This module represents each bird available within the Aviary.
identity : a -> a
Identity, also known as "idiot".
Returns whatever it is given.
Aviary.Birds.identity 1 --> 1
Aviary.Birds.identity [ 1, 2, 3 ] --> [1, 2, 3]
Aviary.Birds.identity String.fromInt --> String.fromInt
kestrel : a -> b -> a
Kestrel.
Returns the first argument provided, ignoring the second.
kestrel "hello" 2 --> "hello"
kestrel Nothing [ 1, 2, 3 ] --> Nothing
kestrel String.fromInt (Just 2) --> String.fromInt
bluebird : (b -> c) -> (a -> b) -> a -> c
Bluebird.
Composes the given functions with the final value.
The equivilent of the composition operator (<<)
in Elm.
isEven : Int -> Bool
isEven n = modBy 2 n == 0
double : number -> number
double = ((*) 2)
bluebird not isEven 2 --> False
bluebird not isEven 1 --> True
bluebird String.fromInt double 4 --> "8"
cardinal : (a -> b -> c) -> b -> a -> c
Cardinal, also known as "flip".
Takes a binary function and two further arguments which are then applied inversely.
multiplyList : List Int -> Int -> List Int
multiplyList items multiple =
List.map ((*) multiple) items
cardinal multiplyList 10 [1, 2, 3] --> [10, 20, 30]
Useful in pipelines where the piped value is required to be the first argument to a function.
[1, 2, 3]
|> cardinal multiplyList 5
|> List.sum
--> 30
applicator : (a -> b) -> a -> b
Applicator.
Calls a given function with a given argument.
Sometimes referred to as "the reverse pipe operator".
The equivilent of the "pipe left" operator (<|)
in Elm.
applicator String.fromInt 1 --> "1"
applicator List.sum [ 1, 2, 3 ] --> 6
psi : (b -> b -> c) -> (a -> b) -> a -> a -> c
Psi.
Transforms two inputs and combines the outputs.
Equivelent of the on operator in Haskell.
add : number -> number -> number
add = (+)
double : number -> number
double = ((*) 2)
psi add double 3 12 --> 30
becard : (c -> d) -> (b -> c) -> (a -> b) -> a -> d
Becard.
Triple composition of a given value.
becard (\n -> n + 15) (\n -> n - 10) (\n -> n * 2) 50 --> 105
becard (Aviary.Birds.cardinal String.append "1") ((++) "2") String.fromInt 50 --> "2501"
blackbird : (b -> c) -> (a -> d -> b) -> a -> d -> c
Blackbird.
blackbird String.toFloat String.append "3" ".14" --> Just 3.14
blackbird (modBy 2) (\x y -> x * y) 2 3 --> 0
bluebirdPrime : (a -> c -> d) -> a -> (b -> c) -> b -> d
Bluebird prime.
bluebirdPrime (+) 1 Aviary.Birds.identity 2 --> 3
bluebirdPrime (++) [ 1, 2, 3 ] List.singleton 4 --> [1, 2, 3, 4]
bunting : (d -> e) -> (a -> b -> c -> d) -> a -> b -> c -> e
Bunting.
createUser : String -> Int -> Bool -> { name : String , age : Int , online : Bool }
createUser name age online = {
name = name ,
age = age ,
online = online
}
incrementUserAge : { name : String , age : Int , online : Bool } -> { name : String , age : Int , online : Bool }
incrementUserAge user =
{ user | age = user.age + 1 }
bunting List.sum (\x y z -> [x, y, z]) 1 2 3 --> 6
bunting incrementUserAge createUser "John" 36 True --> { name = "John", age = 37, online = True }
cardinalPrime : (c -> a -> d) -> (b -> c) -> a -> b -> d
Cardinal Prime.
cardinalPrime (+) ((-) 1) 5 10 --> -4
cardinalPrime List.append List.singleton [ 3, 2, 1 ] 4 --> [4, 3, 2, 1]
cardinalStar : (a -> c -> b -> d) -> a -> b -> c -> d
Cardinal once removed.
Flips the third and fourth arguments when applied to the given ternary function.
cardinalStar Basics.clamp 100 200 150 --> 150
cardinalStar (\four six three -> four + six * three) 4 3 6 --> 22
cardinalStarStar : (a -> b -> d -> c -> e) -> a -> b -> c -> d -> e
Cardinal twice removed.
Flips the fourth and fifth arguments when applied to the given quaternary function.
cardinalStarStar (\two four six three -> (two - four + six) * three) 2 4 3 6 --> 12
dickcissel : (a -> b -> d -> e) -> a -> b -> (c -> d) -> c -> e
Dickcissel.
dickcissel Basics.clamp 100 200 ((*) 2) 110 --> 200
dove : (a -> c -> d) -> a -> (b -> c) -> b -> d
Dove.
dove (+) 5 Basics.identity 2 --> 7
dovekie : (c -> d -> e) -> (a -> c) -> a -> (b -> d) -> b -> e
Dovekie.
dovekie (+) Basics.identity 2 ((*) 2) 11 --> 24
eagle : (a -> d -> e) -> a -> (b -> c -> d) -> b -> c -> e
Eagle.
eagle (+) 6 (*) 2 3 --> 12
eaglebald : (e -> f -> g) -> (a -> b -> e) -> a -> b -> (c -> d -> f) -> c -> d -> g
Bald eagle.
eaglebald (+) (-) 50 25 (*) 3 2 --> 31
finch : a -> b -> (b -> a -> c) -> c
Finch.
finch 6 2 (-) --> -4
finch "Hi" 3 String.repeat --> "HiHiHi"
finchStar : (c -> b -> a -> d) -> a -> b -> c -> d
Finch once removed.
Reverses the second, third and fourth arguments when applied to the given ternary function.
finchStar Basics.clamp 120 200 100 --> 120
finchStarStar : (a -> d -> c -> b -> e) -> a -> b -> c -> d -> e
Finch twice removed.
Flips the third and fifth arguments when applied to the given quaternary function.
finchStar Basics.clamp 120 200 100 --> 120
goldfinch : (b -> c -> d) -> (a -> c) -> a -> b -> d
Goldfinch.
goldfinch (+) ((*) 2) 6 1 --> 13
hummingbird : (a -> b -> a -> c) -> a -> b -> c
Hummingbird.
hummingbird (\x1 y x2 -> ( x1, x2, y )) 1 2 --> (1, 1, 2)
identityStar : (a -> b) -> a -> b
Identity bird once removed.
identityStar (\n -> n - 1) 10 --> 9
identityStarStar : (a -> b -> c) -> a -> b -> c
Identity bird twice removed
identityStarStar (\n m -> n - m) 10 4 --> 6
jayStar : (a -> c) -> a -> b -> c
Jay once removed.
jayStar Basics.identity 10 20 --> 10
jayPrime : (a -> b -> d) -> a -> b -> c -> d
Jay Prime.
jayPrime (+) 10 20 40 --> 30
jay : (a -> b -> b) -> a -> b -> a -> b
Jay.
jay (+) 10 20 40 --> 70
kite : a -> b -> b
Kite.
Returns the second argument provided, ignoring the first.
kite "hello" 2 --> 2
kite Nothing [ 1, 2, 3 ] --> [ 1, 2, 3 ]
kite String.fromInt (Just 2) --> Just 2
owl : ((a -> b) -> a) -> (a -> b) -> b
Owl.
owl (\f -> f 2 6) (+) 5 --> 13
phoenix : (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d
Phoenix.
This is equivilant to the Starling Prime combinator.
phoenix (+) ((*) 2) ((-) 3) 5 --> 8
quacky : a -> (a -> b) -> (b -> c) -> c
Quacky bird.
quacky 10 ((+) 2) ((*) 4) --> 48
quacky "John" String.toUpper (\name -> "My name is " ++ name) --> "My name is JOHN"
queer : (a -> b) -> (b -> c) -> a -> c
Queer bird.
Reverse function composition.
queer ((+) 2) ((*) 4) 10 --> 48
queer String.toUpper (\name -> "My name is " ++ name) "John" --> "My name is JOHN"
quirky : (a -> b) -> a -> (b -> c) -> c
Quirky bird.
quirky ((+) 2) 10 ((*) 4) --> 48
quirky String.toUpper "John" (\name -> "My name is " ++ name) --> "My name is JOHN"
quixotic : (b -> c) -> a -> (a -> b) -> c
Quixotic bird.
quixotic ((+) 2) 10 ((*) 4) --> 42
quixotic String.toUpper "John" (\name -> "My name is " ++ name) --> "MY NAME IS JOHN"
quizzical : a -> (b -> c) -> (a -> b) -> c
Quizzical bird.
quizzical 10 ((+) 2) ((*) 4) --> 42
quizzical "John" String.toUpper (\name -> "My name is " ++ name) --> "MY NAME IS JOHN"
robin : a -> (b -> a -> c) -> b -> c
Robin.
robin 10 (-) 12 --> 2
robin "second" (\a b -> a ++ " " ++ b) "first" --> "first second"
robinStar : (b -> c -> a -> d) -> a -> b -> c -> d
Robin once removed.
robinStar Basics.clamp 10 100 200 --> 100
robinStar Basics.clamp 110 100 200 --> 110
robinStar Basics.clamp 220 100 200 --> 200
robinStarStar : (a -> c -> d -> b -> e) -> a -> b -> c -> d -> e
Robin twice removed.
robinStarStar (\six nine ten four -> six - nine + ten * four) 6 4 9 10 --> 37
starling : (a -> b -> c) -> (a -> b) -> a -> c
Starling.
starling (+) ((*) 2) 10 --> 30
starling (-) (\v -> v * 7) 4 --> -24
starling (\user newAge -> { user | age = newAge }) (\user -> user.age + 1) { age = 35 } --> { age = 36 }
starlingPrime : (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d
Starling Prime.
starlingPrime (+) ((*) 2) ((-) 3) 5 --> 8
thrush : a -> (a -> b) -> b
Thrush.
Sometimes referred to as "the forward pipe operator".
The equivilent of the "pipe right" operator (|>)
in Elm.
thrush 1 Basics.identity --> 1
thrush 20 ((+) 2) --> 22
thrush "Hello" (\v -> v ++ " world!") --> "Hello world!"
vireo : a -> b -> (a -> b -> c) -> c
Vireo.
vireo 1 2 (+) --> 3
vireo 3 "Hello" String.repeat --> "HelloHelloHello"
vireoStar : (b -> a -> b -> d) -> a -> b -> b -> d
Vireo once removed.
vireoStar (\two one three -> one + two - three) 1 2 3 --> 0
vireoStarStar : (a -> c -> b -> c -> e) -> a -> b -> c -> c -> e
Vireo twice removed.
vireoStarStar (\one four two three -> (one + two) - (three + four)) 1 2 3 4 --> -4
warbler : (a -> a -> b) -> a -> b
Warbler.
Provides a given argument as both values to a given binary function.
warbler (+) 2 --> 4
warbler1 : a -> (a -> a -> b) -> b
Converse warbler.
The warbler but with the input arguments reversed.
warbler1 2 (+) --> 4
warblerStar : (a -> b -> b -> c) -> a -> b -> c
Warbler once removed.
warblerStar (\x y z -> [ x, y, z ]) 1 2 --> [1, 2, 2]
warblerStarStar : (a -> b -> c -> c -> d) -> a -> b -> c -> d
Warbler twice removed.
warblerStarStar (\w x y z -> [ w, x, y, z ]) 1 2 3 --> [1, 2, 3, 3]