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

Fix parsing of partial application with pipe #6325

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

glennsl
Copy link
Contributor

@glennsl glennsl commented Jul 8, 2023

Not sure if this is an appropriate fix, but if it is I also need to fix printing.

Fixes #6321

| DotDotDot when args <> [] ->
| DotDotDot ->
Copy link
Contributor Author

@glennsl glennsl Jul 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason for this restriction beyond the fact that f(...) can simple be reduced to f (if not piped)? Is it safe to remove it?

(ReactEvent.Mouse.t -> unit, [ `Has_arity1 ]) function$ as 'callback
let partialPipe = x |.u ((f ())[@res.partial ][@res.uapp ])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about the (). Try an example and see if it type checks correctly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, it shouldn't be there. But if I remove it, the above end up as:

let partialPipe = x |.u f

Seems the whole apply expression is replaced by just the function identifier, which makes sense in itself of course, but that also means the attributes are dropped. Might not be so easy to fix this one.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes looks like fixing this one is more complicated and might need to involve the processing of the partial attribute later in the compiler.
E.g. conceptually I guess the attribute belongs to |.u in that example. Or perhaps putting it on f is fine.
Guess it does not matter much -- just some representation picked up deeper down in the compiler.

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.

Syntax: Partial application of uncurried function does not work naturally with pipe
2 participants