Annotations-0.2.2: Constructing, analyzing and destructing annotated trees

Safe HaskellSafe
LanguageHaskell98

Annotations.F.Zipper

Synopsis

Documentation

data Zipper a Source #

A quasi-zipper, meant for O(1), fixed-memory stepping through a tree structure, but not meant for updates.

Constructors

Zipper 

Fields

enter :: Foldable f => Fix f -> Zipper (Fix f) Source #

Move into the root of the fixed point. The returned zipper builds a data structure with optimal sharing and fixed memory usage. For example, zLeft >=> zRight (if successful) returns to the same node in memory.

leave :: Zipper a -> a Source #

Walk back up to the root of the fixed point and leave the zipper structure.

child :: Int -> Zipper a -> Maybe (Zipper a) Source #

Move down into a specific child.

allFoci :: Foldable f => Fix f -> [Zipper (Fix f)] Source #

Traverses the tree in preorder, yielding all possible tree selections.

newtype Nav Source #

Captures navigation steps in a Zipper. Its Monoid instance specifies the identity step (mempty) and step composition (mappend).

Constructors

Nav 

Fields

Instances

Monoid Nav Source # 

Methods

mempty :: Nav #

mappend :: Nav -> Nav -> Nav #

mconcat :: [Nav] -> Nav #