Given the following type, how should I implement an instance Eq1?
data Foo a = Bar String | Baz a [a]
instance Eq1 Foo where
liftEq _ (Bar a) (Bar b) = a == b -- can't use f
liftEq f (Baz a aa) (Baz b bb) = f a b && liftEq f aa bb -- instance for lists
liftEq _ _ _ = False
Is the above example true? Should I use it manually in GHC 8.0.2? There is a library deriving-compatthat uses TH, but why is it called -compat?
source
share