-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Nested set model implementation
--
-- This package is a general purpose implementation of nested sets in
-- Haskell.
--
-- Supported functionality includes:
--
--
-- - conversion from and to Forest structure from Data.Tree;
-- - position support with moving to parent, sibling and child
-- nodes.
--
@package nested-sets
@version 0.0.1.1
module Data.NestedSet
type NestedSets a = [NestedSetsNode a]
type Position = (Int, Int)
data NestedSetsNode a
NestedSetsNode :: Position -> a -> NestedSets a -> NestedSetsNode a
position :: NestedSetsNode a -> Position
content :: NestedSetsNode a -> a
children :: NestedSetsNode a -> NestedSets a
-- | Convert forest to nested sets This function is the opposite of
-- nestedSetsToForest
forestToNestedSets :: Forest a -> NestedSets a
-- | Convert nested sets to forest. This function is the opposite of
-- forestToNestedSets
nestedSetsToForest :: NestedSets a -> Forest a
-- | Retrieve the starting position (iterator) of the nested set.
nestedSetsStartPosition :: NestedSets a -> Maybe Position
-- | Advance the given position to the next sibling.
nestedSetsNextSiblingPosition :: NestedSets a -> Position -> Maybe Position
-- | Retrieve the position's parent position.
nestedSetsParentPosition :: NestedSets a -> Position -> Maybe Position
-- | Advance the position to the first child node.
nestedSetsFirstChildPosition :: NestedSets a -> Position -> Maybe Position
-- | Retrieve the value for the given Position.
nestedSetsPositionValue :: NestedSets a -> Position -> Maybe a
-- | Set value for the Position on the given nested set. Does not
-- modify the given NestedSets if the Position cannot be
-- found.
nestedSetsPositionSetValue :: NestedSets a -> Position -> a -> NestedSets a
isNestedSetsPositionParent :: Position -> Position -> Bool
instance Show a => Show (NestedSetsNode a)
instance Eq a => Eq (NestedSetsNode a)