Allow extra commas in module declarations or lists?

MigMit migmit at gmail.com
Sat Jun 11 20:02:13 UTC 2016


I think that's the greatest idea since monads. Seriously.

Отправлено с iPad

> 11 июня 2016 г., в 21:12, Michael Burge <michaelburge at pobox.com> написал(а):
> 
> 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 at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users


More information about the Glasgow-haskell-users mailing list