adjunctions-4.4: Adjunctions and representable functors

Copyright(C) 2011 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityprovisional
PortabilityMPTCs, fundeps
Safe HaskellSafe
LanguageHaskell98

Control.Monad.Trans.Contravariant.Adjoint

Description

Uses a contravariant adjunction:

f -| g : Hask^op -> Hask

to build a Comonad to Monad transformer. Sadly, the dual construction, which builds a Comonad out of a Monad, is uninhabited, because any Adjunction of the form

f -| g : Hask -> Hask^op

would trivially admit unsafePerformIO.

Documentation

runAdjoint :: Contravariant g => Adjoint f g a -> g (f a) Source #

adjoint :: Contravariant g => g (f a) -> Adjoint f g a Source #

newtype AdjointT f g w a Source #

Constructors

AdjointT 

Fields

Instances

(Adjunction f g, Comonad w) => Monad (AdjointT f g w) Source # 

Methods

(>>=) :: AdjointT f g w a -> (a -> AdjointT f g w b) -> AdjointT f g w b #

(>>) :: AdjointT f g w a -> AdjointT f g w b -> AdjointT f g w b #

return :: a -> AdjointT f g w a #

fail :: String -> AdjointT f g w a #

(Adjunction f g, Functor w) => Functor (AdjointT f g w) Source # 

Methods

fmap :: (a -> b) -> AdjointT f g w a -> AdjointT f g w b #

(<$) :: a -> AdjointT f g w b -> AdjointT f g w a #

(Adjunction f g, Comonad w) => Applicative (AdjointT f g w) Source # 

Methods

pure :: a -> AdjointT f g w a #

(<*>) :: AdjointT f g w (a -> b) -> AdjointT f g w a -> AdjointT f g w b #

liftA2 :: (a -> b -> c) -> AdjointT f g w a -> AdjointT f g w b -> AdjointT f g w c #

(*>) :: AdjointT f g w a -> AdjointT f g w b -> AdjointT f g w b #

(<*) :: AdjointT f g w a -> AdjointT f g w b -> AdjointT f g w a #