Why doesn't the implementation simply tack on a line number to the error
message?   One easy way to do this is to give an address/offset to where the
error occurred, and then recompile the module to find the line number.  This
is a fairly common strategy among traditional compilers, especially Borland
compilers.  Is there something about the Haskell implementations that make
this difficult or impossible to do?

Of course, you don't want to return the line number where "error" was
called, but rather the line number where the function that called "error"
was called.   For example, if we wrote:

main = print (head [])

head (_:xs) = xs
head [] = error "Head: empty list"

then we would want to get back to line 1, not line 4.

best,
leon





Reply via email to