New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature request - Haskell's $ operator #2415
Comments
Comment author: ertai Would love to have it too. Simple and useful. |
Comment author: @johnwhitington Make use of the fact that & is deprecated for logical AND and write: let ( & ) a b = a b You can then write f a b & g c & h 0 or whatever. Also, it can be read as "and" as in "reverse and flatten and fold" etc. |
Comment author: ertai Cool, thanks for the solution... Will using it from now and kill some parentheses :) |
Comment author: @dbuenzli I really like it aswell, can make some code much clearer. Would be nice if the fun call could be optimized away. Daniel |
Comment author: ertai Here is a bit of Camlp4 (compile with the version from CVS) to do that: $ cat pa_app.ml $ ocamlc -pp camlp4rf -c -I +camlp4 pa_app.ml |
Comment author: @lefessan This feature was implemented by Xavier Clerc in 3.12.1+dev and I backported it to trunk in commit r12070. |
Comment author: jessicah Can the feature also include defining the actual function/operator, not just the compiler primitive? From what I've been able to see, one hasn't been defined in pervasives. And whilst (&) is deprecated, I'd recommend against using this, as it conflicts with jocaml. Is there any reason ocaml can't add the ($) operator (and change the needed precedence/associativity rules)? |
Comment author: @garrigue There is a very good reason not to change the associativity for ($): |
Original bug ID: 2415
Reporter: administrator
Assigned to: @lefessan
Status: closed (set by @xavierleroy on 2015-12-11T18:04:38Z)
Resolution: fixed
Priority: normal
Severity: feature
Fixed in version: 4.00.0+dev
Category: ~DO NOT USE (was: OCaml general)
Monitored by: mehdi @glondu @dbuenzli
Bug description
Full_Name: Charles Martin
Version:
OS:
Submission from: 65.57.245.11 (65.57.245.11)
FEATURE REQUEST
Would love to have Haskell's $ operator added to OCaml. Definining it myself as
doesn't work because of precedence and associativity.
Charles
The text was updated successfully, but these errors were encountered: