<div dir="ltr"><div>Ah yes, the actual docs. Somehow didn't think to check that, sorry.</div><div><br></div>Alright, I'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'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"><<a href="mailto:magnus@therning.org" target="_blank">magnus@therning.org</a>></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>
> Hi,<br>
><br>
> I'm working on an rss file getter. I was wondering if I could get<br>
> some help getting files to download and save without holding the<br>
> entire file in memory in between. I chose Conduit's version of<br>
> SimpleHttp only because it was recommended, and it was the quickest<br>
> thing I could get to work correctly because I was eager to get<br>
> started on this project, so I'd be happy to switch.<br>
><br>
> Here's where I define the download and save functions:<br>
><br>
> <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>
><br>
> And here's where I use them, getting multiple at a time with async:<br>
><br>
> <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>
><br>
> What happens when I run this is that it outputs that it's "Getting"<br>
> the file, waits a while (presumably to download the whole thing),<br>
> then says it's "Saving". And I checked the file system, it's not<br>
> there during the pause. I'm not entirely sure why. Is it my choice<br>
> of libraries, or the way I'm using them? Perhaps something to do<br>
> with async? I just tried content <- simpleHttp "<a href="http://google.com" target="_blank">http://google.com</a>"<br>
> in ghci, and it does pause for a second, so I'm guessing this is<br>
> strict from the getgo. But I've done almost no I/O before.<br>
><br>
> Is there a straightforward, canonical option? It seems like there<br>
> perhaps should be. But if it comes down to using pipes or conduit,<br>
> what the heck I'll try it out, I'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'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>