-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | An implementation of a real-time concurrent queue
--
-- An implementation of a real-time concurrent queue.
@package stm-queue
@version 0.1.2.2
module Data.Queue
-- | Real time Queue backed by transactional variables
-- (TVars)
data Queue a
-- | Create a new, empty Queue
newQueue :: STM (Queue a)
-- | Peek at the top of the Queue, returning the top element.
peek :: Queue a -> STM a
-- | Try to peek for the top item of the Queue. This function
-- is offered to easily port from the TQueue offered in the stm
-- package, but is not the intended usage of the library.
tryPeek :: Queue a -> STM (Maybe a)
-- | Enqueue a single item onto the Queue.
enqueue :: Queue a -> a -> STM ()
-- | Dequeue a single item onto the Queue, retrying if there
-- is nothing there. This is the motivating use case of this library,
-- allowing a thread to register its interest in the head of a
-- Queue and be woken up by the runtime system to read from the
-- top of that Queue when an item has been made available.
dequeue :: Queue a -> STM a
-- | Try to dequeue a single item. This function is offered to allow
-- users to easily port from the TQueue offered in the stm
-- package, but is not the intended usage of the library.
tryDequeue :: Queue a -> STM (Maybe a)
-- | Efficiently read the entire contents of a Queue into a list.
flush :: Queue a -> STM [a]