[Haskell-cafe] Inconsistent trailing comma in export list and record syntax

Jack Henahan jhenahan at uvm.edu
Mon Jul 11 11:42:38 CEST 2011


Well, for your example frustration, the leading comma style would sort your problem nicely. As for the particulars… hmm, not sure. I use leading commas for both, so I never really noticed.

It may be that since modules simply expose functions to other programs, the form is syntactically irrelevant except when the module is being loaded.

I am quite curious about it now, though, so I hope there are some more knowledgeable folks with some input.

On Jul 11, 2011, at 4:49 AM, L Corbijn wrote:

> Hello,
> 
> I'm wondering why the trailing comma is allowed in export syntax, but not in record syntax, here an example
> module Foo (
>     export1, -- is allowed
> ) where
> 
> data Type = Type  {
>     record1 :: Foo, -- is not allowed
> }
> 
> To me this seems quite inconsistent and sometimes quite frustrating, imagine the case that you want to temporarily remove the last record:
> data Type = Type  {
>     record1 :: Foo,
> --    record2 :: Bar
> }
> this would fail due to an extra comma that has to be commented out. 
> 
> You could of course say that I'm using a bad style, but it remains that it seems to be inconsistent to allow a trailing comma in one place and not in the other. So is there an reason for this?
> 
> Lars Corbijn
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe




More information about the Haskell-Cafe mailing list