Zulip Chat Archive

Stream: lean4

Topic: Scoping for delaborator?


Siddharth Bhat (Oct 09 2021 at 15:03):

Consider:

open Lean PrettyPrinter

namespace ns
inductive Foo | mk: Foo

@[appUnexpander Foo.mk]
def unexpadFoo : Lean.PrettyPrinter.Unexpander | `($x) => `(unexpand)
def foo := Foo.mk #print foo

@[appUnexpander ns.Foo.mk]
def unexpadFoo' : Lean.PrettyPrinter.Unexpander | `($x) => `(unexpand)
def bar := ns.Foo.mk #print bar
end ns

/-
def ns.foo : Foo :=
Foo.mk
def bar : ns.Foo :=
unexpand✝
-/

I would expect ns.foo to also print unexpand✝, but it does not. I guess this is because I declare the delaborator as Foo.mk and not ns.Foo.mk. Is needing to name the delaborator with the "full path" (ns.Foo.mk) the expected behaviour? I'm trying to understand why Foo.mk does not suffice :)


Last updated: Dec 20 2023 at 11:08 UTC