<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Trying to work out iteratees</title>
	<atom:link href="http://therning.org/magnus/archives/735/feed" rel="self" type="application/rss+xml" />
	<link>http://therning.org/magnus/archives/735</link>
	<description>Incoherent mumblings</description>
	<lastBuildDate>Wed, 08 Aug 2012 00:21:01 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: John Lato</title>
		<link>http://therning.org/magnus/archives/735/comment-page-1#comment-188650</link>
		<dc:creator>John Lato</dc:creator>
		<pubDate>Sun, 13 Sep 2009 18:07:38 +0000</pubDate>
		<guid isPermaLink="false">http://therning.org/magnus/?p=735#comment-188650</guid>
		<description><![CDATA[&lt;p&gt;Sorry for the late reply; been busy with family stuff recently.&lt;/p&gt;

&lt;p&gt;I agree that the issues you mention with iteratee do all need to be dealt with.  Reading strings (as you tried to do) is probably the most important.  I don&#039;t have a great solution yet, but I&#039;m working on it.  Thanks for the other issues as well.  Solutions are planned for all of them, just a case of limited developer time.&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>Sorry for the late reply; been busy with family stuff recently.</p>

<p>I agree that the issues you mention with iteratee do all need to be dealt with.  Reading strings (as you tried to do) is probably the most important.  I don&#8217;t have a great solution yet, but I&#8217;m working on it.  Thanks for the other issues as well.  Solutions are planned for all of them, just a case of limited developer time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Magnus</title>
		<link>http://therning.org/magnus/archives/735/comment-page-1#comment-188229</link>
		<dc:creator>Magnus</dc:creator>
		<pubDate>Mon, 07 Sep 2009 14:53:14 +0000</pubDate>
		<guid isPermaLink="false">http://therning.org/magnus/?p=735#comment-188229</guid>
		<description><![CDATA[&lt;p&gt;&lt;strong&gt;@John&lt;/strong&gt;, I guess I can comfortably say that I&#039;ve got it then :-)&lt;/p&gt;

&lt;p&gt;Yes, I had a look at the &lt;code&gt;Examples&lt;/code&gt; directory and found both the files you mention.  I&#039;ve so far only taken a look at &lt;code&gt;headers.hs&lt;/code&gt;.  &lt;em&gt;Now&lt;/em&gt; I find it rather a lot easier to see what is going on and I realise that what I had problems with was actually more related to &lt;code&gt;Char&lt;/code&gt; and streams.  What I tried to do was to call &lt;code&gt;readLines&lt;/code&gt; in a &lt;code&gt;fileDriver&lt;/code&gt; and expected to get a list of all lines.  That failed miserably, and all I got was &lt;code&gt;Left []&lt;/code&gt;.  After writing this post, and reading &lt;code&gt;headers.hs&lt;/code&gt; again I realised I needed to map &lt;code&gt;chr . fromIntegral&lt;/code&gt; over the stream first.  That got me to at least get some output, though I was still surprised (see below).&lt;/p&gt;

&lt;p&gt;The main issue I&#039;d try to address is simple examples along the lines of reading and printing (to the screen) a file, line by line and char by char.&lt;/p&gt;

&lt;p&gt;I haven&#039;t studied the API extensively (yet) but I&#039;ve already found a few things that surprised me, I&#039;d address those as the second issue.  What I&#039;m thinking of is &lt;code&gt;readLines&lt;/code&gt;, which for some reason terminates on an empty line and breaks on EOF.  The same goes for &lt;code&gt;enumLines&lt;/code&gt;.  They both seem to be geared to usage for parsing HTTP, but their general-sounding names don&#039;t give that away.&lt;/p&gt;

&lt;p&gt;The third issue as I see it is that there are &lt;em&gt;users&lt;/em&gt; of the library mixed in with the library itself.  Here I&#039;m thinking of &lt;code&gt;Data.Iteratee.Codecs.*&lt;/code&gt;.  They are nice to have, but I&#039;d argue they deserve their own little package.&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p><strong>@John</strong>, I guess I can comfortably say that I&#8217;ve got it then <img src='http://therning.org/magnus/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>

<p>Yes, I had a look at the <code>Examples</code> directory and found both the files you mention.  I&#8217;ve so far only taken a look at <code>headers.hs</code>.  <em>Now</em> I find it rather a lot easier to see what is going on and I realise that what I had problems with was actually more related to <code>Char</code> and streams.  What I tried to do was to call <code>readLines</code> in a <code>fileDriver</code> and expected to get a list of all lines.  That failed miserably, and all I got was <code>Left []</code>.  After writing this post, and reading <code>headers.hs</code> again I realised I needed to map <code>chr . fromIntegral</code> over the stream first.  That got me to at least get some output, though I was still surprised (see below).</p>

<p>The main issue I&#8217;d try to address is simple examples along the lines of reading and printing (to the screen) a file, line by line and char by char.</p>

<p>I haven&#8217;t studied the API extensively (yet) but I&#8217;ve already found a few things that surprised me, I&#8217;d address those as the second issue.  What I&#8217;m thinking of is <code>readLines</code>, which for some reason terminates on an empty line and breaks on EOF.  The same goes for <code>enumLines</code>.  They both seem to be geared to usage for parsing HTTP, but their general-sounding names don&#8217;t give that away.</p>

<p>The third issue as I see it is that there are <em>users</em> of the library mixed in with the library itself.  Here I&#8217;m thinking of <code>Data.Iteratee.Codecs.*</code>.  They are nice to have, but I&#8217;d argue they deserve their own little package.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Lato</title>
		<link>http://therning.org/magnus/archives/735/comment-page-1#comment-188128</link>
		<dc:creator>John Lato</dc:creator>
		<pubDate>Sat, 05 Sep 2009 23:13:57 +0000</pubDate>
		<guid isPermaLink="false">http://therning.org/magnus/?p=735#comment-188128</guid>
		<description><![CDATA[&lt;p&gt;Hi Magnus, in my opinion it looks like you&#039;ve got it.  At least as well as I do anyway.&lt;/p&gt;

&lt;p&gt;Did you look at the &quot;Examples&quot; directory of the iteratee package?  You&#039;ll need to download the tarball and unpack it, but those examples are relatively simple.  wave_reader.hs is the shortest, but headers.hs is probably more familiar to most programmers.  If you did look at these and they weren&#039;t helpful, I would appreciate knowing about it so I can improve them for the next release.  Or if you could tell me where you got stuck at the beginning, maybe I can address that.&lt;/p&gt;

&lt;p&gt;As you&#039;ve likely figured out, there&#039;s actually a lot that can be done without including monads in the iteratee type.  If you have an enumerator defined as&lt;/p&gt;

&lt;p&gt;type EnumeratorM m c e a = Iteratee c e a -&gt; m (Iteratee c e a)&lt;/p&gt;

&lt;p&gt;you can do input.  The IterateeG type in the iteratee package is actually a monad transformer, which allows for some very interesting applications.  I&#039;ve considered changing the iteratee package to provide pure iteratees as well as the monadic variety, but I don&#039;t know that they would find much use.  You need the monad to stream output, for example.&lt;/p&gt;

&lt;p&gt;wren, I think the biggest thing about iteratees is that not many people understand them.  I/O in Haskell isn&#039;t quite right yet, and I think most programmers are aware of this either intuitively or explicitly.  So they think enumerator I/O could be the Holy Grail that will solve all their problems.  The Oleg label adds to the mystique.  There are advantages to enumerator I/O, but there are also drawbacks that anyone who tries to use them will surely discover sooner or later.  Anyway, iteratees do offer some good features.  They&#039;re composable, have predictable memory usage, and allow short-cut evaluation of streams.  They also fully encapsulate the handle so it cannot leak and is GC&#039;d when the iteratee finishes processing, either naturally or on exceptions.  Finally they can be very efficient; my iter-audio package (not on hackage yet, but public darcs repo) is the fastest Haskell wave library I know of.  It&#039;s faster than the hsndfile binding to libsndfile, which is the only real competitor performance-wise.&lt;/p&gt;

&lt;p&gt;Also, I don&#039;t know what you mean about an &quot;official release&quot; either.  Don released &quot;liboleg&quot;, which is basically a cabal-ization of Oleg&#039;s releases, and the &quot;iteratee&quot; package is released too.  If you know of any bugs/problems with &quot;iteratee&quot;, please report them to the maintainer, because right now the trac instance is empty :)&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>Hi Magnus, in my opinion it looks like you&#8217;ve got it.  At least as well as I do anyway.</p>

<p>Did you look at the &#8220;Examples&#8221; directory of the iteratee package?  You&#8217;ll need to download the tarball and unpack it, but those examples are relatively simple.  wave_reader.hs is the shortest, but headers.hs is probably more familiar to most programmers.  If you did look at these and they weren&#8217;t helpful, I would appreciate knowing about it so I can improve them for the next release.  Or if you could tell me where you got stuck at the beginning, maybe I can address that.</p>

<p>As you&#8217;ve likely figured out, there&#8217;s actually a lot that can be done without including monads in the iteratee type.  If you have an enumerator defined as</p>

<p>type EnumeratorM m c e a = Iteratee c e a -&gt; m (Iteratee c e a)</p>

<p>you can do input.  The IterateeG type in the iteratee package is actually a monad transformer, which allows for some very interesting applications.  I&#8217;ve considered changing the iteratee package to provide pure iteratees as well as the monadic variety, but I don&#8217;t know that they would find much use.  You need the monad to stream output, for example.</p>

<p>wren, I think the biggest thing about iteratees is that not many people understand them.  I/O in Haskell isn&#8217;t quite right yet, and I think most programmers are aware of this either intuitively or explicitly.  So they think enumerator I/O could be the Holy Grail that will solve all their problems.  The Oleg label adds to the mystique.  There are advantages to enumerator I/O, but there are also drawbacks that anyone who tries to use them will surely discover sooner or later.  Anyway, iteratees do offer some good features.  They&#8217;re composable, have predictable memory usage, and allow short-cut evaluation of streams.  They also fully encapsulate the handle so it cannot leak and is GC&#8217;d when the iteratee finishes processing, either naturally or on exceptions.  Finally they can be very efficient; my iter-audio package (not on hackage yet, but public darcs repo) is the fastest Haskell wave library I know of.  It&#8217;s faster than the hsndfile binding to libsndfile, which is the only real competitor performance-wise.</p>

<p>Also, I don&#8217;t know what you mean about an &#8220;official release&#8221; either.  Don released &#8220;liboleg&#8221;, which is basically a cabal-ization of Oleg&#8217;s releases, and the &#8220;iteratee&#8221; package is released too.  If you know of any bugs/problems with &#8220;iteratee&#8221;, please report them to the maintainer, because right now the trac instance is empty <img src='http://therning.org/magnus/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Magnus</title>
		<link>http://therning.org/magnus/archives/735/comment-page-1#comment-187451</link>
		<dc:creator>Magnus</dc:creator>
		<pubDate>Fri, 28 Aug 2009 10:08:25 +0000</pubDate>
		<guid isPermaLink="false">http://therning.org/magnus/?p=735#comment-187451</guid>
		<description><![CDATA[&lt;p&gt;&lt;strong&gt;@wren&lt;/strong&gt;, Yes, that seems to be it indeed.  I don&#039;t quite understand what you mean with &quot;keeping it from official release&quot;.  There&#039;s the work to bring stream fusion into GHC &lt;a href=&quot;http://hackage.haskell.org/trac/ghc/ticket/915&quot; rel=&quot;nofollow&quot;&gt;ticket #915&lt;/a&gt;, but what I wrote is more related to Oleg&#039;s iteratee-based IO.  I thought the two things were completely separate, and that the latter wasn&#039;t related to GHC development at all (hence the official release would be whatever can be found on Hackage).  Of course I could be wrong, am I?&lt;/p&gt;

&lt;p&gt;I do have a limited implementation of iteratee-based IO (only &#039;I&#039; really), which is derived from what I have in this post.  I&#039;m not sure it&#039;s worth posting though.&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p><strong>@wren</strong>, Yes, that seems to be it indeed.  I don&#8217;t quite understand what you mean with &#8220;keeping it from official release&#8221;.  There&#8217;s the work to bring stream fusion into GHC <a href="http://hackage.haskell.org/trac/ghc/ticket/915" rel="nofollow">ticket #915</a>, but what I wrote is more related to Oleg&#8217;s iteratee-based IO.  I thought the two things were completely separate, and that the latter wasn&#8217;t related to GHC development at all (hence the official release would be whatever can be found on Hackage).  Of course I could be wrong, am I?</p>

<p>I do have a limited implementation of iteratee-based IO (only &#8216;I&#8217; really), which is derived from what I have in this post.  I&#8217;m not sure it&#8217;s worth posting though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wren ng thornton</title>
		<link>http://therning.org/magnus/archives/735/comment-page-1#comment-187417</link>
		<dc:creator>wren ng thornton</dc:creator>
		<pubDate>Thu, 27 Aug 2009 19:05:40 +0000</pubDate>
		<guid isPermaLink="false">http://therning.org/magnus/?p=735#comment-187417</guid>
		<description><![CDATA[&lt;p&gt;If this is all there is to it, why is there so much hype? It&#039;s just the standard stream fusion hylomorphism stuff with a left fold. Which is nice stuff, don&#039;t get me wrong, but it&#039;s fairly well known already. From all I&#039;ve heard about iteratees (not having read Oleg yet) it seems like there should be more to it, e.g. why all the bugs/issues keeping it from official release?&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>If this is all there is to it, why is there so much hype? It&#8217;s just the standard stream fusion hylomorphism stuff with a left fold. Which is nice stuff, don&#8217;t get me wrong, but it&#8217;s fairly well known already. From all I&#8217;ve heard about iteratees (not having read Oleg yet) it seems like there should be more to it, e.g. why all the bugs/issues keeping it from official release?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
