> Not a typechecker bug; more a bizarre consequence of
> overlapping instance decls.
OK, a typechecker misfeature, then, so I'll cross-reply to ghc-users. ;-)
> The instance decl
> instance Holidays a => Eq a
> overlaps with absolutely every other instance decl for Eq.
>
> In order to make Lattice (Inv a) an instance of Eq, we have
> to satisfy Eq (Inv a), since Eq is a superclass of Lattice.
> From the data decl, we can get Eq (Inv a) if we can get Eq a.
> From the instance decl you commented out, we can get Eq a
> if we can get Holidays a. But then we get stuck.
That seems a strange thing to do, really. Isn't the (apparent)
lack of an instance of Eq a, rather than it being sensible to
insist that the superclasses be back-propgated (if I even remotely
understand what's going on here...).
> Admittedly, we can also get Eq a from Lattice a, but GHC's search
> doesn't spot that (I'm not quite certain why).
Aye, there's the rub. That's why I think it's a bug, or at least,
a non-optimal resolution of the overlap. Furthermore, even if
this ought to be rejected, then: a) why is it OK if the above
instance declaration appears in a different module; b) why is
the overlap error in the reported manner, which is _really_ confusing?
(I had to pretty much use 'divide and conquer' on the source program
to just localise the error, never mind understand it.
Slan,
Alex.