Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. data Zero
  2. data Succ n
  3.  
  4. type One = Succ Zero
  5. type Two = Succ One
  6. type Four = Succ (Succ Two)
  7. type Six = Succ (Succ Four)
  8. type Eight = Succ (Succ Six)
  9.  
  10. class Nat n where
  11.   toInt :: n -> Int
  12.  
  13. instance Nat Zero where
  14.   toInt _ = 0
  15.  
  16. instance (Nat n) => Nat (Succ n) where
  17.   toInt _ = 1 + toInt (undefined::n)