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

Support or-patterns #232

Open
RyanGlScott opened this issue Oct 25, 2024 · 0 comments
Open

Support or-patterns #232

RyanGlScott opened this issue Oct 25, 2024 · 0 comments

Comments

@RyanGlScott
Copy link
Collaborator

th-desugar does not currently support or-patterns (introduced in GHC 9.12), and attempting to desugar an or-pattern will result in an error. In order to support or-patterns, we will need to answer the following questions:

  1. Should we add a DOrP constructor to DPat, or should we attempt to desugar or-patterns into simpler patterns (à la match flattening)? See this issue.
  2. Relatedly, GHC flattens matches on or-patterns by desugaring them into view patterns (see this Note), but th-desugar doesn't support view patterns. How should match flattening be handled on the th-desugar side?
  3. How should we handle an as-pattern such as p@(A ; B ; C)? Note that or-patterns are not invertible, which means that they are susceptible to this issue.
RyanGlScott added a commit that referenced this issue Oct 25, 2024
Handling or-patterns in full generality is tricky (see #232), so for now, we
simply error if we attempt to desugar an or-pattern.

Checks off one box in #231.
RyanGlScott added a commit that referenced this issue Oct 26, 2024
Handling or-patterns in full generality is tricky (see #232), so for now, we
simply error if we attempt to desugar an or-pattern.

Checks off one box in #231.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant