GHC suggests -XIncoherentInstances when it's already on
If I say
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE IncoherentInstances #-}
-- All instances are incoherent because of -XIncoherentInstances
class CallResult r where
instance {-# OVERLAPPABLE #-} CallResult (m b) where
instance {-# OVERLAPPABLE #-} CallResult x where
call :: (CallResult r) => r
call = undefined
partial = call
(reduced from an attempt to write a variadic call
function)
I get
Variadic.hs:12:11: error:
• Overlapping instances for CallResult r0
arising from a use of ‘call’
Matching instances:
instance [overlappable] CallResult x -- Defined at Variadic.hs:7:31
instance [overlappable] CallResult (m b)
-- Defined at Variadic.hs:6:31
(The choice depends on the instantiation of ‘r0’
To pick the first instance above, use IncoherentInstances
when compiling the other instance declarations)
• In the expression: call
In an equation for ‘partial’: partial = call
|
12 | partial = call
|
Notice that I have used -XIncoherentInstances
.