Allow extra commas in module declarations or lists?

Michael Burge michaelburge at pobox.com
Sat Jun 11 19:12:12 UTC 2016


Some languages like Perl allow you to include additional commas in your
lists, so that you can freely reorder them without worrying about adding or
removing commas from the last or first item:

my @array = (
  1,
  2,
  3,
);

Perl even allows multiple redundant commas everywhere after the first
element, which is less useful but has come up on occasion:
my @array = (1,,,2,,,,,,,,,3,,,,,);

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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/glasgow-haskell-users/attachments/20160611/1836dafb/attachment.html>


More information about the Glasgow-haskell-users mailing list