Portability | MPTCs |
---|---|

Stability | provisional |

Maintainer | Edward Kmett <ekmett@gmail.com> |

Safe Haskell | Trustworthy |

- class (Contravariant f, Representable g) => Adjunction f g | f -> g, g -> f where
- unit :: a -> g (f a)
- counit :: a -> f (g a)
- leftAdjunct :: (b -> f a) -> a -> g b
- rightAdjunct :: (a -> g b) -> b -> f a

- adjuncted :: (Adjunction f g, Profunctor p, Functor h) => p (a -> g b) (h (c -> g d)) -> p (b -> f a) (h (d -> f c))
- contrarepAdjunction :: Adjunction f g => (a -> f ()) -> g a
- coindexAdjunction :: Adjunction f g => g a -> a -> f ()

# Documentation

class (Contravariant f, Representable g) => Adjunction f g | f -> g, g -> f whereSource

An adjunction from `Hask^op`

to `Hask`

`Op`

(f a) b ~`Hask`

a (g b)

`rightAdjunct`

`unit`

=`id`

`leftAdjunct`

`counit`

=`id`

Any adjunction from `Hask`

to `Hask^op`

would indirectly
permit `unsafePerformIO`

, and therefore does not exist.

leftAdjunct :: (b -> f a) -> a -> g bSource

rightAdjunct :: (a -> g b) -> b -> f aSource

Adjunction Predicate Predicate | This gives rise to the |

Adjunction (Op r) (Op r) | This |

adjuncted :: (Adjunction f g, Profunctor p, Functor h) => p (a -> g b) (h (c -> g d)) -> p (b -> f a) (h (d -> f c))Source

`leftAdjunct`

and `rightAdjunct`

form two halves of an isomorphism.

This can be used with the combinators from the `lens`

package.

`adjuncted`

::`Adjunction`

f g =>`Iso'`

(b -> f a) (a -> g b)

contrarepAdjunction :: Adjunction f g => (a -> f ()) -> g aSource

Represent a `Contravariant`

functor that has a left adjoint

coindexAdjunction :: Adjunction f g => g a -> a -> f ()Source