Copyright | (c) Dominik Schrempf 2021 |
---|---|

License | GPL-3.0-or-later |

Maintainer | dominik.schrempf@gmail.com |

Stability | unstable |

Portability | portable |

Safe Haskell | None |

Language | Haskell2010 |

Creation date: Thu Jul 23 08:42:37 2020.

## Synopsis

- data TreePos e a = Pos {}
- fromTree :: Tree e a -> TreePos e a
- toTree :: TreePos e a -> Tree e a
- goParent :: TreePos e a -> Maybe (TreePos e a)
- goParentUnsafe :: TreePos e a -> TreePos e a
- goRoot :: TreePos e a -> TreePos e a
- goLeft :: TreePos e a -> Maybe (TreePos e a)
- goRight :: TreePos e a -> Maybe (TreePos e a)
- goChild :: Int -> TreePos e a -> Maybe (TreePos e a)
- goChildUnsafe :: Int -> TreePos e a -> TreePos e a
- type Path = [Int]
- goPath :: Path -> TreePos e a -> Maybe (TreePos e a)
- goPathUnsafe :: Path -> TreePos e a -> TreePos e a
- getSubTreeUnsafe :: Path -> Tree e a -> Tree e a
- isValidPath :: Tree e a -> Path -> Bool
- isLeafPath :: Tree e a -> Path -> Bool
- insertTree :: Tree e a -> TreePos e a -> TreePos e a
- modifyTree :: (Tree e a -> Tree e a) -> TreePos e a -> TreePos e a
- insertBranch :: e -> TreePos e a -> TreePos e a
- insertLabel :: a -> TreePos e a -> TreePos e a

# Data type

Tree zipper. For reference, please see http://hackage.haskell.org/package/rosezipper.

# Conversion

# Movement

goChild :: Int -> TreePos e a -> Maybe (TreePos e a) Source #

Go to child with given index in forest.

goChildUnsafe :: Int -> TreePos e a -> TreePos e a Source #

Go to child with given index in forest. Call `error`

if child does not
exist.

# Paths

Path from the root of a tree to the node of the tree.

The position is specific to a tree topology. If the topology changes, the position becomes invalid.

goPathUnsafe :: Path -> TreePos e a -> TreePos e a Source #

Got to node with given path.

Call `error`

if path is invalid.

getSubTreeUnsafe :: Path -> Tree e a -> Tree e a Source #

Get the sub tree at path.

Call `error`

if path is invalid.

isValidPath :: Tree e a -> Path -> Bool Source #

Check if a path is valid in that it leads to a node on a tree.

# Modification

insertTree :: Tree e a -> TreePos e a -> TreePos e a Source #

Insert a new tree into the current focus of the zipper.

modifyTree :: (Tree e a -> Tree e a) -> TreePos e a -> TreePos e a Source #

Modify the tree at the current focus of the zipper.

insertBranch :: e -> TreePos e a -> TreePos e a Source #

Insert a new branch label into the current focus of the zipper.

insertLabel :: a -> TreePos e a -> TreePos e a Source #

Insert a new node label into the current focus of the zipper.