google / google/codeworld

Requirements: Captures for matching rules

オープン
#774 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
enhancement
主要言語
Haskell
スター
1.3k
フォーク
201
PR マージ指標
30日以内にマージされた PR はありません

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず #772 で参照されている matching-rule 機能を読み、match 構文、パターン、式がどのように表現されているかを追跡します。__var_x が同等のパターン変数と式変数をどのように束縛するかを定義し、そのうえで例が指定どおりにマッチするか、または失敗するかを検証します。キャプチャされた match が、既存の __var の動作を壊すことなく環境から利用できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
haskell
領域
compilers
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。