|
Data.Queue | Portability | portable | Stability | experimental | Maintainer | libraries@haskell.org |
|
|
|
|
|
Description |
Queues with constant time operations, from
Simple and efficient purely functional queues and deques,
by Chris Okasaki, JFP 5(4):583-592, October 1995.
|
|
Synopsis |
|
|
|
Documentation |
|
data Queue a |
The type of FIFO queues.
| Instances | |
|
|
Primitive operations
|
|
Each of these requires O(1) time in the worst case.
|
|
emptyQueue :: Queue a |
The empty queue.
|
|
addToQueue :: Queue a -> a -> Queue a |
Add an element to the back of a queue.
|
|
deQueue :: Queue a -> Maybe (a, Queue a) |
Attempt to extract the front element from a queue.
If the queue is empty, Nothing,
otherwise the first element paired with the remainder of the queue.
|
|
Queues and lists
|
|
listToQueue :: [a] -> Queue a |
A queue with the same elements as the list.
|
|
queueToList :: Queue a -> [a] |
The elements of a queue, front first.
|
|
Produced by Haddock version 0.7 |