[Haskell-cafe] Type inference for infinite structures

Matt Collins mattcol at gmail.com
Thu Dec 22 19:59:19 EST 2005


Hi everyone,

I'm relatively new to Haskell and was a bit troubled by the problem  
of assigning a type to infinite structures. To give a clear example,  
suppose we have

data Nat = Zero | Succ Nat
omega = Succ omega

What type then does omega have? According to GHCi, omega :: Nat. But  
surely this can only be the case if we already have that omega :: Nat  
(on the right hand side of the equation)?

I can see that the type assignment is valid, but is it necessarily  
the case? Does it not, somehow, sidestep the inductive base case of  
the definition of a Nat?

Thanks,

Matt



More information about the Haskell-Cafe mailing list