StateList
StateList
is a List with a state associated to each element.
This is used instead of List (α × σ)
as it is more efficient.
- nil: {σ α : Type u} → Mathlib.Meta.FunProp.StateList σ α
.nil is the empty list.
- cons: {σ α : Type u} → α → σ → Mathlib.Meta.FunProp.StateList σ α → Mathlib.Meta.FunProp.StateList σ α
Instances For
Equations
- Mathlib.Meta.FunProp.StateList.instAppendStateList = { append := Mathlib.Meta.FunProp.StateList.append }
The combined state and list monad transformer.
Equations
- Mathlib.Meta.FunProp.StateListT σ m α = (σ → m (Mathlib.Meta.FunProp.StateList σ α))
Instances For
@[inline]
def
Mathlib.Meta.FunProp.StateListT.run
{α : Type u}
{σ : Type u}
{m : Type u → Type v}
[Functor m]
(x : Mathlib.Meta.FunProp.StateListT σ m α)
(s : σ)
:
Run x
on a given state s
, returning the list of values with corresponding states.
Equations
- Mathlib.Meta.FunProp.StateListT.run x s = Mathlib.Meta.FunProp.StateList.toList <$> x s
Instances For
@[inline]
def
Mathlib.Meta.FunProp.StateListT.run'
{α : Type u}
{σ : Type u}
{m : Type u → Type v}
[Functor m]
(x : Mathlib.Meta.FunProp.StateListT σ m α)
(s : σ)
:
m (List α)
Run x
on a given state s
, returning the list of values.
Equations
- Mathlib.Meta.FunProp.StateListT.run' x s = Mathlib.Meta.FunProp.StateList.toList' <$> x s
Instances For
@[reducible]
The combined state and list monad.
Equations
Instances For
instance
Mathlib.Meta.FunProp.StateListT.instAlternativeStateListT
{σ : Type u}
{m : Type u → Type v}
[Monad m]
:
Equations
- One or more equations did not get rendered due to their size.
@[inline]
Return the state from StateListT σ m
.
Equations
- Mathlib.Meta.FunProp.StateListT.get s = pure (Mathlib.Meta.FunProp.StateList.cons s s Mathlib.Meta.FunProp.StateList.nil)
Instances For
@[inline]
def
Mathlib.Meta.FunProp.StateListT.set
{σ : Type u}
{m : Type u → Type v}
[Monad m]
:
σ → Mathlib.Meta.FunProp.StateListT σ m PUnit
Set the state in StateListT σ m
.
Equations
- Mathlib.Meta.FunProp.StateListT.set s' x = pure (Mathlib.Meta.FunProp.StateList.cons PUnit.unit s' Mathlib.Meta.FunProp.StateList.nil)
Instances For
@[inline]
def
Mathlib.Meta.FunProp.StateListT.modifyGet
{α : Type u}
{σ : Type u}
{m : Type u → Type v}
[Monad m]
(f : σ → α × σ)
:
Modify and get the state in StateListT σ m
.
Equations
- Mathlib.Meta.FunProp.StateListT.modifyGet f s = let a := f s; pure (Mathlib.Meta.FunProp.StateList.cons a.fst a.snd Mathlib.Meta.FunProp.StateList.nil)
Instances For
@[inline]
def
Mathlib.Meta.FunProp.StateListT.lift
{α : Type u}
{σ : Type u}
{m : Type u → Type v}
[Monad m]
(t : m α)
:
Lift an action from m α
to StateListT σ m α
.
Equations
- Mathlib.Meta.FunProp.StateListT.lift t s = do let a ← t pure (Mathlib.Meta.FunProp.StateList.cons a s Mathlib.Meta.FunProp.StateList.nil)
Instances For
instance
Mathlib.Meta.FunProp.StateListT.instMonadLiftStateListT
{σ : Type u}
{m : Type u → Type v}
[Monad m]
:
@[always_inline]
instance
Mathlib.Meta.FunProp.StateListT.instMonadFunctorStateListT
{σ : Type u}
{m : Type u → Type v}
:
Equations
- One or more equations did not get rendered due to their size.
@[always_inline]
instance
Mathlib.Meta.FunProp.StateListT.instMonadExceptOfStateListT
{σ : Type u}
{m : Type u → Type v}
[Monad m]
{ε : Type u_1}
[MonadExceptOf ε m]
:
Equations
- One or more equations did not get rendered due to their size.
instance
Mathlib.Meta.FunProp.instMonadStateOfStateListT
{σ : Type u}
{m : Type u → Type v}
[Monad m]
:
Equations
- One or more equations did not get rendered due to their size.
@[always_inline]
instance
Mathlib.Meta.FunProp.StateListT.monadControl
{σ : Type u}
{m : Type u → Type v}
[Monad m]
:
Equations
- One or more equations did not get rendered due to their size.