Documentation: alleged UndecidableInstances loopiness doesn't loop
The example code in the User Guide for the UndecidableInstances extension that is alleged "would make the typechecker loop", doesn't:
class D a class F a b | a->b instance F [a] [[a]] instance (D c, F a c) => D [a] -- 'c' is not mentioned in the head
That is with
fD :: (D x, Show x) => x -> String fD x = show x y = fD [[()]]
The constraint checking from wanted
D [[()]] to
F [()] c strips away one
[ ]. The improvement
F [()] [[()]] puts it back. Presumably the
D c constraint i.e.
D [[()]] says: oh, I've already seen a wanted like that, no need to check it again. (Perhaps it didn't used to be so smart.)
D instance to this, and the typechecker does loop
instance (D c, F [a] c) => D [a]
GHC 8.6.4 on Windows architecture.
(The other example discussed there, with the "somewhat strange" definition using
.*. does indeed cause loopiness.)
P.S. might it be an idea to offer a documentation template? The 'bug' template didn't seem to apply. I've put a 'documentation' Label.