Requirements: Captures for matching rules
- Vorherrschende Sprache
- Haskell
- Sterne
- 1.3k
- Forks
- 201
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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.
Beitragsleitfaden
Rechercherichtung
Lies zunächst das in #772 referenzierte Matching-Rule-Feature und verfolge, wie Match-Syntax, Muster und Ausdrücke dargestellt werden. Definiere, wie __var_x äquivalente Muster- und Ausdrucksvariablen bindet, und überprüfe anschließend, dass die Beispiele wie angegeben übereinstimmen oder fehlschlagen. Als abgeschlossen gilt die Aufgabe, wenn erfasste Matches in der Umgebung verfügbar sind, ohne das bestehende Verhalten von __var zu beeinträchtigen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- haskell
- Bereich
- compilers
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 25/100