hxt-9.3.1.16: 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 | stable
Portability | portable
Safe Haskell | Safe
Language | Haskell98

Data.Tree.NTree.Zipper.TypeDefs

Contents

- Orphan instances

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 Source #

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 Source # |
Methods fmap :: (a -> b) -> NTZipper a -> NTZipper b # (<$) :: a -> NTZipper b -> NTZipper a #
NavigatableTree NTZipper Source # |
Methods mvUp :: NTZipper a -> Maybe (NTZipper a) Source # mvDown :: NTZipper a -> Maybe (NTZipper a) Source # mvLeft :: NTZipper a -> Maybe (NTZipper a) Source # mvRight :: NTZipper a -> Maybe (NTZipper a) Source #
Tree NTZipper Source # |

Methods

mkTree :: a -> [NTZipper a] -> NTZipper a Source #

mkLeaf :: a -> NTZipper a Source #

isLeaf :: NTZipper a -> Bool Source #

isInner :: NTZipper a -> Bool Source #

getNode :: NTZipper a -> a Source #

getChildren :: NTZipper a -> [NTZipper a] Source #

changeNode :: (a -> a) -> NTZipper a -> NTZipper a Source #

changeChildren :: ([NTZipper a] -> [NTZipper a]) -> NTZipper a -> NTZipper a Source #

setNode :: a -> NTZipper a -> NTZipper a Source #

setChildren :: [NTZipper a] -> NTZipper a -> NTZipper a Source #

foldTree :: (a -> [b] -> b) -> NTZipper a -> b Source #

nodesTree :: NTZipper a -> [a] Source #

depthTree :: NTZipper a -> Int Source #

cardTree :: NTZipper a -> Int Source #

formatTree :: (a -> String) -> NTZipper a -> String Source #

Show a => Show (NTZipper a) Source # |
Methods showsPrec :: Int -> NTZipper a -> ShowS # show :: NTZipper a -> String # showList :: [NTZipper a] -> ShowS #

type NTBreadCrumbs a = [NTCrumb a] Source #

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

data NTCrumb a Source #

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 Source # |
Methods fmap :: (a -> b) -> NTCrumb a -> NTCrumb b # (<$) :: a -> NTCrumb b -> NTCrumb a #
Show a => Show (NTCrumb a) Source # |
Methods showsPrec :: Int -> NTCrumb a -> ShowS # show :: NTCrumb a -> String # showList :: [NTCrumb a] -> ShowS #

toNTZipper :: NTree a -> NTZipper a Source #

Conversion of a rose tree into a navigatable rose tree

fromNTZipper :: NTZipper a -> NTree a Source #

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) Source #

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

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

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

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

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

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

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

isTop :: NTZipper a -> Bool Source #

up1 :: NTree a -> NTCrumb a -> NTree a Source #

# Orphan instances

NavigatableTreeModify NTZipper NTree Source # |
Methods addTreeLeft :: NTree a -> NTZipper a -> Maybe (NTZipper a) Source # addTreeRight :: NTree a -> NTZipper a -> Maybe (NTZipper a) Source # dropTreeLeft :: NTZipper a -> Maybe (NTZipper a) Source # dropTreeRight :: NTZipper a -> Maybe (NTZipper a) Source # substThisTree :: NTree a -> NTZipper a -> NTZipper a Source #
NavigatableTreeToTree NTZipper NTree Source # |
Methods fromTree :: NTree a -> NTZipper a Source # toTree :: NTZipper a -> NTree a Source #