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 heap-based priority queue to implement the event queue.
Synopsis
- data PriorityQueue a
- type Priority = Int
- queueNull :: PriorityQueue a -> IO Bool
- queueCount :: PriorityQueue a -> IO Int
- newQueue :: IO (PriorityQueue a)
- enqueue :: PriorityQueue a -> Double -> Priority -> a -> IO ()
- dequeue :: PriorityQueue a -> IO ()
- queueFront :: PriorityQueue a -> IO (Double, Priority, a)
Documentation
data PriorityQueue a Source #
The PriorityQueue
type represents an imperative heap-based
priority queue.
queueCount :: PriorityQueue a -> IO Int Source #
Return the number of elements in the priority queue.
newQueue :: IO (PriorityQueue a) Source #
Create a new priority queue.
enqueue :: PriorityQueue a -> Double -> Priority -> a -> IO () Source #
Enqueue a new element with the specified priority.
dequeue :: PriorityQueue a -> IO () Source #
Dequeue the element with the minimal priority.
queueFront :: PriorityQueue a -> IO (Double, Priority, a) Source #
Return the element with the minimal priority.