[Haskell-cafe] Which tab width do you prefer for Haskell code?

Richard A. O'Keefe ok at cs.otago.ac.nz
Tue Aug 30 03:56:56 UTC 2016



On 30/08/16 6:09 AM, Christopher Done wrote:
> Hi everyone,
>
> I'm trying to get a feel for the modern Haskell community's opinion on
> default tab-width for HIndent. Here is a link to the online poll:
>
> http://doodle.com/poll/82xf854t9mmuv22h#table
>
> Quote:
>
>> For the HIndent tool we'd like to choose the standard tab width.
>> For now, it is 4, the width set by the Johan Tibell style guide.
>> A survey of 1000 top-downloaded packages on Hackage reveals about 50-50 either way:https://gist.github.com/chrisdone/e3d1796d8f5df717b91db54aae36c440
>> HIndent is meant as a "community standard" tool; it should reflect the community's actual practice. If there's a clear preference for 2, we'll switch to that. Otherwise, we remain with 4.

There seems to be some confusion here.
The Johan Tibell style guide does NOT "set"
"the standard tab width" to 4.  Far from it!
The guide says plainly "TABS ARE ILLEGAL".

What the style guide talks about is INDENTATION steps.
Not tab width!

When it comes to TAB width, the Haskell 2010 report
is explicit and unambiguous, leaving no room for
anyone's preferences.  Chapter 10 says

	The "indentation" of a lexeme is the column number
	of the first character of that lexeme;
	the indentation of a line is the indentation of
	its leftmost lexeme.
	To determine the column number, assume a fixed-
	width font with the following conventions:
	* The characters newline, return, linefeed,
	  and formfeed, all start a new line.
	* The first column is designated column 1, not 0.
	* TAB STOPS ARE 8 CHARACTERS APART.
	* A tab character causes the insertion of enough
	  spaces to align the current position with the
	  next tab stop.


More information about the Haskell-Cafe mailing list