[Haskell-cafe] Trouble with types

Vladimir Reshetnikov v.reshetnikov at gmail.com
Tue Jun 2 01:30:59 EDT 2009


Hi Daniel,

Could you please explain what does mean 'monomorphic' in this context?
I thought that all type variables in Haskell are implicitly
universally quantified, so (a -> a) is the same type as (forall a. a
-> a)

Thank you,
Vladimir

On 6/1/09, Daniel Fischer <daniel.is.fischer at web.de> wrote:
> 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
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>


More information about the Haskell-Cafe mailing list