@[inline]
def
StateT.run
{σ : Type u}
{m : Type u → Type v}
{α : Type u}
(x : StateT σ m α)
(s : σ)
:
m (α × σ)
Equations
- StateT.run x s = x s
Instances For
instance
instSubsingletonStateM
{σ : Type u_1}
{α : Type u_1}
[Subsingleton σ]
[Subsingleton α]
:
Subsingleton (StateM σ α)
@[inline]
def
StateT.orElse
{σ : Type u}
{m : Type u → Type v}
[Alternative m]
{α : Type u}
(x₁ : StateT σ m α)
(x₂ : Unit → StateT σ m α)
:
StateT σ m α
Equations
- StateT.orElse x₁ x₂ s = HOrElse.hOrElse (x₁ s) fun x => x₂ () s
Instances For
instance
StateT.instAlternativeStateT
{σ : Type u}
{m : Type u → Type v}
[Monad m]
[Alternative m]
:
Alternative (StateT σ m)
Equations
- StateT.instAlternativeStateT = Alternative.mk (fun {α} => StateT.failure) fun {α} => StateT.orElse
@[always_inline]
instance
StateT.instMonadFunctorStateT
(σ : Type u_1)
(m : Type u_1 → Type u_2)
[Monad m]
:
MonadFunctor m (StateT σ m)
Equations
- StateT.instMonadFunctorStateT σ m = { monadMap := fun {α} f x s => f (α × σ) (x s) }
@[always_inline]
instance
StateT.instMonadExceptOfStateT
{σ : Type u}
{m : Type u → Type v}
[Monad m]
(ε : Type u_1)
[MonadExceptOf ε m]
:
MonadExceptOf ε (StateT σ m)
Equations
- StateT.instMonadExceptOfStateT ε = { throw := fun {α} => StateT.lift ∘ throwThe ε, tryCatch := fun {α} x c s => tryCatchThe ε (x s) fun e => c e s }
@[inline]
def
ForM.forIn
{m : Type u_1 → Type u_2}
{β : Type u_1}
{ρ : Type u_3}
{α : Type u_4}
[Monad m]
[ForM (StateT β (ExceptT β m)) ρ α]
(x : ρ)
(b : β)
(f : α → β → m (ForInStep β))
:
m β
Adapter to create a ForIn instance from a ForM instance
Equations
- One or more equations did not get rendered due to their size.
Instances For
instance
instMonadStateOfStateT
{σ : Type u}
{m : Type u → Type v}
[Monad m]
:
MonadStateOf σ (StateT σ m)
Equations
- instMonadStateOfStateT = { get := StateT.get, set := StateT.set, modifyGet := fun {α} => StateT.modifyGet }
@[always_inline]
instance
StateT.monadControl
(σ : Type u)
(m : Type u → Type v)
[Monad m]
:
MonadControl m (StateT σ m)
Equations
- One or more equations did not get rendered due to their size.
@[always_inline]
instance
StateT.tryFinally
{m : Type u → Type v}
{σ : Type u}
[MonadFinally m]
[Monad m]
:
MonadFinally (StateT σ m)
Equations
- One or more equations did not get rendered due to their size.