Copyright | (c) Dominik Schrempf 2020 |
---|---|
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
- goUp :: TreePos e a -> Maybe (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)
- 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
- insertTree :: 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.
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.
Modification
insertTree :: Tree e a -> TreePos e a -> TreePos e a Source #
Insert a new tree into 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.