-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Wagner Ferenc wrote:
nr@eecs.harvard.edu (Norman Ramsey) writes:
load :: String -> IO X.Document load fn = do handle <- IO.openFile fn IO.ReadMode contents <- IO.hGetContents handle IO.hClose handle return $ XP.xmlParse fn contents
Try not closing the handle before parsing.
I think it's a little more to it than that. The parsing is performed lazily and therefore it's hard to try to close the handle manually, even if HaXml would parse all of the file at once (unless you force the evaluation). The simplest thing is to use readFile (from the Prelude) instead of using handles. readFile will take care of everything for you when the time is right. load fn = do contents <- readFile fn return $ XP.xmlParse fn contents That's it! Cheers, Lennart Kolmodin -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFljzs4txYG4KUCuERAuqkAJ9sBHWqo8cViDoqiYIGaBmBQ2/mngCgiZxG HJT4vGCs/LT/aA6hsjMfYgc= =EoQ5 -----END PGP SIGNATURE-----