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

Generate Apply instances with explicit kind arguments #603

Merged
merged 1 commit into from
Jun 19, 2024

Conversation

RyanGlScott
Copy link
Collaborator

After the changes in GHC#23515 are implemented, some Apply instances will fail to compile due to their left-hand sides being kind-generalized to something that is more polymorphic than what their right-hand sides will allow. For example, this commonly occurs when generating Apply instances for lambda-lifted definitions or declarations whose kinds use visible dependent quantification.

We avoid this issue by now generating Apply instances with explicit kind arguments (via TypeApplications), leveraging the fact that we know what the kinds are (most of the time) during defunctionalization. See the new section of Note [Defunctionalization game plan], Wrinkle 2: Non-vanilla kinds for the full details.

Resolves the "Defunctionalizing declarations using visible dependent quantification" section of #601.

After the changes in
[GHC#23515](https://gitlab.haskell.org/ghc/ghc/-/issues/23515) are implemented,
some `Apply` instances will fail to compile due to their left-hand sides being
kind-generalized to something that is more polymorphic than what their
right-hand sides will allow. For example, this commonly occurs when generating
`Apply` instances for lambda-lifted definitions or declarations whose kinds use
visible dependent quantification.

We avoid this issue by now generating `Apply` instances with explicit kind
arguments (via `TypeApplications`), leveraging the fact that we know what the
kinds are (most of the time) during defunctionalization. See the new section of
`Note [Defunctionalization game plan], Wrinkle 2: Non-vanilla kinds` for the
full details.

Resolves the "Defunctionalizing declarations using visible dependent
quantification" section of #601.
@RyanGlScott RyanGlScott force-pushed the explicit-apply-kind-arguments branch from ceb48a1 to 429961a Compare June 18, 2024 11:20
@RyanGlScott RyanGlScott merged commit 95ce374 into master Jun 19, 2024
24 checks passed
@RyanGlScott RyanGlScott deleted the explicit-apply-kind-arguments branch June 19, 2024 10:55
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.

1 participant