[Haskell-beginners] Laziness and XML parsing

Sean Hess seanhess at gmail.com
Tue Nov 8 03:45:40 CET 2011


I want to parse a large xml file (2GB), without putting the whole thing into memory. It's pretty simple with a sax parser in most languages, you just stream bytes to the sax parser, and wait for sax events. 

Here's what I think the equivalent is in Haskell - https://gist.github.com/1346854

Is the xml file being read lazily? It seems lazy, but it also seems like all the sax events would be loaded into memory. If not, how is that possible? In order to be lazy, it seems like parse would have to be an impure function, so that it could back to the disk to get more stuff. 

~sean


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20111107/84860e0d/attachment.htm>


More information about the Beginners mailing list