[Haskell-cafe] Trouble with types

Daniel Fischer daniel.is.fischer at web.de
Mon Jun 1 09:54:06 EDT 2009


Am Montag 01 Juni 2009 14:44:37 schrieb Vladimir Reshetnikov:
> Hi,
>
> I tried this code:
>
> -----------------------
> f, g :: a -> a
> (f, g) = (id, id)
> -----------------------
>
> Hugs: OK
>
> GHC:
>     Couldn't match expected type `forall a. a -> a'
>            against inferred type `a -> a'
>     In the expression: id
>     In the expression: (id, id)
>     In a pattern binding: (f, g) = (id, id)
>
> What does mean this error message?
> And what of them (Hugs, GHC) is correct?

http://www.haskell.org/ghc/docs/latest/html/users_guide/bugs-and-infelicities.html
Section 12.1.1.4, Declarations and bindings

GHC's typechecker makes all pattern bindings monomorphic by default; this behaviour can be 
disabled with -XNoMonoPatBinds. See Section 7.1, “Language options”.

Hugs is correct, it's a known infelicity in GHC which can be disabled.
>
> Thanks
> Vladimir




More information about the Haskell-Cafe mailing list