StateT's catchError discards changes to state
まだ誰も着手していません。
評価
- 難易度
- 1/5
- 見積もり時間
- 1時間未満
- 初心者へのやさしさ
- 28/100
- issue の種類
- ドキュメント
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
調査の方向性
The issue identifies the StateT documentation as the place to explain this behavior, but names no documentation file or test. Start by locating the StateT documentation and reviewing its existing description of catchError. Done means the docs explain that state changes made before an error are discarded in this transformer stack.
索引モデルが issue の本文から書いたものです。
説明
StateT's catchError doesn't take into account that the state can change in the call to is first parameter:
instance monadErrorStateT :: MonadError e m => MonadError e (StateT s m) where
catchError (StateT m) h =
StateT \s -> catchError (m s) (\e -> case h e of StateT f -> f s)
StateT's function m COULD change state and if it does, that state change is lost, i.e. it's neither captured nor is it passed to f.
This is ONLY noticeable when you have a Stack where StateT is ABOVE ExceptT otherwise StateT's catchError will NOT be called.
After many tests, I've come to the conclusion that this CANNOT be fixed. Here was my initial attempt to fix it:
instance monadErrorStateT :: MonadError e m => MonadError e (StateT s m) where
catchError (StateT m) h =
StateT \s -> m s >>= \t@(Tuple _ s') -> catchError (pure t) (\e -> case h e of StateT f -> f s')
The problem is that ExceptT is BELOW StateT in the Stack. That means that m s >>= ... will Short-circuit, which is NOT the desired behavior here.
I cannot see any way to capture the changes made to the state by the first call that won't Short-circuit.
So, the only question that remains is how to communicate this information in the docs. The only place that makes sense in the StateT docs.
- 主要言語
- PureScript
- スター
- 72
- フォーク
- 43
- 平均マージ
- 2日 23時間
- マージ済み PR(30日)
- 1
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
purescript/purescript-transformers のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 52/100
-
type: breaking change
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
purescript/purescript-transformers#144 · コメント 2 件 ·
-
type: enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 18/100
purescript/purescript-transformers#123 · コメント 4 件 ·
-
maybeToExceptTオープンtype: enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 42/100
-
type: documentation
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
purescript/purescript-transformers#117 · コメント 6 件 ·
purescript/purescript-transformers の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
kubescape/node-agent#1099 ·
メンテナーはふだん 1 日以内に返信
-
[workshop-sim] Improve: Provide a concrete example and activity checks in agentic intro (step 5)オープンfeedback simulation workshop
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
githubnext/gh-aw-workshop#5715 ·
メンテナーはふだん 1 日以内に返信
-
documentation type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
area-multi-tenancy p1-recommended technical-debt
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
Docs: 2 broken linksオープンBug pulumi/pulumi-terraform-bridge R2 S2
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
pulumi/pulumi-terraform-bridge#3713 ·
メンテナーはふだん 1 日以内に返信