[Haskell] Strange type inference
Lemmih
lemmih at gmail.com
Fri Jul 7 11:19:13 EDT 2006
On 7/7/06, Emil Axelsson <emax at 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
More information about the Haskell
mailing list