Module

Data.Tree

#Tree

type Tree a = Cofree List a

A Rose, or multi-way tree, with values of type a. To access the root of the Tree's value, use Control.Comonad.Cofree (head). To access the root's children, use Control.Comonad.Cofree (tail)

#Forest

type Forest a = List (Tree a)

A type alias for the children of a Tree's root value.

#mkTree

mkTree :: forall a. a -> Forest a -> Tree a

Create a Tree from a Node value of type a and a Forest of children.

#drawTree

drawTree :: Tree String -> String

Draw a 2D String representation of a Tree String.

#drawTree'

drawTree' :: Int -> Tree String -> String

Draw a 2D String representation of a Tree String, starting the indent at the given level

#drawForest

drawForest :: Forest String -> String

Draw a 2D String representation of a Forest String,

#drawForest'

drawForest' :: Int -> Forest String -> String

Draw a 2D String representation of a Forest String, starting the indent at the given level

#showTree

showTree :: forall a. Show a => Tree a -> String

Draw a 2D String representation of a Tree composed of Showable elements.

#showForest

showForest :: forall a. Show a => Forest a -> String

Draw a 2D String representation of a Forest composed of Showable elements.

#scanTree

scanTree :: forall a b. (a -> b -> b) -> b -> Tree a -> Tree b

Scan a Tree, accumulating values of b there are constant across Nodes that have the same parent.

#scanTreeAccum

scanTreeAccum :: forall a b c. (a -> b -> Accum b c) -> b -> Tree a -> Tree c

Scan a Tree, accumulating values of b there are constant across Nodes that have the same parent, and returning a Tree of type c.

#setNodeValue

setNodeValue :: forall a. a -> Tree a -> Tree a

Set the value of a node.

#modifyNodeValue

modifyNodeValue :: forall a. (a -> a) -> Tree a -> Tree a

Modify the value of a node.

#appendChild

appendChild :: forall a. Tree a -> Tree a -> Tree a

Append a child to a node.

Modules