<br><font size=2 face="sans-serif">but there's no risk using trace is there?</font>
<br>
<br><font size=2 face="sans-serif">t.</font>
<br>
<br><font size=2 face="sans-serif">&gt; </font><tt><font size=2>The unsafe...
functions are called that<br>
for a reason, and their use should be highly discouraged,<br>
except in cases where there is absolutely no other<br>
reasonable way. </font></tt>
<br>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>&quot;Yitzchak Gale&quot;
&lt;gale@sefer.org&gt;</b> </font>
<br><font size=1 face="sans-serif">Sent by: haskell-cafe-bounces@haskell.org</font>
<p><font size=1 face="sans-serif">11/29/2007 05:01 PM</font>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td><font size=1 face="sans-serif">&quot;Andrew Coppin&quot; &lt;andrewcoppin@btinternet.com&gt;</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td><font size=1 face="sans-serif">haskell-cafe@haskell.org</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td><font size=1 face="sans-serif">Re: [Haskell-cafe] Progress indications</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><tt><font size=2>Bit Connor wrote:<br>
&gt; computation is. And since it's all calls to map and filter et al.,
it's<br>
&gt; ...it's not immediately clear how to provide any feedback<br>
&gt; on how much longer there is to wait.<br>
<br>
Andrew Coppin wrote:<br>
&gt; It seems unsafePerformIO is the way to go here.<br>
&gt; ...unsafeInterleaveIO<br>
<br>
I disagree. The unsafe... functions are called that<br>
for a reason, and their use should be highly discouraged,<br>
except in cases where there is absolutely no other<br>
reasonable way. I don't believe that this is one<br>
of those cases.<br>
<br>
A better approach is to use pure monads. Instead of<br>
<br>
f :: ... -&gt; a<br>
<br>
write functions whose type is something like<br>
<br>
f :: ... -&gt; MyMonad a<br>
<br>
where MyMonad is defined in one and only<br>
one place in your program. Or, better yet,<br>
polymorphic things like<br>
<br>
f :: Monad m =&gt; ... -&gt; m a<br>
f :: MyMonadClass m =&gt; ... -&gt; m a<br>
<br>
Then when you later need to add something<br>
like progress indicators, you just add that<br>
to the capabilities of your monad, and add<br>
some updateProgress calls to your functions.<br>
By using &quot;do&quot; notation wisely, you can<br>
keep your abstractions just as clear as they<br>
were, and cleanly separated from the progress logic.<br>
<br>
Other things you may need to add later in<br>
real-world programs are exception handling,<br>
logging, trace, etc. All of these are easy if you<br>
started out in a monad.<br>
<br>
-Yitz<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
Haskell-Cafe@haskell.org<br>
http://www.haskell.org/mailman/listinfo/haskell-cafe<br>
</font></tt>
<br>
<br>
<span style="font-family:sans-serif,helvetica; font-size:10pt; color:#000000">---</span><br>
<br>
<span style="font-family:sans-serif,helvetica; font-size:10pt; color:#000000">This e-mail may contain confidential and/or privileged information. If you </span><br>
<span style="font-family:sans-serif,helvetica; font-size:10pt; color:#000000">are not the intended recipient (or have received this e-mail in error) </span><br>
<span style="font-family:sans-serif,helvetica; font-size:10pt; color:#000000">please notify the sender immediately and destroy this e-mail. Any </span><br>
<span style="font-family:sans-serif,helvetica; font-size:10pt; color:#000000">unauthorized copying, disclosure or distribution of the material in this </span><br>
<span style="font-family:sans-serif,helvetica; font-size:10pt; color:#000000">e-mail is strictly forbidden.</span><br>