FlexibleInstances / UndecidableInstances confusion
Consider the following code:
class Foo a bar :: Foo a => Int bar = 0
Compiling this code with no extensions correctly reports an error that
bar is inherently ambiguous.
However, if I enable
-XUndecidableInstances, the ambiguity error disappears, though I still cannot declare
instance Foo a. On the other hand, if I enable
-XFlexibleInstances, the ambiguity error remains, even though I can now declare
instance Foo a.
I believe that the problem is due to confusion in the note
[The ambiguity check for type signatures] in
typecheck/TcMType.lhs. That note refers to
UndecidableInstances where I believe it means
FlexibleInstances. The code immediately below (line 1378, in function
checkAmbiguity) also uses
UndecidableInstances where it would seem to want
I would fix this myself, but I don't feel confident enough in this wing of GHC to know this is the right change!