[Haskell-cafe] Typeclass resolution errors quite puzzling
David Feuer
david.feuer at gmail.com
Mon Aug 15 17:26:26 UTC 2016
For what it's worth, I also think it would be really useful to get a trace
of the constraint simplification when there's a resolution failure.
Unification could make some bits hard to understand, but anything would be
better than nothing.
On Aug 15, 2016 10:50 AM, "Tom Ellis" <
tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote:
> On Mon, Aug 15, 2016 at 03:40:46PM +0100, Malcolm Wallace wrote:
> > It is no surprise that the instance Eq A is not mentioned, because there
> > is a perfectly valid instance for it already, and it contains no error.
>
> I disagree.
>
> There is no valid instance for Eq (A B), because all that the compiler
> knows
> is that 'Eq B => Eq (A B)', and there is no 'Eq B'.
>
> There are two separate issues here.
>
> 1. The reason the compilation fails is that there is no instance 'Eq (A
> B)'.
>
> 2. The reason there is no instance 'Eq (A B)' is that there is no instance
> 'Eq B'.
>
> In my opinion it would be most helpful to the user to mention both 1 and 2.
> In fact it's likely to be very confusing if you don't mention both of them!
>
> Tom
> _______________________________________________
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160815/fb7c2c83/attachment.html>
More information about the Haskell-Cafe
mailing list