arrows-0.2: Arrow classes and transformersSource codeContentsIndex
Control.Arrow.Transformer.Writer
Portabilitynon-portable (multi-parameter type classes)
Stabilityexperimental
Maintainerross@soi.city.ac.uk
Description
Arrow transformer that adds accumulation of output.
Synopsis
data WriterArrow w a b c
runWriter :: (Arrow a, Monoid w) => WriterArrow w a e b -> a e (b, w)
class (ArrowWriter w a, Arrow a') => ArrowAddWriter w a a' | a -> a' where
liftWriter :: a' e b -> a e b
elimWriter :: a e b -> a' e (b, w)
Documentation
data WriterArrow w a b c Source
An arrow type that augments an existing arrow with accumulating output. The ArrowWriter class contains the relevant operations.
show/hide Instances
runWriter :: (Arrow a, Monoid w) => WriterArrow w a e b -> a e (b, w)Source

Encapsulation of a writer computation, providing the accumulated output.

Typical usage in arrow notation:

	proc p -> do
		...
		(result, output) <- (|runWriter cmd|)
class (ArrowWriter w a, Arrow a') => ArrowAddWriter w a a' | a -> a' whereSource

Adding a Control.Arrow.Transformer.Writer.WriterArrow to an arrow type, but not necessarily as the outer arrow transformer.

Typically a composite arrow type is built by applying a series of arrow transformer to a base arrow (usually either a function arrow or a Kleisli arrow. One can add a transformer to the top of this stack using the Control.Arrow.Transformer.lift method of the Control.Arrow.Transformer.ArrowTransformer class, or remove a state transformer from the top of the stack using the Control.Arrow.Transformer.Writer.runWriter encapsulation operator. The methods of this class add and remove state transformers anywhere in the stack. In the instance

	instance Arrow a => ArrowAddWriter w (ArrowWriter w a) a

they are equivalent to Control.Arrow.Transformer.lift and Control.Arrow.Transformer.Writer.runWriter respectively. Instances are lifted through other transformers with

	instance ArrowAddWriter w a a' =>
		ArrowAddWriter w (FooArrow a) (FooArrow a')
Methods
liftWriter :: a' e b -> a e bSource
elimWriter :: a e b -> a' e (b, w)Source
show/hide Instances
Produced by Haddock version 2.3.0