| Copyright | Copyright (C) 2015 Kyle Carter |
|---|---|
| License | BSD3 |
| Maintainer | Kyle Carter <kylcarte@indiana.edu> |
| Stability | experimental |
| Portability | RankNTypes |
| Safe Haskell | None |
| Language | Haskell2010 |
Type.Family.Nat
Description
Type-level natural numbers, along with frequently used type families over them.
- data N
- fromInt :: Int -> Maybe N
- type family IsZero x :: Bool
- zeroCong :: (x ~ y) :- (IsZero x ~ IsZero y)
- zNotS :: (Z ~ S x) :- Fail
- type family NatEq x y :: Bool
- type family Iota x :: [N]
- iotaCong :: (x ~ y) :- (Iota x ~ Iota y)
- type family Pred x :: N
- predCong :: (x ~ y) :- (Pred x ~ Pred y)
- type family x + y :: N
- addCong :: (w ~ y, x ~ z) :- ((w + x) ~ (y + z))
- type family x * y :: N
- mulCong :: (w ~ y, x ~ z) :- ((w * x) ~ (y * z))
- type family x ^ y :: N
- expCong :: (w ~ y, x ~ z) :- ((w ^ x) ~ (y ^ z))
- type family Len as :: N
- lenCong :: (as ~ bs) :- (Len as ~ Len bs)
- type family Ix x as :: k
- ixCong :: (x ~ y, as ~ bs) :- (Ix x as ~ Ix y bs)
- type N0 = Z
- type N1 = S N0
- type N2 = S N1
- type N3 = S N2
- type N4 = S N3
- type N5 = S N4
- type N6 = S N5
- type N7 = S N6
- type N8 = S N7
- type N9 = S N8
- type N10 = S N9
Documentation
Instances
| Eq N Source | |
| Ord N Source | |
| Show N Source | |
| TestEquality N Nat | |
| Read1 N Nat Source | |
| Read1 N Fin Source | |
| Show1 N Nat Source | |
| Show1 N Fin Source | |
| Ord1 N Nat Source | |
| Ord1 N Fin Source | |
| Eq1 N Nat Source | |
| Eq1 N Fin Source | |
| Known N Nat Z Source | |
| Known N Nat n => Known N Nat (S n) Source | If |
| (~) N n' (Pred n) => Witness ØC ((~) N (S n') n) (Fin n) Source | A That is, |
| Witness ØC (Known N Nat n) (Nat n) Source | A |
| Witness ØC (Known N Nat n) (VT k n f a) Source | |
| type (==) N x y = NatEq x y Source | |
| type KnownC N Nat Z = ØC | |
| type KnownC N Nat (S n) = Known N Nat n Source | |
| type WitnessC ØC ((~) N (S n') n) (Fin n) = (~) N n' (Pred 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 |