ambiguous type stuff

David Feuer david.feuer at gmail.com
Sun Dec 6 01:16:08 UTC 2015


I think I didn't explain myself well enough. I'm not talking about expanded
defaulting, although that may be tied up with the same mechanisms. Perhaps
the best thing is just to work on the error message text for certain
ambiguous type situations. Notably, situations where adding a proxy
argument or similar is needed to avoid the error tend to be pretty
mysterious until you realize that the system is not complaining because it
can't determine a type, but rather because there is no way to pinpoint that
type at the use site.

If F is a type family then

f :: Foo x => F x

has a perfectly sensible translation, namely

f :: forall x . Foo x -> F x

The problem is purely one of inference on the Haskell side: there is no way
to add a signature *at the call site* that determines what value of x to
pass to f. The error message about x being ambiguous because F is a type
family has to be read a bit backwards. At a *use site*, it'll be pretty
clear-cut what's ambiguous, and it will soon become clear why it can't be
pinned down. Perhaps it would pay to change the error message to explain
why the type signature renders the term unusable.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20151205/23ff751e/attachment.html>


More information about the ghc-devs mailing list