If an XML node has a large number of child nodes, the children function will overflow the stack because it cannot be tail-call optimized as written.
$ elm repl
---- Elm 0.19.1 ----------------------------------------------------------------
Say :help for help and :exit to exit! More at <https://elm-lang.org/0.19.1/repl>
--------------------------------------------------------------------------------
> import XmlParser
> XmlParser.parse ("<parent>" ++ String.repeat 2000 "<child></child>" ++ "</parent>")
RangeError: Maximum call stack size exceeded
If an XML node has a large number of child nodes, the
children
function will overflow the stack because it cannot be tail-call optimized as written.