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)