"But why is it saying that overlap is ok?"
Because you told it so with the language pragma.
Note that these instances are not merely overlapping, they are identical, as far as GHC's instance resolution is concerned. GHC knows no way at all to ever distinguish these instances, hence it rejects them. Not even IncoherentInstances
helps with GHC yet. It will help in GHC 7.8, as Joachim Breitner just notified me.
And finally, is what I intend possible in the current GHC in another way (what I intend is to use one piece of code for instances of
Eq
and another for the rest)?
I would not be surprised if the new costraint kinds extensions would make it possible, but I've never worked with them, so I don't know how they work and what they can do. But your code would not look nearly as simple, if it works at all.