The interface for trees
Methods
mkTree :: a -> [t a] -> t atree construction: a new tree is constructed by a node attribute and a list of children
mkLeaf :: a -> t aleaf construction: leafs don't have any children
definition:
mkLeaf n = mkTree n []isLeaf :: t a -> Boolleaf test: list of children empty?
isInner :: t a -> Boolinnner node test:
not . isLeafgetNode :: t a -> aselect node attribute
getChildren :: t a -> [t a]select children
changeNode :: (a -> a) -> t a -> t aedit node attribute
changeChildren :: ([t a] -> [t a]) -> t a -> t aedit children
setNode :: a -> t a -> t asubstitute node:
setNode n = changeNode (const n)setChildren :: [t a] -> t a -> t asubstitute children:
setChildren cl = changeChildren (const cl)foldTree :: (a -> [b] -> b) -> t a -> bfold for trees
nodesTree :: t a -> [a]all nodes of a tree
depthTree :: t a -> Intdepth of a tree
cardTree :: t a -> Intnumber of nodes in a tree
formatTree :: (a -> String) -> t a -> Stringformat tree for readable trace output
a graphical representation of the tree in text format
Instances2Tree
Tree NTreeDefined in hxt-9.3.1.22 · Data.Tree.NTree.TypeDefsImplementation of Data.Tree.Class interface for rose trees
Tree NTZipperDefined in hxt-9.3.1.22 · Data.Tree.NTree.Zipper.TypeDefs