[Haskell-cafe] Re: Re: hxt memory useage

Neil Mitchell ndmitchell at gmail.com
Mon Jan 28 18:31:02 EST 2008


> Not so sure about this. For streaming processing, it would be nicer to have
> something like StAX with a stack of already entered elements kept about as
> book-keeping |(the tags + attribute sets to root). Let's face it, if you sign
> up to a document model, you are signing up to a document and shouldn't be
> supprised when it sits in memory.

The code is so simple I'm not sure it even needs to go in the tagsoup
library :-)

process stack (t@(TagOpen name attribs):rest) = process (stack:t) rest
process (TagOpen name1 _:stack) (TagClose name2:rest) | name1 == name2
= process stack rest
process stack rest = ... your code here ...

You are probably right that every application needs to tailor this
pattern to its own needs, but its sufficiently simple that I can't see
that being a problem.



More information about the Haskell-Cafe mailing list