hxt-9.0.1: A collection of tools for processing XML with Haskell.

MaintainerUwe Schmidt (uwe\@fh-wedel.de)



Interface definition for trees



class Tree t whereSource

The interface for trees


mkTree :: a -> [t a] -> t aSource

tree construction: a new tree is constructed by a node attribute and a list of children

mkLeaf :: a -> t aSource

leaf construction: leafs don't have any children

definition: mkLeaf n = mkTree n []

isLeaf :: t a -> BoolSource

leaf test: list of children empty?

isInner :: t a -> BoolSource

innner node test: not . isLeaf

getNode :: t a -> aSource

select node attribute

getChildren :: t a -> [t a]Source

select children

changeNode :: (a -> a) -> t a -> t aSource

edit node attribute

changeChildren :: ([t a] -> [t a]) -> t a -> t aSource

edit children

setNode :: a -> t a -> t aSource

substitute node: setNode n = changeNode (const n)

setChildren :: [t a] -> t a -> t aSource

substitute children: setChildren cl = changeChildren (const cl)

foldTree :: (a -> [b] -> b) -> t a -> bSource

fold for trees

nodesTree :: t a -> [a]Source

all nodes of a tree

depthTree :: t a -> IntSource

depth of a tree

cardTree :: t a -> IntSource

number of nodes in a tree

formatTree :: (a -> String) -> t a -> StringSource

format tree for readable trace output

a graphical representation of the tree in text format


Tree NTree

Implementation of Data.Tree.Class interface for rose trees