
On 6/29/05, Seth Kurtzberg
I just wanted to correct any assumption that imperative language don't suffer from error message problems. Fundamentally, they suffer more, and are in many cases impossible to fix. In my experience GHC error locations always have some relationship to the error in coding, although of course the error message may at times be hard to interpret because the programmer believes he has coded a function with a particular signature but, in fact, has coded the function with a different inferred type. (Of course we all always explicitly specify function signatures and avoid this problem entirely. :-) )
This makes me think that an interactive "compile-time debugger" could be a good idea to help "newbies". It would present expressions against the inferred type and ask if the inference is correct. The user could either accept the inference, or reject it. After a few itrerations the exact location of the error should be pinpointed exactly. Additionally, confirmed inferences could be added directly in the source code as type annotations. (Iirc, Chameleon does this sort of thing.) Of course, GHC is probably not the place to add such a functionality. It could be a tool of its own right, perhaps part of the Helium project. Cheers, JP.