Rose (n-ary) trees with both upwards- (i.e. cached) and
downwards-traveling (i.e. accumulating) monoidal annotations.
Abstractly, a DUALTree is a rose (n-ary) tree with data (of type
l) at leaves, data (of type a) at internal nodes, and two
types of monoidal annotations, one (of type u) travelling
"up" the tree and one (of type d) traveling "down". See
the documentation at the top of this file for full details.
DUALTree comes with some instances:
Functor, for modifying leaf data. Note that fmap of course cannot alter any
uannotations.Semigroup.
DUALTreeNEs form a semigroup where(<>)corresponds to adjoining two trees under a common parent root, withsconcatspecialized to put all the trees under a single parent. Note that this does not satisfy associativity up to structural equality, but only up to observational equivalence under flatten. Technically using foldDUAL directly enables one to observe the difference, but it is understood that foldDUAL should be used only in ways such that reassociation of subtrees "does not matter".Monoid. The identity is the empty tree.
Instances6Action, Functor, Eq, Show, Semigroup, Monoid
(Semigroup d, Semigroup u, Action d u) => Action (DAct d) (DUALTree d u a l)Defined in dual-tree-0.2.3.1 · Data.Tree.DUAL.InternalApply a
dannotation at the root of a tree. Semantically, alluannotations are transformed by the action ofd, although operationallyactincurs only a constant amount of work.Functor (DUALTree d u a)Defined in dual-tree-0.2.3.1 · Data.Tree.DUAL.Internal(Eq u, Eq l, Eq d, Eq a) => Eq (DUALTree d u a l)Defined in dual-tree-0.2.3.1 · Data.Tree.DUAL.Internal(Show u, Show l, Show d, Show a) => Show (DUALTree d u a l)Defined in dual-tree-0.2.3.1 · Data.Tree.DUAL.Internal(Semigroup u, Action d u) => Semigroup (DUALTree d u a l)Defined in dual-tree-0.2.3.1 · Data.Tree.DUAL.Internal(Semigroup u, Action d u) => Monoid (DUALTree d u a l)Defined in dual-tree-0.2.3.1 · Data.Tree.DUAL.Internal