chore: Use `StateRefT` in `Repl.lean`
This commit is contained in:
parent
6a7830cb71
commit
970c16a0a4
|
@ -12,7 +12,9 @@ structure State where
|
||||||
goalStates: Std.HashMap Nat GoalState := Std.HashMap.empty
|
goalStates: Std.HashMap Nat GoalState := Std.HashMap.empty
|
||||||
|
|
||||||
/-- Main state monad for executing commands -/
|
/-- Main state monad for executing commands -/
|
||||||
abbrev MainM := ReaderT Context (StateT State Lean.CoreM)
|
abbrev MainM := ReaderT Context $ StateRefT State Lean.CoreM
|
||||||
|
/-- Fallible subroutine return type -/
|
||||||
|
abbrev CR α := Except Protocol.InteractionError α
|
||||||
|
|
||||||
def newGoalState (goalState: GoalState) : MainM Nat := do
|
def newGoalState (goalState: GoalState) : MainM Nat := do
|
||||||
let state ← get
|
let state ← get
|
||||||
|
@ -24,10 +26,6 @@ def newGoalState (goalState: GoalState) : MainM Nat := do
|
||||||
return stateId
|
return stateId
|
||||||
|
|
||||||
|
|
||||||
-- HACK: For some reason writing `CommandM α := MainM (Except ... α)` disables
|
|
||||||
-- certain monadic features in `MainM`
|
|
||||||
abbrev CR α := Except Protocol.InteractionError α
|
|
||||||
|
|
||||||
def runMetaInMainM { α } (metaM: Lean.MetaM α): MainM α :=
|
def runMetaInMainM { α } (metaM: Lean.MetaM α): MainM α :=
|
||||||
metaM.run'
|
metaM.run'
|
||||||
def runTermElabInMainM { α } (termElabM: Lean.Elab.TermElabM α) : MainM α :=
|
def runTermElabInMainM { α } (termElabM: Lean.Elab.TermElabM α) : MainM α :=
|
||||||
|
|
Loading…
Reference in New Issue