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

Portability | portable
Stability | stable
Maintainer | Uwe Schmidt (uwe\@fh-wedel.de)
Safe Haskell | Safe-Inferred

Data.Tree.NTree.Zipper.TypeDefs

Description

Implementation of navigateble trees for rose trees. The implementation is done with zippers. A description and introductory tutorial about zippers can be found in http://learnyouahaskell.com/zippers

Synopsis

- data NTZipper a = NTZ {
  - ntree :: NTree a
  - context :: NTBreadCrumbs a
  }
- type NTBreadCrumbs a = [NTCrumb a]
- data NTCrumb a = NTC (NTrees a) a (NTrees a)
- toNTZipper :: NTree a -> NTZipper a
- fromNTZipper :: NTZipper a -> NTree a
- up :: NTZipper a -> Maybe (NTZipper a)
- down :: NTZipper a -> Maybe (NTZipper a)
- toTheRight :: NTZipper a -> Maybe (NTZipper a)
- toTheLeft :: NTZipper a -> Maybe (NTZipper a)
- addToTheLeft :: NTree a -> NTZipper a -> Maybe (NTZipper a)
- addToTheRight :: NTree a -> NTZipper a -> Maybe (NTZipper a)
- dropFromTheLeft :: NTZipper a -> Maybe (NTZipper a)
- dropFromTheRight :: NTZipper a -> Maybe (NTZipper a)
- isTop :: NTZipper a -> Bool
- up1 :: NTree a -> NTCrumb a -> NTree a

# Documentation

data NTZipper a

Zipper for rose trees

A zipper consist of the current tree and the branches on the way back to the root

Constructors

NTZ |

Fields

ntree :: NTree a
context :: NTBreadCrumbs a

Instances

Functor NTZipper |
Tree NTZipper |
NavigatableTree NTZipper |
NavigatableTreeModify NTZipper NTree |
NavigatableTreeToTree NTZipper NTree |
Show a => Show (NTZipper a) |

type NTBreadCrumbs a = [NTCrumb a]

The list of unzipped nodes from a current tree back to the root

data NTCrumb a

One unzipped step consists of the left siblings, the node info and the right siblings

Constructors

NTC (NTrees a) a (NTrees a) |

Instances

Functor NTCrumb |
Show a => Show (NTCrumb a) |

toNTZipper :: NTree a -> NTZipper a

Conversion of a rose tree into a navigatable rose tree

fromNTZipper :: NTZipper a -> NTree a

Conversion of a navigatable rose tree into an ordinary rose tree.

The context, the parts for moving up to the root are just removed from the tree. So when transforming a navigatable tree by moving around and by changing some nodes, one has to navigate back to the root, else that parts are removed from the result

up :: NTZipper a -> Maybe (NTZipper a)

down :: NTZipper a -> Maybe (NTZipper a)

toTheRight :: NTZipper a -> Maybe (NTZipper a)

toTheLeft :: NTZipper a -> Maybe (NTZipper a)

addToTheLeft :: NTree a -> NTZipper a -> Maybe (NTZipper a)

addToTheRight :: NTree a -> NTZipper a -> Maybe (NTZipper a)

dropFromTheLeft :: NTZipper a -> Maybe (NTZipper a)

dropFromTheRight :: NTZipper a -> Maybe (NTZipper a)

isTop :: NTZipper a -> Bool

up1 :: NTree a -> NTCrumb a -> NTree a