How can I constrain to Maybe a where Eq a? It needs to be of kind * -> Constraint
What I tried:
class (a ~ Maybe b, Eq b) => K a where
instance (a ~ Maybe b, Eq b) => K a where
Error:
Not in scope: type variable ‘b’
Example Usage:
data Test c = forall a. (c a) => Test a
r :: Test K -> Maybe Bool
r (Test o) = (==) <$> o <*> o -- I need GHC to infer that o is Maybe Eq
Cases that work:
pp :: Test ((~) String) -> String
pp (Test o) = o ++ "X" -- GHC infers that o is a string
hh :: Test Eq -> Bool
hh (Test o) = o == o -- GHC infers that o is Eq
Generic answer here: Is there a general way to apply constraints to a type application?