File: .lake/packages/lean4/src/lean/lake/Lake/Util/EStateT.lean

full_name: Lake.EResult
code: /--
`EResult ε σ α` is equivalent to `Except ε α × σ`, but using a single
combined inductive yields a more efficient data representation.
-/
inductive EResult (ε : Type u) (σ : Type v) (α : Type w) : Type max u v w
/-- A success value of type `α`, and a new state `σ`. -/
| ok    : α → σ → EResult ε σ α
/-- A failure value of type `ε`, and a new state `σ`. -/
| error : ε → σ → EResult ε σ α
goal: Type (max u v w)

full_name: Lake.EResult.error
code: /--
`EResult ε σ α` is equivalent to `Except ε α × σ`, but using a single
combined inductive yields a more efficient data representation.
-/
inductive EResult (ε : Type u) (σ : Type v) (α : Type w) : Type max u v w
/-- A success value of type `α`, and a new state `σ`. -/
| ok    : α → σ → EResult ε σ α
/-- A failure value of type `ε`, and a new state `σ`. -/
| error : ε → σ → EResult ε σ α
goal: ε → σ → Lake.EResult ε σ α

full_name: Lake.EResult.ok
code: /--
`EResult ε σ α` is equivalent to `Except ε α × σ`, but using a single
combined inductive yields a more efficient data representation.
-/
inductive EResult (ε : Type u) (σ : Type v) (α : Type w) : Type max u v w
/-- A success value of type `α`, and a new state `σ`. -/
| ok    : α → σ → EResult ε σ α
/-- A failure value of type `ε`, and a new state `σ`. -/
| error : ε → σ → EResult ε σ α
goal: α → σ → Lake.EResult ε σ α

full_name: Lake.instInhabitedEResult
code: instance [Inhabited α] [Inhabited σ] : Inhabited (EResult ε σ α) 
goal: Inhabited (Lake.EResult ε σ α)

full_name: Lake.instInhabitedEResult_1
code: instance [Inhabited ε] [Inhabited σ] : Inhabited (EResult ε σ α) 
goal: Inhabited (Lake.EResult ε σ α)

full_name: Lake.EResult.state
code: /-- Extract the state `σ` from a `EResult ε σ α`. -/
@[inline] def EResult.state : EResult ε σ α → σ

goal: Lake.EResult ε σ α → σ

full_name: Lake.EResult.modifyState
code: @[inline] def EResult.modifyState (f : σ → σ') : EResult ε σ α → EResult ε σ' α

goal: Lake.EResult ε σ α → Lake.EResult ε σ' α

full_name: Lake.EResult.setState
code: @[inline] def EResult.setState (s : σ') (r : EResult ε σ α) : EResult ε σ' α 
goal: Lake.EResult ε σ' α

full_name: Lake.EResult.toProd
code: /-- Convert a `EResult ε σ α` into `Except ε α × σ`. -/
@[inline] def EResult.toProd : EResult ε σ α → Except ε α × σ

goal: Lake.EResult ε σ α → Except ε α × σ

full_name: Lake.EResult.toProd?
code: /-- Convert an `EResult ε σ α` into `Option α × σ`, discarding the exception contents. -/
@[inline] def EResult.toProd? : EResult ε σ α → Option α × σ

goal: Lake.EResult ε σ α → Option α × σ

full_name: Lake.EResult.result?
code: /-- Extract the result `α` from a `EResult ε σ α`. -/
@[inline] def EResult.result? : EResult ε σ α → Option α

goal: Lake.EResult ε σ α → Option α

full_name: Lake.EResult.error?
code: /-- Extract the error `ε` from a `EResult ε σ α`. -/
@[inline] def EResult.error? : EResult ε σ α → Option ε

goal: Lake.EResult ε σ α → Option ε

full_name: Lake.EResult.toExcept
code: /-- Convert an `EResult ε σ α` into `Except ε α`, discarding its state. -/
@[inline] def EResult.toExcept : EResult ε σ α → Except ε α

goal: Lake.EResult ε σ α → Except ε α

full_name: Lake.EResult.map
code: @[always_inline, inline]
protected def EResult.map (f : α → β) : EResult ε σ α → EResult ε σ β

goal: Lake.EResult ε σ α → Lake.EResult ε σ β

full_name: Lake.instFunctorEResult
code: instance : Functor (EResult ε σ) 
goal: Functor (Lake.EResult ε σ)

full_name: Lake.EStateT
code: /--
`EStateT ε σ m` is a combined error and state monad transformer,
equivalent to `ExceptT ε (StateT σ m)` but more efficient.
-/
def EStateT (ε : Type u) (σ : Type v) (m : Type max u v w → Type x) (α : Type w) 
goal: Type (max v x)

full_name: Lake.EStateT.instInhabitedOfPure
code: instance [Inhabited ε] [Pure m] : Inhabited (EStateT ε σ m α) 
goal: Inhabited (Lake.EStateT ε σ m α)

full_name: Lake.EStateT.run
code: /-- Execute an `EStateT` on initial state `init` to get an `EResult` result. -/
@[always_inline, inline]
def run (init : σ) (self : EStateT ε σ m α) : m (EResult ε σ α) 
goal: m (Lake.EResult ε σ α)

full_name: Lake.EStateT.run'
code: /--
Execute an `EStateT` on initial state `init`
to get an `Except` result, discarding the final state.
-/
@[always_inline, inline]
def run' {σ : Type max u w} [Functor m] (init : σ) (x : EStateT ε σ m α) : m (Except ε α) 
goal: m (Except ε α)

full_name: Lake.EStateT.toStateT
code: /-- Convert an `EStateT` to a `StateT`, returning an `Except` result. -/
@[inline] def toStateT {ε σ α : Type u} [Functor m] (x : EStateT ε σ m α) : StateT σ m (Except ε α) 
goal: StateT σ m (Except ε α)

full_name: Lake.EStateT.toStateT?
code: /-- Convert an `EStateT` to a `StateT`, returning an `Option` result. -/
@[inline] def toStateT? {ε σ α : Type u} [Functor m] (x : EStateT ε σ m α) : StateT σ m (Option α) 
goal: StateT σ m (Option α)

full_name: Lake.EStateT.run?
code: /--
Execute an `EStateT` on initial state `init`
to get an `Option` result, discarding the exception contents.
-/
@[always_inline, inline]
def run? {ε : Type max v w} [Functor m]  (init : σ) (x : EStateT ε σ m α) : m (Option α × σ) 
goal: m (Option α × σ)

full_name: Lake.EStateT.run?'
code: /--
Execute an `EStateT` on initial state `init` to get an `Option` result,
discarding the final state.
-/
@[always_inline, inline]
def run?' {ε σ α : Type u} [Functor m] (init : σ) (x : EStateT ε σ m α) : m (Option α) 
goal: m (Option α)

full_name: Lake.EStateT.catchExceptions
code: @[inline] def catchExceptions {ε σ α : Type u}
  [Monad m] (x : EStateT ε σ m α) (h : ε → StateT σ m α)
: StateT σ m α 
goal: StateT σ m α

full_name: Lake.EStateT.lift
code: /-- Lift the `m` monad into the `EStateT ε σ m` monad transformer. -/
@[always_inline, inline]
protected def lift {ε σ α : Type u} [Monad m] (x : m α) : EStateT ε σ m α 
goal: Lake.EStateT ε σ m α

full_name: Lake.EStateT.instMonadLiftOfMonad
code: instance {ε σ : Type u} [Monad m] : MonadLift m (EStateT ε σ m) 
goal: MonadLift m (Lake.EStateT ε σ m)

full_name: Lake.EStateT.pure
code: /-- The `pure` operation of the `EStateT` monad transformer. -/
@[always_inline, inline]
protected def pure [Pure m] (a : α) : EStateT ε σ m α 
goal: Lake.EStateT ε σ m α

full_name: Lake.EStateT.instPure
code: instance [Pure m] : Pure (EStateT ε σ m) 
goal: Pure (Lake.EStateT ε σ m)

full_name: Lake.EStateT.map
code: /-- The `map` operation of the `EStateT` monad transformer. -/
@[always_inline, inline]
protected def map [Functor m] (f : α → β) (x : EStateT ε σ m α) : EStateT ε σ m β 
goal: Lake.EStateT ε σ m β

full_name: Lake.EStateT.instFunctor
code: instance [Functor m] : Functor (EStateT ε σ m) 
goal: Functor (Lake.EStateT ε σ m)

full_name: Lake.EStateT.bind
code: /-- The `bind` operation of the `EStateT` monad transformer. -/
@[always_inline, inline]
protected def bind [Monad m] (x : EStateT ε σ m α) (f : α → EStateT ε σ m β) : EStateT ε σ m β 
goal: Lake.EStateT ε σ m β

full_name: Lake.EStateT.seqRight
code: /-- The `seqRight` operation of the `EStateT` monad transformer. -/
@[always_inline, inline]
protected def seqRight [Monad m] (x : EStateT ε σ m α) (y : Unit → EStateT ε σ m β) : EStateT ε σ m β 
goal: Lake.EStateT ε σ m β

full_name: Lake.EStateT.instMonad
code: @[always_inline]
instance [Monad m] : Monad (EStateT ε σ m) 
goal: Monad (Lake.EStateT ε σ m)

full_name: Lake.EStateT.set
code: /-- The `set` operation of the `EStateT` monad. -/
@[always_inline, inline]
protected def set [Pure m] (s : σ) : EStateT ε σ m PUnit.{w+1} 
goal: Lake.EStateT ε σ m PUnit

full_name: Lake.EStateT.get
code: /-- The `get` operation of the `EStateT` monad. -/
@[always_inline, inline]
protected def get [Pure m] : EStateT ε σ m σ 
goal: Lake.EStateT ε σ m σ

full_name: Lake.EStateT.modifyGet
code: /-- The `modifyGet` operation of the `EStateT` monad transformer. -/
@[always_inline, inline]
protected def modifyGet [Pure m] (f : σ → Prod α σ) : EStateT ε σ m α 
goal: Lake.EStateT ε σ m α

full_name: Lake.EStateT.instMonadStateOfOfPure
code: instance [Pure m] : MonadStateOf σ (EStateT ε σ m) 
goal: MonadStateOf σ (Lake.EStateT ε σ m)

full_name: Lake.EStateT.throw
code: /-- The `throw` operation of the `EStateT` monad transformer. -/
@[always_inline, inline]
protected def throw [Pure m] (e : ε) : EStateT ε σ m α 
goal: Lake.EStateT ε σ m α

full_name: Lake.EStateT.tryCatch
code: @[always_inline, inline]
protected def tryCatch [Monad m] (x : EStateT ε σ m α) (handle : ε → EStateT ε σ m α) : EStateT ε σ m α 
goal: Lake.EStateT ε σ m α

full_name: Lake.EStateT.instMonadExceptOfOfMonad
code: instance [Monad m] : MonadExceptOf ε (EStateT ε σ m) 
goal: MonadExceptOf ε (Lake.EStateT ε σ m)

full_name: Lake.EStateT.orElse
code: @[always_inline, inline]
protected def orElse [Monad m] (x₁ : EStateT ε σ m α) (x₂ : Unit → EStateT ε σ m α) : EStateT ε σ m α 
goal: Lake.EStateT ε σ m α

full_name: Lake.EStateT.instOrElseOfMonad
code: instance [Monad m] : OrElse (EStateT ε σ m α) 
goal: OrElse (Lake.EStateT ε σ m α)

full_name: Lake.EStateT.adaptExcept
code: /-- Map the exception type of a `EStateT ε σ m α` by a function `f : ε → ε'`. -/
@[always_inline, inline]
def adaptExcept [Functor m] (f : ε → ε') (x : EStateT ε σ m α) : EStateT ε' σ m α 
goal: Lake.EStateT ε' σ m α

full_name: Lake.EStateT.instMonadFinallyOfMonad
code: @[always_inline]
instance [Monad m] : MonadFinally (EStateT ε σ m) 
goal: MonadFinally (Lake.EStateT ε σ m)