- data TreePos t a
- class PosType t
- data Empty a
- data Full a
- before :: PosType t => TreePos t a -> Forest a
- after :: PosType t => TreePos t a -> Forest a
- forest :: PosType t => TreePos t a -> Forest a
- tree :: TreePos Full a -> Tree a
- label :: TreePos Full a -> a
- parents :: PosType t => TreePos t a -> [(Forest a, a, Forest a)]
- fromTree :: Tree a -> TreePos Full a
- fromForest :: Forest a -> TreePos Empty a
- toForest :: PosType t => TreePos t a -> Forest a
- toTree :: TreePos Full a -> Tree a
- parent :: PosType t => TreePos t a -> Maybe (TreePos Full a)
- root :: TreePos Full a -> TreePos Full a
- prevSpace :: TreePos Full a -> TreePos Empty a
- prevTree :: TreePos Empty a -> Maybe (TreePos Full a)
- prev :: PosType t => TreePos t a -> Maybe (TreePos t a)
- first :: TreePos Empty a -> TreePos Empty a
- spaceAt :: Int -> TreePos Empty a -> TreePos Empty a
- nextSpace :: TreePos Full a -> TreePos Empty a
- nextTree :: TreePos Empty a -> Maybe (TreePos Full a)
- next :: PosType t => TreePos t a -> Maybe (TreePos t a)
- last :: TreePos Empty a -> TreePos Empty a
- children :: TreePos Full a -> TreePos Empty a
- firstChild :: TreePos Full a -> Maybe (TreePos Full a)
- lastChild :: TreePos Full a -> Maybe (TreePos Full a)
- childAt :: Int -> TreePos Full a -> Maybe (TreePos Full a)
- isRoot :: PosType t => TreePos t a -> Bool
- isFirst :: PosType t => TreePos t a -> Bool
- isLast :: PosType t => TreePos t a -> Bool
- isLeaf :: TreePos Full a -> Bool
- isContained :: PosType t => TreePos t a -> Bool
- hasChildren :: TreePos Full a -> Bool
- insert :: Tree a -> TreePos Empty a -> TreePos Full a
- delete :: TreePos Full a -> TreePos Empty a
- setTree :: Tree a -> TreePos Full a -> TreePos Full a
- modifyTree :: (Tree a -> Tree a) -> TreePos Full a -> TreePos Full a
- modifyLabel :: (a -> a) -> TreePos Full a -> TreePos Full a
- setLabel :: a -> TreePos Full a -> TreePos Full a
Documentation
Position which does not point to a tree (e.g., it is between two trees).
Position which points to a tree.
Context
forest :: PosType t => TreePos t a -> Forest aSource
All trees at this location (i.e., the current tree---if any---and its siblings).
parents :: PosType t => TreePos t a -> [(Forest a, a, Forest a)]Source
The contexts of the parents for this position.
Conversions
fromForest :: Forest a -> TreePos Empty aSource
The location at the beginning of the forest.
Moving around
spaceAt :: Int -> TreePos Empty a -> TreePos Empty aSource
The empty space at the given index. The first space is at index 0. For indexes that are negative or too large, we return the first and last position in the tree, respectively.
children :: TreePos Full a -> TreePos Empty aSource
The location at the beginning of the forest of children.
childAt :: Int -> TreePos Full a -> Maybe (TreePos Full a)Source
The child at the given index in the tree. The first child is at index 0.
Node classification
isFirst :: PosType t => TreePos t a -> BoolSource
Are we the first position (of its kind) in a forest.
isContained :: PosType t => TreePos t a -> BoolSource
Do we have a parent?
hasChildren :: TreePos Full a -> BoolSource
Do we have children?
Working with the current tree
insert :: Tree a -> TreePos Empty a -> TreePos Full aSource
Insert a new tree at the current position.