Annotations-0.2.2: Constructing, analyzing and destructing annotated trees

Safe HaskellSafe
LanguageHaskell98

Annotations.F.Positional

Description

Queries on trees annotated with position information.

Synopsis

Documentation

selectByRange :: Foldable f => Range -> AnnFix Bounds f -> Maybe (Zipper (AnnFix Bounds f)) Source #

Find the deepest node whose bounds match the given range. See rangeInBounds.

selectByPos :: Foldable f => Int -> AnnFix Bounds f -> Maybe (Zipper (AnnFix Bounds f)) Source #

Find the deepest node whose bounds contain the given position.

validBounds :: Foldable f => AnnFix Bounds f -> [Bounds] Source #

Find all selections in the tree and return their bounds. The tree is traversed in preorder. Consequently, the bounds are returned in lexicographical order.

repairBy :: (Foldable f, Ord dist) => (Range -> Range -> dist) -> AnnFix Bounds f -> Range -> Bounds Source #

repairBy cost tree range finds the the closest valid text selection to range, where 'closest' is determined by the specified cost function.

moveSelection :: Foldable f => AnnFix Bounds f -> Nav -> Range -> Maybe Bounds Source #

Move around in a tree according to the Nav, expressed in tree selections. Although a Range is required as input, a Bounds is returned, providing information about all the valid text selections that would select the particular tree node.