pipes-3.1.0: Compositional pipelines

Safe HaskellSafe
LanguageHaskell98

Control.MFunctor

Contents

Description

This module temporarily holds this class until it can find a better home.

Synopsis

Functors over Monads

class MFunctor t where Source #

A functor in the category of monads

hoist f . hoist g = hoist (f . g)

hoist id = id

If f is a monad morphism, then hoist f is a monad morphism, meaning that hoistK f = (hoist f .) defines a functor between Kleisli categories:

hoistK f k1 >=> hoistK f k2 = hoistK f (k1 >=> k2)

hoistK f return = return

Minimal complete definition

hoist

Methods

hoist :: Monad m => (forall a. m a -> n a) -> t m b -> t n b Source #

Lift a monad morphism from m to n into a monad morphism from (t m) to (t n)

Instances

MFunctor MaybeT Source # 

Methods

hoist :: Monad m => (forall a. m a -> n a) -> MaybeT m b -> MaybeT n b Source #

MFunctor (WriterT w) Source # 

Methods

hoist :: Monad m => (forall a. m a -> n a) -> WriterT w m b -> WriterT w n b Source #

MFunctor (WriterT w) Source # 

Methods

hoist :: Monad m => (forall a. m a -> n a) -> WriterT w m b -> WriterT w n b Source #

MFunctor (StateT s) Source # 

Methods

hoist :: Monad m => (forall a. m a -> n a) -> StateT s m b -> StateT s n b Source #

MFunctor (StateT s) Source # 

Methods

hoist :: Monad m => (forall a. m a -> n a) -> StateT s m b -> StateT s n b Source #

MFunctor (IdentityT *) Source # 

Methods

hoist :: Monad m => (forall a. m a -> n a) -> IdentityT * m b -> IdentityT * n b Source #

MFunctor (ReaderT * r) Source # 

Methods

hoist :: Monad m => (forall a. m a -> n a) -> ReaderT * r m b -> ReaderT * r n b Source #

MFunctor (RWST r w s) Source # 

Methods

hoist :: Monad m => (forall a. m a -> n a) -> RWST r w s m b -> RWST r w s n b Source #

MFunctor (ProxyFast a' a b' b) Source # 

Methods

hoist :: Monad m => (forall c. m c -> n c) -> ProxyFast a' a b' b m b -> ProxyFast a' a b' b n b Source #

MFunctor (ProxyCorrect a' a b' b) Source # 

Methods

hoist :: Monad m => (forall c. m c -> n c) -> ProxyCorrect a' a b' b m b -> ProxyCorrect a' a b' b n b Source #

Proxy p => MFunctor (IdentityP p a' a b' b) Source # 

Methods

hoist :: Monad m => (forall c. m c -> n c) -> IdentityP p a' a b' b m b -> IdentityP p a' a b' b n b Source #

Proxy p => MFunctor (MaybeP p a' a b' b) Source # 

Methods

hoist :: Monad m => (forall c. m c -> n c) -> MaybeP p a' a b' b m b -> MaybeP p a' a b' b n b Source #

Proxy p => MFunctor (EitherP e p a' a b' b) Source # 

Methods

hoist :: Monad m => (forall c. m c -> n c) -> EitherP e p a' a b' b m b -> EitherP e p a' a b' b n b Source #

Proxy p => MFunctor (ReaderP i p a' a b' b) Source # 

Methods

hoist :: Monad m => (forall c. m c -> n c) -> ReaderP i p a' a b' b m b -> ReaderP i p a' a b' b n b Source #

Proxy p => MFunctor (StateP s p a' a b' b) Source # 

Methods

hoist :: Monad m => (forall c. m c -> n c) -> StateP s p a' a b' b m b -> StateP s p a' a b' b n b Source #

Proxy p => MFunctor (WriterP w p a' a b' b) Source # 

Methods

hoist :: Monad m => (forall c. m c -> n c) -> WriterP w p a' a b' b m b -> WriterP w p a' a b' b n b Source #

hoistK Source #

Arguments

:: (Monad m, MFunctor t) 
=> (forall a. m a -> n a)

Monad morphism

-> (b' -> t m b)

Kleisli arrow

-> b' -> t n b 

Convenience function equivalent to (hoist f .)

raise :: (Monad m, MFunctor t1, MonadTrans t2) => t1 m r -> t1 (t2 m) r Source #

Lift the base monad

raise = hoist lift

raiseK :: (Monad m, MFunctor t1, MonadTrans t2) => (q -> t1 m r) -> q -> t1 (t2 m) r Source #

Lift the base monad of a 'K'leisli arrow

raiseK = hoistK lift