error stack traces/source locations (was: Should exhaustiveness
testing be on by default?)
Simon Peyton-Jones
simonpj at microsoft.com
Tue May 26 09:58:31 EDT 2009
| I'd be happy to be proven wrong in this, of course!-) I had the feeling
| that there'd been some recent work on all this and, indeed, reddit has:
|
| http://www.reddit.com/r/haskell/comments/8mbar/finding_the_needle_stack_traces_for_g
| hc_pdf/
Sorry I've been very buried recently. Some brief rejoinders to this thread.
- Yes, Tristan's paper "Finding the needle"
http://research.microsoft.com/~simonpj/papers/stack-trace/DebugTraces.pdf
describes his intern work, and represents a good stab at the problem.
I think he'd be very interested in feedback. Is this the best way to tackle
the problem? Are there better alternatives?
- It's not in GHC HEAD, because of the unresolved issues that are discussed
towards the end of the paper.
- Template Haskell does let you find the current source location, thus:
loc :: Q Exp
loc = do { l <- location
; lift (loc_module l ++ ":" ++ show (loc_start l)) }
Now you can say (error $(loc)), and you'll get the source location of the
call to $loc.
So that's pretty close to what was originally asked for.
Simon
More information about the Glasgow-haskell-users
mailing list