Remark: we cannot use the caching trick used at FindExpr
and ReplaceExpr
because they
may visit the same expression multiple times if they are stored in different memory
addresses. Note that the following code is parametric in a monad m
.
@[inline]
def
Lean.Expr.forEach
{ω : Type}
{m : Type → Type}
[STWorld ω m]
[MonadLiftT (ST ω) m]
[Monad m]
(e : Lean.Expr)
(f : Lean.Expr → m Unit)
:
m Unit
Equations
- Lean.Expr.forEach e f = Lean.Expr.forEach' e fun e => do f e pure true