so in the end I had to build the program with:<br><br> ghc -prof -auto-all -rtsopts -osuf prof *.hs<br><br>so also -rtsopts. After the simple ghc *.hs build.<br><br>then I run it with:<br><br>+RTS -xc -RTS<br><br>in the command-line.<br>
<br>but it doesn&#39;t appear to work properly, I guess I didn&#39;t quite compile or run it correctly. It constantly displays me some stack position during the whole runtime even when there is no problem.<br>When the real problem comes, it still displays the same stack it did for the whole runtime, but there is no &quot;head&quot; in that function.<br>
<br>I&#39;ll probably end up debugging this one &quot;by hand&quot;, but I would really would like to have a general solution for the problem for the future, where tooling would help me...<br><br>annotating/modifying my code... it really seems wrong in this case :-/<br>
<br><div class="gmail_quote">On Tue, Nov 6, 2012 at 8:34 PM, Emmanuel Touzery <span dir="ltr">&lt;<a href="mailto:etouzery@gmail.com" target="_blank">etouzery@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
well it certainly requires will to build with profiling.<br>i had to reinstall all my cabal packages with profiling enabled, which i finally managed to do now..<br><br>and now it tells me:<br>ghc -prof -auto-all Prog.hs<br>

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

<br>Ah well.. I&#39;ll fight some more with this later. Not exactly &quot;out of the box&quot;...<span class="HOEnZb"><font color="#888888"><br><br>Emmanuel</font></span><div class="HOEnZb"><div class="h5"><br><br><div class="gmail_quote">
On Tue, Nov 6, 2012 at 1:02 PM, Ozgur Akgun <span dir="ltr">&lt;<a href="mailto:ozgurakgun@gmail.com" target="_blank">ozgurakgun@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Emmanuel,<div><br></div><div>It is indeed good practice to write total programs in general. However, I understand the need for stack traces in practice.</div>

<div><br></div><div>There are some slides by Simon Marlow on the issue, ironically using your example in the title.</div>

<div><br></div><div>In short: check the -xc flag in <a href="http://www.haskell.org/ghc/docs/7.0.1/html/users_guide/runtime-control.html" target="_blank">http://www.haskell.org/ghc/docs/7.0.1/html/users_guide/runtime-control.html</a></div>



<div><br></div><div>Hope this helps,</div><div>Ozgur</div><div><br></div>
</blockquote></div><br>
</div></div></blockquote></div><br>