Safe Haskell | Safe |
---|---|

Language | Haskell2010 |

A transactional priority queue, based on a Finger Tree.

- data TPQueue k v
- newTPQueue :: Ord k => STM (TPQueue k v)
- newTPQueueIO :: Ord k => IO (TPQueue k v)
- writeTPQueue :: Ord k => TPQueue k v -> k -> v -> STM ()
- readTPQueue :: Ord k => TPQueue k v -> STM v
- tryReadTPQueue :: Ord k => TPQueue k v -> STM (Maybe v)
- peekTPQueue :: Ord k => TPQueue k v -> STM v
- tryPeekTPQueue :: Ord k => TPQueue k v -> STM (Maybe v)
- isEmptyTPQueue :: Ord k => TPQueue k v -> STM Bool

# Documentation

newTPQueueIO :: Ord k => IO (TPQueue k v) Source #

IO version of `newTPQueue`

. This is useful for creating top-level
`TPQueues`

using `unsafePerformIO`

, because using `atomically`

inside
`unsafePerformIO`

isn't possible.

tryReadTPQueue :: Ord k => TPQueue k v -> STM (Maybe v) Source #

A version of `readTPQueue`

that does not retry, but returns `Nothing`

instead if no value is available.

peekTPQueue :: Ord k => TPQueue k v -> STM v Source #

Get the next minimal value from a `TPQueue`

without removing it.

tryPeekTPQueue :: Ord k => TPQueue k v -> STM (Maybe v) Source #

A version of `peekTPQueue`

that does not retry, but returns `Nothing`

instead if no value is available.