Module
Data.Functor.Contravariant
- Package
- purescript-contravariant
- Repository
- purescript/purescript-contravariant
#Contravariant Source
class Contravariant f where
A Contravariant
functor can be seen as a way of changing the input type
of a consumer of input, in contrast to the standard covariant Functor
that can be seen as a way of changing the output type of a producer of
output.
Contravariant
instances should satisfy the following laws:
- Identity
(>$<) id = id
- Composition
(f >$<) <<< (g >$<) = (>$<) (g <<< f)
Members
cmap :: forall b a. (b -> a) -> f a -> f b
#cmapFlipped Source
cmapFlipped :: forall f b a. Contravariant f => f a -> (b -> a) -> f b
cmapFlipped
is cmap
with its arguments reversed.
#(>#<) Source
Operator alias for Data.Functor.Contravariant.cmapFlipped (left-associative / precedence 4)
#coerce Source
coerce :: forall b a f. Contravariant f => Functor f => f a -> f b