arrows-0.4.1: Arrow classes and transformersSource codeContentsIndex
Control.Arrow.Transformer.Reader
Portabilitynon-portable (multi-parameter type classes)
Stabilityexperimental
Maintainerross@soi.city.ac.uk
Description
Arrow transformer that adds a read-only state (i.e. an environment).
Synopsis
data ReaderArrow r a b c
runReader :: Arrow a => ReaderArrow r a e b -> a (e, r) b
class (ArrowReader r a, Arrow a') => ArrowAddReader r a a' | a -> a' where
liftReader :: a' e b -> a e b
elimReader :: a e b -> a' (e, r) b
Documentation
data ReaderArrow r a b c Source
An arrow type that augments an existing arrow with a read-only state (or environment). The ArrowReader class contains the operations on this state.
show/hide Instances
runReader :: Arrow a => ReaderArrow r a e b -> a (e, r) bSource

Encapsulation of a state-reading computation, taking a value for the state.

Typical usage in arrow notation:

	proc p -> ...
		(|runReader cmd|) env
class (ArrowReader r a, Arrow a') => ArrowAddReader r a a' | a -> a' whereSource

Adding a Control.Arrow.Transformer.Reader.ReaderArrow 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.Reader.runReader encapsulation operator. The methods of this class add and remove state transformers anywhere in the stack. In the instance

	instance Arrow a => ArrowAddReader r (ArrowReader r a) a

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

	instance ArrowAddReader r a a' =>
		ArrowAddReader r (FooArrow a) (FooArrow a')
Methods
liftReader :: a' e b -> a e bSource
elimReader :: a e b -> a' (e, r) bSource
show/hide Instances
Produced by Haddock version 2.3.0