Skip to content
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

Make pipe-first work with uncurried functions #4342

Closed
yawaramin opened this issue May 2, 2020 · 2 comments
Closed

Make pipe-first work with uncurried functions #4342

yawaramin opened this issue May 2, 2020 · 2 comments

Comments

@yawaramin
Copy link
Contributor

yawaramin commented May 2, 2020

Currently, this:

let f = (. x, y) => x + y;
let x = 1->f(. 2);

Does not work, with the error:

We've found a bug for you!
OCaml preview 2:15

This is an uncurried BuckleScript function. It must be applied with a dot.

Like this: foo(. a, b)
Not like this: foo(a, b)

This guarantees that your function is fully applied. More info here:
https://bucklescript.github.io/docs/en/function.html#solution-guaranteed-uncurrying

As we are placing more emphasis on uncurried syntax in BuckleScript, I think it makes sense to have the pipe-first operator work with uncurried functions as well.

@bobzhang
Copy link
Member

bobzhang commented May 5, 2020

I suggest this being done on the reason side in the parsing stage instead of relying on ppx.
cc @IwanKaramazow @anmonteiro

@bobzhang
Copy link
Member

bobzhang commented May 5, 2020

moved into reasonml/reason#2569

@bobzhang bobzhang closed this as completed May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants