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

Copyright | Copyright (C) 2010 Uwe Schmidt
License | MIT
Maintainer | Uwe Schmidt (uwe\@fh-wedel.de)
Stability | experimental
Portability | portable
Safe Haskell | Safe-Inferred
Language | Haskell2010

Data.Tree.NavigatableTree.Class

Description

Interface definition for navigatable trees. Navigatable trees need to have operations to move up, down, left and right. With these elementary operations, most of the XPath axises can be defined.

Synopsis

- class NavigatableTree (t :: Type -> Type) where
  - mvUp :: t a -> Maybe (t a)
  - mvDown :: t a -> Maybe (t a)
  - mvLeft :: t a -> Maybe (t a)
  - mvRight :: t a -> Maybe (t a)
- class NavigatableTreeToTree (nt :: Type -> Type) (t :: Type -> Type) | t -> nt, nt -> t where
  - fromTree :: t a -> nt a
  - toTree :: nt a -> t a
- class NavigatableTreeModify (nt :: Type -> Type) (t :: Type -> Type) | t -> nt, nt -> t where
  - addTreeLeft :: t a -> nt a -> Maybe (nt a)
  - addTreeRight :: t a -> nt a -> Maybe (nt a)
  - dropTreeLeft :: nt a -> Maybe (nt a)
  - dropTreeRight :: nt a -> Maybe (nt a)
  - substThisTree :: t a -> nt a -> nt a

# Documentation

class NavigatableTree (t :: Type -> Type) where #

The interface for navigatable trees

Methods

mvUp :: t a -> Maybe (t a) #

move one step towards the root

mvDown :: t a -> Maybe (t a) #

descend one step to the leftmost child

mvLeft :: t a -> Maybe (t a) #

move to the left neighbour

mvRight :: t a -> Maybe (t a) #

move to the right neighbour

#### Instances

Instances details

NavigatableTree NTZipper # |
Instance details Defined in Data.Tree.NTree.Zipper.TypeDefs Methods mvUp :: NTZipper a -> Maybe (NTZipper a) # mvDown :: NTZipper a -> Maybe (NTZipper a) # mvLeft :: NTZipper a -> Maybe (NTZipper a) # mvRight :: NTZipper a -> Maybe (NTZipper a) #

class NavigatableTreeToTree (nt :: Type -> Type) (t :: Type -> Type) | t -> nt, nt -> t where #

Conversion between trees and navigatable trees,

There is only a single navigatable tree implementation for a given tree allowed (see the functional dependencies)

Methods

fromTree :: t a -> nt a #

construct a navigatable tree

toTree :: nt a -> t a #

remove navigation

#### Instances

Instances details

NavigatableTreeToTree NTZipper NTree # |
Instance details Defined in Data.Tree.NTree.Zipper.TypeDefs Methods fromTree :: NTree a -> NTZipper a # toTree :: NTZipper a -> NTree a #

class NavigatableTreeModify (nt :: Type -> Type) (t :: Type -> Type) | t -> nt, nt -> t where #

Edit operation on navigatable trees

There is only a single navigatable tree implementation for a given tree allowed (see the functional dependencies)

Methods

addTreeLeft :: t a -> nt a -> Maybe (nt a) #

add an ordinary tree in front of the given navigatable tree

addTreeRight :: t a -> nt a -> Maybe (nt a) #

add an ordinary tree behind of the given navigatable tree

dropTreeLeft :: nt a -> Maybe (nt a) #

drop the direct left sibling tree of the given navigatable tree

dropTreeRight :: nt a -> Maybe (nt a) #

drop the direct right sibling tree of the given navigatable tree

substThisTree :: t a -> nt a -> nt a #

change the tree but remain the navigation

#### Instances

Instances details

NavigatableTreeModify NTZipper NTree # |
Instance details Defined in Data.Tree.NTree.Zipper.TypeDefs Methods addTreeLeft :: NTree a -> NTZipper a -> Maybe (NTZipper a) # addTreeRight :: NTree a -> NTZipper a -> Maybe (NTZipper a) # dropTreeLeft :: NTZipper a -> Maybe (NTZipper a) # dropTreeRight :: NTZipper a -> Maybe (NTZipper a) # substThisTree :: NTree a -> NTZipper a -> NTZipper a #