Permitting trailing commas for record syntax ADT declarations

Simon Peyton Jones simonpj at microsoft.com
Tue Sep 23 08:23:22 UTC 2014


We're not changing the meaning of any existing programs, just allowing some new ones.

Yes, that’s true of quite a few other extensions too, notably UnicodeSyntax.  Even GADTs!!  It’s hard to know where to draw the line.

There is, in theory at least, the point that the language extension signals that this module might not work with some other Haskell compiler.

My instinct is to treat it uniformly, like other language extensions. But strong sentiment to the contrary from GHC users would persuade me.  It’s not that big a deal.

Simon

From: Johan Tibell [mailto:johan.tibell at gmail.com]
Sent: 23 September 2014 09:03
To: Roman Cheplyaka
Cc: Alexander Berntsen; Simon Peyton Jones; ghc-devs at haskell.org
Subject: Re: Permitting trailing commas for record syntax ADT declarations

I must say that requiring a language pragma makes the feature quite a bit more heavy weight. We're not changing the meaning of any existing programs, just allowing some new ones. One could argue that perhaps the HaskellXX standard might pick up this new pragma and thus making it unnecessary eventually, but the standardization process is dead (and even when it was alive, it was lagging actual practice enough that it was largely ignored.)


On Tue, Sep 23, 2014 at 9:41 AM, Roman Cheplyaka <roma at ro-che.info<mailto:roma at ro-che.info>> wrote:
On 23/09/14 10:11, Alexander Berntsen wrote:
> On 22/09/14 21:07, Simon Peyton Jones wrote:
>> have a language extension TrailingCommas (or something) to enable
>> the extension
> For clarification: are you overruling the "do we sneak it in HEAD or
> use pragma(s)"-vote and telling me to do the latter?
>
> If we can sneak it into HEAD (this is @ you Johan, too), I suggest
> that someone applies my patches to make import and export lists
> support leading commas (presently they only support trailing commas,
> per the report) -- and following this I can just send a bunch of
> "Permit leading/trailing ',' in Foo" patches to Phabricator, and you
> guys can bikeshed over there about which ones you actually want to
> commit. ;-)
>
> If I am to go down the pragma route, I guess I can make a
> RudundantCommas pragma or something like that, that implements
> trailing commas for imports/exports, and leading/trailing commas for
> the suggestions in this thread.
>
> I'm +1 on the GHC HEAD route, but I'm not exactly violently opposed to
> the pragma route either.

Here's my reasoning:

If you invoke ghc with -XHaskell2010, then trailing commas shouldn't be
accepted, because they do not belong to Haskell 2010.

Which means that you do need an extension to identify this difference in
behavior.

Roman

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20140923/1b7d658d/attachment-0001.html>


More information about the ghc-devs mailing list