Yes, GHC will rewrite this to<div><br></div><div>    force x = x</div><div><br></div><div>I&#39;m also not sure if we really want &quot;seq&quot; in all of these cases, or if we want stronger guarantees.  For example, GHC can (and often will) rewrite</div>

<div><br></div><div>    f x y = x `seq` y `seq` x</div><div><br></div><div>to</div><div><br></div><div>    f x y = y `seq` x</div><div><br></div><div>This changes the order of evaluation. For pure computations this is semantically sound. However, it can change the space behaviour of the program, which defeats the point of using &quot;seq&quot; in the first place (usually). If forcing &quot;x&quot; to be evaluated before &quot;y&quot; is the goal, then &quot;pseq&quot; must be used. I think it&#39;s worthwhile to consider introducing high-level combinators for this use case as well.</div>

<div class="gmail_extra"><br><br><div class="gmail_quote">On 15 November 2012 15:38, Johan Tibell <span dir="ltr">&lt;<a href="mailto:johan.tibell@gmail.com" target="_blank">johan.tibell@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 class="im">On Thu, Nov 15, 2012 at 2:38 AM, Henning Thielemann <span dir="ltr">&lt;<a href="mailto:lemming@henning-thielemann.de" target="_blank">lemming@henning-thielemann.de</a>&gt;</span> wrote:</div>

<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">

<div>
On Mon, 12 Nov 2012, Bas van Dijk wrote:<br></div></div><div class="im"><div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
force :: WHNFData a =&gt; a -&gt; a<br>
force x = x `seq` x<br>
</blockquote>
<br></div>
Does this function do something?</div></blockquote><div><br></div><div>No. It says &quot;when x is evaluated, evaluate x&quot;. </div></div>
<br>_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/libraries" target="_blank">http://www.haskell.org/mailman/listinfo/libraries</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Push the envelope. Watch it bend.<br>
</div>