kure-2.18.6: Combinators for Strategic Programming
Copyright(c) 2012--2021 The University of Kansas
LicenseBSD3
MaintainerNeil Sculthorpe <neil.sculthorpe@ntu.ac.uk>
Stabilitybeta
Portabilityghc
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.KURE.Combinators.Arrow

Description

This module provides some utility arrow routing combinators.

Synopsis

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.

swap :: Arrow bi => bi (a, b) (b, a) Source #

A pure arrow that swaps the elements of a pair.

fork :: Arrow bi => bi a (a, a) Source #

A pure arrow that duplicates its argument.

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.

constant :: Arrow bi => b -> bi a b Source #

An arrow with a constant result.

serialise :: (Foldable f, Category bi) => f (bi a a) -> bi a a Source #

Sequence (from left to right) a collection of Categorys.

parallelise :: (Foldable f, Arrow bi, Monoid b) => f (bi a b) -> bi a b Source #

Apply a collection of arrows to the same input, combining their results in a monoid.