
On Mon, Apr 6, 2009 at 7:39 PM, Manuel M T Chakravarty
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
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