Eq1, Ord1, Show1: move from eq1, compare1, showsPrec1 to liftEq, liftCompare, liftShowsPrec

Henning Thielemann lemming at henning-thielemann.de
Mon Jan 11 18:55:40 UTC 2016

On Mon, 11 Jan 2016, Ryan Scott wrote:

>> What are the use cases where eq1 was not powerful enough and liftEq is needed?
> The previous type signature of Data.Functor.Classes in
> transformers-0.4 resulted in some awkward instances, a prime example
> being found in Data.Functor.Compose:
>    import Data.Functor.Classes(Eq1(..))
>    newtype Compose f g a = Compose (f (g a))
>    instance (Functor f, Eq1 f, Eq1 g, Eq a) => Eq (Compose f g a) where
>      Compose x == Compose y = eq1 (fmap Apply x) (fmap Apply y)
>    instance (Functor f, Eq1 f, Eq1 g) => Eq1 (Compose f g) where eq1 = (==)
>    newtype Apply g a = Apply (g a)
>    instance (Eq1 g, Eq a) => Eq (Apply g a) where
>        Apply x == Apply y = eq1 x y

Btw. I already defined my own Apply type (I called it Wrap) because I 
found it useful. Would you mind to export it from 'transformers'?

More information about the Libraries mailing list