How can I get the position where error was called?
haskell
Solution
You can use the `-xc` RTS 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:
$ ghc --make -prof -auto-all myprog.hs
$ ./myprog +RTS -xc
Technically this only gives a cost centre stack, not a true stack trace. Improved stack trace support is coming in GHC 7.4.
Problem
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).