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

Allow pattern-matching in lets (and other definitions) for records and other single-constructor types #3118

Closed
lukaszcz opened this issue Oct 22, 2024 · 0 comments · Fixed by #3181
Assignees
Labels
Milestone

Comments

@lukaszcz
Copy link
Collaborator

lukaszcz commented Oct 22, 2024

We should allow:

let (x, y) := f a
in

and

let record@{field1; field2} := f a
in

This is convenient syntactic sugar which easily translates to pattern matching. We should allow it only for single-constructor types so there is no issue with non-exhaustive patterns.

For consistency, we can allow it everywhere where a function definition is expected.

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

Successfully merging a pull request may close this issue.

2 participants