[Haskell-cafe] Indentation woes

anon individu at gmail.com
Fri Jul 27 00:33:17 EDT 2007

2007/7/26, ok <ok at cs.otago.ac.nz>:
> The Fundamental Law of Indentation is
>    "If major syntactic unit X is a proper part of major syntactic
>     unit Y, then every visible character of X is strictly to the
>     right[%] of the leftmost[%] visible character of Y."
> [%] If you are using a right-to-left script, switch "left" and
> "right" in that sentence.

What makes this a law? If you notice a pattern where beginners trip
against this rule because they don't indent the arms of conditionals
properly inside do blocks, should strict adherence to this principle
take precendence over the intuition of prospective users of the
language? Oddly enough, members of the Haskell' committee seem to
think we should amend the rules for the benefit of programmers rather
the other way around, but I guess they never heard of the Fundamental
Law of Indentation.

> That is how indentation makes structure visible, and if you
> break that, you just plain aren't indenting.  This isn't fuzzy,
> and it isn't aesthetic, it's simply that if you start things in
> the same column you are making it obvious to the reader than
> neither is part of the other.  In the example about, that's not
> true.  You might as well go around ending sentences with

I see what you did there. But you really might as well end sentences
with prepositions. Or begin them with conjunction. Or indent your code
whichever way seems most natural and elegant because to do otherwise
is just prescriptivism for its own sake. In general, people don't much
care for arbitrary rules; they like to understand the rationale behind
them before they get on board, which is all I'm really asking for

More information about the Haskell-Cafe mailing list