<div class="gmail_quote">On Mon, Apr 20, 2009 at 2:54 PM, Peter Verswyvelen <span dir="ltr">&lt;<a href="mailto:bugfact@gmail.com">bugfact@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;">
<div>I find this very confusing. Is the documentation of seq wrong (should be <span style="font-style:italic">weak</span> head normal form)?</div></blockquote><div><br></div><div>Yes.  Weak head normal form is really the only <i>essential</i> one.  The popular runtimes do not know how to reduce under a lambda, so they can&#39;t reduce something to hnf.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div></div><div>Anyway, so I guess we would actually need a function:</div><div><br></div><div><div><span style="font-family:&#39;courier new&#39;, monospace"><span style="font-size:large">iswhnf  :: a -&gt; IO Bool</span></span></div>

<div><br></div></div><div><span style="font-family:arial, helvetica, sans-serif"><span style="font-size:small">But since the value of this </span></span><span style="font-family:arial, helvetica, sans-serif"><span style="font-size:small">iswhnf function d</span></span><span style="font-family:arial, helvetica, sans-serif"><span style="font-size:small">epends on </span></span><span style="font-style:italic"><span style="font-family:arial, helvetica, sans-serif"><span style="font-size:small">when</span></span></span><span style="font-family:arial, helvetica, sans-serif"><span style="font-size:small"> it is called, I feel it has to be in the IO monad; actually multiple threads evaluating it have nothing to do with it?</span></span></div>
</blockquote><div><br></div><div>This is an impure function for a few reasons.  I.e. not only does it give different answers at different times (depending on evaluation order), but it is not pure in the domain theory; i.e. (\x. x) 42 = 42, but iswhnf gives different answers for these.</div>
<div><br></div><div>So yes, definitely in IO, as a runtime extension (I wouldn&#39;t even expect this function to be implementable on all runtimes).</div><div><br></div><div>Luke</div></div>