Copyright | (c) 2012--2021 The University of Kansas |
---|---|
License | BSD3 |
Maintainer | Neil Sculthorpe <neil.sculthorpe@ntu.ac.uk> |
Stability | beta |
Portability | ghc |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
This module provides some utility arrow routing combinators.
Synopsis
- result :: Arrow bi => (b -> c) -> bi a b -> bi a c
- argument :: Arrow bi => (a -> b) -> bi b c -> bi a c
- toFst :: Arrow bi => bi a b -> bi (a, x) b
- toSnd :: Arrow bi => bi a b -> bi (x, a) b
- swap :: Arrow bi => bi (a, b) (b, a)
- fork :: Arrow bi => bi a (a, a)
- forkFirst :: Arrow bi => bi a b -> bi a (b, a)
- forkSecond :: Arrow bi => bi a b -> bi a (a, b)
- constant :: Arrow bi => b -> bi a b
- serialise :: (Foldable f, Category bi) => f (bi a a) -> bi a a
- parallelise :: (Foldable f, Arrow bi, Monoid b) => f (bi a b) -> bi a b
Arrow Routing
The names result
and argument
are taken from Conal Elliott's semantic editor combinators.
http://conal.net/blog/posts/semantic-editor-combinators
result :: Arrow bi => (b -> c) -> bi a b -> bi a c Source #
Apply a pure function to the result of an arrow.
argument :: Arrow bi => (a -> b) -> bi b c -> bi a c Source #
Apply a pure function to the argument to an arrow.
toFst :: Arrow bi => bi a b -> bi (a, x) b Source #
Apply an arrow to the first element of a pair, discarding the second element.
toSnd :: Arrow bi => bi a b -> bi (x, a) b Source #
Apply an arrow to the second element of a pair, discarding the first element.
forkFirst :: Arrow bi => bi a b -> bi a (b, a) Source #
Tag the result of an arrow with its argument.
forkSecond :: Arrow bi => bi a b -> bi a (a, b) Source #
Tag the result of an arrow with its argument.