Contents A right Kan extension monad transformer Representing monads as right Kan extensions Ran Monad Transformers Default definitions for common extension patterns IO, ST s, STM Pointed Functors The Yoneda Lemma The codensity monad of a functor
Synopsis
data Ran m a = Ran {
 getRan :: forall b. (a -> G m b) -> H m b
}
class (Applicative (Ran f), Applicative f, RanIso f) => RApplicative f
class RanIso f where
 type G f :: * -> * type H f :: * -> * liftRan :: f a -> Ran f a lowerRan :: Ran f a -> f a
class RanTrans t where
 liftRanT :: (RanIso m, RanIso (t m)) => Ran m a -> Ran (t m) a outRan :: (RanIso m, RanIso (t m)) => Ran (t m) a -> t (Ran m) a inRan :: (RanIso m, RanIso (t m)) => t (Ran m) a -> Ran (t m) a
returnRanCodensity :: (RanIso m, G m ~ H m) => a -> Ran m a
bindRanCodensity :: (RanIso m, G m ~ H m) => Ran m a -> (a -> Ran m b) -> Ran m b
apRanCodensity :: (RanIso m, G m ~ H m) => Ran m (a -> b) -> Ran m a -> Ran m b
ranCodensity :: Ran (Codensity f) a -> Codensity f a
codensityRan :: Codensity f a -> Ran (Codensity f) a
liftRanCodensity :: (RanIso m, G m ~ H m, Monad (G m)) => G m a -> Ran m a
lowerRanCodensity :: (RanIso m, G m ~ H m, Monad (G m)) => Ran m a -> G m a
liftRanWorld :: (G m ~ World w, H m ~ World w) => (State# w -> (#State# w, a#)) -> Ran m a
lowerRanWorld :: (G m ~ World w, H m ~ World w) => Ran m a -> State# w -> (#State# w, a#)
class Functor f => Pointed f where
 point :: a -> f a
data Yoneda f a = Yoneda {
 getYoneda :: forall b. (a -> b) -> f b
}
lowerYoneda :: Yoneda f a -> f a
data Codensity f a = Codensity {
 getCodensity :: forall b. (a -> f b) -> f b
}
lowerCodensity :: Monad m => Codensity m a -> m a
lowerCodensityApp :: Applicative f => Codensity f a -> f a
lowerCodensityPointed :: Applicative f => Codensity f a -> f a
A right Kan extension monad transformer
 data Ran m a Source
A right Kan extension transformer for a monad
Constructors
Ran
 getRan :: forall b. (a -> G m b) -> H m b Instances
Representing monads as right Kan extensions
 class (Applicative (Ran f), Applicative f, RanIso f) => RApplicative f Source
 class RanIso f where Source
Associated Types
 type G f :: * -> * Source
 type H f :: * -> * Source
Methods
 liftRan :: f a -> Ran f a Source
 lowerRan :: Ran f a -> f a Source Instances
 RanIso IO RanIso STM RanIso Maybe RanIso Identity RanIso ((->) e) RanIso (Either e) RanIso (ST s) Monoid w => RanIso (Writer w) RanIso (State s) RanIso (Reader e) RanIso (Yoneda f) RanIso (Codensity f) RanIso m => RanIso (ReaderT e m) (RanIso m, Error e) => RanIso (ErrorT e m)
 class RanTrans t where Source
Methods
 liftRanT :: (RanIso m, RanIso (t m)) => Ran m a -> Ran (t m) a Source
 outRan :: (RanIso m, RanIso (t m)) => Ran (t m) a -> t (Ran m) a Source
 inRan :: (RanIso m, RanIso (t m)) => t (Ran m) a -> Ran (t m) a Source Instances
 RanTrans (ReaderT e) RanTrans (ErrorT e)
Default definitions for common extension patterns
 returnRanCodensity :: (RanIso m, G m ~ H m) => a -> Ran m a Source
 bindRanCodensity :: (RanIso m, G m ~ H m) => Ran m a -> (a -> Ran m b) -> Ran m b Source
 apRanCodensity :: (RanIso m, G m ~ H m) => Ran m (a -> b) -> Ran m a -> Ran m b Source
 ranCodensity :: Ran (Codensity f) a -> Codensity f a Source
 codensityRan :: Codensity f a -> Ran (Codensity f) a Source
 liftRanCodensity :: (RanIso m, G m ~ H m, Monad (G m)) => G m a -> Ran m a Source
 lowerRanCodensity :: (RanIso m, G m ~ H m, Monad (G m)) => Ran m a -> G m a Source
IO, ST s, STM
 liftRanWorld :: (G m ~ World w, H m ~ World w) => (State# w -> (#State# w, a#)) -> Ran m a Source
 lowerRanWorld :: (G m ~ World w, H m ~ World w) => Ran m a -> State# w -> (#State# w, a#) Source
Pointed Functors
 class Functor f => Pointed f where Source
A pointed functor is a functor with a discriminated family of f-coalgebras
Methods
 point :: a -> f a Source Instances
The Yoneda Lemma
 data Yoneda f a Source
The Covariant Yoneda lemma applied to a functor. Note that f need not be a Hask Functor!
Constructors
Yoneda
 getYoneda :: forall b. (a -> b) -> f b Instances Instances