Module
Data.Functor.Contravariant
- Package
- purescript-contravariant
- Repository
- purescript/purescript-contravariant
#Contravariant Source
class Contravariant f whereA 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
cmap id = id - Composition
cmap f <<< cmap g = cmap (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 bcmapFlipped 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#imapC Source
imapC :: forall b a f. Contravariant f => (a -> b) -> (b -> a) -> f a -> f bAs all Contravariant functors are also trivially Invariant, this function can be used as the imap implementation for any types that have an existing Contravariant instance.