hxt-9.3.1.16: A collection of tools for processing XML with Haskell.

CopyrightCopyright (C) 2010 Uwe Schmidt
LicenseMIT
MaintainerUwe Schmidt (uwe\@fh-wedel.de)
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell98

Control.Arrow.ArrowNavigatableTree

Description

List arrows for navigatable trees

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

Synopsis

Documentation

class ArrowList a => ArrowNavigatableTree a where Source #

The interface for navigatable tree arrows

all functions have default implementations

Methods

moveUp :: NavigatableTree t => a (t b) (t b) Source #

moveDown :: NavigatableTree t => a (t b) (t b) Source #

moveLeft :: NavigatableTree t => a (t b) (t b) Source #

moveRight :: NavigatableTree t => a (t b) (t b) Source #

Instances

ArrowNavigatableTree LA Source # 

Methods

moveUp :: NavigatableTree t => LA (t b) (t b) Source #

moveDown :: NavigatableTree t => LA (t b) (t b) Source #

moveLeft :: NavigatableTree t => LA (t b) (t b) Source #

moveRight :: NavigatableTree t => LA (t b) (t b) Source #

ArrowNavigatableTree IOLA Source # 

Methods

moveUp :: NavigatableTree t => IOLA (t b) (t b) Source #

moveDown :: NavigatableTree t => IOLA (t b) (t b) Source #

moveLeft :: NavigatableTree t => IOLA (t b) (t b) Source #

moveRight :: NavigatableTree t => IOLA (t b) (t b) Source #

ArrowNavigatableTree (SLA s) Source # 

Methods

moveUp :: NavigatableTree t => SLA s (t b) (t b) Source #

moveDown :: NavigatableTree t => SLA s (t b) (t b) Source #

moveLeft :: NavigatableTree t => SLA s (t b) (t b) Source #

moveRight :: NavigatableTree t => SLA s (t b) (t b) Source #

ArrowNavigatableTree (IOSLA s) Source # 

Methods

moveUp :: NavigatableTree t => IOSLA s (t b) (t b) Source #

moveDown :: NavigatableTree t => IOSLA s (t b) (t b) Source #

moveLeft :: NavigatableTree t => IOSLA s (t b) (t b) Source #

moveRight :: NavigatableTree t => IOSLA s (t b) (t b) Source #

parentAxis :: (ArrowList a, NavigatableTree t) => a (t b) (t b) Source #

ancestorAxis :: (ArrowList a, NavigatableTree t) => a (t b) (t b) Source #

XPath axis: ancestor

ancestorOrSelfAxis :: (ArrowList a, NavigatableTree t) => a (t b) (t b) Source #

XPath axis: ancestor or self

childAxis :: (ArrowList a, NavigatableTree t) => a (t b) (t b) Source #

XPath axis: child

descendantAxis :: (ArrowList a, NavigatableTree t) => a (t b) (t b) Source #

XPath axis: descendant

descendantOrSelfAxis :: (ArrowList a, NavigatableTree t) => a (t b) (t b) Source #

XPath axis: descendant or self

descendantOrFollowingAxis :: (ArrowList a, NavigatableTree t) => a (t b) (t b) Source #

not an XPath axis but useful: descendant or following

revDescendantOrSelfAxis :: (ArrowList a, NavigatableTree t) => a (t b) (t b) Source #

not an official XPath axis but useful: reverse descendant or self, used in preceding axis

followingSiblingAxis :: (ArrowList a, NavigatableTree t) => a (t b) (t b) Source #

XPath axis: following sibling

precedingSiblingAxis :: (ArrowList a, NavigatableTree t) => a (t b) (t b) Source #

XPath axis: preceeding sibling

selfAxis :: (ArrowList a, NavigatableTree t) => a (t b) (t b) Source #

XPath axis: self

followingAxis :: (ArrowList a, NavigatableTree t) => a (t b) (t b) Source #

XPath axis: following

precedingAxis :: (ArrowList a, NavigatableTree t) => a (t b) (t b) Source #

XPath axis: preceding

moveToRoot :: (Arrow a, NavigatableTree t) => a (t b) (t b) Source #

move to the root

isAtRoot :: (ArrowList a, NavigatableTree t) => a (t b) (t b) Source #

addNav :: (ArrowList a, NavigatableTreeToTree nt t) => a (t b) (nt b) Source #

Conversion from a tree into a navigatable tree

remNav :: (ArrowList a, NavigatableTreeToTree nt t) => a (nt b) (t b) Source #

Conversion from a navigatable tree into an ordinary tree

withNav :: (ArrowList a, NavigatableTreeToTree nt t) => a (nt b) (nt c) -> a (t b) (t c) Source #

apply an operation using navigation to an ordinary tree

This root and all children may be visited in arbitrary order

withoutNav :: (ArrowList a, NavigatableTreeToTree nt t, NavigatableTreeModify nt t) => a (t b) (t b) -> a (nt b) (nt b) Source #

apply a simple operation without use of navigation to a navigatable tree

This enables to apply arbitrary tree operations to navigatable trees

filterAxis :: (ArrowIf a, NavigatableTreeToTree nt t) => a (t b) c -> a (nt b) (nt b) Source #

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

moveOn :: (ArrowList a, NavigatableTree t) => a (t b) (t b) -> a (t b) (t b) Source #

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

changeThisTree :: (ArrowList a, ArrowIf a, NavigatableTreeToTree nt t, NavigatableTreeModify nt t) => a (t b) (t b) -> a (nt b) (nt b) Source #

Change the current subtree of a navigatable tree.

The arrow for computing the changes should be deterministic. If it fails nothing is changed.

substThisTree :: (ArrowList a, ArrowIf a, NavigatableTreeToTree nt t, NavigatableTreeModify nt t) => t b -> a (nt b) (nt b) Source #

Substitute the current subtree of a navigatable tree by a given tree

addToTheLeft :: (ArrowList a, NavigatableTreeToTree nt t, NavigatableTreeModify nt t) => a (t b) (t b) -> a (nt b) (nt b) Source #

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.

addToTheRight :: (ArrowList a, NavigatableTreeToTree nt t, NavigatableTreeModify nt t) => a (t b) (t b) -> a (nt b) (nt b) Source #

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.

addToOneSide :: (ArrowList a, NavigatableTreeToTree nt t, NavigatableTreeModify nt t) => (Maybe (nt b) -> [t b] -> Maybe (nt b)) -> a (t b) (t b) -> a (nt b) (nt b) Source #

addToOneSide does the real work for addToTheLeft and addToTheRight

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

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

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

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