Copyright | Copyright (c) 2009-2017 David Sorokin <david.sorokin@gmail.com> |
---|---|
License | BSD3 |
Maintainer | David Sorokin <david.sorokin@gmail.com> |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Tested with: GHC 8.0.1
An imperative double-linked list.
Synopsis
- data DoubleLinkedList a
- listNull :: DoubleLinkedList a -> IO Bool
- listCount :: DoubleLinkedList a -> IO Int
- newList :: IO (DoubleLinkedList a)
- listInsertFirst :: DoubleLinkedList a -> a -> IO ()
- listAddLast :: DoubleLinkedList a -> a -> IO ()
- listRemoveFirst :: DoubleLinkedList a -> IO ()
- listRemoveLast :: DoubleLinkedList a -> IO ()
- listRemove :: Eq a => DoubleLinkedList a -> a -> IO Bool
- listRemoveBy :: DoubleLinkedList a -> (a -> Bool) -> IO (Maybe a)
- listContains :: Eq a => DoubleLinkedList a -> a -> IO Bool
- listContainsBy :: DoubleLinkedList a -> (a -> Bool) -> IO (Maybe a)
- listFirst :: DoubleLinkedList a -> IO a
- listLast :: DoubleLinkedList a -> IO a
- clearList :: DoubleLinkedList a -> IO ()
- freezeList :: DoubleLinkedList a -> IO [a]
Documentation
data DoubleLinkedList a Source #
The DoubleLinkedList
type represents an imperative double-linked list.
newList :: IO (DoubleLinkedList a) Source #
Create a new list.
listInsertFirst :: DoubleLinkedList a -> a -> IO () Source #
Insert a new element in the beginning.
listAddLast :: DoubleLinkedList a -> a -> IO () Source #
Add a new element to the end.
listRemoveFirst :: DoubleLinkedList a -> IO () Source #
Remove the first element.
listRemoveLast :: DoubleLinkedList a -> IO () Source #
Remove the last element.
listRemove :: Eq a => DoubleLinkedList a -> a -> IO Bool Source #
Remove the specified element from the list and return a flag indicating whether the element was found and removed.
listRemoveBy :: DoubleLinkedList a -> (a -> Bool) -> IO (Maybe a) Source #
Remove an element satisfying the specified predicate and return the element if found.
listContains :: Eq a => DoubleLinkedList a -> a -> IO Bool Source #
Detect whether the specified element is contained in the list.
listContainsBy :: DoubleLinkedList a -> (a -> Bool) -> IO (Maybe a) Source #
Detect whether an element satisfying the specified predicate is contained in the list.
listFirst :: DoubleLinkedList a -> IO a Source #
Return the first element.
listLast :: DoubleLinkedList a -> IO a Source #
Return the last element.
clearList :: DoubleLinkedList a -> IO () Source #
Clear the contents of the list.
freezeList :: DoubleLinkedList a -> IO [a] Source #
Freeze the list and return its contents.