[Haskell-cafe] Pointfree composition for higher arity

Stephen Tetley stephen.tetley at gmail.com
Wed Feb 17 11:15:05 EST 2010


On 17 February 2010 16:05, Mike Dillon <mike at embody.org> wrote:
...

> Are you kidding me? I love writing code like this:
>
>    ooooo = bunting bunting cardinal thrush blackbird
>
> :)

Hi Mike

Thanks! - it took me a surprising amount of time to get from this
(where I cheated and used an online 'combinator calculator'):

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

... to this:

psi :: (b -> b -> c) -> (a -> b) -> a -> a -> c
psi = cardinal (bluebird starling (bluebird cardinalstar dovekie)) applicator


More information about the Haskell-Cafe mailing list