Permitting trailing commas for record syntax ADT declarations

Jan Stolarek jan.stolarek at p.lodz.pl
Wed Sep 24 07:40:21 UTC 2014


> 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
>          , b
>          , c
>          ]
During hacking sessions I often find myself in the need of commenting out the first import /record 
field/list element. With the proposed change I can just:

   module A
      ( --a
      , b
      , c
      ) where ...

   data A = A
      { --a :: Int
      , b :: Int
      , c :: Int
      }

   abc = [ --a
         , b
         , c
         ]

As things are now I am forced to edit the second line as well. (And when I'm uncommenting things I 
need to edit the second line again). This is mostly irritating and that's why I think 
implementing this proposal will be a Good Thing.

Janek


More information about the ghc-devs mailing list