Portability | non-portable (functional-dependencies) |
---|---|

Stability | experimental |

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

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

- newtype ACompF f g a = ACompF (CompF f g a)
- repAdjunction :: Adjunction f g => (f () -> a) -> g a
- unrepAdjunction :: Adjunction f g => g a -> f () -> a

# Documentation

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

An `Adjunction`

formed by the `Functor`

f and `Functor`

g.

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

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

Adjunction Identity Identity | |

Adjunction ((,) e) ((->) e) | |

Adjunction (Coreader e) (Reader e) | |

(Adjunction f1 g1, Adjunction f2 g2) => Adjunction (CompF f2 f1) (CompF g1 g2) |

Adjunction-oriented composition, yields monads and comonads from adjunctions

Composition ACompF | |

MonadState e (ACompF ((->) e) ((,) e)) | |

ComonadContext e (ACompF ((,) e) ((->) e)) | |

Functor f => HFunctor (ACompF f) | |

Adjunction f g => Monad (ACompF g f) | |

(Functor f, Functor g) => Functor (ACompF f g) | |

Adjunction f g => Applicative (ACompF g f) | |

(Full f, Full g) => Full (ACompF f g) | |

(ExpFunctor f, ExpFunctor g) => ExpFunctor (ACompF f g) | |

Adjunction f g => Copointed (ACompF f g) | |

Adjunction f g => Pointed (ACompF g f) | |

Adjunction f g => Comonad (ACompF f g) |

# Every Right Adjoint is Representable

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

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