Safe Haskell | Safe |
---|---|

Language | Haskell98 |

- type AnnFix x s = HFix (K x :*: PF s)
- type AnnFix1 x s = PF s (AnnFix x s)
- mkAnnFix :: x -> AnnFix1 x s ix -> AnnFix x s ix
- type AnyAnnFix x s = AnyF s (AnnFix x s)
- unannotate :: HFunctor s (PF s) => s ix -> AnnFix x s ix -> HFix (PF s) ix
- children :: HFunctor s f => s ix -> f r ix -> [AnyF s r]
- flatten :: forall s x ix. (HFunctor s (PF s), Fam s) => s ix -> AnnFix x s ix -> [(x, Any s)]
- filterAnnFix :: (Fam s, HFunctor s (PF s)) => s ix -> (x -> Bool) -> AnnFix x s ix -> [(x, Any s)]
- debugFlatten :: (HFunctor s (PF s), ShowFam s, Show x, Fam s) => s ix -> AnnFix x s ix -> IO ()
- allAnnotations :: HFunctor phi (PF phi) => phi ix -> AnnFix x phi ix -> [x]
- type AnnZipper phi x = FixZipper phi (K x :*: PF phi)
- focusAnn :: Loc phi f (HFix (K x :*: g)) ix -> x
- explore :: Zipper phi (PF phi) => phi ix -> (x -> ExploreHints) -> AnnFix x phi ix -> [AnnZipper phi x ix]
- findLeftmostDeepest :: Zipper phi (PF phi) => phi ix -> (x -> Bool) -> AnnFix x phi ix -> Maybe (AnnZipper phi x ix)

# Documentation

mkAnnFix :: x -> AnnFix1 x s ix -> AnnFix x s ix Source #

Supply a tree with an annotation at the top level.

type AnyAnnFix x s = AnyF s (AnnFix x s) Source #

A fixpoint of a data family `s`

annotated with an `x`

at every recursive position, with existentially quantified top-level index.

unannotate :: HFunctor s (PF s) => s ix -> AnnFix x s ix -> HFix (PF s) ix Source #

Removes all annotations from a recursively annotated fixpoint.

children :: HFunctor s f => s ix -> f r ix -> [AnyF s r] Source #

Collects the direct children of a functor in a list.

flatten :: forall s x ix. (HFunctor s (PF s), Fam s) => s ix -> AnnFix x s ix -> [(x, Any s)] Source #

Flatten an annotated tree to a list of subtrees coupled with their annotations.

filterAnnFix :: (Fam s, HFunctor s (PF s)) => s ix -> (x -> Bool) -> AnnFix x s ix -> [(x, Any s)] Source #

Yield all subtrees whose annotation matches the predicate.

debugFlatten :: (HFunctor s (PF s), ShowFam s, Show x, Fam s) => s ix -> AnnFix x s ix -> IO () Source #

Flatten an annotated tree and print all subtrees to stdout.

allAnnotations :: HFunctor phi (PF phi) => phi ix -> AnnFix x phi ix -> [x] Source #

Recursively yield all annotations in the tree in preorder.

focusAnn :: Loc phi f (HFix (K x :*: g)) ix -> x Source #

Extract the annotation of the current focus.

explore :: Zipper phi (PF phi) => phi ix -> (x -> ExploreHints) -> AnnFix x phi ix -> [AnnZipper phi x ix] Source #

Explore an annotated tree. Starting with the root of the tree, at each
position the annotation at that position is matched against the
`ExploreHints`

predicates and all the selections where `matchHere`

was
positive are collected. The `exploreRight`

and `exploreDown`

allow pruning
of the tree, preventing entire parts from being visited.

findLeftmostDeepest :: Zipper phi (PF phi) => phi ix -> (x -> Bool) -> AnnFix x phi ix -> Maybe (AnnZipper phi x ix) Source #

Find the deepest node in an annotated tree that matches the predicate. Starting with the root, the predicate tells whether a node's annotation matches. If so, the search continues at the node's children and the node's siblings to the right are excluded from further exploration. If no child matches, the node itself is returned.