I'm writing a library for working with graphs. The primary task - parsing xml-tree. The tree looks like
<graph nodes=4 arcs=5>
<node id=1 />
<node id=2 />
<node id=3 />
<node id=4 />
<arc from=1 to=2 />
<arc from=1 to=3 />
<arc from=1 to=4 />
<arc from=2 to=4 />
<arc from=3 to=4 />
</graph>
Structure for storing:
type Id = Int
data Node = Node Id deriving (Show)
data Arc = Arc Id Id deriving (Show)
data Graph = Graph { nodes :: [Node],
arcs :: [Arc]}
How to write data from the xml file into this structure? I can not write a parser for xml tree of this kind (HXT library)