Permitting trailing commas for record syntax ADT declarations

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 - From a lead-developer-who-merges-a-lot point of view, trailing commas in import lists are a godsend. import Foo ( fu, baz, quux, ) is brilliant. It lets me add a line, + foobar, and remove a line, - - fu, in a very neat manner. Annoying 3-way merges be gone! It would be *very* useful if the same behaviour existed for record syntax. I wish this existed on an almost daily basis, data Foo a b = MkFoo { fu :: a, ba :: b, } If there's not too much opposition to the idea, I would like to take a stab at implementing this. Any pointers on *how* to implement it, would be very useful as I'm not familiar with the codebase outside of libraries/base at all. - -- Alexander alexander@plaimi.net https://secure.plaimi.net/~alexander -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iF4EAREIAAYFAlQgE3kACgkQRtClrXBQc7WHLQD/V9bHhC9ekobxxB5j7ZwAVj8e G3pQr4jmLAOFHkdSs/EBAIybHdSVXQlQ1fFTpLUzB/EIDLpiHlKKlU4tG01hYUhp =A1Ky -----END PGP SIGNATURE-----

-----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 {foo :: a, bar :: b} deriving (Show) λ (MkFoo {,foo = 2, bar = 3,}) {,foo=3,} MkFoo {foo = 3, bar = 3} I am happy to have a stab at all the other requests in this thread. I will make small commits so that we can cherry-pick the ones we want. We need to decide if we're going to sneak this into HEAD, or introduce a language pragma (or one per structure that permits it). My vote goes for the first-mentioned route, as this should be non-breaking changes (if I do them correctly). Please cast your vote on the matter. :-] - -- Alexander alexander@plaimi.net https://secure.plaimi.net/~alexander -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iF4EAREIAAYFAlQgSq4ACgkQRtClrXBQc7WtfgD+I/K/Cy+aiaGZeGUUQC8yQthW +wFf7+9sKX0dz0PktxgBAIVamPo/UhDLTgkFJOM03ro6OOC5i3Kb4/0YhsnTH/BP =SPjR -----END PGP SIGNATURE-----
participants (1)
-
Alexander Berntsen