{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE ExplicitNamespaces #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE TypeOperators #-}
module Control.Concurrent.Class.MonadSTM.Strict.TQueue
(
StrictTQueue
, LazyTQueue
, toLazyTQueue
, fromLazyTQueue
, castStrictTQueue
, newTQueue
, newTQueueIO
, readTQueue
, tryReadTQueue
, peekTQueue
, tryPeekTQueue
, flushTQueue
, writeTQueue
, unGetTQueue
, isEmptyTQueue
, labelTQueue
, labelTQueueIO
, traceTQueue
, traceTQueueIO
) where
import qualified Control.Concurrent.Class.MonadSTM.TQueue as Lazy
import Control.Monad.Class.MonadSTM hiding (traceTQueue, traceTQueueIO)
type LazyTQueue m = Lazy.TQueue m
newtype StrictTQueue m a = StrictTQueue { forall (m :: * -> *) a. StrictTQueue m a -> LazyTQueue m a
toLazyTQueue :: LazyTQueue m a }
fromLazyTQueue :: LazyTQueue m a -> StrictTQueue m a
fromLazyTQueue :: forall (m :: * -> *) a. LazyTQueue m a -> StrictTQueue m a
fromLazyTQueue = forall (m :: * -> *) a. LazyTQueue m a -> StrictTQueue m a
StrictTQueue
castStrictTQueue :: LazyTQueue m ~ LazyTQueue n
=> StrictTQueue m a -> StrictTQueue n a
castStrictTQueue :: forall (m :: * -> *) (n :: * -> *) a.
(LazyTQueue m ~ LazyTQueue n) =>
StrictTQueue m a -> StrictTQueue n a
castStrictTQueue (StrictTQueue LazyTQueue m a
var) = forall (m :: * -> *) a. LazyTQueue m a -> StrictTQueue m a
StrictTQueue LazyTQueue m a
var
labelTQueue :: MonadLabelledSTM m => StrictTQueue m a -> String -> STM m ()
labelTQueue :: forall (m :: * -> *) a.
MonadLabelledSTM m =>
StrictTQueue m a -> String -> STM m ()
labelTQueue (StrictTQueue LazyTQueue m a
queue) = forall (m :: * -> *) a.
MonadLabelledSTM m =>
TQueue m a -> String -> STM m ()
Lazy.labelTQueue LazyTQueue m a
queue
labelTQueueIO :: MonadLabelledSTM m => StrictTQueue m a -> String -> m ()
labelTQueueIO :: forall (m :: * -> *) a.
MonadLabelledSTM m =>
StrictTQueue m a -> String -> m ()
labelTQueueIO (StrictTQueue LazyTQueue m a
queue) = forall (m :: * -> *) a.
MonadLabelledSTM m =>
TQueue m a -> String -> m ()
Lazy.labelTQueueIO LazyTQueue m a
queue
traceTQueue :: MonadTraceSTM m
=> proxy m
-> StrictTQueue m a
-> ((Maybe [a]) -> [a] -> InspectMonad m TraceValue)
-> STM m ()
traceTQueue :: forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> StrictTQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
traceTQueue proxy m
p (StrictTQueue LazyTQueue m a
queue) = forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
Lazy.traceTQueue proxy m
p LazyTQueue m a
queue
traceTQueueIO :: MonadTraceSTM m
=> StrictTQueue m a
-> ((Maybe [a]) -> [a] -> InspectMonad m TraceValue)
-> m ()
traceTQueueIO :: forall (m :: * -> *) a.
MonadTraceSTM m =>
StrictTQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> m ()
traceTQueueIO (StrictTQueue LazyTQueue m a
queue) = forall (m :: * -> *) a.
MonadTraceSTM m =>
TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> m ()
Lazy.traceTQueueIO LazyTQueue m a
queue
newTQueue :: MonadSTM m => STM m (StrictTQueue m a)
newTQueue :: forall (m :: * -> *) a. MonadSTM m => STM m (StrictTQueue m a)
newTQueue = forall (m :: * -> *) a. LazyTQueue m a -> StrictTQueue m a
StrictTQueue forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (m :: * -> *) a. MonadSTM m => STM m (TQueue m a)
Lazy.newTQueue
newTQueueIO :: MonadSTM m => m (StrictTQueue m a)
newTQueueIO :: forall (m :: * -> *) a. MonadSTM m => m (StrictTQueue m a)
newTQueueIO = forall (m :: * -> *) a.
(MonadSTM m, HasCallStack) =>
STM m a -> m a
atomically forall (m :: * -> *) a. MonadSTM m => STM m (StrictTQueue m a)
newTQueue
readTQueue :: MonadSTM m => StrictTQueue m a -> STM m a
readTQueue :: forall (m :: * -> *) a. MonadSTM m => StrictTQueue m a -> STM m a
readTQueue = forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
Lazy.readTQueue forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. StrictTQueue m a -> LazyTQueue m a
toLazyTQueue
tryReadTQueue :: MonadSTM m => StrictTQueue m a -> STM m (Maybe a)
tryReadTQueue :: forall (m :: * -> *) a.
MonadSTM m =>
StrictTQueue m a -> STM m (Maybe a)
tryReadTQueue = forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
Lazy.tryReadTQueue forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. StrictTQueue m a -> LazyTQueue m a
toLazyTQueue
peekTQueue :: MonadSTM m => StrictTQueue m a -> STM m a
peekTQueue :: forall (m :: * -> *) a. MonadSTM m => StrictTQueue m a -> STM m a
peekTQueue = forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
Lazy.peekTQueue forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. StrictTQueue m a -> LazyTQueue m a
toLazyTQueue
tryPeekTQueue :: MonadSTM m => StrictTQueue m a -> STM m (Maybe a)
tryPeekTQueue :: forall (m :: * -> *) a.
MonadSTM m =>
StrictTQueue m a -> STM m (Maybe a)
tryPeekTQueue = forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
Lazy.tryPeekTQueue forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. StrictTQueue m a -> LazyTQueue m a
toLazyTQueue
flushTQueue :: MonadSTM m => StrictTQueue m a -> STM m [a]
flushTQueue :: forall (m :: * -> *) a. MonadSTM m => StrictTQueue m a -> STM m [a]
flushTQueue = forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m [a]
Lazy.flushTQueue forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. StrictTQueue m a -> LazyTQueue m a
toLazyTQueue
writeTQueue :: MonadSTM m => StrictTQueue m a -> a -> STM m ()
writeTQueue :: forall (m :: * -> *) a.
MonadSTM m =>
StrictTQueue m a -> a -> STM m ()
writeTQueue (StrictTQueue LazyTQueue m a
tqueue) !a
a = forall (m :: * -> *) a. MonadSTM m => TQueue m a -> a -> STM m ()
Lazy.writeTQueue LazyTQueue m a
tqueue a
a
isEmptyTQueue :: MonadSTM m => StrictTQueue m a -> STM m Bool
isEmptyTQueue :: forall (m :: * -> *) a.
MonadSTM m =>
StrictTQueue m a -> STM m Bool
isEmptyTQueue = forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m Bool
Lazy.isEmptyTQueue forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. StrictTQueue m a -> LazyTQueue m a
toLazyTQueue
unGetTQueue :: MonadSTM m => StrictTQueue m a -> a -> STM m ()
unGetTQueue :: forall (m :: * -> *) a.
MonadSTM m =>
StrictTQueue m a -> a -> STM m ()
unGetTQueue (StrictTQueue LazyTQueue m a
queue) !a
a = forall (m :: * -> *) a. MonadSTM m => TQueue m a -> a -> STM m ()
Lazy.unGetTQueue LazyTQueue m a
queue a
a