[Haskell-cafe] Strange type error with associated type synonyms

Peter Berry pwberry at gmail.com
Tue Apr 7 11:09:29 EDT 2009


On Mon, Apr 6, 2009 at 7:39 PM, Manuel M T Chakravarty
<chak at cse.unsw.edu.au> wrote:
> Peter Berry:
>
>> 3) we apply appl to x, so Memo d1 a = Memo d a. unify d = d1
>>
>> But for some reason, step 3 fails.
>
> Step 3 is invalid - cf,
> <http://www.haskell.org/pipermail/haskell-cafe/2009-April/059196.html>.
>
>  More generally, the signature of memo_fmap is ambiguous, and hence,
>  correctly rejected.  We need to improve the error message, though.
>  Here is a previous discussion of the subject:
>
>   http://www.mail-archive.com/haskell-cafe@haskell.org/msg39673.html

Aha! Very informative, thanks.

On 07/04/2009, Manuel M T Chakravarty <chak at cse.unsw.edu.au> wrote:
> Matt Morrow:
>> The thing that confuses me about this case is how, if the type sig
>> on memo_fmap is omitted, ghci has no problem with it, and even gives
>> it the type that it rejected:
>
> Basically, type checking proceeds in one of two modes: inferring or
> checking.  The former is when there is no signature is given; the
> latter, if there is a user-supplied signature.  GHC can infer
> ambiguous signatures, but it cannot check them.  This is of course
> very confusing and we need to fix this (by preventing GHC from
> inferring ambiguous signatures).  The issue is also discussed in the
> mailing list thread I cited in my previous reply.

I see. So GHC is wrong to accept memo_fmap?

-- 
Peter Berry <pwberry at gmail.com>
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html


More information about the Haskell-Cafe mailing list