Tab "\t" character behaviour in (Win)hugs/ghc

Brian Boutel brian@nzcs.org.nz
Wed, 19 Sep 2001 10:10:51 +1200


Sigbjorn Finne wrote:
> >
> > What does the language definition say about this?
> 
> Nothing at all, I believe, but the convention is for tab characters
> to be interpreted by an output device as moving the cursor to
> the next tab stop/alignment column. In the absence of any custom
> set of tab stops, the convention is to space them evenly every
> 8 characters.
>

Actually, Appendix B3 of the Haskell 98 Report says

The "indentation" of a lexeme is the column number indicating the start
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 this tab convention: tab stops are 8 characters
apart, and a tab character causes
the insertion of enough spaces to align the current position with the
next tab stop. For the purposes of
the layout rule, Unicode characters in a source program are considered
to be of the same, fixed,
width as an ASCII character. The first column is designated column 1,
not 0. 

--brian