| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
TypeLevel.Nat
Description
Type-level Peano arithmetic.
Documentation
>>>import Test.QuickCheck>>>:{instance Arbitrary Nat where arbitrary = fmap (fromInteger . getNonNegative) arbitrary :}
Peano numbers. Care is taken to make operations as lazy as possible:
>>>1 > S (S undefined)False>>>Z > undefinedFalse>>>3 + (undefined :: Nat) >= 3True
Instances
| Bounded Nat Source # | The maximum bound here is infinity. (maxBound :: Nat) > n |
| Enum Nat Source # | Uses custom
|
| Eq Nat Source # | |
| Integral Nat Source # | Not at all optimized.
|
| Data Nat Source # | |
| Num Nat Source # | Subtraction stops at zero. n >= m ==> m - n == Z |
| Ord Nat Source # | As lazy as possible |
| Read Nat Source # | Reads the integer representation. |
| Real Nat Source # | Reasonably expensive. |
| Show Nat Source # | Shows integer representation. |
| Generic Nat Source # | |
| NFData Nat Source # | Will obviously diverge for values like |
| type Rep Nat Source # | |
| data The Nat Source # | Singleton for type-level Peano numbers. |