Just to bring up some prior art, from what I've heard, F# calls this <font face="courier new, monospace">|></font>. In Clojure the <font face="courier new, monospace">-></font> function takes a value and a series of functions, and applies them in order from left to right, e.g. <font face="courier new, monospace">(-> 5 zero? not) ;;=> true</font>. Obviously, In OO languages, this is usually accomplished by chaining calls <font face="courier new, monospace">foo.bar().baz().quux()</font>.<div>
<br></div><div>I agree that Haskell should provide this idiom. I find <font face="courier new, monospace">&</font> to be a strange name for it, but to be honest, it's no stranger than <font face="courier new, monospace">$</font> so I say go for it. I would suggest <font face="courier new, monospace">|</font> to mimic the unix pipe, but this obviously clashes with Haskell guard syntax. I think <font face="courier new, monospace">|></font> is a reasonable name, but Data.Sequence has already claimed it.<br>
<br>-- Dan Burton<br><br><br>On Tue, Nov 20, 2012 at 9:59 AM, Yitzchak Gale <<a href="mailto:gale@sefer.org">gale@sefer.org</a>> wrote:<br>><br>> It is a common idiom to write a sequence of composed combinators in<br>
> reverse order to the way they would be written with ($) or (.). That<br>> naturally expresses the idea of the combinators as operations being<br>> applied in the given order.<br>><br>> This comes up so often, and is commonly used so many times in a single<br>
> expression, that Control.Arrow.>>> is far too wordy, and even a two-<br>> character operator is awkward.<br>><br>> Surprisingly, until recently the operator (&) was still not used in any<br>
> of the popular libraries, and its name naturally expresses the idea we are<br>
> looking for. This operator has now been defined in the lens package. We<br>> hereby propose to move it to its natural home for more general use,<br>> Data.Function.<br>><br>> As in the lens package, we define the operator as a flipped version of<br>
> ($), but with slightly higher precedence for better interaction with<br>> ($), and with left associativity. This definition has already proven<br>> useful and convenient even in the presence of the large and varied corpus<br>
> of combinators and operators in the lens package. (There it was formerly<br>> known as (%), but that clashed with the usual meaning of (%) from<br>> Data.Ratio.)<br>><br>> infixl 1 &<br>> (&) :: a -> (a -> b) -> b<br>
> a & f = f a<br>> {-# INLINE (&) #-}<br>><br>> Discussion period: 2 weeks <br>><br>> <a href="http://hackage.haskell.org/trac/ghc/ticket/7434">http://hackage.haskell.org/trac/ghc/ticket/7434</a><br>
><br>> Thanks,<br>> Yitz<br>><br>> _______________________________________________<br>> Libraries mailing list<br>> <a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>> <a href="http://www.haskell.org/mailman/listinfo/libraries">http://www.haskell.org/mailman/listinfo/libraries</a><br>
><br></div>