[Haskell-cafe] question about indentation conventions
Johannes Waldmann
waldmann at imn.htwk-leipzig.de
Mon Jul 1 13:51:52 CEST 2013
> Code which is part of some expression should be indented
> further in than the beginning of that expression [...]
Yes. Then the next question is "how much further in".
My answer is: it does not matter, but make it consistent (like 4 spaces),
with the implication that indentation should *not* depend
on length of identifiers in the previous line(s)
Example (bad):
foo x = do bar
baz
Example (good):
foo x = do
bar
baz
Reason: when refactoring later changes the name "foo",
or the number or names of its arguments,
you'll have to re-indent code (in the "bad" version):
(a) this needs tool support and
(b) it creates noise in the diffs.
- J.W.
More information about the Haskell-Cafe
mailing list