Equations
- instMonadEST ε σ = inferInstanceAs (Monad (EStateM ε σ))
Equations
- instMonadExceptOfEST ε σ = inferInstanceAs (MonadExceptOf ε (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
@[always_inline]
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 α
Instances For
@[inline]
Equations
- ST.Prim.Ref.modifyUnsafe r f = do let v ← ST.Prim.Ref.take r ST.Prim.Ref.set r (f v)
Instances For
@[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
Instances For
@[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
- ST.Ref.set r 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
- ST.Ref.swap r 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 α
Equations
- ST.Ref.take r = liftM (ST.Prim.Ref.take r)
Instances For
@[inline]
def
ST.Ref.ptrEq
{σ : Type}
{m : Type → Type}
[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)
Instances For
@[inline]
def
ST.Ref.modify
{σ : Type}
{m : Type → Type}
[MonadLiftT (ST σ) m]
{α : Type}
(r : ST.Ref σ α)
(f : α → α)
:
m Unit
Equations
- ST.Ref.modify r f = liftM (ST.Prim.Ref.modify r f)
Instances For
@[inline]
def
ST.Ref.modifyGet
{σ : Type}
{m : Type → Type}
[MonadLiftT (ST σ) m]
{α : Type}
{β : Type}
(r : ST.Ref σ α)
(f : α → β × α)
:
m β
Equations
- ST.Ref.modifyGet r 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
Equations
- ST.Ref.toMonadStateOf r = { get := ST.Ref.get r, set := ST.Ref.set r, modifyGet := fun {α} => ST.Ref.modifyGet r }