manatee-core-0.0.2: The core of Manatee.

Manatee.Toolkit.Data.ListZipper

Synopsis

Documentation

data ListZipper a Source

Constructors

ListZipper ![a] ![a] 

Instances

empty :: ListZipper aSource

Create an empty ListZipper.

singleton :: a -> ListZipper aSource

Create a ListZipper with a single element.

fromList :: [a] -> ListZipper aSource

Create a ListZipper from list, and focus focus to first element in list.

fromListEnd :: [a] -> ListZipper aSource

Create a ListZipper from list end, and focus focus to end element in list.

toList :: ListZipper a -> [a]Source

Convert ListZipper to List.

atStart :: ListZipper a -> BoolSource

Whether is first element.

atEnd :: ListZipper a -> BoolSource

Whether is last element.

isEmpty :: ListZipper a -> BoolSource

Whether is empty.

getCurrent :: ListZipper a -> Maybe aSource

Get current node, return Nothing if haven't found anything at current node. This function won't change current focus node.

getLeft :: ListZipper a -> Maybe aSource

Get left node, return Nothing if haven't found anything at left node. This function won't change current focus node.

getRight :: ListZipper a -> Maybe aSource

Get right node, return Nothing if haven't found anything at right node. This function won't change current focus node.

getFirst :: ListZipper a -> Maybe aSource

Get first node, return Nothing if haven't found anything at first node. This function won't change current focus node.

getLast :: ListZipper a -> Maybe aSource

Get last node, return Nothing if haven't found anything at last node. This function won't change current focus node.

getLeftCircular :: ListZipper a -> Maybe aSource

Get left node, return Nothing if haven't found anything at left node. If reach first node, circular to end node. This function won't change current focus node.

getRightCircular :: ListZipper a -> Maybe aSource

Get right node, return Nothing if haven't found anything at right node. If reach last node, circular to first node. This function won't change current focus node.

get :: ListZipper a -> Int -> Maybe aSource

Get node with given index. This function won't change current focus node.

focusLeft :: ListZipper a -> Maybe (ListZipper a)Source

Focus left node.

focusRight :: ListZipper a -> Maybe (ListZipper a)Source

Focus right node.

focusFirst :: ListZipper a -> Maybe (ListZipper a)Source

Focus first node.

focusLast :: ListZipper a -> Maybe (ListZipper a)Source

Focus last node.

focus :: Int -> ListZipper a -> Maybe (ListZipper a)Source

Focus node with given index.

focusNode :: Eq a => a -> ListZipper a -> Maybe (ListZipper a)Source

Focus node.

insertLeft :: a -> ListZipper a -> ListZipper aSource

Insert node to right side and keep current focus.

insertRight :: a -> ListZipper a -> ListZipper aSource

Insert node to left side and keep current focus. Except it will focus first element when list is empty.

insertFirst :: a -> ListZipper a -> ListZipper aSource

Insert node to first and keep current focus.

insertLast :: a -> ListZipper a -> ListZipper aSource

Insert node to last end and keep current focus.

delete :: ListZipper a -> Maybe (ListZipper a)Source

Delete current node and focus focus right node.

deleteLeft :: ListZipper a -> Maybe (ListZipper a)Source

Delete left node and keep current focus.

deleteRight :: ListZipper a -> Maybe (ListZipper a)Source

Delete right node and keep current focus.

deleteFirst :: ListZipper a -> Maybe (ListZipper a)Source

Delete first node and keep current focus.

deleteLast :: ListZipper a -> Maybe (ListZipper a)Source

Delete last node and keep current focus.

deleteOthers :: ListZipper a -> Maybe (ListZipper a)Source

Delete other node except current node.

deleteNode :: Eq a => a -> ListZipper a -> Maybe (ListZipper a)Source

Delete specify node.

swapLeft :: ListZipper a -> Maybe (ListZipper a)Source

Swap with left node, and focus swap node.

swapRight :: ListZipper a -> Maybe (ListZipper a)Source

Swap with right node, and focus swap node.

replace :: a -> ListZipper a -> Maybe (ListZipper a)Source

Replace current node.

length :: ListZipper a -> IntSource

Get length.

currentIndex :: ListZipper a -> IntSource

Get current index.

leftIndex :: ListZipper a -> IntSource

Get left index.

rightIndex :: ListZipper a -> IntSource

Get right index.

firstIndex :: ListZipper a -> IntSource

Get first index.

lastIndex :: ListZipper a -> IntSource

Get last index.