- class (Contravariant f, Contravariant 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

- class (Contravariant f, Contravariant g) => DualAdjunction f g | f -> g, g -> f where
- unitOp :: g (f a) -> a
- counitOp :: f (g a) -> a
- leftAdjunctOp :: (f a -> b) -> g b -> a
- rightAdjunctOp :: (g b -> a) -> f a -> b

- data Representation f x = Representation {}
- repAdjunction :: Adjunction f g => Representation g (f ())
- repFlippedAdjunction :: Adjunction f g => Representation f (g ())

# Documentation

class (Contravariant f, Contravariant 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

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

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

Adjunction Predicate Predicate | This gives rise to the Cont Bool monad |

Adjunction (Op r) (Op r) | This adjunction gives rise to the Cont monad |

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

An adjunction from Hask to Hask^op

Hask (f a) b ~ Op a (g b)

rightAdjunct unit = id leftAdjunct counit = id

counitOp :: f (g a) -> aSource

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

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

repAdjunction :: Adjunction f g => Representation g (f ())Source

Represent a contravariant functor that has a left adjoint

repFlippedAdjunction :: Adjunction f g => Representation f (g ())Source