[Haskell-cafe] Pointfree composition for higher arity

Neil Brown nccb2 at kent.ac.uk
Wed Feb 17 10:35:54 EST 2010


Sean Leather wrote:
> I find myself often writing this pattern:
>
>     someFun x y z = ...   
>
>      
>
>     fun y z = runFun $ someFun someDefault y z
>
>
> or, alternatively:
>
>     fun y = runFun . someFun someDefault y
>
I very often write this too (wanting function composition, but with a 
two-argument function on the right hand side).  The trick I picked up 
from somewhere is to do:

fun = (runFun .) . someFun someDefault

I'm not too keen on that, as it seems clumsy.  I often end up writing 
the operator that you describe, but have never settled on a consistent 
name (since the obvious one to me, (..), is taken).

Thanks,

Neil.


More information about the Haskell-Cafe mailing list