mirror of
https://github.com/leanprover/lean4.git
synced 2026-03-17 10:24:07 +00:00
doc: remark that CoreM.toIO ignores ctx.initHeartbeats (#12859)
This is slightly surprising behavior, and so should be in the docstring.
This commit is contained in:
@@ -431,6 +431,10 @@ def mkFreshUserName (n : Name) : CoreM Name :=
|
||||
@[inline] def CoreM.run' (x : CoreM α) (ctx : Context) (s : State) : EIO Exception α :=
|
||||
Prod.fst <$> x.run ctx s
|
||||
|
||||
/--
|
||||
Run a `CoreM` monad in IO.
|
||||
Note that the value of `ctx.initHeartbeats` is ignored and replaced with `IO.getNumHeartbeats`.
|
||||
-/
|
||||
@[inline] def CoreM.toIO (x : CoreM α) (ctx : Context) (s : State) : IO (α × State) := do
|
||||
match (← (x.run { ctx with initHeartbeats := (← IO.getNumHeartbeats) } s).toIO') with
|
||||
| Except.error (Exception.error _ msg) => throw <| IO.userError (← msg.toString)
|
||||
@@ -440,7 +444,7 @@ def mkFreshUserName (n : Name) : CoreM Name :=
|
||||
@[inline] def CoreM.toIO' (x : CoreM α) (ctx : Context) (s : State) : IO α :=
|
||||
(·.1) <$> x.toIO ctx s
|
||||
|
||||
-- withIncRecDepth for a monad `m` such that `[MonadControlT CoreM n]`
|
||||
/-- withIncRecDepth for a monad `m` such that `[MonadControlT CoreM n]`. -/
|
||||
protected def withIncRecDepth [Monad m] [MonadControlT CoreM m] (x : m α) : m α :=
|
||||
controlAt CoreM fun runInBase => withIncRecDepth (runInBase x)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user