Copyright | Copyright (C) 2021 Yoo Chung |
---|---|
License | GPL-3.0-or-later |
Maintainer | dev@chungyc.org |
Safe Haskell | Safe-Inferred |
Language | GHC2021 |
For a Tree
which has been laid out with position (x,y) for every node,
such as with layoutInorder
, turns it into SVG
so that the layout can be viewed graphically. Only trees with Char
values are supported.
This is used to generate the graphical representation of binary trees for inclusion in the Haddock documentation generated for the layout problems. Doing it manually once was a painstaking and error-prone process; the thought of doing it two more times was too much. It could also be used to graphically explore alternative layout methods that are not included in one of the problems.
Documentation
toSVG :: Tree (Char, (Int, Int)) -> XML Source #
Renders a binary tree with Char
values with annotated layout to SVG.
prettyXML :: XML -> Doc ann Source #
Pretty print XML, so we have prettier output instead of one very long line.
Supports a limited subset of XML sufficient to output SVG generated by toSVG
.