Zulip Chat Archive

Stream: general

Topic: How does `@[derive]` choose the instance name?


Eric Wieser (Feb 02 2021 at 11:35):

I'm looking at src#instance_derive_handler but can't actually see where the name is being generated.

I ask because something like

@[derive [add_comm_group, vector_space ℝ]]
def foo (V : Type*) [inner_product_space  V] : Type* := V ×  × 

gives a lousy foo.inst name for the vector_space

Rob Lewis (Feb 02 2021 at 11:39):

src#tactic.delta_instance_handler

Eric Wieser (Feb 02 2021 at 11:40):

Is there an easy way to interactively ask lean to find everything tagged with derive_handler?

Rob Lewis (Feb 02 2021 at 11:43):

#eval attribute.get_instances `derive >>= tactic.trace ?

Eric Wieser (Feb 02 2021 at 11:46):

I guess ideally that derive handler would use heuristic_inst_name from the C++

Eric Wieser (Feb 02 2021 at 11:55):

#6007


Last updated: Dec 20 2023 at 11:08 UTC