1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 22:31:36 +03:00

📝 genericLiftEq.

This commit is contained in:
Rob Rix 2017-02-21 16:11:10 -05:00
parent 6ecbe9538f
commit 18374a0397

View File

@ -10,6 +10,7 @@ class GEq1 f where
-- The function will usually be applied to an equality function, but the more general type ensures that the implementation uses it to compare elements of the first container with elements of the second.
gliftEq :: (a -> b -> Bool) -> f a -> f b -> Bool
-- | A suitable implementation of Eq1s liftEq for Generic1 types.
genericLiftEq :: (Generic1 f, GEq1 (Rep1 f)) => (a -> b -> Bool) -> f a -> f b -> Bool
genericLiftEq f a b = gliftEq f (from1 a) (from1 b)