On 9/18/07, <b class="gmail_sendername">Pepe Iborra</b> &lt;<a href="mailto:mnislaih@gmail.com">mnislaih@gmail.com</a>&gt; wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Could you paste a ghci session demonstrating the problem?<br><br></blockquote></div><br>Here is a very short and simple debug session showing the problem:<br>
<br>
=======================================<br>
*Main&gt; :l debug68.hs<br>
[1 of 1] Compiling Main&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ( debug68.hs, interpreted )<br>
Ok, modules loaded: Main.<br>
*Main&gt; :break qsort<br>
Breakpoint 1 activated at debug68.hs:(1,0)-(3,55)<br>
*Main&gt; main<br>
Stopped at debug68.hs:(1,0)-(3,55)<br>
_result :: [a] = _<br>
[debug68.hs:(1,0)-(3,55)] *Main&gt; :delete *<br>
[debug68.hs:(1,0)-(3,55)] *Main&gt; :continue<br>
[0,1,3,4,8,11,18,23]<br>
*Main&gt; :break qsort<br>
Breakpoint 2 activated at debug68.hs:(1,0)-(3,55)<br>
*Main&gt; main<br>
[0,1,3,4,8,11,18,23]<br>
=======================================<br>
<br>
The code:<br>
=======================================<br>
qsort [] = [] <br>
qsort (a:as) = qsort left ++ [a] ++ qsort right<br>
&nbsp; where (left,right) = (filter (&lt;=a) as, filter (&gt;a) as)<br>
<br>
main = do<br>
&nbsp;&nbsp;&nbsp; print $ qsort [8, 4, 0, 3, 1, 23, 11, 18]<br>
=======================================<br><br><span class="gmail_quote"></span>The sequence is:<br>1: set a breakpoint at qsort<br>2: evaluate function main<br>3: execution stopped at qsort (as expected)<br>4: delete all breakpoints
<br>5: set breakpoint at qsort again<br>6: evaluate function main<br>7: that lazy haskell show the result without stopping at the breakpoint<br><br>Just for fun I wrote an IO qsort function:<br><br>&nbsp;&nbsp;&nbsp; qsortIO :: (Ord a) =&gt; [a] -&gt; IO [a]
<br>&nbsp;&nbsp;&nbsp; qsortIO [] = return []<br>&nbsp;&nbsp;&nbsp; qsortIO (a:as) = do<br>&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; l &lt;- qsortIO left<br>&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; r &lt;- qsortIO right<br>&nbsp; &nbsp; &nbsp; &nbsp; return $ l ++ [a] ++ r<br>&nbsp; &nbsp; &nbsp; where<br>&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; (left, right) = (filter (&lt;=a) as, filter (&gt;a) as)
<br><br>and this one gets debugged on each run thanks to it&#39;s IO signature.<br><br>Hope this helps,<br><br>Best regards,<br><br>Olivier.<br>