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

Simplify binary lambdas with intermediate decls #877

Merged
merged 1 commit into from
Apr 26, 2022

Conversation

apaszke
Copy link
Collaborator

@apaszke apaszke commented Apr 25, 2022

We used to make a simplifying assumption that the binary lambda
arguments to effect handlers have no decls in between the first and
second lambda binder. However, it's been easy to violate that
assumption, because inference likes to insert decls while unpacking
patterns. This meant that accumulating over a monoid such as
AddMonoid Complex caused a simplification error, because of Complex
argument unpacking.

This change relaxes the constraint slightly, to allow for the
problematic decls. However, it's still not a complete solution as it
assumes that the second binder and the eventual reconstruction don't
depend on those decls. This seems sufficient for now and we can always
revise that in the future.

This unblocks #876.

We used to make a simplifying assumption that the binary lambda
arguments to effect handlers have no decls in between the first and
second lambda binder. However, it's been easy to violate that
assumption, because inference likes to insert decls while unpacking
patterns. This meant that accumulating over a monoid such as
`AddMonoid Complex` caused a simplification error, because of `Complex`
argument unpacking.

This change relaxes the constraint slightly, to allow for the
problematic decls. However, it's still not a complete solution as it
assumes that the second binder and the eventual reconstruction don't
depend on those decls. This seems sufficient for now and we can always
revise that in the future.
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