-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | data Nat = Zero | Succ Nat -- -- The usual data Nat = Zero | Succ Nat datatype with the -- appropriate instances. -- -- Should be portable to any Haskell 98 compiler which supports the -- CPP extension. @package data-nat @version 0.1 -- | Operations which are undefined mathematically (0 / 0, -- infinity * 0, infinity - infinity, etc.) also have -- undefined results in this implementation. module Data.Nat data Nat Zero :: Nat Succ :: Nat -> Nat -- | Shallow deconstruction. Returns the first argument if Zero, -- applies the second argument to the inner value if Succ. nat :: r -> (Nat -> r) -> Nat -> r -- | Returns the first argument if Zero, applies the second -- argument recursively for each Succ. foldNat :: r -> (r -> r) -> Nat -> r -- | Build a Nat from a seed value: the first argument should -- return the next seed value if the building is to continue, or -- Nothing if it is to stop. A Succ is added at each -- iteration. unfoldNat :: (a -> Maybe a) -> a -> Nat -- | Very big! infinity :: Nat -- |
-- diff n m | n >= m = Right (n - m) -- | otherwise = Left (m - n) --diff :: Nat -> Nat -> Either Nat Nat instance Typeable Nat instance Eq Nat instance Ord Nat instance Read Nat instance Show Nat instance Generic Nat instance Datatype D1Nat instance Constructor C1_0Nat instance Constructor C1_1Nat instance Ix Nat instance Whole Nat instance Integral Nat instance Real Nat instance Num Nat instance Bounded Nat instance Enum Nat