<div dir="ltr">I would argue that a monad transformer "cannot undo earlier action in a lower monad." For example, in the case of MaybeT: In order to determine of an action succeeded or failed, it needs to evaluate in the underlying monad. But what if the underlying monad doesn't provide any means to restore its state to some previous point? So I believe having 'v >> mzero = mzero' for a transformer with MonadPlus would be only possible if the underlying monad provided some kind of check-pointing.<br>

</div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-02-04 Dan Burton <span dir="ltr"><<a href="mailto:danburton.email@gmail.com" target="_blank">danburton.email@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr"><div class="im"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span style="font-family:arial,sans-serif;font-size:13.333333969116211px">The issue is that a later mzero in the transformer cannot undo an earlier action in a lower monad.</span></blockquote>



<div><br></div></div>Precisely. Another example, for fun:<div><br></div><div><div><div><font face="courier new, monospace">>>> print (runMaybeT $ lift [1,2,3] >> mzero :: [Maybe Int])<br></font></div><div>

<font face="courier new, monospace">[Nothing, Nothing, Nothing]</font></div>

<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">>>> print (runMaybeT mzero :: [Maybe Int])</font></div></div><div><font face="courier new, monospace">[Nothing]</font><br>



</div></div><div><br></div><div>Actually, I'd say the problem <i>isn't </i>that a transformer "cannot undo earlier action in a lower monad." I'd just say that most transformers <i>happen to be implemented </i>in this "forgetful" manner. It's conceivable that we could implement some of them differently, in a way that would obey the MonadPlus laws. Whether or not obedience to this particular law is worthwhile... well, that's debatable.</div>

<span class="HOEnZb"><font color="#888888">

<div><br></div>-- Dan Burton</font></span></div>
<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>
<br></blockquote></div><br></div>