Which Haskell XML library to use? Which Haskell XML library to use? xml xml

Which Haskell XML library to use?


I would recommend:

  1. xml, if your task is simple
  2. haxml, if your task is complex
  3. hxt, if you like arrows
  4. hexpat if you need high performance


HXT's main problem, aside from the unusual arrow syntax, is performance and memory usage. I have an app that spends 1.2 seconds processing about 1.5MB of XML, consuming about 2.3GB (!) of memory in the process. Libxml2 takes a few milliseconds on the same data. Extracting data via the css function and arrow predicates also seems very slow compared to Libxml2.


I would personally recommend HXT because it uses arrows, which are a very useful and powerful tool to learn, and an XML parsing library is the perfect use for arrows (they were first invented to solve various parsing problems that monads couldn't). Arrows are also starting to be used outside of pure functional programming, such as Arrowlets in JavaScript.