Permitting trailing commas for record syntax ADT declarations

Herbert Valerio Riedel hvriedel at
Thu Sep 25 12:06:56 UTC 2014

On 2014-09-25 at 13:34:16 +0200, Daniel Trstenjak wrote:


> One compromise could be, that additional commatas in literal lists
> are only allowed at the beginning and at the end.

...another idea could be to make it a separate Pragma
(e.g. ExtraCommasLists) if there's a chance of ListSections (which would
conflict with this) becoming a reality.

> Then your use case would work and also something like:
>    abc = [ 
>       -- a
>       , a
>       -- b
>       , b
>       -- c
>       , c
>       ]

I'd probably prefer leading-comma over trailing-comma style anyway (as
I've grown to like it over the years).

> I think that are the main uses of additional commatas in literal lists
> and I can't see that someone really wants a list literal like '[,3,,4,]',
> so wrongly reading it as a list section shouldn't be an issue.

Yeah, I don't care much about extra middle-commas either. Personally,
I'd be already happy with just trailing & leading extra-comma support.

More information about the ghc-devs mailing list