[Haskell-cafe] problem with compiler error message

Li-yao Xia lysxia at gmail.com
Tue Nov 21 13:02:44 UTC 2017


Hi Dmitry,

This is indeed a GHC bug. Here's an existing ticket about it, it seems 
to be fixed for the next release of GHC.

https://ghc.haskell.org/trac/ghc/ticket/14000

Cheers,
Li-yao

On 11/21/2017 04:51 AM, Dmitry Olshansky wrote:
> GHCi 8.2.1.
> 
> 2017-11-21 10:48 GMT+03:00 Dmitry Olshansky <olshanskydr at gmail.com>:
> 
>> Hello cafe!
>>
>> It seems that this behavior is wrong:
>>
>>> class Foo a where { type Bar a; baz :: a -> Bar a }
>>> baz zzz         -- zzz is not in scope
>> <interactive>:17:1: error:
>>      • Couldn't match expected type ‘Bar a’ with actual type ‘Bar a0’
>>        NB: ‘Bar’ is a type function, and may not be injective
>>        The type variable ‘a0’ is ambiguous
>>      • In the ambiguity check for the inferred type for ‘it’
>>        To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
>>        When checking the inferred type
>>          it :: forall a. Bar a
>>
>> As opposite - correct behavior:
>>> :t negate
>> negate :: Num a => a -> a
>>> negate zzz
>> <interactive>:19:8: error: Variable not in scope: zzz
>>
>> Best regards,
>> Dmitry
>>
> 
> 
> 
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
> 


More information about the Haskell-Cafe mailing list