adjunctions-0.2: Adjunctions

Data.Functor.Contravariant.Adjunction

Synopsis

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

Methods

unit :: a -> g (f a)Source

counit :: a -> f (g a)Source

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

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

Instances

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

Methods

unitOp :: g (f a) -> aSource

counitOp :: f (g a) -> aSource

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

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

data Representation f x Source

A representation of a contravariant functor

Constructors

Representation 

Fields

rep :: forall a. (a -> x) -> f a
 
unrep :: forall a. f a -> a -> x
 

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

Represent a contravariant functor that has a left adjoint