The implementations of all functions except for rem, quot, div, mod are supposed to be as non-strict as possible.
- data NatO
- cmpNatOLT :: NatO -> NatO -> Ordering
- fromNatO :: Num n => NatO -> n
- toNatO :: (Integral n, Num n) => n -> NatO
- length :: [a] -> NatO
- take :: NatO -> [a] -> [a]
- drop :: NatO -> [a] -> [a]
- replicate :: NatO -> a -> [a]
- lengthNum :: (Enum n, Num n) => [a] -> n
- takeNum :: (Enum n, Num n) => n -> [a] -> [a]
- dropNum :: (Enum n, Num n) => n -> [a] -> [a]
- replicateNum :: (Enum n, Num n) => n -> a -> [a]
Datatype
Natural numbers and zero
Helper Functions
cmpNatOLT :: NatO -> NatO -> OrderingSource
This function is used to implement lazy instances of compare and (<), (<=), (>), (>=). It is used to transfer information to more significant bits. Instead of yielding EQ it yields LT if the numbers are equal.
toNatO :: (Integral n, Num n) => n -> NatOSource
This is used for the implementation of fromInteger and toEnum.
Example Implementations using NatO
Example Implementations using Num
replicateNum :: (Enum n, Num n) => n -> a -> [a]Source