hledger-lib-1.16.2: Core data types, parsers and functionality for the hledger accounting tools

Safe HaskellNone
LanguageHaskell2010

Hledger.Utils.Tree

Synopsis

Documentation

root :: Tree a -> a Source #

subs :: Tree a -> Forest a Source #

leaves :: Tree a -> [a] Source #

List just the leaf nodes of a tree

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.

treeprune :: Int -> Tree a -> Tree a Source #

remove all nodes past a certain depth

treemap :: (a -> b) -> Tree a -> Tree b Source #

apply f to all tree nodes

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

remove all subtrees whose nodes do not fulfill predicate

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

is predicate true in any node of tree ?

showtree :: Show a => Tree a -> String Source #

show a compact ascii representation of a tree

showforest :: Show a => Forest a -> String Source #

show a compact ascii representation of a forest

newtype FastTree a Source #

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

Constructors

T (Map a (FastTree a)) 
Instances
Eq a => Eq (FastTree a) Source # 
Instance details

Defined in Hledger.Utils.Tree

Methods

(==) :: FastTree a -> FastTree a -> Bool #

(/=) :: FastTree a -> FastTree a -> Bool #

Ord a => Ord (FastTree a) Source # 
Instance details

Defined in Hledger.Utils.Tree

Methods

compare :: FastTree a -> FastTree a -> Ordering #

(<) :: FastTree a -> FastTree a -> Bool #

(<=) :: FastTree a -> FastTree a -> Bool #

(>) :: FastTree a -> FastTree a -> Bool #

(>=) :: FastTree a -> FastTree a -> Bool #

max :: FastTree a -> FastTree a -> FastTree a #

min :: FastTree a -> FastTree a -> FastTree a #

Show a => Show (FastTree a) Source # 
Instance details

Defined in Hledger.Utils.Tree

Methods

showsPrec :: Int -> FastTree a -> ShowS #

show :: FastTree a -> String #

showList :: [FastTree a] -> ShowS #

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