[Haskell-cafe] Pointfree composition for higher arity

wren ng thornton wren at freegeek.org
Fri Feb 19 23:42:03 EST 2010

Sean Leather wrote:
> The second option approaches the ideal pointfreeness (or pointlessness if
> you prefer), but I'd like to go farther:
> (...) :: (c -> d) -> (a -> b -> c) -> a -> b -> d
>> (...) f g x y = f (g x y)
>> infixr 9 ...

I go with infixl 8 personally. It seems to play better with some of the 
other composition combinators.

In a somewhat different vein than Oleg's proposed general composition, 
I've particularly enjoyed Matt Hellige's pointless fun combinators[0]. I 
have a version which also adds a strict application combinator in my 
desiderata package[1] so we can say things like:

     foo $:: bar ~> baz !~> bif

which translates to:

     \a b -> bif (foo (bar a) (baz $! b))

These combinators are especially good when you don't just have a linear 
chain of functions.

[0] http://matt.immute.net/content/pointless-fun

Live well,

More information about the Haskell-Cafe mailing list