cursor-0.1.0.1: Purely Functional Cursors

Safe HaskellNone
LanguageHaskell2010

Cursor.Simple.Forest

Synopsis

Documentation

forestCursorSwapPrev :: ForestCursor a b -> Maybe (ForestCursor a b) Source #

Swaps the current node with the previous node on the same level

Example:

Before:

- a
- b <--

After:

- b <--
- a

forestCursorSwapNext :: ForestCursor a b -> Maybe (ForestCursor a b) Source #

Swaps the current node with the next node on the same level

Example:

Before:

- a <--
- b

After:

- b
- a <--

forestCursorDemoteElemUnder :: b -> b -> ForestCursor a b -> ForestCursor 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:

 - a <--
   |- b

After:

 - <given element 1>
   |- a <--
 - <given element 2>
   |- b

forestCursorDemoteSubTreeUnder :: b -> ForestCursor a b -> ForestCursor 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

data CTree a Source #

Constructors

CNode !a (CForest a) 
Instances
Functor CTree Source # 
Instance details

Defined in Cursor.Tree.Types

Methods

fmap :: (a -> b) -> CTree a -> CTree b #

(<$) :: a -> CTree b -> CTree a #

Eq a => Eq (CTree a) Source # 
Instance details

Defined in Cursor.Tree.Types

Methods

(==) :: CTree a -> CTree a -> Bool #

(/=) :: CTree a -> CTree a -> Bool #

Show a => Show (CTree a) Source # 
Instance details

Defined in Cursor.Tree.Types

Methods

showsPrec :: Int -> CTree a -> ShowS #

show :: CTree a -> String #

showList :: [CTree a] -> ShowS #

Generic (CTree a) Source # 
Instance details

Defined in Cursor.Tree.Types

Associated Types

type Rep (CTree a) :: Type -> Type #

Methods

from :: CTree a -> Rep (CTree a) x #

to :: Rep (CTree a) x -> CTree a #

Validity a => Validity (CTree a) Source # 
Instance details

Defined in Cursor.Tree.Types

Methods

validate :: CTree a -> Validation #

type Rep (CTree a) Source # 
Instance details

Defined in Cursor.Tree.Types

type Rep (CTree a) = D1 (MetaData "CTree" "Cursor.Tree.Types" "cursor-0.1.0.1-B4Ve9845sGB2dEksN2X1wh" False) (C1 (MetaCons "CNode" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 a) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (CForest a))))

cTree :: Bool -> Tree a -> CTree a Source #

data CForest a Source #

Instances
Functor CForest Source # 
Instance details

Defined in Cursor.Tree.Types

Methods

fmap :: (a -> b) -> CForest a -> CForest b #

(<$) :: a -> CForest b -> CForest a #

Eq a => Eq (CForest a) Source # 
Instance details

Defined in Cursor.Tree.Types

Methods

(==) :: CForest a -> CForest a -> Bool #

(/=) :: CForest a -> CForest a -> Bool #

Show a => Show (CForest a) Source # 
Instance details

Defined in Cursor.Tree.Types

Methods

showsPrec :: Int -> CForest a -> ShowS #

show :: CForest a -> String #

showList :: [CForest a] -> ShowS #

Generic (CForest a) Source # 
Instance details

Defined in Cursor.Tree.Types

Associated Types

type Rep (CForest a) :: Type -> Type #

Methods

from :: CForest a -> Rep (CForest a) x #

to :: Rep (CForest a) x -> CForest a #

Validity a => Validity (CForest a) Source # 
Instance details

Defined in Cursor.Tree.Types

Methods

validate :: CForest a -> Validation #

type Rep (CForest a) Source # 
Instance details

Defined in Cursor.Tree.Types

type Rep (CForest a) = D1 (MetaData "CForest" "Cursor.Tree.Types" "cursor-0.1.0.1-B4Ve9845sGB2dEksN2X1wh" False) (C1 (MetaCons "EmptyCForest" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "ClosedForest" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (NonEmpty (Tree a)))) :+: C1 (MetaCons "OpenForest" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (NonEmpty (CTree a))))))