[Haskell-cafe] question about indentation conventions

Richard A. O'Keefe ok at cs.otago.ac.nz
Tue Jul 2 01:33:10 CEST 2013


On 2/07/2013, at 12:00 AM, Richard Cobbe wrote:

> Sure.  So my first question boils down to which of the two alternatives
> below does the community prefer?  (To be clear about the intended
> semantics: this is the application of the function f to the arguments x, y,
> and z.)
> 
>    f x
>    y
>    z

This (a) clearly violates the Golden Rule of Indentation
 and (b) Goes out of its way to confuse human readers.
I do not know any indenting program that would tolerate
such a layout for C or Lisp.

> or
> 
>    f x
>     y
>     z
> 
> Both are correct, in most contexts.

What part of "y and z are PARTS of f x y z and so SHOULD BE INDENTED
relative to the whole expression" is hard to understand?

If by "correct" you mean "will not confuse a Haskell parser",
you're right.  If you mean "will not dangerously mislead human
readers", only the second form is acceptable.

I do not trust any program to do my indentation.
And let's face it, if your Haskell functions are big
enough that manual indentation is a big issue, they
are too big.





More information about the Haskell-Cafe mailing list