Introduction | Arrow syntax | Bibliography | Downloads |
---|---|---|---|
Arrows are a new abstract view of computation, defined by John Hughes [Hug00]. They serve much the same purpose as monads -- providing a common structure for libraries -- but are more general. In particular they allow notions of computation that may be partially static (independent of the input) or may take multiple inputs. If your application works fine with monads, you might as well stick with them. But if you're using a structure that's very like a monad, but isn't one, maybe it's an arrow. The Arrow classA computation takes inputs of some type and produces outputs of another type. (Thanks to Cale Gibbard for the improved artwork.) Hence Hughes defined a Haskell class of binary type constructors:
with a number of axioms. This and related classes are in the Control.Arrow module now distributed with all Haskell implementations. Workers in denotational semantics have independently defined equivalent structures, called Freyd-categories or (more generally) premonoidal notions of computation. Examples
In many of these cases, we can generalize from -> to any arrow (possibly constrained), yielding arrow transformers. |
|||
Introduction | Arrow syntax | Bibliography | Downloads |
Ross Paterson