<div>As noted, IO is not strict in the value x, only in the operation that generates x. However, should you desire strictness in a generic way, it would be trivial to model a transformer monad to provide it.</div><div><br>
</div><div><div>E.g.</div><div><br></div><div>data StrictT m a = StrictT (m a)</div><div><br></div><div>runStrictT :: StrictT m a -&gt; m a</div><div>runStrictT (StrictT op) = op</div><div><br></div><div>class (Monad m) =&gt; Monad (StrictT m a) where</div>
<div>  return x = StrictT (return x)</div><div>  (StrictT op) &gt;&gt;= f = op &gt;&gt;= \ a -&gt; a `seq` StrictT (f a)</div><div><br><br><div class="gmail_quote">On Sat, Jan 21, 2012 at 9:29 AM, Victor S. Miller <span dir="ltr">&lt;<a href="mailto:victorsmiller@gmail.com">victorsmiller@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">The &quot;do&quot; notation translates<br>
<br>
do {x &lt;- a;f}  into<br>
<br>
a&gt;&gt;=(\x -&gt; f)<br>
<br>
However when we&#39;re working in the IO monad the semantics we want requires that the lambda expression be strict in its argument.  So is this a special case for IO?  If I wanted this behavior in other monads is there a way to specify that?<br>

<br>
Victor<br>
<br>
Sent from my iPhone<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>
</blockquote></div><br></div></div>