I am looking for something to replace loch (and its preprocessor) since it doesn’t compile with ghc 7.
Specifically, if error is called then I would like to figure out, as conveniently as possible, where it was called from (line number and stack trace would be nice).
You can use the
-xcRTS option, as described on this page; you need to compile your program with profiling support, and the output is pretty ugly, but it works.This should do it:
Technically this only gives a cost centre stack, not a true stack trace. Improved stack trace support is coming in GHC 7.4.