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

Manuel M T Chakravarty chak at cse.unsw.edu.au
Tue Apr 7 07:41:22 EDT 2009


Matt Morrow:
> 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
>
> Manuel
>
> 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.

Manuel

PS: I do realise that ambiguous signatures are the single most  
confusing issue concerning type families (at least judging from the  
amount of mailing list traffic generated).  We'll do our best to  
improve the situation before 6.12 comes out.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090407/4742e5c1/attachment.htm


More information about the Haskell-Cafe mailing list