Here is a practical example I ran into a few days ago.&nbsp; With this expression:<br><br>&nbsp;&nbsp; writeFile path (compute text)<br><br>the file at path would be overwritten with an empty file if an error occurs while evaluating (compute text).&nbsp; With this one:
<br><br>&nbsp; writeFile path $! (compute text)<br><br>the file alone when an error occurs.<br><br>On Nov 17, 2007 8:04 PM, PR Stanley &lt;<a href="mailto:prstanley@ntlworld.com">prstanley@ntlworld.com</a>&gt; wrote:<br><div class="gmail_quote">
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi<br>okay, so $! is a bit like $ i.e. the equivalent of putting<br>parentheses around the righthand expression. I&#39;m still not sure of
<br>the difference between $ and $!. Maybe it&#39;s because I don&#39;t<br>understand the meaning of &quot;strict application&quot;. While we&#39;re on the<br>subject, what&#39;s meant by Haskell being a non-strict language?
<br>Cheers<br>Paul<br><div><div></div><div class="Wj3C7c">At 01:50 15/11/2007, you wrote:<br>&gt;On 14 Nov 2007, at 4:32 PM, Shachaf Ben-Kiki wrote:<br>&gt;<br>&gt;&gt;On Nov 14, 2007 4:27 PM, Justin Bailey &lt;<a href="mailto:jgbailey@gmail.com">
jgbailey@gmail.com</a>&gt; wrote:<br>&gt;&gt;&gt;It&#39;s:<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; &nbsp; f $! x = x `seq` f x<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;That is, the argument to the right of $! is forced to evaluate, and<br>&gt;&gt;&gt;then that value is passed to the function on the left. The function
<br>&gt;&gt;&gt;itself is not strictly evaluated (i.e., f x) I don&#39;t believe.<br>&gt;&gt;<br>&gt;&gt;Unless you mean f -- which I still don&#39;t think would do much -- it<br>&gt;&gt;wouldn&#39;t make sense to evaluate (f x) strictly.
<br>&gt;<br>&gt;Right. &nbsp;(f x) evaluates f and then applies it to x. &nbsp;(f $! x)<br>&gt;evaluates x, evaluates f, and then applies f to x.<br>&gt;<br>&gt;jcc<br>&gt;<br>&gt;_______________________________________________<br>
&gt;Haskell-Cafe mailing list<br>&gt;<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>&gt;<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe
</a><br><br>_______________________________________________<br>Haskell-Cafe mailing list<br><a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br><a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">
http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br></div></div></blockquote></div><br>