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

Treat uncurried application of primitives like curried application #5851

Merged
merged 1 commit into from
Nov 26, 2022

Conversation

cristianoc
Copy link
Collaborator

Primitives are treated specially in the type checker, so that when fully applied, no function is generated. With uncurried application, primitives are wrapped with eta expansion before being used, because the encoding via Js.Internal.opaqueFullApply disables the special treatment by the type checker. This PR treats uncurried application of primitives like curried application, to help Lam compilation produce better code instead of leaving eta-expanded functions in the output.

Primitives are treated specially in the type checker, so that when fully applied, no function is generated.
With uncurried application, primitives are wrapped with eta expansion before being used, because the encoding via `Js.Internal.opaqueFullApply` disables the special treatment by the type checker.
This PR treats uncurried application of primitives like curried application, to help `Lam` compilation produce better code instead of leaving eta-expanded functions in the output.
@cristianoc
Copy link
Collaborator Author

See also #5847 which also addresses improving the generated code, via some Lam compilation optimisation.

@cristianoc cristianoc mentioned this pull request Nov 26, 2022
15 tasks
@cristianoc cristianoc merged commit 4e95019 into master Nov 26, 2022
@cristianoc cristianoc deleted the uncurried_primitives branch November 26, 2022 11:27
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.

None yet

1 participant