pipes-3.1.0: Compositional pipelines

Safe HaskellSafe-Inferred

Control.MFunctor

Contents

Description

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

Synopsis

Functors over Monads

class MFunctor t whereSource

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

Methods

hoistSource

Arguments

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

Monad morphism

-> t m b 
-> t n b 

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

Instances

MFunctor MaybeT 
MFunctor IdentityT 
MFunctor (WriterT w) 
MFunctor (WriterT w) 
MFunctor (StateT s) 
MFunctor (StateT s) 
MFunctor (ReaderT r) 
MFunctor (RWST r w s) 
MFunctor (ProxyFast a' a b' b) 
MFunctor (ProxyCorrect a' a b' b) 
Proxy p => MFunctor (IdentityP p a' a b' b) 
Proxy p => MFunctor (MaybeP p a' a b' b) 
Proxy p => MFunctor (EitherP e p a' a b' b) 
Proxy p => MFunctor (ReaderP i p a' a b' b) 
Proxy p => MFunctor (StateP s p a' a b' b) 
Proxy p => MFunctor (WriterP w p a' a b' b) 

hoistKSource

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) rSource

Lift the base monad

 raise = hoist lift

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

Lift the base monad of a 'K'leisli arrow

 raiseK = hoistK lift