
Simon P. Jones wrote today about the -xc option to help with
finding who called fromJust Noting.
Now, I see in the GHC Guide:
------------------------------------------------------------------
-xs
(Only available when the program is compiled for profiling.) When an
exception is raised in the program, this option causes the current
cost-centre-stack to be dumped to stderr.
This can be particularly useful for debugging: if your program is
complaining about a head [] error and you haven't got a clue which bit of
code is causing it, compiling with -prof -auto-all and running with
+RTS -xc -RTS will tell you exactly the call stack at the point the error
was raised.
The output contains one line for each exception raised in the program
(the program might raise and catch several exceptions during its
execution), where each line is of the form:
< cc1, ..., ccn >
...
---------------------------------------------------------------------
So, I `made' the project under -prof -auto-all and run
./Nat1 +RTS -xc -RTS.
It prints
...
(3, Ind n,
(formula1
[(1, IndMember,