kure-2.12.2: Combinators for Strategic Programming

Portabilityghc
Stabilitybeta
MaintainerNeil Sculthorpe <neil@ittc.ku.edu>
Safe HaskellSafe-Inferred

Language.KURE.Combinators.Arrow

Contents

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 cSource

Apply a pure function to the result of an arrow.

argument :: Arrow bi => (a -> b) -> bi b c -> bi a cSource

Apply a pure function to the argument to an arrow.

toFst :: Arrow bi => bi a b -> bi (a, x) bSource

Apply an arrow to the first element of a pair, discarding the second element.

toSnd :: Arrow bi => bi a b -> bi (x, a) bSource

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 bSource

An arrow with a constant result.

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

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

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

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