Portability | GHC |
---|---|

Stability | unstable |

Maintainer | stephen.tetley@gmail.com |

Build a tree within a monad - the monad allows anchor references.

- data NodeId a
- type ZNodeId u = NodeId (UNil u)
- type NodeAnno u = DotAnchor u -> Graphic u
- type NodeAnnoRefs u = IntMap (NodeAnno u)
- data TreeBuild u a
- type TreeSpec a = Tree (NodeId a)
- type ZTreeSpec u = TreeSpec (UNil u)
- type TreeNodeAns u = (TreeNode u, Maybe Int)
- type TreeBuildAns u = (Tree (TreeNodeAns u), NodeAnnoRefs u)
- runTreeBuild :: (Real u, Floating u, InterpretUnit u) => (a -> TreeNode u) -> TreeBuild u (TreeSpec a) -> TreeBuildAns u
- regularBuild :: Tree a -> TreeBuild u (TreeSpec a)
- nodeId :: TreeNode u -> TreeBuild u (NodeId a)
- label :: a -> NodeId a
- branch :: NodeId a -> [TreeSpec a] -> TreeSpec a
- zbranch :: [ZTreeSpec u] -> ZTreeSpec u
- leaf :: NodeId a -> TreeSpec a
- zleaf :: ZTreeSpec u

# Documentation

Nodes can be bound with `(>>=)`

or in the do-notation before
they are drawn. This is similar to the concept of *embedded*
nodes in TikZ. Bound nodes can be referenced by their anchors
e.g. to give them an extra annotation.

This opaque type represents bound nodes and regular nodes that are just drawn and cannot be annotated.

type NodeAnnoRefs u = IntMap (NodeAnno u)Source

type TreeNodeAns u = (TreeNode u, Maybe Int)Source

type TreeBuildAns u = (Tree (TreeNodeAns u), NodeAnnoRefs u)Source

runTreeBuild :: (Real u, Floating u, InterpretUnit u) => (a -> TreeNode u) -> TreeBuild u (TreeSpec a) -> TreeBuildAns uSource

This is the `run`

function for the TreeBuild monad.

Note the monadic *command* is type specialized to
`(TreeSpec a)`

, this is because evaluation in the TreeBuild
monad is only significant for producing a `Tree (TreeNode u)`

.