Safe Haskell | Safe-Inferred |
---|
Data.Nat
Description
Operations which are undefined mathematically (0 / 0
, infinity * 0
, infinity - infinity
, etc.)
also have undefined results in this implementation.
Documentation
nat :: r -> (Nat -> r) -> Nat -> rSource
Shallow deconstruction. Returns the first argument if Zero
, applies the second argument to the inner value if Succ
.
foldNat :: r -> (r -> r) -> Nat -> rSource
Returns the first argument if Zero
, applies the second argument recursively for each Succ
.