Module
Data.Bifunctor
- Package
- purescript-bifunctors
- Repository
- purescript/purescript-bifunctors
#Bifunctor Source
class Bifunctor :: (Type -> Type -> Type) -> Constraint
class Bifunctor f where
A Bifunctor
is a Functor
from the pair category (Type, Type)
to Type
.
A type constructor with two type arguments can be made into a Bifunctor
if
both of its type arguments are covariant.
The bimap
function maps a pair of functions over the two type arguments
of the bifunctor.
Laws:
- Identity:
bimap identity identity == identity
- Composition:
bimap f1 g1 <<< bimap f2 g2 == bimap (f1 <<< f2) (g1 <<< g2)
Members
bimap :: forall a b c d. (a -> b) -> (c -> d) -> f a c -> f b d