A Pointless Library Proposal
Donald Bruce Stewart
dons at cse.unsw.edu.au
Mon Oct 30 20:06:52 EST 2006
john:
> On Mon, Oct 30, 2006 at 10:16:46AM -0500, Lennart Augustsson wrote:
> > I like to use undefined is the stub for unimplemented functions since
> > it's nice and terse. Unfortunately, ghc doesn't give much
> > information about where the undefined was called.
> > It would be great if the message for undefined could include file
> > name and line number (like hbc did :).
>
> jhc has the SRCLOC_ANNOTATE pragma, which lets you attach file and line
> number information to arbitrary functions. sort of a generalization of
> the 'assert' feature of ghc. One day I will get around to implementing
> it in ghc. perhaps the next time a program I write mysteriously dies
> with "Prelude.undefined" being the only thing printed.
I've previously used assert for this,
For locating errors with line numbers:
http://www.cse.unsw.edu.au/~dons/tmp/Exception.hs
and adding line numbers to 'trace'
http://www.cse.unsw.edu.au/~dons/tmp/Location.hs
But seems like we need a 'proper' solution. undefineds with lines
numbers, and errors with line numbers, would be a good start.
-- Don
More information about the Libraries
mailing list