Built with
doc-gen4, running Lean4.
Bubbles (
) indicate interactive fragments: hover for details, tap to reveal contents.
Use
Ctrl+↑Ctrl+↓to navigate,
Ctrl+🖱️to focus.
On Mac, use
Cmdinstead of
Ctrl.
/-
Copyright (c) 2022 Jannis Limperg. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jannis Limperg
-/
import Lean.Util.MonadBacktrack
namespace Lean
/--
Execute the action `x`, then restore the initial state. Returns the state after
`x` finished.
-/
def withoutModifyingState' [Monad m] [MonadBacktrack s m] [MonadFinally: (Type ?u.27 → Type ?u.26) → Type (max(?u.27+1)?u.26)
MonadFinally m]
(x : m α) : m (α × s) :=
withoutModifyingState do
let result ← x
let finalState ← saveState
return (result, finalState)
end Lean