Equations
- instMonadEST ε σ = inferInstanceAs (Monad (EStateM ε σ))
Equations
- instMonadExceptOfEST ε σ = inferInstanceAs (MonadExceptOf ε (EStateM ε σ))
Equations
- instInhabitedEST = inferInstanceAs (Inhabited (EStateM ε σ α))
Equations
- instMonadST σ = inferInstanceAs (Monad (EST Empty σ))
@[noinline]
Equations
- runEST x = match x Unit () with | EStateM.Result.ok a a_1 => Except.ok a | EStateM.Result.error ex a => Except.error ex
Instances For
@[extern lean_st_ref_swap]
@[extern lean_st_ref_take]
@[implemented_by ST.Prim.Ref.modifyUnsafe]
Equations
- ST.Prim.Ref.modify r f = do let v ← ST.Prim.Ref.get r ST.Prim.Ref.set r (f v)
Instances For
@[implemented_by ST.Prim.Ref.modifyGetUnsafe]
Equations
- ST.Prim.Ref.modifyGet r f = do let v ← ST.Prim.Ref.get r match f v with | (b, a) => do ST.Prim.Ref.set r a pure b
Instances For
@[inline]
def
ST.Ref.set
{σ : Type}
{m : Type → Type}
[MonadLiftT (ST σ) m]
{α : Type}
(r : ST.Ref σ α)
(a : α)
:
m Unit
Equations
- r.set a = liftM (ST.Prim.Ref.set r a)
Instances For
@[inline]
def
ST.Ref.swap
{σ : Type}
{m : Type → Type}
[MonadLiftT (ST σ) m]
{α : Type}
(r : ST.Ref σ α)
(a : α)
:
m α
Equations
- r.swap a = liftM (ST.Prim.Ref.swap r a)
Instances For
@[inline]
unsafe def
ST.Ref.take
{σ : Type}
{m : Type → Type}
[MonadLiftT (ST σ) m]
{α : Type}
(r : ST.Ref σ α)
:
m α
Instances For
@[inline]
def
ST.Ref.ptrEq
{σ : Type}
{m : Type → Type}
[MonadLiftT (ST σ) m]
{α : Type}
(r1 r2 : ST.Ref σ α)
:
m Bool
Equations
- r1.ptrEq r2 = liftM (ST.Prim.Ref.ptrEq r1 r2)
Instances For
@[inline]
def
ST.Ref.modify
{σ : Type}
{m : Type → Type}
[MonadLiftT (ST σ) m]
{α : Type}
(r : ST.Ref σ α)
(f : α → α)
:
m Unit
Equations
- r.modify f = liftM (ST.Prim.Ref.modify r f)
Instances For
@[inline]
def
ST.Ref.modifyGet
{σ : Type}
{m : Type → Type}
[MonadLiftT (ST σ) m]
{α β : Type}
(r : ST.Ref σ α)
(f : α → β × α)
:
m β
Equations
- r.modifyGet f = liftM (ST.Prim.Ref.modifyGet r f)
Instances For
def
ST.Ref.toMonadStateOf
{σ : Type}
{m : Type → Type}
[MonadLiftT (ST σ) m]
{α : Type}
(r : ST.Ref σ α)
:
MonadStateOf α m