úÎ FT      Safe-Inferred234=K!A 'type-class synonym' for Trees.5Iterate a tree in DFS pre-order. (Depth First Search)@Transform a tree into lists of the items in its different layers3Iterate a tree in BFS order. (Breadth First Search)+Best First Search given a scoring function.0Prune a tree or list given a predicate. Unlike z which stops a branch where the condition doesn't hold, prune "cuts" the whole branch (the underlying MonadPlus's mzero). ÂBest-First-Search given that a node's children are in sorted order (best first) and given a scoring function. Especially useful for trees where nodes have an infinite amount of children, where  will get stuck.+Example: Find smallest Pythagorian Triplets ÿ<import Control.Monad import Control.Monad.Generator import Control.Monad.Trans.Class import Data.List.Tree import Data.Maybe pythagorianTriplets = catMaybes . fmap fst . bestFirstSearchSortedChildrenOn snd . generate $ do x <- lift [1..] yield (Nothing, x) y <- lift [1..] yield (Nothing, x + y) z <- lift [1..] yield (Nothing, x + y + z) lift . guard $ x^2 + y^2 == z^2 yield (Just (x, y, z), 0) > print $ take 10 pythagorianTriplets [(3,4,5),(4,3,5),(6,8,10),(8,6,10),(5,12,13),(12,5,13),(9,12,15),(12,9,15),(15,8,17),(8,15,17)] 5Generalized "Branch and Bound". A method for pruning.ZThe result of this function would usually be given to another search algorithm, such as ., in order to find the node with lowest value.ÿThis augments the regular search by pruning the tree. Given a function to calculate a lower and upper bound for a subtree, we keep the lowest upper bound (hence the State monad) encountered so far, and we prune any subtree whose lower bound is over the known upper bound.       Safe-Inferred When used with scanl or scanl1B, transforms tree of filenames to tree of filenames with the paths         ListTree-0.2.2Data.List.TreeSystem.Directory.ListTree TreeItemMTreeTTreedfs bfsLayersbfsbestFirstSearchOnprunepruneMbestFirstSearchSortedChildrenOnbranchAndBoundsortChildrenOn directoryTree appendPathbaseGHC.List takeWhilesearchmergeOnSortedHeads$fTreet