Pairings between functors.

Based on


type Pairing f g = forall a b c. (a -> b -> c) -> f a -> g b -> c

A pairing between functors f and g.

This asserts that any sums in f can annihilate any products in g, and vice versa.

This library provides some useful pairings, and ways of lifting pairings over various constructions on Functors.

#type (⋈)Source

Operator alias for Data.Functor.Pairing.Pairing (non-associative / precedence 4)


zap :: forall f g a b. f  g -> f (a -> b) -> g a -> b


sym :: forall f g. f  g -> g  f

Pairing is symmetric


identity :: Identity  Identity

The identity functor pairs with itself


productCoproduct :: forall f1 g1 f2 g2. f1  g1 -> f2  g2 -> (Product f1 f2)  (Coproduct g1 g2)

Functor products pair with functor coproducts


stateStore :: forall f g s. f  g -> (StateT s f)  (StoreT s g)

StateT pairs with StoreT.


readerEnv :: forall f g e. f  g -> (ReaderT e f)  (EnvT e g)

ReaderT pairs with EnvT.


writerTraced :: forall f g w. f  g -> (WriterT w f)  (TracedT w g)

WriterT pairs with TracedT.


freeCofree :: forall f g. Functor f => f  g -> (Free f)  (Cofree g)

Free pairs with Cofree.