Hi haskellers,

I played a bit with the enumerator package, and I'm quite stuck with the
question how to duplex data to two (or more) consumers using combinators
from xml-enumerator (for example) package. What I mean is:

main = withFile "out.xml" WriteMode $ \h ->
       parseFile "in.xml" decodeEntities $
       (joinI $ renderText $$ iterHandle h) >> (force "data required"
parseData)

where parseData is a simple xml-enumerator parser. Combining consumers in
such a way I can get text being output to the file "out.xml" (like in the
example given) or parsed with parseData (if I switch the order of the
consumers), but not both. Can anybody tell me how to make a pipe (input ->
process -> output) to have text both parsed and then put back to the file?
While pretty straightforward with the arrow approach, it doesn't seem
obvious to me with the iteratees :(

-- 
Regards, Paul Sujkov
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to