Safe Haskell | Safe |
---|---|

Language | Haskell2010 |

`AUTHOR`

- Dr. Alistair Ward
`DESCRIPTION`

- Defines operations on an arbitrary rose-tree.

## Synopsis

- type IsMatch a = a -> Bool
- countTerminalNodes :: Num nodes => Tree a -> nodes
- drawTree :: (a -> String) -> Tree a -> String
- drawForest :: (a -> String) -> Forest a -> String
- traceRoute :: (datum -> IsMatch a) -> Tree a -> [datum] -> Maybe [a]
- promote :: (datum -> IsMatch a) -> [datum] -> [Tree a] -> Maybe [Tree a]
- reduce :: IsMatch a -> Tree a -> Maybe (Tree a)
- mapForest :: (a -> Forest a -> Forest a) -> Transformation a

# Types

## Type-synonyms

# Function

countTerminalNodes :: Num nodes => Tree a -> nodes Source #

Counts the number of terminal nodes.

drawTree :: (a -> String) -> Tree a -> String Source #

Returns a string which graphically represents the tree.

drawForest :: (a -> String) -> Forest a -> String Source #

Returns a string which graphically represents the forest.

:: (datum -> IsMatch a) | Whether a datum matches. |

-> Tree a | |

-> [datum] | The data against which, nodes from the tree should be matched. |

-> Maybe [a] | Returns |

Trace a path down the specified tree, of matching nodes.

## Mutators

:: (datum -> IsMatch a) | Whether a node matches. |

-> [datum] | The data against which nodes from the forest should be matched. |

-> [Tree a] | |

-> Maybe [Tree a] | Returns |

- Recursively advances the position within the forest, of the first node which matches the next datum, at successively deeper levels.
- CAVEAT: each datum is expected to match exactly one item from the forest at each level.