Open jckarter opened 12 years ago
Is having multiple statements/definitions on one line a 'good' thing? Realistically you could only fit a couple of in-line record definitions on the same line as the top level definition before it starts to get ugly. Is there another language that uses this form successfully?
In traditional Hindley-Milner type systems, variant members are defined in-line as part of the variant type, so the idea was to allow those sorts of definitions, like data Maybe t = Nothing | Just t
, where the component tags logically make sense as part of the type. Clay's arrangement that variants are composed over independent types is somewhat unusual, but I think Scala's case classes are roughly comparable, though IIRC Scala doesn't provide a sugar to define a type with all of its subtypes.
It would be sort of convenient to be able to define variant or newtype member types in-line in a variant or newtype definition, for instance: