DeepArrow-0.2: Arrows for "deep application"Source codeContentsIndex
Control.Arrow.DeepArrow.Examples
Portabilityportable
Stabilityexperimental
Maintainerconal@conal.net
Contents
Deep application
Function extraction
Input extraction
Description

DeepArrow examples.

The types in the source code are formatted for easier reading.

Synopsis
deep :: DeepArrow ~> => (c ~> c') -> (a -> (f, b -> (c, g)), e) ~> (a -> (f, b -> (c', g)), e)
extF :: DeepArrow ~> => (d ~> (c -> b)) -> (e -> (a, d), f) ~> (c -> (e -> (a, b), f))
extFF :: DeepArrow ~> => (e -> (a, c -> b), f) ~> (c -> (e -> (a, b), f))
extI :: DeepArrow ~> => (((a, (b, e)), c) -> d) ~> (b -> ((a, e), c) -> d)
extFI :: DeepArrow ~> => (e -> (g, ((a, (b, e)), c) -> d), f) ~> (b -> (e -> (g, ((a, e), c) -> d), f))
Deep application
deep :: DeepArrow ~> => (c ~> c') -> (a -> (f, b -> (c, g)), e) ~> (a -> (f, b -> (c', g)), e)Source

Given a value of type (a -> (f,b -> (c,g)),e), apply a function to just the c part and leave the rest intact.

deep = first . result . second . result . first
Function extraction
extF :: DeepArrow ~> => (d ~> (c -> b)) -> (e -> (a, d), f) ~> (c -> (e -> (a, b), f))Source

Given a way to extract a function from a d value, create a way to extract a function from a (e -> (a,d), f) value.

extF = funFirst . funResult . funSecond
extFF :: DeepArrow ~> => (e -> (a, c -> b), f) ~> (c -> (e -> (a, b), f))Source

To make an extractor, simply apply the extractor-transformer extF to the identity arrow.

extFF = extF idA
Input extraction
extI :: DeepArrow ~> => (((a, (b, e)), c) -> d) ~> (b -> ((a, e), c) -> d)Source

Extract a b input from a ((a,(b,e)),c) argument.

extI = (inpFirst . inpSecond) inpF
extFI :: DeepArrow ~> => (e -> (g, ((a, (b, e)), c) -> d), f) ~> (b -> (e -> (g, ((a, e), c) -> d), f))Source

Typically, we will have to combine function and input extractors. For instance, combine extF and extI.

extFI = extF extI
Produced by Haddock version 2.3.0