{-# LANGUAGE DeriveFunctor              #-}
{-# LANGUAGE FlexibleContexts           #-}
{-# LANGUAGE FlexibleInstances          #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE KindSignatures             #-}
{-# LANGUAGE MultiParamTypeClasses      #-}
{-# LANGUAGE StandaloneDeriving         #-}
{-# LANGUAGE TypeFamilies               #-}

-- undecidable instances needed for 'ContTSTM' instances of
-- 'MonadThrow' and 'MonadCatch' type classes.
{-# LANGUAGE UndecidableInstances       #-}
{-# OPTIONS_GHC -Wno-orphans            #-}

module Control.Monad.Class.MonadSTM.Trans
  ( ContTSTM (..)) where

import           Control.Monad.Cont (ContT (..))
import           Control.Monad.Except (ExceptT (..), runExceptT)
import           Control.Monad.Trans (lift)
import qualified Control.Monad.RWS.Lazy as Lazy
import qualified Control.Monad.RWS.Strict as Strict
import qualified Control.Monad.State.Lazy as Lazy
import qualified Control.Monad.State.Strict as Strict
import qualified Control.Monad.Writer.Lazy as Lazy
import qualified Control.Monad.Writer.Strict as Strict

import qualified Control.Monad.Class.MonadThrow as MonadThrow
import           Control.Monad.Class.MonadSTM.Internal

import           Data.Array.Base (MArray (..))
import           Data.Function (on)
import           Data.Kind (Type)


-- | A newtype wrapper for an 'STM' monad for 'ContT'
--
newtype ContTSTM r (m :: Type -> Type) a = ContTSTM { forall r (m :: * -> *) a. ContTSTM r m a -> STM m a
getContTSTM :: STM m a }

deriving instance MonadSTM m => Functor     (ContTSTM r m)
deriving instance MonadSTM m => Applicative (ContTSTM r m)
deriving instance MonadSTM m => Monad       (ContTSTM r m)

instance ( Semigroup a, MonadSTM m ) => Semigroup (ContTSTM r m a) where
    ContTSTM r m a
a <> :: ContTSTM r m a -> ContTSTM r m a -> ContTSTM r m a
<> ContTSTM r m a
b = forall a. Semigroup a => a -> a -> a
(<>) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ContTSTM r m a
a forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ContTSTM r m a
b
instance ( Monoid a, MonadSTM m )    => Monoid (ContTSTM r m a) where
    mempty :: ContTSTM r m a
mempty = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a. Monoid a => a
mempty

instance ( MonadSTM m, MArray e a (STM m) ) => MArray e a (ContTSTM r m) where
    getBounds :: forall i. Ix i => e i a -> ContTSTM r m (i, i)
getBounds         = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds
    getNumElements :: forall i. Ix i => e i a -> ContTSTM r m Int
getNumElements    = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements
    unsafeRead :: forall i. Ix i => e i a -> Int -> ContTSTM r m a
unsafeRead e i a
arr    = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead e i a
arr
    unsafeWrite :: forall i. Ix i => e i a -> Int -> a -> ContTSTM r m ()
unsafeWrite e i a
arr Int
i = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite e i a
arr Int
i


-- note: this (and the following) instance requires 'UndecidableInstances'
-- extension because it violates 3rd Paterson condition, however `STM m` will
-- resolve to a concrete type of kind (Type -> Type), and thus no larger than
-- `m` itself, e.g. for `m ~ ReaderT r f`, `STM m ~ WrappedSTM Reader r f`.
-- Instance resolution will terminate as soon as the monad transformer stack
-- depth is exhausted.
instance ( MonadSTM m
         , MonadThrow.MonadThrow (STM m)
         , MonadThrow.MonadCatch (STM m)
         ) => MonadThrow.MonadThrow (ContTSTM r m) where
  throwIO :: forall e a. Exception e => e -> ContTSTM r m a
throwIO = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
MonadThrow.throwIO

instance ( MonadSTM m
         , MonadThrow.MonadThrow (STM m)
         , MonadThrow.MonadCatch (STM m)
         ) => MonadThrow.MonadCatch (ContTSTM r m) where
  catch :: forall e a.
Exception e =>
ContTSTM r m a -> (e -> ContTSTM r m a) -> ContTSTM r m a
catch ContTSTM r m a
action e -> ContTSTM r m a
handler = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM
                       forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) e a.
(MonadCatch m, Exception e) =>
m a -> (e -> m a) -> m a
MonadThrow.catch (forall r (m :: * -> *) a. ContTSTM r m a -> STM m a
getContTSTM ContTSTM r m a
action) (forall r (m :: * -> *) a. ContTSTM r m a -> STM m a
getContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
. e -> ContTSTM r m a
handler)
  generalBracket :: forall a b c.
ContTSTM r m a
-> (a -> ExitCase b -> ContTSTM r m c)
-> (a -> ContTSTM r m b)
-> ContTSTM r m (b, c)
generalBracket ContTSTM r m a
acquire a -> ExitCase b -> ContTSTM r m c
release a -> ContTSTM r m b
use = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall a b. (a -> b) -> a -> b
$
    forall (m :: * -> *) a b c.
MonadCatch m =>
m a -> (a -> ExitCase b -> m c) -> (a -> m b) -> m (b, c)
MonadThrow.generalBracket (forall r (m :: * -> *) a. ContTSTM r m a -> STM m a
getContTSTM    ContTSTM r m a
acquire)
                              (forall r (m :: * -> *) a. ContTSTM r m a -> STM m a
getContTSTM forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: a -> ExitCase b -> ContTSTM r m c
release)
                              (forall r (m :: * -> *) a. ContTSTM r m a -> STM m a
getContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  a -> ContTSTM r m b
use)

-- | @'ContT' r m@ monad is using underlying @'STM' m@ monad as its stm monad,
-- without transforming it.
--
instance MonadSTM m => MonadSTM (ContT r m) where
    type STM (ContT r m) = ContTSTM r m
    atomically :: forall a. HasCallStack => STM (ContT r m) a -> ContT r m a
atomically = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a.
(MonadSTM m, HasCallStack) =>
STM m a -> m a
atomically forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r (m :: * -> *) a. ContTSTM r m a -> STM m a
getContTSTM

    type TVar (ContT r m) = TVar m
    newTVar :: forall a. a -> STM (ContT r m) (TVar (ContT r m) a)
newTVar        = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => a -> STM m (TVar m a)
newTVar
    readTVar :: forall a. TVar (ContT r m) a -> STM (ContT r m) a
readTVar       = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TVar m a -> STM m a
readTVar
    writeTVar :: forall a. TVar (ContT r m) a -> a -> STM (ContT r m) ()
writeTVar      = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m ()
writeTVar
    retry :: forall a. STM (ContT r m) a
retry          = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM    forall (m :: * -> *) a. MonadSTM m => STM m a
retry
    orElse :: forall a.
STM (ContT r m) a -> STM (ContT r m) a -> STM (ContT r m) a
orElse         = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
on forall (m :: * -> *) a. MonadSTM m => STM m a -> STM m a -> STM m a
orElse forall r (m :: * -> *) a. ContTSTM r m a -> STM m a
getContTSTM

    modifyTVar :: forall a. TVar (ContT r m) a -> (a -> a) -> STM (ContT r m) ()
modifyTVar     = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a.
MonadSTM m =>
TVar m a -> (a -> a) -> STM m ()
modifyTVar
    modifyTVar' :: forall a. TVar (ContT r m) a -> (a -> a) -> STM (ContT r m) ()
modifyTVar'    = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a.
MonadSTM m =>
TVar m a -> (a -> a) -> STM m ()
modifyTVar'
    stateTVar :: forall s a.
TVar (ContT r m) s -> (s -> (a, s)) -> STM (ContT r m) a
stateTVar      = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) s a.
MonadSTM m =>
TVar m s -> (s -> (a, s)) -> STM m a
stateTVar
    swapTVar :: forall a. TVar (ContT r m) a -> a -> STM (ContT r m) a
swapTVar       = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m a
swapTVar
    check :: Bool -> STM (ContT r m) ()
check          = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => Bool -> STM m ()
check

    type TMVar (ContT r m) = TMVar m
    newTMVar :: forall a. a -> STM (ContT r m) (TMVar (ContT r m) a)
newTMVar       = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => a -> STM m (TMVar m a)
newTMVar
    newEmptyTMVar :: forall a. STM (ContT r m) (TMVar (ContT r m) a)
newEmptyTMVar  = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM    forall (m :: * -> *) a. MonadSTM m => STM m (TMVar m a)
newEmptyTMVar
    takeTMVar :: forall a. TMVar (ContT r m) a -> STM (ContT r m) a
takeTMVar      = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m a
takeTMVar
    tryTakeTMVar :: forall a. TMVar (ContT r m) a -> STM (ContT r m) (Maybe a)
tryTakeTMVar   = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m (Maybe a)
tryTakeTMVar
    putTMVar :: forall a. TMVar (ContT r m) a -> a -> STM (ContT r m) ()
putTMVar       = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m ()
putTMVar
    tryPutTMVar :: forall a. TMVar (ContT r m) a -> a -> STM (ContT r m) Bool
tryPutTMVar    = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m Bool
tryPutTMVar
    readTMVar :: forall a. TMVar (ContT r m) a -> STM (ContT r m) a
readTMVar      = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m a
readTMVar
    tryReadTMVar :: forall a. TMVar (ContT r m) a -> STM (ContT r m) (Maybe a)
tryReadTMVar   = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m (Maybe a)
tryReadTMVar
    swapTMVar :: forall a. TMVar (ContT r m) a -> a -> STM (ContT r m) a
swapTMVar      = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m a
swapTMVar
    isEmptyTMVar :: forall a. TMVar (ContT r m) a -> STM (ContT r m) Bool
isEmptyTMVar   = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m Bool
isEmptyTMVar

    type TQueue (ContT r m) = TQueue m
    newTQueue :: forall a. STM (ContT r m) (TQueue (ContT r m) a)
newTQueue      = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall (m :: * -> *) a. MonadSTM m => STM m (TQueue m a)
newTQueue
    readTQueue :: forall a. TQueue (ContT r m) a -> STM (ContT r m) a
readTQueue     = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
readTQueue
    tryReadTQueue :: forall a. TQueue (ContT r m) a -> STM (ContT r m) (Maybe a)
tryReadTQueue  = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryReadTQueue
    peekTQueue :: forall a. TQueue (ContT r m) a -> STM (ContT r m) a
peekTQueue     = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
peekTQueue
    tryPeekTQueue :: forall a. TQueue (ContT r m) a -> STM (ContT r m) (Maybe a)
tryPeekTQueue  = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryPeekTQueue
    flushTQueue :: forall a. TQueue (ContT r m) a -> STM (ContT r m) [a]
flushTQueue    = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m [a]
flushTQueue
    writeTQueue :: forall a. TQueue (ContT r m) a -> a -> STM (ContT r m) ()
writeTQueue TQueue (ContT r m) a
v  = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TQueue m a -> a -> STM m ()
writeTQueue TQueue (ContT r m) a
v
    isEmptyTQueue :: forall a. TQueue (ContT r m) a -> STM (ContT r m) Bool
isEmptyTQueue  = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m Bool
isEmptyTQueue
    unGetTQueue :: forall a. TQueue (ContT r m) a -> a -> STM (ContT r m) ()
unGetTQueue    = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TQueue m a -> a -> STM m ()
unGetTQueue

    type TBQueue (ContT r m) = TBQueue m
    newTBQueue :: forall a. Natural -> STM (ContT r m) (TBQueue (ContT r m) a)
newTBQueue     = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
Natural -> STM m (TBQueue m a)
newTBQueue
    readTBQueue :: forall a. TBQueue (ContT r m) a -> STM (ContT r m) a
readTBQueue    = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m a
readTBQueue
    tryReadTBQueue :: forall a. TBQueue (ContT r m) a -> STM (ContT r m) (Maybe a)
tryReadTBQueue = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
TBQueue m a -> STM m (Maybe a)
tryReadTBQueue
    peekTBQueue :: forall a. TBQueue (ContT r m) a -> STM (ContT r m) a
peekTBQueue    = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m a
peekTBQueue
    tryPeekTBQueue :: forall a. TBQueue (ContT r m) a -> STM (ContT r m) (Maybe a)
tryPeekTBQueue = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
TBQueue m a -> STM m (Maybe a)
tryPeekTBQueue
    flushTBQueue :: forall a. TBQueue (ContT r m) a -> STM (ContT r m) [a]
flushTBQueue   = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m [a]
flushTBQueue
    writeTBQueue :: forall a. TBQueue (ContT r m) a -> a -> STM (ContT r m) ()
writeTBQueue   = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> a -> STM m ()
writeTBQueue
    lengthTBQueue :: forall a. TBQueue (ContT r m) a -> STM (ContT r m) Natural
lengthTBQueue  = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m Natural
lengthTBQueue
    isEmptyTBQueue :: forall a. TBQueue (ContT r m) a -> STM (ContT r m) Bool
isEmptyTBQueue = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m Bool
isEmptyTBQueue
    isFullTBQueue :: forall a. TBQueue (ContT r m) a -> STM (ContT r m) Bool
isFullTBQueue  = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m Bool
isFullTBQueue
    unGetTBQueue :: forall a. TBQueue (ContT r m) a -> a -> STM (ContT r m) ()
unGetTBQueue   = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> a -> STM m ()
unGetTBQueue

    type TArray (ContT r m) = TArray m

    type TSem (ContT r m) = TSem m
    newTSem :: Integer -> STM (ContT r m) (TSem (ContT r m))
newTSem        = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => Integer -> STM m (TSem m)
newTSem
    waitTSem :: TSem (ContT r m) -> STM (ContT r m) ()
waitTSem       = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
waitTSem
    signalTSem :: TSem (ContT r m) -> STM (ContT r m) ()
signalTSem     = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
signalTSem
    signalTSemN :: Natural -> TSem (ContT r m) -> STM (ContT r m) ()
signalTSemN    = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *). MonadSTM m => Natural -> TSem m -> STM m ()
signalTSemN

    type TChan (ContT r m) = TChan m
    newTChan :: forall a. STM (ContT r m) (TChan (ContT r m) a)
newTChan          = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM    forall (m :: * -> *) a. MonadSTM m => STM m (TChan m a)
newTChan
    newBroadcastTChan :: forall a. STM (ContT r m) (TChan (ContT r m) a)
newBroadcastTChan = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM    forall (m :: * -> *) a. MonadSTM m => STM m (TChan m a)
newBroadcastTChan
    dupTChan :: forall a.
TChan (ContT r m) a -> STM (ContT r m) (TChan (ContT r m) a)
dupTChan          = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
TChan m a -> STM m (TChan m a)
dupTChan
    cloneTChan :: forall a.
TChan (ContT r m) a -> STM (ContT r m) (TChan (ContT r m) a)
cloneTChan        = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
TChan m a -> STM m (TChan m a)
cloneTChan
    readTChan :: forall a. TChan (ContT r m) a -> STM (ContT r m) a
readTChan         = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m a
readTChan
    tryReadTChan :: forall a. TChan (ContT r m) a -> STM (ContT r m) (Maybe a)
tryReadTChan      = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m (Maybe a)
tryReadTChan
    peekTChan :: forall a. TChan (ContT r m) a -> STM (ContT r m) a
peekTChan         = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m a
peekTChan
    tryPeekTChan :: forall a. TChan (ContT r m) a -> STM (ContT r m) (Maybe a)
tryPeekTChan      = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m (Maybe a)
tryPeekTChan
    writeTChan :: forall a. TChan (ContT r m) a -> a -> STM (ContT r m) ()
writeTChan        = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TChan m a -> a -> STM m ()
writeTChan
    unGetTChan :: forall a. TChan (ContT r m) a -> a -> STM (ContT r m) ()
unGetTChan        = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TChan m a -> a -> STM m ()
unGetTChan
    isEmptyTChan :: forall a. TChan (ContT r m) a -> STM (ContT r m) Bool
isEmptyTChan      = forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m Bool
isEmptyTChan


-- | The underlying stm monad is also transformed.
--
instance (Monoid w, MonadSTM m) => MonadSTM (Lazy.WriterT w m) where
    type STM (Lazy.WriterT w m) = Lazy.WriterT w (STM m)
    atomically :: forall a. HasCallStack => STM (WriterT w m) a -> WriterT w m a
atomically (Lazy.WriterT STM m (a, w)
stm) = forall w (m :: * -> *) a. m (a, w) -> WriterT w m a
Lazy.WriterT (forall (m :: * -> *) a.
(MonadSTM m, HasCallStack) =>
STM m a -> m a
atomically STM m (a, w)
stm)

    type TVar (Lazy.WriterT w m) = TVar m
    newTVar :: forall a. a -> STM (WriterT w m) (TVar (WriterT w m) a)
newTVar        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => a -> STM m (TVar m a)
newTVar
    readTVar :: forall a. TVar (WriterT w m) a -> STM (WriterT w m) a
readTVar       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TVar m a -> STM m a
readTVar
    writeTVar :: forall a. TVar (WriterT w m) a -> a -> STM (WriterT w m) ()
writeTVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m ()
writeTVar
    retry :: forall a. STM (WriterT w m) a
retry          = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift    forall (m :: * -> *) a. MonadSTM m => STM m a
retry
    orElse :: forall a.
STM (WriterT w m) a -> STM (WriterT w m) a -> STM (WriterT w m) a
orElse (Lazy.WriterT STM m (a, w)
a) (Lazy.WriterT STM m (a, w)
b) = forall w (m :: * -> *) a. m (a, w) -> WriterT w m a
Lazy.WriterT forall a b. (a -> b) -> a -> b
$ STM m (a, w)
a forall (m :: * -> *) a. MonadSTM m => STM m a -> STM m a -> STM m a
`orElse` STM m (a, w)
b

    modifyTVar :: forall a. TVar (WriterT w m) a -> (a -> a) -> STM (WriterT w m) ()
modifyTVar     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a.
MonadSTM m =>
TVar m a -> (a -> a) -> STM m ()
modifyTVar
    modifyTVar' :: forall a. TVar (WriterT w m) a -> (a -> a) -> STM (WriterT w m) ()
modifyTVar'    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a.
MonadSTM m =>
TVar m a -> (a -> a) -> STM m ()
modifyTVar'
    stateTVar :: forall s a.
TVar (WriterT w m) s -> (s -> (a, s)) -> STM (WriterT w m) a
stateTVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) s a.
MonadSTM m =>
TVar m s -> (s -> (a, s)) -> STM m a
stateTVar
    swapTVar :: forall a. TVar (WriterT w m) a -> a -> STM (WriterT w m) a
swapTVar       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m a
swapTVar
    check :: Bool -> STM (WriterT w m) ()
check          = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => Bool -> STM m ()
check

    type TMVar (Lazy.WriterT w m) = TMVar m
    newTMVar :: forall a. a -> STM (WriterT w m) (TMVar (WriterT w m) a)
newTMVar       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => a -> STM m (TMVar m a)
newTMVar
    newEmptyTMVar :: forall a. STM (WriterT w m) (TMVar (WriterT w m) a)
newEmptyTMVar  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift    forall (m :: * -> *) a. MonadSTM m => STM m (TMVar m a)
newEmptyTMVar
    takeTMVar :: forall a. TMVar (WriterT w m) a -> STM (WriterT w m) a
takeTMVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m a
takeTMVar
    tryTakeTMVar :: forall a. TMVar (WriterT w m) a -> STM (WriterT w m) (Maybe a)
tryTakeTMVar   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m (Maybe a)
tryTakeTMVar
    putTMVar :: forall a. TMVar (WriterT w m) a -> a -> STM (WriterT w m) ()
putTMVar       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m ()
putTMVar
    tryPutTMVar :: forall a. TMVar (WriterT w m) a -> a -> STM (WriterT w m) Bool
tryPutTMVar    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m Bool
tryPutTMVar
    readTMVar :: forall a. TMVar (WriterT w m) a -> STM (WriterT w m) a
readTMVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m a
readTMVar
    tryReadTMVar :: forall a. TMVar (WriterT w m) a -> STM (WriterT w m) (Maybe a)
tryReadTMVar   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m (Maybe a)
tryReadTMVar
    swapTMVar :: forall a. TMVar (WriterT w m) a -> a -> STM (WriterT w m) a
swapTMVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m a
swapTMVar
    isEmptyTMVar :: forall a. TMVar (WriterT w m) a -> STM (WriterT w m) Bool
isEmptyTMVar   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m Bool
isEmptyTMVar

    type TQueue (Lazy.WriterT w m) = TQueue m
    newTQueue :: forall a. STM (WriterT w m) (TQueue (WriterT w m) a)
newTQueue      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *) a. MonadSTM m => STM m (TQueue m a)
newTQueue
    readTQueue :: forall a. TQueue (WriterT w m) a -> STM (WriterT w m) a
readTQueue     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
readTQueue
    tryReadTQueue :: forall a. TQueue (WriterT w m) a -> STM (WriterT w m) (Maybe a)
tryReadTQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryReadTQueue
    peekTQueue :: forall a. TQueue (WriterT w m) a -> STM (WriterT w m) a
peekTQueue     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
peekTQueue
    tryPeekTQueue :: forall a. TQueue (WriterT w m) a -> STM (WriterT w m) (Maybe a)
tryPeekTQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryPeekTQueue
    flushTQueue :: forall a. TQueue (WriterT w m) a -> STM (WriterT w m) [a]
flushTQueue    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m [a]
flushTQueue
    writeTQueue :: forall a. TQueue (WriterT w m) a -> a -> STM (WriterT w m) ()
writeTQueue TQueue (WriterT w m) a
v  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> a -> STM m ()
writeTQueue TQueue (WriterT w m) a
v
    isEmptyTQueue :: forall a. TQueue (WriterT w m) a -> STM (WriterT w m) Bool
isEmptyTQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m Bool
isEmptyTQueue
    unGetTQueue :: forall a. TQueue (WriterT w m) a -> a -> STM (WriterT w m) ()
unGetTQueue    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TQueue m a -> a -> STM m ()
unGetTQueue

    type TBQueue (Lazy.WriterT w m) = TBQueue m
    newTBQueue :: forall a. Natural -> STM (WriterT w m) (TBQueue (WriterT w m) a)
newTBQueue     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
Natural -> STM m (TBQueue m a)
newTBQueue
    readTBQueue :: forall a. TBQueue (WriterT w m) a -> STM (WriterT w m) a
readTBQueue    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m a
readTBQueue
    tryReadTBQueue :: forall a. TBQueue (WriterT w m) a -> STM (WriterT w m) (Maybe a)
tryReadTBQueue = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
TBQueue m a -> STM m (Maybe a)
tryReadTBQueue
    peekTBQueue :: forall a. TBQueue (WriterT w m) a -> STM (WriterT w m) a
peekTBQueue    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m a
peekTBQueue
    tryPeekTBQueue :: forall a. TBQueue (WriterT w m) a -> STM (WriterT w m) (Maybe a)
tryPeekTBQueue = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
TBQueue m a -> STM m (Maybe a)
tryPeekTBQueue
    flushTBQueue :: forall a. TBQueue (WriterT w m) a -> STM (WriterT w m) [a]
flushTBQueue   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m [a]
flushTBQueue
    writeTBQueue :: forall a. TBQueue (WriterT w m) a -> a -> STM (WriterT w m) ()
writeTBQueue   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> a -> STM m ()
writeTBQueue
    lengthTBQueue :: forall a. TBQueue (WriterT w m) a -> STM (WriterT w m) Natural
lengthTBQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m Natural
lengthTBQueue
    isEmptyTBQueue :: forall a. TBQueue (WriterT w m) a -> STM (WriterT w m) Bool
isEmptyTBQueue = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m Bool
isEmptyTBQueue
    isFullTBQueue :: forall a. TBQueue (WriterT w m) a -> STM (WriterT w m) Bool
isFullTBQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m Bool
isFullTBQueue
    unGetTBQueue :: forall a. TBQueue (WriterT w m) a -> a -> STM (WriterT w m) ()
unGetTBQueue   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> a -> STM m ()
unGetTBQueue

    type TArray (Lazy.WriterT w m) = TArray m

    type TSem (Lazy.WriterT w m) = TSem m
    newTSem :: Integer -> STM (WriterT w m) (TSem (WriterT w m))
newTSem        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => Integer -> STM m (TSem m)
newTSem
    waitTSem :: TSem (WriterT w m) -> STM (WriterT w m) ()
waitTSem       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
waitTSem
    signalTSem :: TSem (WriterT w m) -> STM (WriterT w m) ()
signalTSem     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
signalTSem
    signalTSemN :: Natural -> TSem (WriterT w m) -> STM (WriterT w m) ()
signalTSemN    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *). MonadSTM m => Natural -> TSem m -> STM m ()
signalTSemN

    type TChan (Lazy.WriterT w m) = TChan m
    newTChan :: forall a. STM (WriterT w m) (TChan (WriterT w m) a)
newTChan          = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift    forall (m :: * -> *) a. MonadSTM m => STM m (TChan m a)
newTChan
    newBroadcastTChan :: forall a. STM (WriterT w m) (TChan (WriterT w m) a)
newBroadcastTChan = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift    forall (m :: * -> *) a. MonadSTM m => STM m (TChan m a)
newBroadcastTChan
    dupTChan :: forall a.
TChan (WriterT w m) a -> STM (WriterT w m) (TChan (WriterT w m) a)
dupTChan          = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
TChan m a -> STM m (TChan m a)
dupTChan
    cloneTChan :: forall a.
TChan (WriterT w m) a -> STM (WriterT w m) (TChan (WriterT w m) a)
cloneTChan        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
TChan m a -> STM m (TChan m a)
cloneTChan
    readTChan :: forall a. TChan (WriterT w m) a -> STM (WriterT w m) a
readTChan         = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m a
readTChan
    tryReadTChan :: forall a. TChan (WriterT w m) a -> STM (WriterT w m) (Maybe a)
tryReadTChan      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m (Maybe a)
tryReadTChan
    peekTChan :: forall a. TChan (WriterT w m) a -> STM (WriterT w m) a
peekTChan         = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m a
peekTChan
    tryPeekTChan :: forall a. TChan (WriterT w m) a -> STM (WriterT w m) (Maybe a)
tryPeekTChan      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m (Maybe a)
tryPeekTChan
    writeTChan :: forall a. TChan (WriterT w m) a -> a -> STM (WriterT w m) ()
writeTChan        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TChan m a -> a -> STM m ()
writeTChan
    unGetTChan :: forall a. TChan (WriterT w m) a -> a -> STM (WriterT w m) ()
unGetTChan        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TChan m a -> a -> STM m ()
unGetTChan
    isEmptyTChan :: forall a. TChan (WriterT w m) a -> STM (WriterT w m) Bool
isEmptyTChan      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m Bool
isEmptyTChan


-- | The underlying stm monad is also transformed.
--
instance (Monoid w, MonadSTM m) => MonadSTM (Strict.WriterT w m) where
    type STM (Strict.WriterT w m) = Strict.WriterT w (STM m)
    atomically :: forall a. HasCallStack => STM (WriterT w m) a -> WriterT w m a
atomically (Strict.WriterT STM m (a, w)
stm) = forall w (m :: * -> *) a. m (a, w) -> WriterT w m a
Strict.WriterT (forall (m :: * -> *) a.
(MonadSTM m, HasCallStack) =>
STM m a -> m a
atomically STM m (a, w)
stm)

    type TVar (Strict.WriterT w m) = TVar m
    newTVar :: forall a. a -> STM (WriterT w m) (TVar (WriterT w m) a)
newTVar        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => a -> STM m (TVar m a)
newTVar
    readTVar :: forall a. TVar (WriterT w m) a -> STM (WriterT w m) a
readTVar       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TVar m a -> STM m a
readTVar
    writeTVar :: forall a. TVar (WriterT w m) a -> a -> STM (WriterT w m) ()
writeTVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m ()
writeTVar
    retry :: forall a. STM (WriterT w m) a
retry          = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift    forall (m :: * -> *) a. MonadSTM m => STM m a
retry
    orElse :: forall a.
STM (WriterT w m) a -> STM (WriterT w m) a -> STM (WriterT w m) a
orElse (Strict.WriterT STM m (a, w)
a) (Strict.WriterT STM m (a, w)
b) = forall w (m :: * -> *) a. m (a, w) -> WriterT w m a
Strict.WriterT forall a b. (a -> b) -> a -> b
$ STM m (a, w)
a forall (m :: * -> *) a. MonadSTM m => STM m a -> STM m a -> STM m a
`orElse` STM m (a, w)
b

    modifyTVar :: forall a. TVar (WriterT w m) a -> (a -> a) -> STM (WriterT w m) ()
modifyTVar     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a.
MonadSTM m =>
TVar m a -> (a -> a) -> STM m ()
modifyTVar
    modifyTVar' :: forall a. TVar (WriterT w m) a -> (a -> a) -> STM (WriterT w m) ()
modifyTVar'    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a.
MonadSTM m =>
TVar m a -> (a -> a) -> STM m ()
modifyTVar'
    stateTVar :: forall s a.
TVar (WriterT w m) s -> (s -> (a, s)) -> STM (WriterT w m) a
stateTVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) s a.
MonadSTM m =>
TVar m s -> (s -> (a, s)) -> STM m a
stateTVar
    swapTVar :: forall a. TVar (WriterT w m) a -> a -> STM (WriterT w m) a
swapTVar       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m a
swapTVar
    check :: Bool -> STM (WriterT w m) ()
check          = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => Bool -> STM m ()
check

    type TMVar (Strict.WriterT w m) = TMVar m
    newTMVar :: forall a. a -> STM (WriterT w m) (TMVar (WriterT w m) a)
newTMVar       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => a -> STM m (TMVar m a)
newTMVar
    newEmptyTMVar :: forall a. STM (WriterT w m) (TMVar (WriterT w m) a)
newEmptyTMVar  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift    forall (m :: * -> *) a. MonadSTM m => STM m (TMVar m a)
newEmptyTMVar
    takeTMVar :: forall a. TMVar (WriterT w m) a -> STM (WriterT w m) a
takeTMVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m a
takeTMVar
    tryTakeTMVar :: forall a. TMVar (WriterT w m) a -> STM (WriterT w m) (Maybe a)
tryTakeTMVar   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m (Maybe a)
tryTakeTMVar
    putTMVar :: forall a. TMVar (WriterT w m) a -> a -> STM (WriterT w m) ()
putTMVar       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m ()
putTMVar
    tryPutTMVar :: forall a. TMVar (WriterT w m) a -> a -> STM (WriterT w m) Bool
tryPutTMVar    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m Bool
tryPutTMVar
    readTMVar :: forall a. TMVar (WriterT w m) a -> STM (WriterT w m) a
readTMVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m a
readTMVar
    tryReadTMVar :: forall a. TMVar (WriterT w m) a -> STM (WriterT w m) (Maybe a)
tryReadTMVar   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m (Maybe a)
tryReadTMVar
    swapTMVar :: forall a. TMVar (WriterT w m) a -> a -> STM (WriterT w m) a
swapTMVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m a
swapTMVar
    isEmptyTMVar :: forall a. TMVar (WriterT w m) a -> STM (WriterT w m) Bool
isEmptyTMVar   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m Bool
isEmptyTMVar

    type TQueue (Strict.WriterT w m) = TQueue m
    newTQueue :: forall a. STM (WriterT w m) (TQueue (WriterT w m) a)
newTQueue      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *) a. MonadSTM m => STM m (TQueue m a)
newTQueue
    readTQueue :: forall a. TQueue (WriterT w m) a -> STM (WriterT w m) a
readTQueue     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
readTQueue
    tryReadTQueue :: forall a. TQueue (WriterT w m) a -> STM (WriterT w m) (Maybe a)
tryReadTQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryReadTQueue
    peekTQueue :: forall a. TQueue (WriterT w m) a -> STM (WriterT w m) a
peekTQueue     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
peekTQueue
    tryPeekTQueue :: forall a. TQueue (WriterT w m) a -> STM (WriterT w m) (Maybe a)
tryPeekTQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryPeekTQueue
    flushTQueue :: forall a. TQueue (WriterT w m) a -> STM (WriterT w m) [a]
flushTQueue    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m [a]
flushTQueue
    writeTQueue :: forall a. TQueue (WriterT w m) a -> a -> STM (WriterT w m) ()
writeTQueue TQueue (WriterT w m) a
v  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> a -> STM m ()
writeTQueue TQueue (WriterT w m) a
v
    isEmptyTQueue :: forall a. TQueue (WriterT w m) a -> STM (WriterT w m) Bool
isEmptyTQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m Bool
isEmptyTQueue
    unGetTQueue :: forall a. TQueue (WriterT w m) a -> a -> STM (WriterT w m) ()
unGetTQueue    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TQueue m a -> a -> STM m ()
unGetTQueue

    type TBQueue (Strict.WriterT w m) = TBQueue m
    newTBQueue :: forall a. Natural -> STM (WriterT w m) (TBQueue (WriterT w m) a)
newTBQueue     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
Natural -> STM m (TBQueue m a)
newTBQueue
    readTBQueue :: forall a. TBQueue (WriterT w m) a -> STM (WriterT w m) a
readTBQueue    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m a
readTBQueue
    tryReadTBQueue :: forall a. TBQueue (WriterT w m) a -> STM (WriterT w m) (Maybe a)
tryReadTBQueue = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
TBQueue m a -> STM m (Maybe a)
tryReadTBQueue
    peekTBQueue :: forall a. TBQueue (WriterT w m) a -> STM (WriterT w m) a
peekTBQueue    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m a
peekTBQueue
    tryPeekTBQueue :: forall a. TBQueue (WriterT w m) a -> STM (WriterT w m) (Maybe a)
tryPeekTBQueue = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
TBQueue m a -> STM m (Maybe a)
tryPeekTBQueue
    flushTBQueue :: forall a. TBQueue (WriterT w m) a -> STM (WriterT w m) [a]
flushTBQueue   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m [a]
flushTBQueue
    writeTBQueue :: forall a. TBQueue (WriterT w m) a -> a -> STM (WriterT w m) ()
writeTBQueue   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> a -> STM m ()
writeTBQueue
    lengthTBQueue :: forall a. TBQueue (WriterT w m) a -> STM (WriterT w m) Natural
lengthTBQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m Natural
lengthTBQueue
    isEmptyTBQueue :: forall a. TBQueue (WriterT w m) a -> STM (WriterT w m) Bool
isEmptyTBQueue = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m Bool
isEmptyTBQueue
    isFullTBQueue :: forall a. TBQueue (WriterT w m) a -> STM (WriterT w m) Bool
isFullTBQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m Bool
isFullTBQueue
    unGetTBQueue :: forall a. TBQueue (WriterT w m) a -> a -> STM (WriterT w m) ()
unGetTBQueue   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> a -> STM m ()
unGetTBQueue

    type TArray (Strict.WriterT w m) = TArray m

    type TSem (Strict.WriterT w m) = TSem m
    newTSem :: Integer -> STM (WriterT w m) (TSem (WriterT w m))
newTSem        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => Integer -> STM m (TSem m)
newTSem
    waitTSem :: TSem (WriterT w m) -> STM (WriterT w m) ()
waitTSem       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
waitTSem
    signalTSem :: TSem (WriterT w m) -> STM (WriterT w m) ()
signalTSem     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
signalTSem
    signalTSemN :: Natural -> TSem (WriterT w m) -> STM (WriterT w m) ()
signalTSemN    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *). MonadSTM m => Natural -> TSem m -> STM m ()
signalTSemN

    type TChan (Strict.WriterT w m) = TChan m
    newTChan :: forall a. STM (WriterT w m) (TChan (WriterT w m) a)
newTChan          = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift    forall (m :: * -> *) a. MonadSTM m => STM m (TChan m a)
newTChan
    newBroadcastTChan :: forall a. STM (WriterT w m) (TChan (WriterT w m) a)
newBroadcastTChan = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift    forall (m :: * -> *) a. MonadSTM m => STM m (TChan m a)
newBroadcastTChan
    dupTChan :: forall a.
TChan (WriterT w m) a -> STM (WriterT w m) (TChan (WriterT w m) a)
dupTChan          = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
TChan m a -> STM m (TChan m a)
dupTChan
    cloneTChan :: forall a.
TChan (WriterT w m) a -> STM (WriterT w m) (TChan (WriterT w m) a)
cloneTChan        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
TChan m a -> STM m (TChan m a)
cloneTChan
    readTChan :: forall a. TChan (WriterT w m) a -> STM (WriterT w m) a
readTChan         = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m a
readTChan
    tryReadTChan :: forall a. TChan (WriterT w m) a -> STM (WriterT w m) (Maybe a)
tryReadTChan      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m (Maybe a)
tryReadTChan
    peekTChan :: forall a. TChan (WriterT w m) a -> STM (WriterT w m) a
peekTChan         = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m a
peekTChan
    tryPeekTChan :: forall a. TChan (WriterT w m) a -> STM (WriterT w m) (Maybe a)
tryPeekTChan      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m (Maybe a)
tryPeekTChan
    writeTChan :: forall a. TChan (WriterT w m) a -> a -> STM (WriterT w m) ()
writeTChan        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TChan m a -> a -> STM m ()
writeTChan
    unGetTChan :: forall a. TChan (WriterT w m) a -> a -> STM (WriterT w m) ()
unGetTChan        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TChan m a -> a -> STM m ()
unGetTChan
    isEmptyTChan :: forall a. TChan (WriterT w m) a -> STM (WriterT w m) Bool
isEmptyTChan      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m Bool
isEmptyTChan


-- | The underlying stm monad is also transformed.
--
instance MonadSTM m => MonadSTM (Lazy.StateT s m) where
    type STM (Lazy.StateT s m) = Lazy.StateT s (STM m)
    atomically :: forall a. HasCallStack => STM (StateT s m) a -> StateT s m a
atomically (Lazy.StateT s -> STM m (a, s)
stm) = forall s (m :: * -> *) a. (s -> m (a, s)) -> StateT s m a
Lazy.StateT forall a b. (a -> b) -> a -> b
$ \s
s -> forall (m :: * -> *) a.
(MonadSTM m, HasCallStack) =>
STM m a -> m a
atomically (s -> STM m (a, s)
stm s
s)

    type TVar (Lazy.StateT s m) = TVar m
    newTVar :: forall a. a -> STM (StateT s m) (TVar (StateT s m) a)
newTVar        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => a -> STM m (TVar m a)
newTVar
    readTVar :: forall a. TVar (StateT s m) a -> STM (StateT s m) a
readTVar       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TVar m a -> STM m a
readTVar
    writeTVar :: forall a. TVar (StateT s m) a -> a -> STM (StateT s m) ()
writeTVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m ()
writeTVar
    retry :: forall a. STM (StateT s m) a
retry          = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift    forall (m :: * -> *) a. MonadSTM m => STM m a
retry
    orElse :: forall a.
STM (StateT s m) a -> STM (StateT s m) a -> STM (StateT s m) a
orElse (Lazy.StateT s -> STM m (a, s)
a) (Lazy.StateT s -> STM m (a, s)
b) = forall s (m :: * -> *) a. (s -> m (a, s)) -> StateT s m a
Lazy.StateT forall a b. (a -> b) -> a -> b
$ \s
s -> s -> STM m (a, s)
a s
s forall (m :: * -> *) a. MonadSTM m => STM m a -> STM m a -> STM m a
`orElse` s -> STM m (a, s)
b s
s

    modifyTVar :: forall a. TVar (StateT s m) a -> (a -> a) -> STM (StateT s m) ()
modifyTVar     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a.
MonadSTM m =>
TVar m a -> (a -> a) -> STM m ()
modifyTVar
    modifyTVar' :: forall a. TVar (StateT s m) a -> (a -> a) -> STM (StateT s m) ()
modifyTVar'    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a.
MonadSTM m =>
TVar m a -> (a -> a) -> STM m ()
modifyTVar'
    stateTVar :: forall s a.
TVar (StateT s m) s -> (s -> (a, s)) -> STM (StateT s m) a
stateTVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) s a.
MonadSTM m =>
TVar m s -> (s -> (a, s)) -> STM m a
stateTVar
    swapTVar :: forall a. TVar (StateT s m) a -> a -> STM (StateT s m) a
swapTVar       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m a
swapTVar
    check :: Bool -> STM (StateT s m) ()
check          = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => Bool -> STM m ()
check

    type TMVar (Lazy.StateT s m) = TMVar m
    newTMVar :: forall a. a -> STM (StateT s m) (TMVar (StateT s m) a)
newTMVar       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => a -> STM m (TMVar m a)
newTMVar
    newEmptyTMVar :: forall a. STM (StateT s m) (TMVar (StateT s m) a)
newEmptyTMVar  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift    forall (m :: * -> *) a. MonadSTM m => STM m (TMVar m a)
newEmptyTMVar
    takeTMVar :: forall a. TMVar (StateT s m) a -> STM (StateT s m) a
takeTMVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m a
takeTMVar
    tryTakeTMVar :: forall a. TMVar (StateT s m) a -> STM (StateT s m) (Maybe a)
tryTakeTMVar   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m (Maybe a)
tryTakeTMVar
    putTMVar :: forall a. TMVar (StateT s m) a -> a -> STM (StateT s m) ()
putTMVar       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m ()
putTMVar
    tryPutTMVar :: forall a. TMVar (StateT s m) a -> a -> STM (StateT s m) Bool
tryPutTMVar    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m Bool
tryPutTMVar
    readTMVar :: forall a. TMVar (StateT s m) a -> STM (StateT s m) a
readTMVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m a
readTMVar
    tryReadTMVar :: forall a. TMVar (StateT s m) a -> STM (StateT s m) (Maybe a)
tryReadTMVar   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m (Maybe a)
tryReadTMVar
    swapTMVar :: forall a. TMVar (StateT s m) a -> a -> STM (StateT s m) a
swapTMVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m a
swapTMVar
    isEmptyTMVar :: forall a. TMVar (StateT s m) a -> STM (StateT s m) Bool
isEmptyTMVar   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m Bool
isEmptyTMVar

    type TQueue (Lazy.StateT s m) = TQueue m
    newTQueue :: forall a. STM (StateT s m) (TQueue (StateT s m) a)
newTQueue      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *) a. MonadSTM m => STM m (TQueue m a)
newTQueue
    readTQueue :: forall a. TQueue (StateT s m) a -> STM (StateT s m) a
readTQueue     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
readTQueue
    tryReadTQueue :: forall a. TQueue (StateT s m) a -> STM (StateT s m) (Maybe a)
tryReadTQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryReadTQueue
    peekTQueue :: forall a. TQueue (StateT s m) a -> STM (StateT s m) a
peekTQueue     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
peekTQueue
    tryPeekTQueue :: forall a. TQueue (StateT s m) a -> STM (StateT s m) (Maybe a)
tryPeekTQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryPeekTQueue
    flushTQueue :: forall a. TQueue (StateT s m) a -> STM (StateT s m) [a]
flushTQueue    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m [a]
flushTQueue
    writeTQueue :: forall a. TQueue (StateT s m) a -> a -> STM (StateT s m) ()
writeTQueue TQueue (StateT s m) a
v  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TQueue m a -> a -> STM m ()
writeTQueue TQueue (StateT s m) a
v
    isEmptyTQueue :: forall a. TQueue (StateT s m) a -> STM (StateT s m) Bool
isEmptyTQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m Bool
isEmptyTQueue
    unGetTQueue :: forall a. TQueue (StateT s m) a -> a -> STM (StateT s m) ()
unGetTQueue    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TQueue m a -> a -> STM m ()
unGetTQueue

    type TBQueue (Lazy.StateT s m) = TBQueue m
    newTBQueue :: forall a. Natural -> STM (StateT s m) (TBQueue (StateT s m) a)
newTBQueue     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
Natural -> STM m (TBQueue m a)
newTBQueue
    readTBQueue :: forall a. TBQueue (StateT s m) a -> STM (StateT s m) a
readTBQueue    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m a
readTBQueue
    tryReadTBQueue :: forall a. TBQueue (StateT s m) a -> STM (StateT s m) (Maybe a)
tryReadTBQueue = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
TBQueue m a -> STM m (Maybe a)
tryReadTBQueue
    peekTBQueue :: forall a. TBQueue (StateT s m) a -> STM (StateT s m) a
peekTBQueue    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m a
peekTBQueue
    tryPeekTBQueue :: forall a. TBQueue (StateT s m) a -> STM (StateT s m) (Maybe a)
tryPeekTBQueue = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
TBQueue m a -> STM m (Maybe a)
tryPeekTBQueue
    flushTBQueue :: forall a. TBQueue (StateT s m) a -> STM (StateT s m) [a]
flushTBQueue   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m [a]
flushTBQueue
    writeTBQueue :: forall a. TBQueue (StateT s m) a -> a -> STM (StateT s m) ()
writeTBQueue   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> a -> STM m ()
writeTBQueue
    lengthTBQueue :: forall a. TBQueue (StateT s m) a -> STM (StateT s m) Natural
lengthTBQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m Natural
lengthTBQueue
    isEmptyTBQueue :: forall a. TBQueue (StateT s m) a -> STM (StateT s m) Bool
isEmptyTBQueue = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m Bool
isEmptyTBQueue
    isFullTBQueue :: forall a. TBQueue (StateT s m) a -> STM (StateT s m) Bool
isFullTBQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m Bool
isFullTBQueue
    unGetTBQueue :: forall a. TBQueue (StateT s m) a -> a -> STM (StateT s m) ()
unGetTBQueue   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> a -> STM m ()
unGetTBQueue

    type TArray (Lazy.StateT s m) = TArray m

    type TSem (Lazy.StateT s m) = TSem m
    newTSem :: Integer -> STM (StateT s m) (TSem (StateT s m))
newTSem        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => Integer -> STM m (TSem m)
newTSem
    waitTSem :: TSem (StateT s m) -> STM (StateT s m) ()
waitTSem       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
waitTSem
    signalTSem :: TSem (StateT s m) -> STM (StateT s m) ()
signalTSem     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
signalTSem
    signalTSemN :: Natural -> TSem (StateT s m) -> STM (StateT s m) ()
signalTSemN    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *). MonadSTM m => Natural -> TSem m -> STM m ()
signalTSemN

    type TChan (Lazy.StateT s m) = TChan m
    newTChan :: forall a. STM (StateT s m) (TChan (StateT s m) a)
newTChan          = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift    forall (m :: * -> *) a. MonadSTM m => STM m (TChan m a)
newTChan
    newBroadcastTChan :: forall a. STM (StateT s m) (TChan (StateT s m) a)
newBroadcastTChan = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift    forall (m :: * -> *) a. MonadSTM m => STM m (TChan m a)
newBroadcastTChan
    dupTChan :: forall a.
TChan (StateT s m) a -> STM (StateT s m) (TChan (StateT s m) a)
dupTChan          = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
TChan m a -> STM m (TChan m a)
dupTChan
    cloneTChan :: forall a.
TChan (StateT s m) a -> STM (StateT s m) (TChan (StateT s m) a)
cloneTChan        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
TChan m a -> STM m (TChan m a)
cloneTChan
    readTChan :: forall a. TChan (StateT s m) a -> STM (StateT s m) a
readTChan         = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m a
readTChan
    tryReadTChan :: forall a. TChan (StateT s m) a -> STM (StateT s m) (Maybe a)
tryReadTChan      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m (Maybe a)
tryReadTChan
    peekTChan :: forall a. TChan (StateT s m) a -> STM (StateT s m) a
peekTChan         = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m a
peekTChan
    tryPeekTChan :: forall a. TChan (StateT s m) a -> STM (StateT s m) (Maybe a)
tryPeekTChan      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m (Maybe a)
tryPeekTChan
    writeTChan :: forall a. TChan (StateT s m) a -> a -> STM (StateT s m) ()
writeTChan        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TChan m a -> a -> STM m ()
writeTChan
    unGetTChan :: forall a. TChan (StateT s m) a -> a -> STM (StateT s m) ()
unGetTChan        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TChan m a -> a -> STM m ()
unGetTChan
    isEmptyTChan :: forall a. TChan (StateT s m) a -> STM (StateT s m) Bool
isEmptyTChan      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m Bool
isEmptyTChan


-- | The underlying stm monad is also transformed.
--
instance MonadSTM m => MonadSTM (Strict.StateT s m) where
    type STM (Strict.StateT s m) = Strict.StateT s (STM m)
    atomically :: forall a. HasCallStack => STM (StateT s m) a -> StateT s m a
atomically (Strict.StateT s -> STM m (a, s)
stm) = forall s (m :: * -> *) a. (s -> m (a, s)) -> StateT s m a
Strict.StateT forall a b. (a -> b) -> a -> b
$ \s
s -> forall (m :: * -> *) a.
(MonadSTM m, HasCallStack) =>
STM m a -> m a
atomically (s -> STM m (a, s)
stm s
s)

    type TVar (Strict.StateT s m) = TVar m
    newTVar :: forall a. a -> STM (StateT s m) (TVar (StateT s m) a)
newTVar        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => a -> STM m (TVar m a)
newTVar
    readTVar :: forall a. TVar (StateT s m) a -> STM (StateT s m) a
readTVar       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TVar m a -> STM m a
readTVar
    writeTVar :: forall a. TVar (StateT s m) a -> a -> STM (StateT s m) ()
writeTVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m ()
writeTVar
    retry :: forall a. STM (StateT s m) a
retry          = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift    forall (m :: * -> *) a. MonadSTM m => STM m a
retry
    orElse :: forall a.
STM (StateT s m) a -> STM (StateT s m) a -> STM (StateT s m) a
orElse (Strict.StateT s -> STM m (a, s)
a) (Strict.StateT s -> STM m (a, s)
b) = forall s (m :: * -> *) a. (s -> m (a, s)) -> StateT s m a
Strict.StateT forall a b. (a -> b) -> a -> b
$ \s
s -> s -> STM m (a, s)
a s
s forall (m :: * -> *) a. MonadSTM m => STM m a -> STM m a -> STM m a
`orElse` s -> STM m (a, s)
b s
s

    modifyTVar :: forall a. TVar (StateT s m) a -> (a -> a) -> STM (StateT s m) ()
modifyTVar     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a.
MonadSTM m =>
TVar m a -> (a -> a) -> STM m ()
modifyTVar
    modifyTVar' :: forall a. TVar (StateT s m) a -> (a -> a) -> STM (StateT s m) ()
modifyTVar'    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a.
MonadSTM m =>
TVar m a -> (a -> a) -> STM m ()
modifyTVar'
    stateTVar :: forall s a.
TVar (StateT s m) s -> (s -> (a, s)) -> STM (StateT s m) a
stateTVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) s a.
MonadSTM m =>
TVar m s -> (s -> (a, s)) -> STM m a
stateTVar
    swapTVar :: forall a. TVar (StateT s m) a -> a -> STM (StateT s m) a
swapTVar       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m a
swapTVar
    check :: Bool -> STM (StateT s m) ()
check          = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => Bool -> STM m ()
check

    type TMVar (Strict.StateT s m) = TMVar m
    newTMVar :: forall a. a -> STM (StateT s m) (TMVar (StateT s m) a)
newTMVar       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => a -> STM m (TMVar m a)
newTMVar
    newEmptyTMVar :: forall a. STM (StateT s m) (TMVar (StateT s m) a)
newEmptyTMVar  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift    forall (m :: * -> *) a. MonadSTM m => STM m (TMVar m a)
newEmptyTMVar
    takeTMVar :: forall a. TMVar (StateT s m) a -> STM (StateT s m) a
takeTMVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m a
takeTMVar
    tryTakeTMVar :: forall a. TMVar (StateT s m) a -> STM (StateT s m) (Maybe a)
tryTakeTMVar   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m (Maybe a)
tryTakeTMVar
    putTMVar :: forall a. TMVar (StateT s m) a -> a -> STM (StateT s m) ()
putTMVar       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m ()
putTMVar
    tryPutTMVar :: forall a. TMVar (StateT s m) a -> a -> STM (StateT s m) Bool
tryPutTMVar    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m Bool
tryPutTMVar
    readTMVar :: forall a. TMVar (StateT s m) a -> STM (StateT s m) a
readTMVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m a
readTMVar
    tryReadTMVar :: forall a. TMVar (StateT s m) a -> STM (StateT s m) (Maybe a)
tryReadTMVar   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m (Maybe a)
tryReadTMVar
    swapTMVar :: forall a. TMVar (StateT s m) a -> a -> STM (StateT s m) a
swapTMVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m a
swapTMVar
    isEmptyTMVar :: forall a. TMVar (StateT s m) a -> STM (StateT s m) Bool
isEmptyTMVar   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m Bool
isEmptyTMVar

    type TQueue (Strict.StateT s m) = TQueue m
    newTQueue :: forall a. STM (StateT s m) (TQueue (StateT s m) a)
newTQueue      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *) a. MonadSTM m => STM m (TQueue m a)
newTQueue
    readTQueue :: forall a. TQueue (StateT s m) a -> STM (StateT s m) a
readTQueue     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
readTQueue
    tryReadTQueue :: forall a. TQueue (StateT s m) a -> STM (StateT s m) (Maybe a)
tryReadTQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryReadTQueue
    peekTQueue :: forall a. TQueue (StateT s m) a -> STM (StateT s m) a
peekTQueue     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
peekTQueue
    tryPeekTQueue :: forall a. TQueue (StateT s m) a -> STM (StateT s m) (Maybe a)
tryPeekTQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryPeekTQueue
    flushTQueue :: forall a. TQueue (StateT s m) a -> STM (StateT s m) [a]
flushTQueue    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m [a]
flushTQueue
    writeTQueue :: forall a. TQueue (StateT s m) a -> a -> STM (StateT s m) ()
writeTQueue TQueue (StateT s m) a
v  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TQueue m a -> a -> STM m ()
writeTQueue TQueue (StateT s m) a
v
    isEmptyTQueue :: forall a. TQueue (StateT s m) a -> STM (StateT s m) Bool
isEmptyTQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m Bool
isEmptyTQueue
    unGetTQueue :: forall a. TQueue (StateT s m) a -> a -> STM (StateT s m) ()
unGetTQueue    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TQueue m a -> a -> STM m ()
unGetTQueue

    type TBQueue (Strict.StateT s m) = TBQueue m
    newTBQueue :: forall a. Natural -> STM (StateT s m) (TBQueue (StateT s m) a)
newTBQueue     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
Natural -> STM m (TBQueue m a)
newTBQueue
    readTBQueue :: forall a. TBQueue (StateT s m) a -> STM (StateT s m) a
readTBQueue    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m a
readTBQueue
    tryReadTBQueue :: forall a. TBQueue (StateT s m) a -> STM (StateT s m) (Maybe a)
tryReadTBQueue = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
TBQueue m a -> STM m (Maybe a)
tryReadTBQueue
    peekTBQueue :: forall a. TBQueue (StateT s m) a -> STM (StateT s m) a
peekTBQueue    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m a
peekTBQueue
    tryPeekTBQueue :: forall a. TBQueue (StateT s m) a -> STM (StateT s m) (Maybe a)
tryPeekTBQueue = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
TBQueue m a -> STM m (Maybe a)
tryPeekTBQueue
    flushTBQueue :: forall a. TBQueue (StateT s m) a -> STM (StateT s m) [a]
flushTBQueue   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m [a]
flushTBQueue
    writeTBQueue :: forall a. TBQueue (StateT s m) a -> a -> STM (StateT s m) ()
writeTBQueue   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> a -> STM m ()
writeTBQueue
    lengthTBQueue :: forall a. TBQueue (StateT s m) a -> STM (StateT s m) Natural
lengthTBQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m Natural
lengthTBQueue
    isEmptyTBQueue :: forall a. TBQueue (StateT s m) a -> STM (StateT s m) Bool
isEmptyTBQueue = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m Bool
isEmptyTBQueue
    isFullTBQueue :: forall a. TBQueue (StateT s m) a -> STM (StateT s m) Bool
isFullTBQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m Bool
isFullTBQueue
    unGetTBQueue :: forall a. TBQueue (StateT s m) a -> a -> STM (StateT s m) ()
unGetTBQueue   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> a -> STM m ()
unGetTBQueue

    type TArray (Strict.StateT s m) = TArray m

    type TSem (Strict.StateT s m) = TSem m
    newTSem :: Integer -> STM (StateT s m) (TSem (StateT s m))
newTSem        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => Integer -> STM m (TSem m)
newTSem
    waitTSem :: TSem (StateT s m) -> STM (StateT s m) ()
waitTSem       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
waitTSem
    signalTSem :: TSem (StateT s m) -> STM (StateT s m) ()
signalTSem     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
signalTSem
    signalTSemN :: Natural -> TSem (StateT s m) -> STM (StateT s m) ()
signalTSemN    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *). MonadSTM m => Natural -> TSem m -> STM m ()
signalTSemN

    type TChan (Strict.StateT s m) = TChan m
    newTChan :: forall a. STM (StateT s m) (TChan (StateT s m) a)
newTChan          = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift    forall (m :: * -> *) a. MonadSTM m => STM m (TChan m a)
newTChan
    newBroadcastTChan :: forall a. STM (StateT s m) (TChan (StateT s m) a)
newBroadcastTChan = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift    forall (m :: * -> *) a. MonadSTM m => STM m (TChan m a)
newBroadcastTChan
    dupTChan :: forall a.
TChan (StateT s m) a -> STM (StateT s m) (TChan (StateT s m) a)
dupTChan          = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
TChan m a -> STM m (TChan m a)
dupTChan
    cloneTChan :: forall a.
TChan (StateT s m) a -> STM (StateT s m) (TChan (StateT s m) a)
cloneTChan        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
TChan m a -> STM m (TChan m a)
cloneTChan
    readTChan :: forall a. TChan (StateT s m) a -> STM (StateT s m) a
readTChan         = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m a
readTChan
    tryReadTChan :: forall a. TChan (StateT s m) a -> STM (StateT s m) (Maybe a)
tryReadTChan      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m (Maybe a)
tryReadTChan
    peekTChan :: forall a. TChan (StateT s m) a -> STM (StateT s m) a
peekTChan         = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m a
peekTChan
    tryPeekTChan :: forall a. TChan (StateT s m) a -> STM (StateT s m) (Maybe a)
tryPeekTChan      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m (Maybe a)
tryPeekTChan
    writeTChan :: forall a. TChan (StateT s m) a -> a -> STM (StateT s m) ()
writeTChan        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TChan m a -> a -> STM m ()
writeTChan
    unGetTChan :: forall a. TChan (StateT s m) a -> a -> STM (StateT s m) ()
unGetTChan        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TChan m a -> a -> STM m ()
unGetTChan
    isEmptyTChan :: forall a. TChan (StateT s m) a -> STM (StateT s m) Bool
isEmptyTChan      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m Bool
isEmptyTChan


-- | The underlying stm monad is also transformed.
--
instance MonadSTM m => MonadSTM (ExceptT e m) where
    type STM (ExceptT e m) = ExceptT e (STM m)
    atomically :: forall a. HasCallStack => STM (ExceptT e m) a -> ExceptT e m a
atomically = forall e (m :: * -> *) a. m (Either e a) -> ExceptT e m a
ExceptT forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a.
(MonadSTM m, HasCallStack) =>
STM m a -> m a
atomically forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall e (m :: * -> *) a. ExceptT e m a -> m (Either e a)
runExceptT

    type TVar (ExceptT e m) = TVar m
    newTVar :: forall a. a -> STM (ExceptT e m) (TVar (ExceptT e m) a)
newTVar        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => a -> STM m (TVar m a)
newTVar
    readTVar :: forall a. TVar (ExceptT e m) a -> STM (ExceptT e m) a
readTVar       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TVar m a -> STM m a
readTVar
    writeTVar :: forall a. TVar (ExceptT e m) a -> a -> STM (ExceptT e m) ()
writeTVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m ()
writeTVar
    retry :: forall a. STM (ExceptT e m) a
retry          = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift    forall (m :: * -> *) a. MonadSTM m => STM m a
retry
    orElse :: forall a.
STM (ExceptT e m) a -> STM (ExceptT e m) a -> STM (ExceptT e m) a
orElse         = forall e (m :: * -> *) a. m (Either e a) -> ExceptT e m a
ExceptT forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
on forall (m :: * -> *) a. MonadSTM m => STM m a -> STM m a -> STM m a
orElse forall e (m :: * -> *) a. ExceptT e m a -> m (Either e a)
runExceptT

    modifyTVar :: forall a. TVar (ExceptT e m) a -> (a -> a) -> STM (ExceptT e m) ()
modifyTVar     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a.
MonadSTM m =>
TVar m a -> (a -> a) -> STM m ()
modifyTVar
    modifyTVar' :: forall a. TVar (ExceptT e m) a -> (a -> a) -> STM (ExceptT e m) ()
modifyTVar'    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a.
MonadSTM m =>
TVar m a -> (a -> a) -> STM m ()
modifyTVar'
    stateTVar :: forall s a.
TVar (ExceptT e m) s -> (s -> (a, s)) -> STM (ExceptT e m) a
stateTVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) s a.
MonadSTM m =>
TVar m s -> (s -> (a, s)) -> STM m a
stateTVar
    swapTVar :: forall a. TVar (ExceptT e m) a -> a -> STM (ExceptT e m) a
swapTVar       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m a
swapTVar
    check :: Bool -> STM (ExceptT e m) ()
check          = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => Bool -> STM m ()
check

    type TMVar (ExceptT e m) = TMVar m
    newTMVar :: forall a. a -> STM (ExceptT e m) (TMVar (ExceptT e m) a)
newTMVar       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => a -> STM m (TMVar m a)
newTMVar
    newEmptyTMVar :: forall a. STM (ExceptT e m) (TMVar (ExceptT e m) a)
newEmptyTMVar  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift    forall (m :: * -> *) a. MonadSTM m => STM m (TMVar m a)
newEmptyTMVar
    takeTMVar :: forall a. TMVar (ExceptT e m) a -> STM (ExceptT e m) a
takeTMVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m a
takeTMVar
    tryTakeTMVar :: forall a. TMVar (ExceptT e m) a -> STM (ExceptT e m) (Maybe a)
tryTakeTMVar   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m (Maybe a)
tryTakeTMVar
    putTMVar :: forall a. TMVar (ExceptT e m) a -> a -> STM (ExceptT e m) ()
putTMVar       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m ()
putTMVar
    tryPutTMVar :: forall a. TMVar (ExceptT e m) a -> a -> STM (ExceptT e m) Bool
tryPutTMVar    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m Bool
tryPutTMVar
    readTMVar :: forall a. TMVar (ExceptT e m) a -> STM (ExceptT e m) a
readTMVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m a
readTMVar
    tryReadTMVar :: forall a. TMVar (ExceptT e m) a -> STM (ExceptT e m) (Maybe a)
tryReadTMVar   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m (Maybe a)
tryReadTMVar
    swapTMVar :: forall a. TMVar (ExceptT e m) a -> a -> STM (ExceptT e m) a
swapTMVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m a
swapTMVar
    isEmptyTMVar :: forall a. TMVar (ExceptT e m) a -> STM (ExceptT e m) Bool
isEmptyTMVar   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m Bool
isEmptyTMVar

    type TQueue (ExceptT e m) = TQueue m
    newTQueue :: forall a. STM (ExceptT e m) (TQueue (ExceptT e m) a)
newTQueue      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *) a. MonadSTM m => STM m (TQueue m a)
newTQueue
    readTQueue :: forall a. TQueue (ExceptT e m) a -> STM (ExceptT e m) a
readTQueue     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
readTQueue
    tryReadTQueue :: forall a. TQueue (ExceptT e m) a -> STM (ExceptT e m) (Maybe a)
tryReadTQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryReadTQueue
    peekTQueue :: forall a. TQueue (ExceptT e m) a -> STM (ExceptT e m) a
peekTQueue     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
peekTQueue
    tryPeekTQueue :: forall a. TQueue (ExceptT e m) a -> STM (ExceptT e m) (Maybe a)
tryPeekTQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryPeekTQueue
    flushTQueue :: forall a. TQueue (ExceptT e m) a -> STM (ExceptT e m) [a]
flushTQueue    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m [a]
flushTQueue
    writeTQueue :: forall a. TQueue (ExceptT e m) a -> a -> STM (ExceptT e m) ()
writeTQueue TQueue (ExceptT e m) a
v  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> a -> STM m ()
writeTQueue TQueue (ExceptT e m) a
v
    isEmptyTQueue :: forall a. TQueue (ExceptT e m) a -> STM (ExceptT e m) Bool
isEmptyTQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m Bool
isEmptyTQueue
    unGetTQueue :: forall a. TQueue (ExceptT e m) a -> a -> STM (ExceptT e m) ()
unGetTQueue    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TQueue m a -> a -> STM m ()
unGetTQueue

    type TBQueue (ExceptT e m) = TBQueue m
    newTBQueue :: forall a. Natural -> STM (ExceptT e m) (TBQueue (ExceptT e m) a)
newTBQueue     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
Natural -> STM m (TBQueue m a)
newTBQueue
    readTBQueue :: forall a. TBQueue (ExceptT e m) a -> STM (ExceptT e m) a
readTBQueue    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m a
readTBQueue
    tryReadTBQueue :: forall a. TBQueue (ExceptT e m) a -> STM (ExceptT e m) (Maybe a)
tryReadTBQueue = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
TBQueue m a -> STM m (Maybe a)
tryReadTBQueue
    peekTBQueue :: forall a. TBQueue (ExceptT e m) a -> STM (ExceptT e m) a
peekTBQueue    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m a
peekTBQueue
    tryPeekTBQueue :: forall a. TBQueue (ExceptT e m) a -> STM (ExceptT e m) (Maybe a)
tryPeekTBQueue = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
TBQueue m a -> STM m (Maybe a)
tryPeekTBQueue
    flushTBQueue :: forall a. TBQueue (ExceptT e m) a -> STM (ExceptT e m) [a]
flushTBQueue   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m [a]
flushTBQueue
    writeTBQueue :: forall a. TBQueue (ExceptT e m) a -> a -> STM (ExceptT e m) ()
writeTBQueue   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> a -> STM m ()
writeTBQueue
    lengthTBQueue :: forall a. TBQueue (ExceptT e m) a -> STM (ExceptT e m) Natural
lengthTBQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m Natural
lengthTBQueue
    isEmptyTBQueue :: forall a. TBQueue (ExceptT e m) a -> STM (ExceptT e m) Bool
isEmptyTBQueue = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m Bool
isEmptyTBQueue
    isFullTBQueue :: forall a. TBQueue (ExceptT e m) a -> STM (ExceptT e m) Bool
isFullTBQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m Bool
isFullTBQueue
    unGetTBQueue :: forall a. TBQueue (ExceptT e m) a -> a -> STM (ExceptT e m) ()
unGetTBQueue   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> a -> STM m ()
unGetTBQueue

    type TArray (ExceptT e m) = TArray m

    type TSem (ExceptT e m) = TSem m
    newTSem :: Integer -> STM (ExceptT e m) (TSem (ExceptT e m))
newTSem        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => Integer -> STM m (TSem m)
newTSem
    waitTSem :: TSem (ExceptT e m) -> STM (ExceptT e m) ()
waitTSem       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
waitTSem
    signalTSem :: TSem (ExceptT e m) -> STM (ExceptT e m) ()
signalTSem     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
signalTSem
    signalTSemN :: Natural -> TSem (ExceptT e m) -> STM (ExceptT e m) ()
signalTSemN    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *). MonadSTM m => Natural -> TSem m -> STM m ()
signalTSemN

    type TChan (ExceptT e m) = TChan m
    newTChan :: forall a. STM (ExceptT e m) (TChan (ExceptT e m) a)
newTChan          = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift    forall (m :: * -> *) a. MonadSTM m => STM m (TChan m a)
newTChan
    newBroadcastTChan :: forall a. STM (ExceptT e m) (TChan (ExceptT e m) a)
newBroadcastTChan = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift    forall (m :: * -> *) a. MonadSTM m => STM m (TChan m a)
newBroadcastTChan
    dupTChan :: forall a.
TChan (ExceptT e m) a -> STM (ExceptT e m) (TChan (ExceptT e m) a)
dupTChan          = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
TChan m a -> STM m (TChan m a)
dupTChan
    cloneTChan :: forall a.
TChan (ExceptT e m) a -> STM (ExceptT e m) (TChan (ExceptT e m) a)
cloneTChan        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
TChan m a -> STM m (TChan m a)
cloneTChan
    readTChan :: forall a. TChan (ExceptT e m) a -> STM (ExceptT e m) a
readTChan         = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m a
readTChan
    tryReadTChan :: forall a. TChan (ExceptT e m) a -> STM (ExceptT e m) (Maybe a)
tryReadTChan      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m (Maybe a)
tryReadTChan
    peekTChan :: forall a. TChan (ExceptT e m) a -> STM (ExceptT e m) a
peekTChan         = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m a
peekTChan
    tryPeekTChan :: forall a. TChan (ExceptT e m) a -> STM (ExceptT e m) (Maybe a)
tryPeekTChan      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m (Maybe a)
tryPeekTChan
    writeTChan :: forall a. TChan (ExceptT e m) a -> a -> STM (ExceptT e m) ()
writeTChan        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TChan m a -> a -> STM m ()
writeTChan
    unGetTChan :: forall a. TChan (ExceptT e m) a -> a -> STM (ExceptT e m) ()
unGetTChan        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TChan m a -> a -> STM m ()
unGetTChan
    isEmptyTChan :: forall a. TChan (ExceptT e m) a -> STM (ExceptT e m) Bool
isEmptyTChan      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m Bool
isEmptyTChan


-- | The underlying stm monad is also transformed.
--
instance (Monoid w, MonadSTM m) => MonadSTM (Lazy.RWST r w s m) where
    type STM (Lazy.RWST r w s m) = Lazy.RWST r w s (STM m)
    atomically :: forall a. HasCallStack => STM (RWST r w s m) a -> RWST r w s m a
atomically (Lazy.RWST r -> s -> STM m (a, s, w)
stm) = forall r w s (m :: * -> *) a.
(r -> s -> m (a, s, w)) -> RWST r w s m a
Lazy.RWST forall a b. (a -> b) -> a -> b
$ \r
r s
s -> forall (m :: * -> *) a.
(MonadSTM m, HasCallStack) =>
STM m a -> m a
atomically (r -> s -> STM m (a, s, w)
stm r
r s
s)

    type TVar (Lazy.RWST r w s m) = TVar m
    newTVar :: forall a. a -> STM (RWST r w s m) (TVar (RWST r w s m) a)
newTVar        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => a -> STM m (TVar m a)
newTVar
    readTVar :: forall a. TVar (RWST r w s m) a -> STM (RWST r w s m) a
readTVar       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TVar m a -> STM m a
readTVar
    writeTVar :: forall a. TVar (RWST r w s m) a -> a -> STM (RWST r w s m) ()
writeTVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m ()
writeTVar
    retry :: forall a. STM (RWST r w s m) a
retry          = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift    forall (m :: * -> *) a. MonadSTM m => STM m a
retry
    orElse :: forall a.
STM (RWST r w s m) a
-> STM (RWST r w s m) a -> STM (RWST r w s m) a
orElse (Lazy.RWST r -> s -> STM m (a, s, w)
a) (Lazy.RWST r -> s -> STM m (a, s, w)
b) = forall r w s (m :: * -> *) a.
(r -> s -> m (a, s, w)) -> RWST r w s m a
Lazy.RWST forall a b. (a -> b) -> a -> b
$ \r
r s
s -> r -> s -> STM m (a, s, w)
a r
r s
s forall (m :: * -> *) a. MonadSTM m => STM m a -> STM m a -> STM m a
`orElse` r -> s -> STM m (a, s, w)
b r
r s
s

    modifyTVar :: forall a.
TVar (RWST r w s m) a -> (a -> a) -> STM (RWST r w s m) ()
modifyTVar     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a.
MonadSTM m =>
TVar m a -> (a -> a) -> STM m ()
modifyTVar
    modifyTVar' :: forall a.
TVar (RWST r w s m) a -> (a -> a) -> STM (RWST r w s m) ()
modifyTVar'    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a.
MonadSTM m =>
TVar m a -> (a -> a) -> STM m ()
modifyTVar'
    stateTVar :: forall s a.
TVar (RWST r w s m) s -> (s -> (a, s)) -> STM (RWST r w s m) a
stateTVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) s a.
MonadSTM m =>
TVar m s -> (s -> (a, s)) -> STM m a
stateTVar
    swapTVar :: forall a. TVar (RWST r w s m) a -> a -> STM (RWST r w s m) a
swapTVar       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m a
swapTVar
    check :: Bool -> STM (RWST r w s m) ()
check          = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => Bool -> STM m ()
check

    type TMVar (Lazy.RWST r w s m) = TMVar m
    newTMVar :: forall a. a -> STM (RWST r w s m) (TMVar (RWST r w s m) a)
newTMVar       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => a -> STM m (TMVar m a)
newTMVar
    newEmptyTMVar :: forall a. STM (RWST r w s m) (TMVar (RWST r w s m) a)
newEmptyTMVar  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift    forall (m :: * -> *) a. MonadSTM m => STM m (TMVar m a)
newEmptyTMVar
    takeTMVar :: forall a. TMVar (RWST r w s m) a -> STM (RWST r w s m) a
takeTMVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m a
takeTMVar
    tryTakeTMVar :: forall a. TMVar (RWST r w s m) a -> STM (RWST r w s m) (Maybe a)
tryTakeTMVar   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m (Maybe a)
tryTakeTMVar
    putTMVar :: forall a. TMVar (RWST r w s m) a -> a -> STM (RWST r w s m) ()
putTMVar       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m ()
putTMVar
    tryPutTMVar :: forall a. TMVar (RWST r w s m) a -> a -> STM (RWST r w s m) Bool
tryPutTMVar    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m Bool
tryPutTMVar
    readTMVar :: forall a. TMVar (RWST r w s m) a -> STM (RWST r w s m) a
readTMVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m a
readTMVar
    tryReadTMVar :: forall a. TMVar (RWST r w s m) a -> STM (RWST r w s m) (Maybe a)
tryReadTMVar   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m (Maybe a)
tryReadTMVar
    swapTMVar :: forall a. TMVar (RWST r w s m) a -> a -> STM (RWST r w s m) a
swapTMVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m a
swapTMVar
    isEmptyTMVar :: forall a. TMVar (RWST r w s m) a -> STM (RWST r w s m) Bool
isEmptyTMVar   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m Bool
isEmptyTMVar

    type TQueue (Lazy.RWST r w s m) = TQueue m
    newTQueue :: forall a. STM (RWST r w s m) (TQueue (RWST r w s m) a)
newTQueue      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *) a. MonadSTM m => STM m (TQueue m a)
newTQueue
    readTQueue :: forall a. TQueue (RWST r w s m) a -> STM (RWST r w s m) a
readTQueue     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
readTQueue
    tryReadTQueue :: forall a. TQueue (RWST r w s m) a -> STM (RWST r w s m) (Maybe a)
tryReadTQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryReadTQueue
    peekTQueue :: forall a. TQueue (RWST r w s m) a -> STM (RWST r w s m) a
peekTQueue     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
peekTQueue
    tryPeekTQueue :: forall a. TQueue (RWST r w s m) a -> STM (RWST r w s m) (Maybe a)
tryPeekTQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryPeekTQueue
    flushTQueue :: forall a. TQueue (RWST r w s m) a -> STM (RWST r w s m) [a]
flushTQueue    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m [a]
flushTQueue
    writeTQueue :: forall a. TQueue (RWST r w s m) a -> a -> STM (RWST r w s m) ()
writeTQueue TQueue (RWST r w s m) a
v  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> a -> STM m ()
writeTQueue TQueue (RWST r w s m) a
v
    isEmptyTQueue :: forall a. TQueue (RWST r w s m) a -> STM (RWST r w s m) Bool
isEmptyTQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m Bool
isEmptyTQueue
    unGetTQueue :: forall a. TQueue (RWST r w s m) a -> a -> STM (RWST r w s m) ()
unGetTQueue    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TQueue m a -> a -> STM m ()
unGetTQueue

    type TBQueue (Lazy.RWST r w s m) = TBQueue m
    newTBQueue :: forall a. Natural -> STM (RWST r w s m) (TBQueue (RWST r w s m) a)
newTBQueue     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a.
MonadSTM m =>
Natural -> STM m (TBQueue m a)
newTBQueue
    readTBQueue :: forall a. TBQueue (RWST r w s m) a -> STM (RWST r w s m) a
readTBQueue    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m a
readTBQueue
    tryReadTBQueue :: forall a. TBQueue (RWST r w s m) a -> STM (RWST r w s m) (Maybe a)
tryReadTBQueue = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a.
MonadSTM m =>
TBQueue m a -> STM m (Maybe a)
tryReadTBQueue
    peekTBQueue :: forall a. TBQueue (RWST r w s m) a -> STM (RWST r w s m) a
peekTBQueue    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m a
peekTBQueue
    tryPeekTBQueue :: forall a. TBQueue (RWST r w s m) a -> STM (RWST r w s m) (Maybe a)
tryPeekTBQueue = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a.
MonadSTM m =>
TBQueue m a -> STM m (Maybe a)
tryPeekTBQueue
    flushTBQueue :: forall a. TBQueue (RWST r w s m) a -> STM (RWST r w s m) [a]
flushTBQueue   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m [a]
flushTBQueue
    writeTBQueue :: forall a. TBQueue (RWST r w s m) a -> a -> STM (RWST r w s m) ()
writeTBQueue   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> a -> STM m ()
writeTBQueue
    lengthTBQueue :: forall a. TBQueue (RWST r w s m) a -> STM (RWST r w s m) Natural
lengthTBQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m Natural
lengthTBQueue
    isEmptyTBQueue :: forall a. TBQueue (RWST r w s m) a -> STM (RWST r w s m) Bool
isEmptyTBQueue = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m Bool
isEmptyTBQueue
    isFullTBQueue :: forall a. TBQueue (RWST r w s m) a -> STM (RWST r w s m) Bool
isFullTBQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m Bool
isFullTBQueue
    unGetTBQueue :: forall a. TBQueue (RWST r w s m) a -> a -> STM (RWST r w s m) ()
unGetTBQueue   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> a -> STM m ()
unGetTBQueue

    type TArray (Lazy.RWST r w s m) = TArray m

    type TSem (Lazy.RWST r w s m) = TSem m
    newTSem :: Integer -> STM (RWST r w s m) (TSem (RWST r w s m))
newTSem        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => Integer -> STM m (TSem m)
newTSem
    waitTSem :: TSem (RWST r w s m) -> STM (RWST r w s m) ()
waitTSem       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
waitTSem
    signalTSem :: TSem (RWST r w s m) -> STM (RWST r w s m) ()
signalTSem     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
signalTSem
    signalTSemN :: Natural -> TSem (RWST r w s m) -> STM (RWST r w s m) ()
signalTSemN    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *). MonadSTM m => Natural -> TSem m -> STM m ()
signalTSemN

    type TChan (Lazy.RWST r w s m) = TChan m
    newTChan :: forall a. STM (RWST r w s m) (TChan (RWST r w s m) a)
newTChan          = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift    forall (m :: * -> *) a. MonadSTM m => STM m (TChan m a)
newTChan
    newBroadcastTChan :: forall a. STM (RWST r w s m) (TChan (RWST r w s m) a)
newBroadcastTChan = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift    forall (m :: * -> *) a. MonadSTM m => STM m (TChan m a)
newBroadcastTChan
    dupTChan :: forall a.
TChan (RWST r w s m) a
-> STM (RWST r w s m) (TChan (RWST r w s m) a)
dupTChan          = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
TChan m a -> STM m (TChan m a)
dupTChan
    cloneTChan :: forall a.
TChan (RWST r w s m) a
-> STM (RWST r w s m) (TChan (RWST r w s m) a)
cloneTChan        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
TChan m a -> STM m (TChan m a)
cloneTChan
    readTChan :: forall a. TChan (RWST r w s m) a -> STM (RWST r w s m) a
readTChan         = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m a
readTChan
    tryReadTChan :: forall a. TChan (RWST r w s m) a -> STM (RWST r w s m) (Maybe a)
tryReadTChan      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m (Maybe a)
tryReadTChan
    peekTChan :: forall a. TChan (RWST r w s m) a -> STM (RWST r w s m) a
peekTChan         = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m a
peekTChan
    tryPeekTChan :: forall a. TChan (RWST r w s m) a -> STM (RWST r w s m) (Maybe a)
tryPeekTChan      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m (Maybe a)
tryPeekTChan
    writeTChan :: forall a. TChan (RWST r w s m) a -> a -> STM (RWST r w s m) ()
writeTChan        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TChan m a -> a -> STM m ()
writeTChan
    unGetTChan :: forall a. TChan (RWST r w s m) a -> a -> STM (RWST r w s m) ()
unGetTChan        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TChan m a -> a -> STM m ()
unGetTChan
    isEmptyTChan :: forall a. TChan (RWST r w s m) a -> STM (RWST r w s m) Bool
isEmptyTChan      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m Bool
isEmptyTChan


-- | The underlying stm monad is also transformed.
--
instance (Monoid w, MonadSTM m) => MonadSTM (Strict.RWST r w s m) where
    type STM (Strict.RWST r w s m) = Strict.RWST r w s (STM m)
    atomically :: forall a. HasCallStack => STM (RWST r w s m) a -> RWST r w s m a
atomically (Strict.RWST r -> s -> STM m (a, s, w)
stm) = forall r w s (m :: * -> *) a.
(r -> s -> m (a, s, w)) -> RWST r w s m a
Strict.RWST forall a b. (a -> b) -> a -> b
$ \r
r s
s -> forall (m :: * -> *) a.
(MonadSTM m, HasCallStack) =>
STM m a -> m a
atomically (r -> s -> STM m (a, s, w)
stm r
r s
s)

    type TVar (Strict.RWST r w s m) = TVar m
    newTVar :: forall a. a -> STM (RWST r w s m) (TVar (RWST r w s m) a)
newTVar        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => a -> STM m (TVar m a)
newTVar
    readTVar :: forall a. TVar (RWST r w s m) a -> STM (RWST r w s m) a
readTVar       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TVar m a -> STM m a
readTVar
    writeTVar :: forall a. TVar (RWST r w s m) a -> a -> STM (RWST r w s m) ()
writeTVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m ()
writeTVar
    retry :: forall a. STM (RWST r w s m) a
retry          = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift    forall (m :: * -> *) a. MonadSTM m => STM m a
retry
    orElse :: forall a.
STM (RWST r w s m) a
-> STM (RWST r w s m) a -> STM (RWST r w s m) a
orElse (Strict.RWST r -> s -> STM m (a, s, w)
a) (Strict.RWST r -> s -> STM m (a, s, w)
b) = forall r w s (m :: * -> *) a.
(r -> s -> m (a, s, w)) -> RWST r w s m a
Strict.RWST forall a b. (a -> b) -> a -> b
$ \r
r s
s -> r -> s -> STM m (a, s, w)
a r
r s
s forall (m :: * -> *) a. MonadSTM m => STM m a -> STM m a -> STM m a
`orElse` r -> s -> STM m (a, s, w)
b r
r s
s

    modifyTVar :: forall a.
TVar (RWST r w s m) a -> (a -> a) -> STM (RWST r w s m) ()
modifyTVar     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a.
MonadSTM m =>
TVar m a -> (a -> a) -> STM m ()
modifyTVar
    modifyTVar' :: forall a.
TVar (RWST r w s m) a -> (a -> a) -> STM (RWST r w s m) ()
modifyTVar'    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a.
MonadSTM m =>
TVar m a -> (a -> a) -> STM m ()
modifyTVar'
    stateTVar :: forall s a.
TVar (RWST r w s m) s -> (s -> (a, s)) -> STM (RWST r w s m) a
stateTVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) s a.
MonadSTM m =>
TVar m s -> (s -> (a, s)) -> STM m a
stateTVar
    swapTVar :: forall a. TVar (RWST r w s m) a -> a -> STM (RWST r w s m) a
swapTVar       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m a
swapTVar
    check :: Bool -> STM (RWST r w s m) ()
check          = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => Bool -> STM m ()
check

    type TMVar (Strict.RWST r w s m) = TMVar m
    newTMVar :: forall a. a -> STM (RWST r w s m) (TMVar (RWST r w s m) a)
newTMVar       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => a -> STM m (TMVar m a)
newTMVar
    newEmptyTMVar :: forall a. STM (RWST r w s m) (TMVar (RWST r w s m) a)
newEmptyTMVar  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift    forall (m :: * -> *) a. MonadSTM m => STM m (TMVar m a)
newEmptyTMVar
    takeTMVar :: forall a. TMVar (RWST r w s m) a -> STM (RWST r w s m) a
takeTMVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m a
takeTMVar
    tryTakeTMVar :: forall a. TMVar (RWST r w s m) a -> STM (RWST r w s m) (Maybe a)
tryTakeTMVar   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m (Maybe a)
tryTakeTMVar
    putTMVar :: forall a. TMVar (RWST r w s m) a -> a -> STM (RWST r w s m) ()
putTMVar       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m ()
putTMVar
    tryPutTMVar :: forall a. TMVar (RWST r w s m) a -> a -> STM (RWST r w s m) Bool
tryPutTMVar    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m Bool
tryPutTMVar
    readTMVar :: forall a. TMVar (RWST r w s m) a -> STM (RWST r w s m) a
readTMVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m a
readTMVar
    tryReadTMVar :: forall a. TMVar (RWST r w s m) a -> STM (RWST r w s m) (Maybe a)
tryReadTMVar   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m (Maybe a)
tryReadTMVar
    swapTMVar :: forall a. TMVar (RWST r w s m) a -> a -> STM (RWST r w s m) a
swapTMVar      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m a
swapTMVar
    isEmptyTMVar :: forall a. TMVar (RWST r w s m) a -> STM (RWST r w s m) Bool
isEmptyTMVar   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TMVar m a -> STM m Bool
isEmptyTMVar

    type TQueue (Strict.RWST r w s m) = TQueue m
    newTQueue :: forall a. STM (RWST r w s m) (TQueue (RWST r w s m) a)
newTQueue      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *) a. MonadSTM m => STM m (TQueue m a)
newTQueue
    readTQueue :: forall a. TQueue (RWST r w s m) a -> STM (RWST r w s m) a
readTQueue     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
readTQueue
    tryReadTQueue :: forall a. TQueue (RWST r w s m) a -> STM (RWST r w s m) (Maybe a)
tryReadTQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryReadTQueue
    peekTQueue :: forall a. TQueue (RWST r w s m) a -> STM (RWST r w s m) a
peekTQueue     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
peekTQueue
    tryPeekTQueue :: forall a. TQueue (RWST r w s m) a -> STM (RWST r w s m) (Maybe a)
tryPeekTQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryPeekTQueue
    flushTQueue :: forall a. TQueue (RWST r w s m) a -> STM (RWST r w s m) [a]
flushTQueue    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m [a]
flushTQueue
    writeTQueue :: forall a. TQueue (RWST r w s m) a -> a -> STM (RWST r w s m) ()
writeTQueue TQueue (RWST r w s m) a
v  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> a -> STM m ()
writeTQueue TQueue (RWST r w s m) a
v
    isEmptyTQueue :: forall a. TQueue (RWST r w s m) a -> STM (RWST r w s m) Bool
isEmptyTQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m Bool
isEmptyTQueue
    unGetTQueue :: forall a. TQueue (RWST r w s m) a -> a -> STM (RWST r w s m) ()
unGetTQueue    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TQueue m a -> a -> STM m ()
unGetTQueue

    type TBQueue (Strict.RWST r w s m) = TBQueue m
    newTBQueue :: forall a. Natural -> STM (RWST r w s m) (TBQueue (RWST r w s m) a)
newTBQueue     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a.
MonadSTM m =>
Natural -> STM m (TBQueue m a)
newTBQueue
    readTBQueue :: forall a. TBQueue (RWST r w s m) a -> STM (RWST r w s m) a
readTBQueue    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m a
readTBQueue
    tryReadTBQueue :: forall a. TBQueue (RWST r w s m) a -> STM (RWST r w s m) (Maybe a)
tryReadTBQueue = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a.
MonadSTM m =>
TBQueue m a -> STM m (Maybe a)
tryReadTBQueue
    peekTBQueue :: forall a. TBQueue (RWST r w s m) a -> STM (RWST r w s m) a
peekTBQueue    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m a
peekTBQueue
    tryPeekTBQueue :: forall a. TBQueue (RWST r w s m) a -> STM (RWST r w s m) (Maybe a)
tryPeekTBQueue = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a.
MonadSTM m =>
TBQueue m a -> STM m (Maybe a)
tryPeekTBQueue
    flushTBQueue :: forall a. TBQueue (RWST r w s m) a -> STM (RWST r w s m) [a]
flushTBQueue   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m [a]
flushTBQueue
    writeTBQueue :: forall a. TBQueue (RWST r w s m) a -> a -> STM (RWST r w s m) ()
writeTBQueue   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> a -> STM m ()
writeTBQueue
    lengthTBQueue :: forall a. TBQueue (RWST r w s m) a -> STM (RWST r w s m) Natural
lengthTBQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m Natural
lengthTBQueue
    isEmptyTBQueue :: forall a. TBQueue (RWST r w s m) a -> STM (RWST r w s m) Bool
isEmptyTBQueue = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m Bool
isEmptyTBQueue
    isFullTBQueue :: forall a. TBQueue (RWST r w s m) a -> STM (RWST r w s m) Bool
isFullTBQueue  = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> STM m Bool
isFullTBQueue
    unGetTBQueue :: forall a. TBQueue (RWST r w s m) a -> a -> STM (RWST r w s m) ()
unGetTBQueue   = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TBQueue m a -> a -> STM m ()
unGetTBQueue

    type TArray (Strict.RWST r w s m) = TArray m

    type TSem (Strict.RWST r w s m) = TSem m
    newTSem :: Integer -> STM (RWST r w s m) (TSem (RWST r w s m))
newTSem        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => Integer -> STM m (TSem m)
newTSem
    waitTSem :: TSem (RWST r w s m) -> STM (RWST r w s m) ()
waitTSem       = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
waitTSem
    signalTSem :: TSem (RWST r w s m) -> STM (RWST r w s m) ()
signalTSem     = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
signalTSem
    signalTSemN :: Natural -> TSem (RWST r w s m) -> STM (RWST r w s m) ()
signalTSemN    = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *). MonadSTM m => Natural -> TSem m -> STM m ()
signalTSemN

    type TChan (Strict.RWST r w s m) = TChan m
    newTChan :: forall a. STM (RWST r w s m) (TChan (RWST r w s m) a)
newTChan          = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift    forall (m :: * -> *) a. MonadSTM m => STM m (TChan m a)
newTChan
    newBroadcastTChan :: forall a. STM (RWST r w s m) (TChan (RWST r w s m) a)
newBroadcastTChan = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift    forall (m :: * -> *) a. MonadSTM m => STM m (TChan m a)
newBroadcastTChan
    dupTChan :: forall a.
TChan (RWST r w s m) a
-> STM (RWST r w s m) (TChan (RWST r w s m) a)
dupTChan          = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
TChan m a -> STM m (TChan m a)
dupTChan
    cloneTChan :: forall a.
TChan (RWST r w s m) a
-> STM (RWST r w s m) (TChan (RWST r w s m) a)
cloneTChan        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a.
MonadSTM m =>
TChan m a -> STM m (TChan m a)
cloneTChan
    readTChan :: forall a. TChan (RWST r w s m) a -> STM (RWST r w s m) a
readTChan         = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m a
readTChan
    tryReadTChan :: forall a. TChan (RWST r w s m) a -> STM (RWST r w s m) (Maybe a)
tryReadTChan      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m (Maybe a)
tryReadTChan
    peekTChan :: forall a. TChan (RWST r w s m) a -> STM (RWST r w s m) a
peekTChan         = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m a
peekTChan
    tryPeekTChan :: forall a. TChan (RWST r w s m) a -> STM (RWST r w s m) (Maybe a)
tryPeekTChan      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m (Maybe a)
tryPeekTChan
    writeTChan :: forall a. TChan (RWST r w s m) a -> a -> STM (RWST r w s m) ()
writeTChan        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TChan m a -> a -> STM m ()
writeTChan
    unGetTChan :: forall a. TChan (RWST r w s m) a -> a -> STM (RWST r w s m) ()
unGetTChan        = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: forall (m :: * -> *) a. MonadSTM m => TChan m a -> a -> STM m ()
unGetTChan
    isEmptyTChan :: forall a. TChan (RWST r w s m) a -> STM (RWST r w s m) Bool
isEmptyTChan      = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
.  forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m Bool
isEmptyTChan


(.:) :: (c -> d) -> (a -> b -> c) -> (a -> b -> d)
(c -> d
f .: :: forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: a -> b -> c
g) a
x b
y = c -> d
f (a -> b -> c
g a
x b
y)