Skip to content

Add surface syntax for partial application of uncurried functions. #6165

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

Closed
cristianoc opened this issue Apr 16, 2023 · 0 comments · Fixed by #6166
Closed

Add surface syntax for partial application of uncurried functions. #6165

cristianoc opened this issue Apr 16, 2023 · 0 comments · Fixed by #6166
Milestone

Comments

@cristianoc
Copy link
Collaborator

Current placeholder syntax uses attributes:

@@uncurried

let add = (x,y,z) => x+y+z

let ptl1 =  @res.partial add(1)

let v1 = ptl1(2,3)
Js.log2("v1:", v1)
@cristianoc cristianoc added this to the v11.0 milestone Apr 16, 2023
cristianoc added a commit that referenced this issue Apr 16, 2023
Fixes #6165

This PR introduces a new surface syntax for partial application of uncurried functions in ReScript. The syntax allows developers to partially apply uncurried functions more easily and concisely using the ... token in argument lists. The implementation includes changes to the parser, grammar, and printer to handle the new syntax properly.

Example:

res
Copy code
let add = (a, b) => a + b
let ptl1 = add(1, ...)
let result = ptl1(2) // result will be 3
This example demonstrates the new syntax for partial application of the uncurried add function.
cristianoc added a commit that referenced this issue Apr 17, 2023
)

* Add surface syntax for partial application of uncurried functions

Fixes #6165

This PR introduces a new surface syntax for partial application of uncurried functions in ReScript. The syntax allows developers to partially apply uncurried functions more easily and concisely using the ... token in argument lists. The implementation includes changes to the parser, grammar, and printer to handle the new syntax properly.

Example:

res
Copy code
let add = (a, b) => a + b
let ptl1 = add(1, ...)
let result = ptl1(2) // result will be 3
This example demonstrates the new syntax for partial application of the uncurried add function.

* Update CHANGELOG.md

Co-authored-by: Christoph Knittel <ck@cca.io>

* Update CHANGELOG.md

* Update CHANGELOG.md

---------

Co-authored-by: Christoph Knittel <ck@cca.io>
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

Successfully merging a pull request may close this issue.

1 participant