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

Christopher Allen cma at bitemyapp.com
Tue Aug 30 05:35:32 UTC 2016


When most Haskellers say tab width, they're colloquially referring to
how many literal spaces each "indent" action should be.

That is the case here as well. Most Haskellers I know do not use tabs
at all to avoid indent issues, unlike Golang which is exclusively
tabs.

On Mon, Aug 29, 2016 at 10:56 PM, Richard A. O'Keefe <ok at cs.otago.ac.nz> wrote:
>
>
> 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.
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.



-- 
Chris Allen
Currently working on http://haskellbook.com


More information about the Haskell-Cafe mailing list