data-aviary-0.2.0: Combinator birds.

Portability to be determined experimental stephen.tetley@gmail.com

Data.Aviary

Contents

Description

Plainly named combinators

Sometimes permuted to be generally useful...

Note the fixity of `(#)` and `(##)` is not yet fixed. Some experience needs to be gathered as to whether the precendence levels are appropriate.

Synopsis

• (#) :: a -> (a -> b) -> b
• (##) :: (a -> b) -> (b -> c) -> a -> c
• subst :: (a -> b -> c) -> (a -> b) -> a -> c
• bigphi :: (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d
• appro :: (c -> d -> e) -> (a -> c) -> (b -> d) -> a -> b -> e
• oo :: (c -> d) -> (a -> b -> c) -> a -> b -> d
• ooo :: (d -> e) -> (a -> b -> c -> d) -> a -> b -> c -> e
• oooo :: (e -> f) -> (a -> b -> c -> d -> e) -> a -> b -> c -> d -> f

# The real stuff

(#) :: a -> (a -> b) -> bSource

T combinator - thrush

Reverse application - the T combinator. Found in Peter Thiemann's WASH and the paper 'Client-Side Web Scripting in Haskell' - Erik Meijer, Daan Leijen & James Hook.

(##) :: (a -> b) -> (b -> c) -> a -> cSource

Q Combinator - the queer bitd.

Reverse composition - found in Peter Thiemann's WASH. You might perfer to use (<<<) from Control.Categoty.

subst :: (a -> b -> c) -> (a -> b) -> a -> cSource

S combinator - subst. Familiar as Applicative's (`<*>`) operator, which itself is fmap:

f (b -> c) -> f b -> f c where f = ((->) a)

bigphi :: (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> dSource

The big Phi, or Turner's `S'` combinator. Known to Haskell programmers as liftA2 and liftM2 for the Applicative and Monad instances of (->).

``` (a1 -> a2 -> r) -> m a1 -> m a2 -> m r where m = ((->) a)
```

Taste suggests you may prefer liftA2 especially as `bigphi` is not a great name (calling it s' would take a very useful variable name).

appro :: (c -> d -> e) -> (a -> c) -> (b -> d) -> a -> b -> eSource

A variant of the `D2` or dovekie combinator - the argument order has been changed to be more satisfying for Haskellers:

``` (appro comb f g) x y
```
``` (f x) `comb` (g y)
```

`on` from Data.Function is similar but less general, where the two intermediate results are formed by applying the same function to the supplied arguments:

``` on = (appro comb f f)
```

# Specs

oo :: (c -> d) -> (a -> b -> c) -> a -> b -> dSource

Compose an arity 1 function with an arity 2 function. B1 - blackbird

ooo :: (d -> e) -> (a -> b -> c -> d) -> a -> b -> c -> eSource

Compose an arity 1 function with an arity 3 function. B2 - bunting

oooo :: (e -> f) -> (a -> b -> c -> d -> e) -> a -> b -> c -> d -> fSource

Compose an arity 1 function with an arity 4 function.