peano.hs 208 B

12345678
  1. data Nat = Zero | Succ Nat deriving Show
  2. intValOf thisNat = case thisNat of
  3. Zero -> 0
  4. Succ nextNat -> 1 + intValOf nextNat
  5. natValOf thisInt = if thisInt == 0 then Zero else Succ (natValOf (thisInt - 1))