<div dir="ltr"><div>Ah yes, the actual docs. Somehow didn&#39;t think to check that, sorry.</div><div><br></div>Alright, I&#39;ll try to figure that one out, thanks. Any particular reason nobody just offers http over lazy I/O? Is it just because lazy I/O is generally discouraged? Or just particularly bad over a network?<div>
<br></div><div>And is this an area where Conduit is better than Pipes? There doesn&#39;t seem to be a similar http for Pipes.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Aug 10, 2013 at 11:30 PM, Magnus Therning <span dir="ltr">&lt;<a href="mailto:magnus@therning.org" target="_blank">magnus@therning.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="HOEnZb"><div class="h5">On Sat, Aug 10, 2013 at 05:16:58PM -0700, Dan Krol wrote:<br>
&gt; Hi,<br>
&gt;<br>
&gt; I&#39;m working on an rss file getter. I was wondering if I could get<br>
&gt; some help getting files to download and save without holding the<br>
&gt; entire file in memory in between. I chose Conduit&#39;s version of<br>
&gt; SimpleHttp only because it was recommended, and it was the quickest<br>
&gt; thing I could get to work correctly because I was eager to get<br>
&gt; started on this project, so I&#39;d be happy to switch.<br>
&gt;<br>
&gt; Here&#39;s where I define the download and save functions:<br>
&gt;<br>
&gt; <a href="https://github.com/orblivion/feedGetter/blob/master/rss.hs#L107" target="_blank">https://github.com/orblivion/feedGetter/blob/master/rss.hs#L107</a><br>
&gt;<br>
&gt; And here&#39;s where I use them, getting multiple at a time with async:<br>
&gt;<br>
&gt; <a href="https://github.com/orblivion/feedGetter/blob/master/rss.hs#L208" target="_blank">https://github.com/orblivion/feedGetter/blob/master/rss.hs#L208</a><br>
&gt;<br>
&gt; What happens when I run this is that it outputs that it&#39;s &quot;Getting&quot;<br>
&gt; the file, waits a while (presumably to download the whole thing),<br>
&gt; then says it&#39;s &quot;Saving&quot;. And I checked the file system, it&#39;s not<br>
&gt; there during the pause. I&#39;m not entirely sure why. Is it my choice<br>
&gt; of libraries, or the way I&#39;m using them? Perhaps something to do<br>
&gt; with async? I just tried content &lt;- simpleHttp &quot;<a href="http://google.com" target="_blank">http://google.com</a>&quot;<br>
&gt; in ghci, and it does pause for a second, so I&#39;m guessing this is<br>
&gt; strict from the getgo. But I&#39;ve done almost no I/O before.<br>
&gt;<br>
&gt; Is there a straightforward, canonical option? It seems like there<br>
&gt; perhaps should be. But if it comes down to using pipes or conduit,<br>
&gt; what the heck I&#39;ll try it out, I&#39;d like to learn pipes eventually.<br>
<br>
</div></div>Michael is very good with documenting his packages, this is what I<br>
found in the docs for http-conduit (<a href="http://is.gd/WkDb7G" target="_blank">http://is.gd/WkDb7G</a>):<br>
<br>
  Note: Even though this function returns a lazy bytestring, it does<br>
  not utilize lazy I/O, and therefore the entire response body will<br>
  live in memory. If you want constant memory usage, you&#39;ll need to<br>
  use the conduit package and http directly.<br>
<span class="HOEnZb"><font color="#888888"><br>
/M<br>
<br>
--<br>
Magnus Therning                      OpenPGP: 0xAB4DFBA4<br>
email: <a href="mailto:magnus@therning.org">magnus@therning.org</a>   jabber: <a href="mailto:magnus@therning.org">magnus@therning.org</a><br>
twitter: magthe               <a href="http://therning.org/magnus" target="_blank">http://therning.org/magnus</a><br>
<br>
I invented the term Object-Oriented, and I can tell you I did not have<br>
C++ in mind.<br>
     -- Alan Kay<br>
</font></span><br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div>