|
Control.Arrow | Portability | portable | Stability | experimental | Maintainer | libraries@haskell.org |
|
|
|
|
|
Description |
Basic arrow definitions, based on
Generalising Monads to Arrows, by John Hughes,
Science of Computer Programming 37, pp67-111, May 2000.
plus a couple of definitions (returnA and loop) from
A New Notation for Arrows, by Ross Paterson, in ICFP 2001,
Firenze, Italy, pp229-240.
See these papers for the equations these combinators are expected to
satisfy. These papers and more information on arrows can be found at
http://www.haskell.org/arrows/.
|
|
Synopsis |
|
|
|
|
Arrows
|
|
|
The basic arrow class.
Any instance must define either arr or pure (which are synonyms),
as well as >>> and first. The other combinators have sensible
default definitions, which may be overridden for efficiency.
| | Methods | arr :: (b -> c) -> a b c | Source |
| Lift a function to an arrow: you must define either this
or pure.
| | pure :: (b -> c) -> a b c | Source |
| A synonym for arr: you must define one or other of them.
| | (>>>) :: a b c -> a c d -> a b d | Source |
| Left-to-right composition of arrows.
| | first :: a b c -> a (b, d) (c, d) | Source |
| Send the first component of the input through the argument
arrow, and copy the rest unchanged to the output.
| | second :: a b c -> a (d, b) (d, c) | Source |
| A mirror image of first.
The default definition may be overridden with a more efficient
version if desired.
| | (***) :: a b c -> a b' c' -> a (b, b') (c, c') | Source |
| Split the input between the two argument arrows and combine
their output. Note that this is in general not a functor.
The default definition may be overridden with a more efficient
version if desired.
| | (&&&) :: a b c -> a b c' -> a b (c, c') | Source |
| Fanout: send the input to both argument arrows and combine
their output.
The default definition may be overridden with a more efficient
version if desired.
|
| | Instances | |
|
|
|
Kleisli arrows of a monad.
| Constructors | | Instances | |
|
|
Derived combinators
|
|
|
The identity arrow, which plays the role of return in arrow notation.
|
|
|
Precomposition with a pure function.
|
|
|
Postcomposition with a pure function.
|
|
Right-to-left variants
|
|
|
Right-to-left composition, for a better fit with arrow notation.
|
|
|
Precomposition with a pure function (right-to-left variant).
|
|
|
Postcomposition with a pure function (right-to-left variant).
|
|
Monoid operations
|
|
|
| Methods | | | Instances | |
|
|
|
| Methods | (<+>) :: a b c -> a b c -> a b c | Source |
|
| | Instances | |
|
|
Conditionals
|
|
|
Choice, for arrows that support it. This class underlies the
if and case constructs in arrow notation.
Any instance must define left. The other combinators have sensible
default definitions, which may be overridden for efficiency.
| | Methods | | Feed marked inputs through the argument arrow, passing the
rest through unchanged to the output.
| | | A mirror image of left.
The default definition may be overridden with a more efficient
version if desired.
| | | Split the input between the two argument arrows, retagging
and merging their outputs.
Note that this is in general not a functor.
The default definition may be overridden with a more efficient
version if desired.
| | | Fanin: Split the input between the two argument arrows and
merge their outputs.
The default definition may be overridden with a more efficient
version if desired.
|
| | Instances | |
|
|
Arrow application
|
|
|
Some arrows allow application of arrow inputs to other inputs.
| | Methods | | | Instances | |
|
|
|
|
|
|
Any instance of ArrowApply can be made into an instance of
ArrowChoice by defining left = leftApp.
|
|
Feedback
|
|
|
The loop operator expresses computations in which an output value is
fed back as input, even though the computation occurs only once.
It underlies the rec value recursion construct in arrow notation.
| | Methods | loop :: a (b, d) (c, d) -> a b c | Source |
|
| | Instances | |
|
|
Produced by Haddock version 0.9 |