Module

Data.Tree

Package
purescript-tree
Repository
dmbfm/purescript-tree

#Tree Source

newtype Tree a

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

Constructors

Instances

#Forest Source

type Forest a = List (Tree a)

A Forest is a list of Trees.

#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.

#(|>) Source

Operator alias for Data.Tree.mkTree (non-associative / precedence 5)

#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.

#nodeValue Source

nodeValue :: forall a. Tree a -> a

#nodeChildren Source

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

#setNodeValue Source

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

#modifyNodeValue Source

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

#appendChild Source

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

#setChildren Source

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