<div dir="ltr"><div><div><div>I asked more or less the same question in august 2012.<br><br></div>as I have gained more experience with Haskell, the problem has become less important and I think it will be the same with you. But there is a better solution than Maybe and others, haskell can give you a stack trace if you compile with profiling enabled:<br>
<br><a href="http://marc.info/?t=135220245600002&r=1&w=4">http://marc.info/?t=135220245600002&r=1&w=4</a><br><br></div>I now make sure to compile all my libraries with profiling enabled, just in case I may need it...<br>
<br></div>emmanuel<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Mar 31, 2013 at 5:42 PM, Nathan Hüsken <span dir="ltr"><<a href="mailto:nathan.huesken@posteo.de" target="_blank">nathan.huesken@posteo.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hey,<br>
<br>
I have written a program which, when executed produces:<br>
<br>
Main: Prelude.head: empty list<br>
<br>
Now, I can go through my program and replace all "head" with<br>
<br>
(\a -> trace ("<line-nr>: length=" ++ (show (length a))) a)<br>
<br>
Actually, I already did that, and by this I found the error.<br>
But I wonder if there would have been an easier way?<br>
Has anyone any debug advice how I could find out which call to "head" causes this without so much typing work?<br>
<br>
Thanks!<br>
Nathan<br>
<br>
______________________________<u></u>_________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/<u></u>mailman/listinfo/beginners</a><br>
</blockquote></div><br></div>