Disabling warnings breaks instance resolution
This snippet:
{-# OPTIONS_GHC -Wno-all #-}
main = print $ Just () == Nothing
fails with
<source>:2:24: error: [GHC-39999]
* No instance for `Eq (Maybe ())' arising from a use of `=='
* In the second argument of `($)', namely `Just () == Nothing'
In the expression: print $ Just () == Nothing
In an equation for `main': main = print $ Just () == Nothing
|
2 | main = print $ Just () == Nothing
|
Removing -Wno-all makes compilation succeed.
I checked multiple GHC versions and the last one that didn't have this rather peculiar behavior is GHC-8.4.4.
I get a different error message locally:
• Overlapping instances for Eq (Maybe Int)
arising from a use of ‘==’
Matching instance:
instance Eq a => Eq (Maybe a) -- Defined in ‘GHC.Maybe’
There exists a (perhaps superclass) match:
(To pick the first instance above, use IncoherentInstances
when compiling the other instance declarations)
which also goes away if I remove -Wno-all. This is with GHC-9.6.6.
