Safe Haskell | None |
---|---|
Language | Haskell2010 |
Cursor.Tree.Demote
Synopsis
- treeCursorDemoteElem :: (a -> b) -> (b -> a) -> TreeCursor a b -> DemoteResult (TreeCursor a b)
- treeCursorDemoteSubTree :: (a -> b) -> (b -> a) -> TreeCursor a b -> DemoteResult (TreeCursor a b)
- data DemoteResult a
- treeCursorDemoteElemUnder :: b -> b -> TreeCursor a b -> Maybe (TreeCursor a b)
- treeCursorDemoteSubTreeUnder :: b -> TreeCursor a b -> TreeCursor a b
Documentation
treeCursorDemoteElem :: (a -> b) -> (b -> a) -> TreeCursor a b -> DemoteResult (TreeCursor a b) Source #
Demotes the current node to the level of its children.
Example:
Before:
p |- a | |- b |- c <-- | |- d |- e
After:
p |- a | |- b | |- c <-- | |- d |- e
treeCursorDemoteSubTree :: (a -> b) -> (b -> a) -> TreeCursor a b -> DemoteResult (TreeCursor a b) Source #
Demotes the current subtree to the level of its children.
Example:
Before:
p |- a | |- b |- c <-- | |- d |- e
After:
p |- a | |- b | |- c <-- | |- d |- e
data DemoteResult a Source #
Constructors
CannotDemoteTopNode | |
NoSiblingsToDemoteUnder | |
Demoted a |
Instances
treeCursorDemoteElemUnder :: b -> b -> TreeCursor a b -> Maybe (TreeCursor a b) Source #
Demotes the current node to the level of its children, by adding two roots. One for the current node and one for its children that are left behind.
Example:
Before:
p |- a <-- |- b
After:
p |- <given element 1> | |- a <-- |- <given element 2> | |- b
treeCursorDemoteSubTreeUnder :: b -> TreeCursor a b -> TreeCursor a b Source #
Demotes the current subtree to the level of its children, by adding a root.
Example:
Before:
a <-- |- b
After:
<given element> |- a <-- |- b