proposal for trailing comma and semicolon

Heinrich Apfelmus apfelmus at
Sat May 18 10:05:14 CEST 2013

Tillmann Rendel wrote:
> I like to put commas at the beginning of lines, because there, I can 
> make them line up and it is visually clear that they are all at the same 
> nesting level. I like how the commas look a bit like bullet points. For 
> example, I would write:
> items =
>   [ "red"
>   , "blue"
>   , "green"
>   ]
> Could we extend Garett's proposal to also allow prefixing the first 
> element of a list with a comma, to support this style:
> items = [
>   , "red"
>   , "blue"
>   , "green"
>   ]
> Allowing an optional extra comma both at the beginning and at the end 
> would allow programmers the choice where they want to put their commas.

This is the style I am using for records and lists as well. Here an 
example from actual code

     data EventNetwork = EventNetwork
         { actuate :: IO ()
         , pause   :: IO ()

These days, all my record definitions look like that.

Allowing a superfluous leading comma would be great, because that makes 
it easier to move around the first line.

Best regards,
Heinrich Apfelmus


More information about the Haskell-prime mailing list