google / google/codeworld

Requirements: Captures for matching rules

Aperta
#774 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
Haskell
Stelle
1.3k
Fork
201
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

In addition to the feature in #772, allow matching rules to capture matches into an environment. For instance, you should be able to write:

f(__var_x) = __var_x + 42

and this should match any of:

f(x) = x + 42
f(banana) = banana + 42

but not

f(x) = y + 42

Note that this extends the syntax of matches... `__var_x` carries all the same requirements as `__var`, but also binds the match. There's some flexibility though, since on the left-hand side above, `__var` matches a `PVar` (pattern variable), while on the right, it matches a `Var`. There should be an equivalence of sorts between patterns and expressions, by which a match of patterns that are also valid expressions (like `PVar _ (Ident _ a)` and `Var _ (UnQual _ (Ident _ a))` match each other.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.