Character index vs Column number in GHC error messages

Krasimir Angelov kr.angelov at gmail.com
Wed Aug 31 02:55:27 EDT 2005


Hello, Guys

Quite recently GHC was changed to display the column number as well as
the line number in all error messages. This is useful feature but I
found the following difficulty with using it. All text editors that
have built-in support for compilers, expect to find the line number in
the reported error messages. Some of them support column number as
well, but actually this isn't the column number but the character
index in the current line. The difference comes from the tab
characters which can have different width depending from the editor
settings. For such reason all compilers, which I am aware of, display
the character index instead of column number. I tried this with C#,
Visual Basic and GNU CPP.  GCC, Sun's Java compiler and Visual C++
compiler are displaying only the line number. Using the character
index the editor can unambiguously find the exact position where the
error is independently from the current tab setting. GHC displays the
column number instead and this confuses the editors. At least I tried
this with Visual Studio and TextPad editor. I have modified the GHC
parser so that it displays the character index instead of column
number, but I am curious whether this is the preferred behaviour of
the other compilers/editors. Any thoughts are appreciated.

Cheers,
   Krasimir


More information about the Glasgow-haskell-users mailing list