-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Combinator birds. -- -- A catalogue for the combinator birds (Data.Aviary.Birds) - this module -- is intended more for illustration than utility. -- -- Plus a smaller set (Data.Avery) intended to be useful, collecting -- combinators that have already escaped (published elsewhere) but -- aren't in Data.Function and other favourites. @package data-aviary @version 0.1.0 -- | Bird monickered combinators interdefined. -- -- This module is intended for illustration (the type signatures!) rather -- than utility. -- -- The 'long reach' Turner set { S, K, I, B, C, S', B', C' } -- -- The Joy et al. set { S, I, B, C, J(alt), S', B', C', J(alt)' } module Data.Aviary.BirdsInter -- | I combinator - identity bird / idiot bird - Haskell id. idiot :: a -> a -- | K combinator - kestrel - Haskell const. Corresponds to the -- encoding of true in the lambda calculus. -- -- Not interdefined. kestrel :: a -> b -> a -- | B combinator - bluebird - Haskell (.). bluebird :: (b -> c) -> (a -> b) -> a -> c -- | C combinator - cardinal - Haskell flip. cardinal :: (a -> b -> c) -> b -> a -> c -- | A combinator - apply / applicator - Haskell ($). -- -- Note: the definition here is - C (B B I) I - and not the -- familiar - S (S K) - which as far as Haskell is concerned has -- a different type. -- --
--   (S(SK)) :: ((a -> b) -> a) -> (a -> b) -> a
--   
applicator :: (a -> b) -> a -> b -- | Psi combinator - psi bird (?) - Haskell on. psi :: (b -> b -> c) -> (a -> b) -> a -> a -> c -- | B3 combinator - becard. becard :: (c -> d) -> (b -> c) -> (a -> b) -> a -> d -- | B1 combinator - blackbird - specs oo. blackbird :: (c -> d) -> (a -> b -> c) -> a -> b -> d -- | B' combinator - bluebird prime. bluebird' :: (a -> c -> d) -> a -> (b -> c) -> b -> d -- | B2 combinator - bunting - specs ooo. bunting :: (d -> e) -> (a -> b -> c -> d) -> a -> b -> c -> e -- | C' combinator - no name. cardinal' :: (c -> a -> d) -> (b -> c) -> a -> b -> d -- | C* combinator - cardinal once removed. cardinalstar :: (a -> c -> b -> d) -> a -> b -> c -> d -- | C** combinator - cardinal twice removed. cardinalstarstar :: (a -> b -> d -> c -> e) -> a -> b -> c -> d -> e -- | D combinator - dove. dove :: (a -> c -> d) -> a -> (b -> c) -> b -> d -- | D1 combinator - dickcissel. dickcissel :: (a -> b -> d -> e) -> a -> b -> (c -> d) -> c -> e -- | D2 combinator - dovekie. dovekie :: (c -> d -> e) -> (a -> c) -> a -> (b -> d) -> b -> e -- | E combinator - eagle. eagle :: (a -> d -> e) -> a -> (b -> c -> d) -> b -> c -> e -- | E ^ - bald eagle. For alphabetical regularity it is somewhat misnamed -- here as eaglebald. eaglebald :: (e -> f -> g) -> (a -> b -> e) -> a -> b -> (c -> d -> f) -> c -> d -> g -- | F combinator - finch. finch :: a -> b -> (b -> a -> c) -> c -- | F* combinator - finch once removed. finchstar :: (c -> b -> a -> d) -> a -> b -> c -> d -- | F** combinator - finch once removed. finchstarstar :: (a -> d -> c -> b -> e) -> a -> b -> c -> d -> e -- | G combinator - goldfinch. goldfinch :: (b -> c -> d) -> (a -> c) -> a -> b -> d -- | H combinator - hummingbird. hummingbird :: (a -> b -> a -> c) -> a -> b -> c -- | I* combinator - identity bird once removed. Alias of -- applicator, Haskell's ($). Type signature idstar :: (a -> b) -> a -> b -- | I** combinator - identity bird twice removed. idstarstar :: (a -> b -> c) -> a -> b -> c -- | Alternative J combinator - this is the J combintor of Joy, -- Rayward-Smith and Burton (see. Antoni Diller 'Compiling Functional -- Languages' page 104). It is not the J - jay combinator of the -- literature. jalt :: (a -> c) -> a -> b -> c -- | J' combinator - from Joy, Rayward-Smith and Burton. See the comment to -- jalt. jalt' :: (a -> b -> d) -> a -> b -> c -> d -- | J combinator - jay. -- -- This is the usual J combinator. jay :: (a -> b -> b) -> a -> b -> a -> b -- | Ki - kite. Corresponds to the encoding of false in the lambda -- calculus. kite :: a -> b -> b -- | O combinator - owl. owl :: ((a -> b) -> a) -> (a -> b) -> b -- | (Big) Phi combinator - phoenix - Haskell liftM2. phoenix :: (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d -- | Q4 combinator - quacky bird. quacky :: a -> (a -> b) -> (b -> c) -> c -- | Q combinator - queer bird. -- -- Haskell (##) in Peter Thiemann's Wash, reverse composition. queer :: (a -> b) -> (b -> c) -> a -> c -- | Q3 combinator - quirky bird. quirky :: (a -> b) -> a -> (b -> c) -> c -- | Q1 combinator - quixotic bird. quixotic :: (b -> c) -> a -> (a -> b) -> c -- | Q2 combinator - quizzical bird. quizzical :: a -> (b -> c) -> (a -> b) -> c -- | R combinator - robin. robin :: a -> (b -> a -> c) -> b -> c -- | R* combinator - robin once removed. robinstar :: (b -> c -> a -> d) -> a -> b -> c -> d -- | R** combinator - robin twice removed. robinstarstar :: (a -> c -> d -> b -> e) -> a -> b -> c -> d -> e -- | S combinator - starling. -- -- Haskell: Applicative's (<*>) on functions. -- -- Not interdefined. starling :: (a -> b -> c) -> (a -> b) -> a -> c -- | S' combinator - starling prime - Turner's big phi. Haskell: -- Applicative's liftA2 on functions. starling' :: (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d -- | T combinator - thrush. Haskell (#) in Peter Thiemann's Wash, -- reverse application. thrush :: a -> (a -> b) -> b -- | V combinator - vireo. vireo :: a -> b -> (a -> b -> b) -> b -- | V* combinator - vireo once removed. vireostar :: (b -> a -> b -> d) -> a -> b -> b -> d -- | V** combinator - vireo twice removed. vireostarstar :: (a -> c -> b -> c -> e) -> a -> b -> c -> c -> e -- | W combinator - warbler - elementary duplicator. warbler :: (a -> a -> b) -> a -> b -- | W1 combinator - converse warbler. warbler with the arguments -- reversed. warbler1 :: a -> (a -> a -> b) -> b -- | W* combinator - warbler once removed. warblerstar :: (a -> b -> b -> c) -> a -> b -> c -- | W** combinator - warbler twice removed. warblerstarstar :: (a -> b -> c -> c -> d) -> a -> b -> c -> d -- | Bird monickered combinators -- -- This module is intended for illustration (the type signatures!) rather -- than utility. -- -- The 'long reach' Turner set { S, K, I, B, C, S', B', C' } -- -- The Joy et al. set { S, I, B, C, J(alt), S', B', C', J(alt)' } module Data.Aviary.Birds -- | I combinator - identity bird / idiot bird - Haskell id. idiot :: a -> a -- | K combinator - kestrel - Haskell const. Corresponds to the -- encoding of true in the lambda calculus. kestrel :: a -> b -> a -- | B combinator - bluebird - Haskell (.). bluebird :: (b -> c) -> (a -> b) -> a -> c -- | C combinator - cardinal - Haskell flip. cardinal :: (a -> b -> c) -> b -> a -> c -- | A combinator - apply / applicator - Haskell ($). applicator :: (a -> b) -> a -> b -- | Psi combinator - psi bird (?) - Haskell on. psi :: (b -> b -> c) -> (a -> b) -> a -> a -> c -- | B3 combinator - becard. becard :: (c -> d) -> (b -> c) -> (a -> b) -> a -> d -- | B1 combinator - blackbird - specs oo. blackbird :: (c -> d) -> (a -> b -> c) -> a -> b -> d -- | B' combinator - bluebird prime. bluebird' :: (a -> c -> d) -> a -> (b -> c) -> b -> d -- | B2 combinator - bunting - specs ooo. bunting :: (d -> e) -> (a -> b -> c -> d) -> a -> b -> c -> e -- | C' combinator - no name. cardinal' :: (c -> a -> d) -> (b -> c) -> a -> b -> d -- | C* combinator - cardinal once removed. cardinalstar :: (a -> c -> b -> d) -> a -> b -> c -> d -- | C** combinator - cardinal twice removed. cardinalstarstar :: (a -> b -> d -> c -> e) -> a -> b -> c -> d -> e -- | D combinator - dove. dove :: (a -> c -> d) -> a -> (b -> c) -> b -> d -- | D1 combinator - dickcissel. dickcissel :: (a -> b -> d -> e) -> a -> b -> (c -> d) -> c -> e -- | D2 combinator - dovekie. dovekie :: (c -> d -> e) -> (a -> c) -> a -> (b -> d) -> b -> e -- | E combinator - eagle. eagle :: (a -> d -> e) -> a -> (b -> c -> d) -> b -> c -> e -- | E ^ - bald eagle. For alphabetical regularity it is somewhat misnamed -- here as eaglebald. eaglebald :: (e -> f -> g) -> (a -> b -> e) -> a -> b -> (c -> d -> f) -> c -> d -> g -- | F combinator - finch. finch :: a -> b -> (b -> a -> c) -> c -- | F* combinator - finch once removed. finchstar :: (c -> b -> a -> d) -> a -> b -> c -> d -- | F** combinator - finch once removed. finchstarstar :: (a -> d -> c -> b -> e) -> a -> b -> c -> d -> e -- | G combinator - goldfinch. goldfinch :: (b -> c -> d) -> (a -> c) -> a -> b -> d -- | H combinator - hummingbird. hummingbird :: (a -> b -> a -> c) -> a -> b -> c -- | I* combinator - identity bird once removed Alias of applicator, -- Haskell's ($). idstar :: (a -> b) -> a -> b -- | I** combinator - identity bird twice removed idstarstar :: (a -> b -> c) -> a -> b -> c -- | Alternative J combinator - this is the J combintor of Joy, -- Rayward-Smith and Burton (see. Antoni Diller 'Compiling Functional -- Languages' page 104). It is not the J - jay combinator of the -- literature. jalt :: (a -> c) -> a -> b -> c -- | J' combinator - from Joy, Rayward-Smith and Burton. See the comment to -- jalt. jalt' :: (a -> b -> d) -> a -> b -> c -> d -- | J combinator - jay. -- -- This is the usual J combinator. jay :: (a -> b -> b) -> a -> b -> a -> b -- | Ki - kite. Corresponds to the encoding of false in the lambda -- calculus. kite :: a -> b -> b -- | O combinator - owl. owl :: ((a -> b) -> a) -> (a -> b) -> b -- | (Big) Phi combinator - phoenix - Haskell liftM2. phoenix :: (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d -- | Q4 combinator - quacky bird. quacky :: a -> (a -> b) -> (b -> c) -> c -- | Q combinator - queer bird. -- -- Haskell (##) in Peter Thiemann's Wash, reverse composition. queer :: (a -> b) -> (b -> c) -> a -> c -- | Q3 combinator - quirky bird. quirky :: (a -> b) -> a -> (b -> c) -> c -- | Q1 combinator - quixotic bird. quixotic :: (b -> c) -> a -> (a -> b) -> c -- | Q2 combinator - quizzical bird. quizzical :: a -> (b -> c) -> (a -> b) -> c -- | R combinator - robin. robin :: a -> (b -> a -> c) -> b -> c -- | R* combinator - robin once removed. robinstar :: (b -> c -> a -> d) -> a -> b -> c -> d -- | R* combinator - robin twice removed. robinstarstar :: (a -> c -> d -> b -> e) -> a -> b -> c -> d -> e -- | S combinator - starling. -- -- Haskell: Applicative's (<*>) on functions. -- -- Substitution. starling :: (a -> b -> c) -> (a -> b) -> a -> c -- | S' combinator - starling prime - Turner's big phi. Haskell: -- Applicative's liftA2 on functions. starling' :: (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d -- | T combinator - thrush. Haskell (#) in Peter Thiemann's Wash, -- reverse application. thrush :: a -> (a -> b) -> b -- | V combinator - vireo. vireo :: a -> b -> (a -> b -> c) -> c -- | V* combinator - vireo once removed. vireostar :: (b -> a -> b -> d) -> a -> b -> b -> d -- | V** combinator - vireo twice removed. vireostarstar :: (a -> c -> b -> c -> e) -> a -> b -> c -> c -> e -- | W combinator - warbler - elementary duplicator. warbler :: (a -> a -> b) -> a -> b -- | W1 combinator - converse warbler. warbler with the arguments -- reversed. warbler1 :: a -> (a -> a -> b) -> b -- | W* combinator - warbler once removed. warblerstar :: (a -> b -> b -> c) -> a -> b -> c -- | W** combinator - warbler twice removed. warblerstarstar :: (a -> b -> c -> c -> d) -> a -> b -> c -> d -- | 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. module Data.Aviary -- | 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 -> (a -> b) -> b (##) :: (a -> b) -> (b -> c) -> a -> c -- | S combinator - subst. Familiar as Applicative's (<*>) -- operator, which itself is fmap: -- -- f (b -> c) -> f b -> f c where f = ((->) a) subst :: (a -> b -> c) -> (a -> b) -> a -> c -- | 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. bigphi :: (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d -- | A variant of the D2 or dovekie combinator - the argument -- order has been changed to be more satisfying for Haskellers. -- -- appro is similar to the function prod from the Pair -- calculus, but appro applies the first argument f :: (c -- -> d -> e) to the two intermediate results. prod -- always forms a pair from the intermediate results. -- -- 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. appro :: (c -> d -> e) -> (a -> c) -> (b -> d) -> a -> b -> e -- | Compose an arity 1 function with an arity 2 function. B1 - blackbird oo :: (c -> d) -> (a -> b -> c) -> a -> b -> d -- | Compose an arity 1 function with an arity 3 function. B2 - bunting ooo :: (d -> e) -> (a -> b -> c -> d) -> a -> b -> c -> e -- | Compose an arity 1 function with an arity 4 function. oooo :: (e -> f) -> (a -> b -> c -> d -> e) -> a -> b -> c -> d -> f