Question

I have two type declarations for control structures at different levels in a program. The bottom one is the Agent, a StateT with IO capabilities. The second one is another StateT with Agent capabilities, and the third one (Plan) is an ErrorT.

type Agent = StateT AgentState IO
type Plan = ErrorT PlanError (StateT PlanState Agent)

What is the best way to evaluate a Plan? I wrote the following code, but it is not very handful because there are loads of nested runStateT and runErrorT calls.

foo :: Plan ()
defaultAgentState :: AgentState
runStateT (runStateT (runErrorT foo) (PlanState 0)) defaultAgentState

Is there something simpler/nicer?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top