Closed MaximilianAlgehed closed 4 months ago
While this does not alleviate the concern in #84 about GHC picking the "shrink to empty list" instance when it can't conclude that two types are equal, it does make the rules for choosing instances more clear. I'm not convinced that the issue raised in #84 is real, however.
It's not clear why the old code ever worked, possibly because
GSubtermsIncl (K1 i a) a
is a substitution ofGSubtermsIncl (K1 i a) b
...
Yes, that's why. The extra OVERLAPPING
annotation was not ambiguous, but unnecessary.
As per the following documentation for how OVERLAPPING resolves (that I'm 99% sure is the same across all GHC versions) https://downloads.haskell.org/~ghc/7.10.1/docs/html/users_guide/type-class-extensions.html#instance-overlap the way that ghc resolves
OVERLAPPING
pragmas is that an instance that isOVERLAPPING
will be chosen over one that isn't. It's not clear why the old code ever worked, possibly becauseGSubtermsIncl (K1 i a) a
is a substitution ofGSubtermsIncl (K1 i a) b
...Anway, with this change it's explicit that the
GSubtermsIncl (K1 i a) a
instance will be chosen over theGSubtermsIncl (K1 i a) b
instance.