[Haskell-cafe] Typeclass resolution errors quite puzzling
tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Mon Aug 15 14:50:03 UTC 2016
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.
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
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!
More information about the Haskell-Cafe