<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Message: 7<br>
Date: Tue, 29 Mar 2011 22:39:12 -0400<br>
From: wren ng thornton &lt;<a href="mailto:wren@freegeek.org">wren@freegeek.org</a>&gt;<br>
Subject: Re: [Haskell-cafe] ANNOUNCE: enumerator 0.4.8<br>
To: <a href="mailto:haskell-cafe@haskell.org">haskell-cafe@haskell.org</a><br>
Message-ID: &lt;<a href="mailto:4D9297D0.7060405@freegeek.org">4D9297D0.7060405@freegeek.org</a>&gt;<br>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed<br>
<br>
On 3/29/11 4:40 AM, <a href="mailto:oleg@okmij.org">oleg@okmij.org</a> wrote:<br>
&gt; Wren Thornton wrote:<br>
&gt;&gt; This is often conflated with the iteratee throwing an error/exception,<br>
&gt;&gt; which is wrong because we should distinguish between bad program<br>
&gt;&gt; states and argument passing.<br>
&gt;<br>
&gt; I guess this is a matter of different points of view on exceptions.<br>
<br>
The problem is not so much the exceptions per se (one goto is about as<br>
good as any other), it has more to do with the fact that important<br>
things are being left out of the types.<br>
<br>
One of the great things about Haskell is that you can lean so heavily on<br>
the type system to protect yourself when refactoring, designing by<br>
contract, etc. However, if there&#39;s an unspoken code of communication<br>
between specific enumerators and iteratees, it&#39;s very easy to break<br>
things. This is why the communication should be captured in the types,<br>
regardless of the control-flow mechanism used to implement that<br>
communication. I&#39;d like the static guarantee that whatever special<br>
requests my iteratee could make, its enumerator is in a position to<br>
fulfill those requests (or die trying). Allowing for the iteratee to be<br>
paired with an enumerator which is incapable of handling its requests is<br>
a type error and should be treated as such.<br></blockquote><div><br></div><div>This has long been a goal of mine for iteratee (since before the 0.4 release), although I haven&#39;t really done any work on it.  Maybe it&#39;s time to see if I can get a more satisfactory implementation.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
&gt; Wren Thornton wrote:<br>
&gt;&gt; In an ideal framework the producers, transformers, and consumers of<br>
&gt;&gt; stream data would have a type parameter indicating the up-stream<br>
&gt;&gt; communication they support or require (in addition to the type<br>
&gt;&gt; parameters for stream type, result type, and side-effect type).<br>
&gt;<br>
&gt; Very true. Currently the design of Iteratees quite resembles that of<br>
&gt; Control.Exception: everything can throw SomeException. Ideally one<br>
&gt; would like to be more precise, and specify what exceptions or sorts of<br>
&gt; exceptions could be thrown -- by Iteratees, and by ordinary Haskell<br>
&gt; functions. The design of a good effect system is still the topic of<br>
&gt; active research, although there are some encouraging results.<br>
<br>
Yeah, I&#39;m not a big fan of extensible exceptions either. Don&#39;t get me<br>
wrong, it&#39;s an awesome hack and it&#39;s far cleaner than the Java approach;<br>
but it still goes against my sensibilities.<br></blockquote><div><br></div><div>I&#39;ve come around to the view that exceptions are a bad idea (in Haskell), and just making everything explicit (via Maybe, ErrorT, explicit-exceptions, or otherwise) is the best approach at present.</div>
<div><br></div><div>John L.</div></div><br>