pipes-3.0.0: Compositional pipelines

Safe HaskellSafe
LanguageHaskell98

Control.Proxy.Trans

Contents

Description

You can define your own proxy extensions by writing your own "proxy transformers". Proxy transformers are monad transformers that also correctly lift all proxy operations from the base proxy type to the extended proxy type. Stack multiple proxy transformers to chain features together.

Synopsis

Proxy Transformers

class ProxyTrans t where Source #

Uniform interface to lifting proxies

Minimal complete definition

liftP

Methods

liftP :: (Monad m, Proxy p) => p a' a b' b m r -> t p a' a b' b m r Source #

Instances

ProxyTrans IdentityP Source # 

Methods

liftP :: (Monad m, Proxy p) => p a' a b' b m r -> IdentityP p a' a b' b m r Source #

ProxyTrans MaybeP Source # 

Methods

liftP :: (Monad m, Proxy p) => p a' a b' b m r -> MaybeP p a' a b' b m r Source #

ProxyTrans (EitherP e) Source # 

Methods

liftP :: (Monad m, Proxy p) => p a' a b' b m r -> EitherP e p a' a b' b m r Source #

ProxyTrans (ReaderP i) Source # 

Methods

liftP :: (Monad m, Proxy p) => p a' a b' b m r -> ReaderP i p a' a b' b m r Source #

ProxyTrans (StateP s) Source # 

Methods

liftP :: (Monad m, Proxy p) => p a' a b' b m r -> StateP s p a' a b' b m r Source #

ProxyTrans (WriterP w) Source # 

Methods

liftP :: (Monad m, Proxy p) => p a' a b' b m r -> WriterP w p a' a b' b m r Source #

mapP :: (Monad m, Proxy p, ProxyTrans t) => (q -> p a' a b' b m r) -> q -> t p a' a b' b m r Source #

Lift a Proxy Kleisli arrow

mapP = (lift .)

Laws

mapP defines a functor that preserves five categories:

  • Kleisli category
  • The two Proxy categories
  • "request" category
  • "respond" category

Laws:

  • Functor between Proxy categories
mapP (f >-> g) = mapP f >-> mapP g

mapP idT = idT
mapP (f >~> g) = mapP f >~> mapP g

mapP idPush = idPush
  • Functor between Kleisli categories
mapP (f <=< g) = mapP f <=< mapP g

mapP return = return
  • Functor between "request" categories
mapP (f /</ g) = mapP f /</ mapP g -- when /</ is defined

mapP request = request
  • Functor between "respond" categories
mapP (f \<\ g) = mapP f \<\ mapP g -- when \<\ is defined

mapP respond = respond