Or what about a specialized Escape Continuation monad?  (Perhaps there is one on hackage, not sure).<br><br>Something that allows you to set up an continuation (for &quot;escape&quot;) purposes, but does not allow you<br>to capture any more continuations after that, and call that escape cont w/in itself, supplying a &quot;return&quot; value.<br>
<br>i.e. <br><br>&gt; run = do<br>&gt;    result &lt;- createEscape $ \escape -&gt;<br>&gt;        lengthyComputation1<br>&gt;        inp &lt;- askToContinue<br>&gt;        if (not (continue inp)) <br>&gt;          then escape &quot;They quit&quot;<br>
&gt;          else lengthyComputation2<br>&gt;    return result<br><br>Just thinking off the top of my head :).<br><br>However, if there are going to be multiple &#39;lengthy computations&#39; then perhaps<br>MaybeT or EitherT would be better, b/c they allow the propagation of failure<br>
across multiple actions, instead of cascading off to the right of the screen w/ &#39;if&#39;s or &#39;case&#39;s.<br><br>Cheers,<br> - Tim<br><br><div class="gmail_quote">On Thu, Jun 10, 2010 at 3:21 PM, Ben Millwood <span dir="ltr">&lt;<a href="mailto:haskell@benmachine.co.uk">haskell@benmachine.co.uk</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">On Thu, Jun 10, 2010 at 8:57 PM, Maciej Piechotka &lt;<a href="mailto:uzytkownik2@gmail.com">uzytkownik2@gmail.com</a>&gt; wrote:<br>

&gt;<br>
</div><div class="im">&gt; Error monad seems not to be a semantic solution as we exit on success<br>
&gt; not failure.<br>
&gt;<br>
<br>
</div>Which is really why the Either monad should not necessarily have Error<br>
associations :)<br>
If you forget about the fail method, the Monad (Either e) instance<br>
doesn&#39;t need the e to be an error type.<br>
<br>
Alternatively, if even Error is more information than you need, you<br>
could use MaybeT:<br>
<br>
<a href="http://hackage.haskell.org/package/MaybeT" target="_blank">http://hackage.haskell.org/package/MaybeT</a><br>
<br>
which allows you to just stop. Given you&#39;re using it with IO it&#39;d be<br>
easy to write a result to an IORef before terminating the computation,<br>
so it&#39;s of equivalent power, if slightly less convenient.<br>
<div><div></div><div class="h5">_______________________________________________<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>