[Haskell] Strange type inference

Emil Axelsson emax at cs.chalmers.se
Fri Jul 7 08:11:15 EDT 2006


Hello!

I'm observing a strange type inference result in the program at the end of the 
message.

term1 and term2 have the same definitions, except for a type annotation for 
term2, but GHCi infers the following types:

*Main> :t term1
term1 :: Term ()
*Main> :t term2
term2 :: forall a. Term a

Could anyone please explain this?

Thank you,

/ Emil



-----------------------------------

data Term a = X

class Constructive term a | term -> a where
   construct :: term -> Term a

instance Constructive (Term a) a where
   construct = id

term1 = construct X

term2 :: Term a
term2 = construct X



More information about the Haskell mailing list