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

Parser/Printer: unify uncurried functions of arity 0, and of arity 1 taking unit. #5825

Merged
merged 7 commits into from
Nov 19, 2022

Conversation

cristianoc
Copy link
Collaborator

@cristianoc cristianoc commented Nov 18, 2022

  • Don't emit arity 0 for uncurried functions and types
  • Get around the front-end's special treatment of application with () as zero-arity application, by using annotation @res.uapp for uncurried applications and have the compiler front-end treat it specially.
  • Don't distinguish between types (. ) => int and (. unit) => int or in uncurried notation, between () => int and unit=>int.
  • Don't distinguish between foo(.) and foo(. e), both unary applications
  • Don't distinguish between (. ) => 3 and (. x) => x+1 both unary function definitions

This brings the uncurried subset of the language closer to the curried one.

@bobzhang
Copy link
Member

I didn't dig into the details FYI the main use case for arity 0 is FFI where some Js functions need a arity 0 call back

@cristianoc
Copy link
Collaborator Author

I didn't dig into the details FYI the main use case for arity 0 is FFI where some Js functions need a arity 0 call back

I'll have some questions about implementation cleanup later, but for now looking at the user experience. Got into some issues when converting existing code to uncurried by default. The ideal conversion being: just do nothing. This did not work until now, but after removing arity 0 from the uncurried language that the user sees, it does work.

@cristianoc cristianoc changed the title Test: don't emit arity zero from the parser. Parser/Printer: unify uncurried functions of arity 0, and of arity 1 taking unit. Nov 19, 2022
@cristianoc cristianoc merged commit 611d3a8 into master Nov 19, 2022
@cristianoc cristianoc deleted the test_no_arity_0 branch November 19, 2022 09:59
@cristianoc cristianoc mentioned this pull request Nov 20, 2022
15 tasks
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 this pull request may close these issues.

2 participants