[Haskell-cafe] Printing call site for partial functions

Evan Laforge qdunkan at gmail.com
Fri Apr 27 17:59:35 CEST 2012

On Thu, Apr 26, 2012 at 12:20 AM, Simon Peyton-Jones
<simonpj at microsoft.com> wrote:
> Tristan Allwood got quite a long way with this a couple of years ago.
> http://research.microsoft.com/en-us/um/people/simonpj/papers/stack-trace/DebugTraces.pdf

While stack traces are undoubtably useful, I think this is a different
problem.  At least the one I'm thinking of is.  It's probably never
going to be reasonable to get a whole stack trace on every call to a
logger, but all that's actually needed is the direct call site.
That's a different (and much simpler!) problem.  And at least in my
case, the logging and exception functions are all pure, so using
currentCallStack under an unsafePerformIO would be sketchy.

On Thu, Apr 26, 2012 at 7:05 AM, Joachim Breitner
<mail at joachim-breitner.de> wrote:
> using TH (which I only reluctantly advocate for general usage) you can
> get good location information behaviour, see

Yeah, this is the TH solution I mentioned.  It requires boilerplate at
every call site and put a TH dependency on every module (which seems
to slow down compilation quite a lot!), but on the other hand it
*does* provide zero overhead caller information.  I still prefer my
hacky preprocessor, even though I don't like it much either.

More information about the Haskell-Cafe mailing list