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

Nested uncurrying + paren hugging #1803

Merged
merged 2 commits into from
Feb 7, 2018

Conversation

IwanKaramazow
Copy link
Contributor

As @cristianoc pointed out, nested uncurrying should be possible:

add(. 2)(. 3);

now formats as

add(. 2, . 3);

Also adds test cases/support for uncurried syntax with "paren hugging":

f(. (1, 2));
f(. {
  a: "supersupersupersupersupersuperlong",
  b: "supersupersupersupersupersuperlong",
});

Iwan added 2 commits February 1, 2018 14:42
@chenglou
Copy link
Member

chenglou commented Feb 2, 2018

Hummm, not sure we should support add(. 2, . 3)? Should we?

@IwanKaramazow
Copy link
Contributor Author

Unfortunately, I think we should.

  • The behaviour in master is a bug. I'd rather have the parser be "resilient" against this case.
  • It's consistent with the formatting of add(2)(3) -> add(2, 3)
  • It's consistent with types where we allow type f = (int, . int) => unit (but here it get's reformatted to type f = int => (.int) => unit;, unfortunately we don't have enough info at print time to do the same with expressions

@jordwalke
Copy link
Member

I don't see this as a super common use case, so I'm happy to see anything that makes the implementation cleaner and/or more consistent.

@chenglou
Copy link
Member

chenglou commented Feb 7, 2018

^ Sounds good then. Merging! Haven't corrected the outcome printer yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants