lean4-htt/tests/lean/caching_user_attribute.lean
Leonardo de Moura 4eefc41b6e refactor(*): wrap string in a structure
We want to make sure string users do not depend on the string
implementation. This is the first step.

We need this refactoring *now* to make sure it will not be
super painful to address issue #1175
2017-06-07 17:30:49 -07:00

21 lines
740 B
Text

@[user_attribute]
meta def foo_attr : caching_user_attribute string :=
{ name := `foo, descr := "bar",
mk_cache := λ ns, return $ string.join (list.map (λ n, to_string n ++ "\n") ns),
dependencies := [] }
attribute [foo] eq.refl eq.mp
set_option trace.user_attributes_cache true
run_cmd do
s : string ← caching_user_attribute.get_cache foo_attr,
tactic.trace s,
s : string ← caching_user_attribute.get_cache foo_attr,
tactic.trace s,
tactic.set_basic_attribute `foo ``eq.mpr,
s : string ← caching_user_attribute.get_cache foo_attr,
tactic.trace s,
tactic.set_basic_attribute `reducible ``eq.mp, -- should not affect [foo] cache
s : string ← caching_user_attribute.get_cache foo_attr,
tactic.trace s