stylist-traits-0.1.3.1: Traits, datatypes, & parsers for Haskell Stylist
Safe HaskellSafe
LanguageHaskell2010

Stylist.Tree

Description

Abstracts away tree traversals. Mostly used by callers including (soon) XML Conduit Stylist, but also used internally for generating counter text.

Synopsis

Documentation

data StyleTree p Source #

A generic tree, variable numbers of children.

Constructors

StyleTree 

Fields

treeOrder :: (c -> c -> Path -> p -> (c, p')) -> c -> StyleTree p -> StyleTree p' Source #

Preorder traversal of the tree.

treeOrder' :: (c -> c -> Path -> p -> (c, p')) -> c -> c -> Path -> [StyleTree p] -> (c, [StyleTree p']) Source #

Preorder traversal of the tree managing per-layer contexts.

type Path = [Integer] Source #

Indices within the tree.

treeMap :: (p -> p') -> StyleTree p -> StyleTree p' Source #

Runs a callback over all style properties in the tree.

treeFind :: StyleTree p -> (p -> Bool) -> [p] Source #

Find the styltree node matching the given predicate.

treeFlatten :: StyleTree p -> [p] Source #

Flatten a styletree into a list.

treeFlattenAll :: StyleTree p -> [p] Source #

Flatten a styletree into a list, including parent nodes.

preorder :: (Maybe b -> Maybe b -> a -> b) -> StyleTree a -> StyleTree b Source #

Preorder traversal over a tree, without tracking contexts.

preorder' :: (Maybe b -> Maybe b -> a -> b) -> Maybe b -> Maybe b -> [StyleTree a] -> [StyleTree b] Source #

Variant of preorder with given parent & previous-sibling.

postorder :: (a -> [b] -> [b]) -> StyleTree a -> [StyleTree b] Source #

Postorder traversal over the tree.