On Tue, Nov 16, 2010 at 3:26 PM, Michael Ekstrand wrote: > > Batteries provides operators for things like this. It defines the '**>' > operator for function application; it's an odd name, but it has the > right associativity. As Dmitry mentioned, some override (&). Batteries > also provides composition operators |- and -|, and a pipeline operator > |> (opposite of **>). With that operator, you can write: > > f x y |> ignore > > thereby putting the emphasis on "f x y" and relegating "ignore" to a > cleanup at the end. > > - Michael (<|) as inverse of (|>) is also available. It doesn't have the "right" associativity, but you can easily use (f -| g -| h <| x) instead of (f **> g **> h **> x). Though I find the application-as-pipeline style quite readable in some cases, I think that in general it is more often superfluous than not. Besides, as mentioned recently on this list, overuse of the function composition operators (|-) and (-|) are also call for troubles with the value restriction. All in all, I think it's reasonable to stay conservative and not advertise funky binary operators too loudly. That said, domain-specific binary operators are certainly useful for readability in some contexts --- that's what an infix operator is anyway : an unreadable-by-design symbol that only get meaning by domain-specific conventions. Local open in, available by standard since OCaml 3.12, allow us to neatly encapsulate such domain-specific notations into OCaml modules.