so in the end I had to build the program with:

 ghc -prof -auto-all -rtsopts -osuf prof *.hs

so also -rtsopts. After the simple ghc *.hs build.

then I run it with:

+RTS -xc -RTS

in the command-line.

but it doesn't appear to work properly, I guess I didn't quite compile or run it correctly. It constantly displays me some stack position during the whole runtime even when there is no problem.
When the real problem comes, it still displays the same stack it did for the whole runtime, but there is no "head" in that function.

I'll probably end up debugging this one "by hand", but I would really would like to have a general solution for the problem for the future, where tooling would help me...

annotating/modifying my code... it really seems wrong in this case :-/

On Tue, Nov 6, 2012 at 8:34 PM, Emmanuel Touzery <etouzery@gmail.com> wrote:
well it certainly requires will to build with profiling.
i had to reinstall all my cabal packages with profiling enabled, which i finally managed to do now..

and now it tells me:
ghc -prof -auto-all Prog.hs

    Dynamic linking required, but this is a non-standard build (eg. prof).
    You need to build the program twice: once the normal way, and then
    in the desired way using -osuf to set the object file suffix.

Ah well.. I'll fight some more with this later. Not exactly "out of the box"...

Emmanuel


On Tue, Nov 6, 2012 at 1:02 PM, Ozgur Akgun <ozgurakgun@gmail.com> wrote:
Hi Emmanuel,

It is indeed good practice to write total programs in general. However, I understand the need for stack traces in practice.

There are some slides by Simon Marlow on the issue, ironically using your example in the title.


Hope this helps,
Ozgur