プログラムのさまざまなレベルの制御構造に対して2つの型宣言があります。一番下は、Agent
機能付きStateT
のです。IO
2つ目は機能を備えた別のものStateT
でAgent
、3つ目(Plan
)はErrorT
。です。
type Agent = StateT AgentState IO
type Plan = ErrorT PlanError (StateT PlanState Agent)
評価するための最良の方法は何Plan
ですか?runStateT
私は次のコードを書きましたが、ネストされたrunErrorT
呼び出しがたくさんあるため、それほど便利ではありません。
foo :: Plan ()
defaultAgentState :: AgentState
runStateT (runStateT (runErrorT foo) (PlanState 0)) defaultAgentState
もっとシンプルで素敵なものはありますか?