adjunctions-0.6.0: Adjunctions

Portabilityrank 2 types, MPTCs, fundeps
Stabilityexperimental
MaintainerEdward Kmett <ekmett@gmail.com>

Data.Functor.Adjunction

Description

 

Synopsis

Documentation

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

An adjunction between Hask and Hask.

 rightAdjunct unit = id
 leftAdjunct counit = id 

Methods

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

counit :: f (g a) -> aSource

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

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

Instances

distributeAdjunct :: (Adjunction f g, Functor w) => w (g a) -> g (w a)Source

Every right adjoint is representable by its left adjoint applied to unit Consequently, we use the isomorphism from ((->) f ()) ~ g to distribute the right adjoint over any other functor.

data Representation f x Source

Constructors

Representation 

Fields

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