[nhc-bugs] the format of error diagnostics

Malcolm Wallace Malcolm.Wallace@cs.york.ac.uk
Mon, 10 Dec 2001 15:23:41 +0000


| > And how about this one:
| > 
| >       Error after type deriving/checking:
| >    Type error type clash between Prelude.Int and Main.Foo
| >    when trying to apply function at 4:17 to its 1:st argument at 4:8.
| 
| 
| How about:
| 
|      file1.hs:4:8:  Error after type deriving/checking:
|                     Type error type clash between Prelude.Int and Main.Foo
|                     when trying to apply function to its 1:st argument
|      file2.hs:4:17: (the function is defined here).

Unfortunately, that is not what the current error message means.
The function is not defined at line 4, column 17 - it is used at that
position.  The function is at 4:17, the argument is at 4:8 (this is
an infix application), and the definition is somewhere else, possibly
not even in this module.  It could be the function definition that
is wrong, or the argument, or it could be the application (e.g. an
argument missing).

Therefore, in the message

            Type error type clash between Prelude.Int and Main.Foo
            when trying to apply function to its 1:st argument

both positions are vital to understanding the message - either
position on its own is not sufficient.  (It would be nice to also
report a position for the definition, if there is one, but we don't
currently have that information in the compiler.)

Regards,
    Malcolm