Zulip Chat Archive

Stream: lean4

Topic: standalone deriving


Yakov Pechersky (Nov 11 2022 at 01:13):

Is there standalone deriving, a la Haskell?

section

inductive Foo where
  | lt | eq | gt
deriving Inhabited, BEq

end

deriving Repr for Foo -- totally illegitimate syntax
``
For example, `Ordering` is defined in base Lean 4. I would like to have it have a `Repr Ordering` instance. Is there a way for me to generate it without defining it manually?

Matej Penciak (Nov 11 2022 at 01:17):

deriving instance Repr for Foo should work (assuming it can derive the instance)

Yakov Pechersky (Nov 11 2022 at 01:18):

Awesome, thanks!


Last updated: Dec 20 2023 at 11:08 UTC