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 variable definitions #3181

Merged
merged 15 commits into from
Nov 25, 2024
Merged

Allow pattern-matching in variable definitions #3181

merged 15 commits into from
Nov 25, 2024

Conversation

lukaszcz
Copy link
Collaborator

@lukaszcz lukaszcz commented Nov 20, 2024

  • Closes Allow pattern-matching in lets (and other definitions) for records and other single-constructor types #3118
  • Allows patterns on the left-hand sides of definitions. To avoid clashes with constructor names, the patterns need to be enclosed in parentheses or have the form n@.... A standalone symbol x in a definition x := ... is always interpreted as an identifier even if there exists a constructor x.
  • Left-hand side patterns are desugared in the translation from Concrete to Internal. If the inductive type has more than one constructor, non-exhaustive pattern matching error will later be given by the pattern matching compiler.

@lukaszcz lukaszcz added this to the 0.6.9 milestone Nov 20, 2024
@lukaszcz lukaszcz self-assigned this Nov 20, 2024
@lukaszcz lukaszcz force-pushed the let-patterns branch 2 times, most recently from 6e5f02f to 020e876 Compare November 22, 2024 13:03
@lukaszcz lukaszcz marked this pull request as ready for review November 22, 2024 13:10
@lukaszcz lukaszcz requested review from janmasrovira and paulcadman and removed request for janmasrovira November 22, 2024 13:11
@janmasrovira
Copy link
Collaborator

reviewing...

refactors _signName so that the type is more explicit
@lukaszcz lukaszcz merged commit 3c74c37 into main Nov 25, 2024
4 checks passed
@lukaszcz lukaszcz deleted the let-patterns branch November 25, 2024 09:27
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 this pull request may close these issues.

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