Re: Permitting trailing commas for record syntax ADT declarations

2014-09-26 Thread Richard Eisenberg
A modest counter-proposal to this idea: What if we just stopped requiring commas in import/export lists? As far as I can tell, they're not necessary for proper parsing. This doesn't solve other problems, but I'm not convinced every problem in this domain needs the same solution. In

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-26 Thread Roman Cheplyaka
On 26/09/14 22:17, Richard Eisenberg wrote: A modest counter-proposal to this idea: What if we just stopped requiring commas in import/export lists? As far as I can tell, they're not necessary for proper parsing. Things can get somewhat ambiguous: module M (module A value B type C)

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-25 Thread Iavor Diatchki
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

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-25 Thread Andreas Abel
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. */

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-25 Thread Alexander Berntsen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 25/09/14 09:13, Iavor Diatchki wrote: 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. I too work with Haskell every day, and I *know* this will make my job easier. On the

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-25 Thread Levent Erkok
I agree with Iavor on this one. I use Haskell professionally as well, and I'm actually quite fond of what it leaves out in terms of both syntax and semantics, as opposed to what it adds. Whether it's pragma protected or not, I just don't see the point of complicating the language with such a

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-25 Thread Johan Tibell
The reason to support trailing commas are entirely related to engineering and not language expressiveness. Having trailing commas means that diff tools and version control systems work better. This is why most languages support them. ___ ghc-devs mailing

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-25 Thread Alexander Berntsen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 25/09/14 11:18, Simon Peyton Jones wrote: · If we have it at all, ExtraCommas should be a {-# LANGUAGE ExtraCommas #-} extension, like any other. · ExtraCommas should leave tuples alone (always) OK? These are the core

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-25 Thread Johan Tibell
*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

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-25 Thread Herbert Valerio Riedel
On 2014-09-25 at 11:18:01 +0200, Simon Peyton Jones wrote: 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. I'd just like to point out, that lists are something

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-25 Thread Daniel Trstenjak
On Thu, Sep 25, 2014 at 12:03:13PM +0200, Herbert Valerio Riedel wrote: I'd just like to point out, that lists are something that you may want to tweak regularily in code (while tuple are rather fixed-size entities whose size is extended less frequently) Consider the following JSON example:

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-24 Thread Daniel Trstenjak
On Wed, Sep 24, 2014 at 02:50:22AM -0400, Edward Kmett wrote: .. whereas I've adopted prefixed comma-lists in Haskell to avoid the need for an extension like this one, so it'd be quite a shift in my programming style to get to where this helps me. That also lets me somehow question the whole

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-24 Thread Jan Stolarek
That also lets me somehow question the whole proposal if you can get rid of most problems by just changing your coding style: module A ( a , b , c ) where ... data A = A { a :: Int , b :: Int , c :: Int } abc = [ a

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-24 Thread Herbert Valerio Riedel
On 2014-09-24 at 08:50:22 +0200, Edward Kmett wrote: I'm personally of the it should be a language extension like everything else mindset. Me too. Mostly for being able to have more useful error messages with older GHCs and other Haskell parsers. Because if it's a lang-ext pragma, you have

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-24 Thread Andreas Abel
Tibell | Cc: ghc-devs@haskell.org mailto:ghc-devs@haskell.org | Subject: RE: Permitting trailing commas for record syntax ADT | declarations | | | have a language extension TrailingCommas (or something) to enable | | the extension | | For clarification: are you

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-24 Thread Daniel Trstenjak
On Wed, Sep 24, 2014 at 10:48:40AM +0200, Andreas Abel wrote: [,a,b,] is [a,b] (,a,b,) is a tuple section However, I never felt like having list sections would see abundant usage. Thus, this discrepancy is ok, imho. I've somehow to disagree, because I like Haskell especially because

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-24 Thread Alexander Berntsen
-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

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-23 Thread Alexander Berntsen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 22/09/14 22:02, Johan Tibell wrote: Don't worry about supporting trailing/leading commas everywhere for now. Have it work for records first. We can always add support in more places later. I already have it for records. It seems to be working

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-23 Thread Alexander Berntsen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 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?

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-23 Thread Alexander Berntsen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 A piece of information which might be relevant: if we play the pragma game, be prepared for patches that are much more involved. Sneaking into HEAD means applying a few 2-5 line patches (from what I can tell presently), whilst requiring a pragma

RE: Permitting trailing commas for record syntax ADT declarations

2014-09-23 Thread Simon Peyton Jones
| 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? Well, it *is* a language extension, exactly like lots of other language extensions,

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-23 Thread Alexander Berntsen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 23/09/14 09:31, Simon Peyton Jones wrote: Well, it *is* a language extension, exactly like lots of other language extensions, isn't it? (E.g. UnicodeSyntax.) What alternative action, exactly, are you proposing? Why do you propose to treat

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-23 Thread Alexander Berntsen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 23/09/14 09:39, Andreas Abel wrote: If you want to do it only for commas, I suggest ExtraCommas It's only going to be commas, I think. I don't care about the name. ExtraCommas is fine by me. - -- Alexander alexan...@plaimi.net

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-23 Thread Roman Cheplyaka
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?

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-23 Thread Johan Tibell
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

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-23 Thread Alexander Berntsen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 23/09/14 10:03, Johan Tibell wrote: 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

RE: Permitting trailing commas for record syntax ADT declarations

2014-09-23 Thread Simon Peyton Jones
] Sent: 23 September 2014 09:03 To: Roman Cheplyaka Cc: Alexander Berntsen; Simon Peyton Jones; ghc-devs@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

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-23 Thread Roman Cheplyaka
Note that there's another dimension to this question: whether this pragma is switched on by default. We already have precedents like NondecreasingIndentation. So, if you mean heavy-weigth to use, not to implement, then this may address your concern. Now, with my haskell-src-exts maintainer hat

RE: Permitting trailing commas for record syntax ADT declarations

2014-09-23 Thread Simon Peyton Jones
| presently), whilst requiring a pragma means either making the parser | code really messy everywhere there's a comma, or having lots of | duplication there. I don't understand this at all. The standard way is simply to parse the comma(s) always, record the presence of trailing comma(s) in the

RE: Permitting trailing commas for record syntax ADT declarations

2014-09-23 Thread Simon Peyton Jones
meaning. With TupleSections, (a,,b,) means \x y - (a,x,b,y). Simon | -Original Message- | From: Simon Peyton Jones | Sent: 23 September 2014 08:32 | To: 'Alexander Berntsen'; Johan Tibell | Cc: ghc-devs@haskell.org | Subject: RE: Permitting trailing commas for record syntax ADT

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-23 Thread Alexander Berntsen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 See the diff/excerpt below. If it were a pragma, I think this might get ugly quick (consider that this patch only adds leading/trailing commas for record declarations). If you think I should be changing things elsewhere/employing a different

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-23 Thread Carter Schonwald
i think this should be behind a pragma, On Tue, Sep 23, 2014 at 5:00 AM, Alexander Berntsen alexan...@plaimi.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 See the diff/excerpt below. If it were a pragma, I think this might get ugly quick (consider that this patch only adds

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-22 Thread Alexander Berntsen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Forwarding this my reply to the ML as well, On 22/09/14 14:27, David Luposchainsky wrote: +1. While you're at it, you may also want to consider allowing leading commas for the folks that write their exports/records the other way round Sure.

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-22 Thread Johan Tibell
+1 I think this makes sense and we should allow trailing commas wherever the syntax allows it without adding ambiguity (e.g. tuple sections prevent trailing commas for tuple declarations.) P.S. Last time we tried to discuss something like this (on libraries@ I believe) the whole discussion

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-22 Thread Herbert Valerio Riedel
On 2014-09-22 at 14:31:10 +0200, Alexander Berntsen wrote: Forwarding this my reply to the ML as well, On 22/09/14 14:27, David Luposchainsky wrote: +1. While you're at it, you may also want to consider allowing leading commas for the folks that write their exports/records the other way

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-22 Thread Johan Tibell
On Mon, Sep 22, 2014 at 3:57 PM, Herbert Valerio Riedel hvrie...@gmail.com wrote: On 2014-09-22 at 14:31:10 +0200, Alexander Berntsen wrote: Forwarding this my reply to the ML as well, On 22/09/14 14:27, David Luposchainsky wrote: +1. While you're at it, you may also want to consider

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-22 Thread Andreas Abel
+1 to leading and trailing separators. On 22.09.2014 16:01, Johan Tibell wrote: On Mon, Sep 22, 2014 at 3:57 PM, Herbert Valerio Riedel https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md Nice, style guide. I'll probably fork it for the Agda project... -- Andreas

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-22 Thread Alexander Berntsen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Friends, I have a commit that allows for trailing and leading commas in record updates, and it works fine. I think I now have gotten the hang of how the parser is structured and generally works. GHCi output with my patch: λ data Foo a b = MkFoo

RE: Permitting trailing commas for record syntax ADT declarations

2014-09-22 Thread Simon Peyton Jones
@haskell.org Subject: Re: Permitting trailing commas for record syntax ADT declarations +1 I think this makes sense and we should allow trailing commas wherever the syntax allows it without adding ambiguity (e.g. tuple sections prevent trailing commas for tuple declarations.) P.S. Last time we

Re: Permitting trailing commas for record syntax ADT declarations

2014-09-22 Thread Johan Tibell
trailing commas for record syntax ADT declarations +1 I think this makes sense and we should allow trailing commas wherever the syntax allows it without adding ambiguity (e.g. tuple sections prevent trailing commas for tuple declarations.) P.S. Last time we tried to discuss something