Copyright | (c) Masahiro Sakai 2012 |
---|---|
License | BSD-style |
Maintainer | masahiro.sakai@gmail.com |
Stability | provisional |
Portability | non-portable (FlexibleInstances, MultiParamTypeClasses) |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Queue implemented using IORef and Sequence.
- data SeqQueue a
- class Monad m => NewFifo q m where
- newFifo :: m q
- class Monad m => Enqueue q m a | q -> a where
- enqueue :: q -> a -> m ()
- enqueueBatch :: q -> [a] -> m ()
- class Monad m => Dequeue q m a | q -> a where
- dequeue :: q -> m (Maybe a)
- dequeueBatch :: q -> m [a]
- class Monad m => QueueSize q m where
- clear :: SeqQueue a -> IO ()
SeqQueue type
Constructors
Operators
class Monad m => Enqueue q m a | q -> a where
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 Nothing
.
enqueueBatch :: q -> [a] -> m ()
class Monad m => Dequeue q m a | q -> a where
Pull an item out of a queue. Should not block. No ordering
constraints are implied other than that any item that went into
the queue "really ought to" come out before dequeue
returns
Nothing
.
dequeueBatch :: q -> m [a]