data-aviary 0.2.0 → 0.2.1
raw patch · 3 files changed
+65/−15 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.Aviary: combfi :: (c -> b -> d) -> (a -> c) -> a -> b -> d
+ Data.Aviary: combfii :: (d -> b -> c -> e) -> (a -> d) -> a -> b -> c -> e
+ Data.Aviary: combfiii :: (e -> b -> c -> d -> f) -> (a -> e) -> a -> b -> c -> d -> f
+ Data.Aviary: dup :: (a -> a -> b) -> a -> b
Files
- data-aviary.cabal +8/−6
- src/Data/Aviary.hs +55/−1
- src/Data/Aviary/BirdsInter.hs +2/−8
data-aviary.cabal view
@@ -1,5 +1,5 @@ name: data-aviary-version: 0.2.0+version: 0.2.1 license: BSD3 license-file: LICENSE copyright: Stephen Tetley <stephen.tetley@gmail.com>@@ -11,17 +11,19 @@ A catalogue of 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, + Plus a smaller set (Data.Aviary) intended to be useful, collecting combinators that have already /escaped/ (published - elsewhere) but aren\'t in Data.Function, along with some other - favourites.+ elsewhere) but aren\'t in Data.Function, along with some + personal favourites. . Changelog: . + 0.2.1 added @dup@ and the /combiner/ variants of cardinal-prime.+ . 0.2.0 added Haddock docs for @(\#\#)@.-+ build-type: Simple-stability: highly unstable+stability: unstable cabal-version: >= 1.2 extra-source-files:
src/Data/Aviary.hs view
@@ -30,12 +30,18 @@ , subst , bigphi , appro+ , dup -- * Specs , oo , ooo , oooo + -- * Combiners+ , combfi+ , combfii+ , combfiii+ ) where import Data.Function@@ -103,13 +109,20 @@ -- > on = (appro comb f f) -- appro :: (c -> d -> e) -> (a -> c) -> (b -> d) -> a -> b -> e-appro f g h x y = f (g x) (h y) +appro comb f g x y = comb (f x) (g y) +-- | dup - duplicator aka the W combinator aka Warbler. +-- +-- > dup f x = f x x+--+dup :: (a -> a -> b) -> a -> b+dup f x = f x x + -------------------------------------------------------------------------------- -- Specs - blackbird, bunting, ... @@ -138,3 +151,44 @@ -- | Compose an arity 1 function with an arity 4 function. oooo :: (e -> f) -> (a -> b -> c -> d -> e) -> a -> b -> c -> d -> f oooo f g = (((f .) .) .) . g ++--------------------------------------------------------------------------------+-- Combiners+++-- | Combiners - similar to the cardinal\' combinator. +--+-- Mnemonically - @comb@(ine) after applying @f@ to @x@ and a +-- single identity: @y@. +--+-- > combfi comb f x y = comb (f x) y+--+-- Equivalently:+--+-- > combfi comb f = appro comb f id+-- +-- But combfi is a useful introduction to the (somewhat manic, +-- but sometimes useful) higher arity versions.+-- +combfi :: (c -> b -> d) -> (a -> c) -> a -> b -> d+combfi comb f x y = comb (f x) y + +-- | Extrapolation of 'combfi' with another identity.+--+-- Mnemonically - comb(ine) after applying @f@ to @x@ and two +-- identities: @y@ and @z@.+--+-- > combfii comb f x y z = comb (f x) y z+--+combfii :: (d -> b -> c -> e) -> (a -> d) -> a -> b -> c -> e+combfii comb f x y z = comb (f x) y z ++-- | Extrapolation of 'combfii' with a further identity.+--+-- Mnemonically - comb(ine) after applying @f@ to @s@ and three+-- identities: @t@ and @u@ and @v@.+--+-- > combfii comb f s t u v = comb (f s) t u v+--+combfiii :: (e -> b -> c -> d -> f) -> (a -> e) -> a -> b -> c -> d -> f+combfiii comb f s t u v = comb (f s) t u v
src/Data/Aviary/BirdsInter.hs view
@@ -125,15 +125,9 @@ -- | Psi combinator - psi bird (?) - Haskell 'on'. psi :: (b -> b -> c) -> (a -> b) -> a -> a -> c-psi = c (b s (b (b c) (b (b (b b)) (c (b b (b b i)) (c (b b i) i))))) (c (b b i) i)- where- c = cardinal- b = bluebird- s = starling- i = idiot+psi = cardinal (bluebird starling (bluebird cardinalstar dovekie)) applicator - -- TODO - This definition was built with a combinator calculator- -- For sanity it ought to be reduced + -------------------------------------------------------------------------------- -- Other birds