| mkTree :: a -> [t a] -> t a | Source |
|
| tree construction: a new tree is constructed by a node attribute and a list of children
|
|
|
leaf construction: leafs don't have any children
definition: mkLeaf n = mkTree n []
|
|
|
| leaf test: list of children empty?
|
|
|
| innner node test: not . isLeaf
|
|
|
| select node attribute
|
|
| getChildren :: t a -> [t a] | Source |
|
| select children
|
|
| changeNode :: (a -> a) -> t a -> t a | Source |
|
| edit node attribute
|
|
| changeChildren :: ([t a] -> [t a]) -> t a -> t a | Source |
|
| edit children
|
|
| setNode :: a -> t a -> t a | Source |
|
| substitute node: setNode n = changeNode (const n)
|
|
| setChildren :: [t a] -> t a -> t a | Source |
|
| substitute children: setChildren cl = changeChildren (const cl)
|
|
| foldTree :: (a -> [b] -> b) -> t a -> b | Source |
|
| fold for trees
|
|
|
| all nodes of a tree
|
|
|
| depth of a tree
|
|
|
| number of nodes in a tree
|
|
|
format tree for readable trace output
a graphical representation of the tree in text format
|