Permitting trailing commas for record syntax ADT declarations

Simon Peyton Jones simonpj at microsoft.com
Thu Sep 25 09:18:01 UTC 2014


There’s a danger of disappearing into a bikeshed here.  I think it’s clear that:

·         If we have it at all, ExtraCommas should be a {-# LANGUAGE ExtraCommas #-} extension, like any other.

·         ExtraCommas should leave tuples alone (always)

Provided there is that LANGUAGE extension, I have no objection to having it in GHC if Alexander wants to implement it.  It has low impact, and some people like it a lot.  People who don’t like it don’t have to switch on the extension.

It’s unclear whether extra commas in literal lists [a,,b,,] should behave like TupleSections or like ExtraCommas.  My instinct is the former, because the only difference is round vs square parens.    That would suggest continuing to make extra commas illegal in literal lists, for now anyway.  That’s a conservative choice, which is usually the side to err on when it’s a toss-up.

OK?

Simon



From: Iavor Diatchki [mailto:iavor.diatchki at gmail.com]
Sent: 25 September 2014 08:14
To: Alexander Berntsen
Cc: Edward Kmett; Simon Peyton Jones; ghc-devs at haskell.org
Subject: Re: Permitting trailing commas for record syntax ADT declarations

Hello,

My 2c: I don't think that supporting trailing commas is worth the additional complexity to the compiler and the language.

I work with Haskell on a daily basis, and I honestly don't think that this is going to simplify my job in any way.  On the other hand, it seems like it it will make it more complex to write tools that process Haskell, and to explain the syntax of the language to beginners.

-Iavor



On Wed, Sep 24, 2014 at 12:38 PM, Alexander Berntsen <alexander at plaimi.net<mailto:alexander at plaimi.net>> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 24/09/14 08:50, Edward Kmett wrote:
> I'm personally of the "it should be a language extension like
> everything else" mindset
Yeah, I'm going the Pragma route.

> If we limit it to record-like notions, and import/export lists,
> then we don't have to deal with conflicts with TupleSections and
> while it is inconsistent to have tuples behave differently, than
> other comma-separated lists, I'd really rather retain tuple
> sections, which I use somewhat heavily, than lose them to mindless
> uniformity over how we handle comma-separated lists.
I'm implementing it for things where I 100% subjectively feel it makes
sense. This does *not* include tuples, for the reason you mention.

When I get the time, I will make a Wiki page outlining what I'm changing
and my motivation for doing it. We can then have a discussion about
where to draw the line.


I need to figure out a more elegant solution than tweaking the parser
for each individual item. If someone knows their way around this code,
please talk to me on IRC/SIP/XMPP/whatever. Just email me for contact
info. I'll be busy today with a haskell workshop, but I plan on
spending the rest of the week on this business.
- --
Alexander
alexander at plaimi.net<mailto:alexander at plaimi.net>
https://secure.plaimi.net/~alexander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iF4EAREIAAYFAlQinw4ACgkQRtClrXBQc7VL4gD6Ao12HqH1Mjl30n/1Mwlby7W6
/2+JeUOF9ui959xh1QkBAIdTA6km9gDvgCQ1nBQ5juZFNF79C1Fezk2yEpOvF7Fe
=l/sh
-----END PGP SIGNATURE-----
_______________________________________________
ghc-devs mailing list
ghc-devs at haskell.org<mailto:ghc-devs at haskell.org>
http://www.haskell.org/mailman/listinfo/ghc-devs

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


More information about the ghc-devs mailing list