{-# 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 Control.Concurrent.Class.MonadSTM.TQueue qualified 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 = LazyTQueue m a -> StrictTQueue m a
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) = LazyTQueue n a -> StrictTQueue n a
forall (m :: * -> *) a. LazyTQueue m a -> StrictTQueue m a
StrictTQueue LazyTQueue m a
LazyTQueue n 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) = LazyTQueue m a -> String -> STM m ()
forall a. TQueue m a -> String -> STM m ()
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) = LazyTQueue m a -> String -> m ()
forall a. TQueue m a -> String -> m ()
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) = proxy m
-> LazyTQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
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) = LazyTQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> m ()
forall a.
TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> m ()
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 = LazyTQueue m a -> StrictTQueue m a
forall (m :: * -> *) a. LazyTQueue m a -> StrictTQueue m a
StrictTQueue (LazyTQueue m a -> StrictTQueue m a)
-> STM m (LazyTQueue m a) -> STM m (StrictTQueue m a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> STM m (LazyTQueue m a)
forall a. STM m (TQueue m a)
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 = STM m (StrictTQueue m a) -> m (StrictTQueue m a)
forall a. HasCallStack => STM m a -> m a
forall (m :: * -> *) a.
(MonadSTM m, HasCallStack) =>
STM m a -> m a
atomically STM m (StrictTQueue m a)
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 = TQueue m a -> STM m a
forall a. TQueue m a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
Lazy.readTQueue (TQueue m a -> STM m a)
-> (StrictTQueue m a -> TQueue m a) -> StrictTQueue m a -> STM m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. StrictTQueue m a -> TQueue m a
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 = TQueue m a -> STM m (Maybe a)
forall a. TQueue m a -> STM m (Maybe a)
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
Lazy.tryReadTQueue (TQueue m a -> STM m (Maybe a))
-> (StrictTQueue m a -> TQueue m a)
-> StrictTQueue m a
-> STM m (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. StrictTQueue m a -> TQueue m a
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 = TQueue m a -> STM m a
forall a. TQueue m a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
Lazy.peekTQueue (TQueue m a -> STM m a)
-> (StrictTQueue m a -> TQueue m a) -> StrictTQueue m a -> STM m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. StrictTQueue m a -> TQueue m a
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 = TQueue m a -> STM m (Maybe a)
forall a. TQueue m a -> STM m (Maybe a)
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
Lazy.tryPeekTQueue (TQueue m a -> STM m (Maybe a))
-> (StrictTQueue m a -> TQueue m a)
-> StrictTQueue m a
-> STM m (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. StrictTQueue m a -> TQueue m a
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 = TQueue m a -> STM m [a]
forall a. TQueue m a -> STM m [a]
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m [a]
Lazy.flushTQueue (TQueue m a -> STM m [a])
-> (StrictTQueue m a -> TQueue m a)
-> StrictTQueue m a
-> STM m [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. StrictTQueue m a -> TQueue m a
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 = LazyTQueue m a -> a -> STM m ()
forall a. TQueue m a -> a -> STM m ()
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 = TQueue m a -> STM m Bool
forall a. TQueue m a -> STM m Bool
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m Bool
Lazy.isEmptyTQueue (TQueue m a -> STM m Bool)
-> (StrictTQueue m a -> TQueue m a)
-> StrictTQueue m a
-> STM m Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. StrictTQueue m a -> TQueue m a
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 = LazyTQueue m a -> a -> STM m ()
forall a. TQueue m a -> a -> STM m ()
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> a -> STM m ()
Lazy.unGetTQueue LazyTQueue m a
queue a
a