[Haskell-cafe] Pointfree composition for higher arity

Sean Leather leather at cs.uu.nl
Wed Feb 17 10:31:16 EST 2010


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
>

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 ...
>

>
fun = runFun ... someFun someDefault
>

There, that's better. More points for fewer points (which means I should
really change the name from fun to pun).

Does anybody else care about this? What are some alternative solutions? I'd
love to have something like this available in the Prelude or a library. (I
have no strong feelings about the particular operator.)

Regards,
Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100217/b7da2a07/attachment.html


More information about the Haskell-Cafe mailing list