Copyright | Copyright (C) 2010 Uwe Schmidt |
---|---|
License | MIT |
Maintainer | Uwe Schmidt (uwe\@fh-wedel.de) |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell98 |
List arrows for navigatable trees
Trees that implement the Data.Tree.NavigatableTree.Class interface, can be processed with these arrows.
Synopsis
- class ArrowList a => ArrowNavigatableTree a where
- moveUp :: NavigatableTree t => a (t b) (t b)
- moveDown :: NavigatableTree t => a (t b) (t b)
- moveLeft :: NavigatableTree t => a (t b) (t b)
- moveRight :: NavigatableTree t => a (t b) (t b)
- parentAxis :: (ArrowList a, NavigatableTree t) => a (t b) (t b)
- ancestorAxis :: (ArrowList a, NavigatableTree t) => a (t b) (t b)
- ancestorOrSelfAxis :: (ArrowList a, NavigatableTree t) => a (t b) (t b)
- childAxis :: (ArrowList a, NavigatableTree t) => a (t b) (t b)
- descendantAxis :: (ArrowList a, NavigatableTree t) => a (t b) (t b)
- descendantOrSelfAxis :: (ArrowList a, NavigatableTree t) => a (t b) (t b)
- descendantOrFollowingAxis :: (ArrowList a, NavigatableTree t) => a (t b) (t b)
- revDescendantOrSelfAxis :: (ArrowList a, NavigatableTree t) => a (t b) (t b)
- followingSiblingAxis :: (ArrowList a, NavigatableTree t) => a (t b) (t b)
- precedingSiblingAxis :: (ArrowList a, NavigatableTree t) => a (t b) (t b)
- selfAxis :: (ArrowList a, NavigatableTree t) => a (t b) (t b)
- followingAxis :: (ArrowList a, NavigatableTree t) => a (t b) (t b)
- precedingAxis :: (ArrowList a, NavigatableTree t) => a (t b) (t b)
- moveToRoot :: (Arrow a, NavigatableTree t) => a (t b) (t b)
- isAtRoot :: (ArrowList a, NavigatableTree t) => a (t b) (t b)
- addNav :: (ArrowList a, NavigatableTreeToTree nt t) => a (t b) (nt b)
- remNav :: (ArrowList a, NavigatableTreeToTree nt t) => a (nt b) (t b)
- withNav :: (ArrowList a, NavigatableTreeToTree nt t) => a (nt b) (nt c) -> a (t b) (t c)
- withoutNav :: (ArrowList a, NavigatableTreeToTree nt t, NavigatableTreeModify nt t) => a (t b) (t b) -> a (nt b) (nt b)
- filterAxis :: (ArrowIf a, NavigatableTreeToTree nt t) => a (t b) c -> a (nt b) (nt b)
- moveOn :: (ArrowList a, NavigatableTree t) => a (t b) (t b) -> a (t b) (t b)
- changeThisTree :: (ArrowList a, ArrowIf a, NavigatableTreeToTree nt t, NavigatableTreeModify nt t) => a (t b) (t b) -> a (nt b) (nt b)
- substThisTree :: (ArrowList a, ArrowIf a, NavigatableTreeToTree nt t, NavigatableTreeModify nt t) => t b -> a (nt b) (nt b)
- addToTheLeft :: (ArrowList a, NavigatableTreeToTree nt t, NavigatableTreeModify nt t) => a (t b) (t b) -> a (nt b) (nt b)
- addToTheRight :: (ArrowList a, NavigatableTreeToTree nt t, NavigatableTreeModify nt t) => a (t b) (t b) -> a (nt b) (nt b)
- 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)
- dropFromTheLeft :: (ArrowList a, NavigatableTreeModify nt t) => a (nt b) (nt b)
- dropFromTheRight :: (ArrowList a, NavigatableTreeModify nt t) => a (nt b) (nt b)
Documentation
class ArrowList a => ArrowNavigatableTree a where Source #
The interface for navigatable tree arrows
all functions have default implementations
Nothing
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 #
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