Zulip Chat Archive
Stream: lean4
Topic: withSaveInfoContext
Mario Carneiro (Aug 14 2022 at 19:23):
What does docs4#Lean.Elab.withSaveInfoContext do? I've read the docstring and the code but I still have no idea what it is supposed to do.
Resets the trees state
t₀
, runsx
to produce a new trees statet₁
and sets the state to bet₀ ++ (InfoTree.context Γ <$> t₁)
whereΓ
is the context derived from the monad state.
Is there an example of how or why you would want to wrap something in withSaveInfoContext
?
Wojciech Nawrocki (Aug 14 2022 at 21:12):
Nodes in the info tree use the innermost withContext ancestor when pretty-printing and so on, so you'd want to use this whenever you change the (local, and maybe metavar, i forget) context so that the info nodes produced with this change in effect refer to the correct context.
Last updated: Dec 20 2023 at 11:08 UTC