Equations
- instMonadEST ε σ = inferInstanceAs (Monad (EStateM ε σ))
Equations
- instMonadExceptOfEST ε σ = inferInstanceAs (MonadExceptOf ε (EStateM ε σ))
Equations
- instInhabitedEST = inferInstanceAs (Inhabited (EStateM ε σ α))
Equations
- instMonadST σ = inferInstanceAs (Monad (EST Empty σ))
Equations
- instSTWorldEST = { }
@[noinline, nospecialize]
Equations
- runEST x = match x Unit () with | EStateM.Result.ok a a_1 => Except.ok a | EStateM.Result.error ex a => Except.error ex
@[noinline, nospecialize]
Equations
- runST x = match x Unit () with | EStateM.Result.ok a a_1 => a | EStateM.Result.error ex a => nomatch ex
Equations
- instMonadLiftSTEST = { monadLift := fun {α} x s => match x s with | EStateM.Result.ok a s => EStateM.Result.ok a s | EStateM.Result.error ex a => nomatch ex }
- h : Nonempty α
@[extern lean_st_mk_ref]
@[extern lean_st_ref_get]
@[extern lean_st_ref_set]
@[extern lean_st_ref_swap]
@[extern lean_st_ref_take]
@[inline]
Equations
- ST.Prim.Ref.modifyUnsafe r f = do let v ← ST.Prim.Ref.take r ST.Prim.Ref.set r (f v)
@[inline]
unsafe def
ST.Prim.Ref.modifyGetUnsafe
{σ : Type}
{α : Type}
{β : Type}
(r : ST.Ref σ α)
(f : α → β × α)
:
ST σ β
Equations
- ST.Prim.Ref.modifyGetUnsafe r f = do let v ← ST.Prim.Ref.take r match f v with | (b, a) => do ST.Prim.Ref.set r a pure b
@[implementedBy 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)
@[implementedBy 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
@[inline]
def
ST.mkRef
{σ : Type}
{m : Type → Type}
[inst : MonadLiftT (ST σ) m]
{α : Type}
(a : α)
:
m (ST.Ref σ α)
Equations
- ST.mkRef a = liftM (ST.Prim.mkRef a)
@[inline]
def
ST.Ref.get
{σ : Type}
{m : Type → Type}
[inst : MonadLiftT (ST σ) m]
{α : Type}
(r : ST.Ref σ α)
:
m α
Equations
- ST.Ref.get r = liftM (ST.Prim.Ref.get r)
@[inline]
def
ST.Ref.set
{σ : Type}
{m : Type → Type}
[inst : MonadLiftT (ST σ) m]
{α : Type}
(r : ST.Ref σ α)
(a : α)
:
m Unit
Equations
- ST.Ref.set r a = liftM (ST.Prim.Ref.set r a)
@[inline]
def
ST.Ref.swap
{σ : Type}
{m : Type → Type}
[inst : MonadLiftT (ST σ) m]
{α : Type}
(r : ST.Ref σ α)
(a : α)
:
m α
Equations
- ST.Ref.swap r a = liftM (ST.Prim.Ref.swap r a)
@[inline]
unsafe def
ST.Ref.take
{σ : Type}
{m : Type → Type}
[inst : MonadLiftT (ST σ) m]
{α : Type}
(r : ST.Ref σ α)
:
m α
Equations
- ST.Ref.take r = liftM (ST.Prim.Ref.take r)
@[inline]
def
ST.Ref.ptrEq
{σ : Type}
{m : Type → Type}
[inst : MonadLiftT (ST σ) m]
{α : Type}
(r1 : ST.Ref σ α)
(r2 : ST.Ref σ α)
:
m Bool
Equations
- ST.Ref.ptrEq r1 r2 = liftM (ST.Prim.Ref.ptrEq r1 r2)
@[inline]
def
ST.Ref.modify
{σ : Type}
{m : Type → Type}
[inst : MonadLiftT (ST σ) m]
{α : Type}
(r : ST.Ref σ α)
(f : α → α)
:
m Unit
Equations
- ST.Ref.modify r f = liftM (ST.Prim.Ref.modify r f)
@[inline]
def
ST.Ref.modifyGet
{σ : Type}
{m : Type → Type}
[inst : MonadLiftT (ST σ) m]
{α : Type}
{β : Type}
(r : ST.Ref σ α)
(f : α → β × α)
:
m β
Equations
- ST.Ref.modifyGet r f = liftM (ST.Prim.Ref.modifyGet r f)