abstract-deque-0.3: Abstract, parameterized interface to mutable Deques.

Safe Haskell | Safe-Inferred
Language | Haskell98

Data.Concurrent.Deque.Reference

Description

A strawman implementation of concurrent Dequeues. This implementation is so simple that it also makes a good reference implementation for debugging.

The queue representation is simply an IORef containing a Data.Sequence.

Also see Data.Concurrent.Deque.Reference.DequeInstance. By convention a module of this name is also provided.

Synopsis

- data SimpleDeque elt = DQ !Int !(IORef (Seq elt))
- newQ :: IO (SimpleDeque elt)
- nullQ :: SimpleDeque elt -> IO Bool
- newBoundedQ :: Int -> IO (SimpleDeque elt)
- pushL :: SimpleDeque t -> t -> IO ()
- pushR :: SimpleDeque t -> t -> IO ()
- tryPopR :: SimpleDeque a -> IO (Maybe a)
- tryPopL :: SimpleDeque a -> IO (Maybe a)
- tryPushL :: SimpleDeque a -> a -> IO Bool
- tryPushR :: SimpleDeque a -> a -> IO Bool
- _is_using_CAS :: Bool

# Documentation

data SimpleDeque elt Source #

Stores a size bound (if any) as well as a mutable Seq.

Constructors

DQ !Int !(IORef (Seq elt)) |

#### Instances

Instances details

BoundedL SimpleDeque Source # |
Instance details Defined in Data.Concurrent.Deque.Reference Methods newBoundedQ :: Int -> IO (SimpleDeque elt) Source # tryPushL :: SimpleDeque elt -> elt -> IO Bool Source #
BoundedR SimpleDeque Source # |
Instance details Defined in Data.Concurrent.Deque.Reference Methods tryPushR :: SimpleDeque elt -> elt -> IO Bool Source #
DequeClass SimpleDeque Source # |
Instance details Defined in Data.Concurrent.Deque.Reference Methods newQ :: IO (SimpleDeque elt) Source # nullQ :: SimpleDeque elt -> IO Bool Source # pushL :: SimpleDeque elt -> elt -> IO () Source # tryPopR :: SimpleDeque elt -> IO (Maybe elt) Source # leftThreadSafe :: SimpleDeque elt -> Bool Source # rightThreadSafe :: SimpleDeque elt -> Bool Source #
PopL SimpleDeque Source # |
Instance details Defined in Data.Concurrent.Deque.Reference Methods tryPopL :: SimpleDeque elt -> IO (Maybe elt) Source #
PushR SimpleDeque Source # |
Instance details Defined in Data.Concurrent.Deque.Reference Methods pushR :: SimpleDeque elt -> elt -> IO () Source #

newQ :: IO (SimpleDeque elt) Source #

nullQ :: SimpleDeque elt -> IO Bool Source #

newBoundedQ :: Int -> IO (SimpleDeque elt) Source #

pushL :: SimpleDeque t -> t -> IO () Source #

pushR :: SimpleDeque t -> t -> IO () Source #

tryPopR :: SimpleDeque a -> IO (Maybe a) Source #

tryPopL :: SimpleDeque a -> IO (Maybe a) Source #

tryPushL :: SimpleDeque a -> a -> IO Bool Source #

tryPushR :: SimpleDeque a -> a -> IO Bool Source #

_is_using_CAS :: Bool Source #