[Haskell-cafe] Syntax proposal for "reverse apply"/"pipeline apply" (flip ($))
Dan Burton
danburton.email at gmail.com
Wed Apr 16 23:49:31 UTC 2014
In the "lens" package, this is (&) at infixl 1. In the "diagrams" package,
this is (#) at infixl 8. You're certainly not the first to want this, but
nobody can ever agree what it should be called or what fixity it should
have. You can always just define it yourself.
-- Dan Burton
On Wed, Apr 16, 2014 at 3:25 PM, Alexey Muranov <alexey.muranov at gmail.com>wrote:
> Hello,
>
> i am completely new to Haskell, but i am somewhat fascinated by
> lambda-calculus and programming.
>
> For whatever it is worth, i would like to propose for discussion a syntax
> for "(flip ($))" operation in Haskell.
>
> I think that a good syntax would be "|^", for example:
>
> square x = x * x
> y = 3 |^ square -- y == 9
>
>
> Explanation:
>
> * i would have suggested just ^, but it would conflict with number
> exponentiation,
>
> * it is rather common in mathematics to write function application in
> exponential notation: x ^ f instead of f(x), especially if f is an
> automorphism of some structure,
>
> * (flip ($)) is exactly the exponentiation of Church numerals,
>
> * in "The calculi of lambda-conversion", Alonzo Church uses the
> "shorthand" notation "[N^M]" for "(MN)", where M and N are lambda-terms.
>
> * I am probably not the only person missing the ability to apply functions
> from the right:
>
> http://stackoverflow.com/questions/1457140/haskell-composition-vs-fs-pipe-forward-operator
>
> Well, other notations i've thought of are "\^" and "~$".
>
> Alexey.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140416/818eebe7/attachment.html>
More information about the Haskell-Cafe
mailing list