
Hello, nhc98 would be much more convenient to use if the error diagnostics were compatible with Emacs compile mode. In other words, instead of nhc98 -c -d ../nhc Flatten.hs ==================================== Error when renaming:: Constructor OK used at 833:6 is not defined. it would be nice to have the message appear as Flatten.hs:833:6: Error when renaming:: Constructor OK is not defined. Regards, -- F.

nhc98 would be much more convenient to use if the error diagnostics were compatible with Emacs compile mode.
I would like to make that possible, but I'm not sure exactly how it would work. For instance you suggest
nhc98 -c -d ../nhc Flatten.hs
==================================== Error when renaming:: Constructor OK used at 833:6 is not defined.
should be more like
Flatten.hs:833:6: Error when renaming:: Constructor OK is not defined.
But what should the following kind of report translate to? Error when renaming:: Constructor OK used at 117:30, 103:15, 98:21, 72:13, 35:5 is not defined. Identifier splitWhile used at 110:13, 106:8, 102:8, 91:13 is not defined. Identifier digit used at 272:52, 259:52 is not defined. Do you want a separate line for each? 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. A type error is always found as a mismatch between two expressions, leading to at least two possible positions. Which position should the type error be reported for? Regards, Malcolm

But what should the following kind of report translate to?
Error when renaming:: Constructor OK used at 117:30, 103:15, 98:21, 72:13, 35:5 is not defined. Identifier splitWhile used at 110:13, 106:8, 102:8, 91:13 is not defined. Identifier digit used at 272:52, 259:52 is not defined.
Do you want a separate line for each?
IMHO something like the following would be close to perfect: Error when renaming:: file.hs:35:5: Constructor OK is not defined (4 other uses) file.hs:91:13: Identifier splitWhile is not defined (3 other uses) file.hs:259:52: Identifier digit is not defined (1 other use) etc. This allows one to automatically get to the _first_ occurrence. Once the editor's cursor is there, the locations of the rest can be discovered by searching, if one really wants to see them (one often doesn't). With a really fast compiler one often saves time by making one fix and trying again, rather than by deciphering and using information from very involved diagnostics.
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). This would allow one to make Emacs put the cursor first in the offending place, and then - if one wishes - at the definition. Regards, -- Feliks

| > 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

| 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
OK, sorry for misunderstanding the message. But my point remains: the format of the diagnostic message should support Emacs compile mode in locating the two points of interest. Regards, -- F.
participants (2)
-
Feliks Kluzniak
-
Malcolm Wallace