<div class="gmail_quote">On Sat, Jan 21, 2012 at 10:08 AM, Roman Cheplyaka <span dir="ltr"><<a href="mailto:roma@ro-che.info">roma@ro-che.info</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
* David Barbour <<a href="mailto:dmbarbour@gmail.com">dmbarbour@gmail.com</a>> <a href="tel:%5B2012-01-21%2010" value="+12012012110">[2012-01-21 10</a>:01:00-0800]<br>
<div class="im">> As noted, IO is not strict in the value x, only in the operation that<br>
> generates x. However, should you desire strictness in a generic way, it<br>
> would be trivial to model a transformer monad to provide it.<br>
<br>
</div>Again, that wouldn't be a monad transformer, strictly speaking, because<br>
"monads" it produces violate the left identity law.<br></blockquote><div><br></div><div>It meets the left identity law in the same sense as the Eval monad from Control.Strategies.</div><div> <a href="http://hackage.haskell.org/packages/archive/parallel/3.1.0.1/doc/html/src/Control-Parallel-Strategies.html#Eval">http://hackage.haskell.org/packages/archive/parallel/3.1.0.1/doc/html/src/Control-Parallel-Strategies.html#Eval</a></div>
<div><br></div><div>That is, so long as values at each step can be evaluated to WHNF, it remains true that `return x >>= f` = f x.</div><div><br></div><div>I did mess up the def of >>=. I think it should be:</div>
<div> (StrictT op) >>= f = StrictT (op >>= \ x -> x `seq` runStrictT (f x))</div><div><br></div><div>But I'm not interested enough to actually pull out an interpreter and test...</div><div><br></div><div>
Regards,</div><div><br></div><div>Dave</div><div><br></div></div>