[Haskell-cafe] source line annotations

Henning Thielemann lemming at henning-thielemann.de
Fri Jan 28 17:39:58 CET 2011

Evan Laforge schrieb:
> One of the first things I did when starting a larger haskell project
> was to write a preprocessor that would replace certain tokens with
> (token_srcpos (filename, func_name, lineno)) and then write x and
> x_srcpos versions of the various 'throw' and logging functions.  This
> is extremely handy to have, and since logs are part of my app's UI,
> it's part of the app itself.

I suspect that if you add source position information to 'throw' then
you use 'throw' for showing (unintended) programming errors, but 'throw'
is not intended for this purpose, but for expected problems like 'file
not found' and so on. Adding source position to 'error', 'undefined',
irrefutable patterns and logging functions for debugging makes sense to
me, but for 'throw'?

More information about the Haskell-Cafe mailing list