[Haskell-cafe] Pointfree composition for higher arity
Mike Dillon
mike at embody.org
Wed Feb 17 11:26:03 EST 2010
begin Stephen Tetley quotation:
> 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
I just typed a bunch of bird names together, saw that the signature
appeared to be "ooooo", and ran a quick test to confirm :)
-md
More information about the Haskell-Cafe
mailing list