Copyright | Copyright (C) 2015 Kyle Carter |
---|---|
License | BSD3 |
Maintainer | Kyle Carter <kylcarte@indiana.edu> |
Stability | experimental |
Portability | RankNTypes |
Safe Haskell | None |
Language | Haskell2010 |
A singleton
-esque type for representing Peano natural numbers.
- data Nat :: N -> * where
- _Z :: Z :~: Z
- _S :: (x :~: y) -> S x :~: S y
- _s :: (S x :~: S y) -> x :~: y
- _ZneS :: (Z :~: S x) -> Void
- addZ :: Nat x -> (x + Z) :~: x
- addS :: Nat x -> Nat y -> S (x + y) :~: (x + S y)
- (.+) :: Nat x -> Nat y -> Nat (x + y)
- (.*) :: Nat x -> Nat y -> Nat (x * y)
- (.^) :: Nat x -> Nat y -> Nat (x ^ y)
- elimNat :: p Z -> (forall x. Nat x -> p x -> p (S x)) -> Nat n -> p n
- natVal :: Nat n -> Int
Documentation
data Nat :: N -> * where Source
TestEquality N Nat Source | |
Read1 N Nat Source | |
Show1 N Nat Source | |
Ord1 N Nat Source | |
Eq1 N Nat Source | |
Known N Nat Z Source | |
Known N Nat n => Known N Nat (S n) Source | If |
Witness ØC (Known N Nat n) (Nat n) Source | A |
Witness ØC (Known N Nat n) (VT k n f a) Source | |
Eq (Nat n) Source | |
Ord (Nat n) Source | |
Show (Nat n) Source | |
type KnownC N Nat Z = ØC | |
type KnownC N Nat (S n) = Known N Nat n Source | |
type WitnessC ØC (Known N Nat n) (Nat n) = ØC | |
type WitnessC ØC (Known N Nat n) (VT k n f a) = ØC |