lean4-htt/tests/lean/run/constant_fold_task_get_pure.lean
Henrik Böving d9cea67e24
perf: fold Task.get (Task.pure x) to just x (#12446)
This PR adds a simplification rule for `Task.get (Task.pure x) = x` into
the LCNF simplifier. This
ensures that we avoid touching the runtime for a `Task` that instantly
gets destructed anyways.
2026-02-12 08:29:52 +00:00

12 lines
347 B
Text

/-! This test asserts that we detect the pattern of calling `get` on a `Task.pure` and remove
`Task.pure` in order to avoid interaction with the runtime. -/
/--
trace: [Compiler.saveMono] size: 0
def test n : Nat :=
return n
-/
#guard_msgs in
set_option trace.Compiler.saveMono true in
def test (n : Nat) : Nat :=
(Task.pure n).get