module Data.Function.Combinator.Birds
  ( bluebird
  , blackbird
  , bunting
  , becard
  , cardinal
  , dove
  , dickcissel
  , dovekies
  , eagle
  , baldEagle
  , finch
  , goldFinch
  , hummingbird
  , idiot
  , jay
  , kestrel
  , lark
  , mockingbird
  , doubleMockingbird
  , owl
  , queerbird
  , quixoticbird
  , quizzicalbird
  , quirkybird
  , quackybird
  , robin
  , starling
  , thrush
  , turing
  , vireo
  , warbler
  , converseWarbler
  , whybird
  
  , idiot'
  , warbler'
  , cardinal'
  , robin'
  , finch'
  , vireo'
  , idiot''
  , warbler''
  , cardinal''
  , robin''
  , finch''
  , vireo''

  , kite
  , omega
  , konstantMocker
  , crossedKonstantMocker
  , theta
  ) where

import Unsafe.Coerce (unsafeCoerce)

-- | B
-- Haskell @('.')@
bluebird :: (b -> c) -> (a -> b) -> a -> c
bluebird :: (b -> c) -> (a -> b) -> a -> c
bluebird b -> c
f a -> b
g a
x = b -> c
f (a -> b
g a
x)

-- | B1
blackbird :: (c -> d) -> (a -> b -> c) -> a -> b -> d
blackbird :: (c -> d) -> (a -> b -> c) -> a -> b -> d
blackbird c -> d
f a -> b -> c
g a
x b
y = c -> d
f (a -> b -> c
g a
x b
y)

-- | B2
bunting :: (d -> e) -> (a -> b -> c -> d) -> a -> b -> c -> e
bunting :: (d -> e) -> (a -> b -> c -> d) -> a -> b -> c -> e
bunting d -> e
f a -> b -> c -> d
g a
x b
y c
z = d -> e
f (a -> b -> c -> d
g a
x b
y c
z)

-- | B3
becard :: (c -> d) -> (b -> c) -> (a -> b) -> a -> d
becard :: (c -> d) -> (b -> c) -> (a -> b) -> a -> d
becard c -> d
f b -> c
g a -> b
h a
x = c -> d
f (b -> c
g ( a -> b
h a
x))

-- | C
-- Haskell 'flip'
cardinal :: (a -> b -> c) -> b -> a -> c
cardinal :: (a -> b -> c) -> b -> a -> c
cardinal a -> b -> c
f b
x a
y = a -> b -> c
f a
y b
x

-- | D
dove :: (a -> c -> d) -> a -> (b -> c) -> b -> d
dove :: (a -> c -> d) -> a -> (b -> c) -> b -> d
dove a -> c -> d
f a
x b -> c
g b
y = a -> c -> d
f a
x (b -> c
g b
y)

-- | D1
dickcissel :: (a -> b -> c -> d) -> a -> b -> (e -> c) -> e -> d
dickcissel :: (a -> b -> c -> d) -> a -> b -> (e -> c) -> e -> d
dickcissel a -> b -> c -> d
f a
x b
y e -> c
g e
z = a -> b -> c -> d
f a
x b
y (e -> c
g e
z)

-- | D2
dovekies :: (a -> b -> c) -> (d -> a) -> d -> (e -> b) -> e -> c
dovekies :: (a -> b -> c) -> (d -> a) -> d -> (e -> b) -> e -> c
dovekies a -> b -> c
f d -> a
g d
x e -> b
h e
y = a -> b -> c
f (d -> a
g d
x) (e -> b
h e
y)

-- | E
eagle :: (a -> b -> c) -> a -> (d -> e -> b) -> d -> e -> c
eagle :: (a -> b -> c) -> a -> (d -> e -> b) -> d -> e -> c
eagle a -> b -> c
f a
x d -> e -> b
g d
y e
z = a -> b -> c
f a
x (d -> e -> b
g d
y e
z)

-- | E^
baldEagle :: (a -> b -> c) -> (d -> e -> a) -> d -> e -> (f -> g -> b) -> f -> g -> c
baldEagle :: (a -> b -> c)
-> (d -> e -> a) -> d -> e -> (f -> g -> b) -> f -> g -> c
baldEagle a -> b -> c
f d -> e -> a
g d
x e
y f -> g -> b
h f
v g
w = a -> b -> c
f (d -> e -> a
g d
x e
y) (f -> g -> b
h f
v g
w)

-- | F
finch :: b -> a -> (a -> b -> c) -> c
finch :: b -> a -> (a -> b -> c) -> c
finch b
x a
y a -> b -> c
f = a -> b -> c
f a
y b
x

-- | G
goldFinch :: (a -> b -> c) -> (d -> b) -> d -> a -> c
goldFinch :: (a -> b -> c) -> (d -> b) -> d -> a -> c
goldFinch a -> b -> c
f d -> b
g d
x a
y = a -> b -> c
f a
y (d -> b
g d
x)

-- | H
hummingbird :: (a -> b -> a -> c) -> a -> b -> c
hummingbird :: (a -> b -> a -> c) -> a -> b -> c
hummingbird a -> b -> a -> c
f a
x b
y = a -> b -> a -> c
f a
x b
y a
x

-- | I
-- Haskell 'id'
idiot :: a -> a
idiot :: a -> a
idiot a
x = a
x

-- | J
jay :: (a -> b -> b) -> a -> a -> b -> b
jay :: (a -> b -> b) -> a -> a -> b -> b
jay a -> b -> b
f a
x a
y b
z = a -> b -> b
f a
x (a -> b -> b
f a
y b
z)

-- | K
-- Haskell 'const'
kestrel :: a -> b -> a
kestrel :: a -> b -> a
kestrel a
x b
_ = a
x

-- | L
lark :: (b -> c) -> (a -> b) -> c
lark :: (b -> c) -> (a -> b) -> c
lark b -> c
f a -> b
g = b -> c
f (a -> b
g a
forall b. b
g') where g' :: b
g' = (a -> b) -> b
forall a b. a -> b
unsafeCoerce a -> b
g

-- | M
mockingbird :: (a -> b) -> b
mockingbird :: (a -> b) -> b
mockingbird a -> b
x = a -> b
x a
forall b. b
x' where x' :: b
x' = (a -> b) -> b
forall a b. a -> b
unsafeCoerce a -> b
x

-- | M2
doubleMockingbird :: (a -> b -> c) -> a -> c
doubleMockingbird :: (a -> b -> c) -> a -> c
doubleMockingbird a -> b -> c
f a
x = (b -> c) -> c
forall a b. (a -> b) -> b
mockingbird (a -> b -> c
f a
x)

-- | O
owl :: ((a -> b) -> a) -> (a -> b) -> b
owl :: ((a -> b) -> a) -> (a -> b) -> b
owl (a -> b) -> a
f a -> b
g = a -> b
g ((a -> b) -> a
f a -> b
g)

-- | Q
queerbird :: (a -> b) -> (b -> c) -> a -> c
queerbird :: (a -> b) -> (b -> c) -> a -> c
queerbird a -> b
f b -> c
g a
x = b -> c
g (a -> b
f a
x)

-- | Q1
quixoticbird :: (a -> b) -> c -> (c -> a) -> b
quixoticbird :: (a -> b) -> c -> (c -> a) -> b
quixoticbird a -> b
f c
x c -> a
g = a -> b
f (c -> a
g c
x)

-- | Q2
quizzicalbird :: a -> (b -> c) -> (a -> b) -> c
quizzicalbird :: a -> (b -> c) -> (a -> b) -> c
quizzicalbird a
x b -> c
f a -> b
g = b -> c
f (a -> b
g a
x)

-- | Q3
quirkybird :: (a -> b) -> a -> (b -> c) -> c
quirkybird :: (a -> b) -> a -> (b -> c) -> c
quirkybird a -> b
f a
x b -> c
g = b -> c
g (a -> b
f a
x)

-- | Q4
quackybird :: a -> (a -> b) -> (b -> c) -> c
quackybird :: a -> (a -> b) -> (b -> c) -> c
quackybird a
x a -> b
f b -> c
g = b -> c
g (a -> b
f a
x)

-- | R
robin :: b -> (a -> b -> c) -> a -> c
robin :: b -> (a -> b -> c) -> a -> c
robin b
x a -> b -> c
f a
y = a -> b -> c
f a
y b
x

-- | S
-- Haskell @('<*>')@ in 'Applicative'
starling :: (a -> b -> c) -> (a -> b) -> a -> c
starling :: (a -> b -> c) -> (a -> b) -> a -> c
starling a -> b -> c
f a -> b
g a
x = a -> b -> c
f a
x (a -> b
g a
x)

-- | T
thrush :: a -> (a -> b) -> b
thrush :: a -> (a -> b) -> b
thrush a
x a -> b
f = a -> b
f a
x

-- | U
turing :: (a -> (b -> c) -> b) -> (b -> c) -> c
turing :: (a -> (b -> c) -> b) -> (b -> c) -> c
turing a -> (b -> c) -> b
f b -> c
g = b -> c
g (a -> (b -> c) -> b
f a
forall b. b
f' b -> c
g) where f' :: b
f' = (a -> (b -> c) -> b) -> b
forall a b. a -> b
unsafeCoerce a -> (b -> c) -> b
f

-- | V
vireo :: a -> b -> (a -> b -> c) -> c
vireo :: a -> b -> (a -> b -> c) -> c
vireo a
x b
y a -> b -> c
f = a -> b -> c
f a
x b
y

-- | W
warbler :: (a -> a -> b) -> a -> b
warbler :: (a -> a -> b) -> a -> b
warbler a -> a -> b
f a
x = a -> a -> b
f a
x a
x

-- | W1
converseWarbler :: a -> (a -> a -> b) -> b
converseWarbler :: a -> (a -> a -> b) -> b
converseWarbler = ((a -> a -> b) -> a -> b) -> a -> (a -> a -> b) -> b
forall a b c. (a -> b -> c) -> b -> a -> c
cardinal (a -> a -> b) -> a -> b
forall a b. (a -> a -> b) -> a -> b
warbler

-- | Y
whybird :: (x -> x) -> x
whybird :: (x -> x) -> x
whybird x -> x
x = x -> x
x ((x -> x) -> x
forall x. (x -> x) -> x
whybird x -> x
x)

-- | I*
-- Haskell @('$')@
idiot' :: ((a -> b) -> a) -> (a -> b) -> a
idiot' :: ((a -> b) -> a) -> (a -> b) -> a
idiot' (a -> b) -> a
f a -> b
g = (a -> b) -> a
f a -> b
g

-- | W*
warbler' :: (a -> b -> b -> c) -> a -> b -> c
warbler' :: (a -> b -> b -> c) -> a -> b -> c
warbler' a -> b -> b -> c
f a
x b
y = a -> b -> b -> c
f a
x b
y b
y

-- | C*
cardinal' :: (a -> b -> c -> d) -> a -> c -> b -> d
cardinal' :: (a -> b -> c -> d) -> a -> c -> b -> d
cardinal' a -> b -> c -> d
f a
x c
y b
z = a -> b -> c -> d
f a
x b
z c
y

-- | R*
robin' :: (a -> b -> c -> d) -> c -> a -> b -> d
robin' :: (a -> b -> c -> d) -> c -> a -> b -> d
robin' a -> b -> c -> d
f c
x a
y b
z = a -> b -> c -> d
f a
y b
z c
x

-- | F*
finch' :: (a -> b -> c -> d) -> c -> b -> a -> d
finch' :: (a -> b -> c -> d) -> c -> b -> a -> d
finch' a -> b -> c -> d
f c
x b
y a
z = a -> b -> c -> d
f a
z b
y c
x

-- | V*
vireo' :: (a -> b -> c -> d) -> b -> a -> c -> d
vireo' :: (a -> b -> c -> d) -> b -> a -> c -> d
vireo' a -> b -> c -> d
f b
x a
y c
z = a -> b -> c -> d
f a
y b
x c
z

-- | I**
idiot'' :: (a -> b -> c) -> a -> b -> c
idiot'' :: (a -> b -> c) -> a -> b -> c
idiot'' a -> b -> c
f a
g b
h =  a -> b -> c
f a
g b
h

-- | W**
warbler'' :: (a -> b -> c -> c -> d) -> a -> b -> c -> d
warbler'' :: (a -> b -> c -> c -> d) -> a -> b -> c -> d
warbler'' a -> b -> c -> c -> d
f a
x b
y c
z = a -> b -> c -> c -> d
f a
x b
y c
z c
z

-- | C**
cardinal'' :: (a -> b -> c -> d -> e) -> a -> b -> d -> c -> e
cardinal'' :: (a -> b -> c -> d -> e) -> a -> b -> d -> c -> e
cardinal'' a -> b -> c -> d -> e
f a
x b
y d
z c
w = a -> b -> c -> d -> e
f a
x b
y c
w d
z

-- | R**
robin'' :: (a -> b -> c -> d -> e) -> a -> d -> b -> c -> e
robin'' :: (a -> b -> c -> d -> e) -> a -> d -> b -> c -> e
robin'' a -> b -> c -> d -> e
f a
x d
y b
z c
w = a -> b -> c -> d -> e
f a
x b
z c
w d
y

-- | F**
finch'' :: (a -> b -> c -> d -> e) -> a -> d -> c -> b -> e
finch'' :: (a -> b -> c -> d -> e) -> a -> d -> c -> b -> e
finch'' a -> b -> c -> d -> e
f a
x d
y c
z b
w = a -> b -> c -> d -> e
f a
x b
w c
z d
y

-- | V**
vireo'' :: (a -> b -> c -> d -> e) -> a -> c -> d -> b -> e
vireo'' :: (a -> b -> c -> d -> e) -> a -> c -> d -> b -> e
vireo'' a -> b -> c -> d -> e
f a
x c
y d
z b
w = a -> b -> c -> d -> e
f a
x b
w c
y d
z

-- | KI
kite :: a -> b -> b
kite :: a -> b -> b
kite a
_ b
y = b
y

-- | Omega
--   The omega bird looks as mockingbird mockingbird.
--   But, I've implemented this as itself, because omega isn't going to stop anyway.
omega :: a
omega :: a
omega = a
forall b. b
omega -- mockingbird mockingbird

-- | KM
konstantMocker :: c -> (a -> b) -> b
konstantMocker :: c -> (a -> b) -> b
konstantMocker = ((a -> b) -> b) -> c -> (a -> b) -> b
forall a b. a -> b -> a
kestrel (a -> b) -> b
forall a b. (a -> b) -> b
mockingbird

-- | C(KM)
crossedKonstantMocker :: (a -> b) -> c -> b
crossedKonstantMocker :: (a -> b) -> c -> b
crossedKonstantMocker = (c -> (a -> b) -> b) -> (a -> b) -> c -> b
forall a b c. (a -> b -> c) -> b -> a -> c
cardinal c -> (a -> b) -> b
forall c a b. c -> (a -> b) -> b
konstantMocker

-- | Theta
theta :: (a -> a) -> a
theta :: (a -> a) -> a
theta = (((a -> a) -> a) -> (a -> a) -> a) -> (a -> a) -> a
forall x. (x -> x) -> x
whybird ((a -> a) -> a) -> (a -> a) -> a
forall a b. ((a -> b) -> a) -> (a -> b) -> b
owl