Copyright | (c) Conal Elliott 2009-2012 |
---|---|
License | BSD3 |
Maintainer | [email protected] |
Stability | experimental |
Safe Haskell | Safe |
Language | Haskell98 |
TypeUnary.Nat
Description
Experiment in length-typed vectors
- module TypeUnary.TyNat
- data Nat :: * -> * where
- predN :: Nat (S n) -> Nat n
- zero :: Nat N0
- one :: Nat N1
- two :: Nat N2
- three :: Nat N3
- four :: Nat N4
- withIsNat :: (IsNat n => Nat n -> a) -> Nat n -> a
- natSucc :: Nat n -> Nat (S n)
- natIsNat :: Nat n -> IsNat n => Nat n
- natToZ :: Num a => Nat n -> a
- natEq :: Nat m -> Nat n -> Maybe (m :=: n)
- natAdd :: Nat m -> Nat n -> Nat (m :+: n)
- natMul :: forall m n. Nat m -> Nat n -> Nat (m :*: n)
- class IsNat n where
- induction :: forall p. p Z => (forall n. IsNat n => Dict (p n) -> Dict (p (S n))) -> forall n. IsNat n => Dict (p n)
- class (n :+: Z) ~ n => PlusZero n
- plusZero :: IsNat n => Dict (PlusZero n)
- data m :<: n where
- succLim :: (m :<: n) -> m :<: S n
- data Index lim = IsNat n => Index (n :<: lim) (Nat n)
- unIndex :: Num a => Index m -> a
- succI :: Index m -> Index (S m)
- index0 :: Index (N1 :+: m)
- index1 :: Index (N2 :+: m)
- index2 :: Index (N3 :+: m)
- index3 :: Index (N4 :+: m)
- coerceToIndex :: (Eq i, Show i, Num i, IsNat m) => i -> Index m
Documentation
module TypeUnary.TyNat
Value-typed natural numbers
Is n
a natural number type?
Minimal complete definition
induction :: forall p. p Z => (forall n. IsNat n => Dict (p n) -> Dict (p (S n))) -> forall n. IsNat n => Dict (p n) Source #
Peano's induction principle
Inequality proofs and indices
A number under the given limit, with proof