From 8884e58f4384d024ce14cc153053f75acfd52a16 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 21 Feb 2017 16:24:55 -0500 Subject: [PATCH] Define GEq1 instances for a bunch of common functors. --- src/Data/Functor/Classes/Eq/Generic.hs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Data/Functor/Classes/Eq/Generic.hs b/src/Data/Functor/Classes/Eq/Generic.hs index 4a82f5fb0..d5c742a9b 100644 --- a/src/Data/Functor/Classes/Eq/Generic.hs +++ b/src/Data/Functor/Classes/Eq/Generic.hs @@ -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