wumpus-tree-0.13.0: Drawing trees

PortabilityGHC
Stabilityunstable
Maintainerstephen.tetley@gmail.com

Wumpus.Tree.TreeBuildMonad

Description

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

Synopsis

Documentation

data NodeId a Source

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.

Instances

Eq a => Eq (NodeId a) 

runTreeBuild :: (Real u, Floating u, FromPtSize 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).

regularBuild :: Tree a -> TreeBuild u (TreeSpec a)Source

Turn an ordinary Data.Tree into a regular TreeSpec.

All nodes become regular nodes, no nodes are bound. Thus nodes cannot be annotated etc.

label :: a -> NodeId aSource

Note - this is not in the TreeBuild monad.

annotate :: u ~ DUnit a => NodeId a -> NodeAnno u -> TreeBuild u ()Source

Annotate a node with a NodeAnno.

Note - regular nodes cannot be annotated, a node must be bound to a variable first with nodeId.

zbranch :: [ZTreeSpec u] -> ZTreeSpec uSource

Default branch - has children.

zleaf :: ZTreeSpec uSource

Default leaf - tree node with no children.