Working with graphs is super painful. Building a graph where you can say `parent ( firstChild node ) == node` is really
difficult. There are ways to define it all in one go, or ways to build as you go, but I'm not aware of any ways to do it without serious tradeoffs.
See e.g. https://wiki.haskell.org/Tying_the_Knot