Allow custom error types in monad wrappers

オープン
#178 コメント 8 件 リアクション 7 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

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

調査の方向性

まず、モナドラッパーの定義、Alex a 型、および issue に示されている AlexError の処理を見つけます。型パラメーターの変更を評価する前に、Either String a のすべての使用箇所と、表示されている字句エラーの分岐を追跡します。ラッパーが字句解析位置のデータを含むカスタムエラー情報を、既存の動作を失うことなく保持できれば完了です。

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

説明

feature request wrapper

I want to extract the position information on lexing errors so I can send them to an LSP client, but the error type for the wrappers is hard coded to be string, so it is difficult to send along that extra information.
As far as I can tell, the change would mostly consist of replacing Either String a with Either err a, adding a corresponding type parameter to Alex a and adjusting the line

  AlexError ((AlexPn _ line column),_,_,_) -> alexError $ "lexical error at line " ++ (show line) ++ ", column " ++ (show column)
  1. Is there an easier way to do this?
  2. Am I missing some problems with this approach?
主要言語
Haskell
スター
323
フォーク
87
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

haskell/alex のほかの issue

haskell/alex の issue をすべて見る

似ている issue

Haskell の issue をもっと見る

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

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