Impl Irrefutable Patterns in Match Exprs
- Dominant language
- Haskell
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Currently `Ast.Pat` (irrefutable patterns) and `Ast.RefutPat` are totally separate. It would be nice to relate them so that an `Ast.Pat` can be used wherever an `Ast.RefutPat` is expected.
Could this be done using recursion schemes?
## Ex:
```haskell
data Pat r
= VarPat String
| TuplePat [r]
data RefutPat r
= VarRefutPat String
| VrntRefutPat String [r]
| IrrefutPat (Pat r)
```
Then let and match expressions would become:
```haskell
data Expr
...
| LetF (Pat (Fix Pat)) r
...
| MatchF r [(RefutPat (Fix RefutPat), Seq r)]
...
```
Hopefully this would simplify pattern matching/destructuring compilation in `TastToHir.hs`.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.