Copyright | (c) Ross Paterson 2013 |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | [email protected] |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell2010 |
Data.Functor.Classes
Description
Liftings of the Prelude classes Eq
, Ord
, Read
and Show
to
unary and binary type constructors.
These classes are needed to express the constraints on arguments of
transformers in portable Haskell. Thus for a new transformer T
,
one might write instances like
instance (Eq1 f) => Eq1 (T f) where ... instance (Ord1 f) => Ord1 (T f) where ... instance (Read1 f) => Read1 (T f) where ... instance (Show1 f) => Show1 (T f) where ...
If these instances can be defined, defining instances of the base classes is mechanical:
instance (Eq1 f, Eq a) => Eq (T f a) where (==) = eq1 instance (Ord1 f, Ord a) => Ord (T f a) where compare = compare1 instance (Read1 f, Read a) => Read (T f a) where readPrec = readPrec1 readListPrec = readListPrecDefault instance (Show1 f, Show a) => Show (T f a) where showsPrec = showsPrec1
Since: base-4.9.0.0
Synopsis
- class Eq1 f where