Permitting trailing commas for record syntax ADT declarations

Andreas Abel abela at chalmers.se
Thu Sep 25 07:38:00 UTC 2014


Ah, just look at all these brace-and-semicolon languages, and how they 
thrive, and how many beginners have mastered them...

#include <stdio.h>

int main () {
   ; /* It is sunny today, so I am in the mood for a leading semi. */
   ; /* Still not in the mood to start work.                       */
   int i;
   ;
   for (i=0; i < 5; i++) {
     printf("%d", i);
   }; /* Mmh, do you need to put a semi after the closing brace?   */
      /* Let's put one, just to be sure.                           */
   /* TODO: more code */;
}

import Data.Foldable (forM_)

main = do {
   ; -- It is sunny today, so I am in the mood for a leading semi.
   ; -- Still not in the mood to start work.
   ; forM_ [0..4] $ \ i -> do {
       print i ;}
   ;} -- Mmh, do you need to put a semi befor the closing brace?
      -- Let's put one, just to be sure.


On 25.09.2014 09:13, Iavor Diatchki wrote:
> 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
>
>
>
>
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://www.haskell.org/mailman/listinfo/ghc-devs
>

-- 
Andreas Abel  <><      Du bist der geliebte Mensch.

Department of Computer Science and Engineering
Chalmers and Gothenburg University, Sweden

andreas.abel at gu.se
http://www2.tcs.ifi.lmu.de/~abel/


More information about the ghc-devs mailing list