pipes-2.5.0: Compositional pipelines

Safe HaskellSafe-Inferred

Control.Proxy.Trans.Writer

Contents

Description

This module provides the proxy transformer equivalent of WriterT.

This module is even stricter than Control.Monad.Trans.Writer.Strict by being strict in the accumulated monoid.

The underlying implementation uses the state monad to avoid quadratic blowup from left-associative binds.

Synopsis

WriterP

newtype WriterP w p a' a b' b m r Source

The strict Writer proxy transformer

Constructors

WriterP 

Fields

unWriterP :: w -> p a' a b' b m (r, w)
 

Instances

Monoid w => ProxyTrans (WriterP w) 
Channel p => Channel (WriterP w p) 
MonadTrans (p a' a b' b) => MonadTrans (WriterP w p a' a b' b) 
MFunctor (p a' a b' b) => MFunctor (WriterP w p a' a b' b) 
Monad (p a' a b' b m) => Monad (WriterP w p a' a b' b m) 
Monad (p a' a b' b m) => Functor (WriterP w p a' a b' b m) 
(Monad (WriterP w p a' a b' b m), MonadPlus (p a' a b' b m)) => MonadPlus (WriterP w p a' a b' b m) 
(Functor (WriterP w p a' a b' b m), Monad (p a' a b' b m)) => Applicative (WriterP w p a' a b' b m) 
(Applicative (WriterP w p a' a b' b m), MonadPlus (p a' a b' b m)) => Alternative (WriterP w p a' a b' b m) 
(Monad (WriterP w p a' a b' b m), MonadIO (p a' a b' b m)) => MonadIO (WriterP w p a' a b' b m) 

runWriterP :: Monoid w => WriterP w p a' a b' b m r -> p a' a b' b m (r, w)Source

Run a WriterP computation, producing the final result and monoid

runWriterK :: Monoid w => (q -> WriterP w p a' a b' b m r) -> q -> p a' a b' b m (r, w)Source

Run a WriterP 'K'leisli arrow, producing the final result and monoid

execWriterP :: (Monad (p a' a b' b m), Monoid w) => WriterP w p a' a b' b m r -> p a' a b' b m wSource

Evaluate a WriterP computation, but discard the final result

execWriterK :: (Monad (p a' a b' b m), Monoid w) => (q -> WriterP w p a' a b' b m r) -> q -> p a' a b' b m wSource

Evaluate a WriterP 'K'leisli arrow, but discard the final result

Writer operations

tell :: (Monad (p a' a b' b m), Monoid w) => w -> WriterP w p a' a b' b m ()Source

Add a value to the monoid

censor :: (Monad (p a' a b' b m), Monoid w) => (w -> w) -> WriterP w p a' a b' b m r -> WriterP w p a' a b' b m rSource

Modify the result of a writer computation