Haskell uses separators for values in a number of syntactic
constructs. It is my understanding of the 2010 report that the
language does however not generally support leading separators, nor
trailing separators, nor both (two exceptions are discussed at the end
of this email). Consequently diffs are bloated, resulting in mental
overhead when viewing and reviewing patches, as well as potential
three-way merge conflicts or worse. A quick example:
It is impossible to remove values Foo or Baz with a one line diff. It
is additionally impossible to reasonably add a new value to the top or
bottom of the list.
I want the Haskell' committee to discuss allowing one or more of the
* Leading separators
* Trailing separators
* No separators
The former two, or a combination, is arguably the least invasive
modification, whilst the latter is more sensible as a language
extension for now as it would break code. The latter is furthermore
difficult as the rules are potentially more involved, yielding more
gotchas. My immediate suggestion for the no separators route would be
to use newlines.
The discussion should apply to as many contexts as deemed sensible. It
is arguably insensible to introduce leading or trailing separators
where we would end up with ambiguity, as would be the case with tuple
declarations due to tuple sections. Examples of where it would be
sensible are abundant, and include -- but aren't limited to -- data
types, lists, record fields, pattern guards, and language pragmas.
If leading separators, or trailing separators, or both, are accepted
as the way to go forward, perhaps permit extra separators in general.
I.e. [,,,Foo,,,Bar,,,Fu,,,Baz,,,] is a list with four terms, Foo, Bar,
Fu, and Baz.
Please note that Haskell 2010 already permits trailing commas in
import and export lists, like so:
impspec → ( import1 , … , importn [ , ] ) (n ≥ 0)
exports → ( export1 , … , exportn [ , ] ) (n ≥ 0)
Meaning the following is legal:
import Foo (
And the following:
module Foo (
Bizarrely, the following is *not* legal:
import Foo (
I.e. impspecs are permitted trailing commas, imports aren't.
alexander <at> plaimi.net