Allow extra commas in module declarations or lists?

Ben Franksen ben.franksen at online.de
Sat Dec 17 22:29:18 UTC 2016


Sorry for late comment.

Am 12.06.2016 um 14:24 schrieb Joachim Breitner:
> Am Samstag, den 11.06.2016, 12:12 -0700 schrieb Michael Burge:
> I propose allowing an optional single extra comma at the end in module
> declarations, record declarations, record constructors, and list
> constructors:
> 
> module Example (
>   module Example,
>   SomeConstructor(..),
>   ) where
> 
> data SomeConstructor = SomeConstructor {
>   foo :: Int,
>   bar :: Int,
> }
> 
> baz :: SomeConstructor -> SomeConstructor
> baz x = x {
>   foo = 5,
>   bar = 10,
> }
> 
> qux :: [ Int ]
> qux = [
>   1,
>   2,
>   3,
> ]
>> What do you think?
> 
> For the module header, this is already possible.
> 
> For the term language, it unfortunately clashes with things like
> TupleSections.

Tuples haven't been mentioned by the OP. Indeed, extra commas don't make
any sense for tuples so let's just forget about them.

> I believe this has been discussed a few times in the past, e.g.
> https://mail.haskell.org/pipermail/haskell-prime/2013-May/003833.html

And, like here, people concentrate on the red herring 'tuple sections'.

To repeat (and slightly flesh out) the proposal:

  Allow an optional single extra comma at the end in:

  * module import and export lists
  * record declarations
  * record constructors
  * record updates
  * list constructors

I can't see anything problematic with that.

Cheers
Ben
-- 
"Make it so they have to reboot after every typo." ― Scott Adams



More information about the Glasgow-haskell-users mailing list