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

Language | Haskell2010 |

## Synopsis

- root :: Tree a -> a
- subs :: Tree a -> Forest a
- branches :: Tree a -> Forest a
- leaves :: Tree a -> [a]
- subtreeat :: Eq a => a -> Tree a -> Maybe (Tree a)
- subtreeinforest :: Eq a => a -> [Tree a] -> Maybe (Tree a)
- treeprune :: Int -> Tree a -> Tree a
- treemap :: (a -> b) -> Tree a -> Tree b
- treefilter :: (a -> Bool) -> Tree a -> Tree a
- treeany :: (a -> Bool) -> Tree a -> Bool
- showtree :: Show a => Tree a -> String
- showforest :: Show a => Forest a -> String
- newtype FastTree a = T (Map a (FastTree a))
- emptyTree :: FastTree a
- mergeTrees :: Ord a => FastTree a -> FastTree a -> FastTree a
- treeFromPath :: [a] -> FastTree a
- treeFromPaths :: Ord a => [[a]] -> FastTree a

# Documentation

subtreeat :: Eq a => a -> Tree a -> Maybe (Tree a) Source #

get the sub-tree rooted at the first (left-most, depth-first) occurrence of the specified node value

subtreeinforest :: Eq a => a -> [Tree a] -> Maybe (Tree a) Source #

get the sub-tree for the specified node value in the first tree in forest in which it occurs.

treefilter :: (a -> Bool) -> Tree a -> Tree a Source #

remove all subtrees whose nodes do not fulfill predicate

An efficient-to-build tree suggested by Cale Gibbard, probably better than accountNameTreeFrom.

## Instances

Eq a => Eq (FastTree a) Source # | |

Ord a => Ord (FastTree a) Source # | |

Show a => Show (FastTree a) Source # | |

treeFromPath :: [a] -> FastTree a Source #

treeFromPaths :: Ord a => [[a]] -> FastTree a Source #