Zulip Chat Archive

Stream: general

Topic: Basic question about inductive types


Morgan Sinclaire (Aug 25 2024 at 16:58):

I’m reading TPIL and Ch. 7 on inductive types has this simple example:

inductive Weekday where
  | friday

It also says that “The first character | in an inductive declaration is optional. We can also separate constructors using a comma instead of |.” But when I try these examples:

inductive Weekday' where
    friday
inductive Weekday'' where
  , friday

they fail to compile (regardless of the indentation I've tried). Am I misunderstanding that TPIL quote?

Daniel Weber (Aug 25 2024 at 17:36):

I'd guess that this is a leftover from Lean 3 and is false for Lean 4

Kim Morrison (Aug 26 2024 at 00:05):

@Morgan S, if you'd like to open an issue, you can click the github icon in the top right of the TPIL page. It would be very helpful!

Morgan Sinclaire (Aug 26 2024 at 23:28):

Just submitted, thanks for the responses!


Last updated: May 02 2025 at 03:31 UTC