7 Jul
2006
7 Jul
'06
3:19 p.m.
On 7/7/06, Emil Axelsson <emax@cs.chalmers.se> wrote:
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?
It's because of the monomorphism restriction which is widely regarded as one of the uglier parts of Haskell. You can turn it off with -fno-monomorphism-restriction and read more about it here: http://haskell.org/onlinereport/decls.html#sect4.5.5 -- Friendly, Lemmih