treeseq-1.0.0.20180213: Library for a multi-way tree (rose tree), using Seq (finger tree) for forests

Safe HaskellSafe
LanguageHaskell2010

Data.TreeSeq.Strict.Zipper

Contents

Synopsis

Type Zipper

zipper :: Tree a -> Zipper a Source #

Return a Zipper starting at the given Tree.

zippers :: Trees a -> [Zipper a] Source #

Return a Zipper starting at the left-most Tree of the given Trees.

root :: Zipper a -> Cursor a Source #

Return the Cursor after zipping the given Zipper upto its last parent.

roots :: Zipper a -> Trees a Source #

Like root, but concatenate the Cursor into a Trees.

zipath :: Zipper a -> [a] Source #

Return the keys within the Tree nodes leading to the current Cursor of the given Zipper.

select :: Axis a -> Zipper a -> [Tree a] Source #

Return the Trees selected by the given Axis from the given Zipper.

filter :: Axis a -> (Zipper a -> Maybe b) -> Zipper a -> [b] Source #

Return the filtered values selected by the given Axis from the given Zipper.

Type Cursor

data Cursor a Source #

Instances

Eq a => Eq (Cursor a) Source # 

Methods

(==) :: Cursor a -> Cursor a -> Bool #

(/=) :: Cursor a -> Cursor a -> Bool #

Show a => Show (Cursor a) Source # 

Methods

showsPrec :: Int -> Cursor a -> ShowS #

show :: Cursor a -> String #

showList :: [Cursor a] -> ShowS #

cursor :: Zipper a -> Cursor a Source #

Return the current Cursor of a Zipper.

setCursor :: Zipper a -> Cursor a -> Zipper a Source #

Set the current Cursor of a Zipper.

current :: Zipper a -> Tree a Source #

Return the Tree currently under the Cursor.

Type Axis

type Axis a = AxisAlt [] a Source #

runAxis :: Axis a -> Zipper a -> [Zipper a] Source #

Type AxisAlt

type AxisAlt f a = Kleisli f (Zipper a) (Zipper a) Source #

Like Axis, but generalized with Alternative.

Useful to return a Maybe instead of a list.

runAxisAlt :: AxisAlt f a -> Zipper a -> f (Zipper a) Source #

Axis repeat

axis_repeat :: AxisAlt Maybe a -> Axis a Source #

Collect all Zippers along a given axis, including the first Zipper.

axis_repeat_without_self :: AxisAlt Maybe a -> Axis a Source #

Collect all Zippers along a given axis, excluding the starting Zipper.

Axis filter

axis_filter :: Axis a -> (Zipper a -> Bool) -> Axis a infixl 5 Source #

axis_filter_current :: Axis a -> (Tree a -> Bool) -> Axis a infixl 5 Source #

Axis first

Axis last

Axis at

axis_at :: Alternative f => Axis a -> Int -> AxisAlt f a infixl 5 Source #

Axis self

Axis child

Axis ancestor

Axis descendant

Axis preceding

Axis following

Axis parent

Utilities

listHead :: Alternative f => [a] -> f a Source #