Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data Zero
- data Succ n
- type One = Succ Zero
- type Two = Succ One
- type Four = Succ (Succ Two)
- type Six = Succ (Succ Four)
- type Eight = Succ (Succ Six)
- class Nat n where
- toInt :: n -> Int
- instance Nat Zero where
- toInt _ = 0
- instance (Nat n) => Nat (Succ n) where
- toInt _ = 1 + toInt (undefined::n)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement