<br><br><div class="gmail_quote">On Mon, Aug 23, 2010 at 10:37 PM, Conrad Parker <span dir="ltr">&lt;<a href="mailto:conrad@metadecks.org">conrad@metadecks.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On 24 August 2010 14:14, Jason Dagit &lt;<a href="mailto:dagit@codersbase.com">dagit@codersbase.com</a>&gt; wrote:<br>
&gt; I&#39;m not a semanticist, so I apologize right now if I say something stupid or<br>
&gt; incorrect.<br>
&gt;<br>
&gt; On Mon, Aug 23, 2010 at 9:57 PM, Conal Elliott &lt;<a href="mailto:conal@conal.net">conal@conal.net</a>&gt; wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; So perhaps this could be a reasonable semantics?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Iteratee a = [Char] -&gt; Maybe (a, [Char])<br>
&gt;&gt;<br>
&gt;&gt; I&#39;ve been tinkering with this model as well.<br>
&gt;&gt;<br>
&gt;&gt; However, it doesn&#39;t really correspond to the iteratee interfaces I&#39;ve<br>
&gt;&gt; seen, since those interfaces allow an iteratee to notice size and number of<br>
&gt;&gt; chunks.  I suspect this ability is an accidental abstraction leak, which<br>
&gt;&gt; raises the question of how to patch the leak.<br>
&gt;<br>
&gt; From a purely practical viewpoint I feel that treating the chunking as an<br>
&gt; abstraction leak might be missing the point.  If you said, you wanted the<br>
&gt; semantics to acknowledge the chunking but be invariant under the size or<br>
&gt; number of the chunks then I would be happier.<br>
<br>
</div>I think that&#39;s the point, ie. to specify what the invariants should<br>
be. For example (to paraphrase, very poorly, something Conal wrote on<br>
the whiteboard behind me):<br>
<br>
run [concat [chunk]] == run [chunk]<br>
<br>
ie. the (a, [Char]) you maybe get from running an iteratee over any<br>
partitioning of chunks should be the same, ie. the same as from<br>
running it over the concatenation of all chunks, which is the whole<br>
input [Char].<br></blockquote><div><br></div><div>I find this notation foreign.  I get [Char], that&#39;s the Haskell String type, but what is [chunk]?  I doubt you mean a list of one element.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="im"><br>
&gt; I use iteratees when I need to be explicit about chunking and when I don&#39;t<br>
&gt; want the resources to &quot;leak outside&quot; of the stream processing.  If you took<br>
&gt; those properties away, I wouldn&#39;t want to use it anymore because then it<br>
&gt; would just be an inelegant way to do things.<br>
<br>
</div>Then I suppose the model for Enumerators is different than that for<br>
Iteratees; part of the point of an Enumerator is to control the size<br>
of the chunks, so that needs to be part of the model. An Iteratee, on<br>
the other hand, should not have to know the size of its chunks. So you<br>
don&#39;t want to be able to know the length of a chunk (ie. a part of the<br>
stream), but you do want to be able to, say, fold over it, and to be<br>
able to stop the computation at any time (these being the main point<br>
of iteratees ...).<br></blockquote><div><br></div><div>I think I agree with that.</div><div><br></div><div>Jason</div></div>