In the following example:
{-# LANGUAGE UndecidableInstances, FlexibleInstances #-}
class Functor f => C f where c :: f Int
instance (Functor f, Applicative f) => C f where c = pure 42
Compiling in GHC 9.2.3 using -Wredundant-constraints
produces the following warning:
test.hs:5:10: warning: [-Wredundant-constraints]
• Redundant constraint: Functor f
• In the instance declaration for ‘C f’
|
5 | instance (Functor f, Applicative f) => C f where c = pure 42
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
While the constraint intuitively seems redundant, in the case of instance contexts it is in fact necessary, by design, as described here
As in previous GHC versions, like 9.0.2, no warning should be given in this case.