Safe Haskell | Safe-Infered |
---|
The implementations of all functions except for rem, quot, div, mod are supposed to be as non-strict as possible.
- data Nat
- cmpNatLT :: Nat -> Nat -> Ordering
- fromNat :: Num n => Nat -> n
- toNat :: (Integral n, Num n) => n -> Nat
- length :: [a] -> Nat
- take :: Nat -> [a] -> [a]
- drop :: Nat -> [a] -> [a]
- replicate :: Nat -> a -> [a]
- lengthNum :: (Enum n, Num n) => [a] -> n
- takeNum :: (Eq n, Enum n, Num n) => n -> [a] -> [a]
- dropNum :: (Eq n, Enum n, Num n) => n -> [a] -> [a]
- replicateNum :: (Eq n, Enum n, Num n) => n -> a -> [a]
- divmodNat1 :: Nat1 -> Nat1 -> (Nat, Nat)
Datatype
Natural numbers and zero
Helper Functions
cmpNatLT :: Nat -> Nat -> 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.
toNat :: (Integral n, Num n) => n -> NatSource
This is used for the implementation of fromInteger and toEnum.
Example Implementations using Nat
Example Implementations using Num
replicateNum :: (Eq n, Enum n, Num n) => n -> a -> [a]Source