Limber separators
Herbert Valerio Riedel
hvriedel at gmail.com
Wed Jun 1 06:44:39 UTC 2016
On 2016-05-31 at 15:42:14 +0200, Antonio Nikishaev wrote:
[...]
> Personally I don't need this extension per se since I don't care about one excess diff line.
> What I do care about however, is the horrendous style people invented to avoid “the diff problem”.
> As an example
>
> something = [ foo
> , bar
> , baz
> ]
I'm not sure this style was invented to address the diff-problem, as it
actually doesn't solve the problem at all; it only shifts the problem
from the last entry to the first entry in the enumeration.
Moreover, why do you call this a "horrendous" style?
I actually see benefits for trailing separators as you avoid the
separator-alignment problem you'd have with trailing separators:
You either have to use a ragged alignment (and in this case the `,`s are
IMHO hard to see as they're visually attached to their entries; one can
add a whitespace before the `,` though)
something = [
one,
thirteen,
two,
three
]
or if you align the `,`s on the same column to make move separators
visually out of the way, i.e.
something = [
one ,
thirteen ,
two ,
three
]
you may run into a worse diff-problem, once you add an entry that is
longer and would require to realign all `,`s.
That's why I personally consider the "horrendous" style (and I even
catch myself sometimes using this in non-Haskell), i.e.
something =
[ one
, thirteen
, two
, three
]
to have quit a few benefits in its own right. And while I don't *need*
this extension either, I've been tempted to implement such an extension
myself every now and then when I refactor code and fail to move the `,`s
around, resulting in an at least one additional edit-save-recompile
cycle.
> So I’d really like to see this extension, even if only to conquer the
> aforementioned style.
:-)
Well, I'd really like to see the grammar relaxed to allow for redundant
leading separators so I could finally use my personal ideal
diff-friendly style:
something = [
, one
, thirteen
, two
, three
]
More information about the Haskell-prime
mailing list