[Haskell-cafe] Re: Is 78 characters still a good option? Was: breaking too long lines

Stefan Monnier monnier at iro.umontreal.ca
Thu Apr 23 12:41:22 EDT 2009


> I think the non-applicable to code observation is very likely true –
> we'd like to be able to write nice descriptive variable names.
> In  doing this, we probably want them to be more than the 1 or
> 2  characters that Haskellers traditionally use, maybe of the order of
> 5-10.

> Given this, it would seem a shame to only be able to fit 6-13 litterals on
> a line, that sounds like we'll quickly be having to wrap lines with
> deffinititions of any significance on them.

I really like the 80-columns rule.  And I also agree that long
identifiers can be useful.  All this means is that you use up
more lines.  Note that this can be a good thing: indentation is
information, so by using more lines, you give more
indentation information.

> My personal preference with Haskell is to ignore the 78 character "limit",
> but only when layout otherwise becomes horrible otherwise.

I consider screen real-estate a very valuable resource (and I'm appaled
by the fact that current 21" displays are limited to 1600x1200 when they
could go up to 1800x1400 ten years ago), and in this light the 80
columns limit tends to work fairly well: using significantly less (like
50) makes the code really difficult to write, whereas using more tends
to waste a lot of space because, while some lines will make good use of
the extra columns, most of them won't.

Finally, I find that the indentation-pressure imposed by the 80-columns
limit forces me to write better code: when code indentation grows too
high, I'm forced to move it to a separate function, making the code more
readable at the same time (by being forced to choose a name for the
function and to choose appropriate arguments and return values).


        Stefan



More information about the Haskell-Cafe mailing list