HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulehxt-9.3.1.22Haskell2010

Control.Arrow.ArrowNavigatableTree

List arrows for navigatable trees

Trees that implement the Data.Tree.NavigatableTree.Class interface, can be processed with these arrows.

  • 1 class
  • 28 values
  • Packagehxt-9.3.1.22
  • Exports29
  • LanguageHaskell2010
  • LicenceMIT
  • SourceArrowNavigatableTree.hs
classclass ArrowList a => ArrowNavigatableTree (a :: Type -> Type -> Type) where
#

The interface for navigatable tree arrows

all functions have default implementations

Methods

Instances4ArrowNavigatableTree
valuewithNav
  1. :: (ArrowList a, NavigatableTreeToTree nt t)
  2. => a (nt b) (nt c)
  3. -> a (t b) (t c)
#

apply an operation using navigation to an ordinary tree

This root and all children may be visited in arbitrary order

valuefilterAxis
  1. :: (ArrowIf a, NavigatableTreeToTree nt t)
  2. => a (t b) c
  3. -> a (nt b) (nt b)
#

Filter an axis with an ordinary tree predicate

Example: In a tree of Ints find all nodes in the subtrees (in preorder) that have label 42

descendantAxis >>> filterAxis (hasNode (== 42))

Example: In an XML Tree find the following nodes of a node with attribute id and value 42

descendantAxis >>> filterAxis (hasAttrValue "id" (=="42")) >>> followingAxis
valuemoveOn :: (ArrowList a, NavigatableTree t) => a (t b) (t b) -> a (t b) (t b)
#

Move to the next tree on a given axis. Deterministic arrow

Example: Move to the next node in a preorder visit: next child or else next following

moveOn descendantOrFollowingAxis
valueaddToTheLeft
  1. :: (ArrowList a, NavigatableTreeToTree nt t, NavigatableTreeModify nt t)
  2. => a (t b) (t b)
  3. -> a (nt b) (nt b)
#

apply an ordinary arrow to the current subtree of a navigatabe tree and add the result trees in front of the current tree.

If this arrow is applied to the root, it will fail, because we want a tree as result, not a forest.

valueaddToTheRight
  1. :: (ArrowList a, NavigatableTreeToTree nt t, NavigatableTreeModify nt t)
  2. => a (t b) (t b)
  3. -> a (nt b) (nt b)
#

apply an ordinary arrow to the current subtree of a navigatabe tree and add the result trees behind the current tree.

If this arrow is applied to the root, it will fail, because we want a tree as result, not a forest.

valuedropFromTheLeft :: (ArrowList a, NavigatableTreeModify nt t) => a (nt b) (nt b)
#

drop the direct left sibling tree of the given navigatable tree

If this arrow is applied to the root or a leftmost tree, it will fail, because there is nothing to remove

valuedropFromTheRight :: (ArrowList a, NavigatableTreeModify nt t) => a (nt b) (nt b)
#

drop the direct left sibling tree of the given navigatable tree

If this arrow is applied to the root or a rightmost tree, it will fail, because there is nothing to remove