1
1
mirror of https://github.com/github/semantic.git synced 2024-12-21 22:01:46 +03:00

Define GEq1 instances for a bunch of common functors.

This commit is contained in:
Rob Rix 2017-02-21 16:24:55 -05:00
parent 636e096aab
commit 8884e58f43

View File

@ -3,6 +3,7 @@ module Data.Functor.Classes.Eq.Generic
( genericLiftEq
) where
import Data.Functor.Classes
import GHC.Generics
import Prologue
@ -18,6 +19,14 @@ genericLiftEq :: (Generic1 f, GEq1 (Rep1 f)) => (a -> b -> Bool) -> f a -> f b -
genericLiftEq f a b = gliftEq f (from1 a) (from1 b)
-- Eq1 instances
instance GEq1 [] where gliftEq = liftEq
instance GEq1 Maybe where gliftEq = liftEq
instance Eq a => GEq1 ((,) a) where gliftEq = liftEq
instance Eq a => GEq1 (Either a) where gliftEq = liftEq
-- Generics
instance GEq1 U1 where