Module

Data.Tree

Package
purescript-tree
Repository
dmbfm/purescript-tree

#Tree Source

type Tree a = Cofree List a

A Rose, or multi-way tree, with values of type a.

#Forest Source

type Forest a = List (Tree a)

#mkTree Source

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

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

#drawTree Source

drawTree :: Tree String -> String

Draw a 2D String representation of a Tree String.

#showTree Source

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

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

#scanTree Source

scanTree :: forall b a. (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 Source

scanTreeAccum :: forall c b a. (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 Source

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

Set the value of a node.

#modifyNodeValue Source

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

Modify the value of a node.

#appendChild Source

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

Append a child to a node.