Zulip Chat Archive
Stream: lean4
Topic: allow adding doctring to standalone deriving
Alok Singh (Dec 24 2024 at 02:58):
The following is legal, so allowing attaching docs to the standalone deriving clause seems legit
-- To allow printing Lean.NameSet and Std.HashMap for `transitivelyUsedConstants`
deriving instance Repr for Lean.NameSet
deriving instance Repr for Std.HashMap
deriving instance Hashable for Substring
deriving instance Hashable for SourceInfo
deriving instance Hashable for Syntax.Preresolved
deriving instance Hashable for Syntax
/-- Make `Syntax` hashable for `matchOnTree` to put in `HashSet` later-/
instance : Hashable Syntax where
hash := fun syn => Hashable.hash syn
The final manual instance is only needed to get the docstring.
Kim Morrison (Jan 31 2025 at 21:36):
You could use add_decl_doc
in the meantime. Seems a reasonable RFC to allow docstrings on standalone deriving
, I agree. Do you want to write it?
Alok Singh (Feb 01 2025 at 02:58):
https://github.com/leanprover/lean4/issues/6896#issue-2824788810
Kim Morrison (Feb 01 2025 at 06:30):
@Alok Singh, this RFC is inadequate: you don't even state what you want to change, just give an example. We can work it out from the example, but it's not really what we're hoping for from RFCs.
Kyle Miller (Feb 01 2025 at 06:33):
Question: what happens if you do deriving instance Repr for Type1, Type2
with a docstring?
Last updated: May 02 2025 at 03:31 UTC