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?
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users

Reply via email to