- class Monad m => Enqueue q m a | q -> a where
- class Monad m => Dequeue q m a | q -> a where
- class Monad m => DequeueWhere q m a | q -> a where
- class Monad m => PeekQueue q m a | q -> a where
- class Monad m => QueueSize q m where
- data PQ a
- emptyPQ :: Ord p => (a -> p) -> PQ a
- mkPriorityQueue :: ModifyRef sr m (PQ a) => sr -> PriorityQueue m a
- mkDefaultPriorityQueue :: Ref m (PQ a) -> PriorityQueue m a
- data PriorityQueue m a
- newPriorityQueue :: (Monad m, HasRef m1, NewRef (Ref m1 (PQ a)) m (PQ a), Ord p) => (a -> p) -> m (PriorityQueue m1 a)
- newPriorityQueueBy :: (Monad m, HasRef m1, NewRef (Ref m1 (PQ a)) m (PQ a)) => (a -> a -> Ordering) -> m (PriorityQueue m1 a)
enqueue :: q -> a -> m ()
Put an item into a queue. May block while trying to do so.
No constraint is placed on the behavior of the queue except that
every item put in really ought to come out sometime before
dequeue returns a
enqueueBatch :: q -> [a] -> m ()
dequeueBatch :: q -> m [a]
Pull an item matching the given predicate out of a queue.
peekQueue :: q -> m [a]
return the whole contents of the queue (if possible) without altering the queue's contents. Obviously in cases where this can't be done lazily this can be a very expensive operation.
peek a specified number of items off the queue. The default implementation is hideously wasteful in cases where peekQueue is not able to get the contents lazily.
Build a priority queue from a modifiable reference containing
Build a priority queue using an instance of the default modifiable reference for the requested monad and value type
A priority queue usable in the monad
m with values of type
Construct a new priority queue using the specified indexing function