<div class="gmail_quote">On Sat, Mar 27, 2010 at 8:16 PM, Roman Leshchinskiy <span dir="ltr">&lt;<a href="mailto:rl@cse.unsw.edu.au">rl@cse.unsw.edu.au</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On 28/03/2010, at 01:36, Jan-Willem Maessen wrote:<br>
<br>
&gt; It&#39;s worth pointing out that there&#39;s a bit of bang-pattern mysticism going on in this conversation (which has not been uncommon of late!).  A non-buggy strictness analyzer should expose the strictness of these functions without difficulty.<br>

<br>
</div>Actually, rangeJ is lazy in i and rangeK is lazy in i and j. GHC does unbox everything important here but that needs more optimisations than just strictness analysis. You are right, though, that GHC doesn&#39;t need bang patterns here.<br>
</blockquote><div><br></div><div>Quite right, the condition in rangeK that mentions all variables is under another condition:</div><div><br></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 11px; border-collapse: collapse; ">       rangeK :: Int -&gt; Int -&gt; Int -&gt; Int -&gt; Int<br>
       rangeK i j k acc<br>           | k &lt; 1000 =<br>               if i * i + j * j + k * k `mod` 7 == 0</span></div><div>               ...</div><div><br></div><div>So we need to apply some constructor specialization as well to notice that i and j are always of the form (Int# i#).</div>
<div><br></div><div>-Jan</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><font color="#888888">Roman<br>
<br>
<br>
</font></blockquote></div><br>