Effect-free ForIn containers #
PureForIn and PureForIn' identify the containers whose loop produces its elements without
effects, so that iterating is iterating over the list ForIn.toList computes in Id, and
LawfulMemForInId identifies those whose Membership agrees with that Id loop.
Containers whose Membership is exactly the elements the Id loop enumerates. The Iff says
the loop yields all members and nothing else; it constrains neither their order nor their
multiplicity.
The elements of
ForIn.toList xsare the members ofxs.
Instances
Containers whose ForIn loop produces its elements without effects in m, so iterating over
xs is iterating over the list ForIn.toList computes in Id. Only the loop body may have
effects.
- forIn_eq {β : Type u} (xs : ρ) (init : β) (f : α → β → m (ForInStep β)) : forIn xs init f = forIn (ForIn.toList xs) init f
Iterating over
xsis iterating overForIn.toList xs.
Instances
Containers whose ForIn' loop produces its elements without effects in m, carrying a
membership proof for each.
- forIn'_eq {β : Type u} (xs : ρ) (init : β) (f : (a : α) → a ∈ xs → β → m (ForInStep β)) : forIn' xs init f = forIn' (ForIn.toList xs) init fun (a : α) (h : a ∈ ForIn.toList xs) (b : β) => f a ⋯ b
Iterating over
xsis iterating overForIn.toList xs.
Instances
Every element ForIn.toList collects is pushed onto the accumulator in order.
Computes ForIn.toList from the container's own equation between its loop and the loop over
l.