Effect algebra for interaction trees #
This module provides the algebra of effects used to combine and interpret
interaction trees: natural transformations between effect families, the empty
and sum effects (VoidE, SumE), the MonadIter class of iterable monads, the
iter iteration combinator, and the interp interpretation of an ITree
against an effect handler into an arbitrary iterable monad.
A natural transformation between effect families: a uniform map ε1 α → ε2 α.
Equations
- Lean4Itree.naturalTransformation ε1 ε2 = ({α : Type ?u.3} → ε1 α → ε2 α)
Instances For
Notation ε1 ⟶ ε2 for a natural transformation between effect families.
Equations
- Lean4Itree.«term_⟶_» = Lean.ParserDescr.trailingNode `Lean4Itree.«term_⟶_» 50 51 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ⟶ ") (Lean.ParserDescr.cat `term 50))
Instances For
The empty effect family, with no operations.
Instances For
Addition of effect families is their sum SumE.
Equations
- Lean4Itree.instAddEffect = { add := Lean4Itree.SumE }
Coerce a left effect into the sum SumE ε1 ε2.
Equations
- Lean4Itree.instCoeSumEInl = { coe := fun (e : ε1 α) => Lean4Itree.SumE.inl e }
Coerce a right effect into the sum SumE ε1 ε2.
Equations
- Lean4Itree.instCoeSumEInr = { coe := fun (e : ε2 α) => Lean4Itree.SumE.inr e }
Coerce a left effect into the sum (ε1 + ε2).
Equations
- Lean4Itree.instCoeAddInl = { coe := fun (e : ε1 α) => Lean4Itree.SumE.inl e }
Coerce a right effect into the sum (ε1 + ε2).
Equations
- Lean4Itree.instCoeAddInr = { coe := fun (e : ε2 α) => Lean4Itree.SumE.inr e }
The traversal mode used by iter: either start a new iteration (iterS) or
continue binding the tree produced by a step (bindS).
- iterS {ε : Type u_1 → Type u_2} {ρ : Type u_3} {ι : Type u_4} (i : ι) : IterMode
- bindS {ε : Type u_1 → Type u_2} {ρ : Type u_3} {ι : Type u_4} (t : ITree ε (IterState ι ρ)) : IterMode
Instances For
Iterate step from the seed i, producing the interaction tree that loops
until a step returns done.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Interaction trees iterate via the ITree.iter combinator.
Equations
- Lean4Itree.ITree.instMonadIterITree = { iter := fun {ρ ι : Type ?u.1} => Lean4Itree.ITree.iter }
Interpret an interaction tree by handling each effect with handler and
running the resulting computation in an iterable monad m.
Equations
- One or more equations did not get rendered due to their size.