[Haskell-cafe] Is 'flip' really necessary?

Edward Z. Yang ezyang at MIT.EDU
Sun Jul 25 17:53:19 EDT 2010

Excerpts from aditya siram's message of Sun Jul 25 17:13:16 -0400 2010:
> Eta-reducing is nice, and sometimes it makes code more readable. But 'flip'
> is one of those functions that always seems to hinder rather than help
> readability, conversely factoring out flip always makes code easier to
> comprehend. I don't see a need for its existence - maybe I'm missing
> something and more experienced Haskellers can comment.

An interesting alternate spin on flip is infix notation combined with partial
application, such as:

    (`foobar` 3)

which is equivalent to

    \x -> foobar x 3

I frequently use this, although the jury's out on whether or not it's more readable.


More information about the Haskell-Cafe mailing list