During a GHC upgrade we noticed one particular test case seemed to just hang forever (at runtime, not compile time). In searching for a looping bottom value lurking somewhere I found a startling fact, while simplifying an instance declaration:
This exhibited the hanging:
-- Note now-redundant constraint
instance ( Eq (Bar b a)) => Eq (Foo b a) where
_ == _ = False
This did not (the operation finished promptly):
-- constraint removed
instance Eq (Foo b a) where
_ == _ = False
We use UndecidableInstances
heavily and so this question caught my eye, but I don’t see how the variations above could trigger/resolve an infinite loop like the one discussed there.
My question is how the observed behavior could possibly occur, and an answer would hopefully offer a simple reproducer that builds on the snippet here.
FWIW the change in behavior happens between 9.6.6 and 9.8.2