How can I limit, perhaps, where is Eq a? He must be good * β Constraint
What I tried:
class (a ~ Maybe b, Eq b) => K a where instance (a ~ Maybe b, Eq b) => K a where
Mistake:
Not in scope: type variable 'b'
Usage example:
data Test c = forall a. (ca) => 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
The general answer is here: Is there a general way to apply restrictions on the type of application?
haskell
2426021684
source share