{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# 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.RWS.Lazy qualified as Lazy
import Control.Monad.RWS.Strict qualified as Strict
import Control.Monad.State.Lazy qualified as Lazy
import Control.Monad.State.Strict qualified as Strict
import Control.Monad.Trans (lift)
import Control.Monad.Writer.Lazy qualified as Lazy
import Control.Monad.Writer.Strict qualified as Strict
import Control.Monad.Class.MonadSTM.Internal
import Control.Monad.Class.MonadThrow qualified as MonadThrow
import Data.Array.Base (MArray (..))
import Data.Function (on)
import Data.Kind (Type)
import Data.Proxy (Proxy (..))
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 = a -> a -> a
forall a. Semigroup a => a -> a -> a
(<>) (a -> a -> a) -> ContTSTM r m a -> ContTSTM r m (a -> a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ContTSTM r m a
a ContTSTM r m (a -> a) -> ContTSTM r m a -> ContTSTM r m a
forall a b.
ContTSTM r m (a -> b) -> ContTSTM r m a -> ContTSTM r m b
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 = a -> ContTSTM r m a
forall a. a -> ContTSTM r m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure a
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 = STM m (i, i) -> ContTSTM r m (i, i)
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m (i, i) -> ContTSTM r m (i, i))
-> (e i a -> STM m (i, i)) -> e i a -> ContTSTM r m (i, i)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. e i a -> STM m (i, i)
forall i. Ix i => e i a -> STM m (i, i)
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 = STM m Int -> ContTSTM r m Int
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m Int -> ContTSTM r m Int)
-> (e i a -> STM m Int) -> e i a -> ContTSTM r m Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. e i a -> STM m Int
forall i. Ix i => e i a -> STM m Int
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 = STM m a -> ContTSTM r m a
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m a -> ContTSTM r m a)
-> (Int -> STM m a) -> Int -> ContTSTM r m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. e i a -> Int -> STM m a
forall i. Ix i => e i a -> Int -> STM m a
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 = STM m () -> ContTSTM r m ()
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m () -> ContTSTM r m ())
-> (a -> STM m ()) -> a -> ContTSTM r m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. e i a -> Int -> a -> STM m ()
forall i. Ix i => e i a -> Int -> a -> STM m ()
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite e i a
arr Int
i
#if __GLASGOW_HASKELL__ >= 910
newArray :: forall i. Ix i => (i, i) -> a -> ContTSTM r m (e i a)
newArray (i, i)
idxs = STM m (e i a) -> ContTSTM r m (e i a)
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m (e i a) -> ContTSTM r m (e i a))
-> (a -> STM m (e i a)) -> a -> ContTSTM r m (e i a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (i, i) -> a -> STM m (e i a)
forall i. Ix i => (i, i) -> a -> STM m (e i a)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
idxs
#endif
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 = STM m a -> ContTSTM r m a
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m a -> ContTSTM r m a)
-> (e -> STM m a) -> e -> ContTSTM r m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. e -> STM m a
forall e a. Exception e => e -> STM m a
forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
MonadThrow.throwIO
#if __GLASGOW_HASKELL__ >= 910
annotateIO :: forall e a.
ExceptionAnnotation e =>
e -> ContTSTM r m a -> ContTSTM r m a
annotateIO e
ann (ContTSTM STM m a
stm) = STM m a -> ContTSTM r m a
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (e -> STM m a -> STM m a
forall e a. ExceptionAnnotation e => e -> STM m a -> STM m a
forall (m :: * -> *) e a.
(MonadThrow m, ExceptionAnnotation e) =>
e -> m a -> m a
MonadThrow.annotateIO e
ann STM m a
stm)
#endif
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 = STM m a -> ContTSTM r m a
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM
(STM m a -> ContTSTM r m a) -> STM m a -> ContTSTM r m a
forall a b. (a -> b) -> a -> b
$ STM m a -> (e -> STM m a) -> STM m a
forall e a. Exception e => STM m a -> (e -> STM m a) -> STM m a
forall (m :: * -> *) e a.
(MonadCatch m, Exception e) =>
m a -> (e -> m a) -> m a
MonadThrow.catch (ContTSTM r m a -> STM m a
forall r (m :: * -> *) a. ContTSTM r m a -> STM m a
getContTSTM ContTSTM r m a
action) (ContTSTM r m a -> STM m a
forall r (m :: * -> *) a. ContTSTM r m a -> STM m a
getContTSTM (ContTSTM r m a -> STM m a)
-> (e -> ContTSTM r m a) -> e -> STM m a
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 = STM m (b, c) -> ContTSTM r m (b, c)
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m (b, c) -> ContTSTM r m (b, c))
-> STM m (b, c) -> ContTSTM r m (b, c)
forall a b. (a -> b) -> a -> b
$
STM m a
-> (a -> ExitCase b -> STM m c) -> (a -> STM m b) -> STM m (b, c)
forall a b c.
STM m a
-> (a -> ExitCase b -> STM m c) -> (a -> STM m b) -> STM m (b, c)
forall (m :: * -> *) a b c.
MonadCatch m =>
m a -> (a -> ExitCase b -> m c) -> (a -> m b) -> m (b, c)
MonadThrow.generalBracket (ContTSTM r m a -> STM m a
forall r (m :: * -> *) a. ContTSTM r m a -> STM m a
getContTSTM ContTSTM r m a
acquire)
(ContTSTM r m c -> STM m c
forall r (m :: * -> *) a. ContTSTM r m a -> STM m a
getContTSTM (ContTSTM r m c -> STM m c)
-> (a -> ExitCase b -> ContTSTM r m c)
-> a
-> ExitCase b
-> STM m c
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: a -> ExitCase b -> ContTSTM r m c
release)
(ContTSTM r m b -> STM m b
forall r (m :: * -> *) a. ContTSTM r m a -> STM m a
getContTSTM (ContTSTM r m b -> STM m b)
-> (a -> ContTSTM r m b) -> a -> STM m b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> ContTSTM r m b
use)
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 = m a -> ContT r m a
forall (m :: * -> *) a. Monad m => m a -> ContT r m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m a -> ContT r m a)
-> (ContTSTM r m a -> m a) -> ContTSTM r m a -> ContT r m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. STM m a -> m a
forall a. HasCallStack => STM m a -> m a
forall (m :: * -> *) a.
(MonadSTM m, HasCallStack) =>
STM m a -> m a
atomically (STM m a -> m a)
-> (ContTSTM r m a -> STM m a) -> ContTSTM r m a -> m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContTSTM r m a -> STM m a
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 = STM m (TVar m a) -> ContTSTM r m (TVar m a)
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m (TVar m a) -> ContTSTM r m (TVar m a))
-> (a -> STM m (TVar m a)) -> a -> ContTSTM r m (TVar m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> STM m (TVar m a)
forall a. a -> STM m (TVar m a)
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 = STM m a -> ContTSTM r m a
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m a -> ContTSTM r m a)
-> (TVar m a -> STM m a) -> TVar m a -> ContTSTM r m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TVar m a -> STM m a
forall a. TVar m a -> STM m a
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 = STM m () -> ContTSTM r m ()
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m () -> ContTSTM r m ())
-> (TVar m a -> a -> STM m ()) -> TVar m a -> a -> ContTSTM r m ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> a -> STM m ()
forall a. TVar m a -> a -> STM m ()
forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m ()
writeTVar
retry :: forall a. STM (ContT r m) a
retry = STM m a -> ContTSTM r m a
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM STM m a
forall a. STM m a
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 = STM m a -> ContTSTM r m a
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m a -> ContTSTM r m a)
-> (ContTSTM r m a -> ContTSTM r m a -> STM m a)
-> ContTSTM r m a
-> ContTSTM r m a
-> ContTSTM r m a
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: (STM m a -> STM m a -> STM m a)
-> (ContTSTM r m a -> STM m a)
-> ContTSTM r m a
-> ContTSTM r m a
-> STM m a
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
on STM m a -> STM m a -> STM m a
forall a. STM m a -> STM m a -> STM m a
forall (m :: * -> *) a. MonadSTM m => STM m a -> STM m a -> STM m a
orElse ContTSTM r m a -> STM m a
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 = STM m () -> ContTSTM r m ()
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m () -> ContTSTM r m ())
-> (TVar m a -> (a -> a) -> STM m ())
-> TVar m a
-> (a -> a)
-> ContTSTM r m ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> (a -> a) -> STM m ()
forall a. TVar m a -> (a -> a) -> STM m ()
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' = STM m () -> ContTSTM r m ()
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m () -> ContTSTM r m ())
-> (TVar m a -> (a -> a) -> STM m ())
-> TVar m a
-> (a -> a)
-> ContTSTM r m ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> (a -> a) -> STM m ()
forall a. TVar m a -> (a -> a) -> STM m ()
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 = STM m a -> ContTSTM r m a
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m a -> ContTSTM r m a)
-> (TVar m s -> (s -> (a, s)) -> STM m a)
-> TVar m s
-> (s -> (a, s))
-> ContTSTM r m a
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m s -> (s -> (a, s)) -> STM m a
forall s a. TVar m s -> (s -> (a, s)) -> STM m a
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 = STM m a -> ContTSTM r m a
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m a -> ContTSTM r m a)
-> (TVar m a -> a -> STM m a) -> TVar m a -> a -> ContTSTM r m a
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> a -> STM m a
forall a. TVar m a -> a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m a
swapTVar
check :: Bool -> STM (ContT r m) ()
check = STM m () -> ContTSTM r m ()
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m () -> ContTSTM r m ())
-> (Bool -> STM m ()) -> Bool -> ContTSTM r m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> STM m ()
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 = STM m (TMVar m a) -> ContTSTM r m (TMVar m a)
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m (TMVar m a) -> ContTSTM r m (TMVar m a))
-> (a -> STM m (TMVar m a)) -> a -> ContTSTM r m (TMVar m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> STM m (TMVar m a)
forall a. a -> STM m (TMVar m a)
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 = STM m (TMVar m a) -> ContTSTM r m (TMVar m a)
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM STM m (TMVar m a)
forall a. STM m (TMVar m a)
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 = STM m a -> ContTSTM r m a
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m a -> ContTSTM r m a)
-> (TMVar m a -> STM m a) -> TMVar m a -> ContTSTM r m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m a
forall a. TMVar m a -> STM m a
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 = STM m (Maybe a) -> ContTSTM r m (Maybe a)
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m (Maybe a) -> ContTSTM r m (Maybe a))
-> (TMVar m a -> STM m (Maybe a))
-> TMVar m a
-> ContTSTM r m (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m (Maybe a)
forall a. TMVar m a -> STM m (Maybe a)
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 = STM m () -> ContTSTM r m ()
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m () -> ContTSTM r m ())
-> (TMVar m a -> a -> STM m ())
-> TMVar m a
-> a
-> ContTSTM r m ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m ()
forall a. TMVar m a -> a -> STM m ()
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 = STM m Bool -> ContTSTM r m Bool
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m Bool -> ContTSTM r m Bool)
-> (TMVar m a -> a -> STM m Bool)
-> TMVar m a
-> a
-> ContTSTM r m Bool
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m Bool
forall a. TMVar m a -> a -> STM m Bool
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 = STM m a -> ContTSTM r m a
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m a -> ContTSTM r m a)
-> (TMVar m a -> STM m a) -> TMVar m a -> ContTSTM r m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m a
forall a. TMVar m a -> STM m a
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 = STM m (Maybe a) -> ContTSTM r m (Maybe a)
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m (Maybe a) -> ContTSTM r m (Maybe a))
-> (TMVar m a -> STM m (Maybe a))
-> TMVar m a
-> ContTSTM r m (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m (Maybe a)
forall a. TMVar m a -> STM m (Maybe a)
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 = STM m a -> ContTSTM r m a
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m a -> ContTSTM r m a)
-> (TMVar m a -> a -> STM m a) -> TMVar m a -> a -> ContTSTM r m a
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m a
forall a. TMVar m a -> a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m a
swapTMVar
writeTMVar :: forall a. TMVar (ContT r m) a -> a -> STM (ContT r m) ()
writeTMVar = STM m () -> ContTSTM r m ()
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m () -> ContTSTM r m ())
-> (TMVar m a -> a -> STM m ())
-> TMVar m a
-> a
-> ContTSTM r m ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m ()
forall a. TMVar m a -> a -> STM m ()
forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m ()
writeTMVar
isEmptyTMVar :: forall a. TMVar (ContT r m) a -> STM (ContT r m) Bool
isEmptyTMVar = STM m Bool -> ContTSTM r m Bool
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m Bool -> ContTSTM r m Bool)
-> (TMVar m a -> STM m Bool) -> TMVar m a -> ContTSTM r m Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m Bool
forall a. TMVar m a -> STM m Bool
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 = STM m (TQueue m a) -> ContTSTM r m (TQueue m a)
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM STM m (TQueue m a)
forall a. STM m (TQueue m a)
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 = STM m a -> ContTSTM r m a
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m a -> ContTSTM r m a)
-> (TQueue m a -> STM m a) -> TQueue m a -> ContTSTM r m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m a
forall a. TQueue m a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
readTQueue
tryReadTQueue :: forall a. TQueue (ContT r m) a -> STM (ContT r m) (Maybe a)
tryReadTQueue = STM m (Maybe a) -> ContTSTM r m (Maybe a)
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m (Maybe a) -> ContTSTM r m (Maybe a))
-> (TQueue m a -> STM m (Maybe a))
-> TQueue m a
-> ContTSTM r m (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m (Maybe a)
forall a. TQueue m a -> STM m (Maybe a)
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryReadTQueue
peekTQueue :: forall a. TQueue (ContT r m) a -> STM (ContT r m) a
peekTQueue = STM m a -> ContTSTM r m a
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m a -> ContTSTM r m a)
-> (TQueue m a -> STM m a) -> TQueue m a -> ContTSTM r m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m a
forall a. TQueue m a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
peekTQueue
tryPeekTQueue :: forall a. TQueue (ContT r m) a -> STM (ContT r m) (Maybe a)
tryPeekTQueue = STM m (Maybe a) -> ContTSTM r m (Maybe a)
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m (Maybe a) -> ContTSTM r m (Maybe a))
-> (TQueue m a -> STM m (Maybe a))
-> TQueue m a
-> ContTSTM r m (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m (Maybe a)
forall a. TQueue m a -> STM m (Maybe a)
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryPeekTQueue
flushTQueue :: forall a. TQueue (ContT r m) a -> STM (ContT r m) [a]
flushTQueue = STM m [a] -> ContTSTM r m [a]
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m [a] -> ContTSTM r m [a])
-> (TQueue m a -> STM m [a]) -> TQueue m a -> ContTSTM r m [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m [a]
forall a. TQueue m a -> STM m [a]
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m [a]
flushTQueue
writeTQueue :: forall a. TQueue (ContT r m) a -> a -> STM (ContT r m) ()
writeTQueue TQueue (ContT r m) a
v = STM m () -> ContTSTM r m ()
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m () -> ContTSTM r m ())
-> (a -> STM m ()) -> a -> ContTSTM r m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> a -> STM m ()
forall a. TQueue m a -> a -> STM m ()
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> a -> STM m ()
writeTQueue TQueue m a
TQueue (ContT r m) a
v
isEmptyTQueue :: forall a. TQueue (ContT r m) a -> STM (ContT r m) Bool
isEmptyTQueue = STM m Bool -> ContTSTM r m Bool
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m Bool -> ContTSTM r m Bool)
-> (TQueue m a -> STM m Bool) -> TQueue m a -> ContTSTM r m Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m Bool
forall a. TQueue m a -> STM m Bool
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m Bool
isEmptyTQueue
unGetTQueue :: forall a. TQueue (ContT r m) a -> a -> STM (ContT r m) ()
unGetTQueue = STM m () -> ContTSTM r m ()
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m () -> ContTSTM r m ())
-> (TQueue m a -> a -> STM m ())
-> TQueue m a
-> a
-> ContTSTM r m ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TQueue m a -> a -> STM m ()
forall a. TQueue m a -> a -> STM m ()
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 = STM m (TBQueue m a) -> ContTSTM r m (TBQueue m a)
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m (TBQueue m a) -> ContTSTM r m (TBQueue m a))
-> (Natural -> STM m (TBQueue m a))
-> Natural
-> ContTSTM r m (TBQueue m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Natural -> STM m (TBQueue m a)
forall a. Natural -> STM m (TBQueue m a)
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 = STM m a -> ContTSTM r m a
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m a -> ContTSTM r m a)
-> (TBQueue m a -> STM m a) -> TBQueue m a -> ContTSTM r m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m a
forall a. TBQueue m a -> STM m a
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 = STM m (Maybe a) -> ContTSTM r m (Maybe a)
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m (Maybe a) -> ContTSTM r m (Maybe a))
-> (TBQueue m a -> STM m (Maybe a))
-> TBQueue m a
-> ContTSTM r m (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m (Maybe a)
forall a. TBQueue m a -> STM m (Maybe a)
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 = STM m a -> ContTSTM r m a
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m a -> ContTSTM r m a)
-> (TBQueue m a -> STM m a) -> TBQueue m a -> ContTSTM r m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m a
forall a. TBQueue m a -> STM m a
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 = STM m (Maybe a) -> ContTSTM r m (Maybe a)
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m (Maybe a) -> ContTSTM r m (Maybe a))
-> (TBQueue m a -> STM m (Maybe a))
-> TBQueue m a
-> ContTSTM r m (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m (Maybe a)
forall a. TBQueue m a -> STM m (Maybe a)
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 = STM m [a] -> ContTSTM r m [a]
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m [a] -> ContTSTM r m [a])
-> (TBQueue m a -> STM m [a]) -> TBQueue m a -> ContTSTM r m [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m [a]
forall a. TBQueue m a -> STM m [a]
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 = STM m () -> ContTSTM r m ()
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m () -> ContTSTM r m ())
-> (TBQueue m a -> a -> STM m ())
-> TBQueue m a
-> a
-> ContTSTM r m ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TBQueue m a -> a -> STM m ()
forall a. TBQueue m a -> a -> STM m ()
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 = STM m Natural -> ContTSTM r m Natural
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m Natural -> ContTSTM r m Natural)
-> (TBQueue m a -> STM m Natural)
-> TBQueue m a
-> ContTSTM r m Natural
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m Natural
forall a. TBQueue m a -> STM m Natural
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 = STM m Bool -> ContTSTM r m Bool
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m Bool -> ContTSTM r m Bool)
-> (TBQueue m a -> STM m Bool) -> TBQueue m a -> ContTSTM r m Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m Bool
forall a. TBQueue m a -> STM m Bool
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 = STM m Bool -> ContTSTM r m Bool
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m Bool -> ContTSTM r m Bool)
-> (TBQueue m a -> STM m Bool) -> TBQueue m a -> ContTSTM r m Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m Bool
forall a. TBQueue m a -> STM m Bool
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 = STM m () -> ContTSTM r m ()
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m () -> ContTSTM r m ())
-> (TBQueue m a -> a -> STM m ())
-> TBQueue m a
-> a
-> ContTSTM r m ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TBQueue m a -> a -> STM m ()
forall a. TBQueue m a -> a -> STM m ()
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 = STM m (TSem m) -> ContTSTM r m (TSem m)
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m (TSem m) -> ContTSTM r m (TSem m))
-> (Integer -> STM m (TSem m)) -> Integer -> ContTSTM r m (TSem m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> STM m (TSem m)
forall (m :: * -> *). MonadSTM m => Integer -> STM m (TSem m)
newTSem
waitTSem :: TSem (ContT r m) -> STM (ContT r m) ()
waitTSem = STM m () -> ContTSTM r m ()
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m () -> ContTSTM r m ())
-> (TSem m -> STM m ()) -> TSem m -> ContTSTM r m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TSem m -> STM m ()
forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
waitTSem
signalTSem :: TSem (ContT r m) -> STM (ContT r m) ()
signalTSem = STM m () -> ContTSTM r m ()
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m () -> ContTSTM r m ())
-> (TSem m -> STM m ()) -> TSem m -> ContTSTM r m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TSem m -> STM m ()
forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
signalTSem
signalTSemN :: Natural -> TSem (ContT r m) -> STM (ContT r m) ()
signalTSemN = STM m () -> ContTSTM r m ()
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m () -> ContTSTM r m ())
-> (Natural -> TSem m -> STM m ())
-> Natural
-> TSem m
-> ContTSTM r m ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Natural -> TSem m -> STM m ()
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 = STM m (TChan m a) -> ContTSTM r m (TChan m a)
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM STM m (TChan m a)
forall a. STM m (TChan m a)
forall (m :: * -> *) a. MonadSTM m => STM m (TChan m a)
newTChan
newBroadcastTChan :: forall a. STM (ContT r m) (TChan (ContT r m) a)
newBroadcastTChan = STM m (TChan m a) -> ContTSTM r m (TChan m a)
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM STM m (TChan m a)
forall a. STM m (TChan m a)
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 = STM m (TChan m a) -> ContTSTM r m (TChan m a)
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m (TChan m a) -> ContTSTM r m (TChan m a))
-> (TChan m a -> STM m (TChan m a))
-> TChan m a
-> ContTSTM r m (TChan m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (TChan m a)
forall a. TChan m a -> STM m (TChan m a)
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 = STM m (TChan m a) -> ContTSTM r m (TChan m a)
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m (TChan m a) -> ContTSTM r m (TChan m a))
-> (TChan m a -> STM m (TChan m a))
-> TChan m a
-> ContTSTM r m (TChan m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (TChan m a)
forall a. TChan m a -> STM m (TChan m a)
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 = STM m a -> ContTSTM r m a
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m a -> ContTSTM r m a)
-> (TChan m a -> STM m a) -> TChan m a -> ContTSTM r m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m a
forall a. TChan m a -> STM m a
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 = STM m (Maybe a) -> ContTSTM r m (Maybe a)
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m (Maybe a) -> ContTSTM r m (Maybe a))
-> (TChan m a -> STM m (Maybe a))
-> TChan m a
-> ContTSTM r m (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (Maybe a)
forall a. TChan m a -> STM m (Maybe a)
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 = STM m a -> ContTSTM r m a
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m a -> ContTSTM r m a)
-> (TChan m a -> STM m a) -> TChan m a -> ContTSTM r m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m a
forall a. TChan m a -> STM m a
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 = STM m (Maybe a) -> ContTSTM r m (Maybe a)
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m (Maybe a) -> ContTSTM r m (Maybe a))
-> (TChan m a -> STM m (Maybe a))
-> TChan m a
-> ContTSTM r m (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (Maybe a)
forall a. TChan m a -> STM m (Maybe a)
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 = STM m () -> ContTSTM r m ()
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m () -> ContTSTM r m ())
-> (TChan m a -> a -> STM m ())
-> TChan m a
-> a
-> ContTSTM r m ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TChan m a -> a -> STM m ()
forall a. TChan m a -> a -> STM m ()
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 = STM m () -> ContTSTM r m ()
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m () -> ContTSTM r m ())
-> (TChan m a -> a -> STM m ())
-> TChan m a
-> a
-> ContTSTM r m ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TChan m a -> a -> STM m ()
forall a. TChan m a -> a -> STM m ()
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 = STM m Bool -> ContTSTM r m Bool
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m Bool -> ContTSTM r m Bool)
-> (TChan m a -> STM m Bool) -> TChan m a -> ContTSTM r m Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m Bool
forall a. TChan m a -> STM m Bool
forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m Bool
isEmptyTChan
instance MonadInspectSTM m => MonadInspectSTM (ContT r m) where
type InspectMonad (ContT r m) = InspectMonad m
inspectTVar :: forall (proxy :: (* -> *) -> *) a.
proxy (ContT r m)
-> TVar (ContT r m) a -> InspectMonad (ContT r m) a
inspectTVar proxy (ContT r m)
_ = Proxy m -> TVar m a -> InspectMonad m a
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadInspectSTM m =>
proxy m -> TVar m a -> InspectMonad m a
forall (proxy :: (* -> *) -> *) a.
proxy m -> TVar m a -> InspectMonad m a
inspectTVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
inspectTMVar :: forall (proxy :: (* -> *) -> *) a.
proxy (ContT r m)
-> TMVar (ContT r m) a -> InspectMonad (ContT r m) (Maybe a)
inspectTMVar proxy (ContT r m)
_ = Proxy m -> TMVar m a -> InspectMonad m (Maybe a)
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadInspectSTM m =>
proxy m -> TMVar m a -> InspectMonad m (Maybe a)
forall (proxy :: (* -> *) -> *) a.
proxy m -> TMVar m a -> InspectMonad m (Maybe a)
inspectTMVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
instance MonadTraceSTM m => MonadTraceSTM (ContT r m) where
traceTVar :: forall (proxy :: (* -> *) -> *) a.
proxy (ContT r m)
-> TVar (ContT r m) a
-> (Maybe a -> a -> InspectMonad (ContT r m) TraceValue)
-> STM (ContT r m) ()
traceTVar proxy (ContT r m)
_ = STM m () -> ContTSTM r m ()
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m () -> ContTSTM r m ())
-> (TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue) -> STM m ())
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> ContTSTM r m ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> STM m ()
traceTVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTMVar :: forall (proxy :: (* -> *) -> *) a.
proxy (ContT r m)
-> TMVar (ContT r m) a
-> (Maybe (Maybe a)
-> Maybe a -> InspectMonad (ContT r m) TraceValue)
-> STM (ContT r m) ()
traceTMVar proxy (ContT r m)
_ = STM m () -> ContTSTM r m ()
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m () -> ContTSTM r m ())
-> (TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ())
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> ContTSTM r m ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ()
traceTMVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTQueue :: forall (proxy :: (* -> *) -> *) a.
proxy (ContT r m)
-> TQueue (ContT r m) a
-> (Maybe [a] -> [a] -> InspectMonad (ContT r m) TraceValue)
-> STM (ContT r m) ()
traceTQueue proxy (ContT r m)
_ = STM m () -> ContTSTM r m ()
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m () -> ContTSTM r m ())
-> (TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> STM m ())
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> ContTSTM r m ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
traceTQueue (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTBQueue :: forall (proxy :: (* -> *) -> *) a.
proxy (ContT r m)
-> TBQueue (ContT r m) a
-> (Maybe [a] -> [a] -> InspectMonad (ContT r m) TraceValue)
-> STM (ContT r m) ()
traceTBQueue proxy (ContT r m)
_ = STM m () -> ContTSTM r m ()
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m () -> ContTSTM r m ())
-> (TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> STM m ())
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> ContTSTM r m ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
traceTBQueue (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTSem :: forall (proxy :: (* -> *) -> *).
proxy (ContT r m)
-> TSem (ContT r m)
-> (Maybe Integer
-> Integer -> InspectMonad (ContT r m) TraceValue)
-> STM (ContT r m) ()
traceTSem proxy (ContT r m)
_ = STM m () -> ContTSTM r m ()
forall r (m :: * -> *) a. STM m a -> ContTSTM r m a
ContTSTM (STM m () -> ContTSTM r m ())
-> (TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ())
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> ContTSTM r m ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *).
MonadTraceSTM m =>
proxy m
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *).
proxy m
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ()
traceTSem (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
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) = m (a, w) -> WriterT w m a
forall w (m :: * -> *) a. m (a, w) -> WriterT w m a
Lazy.WriterT (STM m (a, w) -> m (a, w)
forall a. HasCallStack => STM m a -> m a
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 = STM m (TVar m a) -> WriterT w (STM m) (TVar m a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TVar m a) -> WriterT w (STM m) (TVar m a))
-> (a -> STM m (TVar m a)) -> a -> WriterT w (STM m) (TVar m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> STM m (TVar m a)
forall a. a -> STM m (TVar m a)
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 = STM m a -> WriterT w (STM m) a
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> WriterT w (STM m) a)
-> (TVar m a -> STM m a) -> TVar m a -> WriterT w (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TVar m a -> STM m a
forall a. TVar m a -> STM m a
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 = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TVar m a -> a -> STM m ())
-> TVar m a
-> a
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> a -> STM m ()
forall a. TVar m a -> a -> STM m ()
forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m ()
writeTVar
retry :: forall a. STM (WriterT w m) a
retry = STM m a -> WriterT w (STM m) a
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m a
forall a. STM m a
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) = STM m (a, w) -> WriterT w (STM m) a
forall w (m :: * -> *) a. m (a, w) -> WriterT w m a
Lazy.WriterT (STM m (a, w) -> WriterT w (STM m) a)
-> STM m (a, w) -> WriterT w (STM m) a
forall a b. (a -> b) -> a -> b
$ STM m (a, w)
a STM m (a, w) -> STM m (a, w) -> STM m (a, w)
forall a. STM m a -> STM m a -> STM m 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 = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TVar m a -> (a -> a) -> STM m ())
-> TVar m a
-> (a -> a)
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> (a -> a) -> STM m ()
forall a. TVar m a -> (a -> a) -> STM m ()
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' = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TVar m a -> (a -> a) -> STM m ())
-> TVar m a
-> (a -> a)
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> (a -> a) -> STM m ()
forall a. TVar m a -> (a -> a) -> STM m ()
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 = STM m a -> WriterT w (STM m) a
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> WriterT w (STM m) a)
-> (TVar m s -> (s -> (a, s)) -> STM m a)
-> TVar m s
-> (s -> (a, s))
-> WriterT w (STM m) a
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m s -> (s -> (a, s)) -> STM m a
forall s a. TVar m s -> (s -> (a, s)) -> STM m a
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 = STM m a -> WriterT w (STM m) a
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> WriterT w (STM m) a)
-> (TVar m a -> a -> STM m a)
-> TVar m a
-> a
-> WriterT w (STM m) a
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> a -> STM m a
forall a. TVar m a -> a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m a
swapTVar
check :: Bool -> STM (WriterT w m) ()
check = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (Bool -> STM m ()) -> Bool -> WriterT w (STM m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> STM m ()
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 = STM m (TMVar m a) -> WriterT w (STM m) (TMVar m a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TMVar m a) -> WriterT w (STM m) (TMVar m a))
-> (a -> STM m (TMVar m a)) -> a -> WriterT w (STM m) (TMVar m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> STM m (TMVar m a)
forall a. a -> STM m (TMVar m a)
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 = STM m (TMVar m a) -> WriterT w (STM m) (TMVar m a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m (TMVar m a)
forall a. STM m (TMVar m a)
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 = STM m a -> WriterT w (STM m) a
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> WriterT w (STM m) a)
-> (TMVar m a -> STM m a) -> TMVar m a -> WriterT w (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m a
forall a. TMVar m a -> STM m a
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 = STM m (Maybe a) -> WriterT w (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> WriterT w (STM m) (Maybe a))
-> (TMVar m a -> STM m (Maybe a))
-> TMVar m a
-> WriterT w (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m (Maybe a)
forall a. TMVar m a -> STM m (Maybe a)
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 = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TMVar m a -> a -> STM m ())
-> TMVar m a
-> a
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m ()
forall a. TMVar m a -> a -> STM m ()
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 = STM m Bool -> WriterT w (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> WriterT w (STM m) Bool)
-> (TMVar m a -> a -> STM m Bool)
-> TMVar m a
-> a
-> WriterT w (STM m) Bool
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m Bool
forall a. TMVar m a -> a -> STM m Bool
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 = STM m a -> WriterT w (STM m) a
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> WriterT w (STM m) a)
-> (TMVar m a -> STM m a) -> TMVar m a -> WriterT w (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m a
forall a. TMVar m a -> STM m a
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 = STM m (Maybe a) -> WriterT w (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> WriterT w (STM m) (Maybe a))
-> (TMVar m a -> STM m (Maybe a))
-> TMVar m a
-> WriterT w (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m (Maybe a)
forall a. TMVar m a -> STM m (Maybe a)
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 = STM m a -> WriterT w (STM m) a
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> WriterT w (STM m) a)
-> (TMVar m a -> a -> STM m a)
-> TMVar m a
-> a
-> WriterT w (STM m) a
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m a
forall a. TMVar m a -> a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m a
swapTMVar
writeTMVar :: forall a. TMVar (WriterT w m) a -> a -> STM (WriterT w m) ()
writeTMVar = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TMVar m a -> a -> STM m ())
-> TMVar m a
-> a
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m ()
forall a. TMVar m a -> a -> STM m ()
forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m ()
writeTMVar
isEmptyTMVar :: forall a. TMVar (WriterT w m) a -> STM (WriterT w m) Bool
isEmptyTMVar = STM m Bool -> WriterT w (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> WriterT w (STM m) Bool)
-> (TMVar m a -> STM m Bool) -> TMVar m a -> WriterT w (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m Bool
forall a. TMVar m a -> STM m Bool
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 = STM m (TQueue m a) -> WriterT w (STM m) (TQueue m a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m (TQueue m a)
forall a. STM m (TQueue m a)
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 = STM m a -> WriterT w (STM m) a
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> WriterT w (STM m) a)
-> (TQueue m a -> STM m a) -> TQueue m a -> WriterT w (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m a
forall a. TQueue m a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
readTQueue
tryReadTQueue :: forall a. TQueue (WriterT w m) a -> STM (WriterT w m) (Maybe a)
tryReadTQueue = STM m (Maybe a) -> WriterT w (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> WriterT w (STM m) (Maybe a))
-> (TQueue m a -> STM m (Maybe a))
-> TQueue m a
-> WriterT w (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m (Maybe a)
forall a. TQueue m a -> STM m (Maybe a)
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryReadTQueue
peekTQueue :: forall a. TQueue (WriterT w m) a -> STM (WriterT w m) a
peekTQueue = STM m a -> WriterT w (STM m) a
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> WriterT w (STM m) a)
-> (TQueue m a -> STM m a) -> TQueue m a -> WriterT w (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m a
forall a. TQueue m a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
peekTQueue
tryPeekTQueue :: forall a. TQueue (WriterT w m) a -> STM (WriterT w m) (Maybe a)
tryPeekTQueue = STM m (Maybe a) -> WriterT w (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> WriterT w (STM m) (Maybe a))
-> (TQueue m a -> STM m (Maybe a))
-> TQueue m a
-> WriterT w (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m (Maybe a)
forall a. TQueue m a -> STM m (Maybe a)
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryPeekTQueue
flushTQueue :: forall a. TQueue (WriterT w m) a -> STM (WriterT w m) [a]
flushTQueue = STM m [a] -> WriterT w (STM m) [a]
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m [a] -> WriterT w (STM m) [a])
-> (TQueue m a -> STM m [a]) -> TQueue m a -> WriterT w (STM m) [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m [a]
forall a. TQueue m a -> STM m [a]
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m [a]
flushTQueue
writeTQueue :: forall a. TQueue (WriterT w m) a -> a -> STM (WriterT w m) ()
writeTQueue TQueue (WriterT w m) a
v = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (a -> STM m ()) -> a -> WriterT w (STM m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> a -> STM m ()
forall a. TQueue m a -> a -> STM m ()
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> a -> STM m ()
writeTQueue TQueue m a
TQueue (WriterT w m) a
v
isEmptyTQueue :: forall a. TQueue (WriterT w m) a -> STM (WriterT w m) Bool
isEmptyTQueue = STM m Bool -> WriterT w (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> WriterT w (STM m) Bool)
-> (TQueue m a -> STM m Bool)
-> TQueue m a
-> WriterT w (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m Bool
forall a. TQueue m a -> STM m Bool
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m Bool
isEmptyTQueue
unGetTQueue :: forall a. TQueue (WriterT w m) a -> a -> STM (WriterT w m) ()
unGetTQueue = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TQueue m a -> a -> STM m ())
-> TQueue m a
-> a
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TQueue m a -> a -> STM m ()
forall a. TQueue m a -> a -> STM m ()
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 = STM m (TBQueue m a) -> WriterT w (STM m) (TBQueue m a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TBQueue m a) -> WriterT w (STM m) (TBQueue m a))
-> (Natural -> STM m (TBQueue m a))
-> Natural
-> WriterT w (STM m) (TBQueue m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Natural -> STM m (TBQueue m a)
forall a. Natural -> STM m (TBQueue m a)
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 = STM m a -> WriterT w (STM m) a
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> WriterT w (STM m) a)
-> (TBQueue m a -> STM m a) -> TBQueue m a -> WriterT w (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m a
forall a. TBQueue m a -> STM m a
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 = STM m (Maybe a) -> WriterT w (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> WriterT w (STM m) (Maybe a))
-> (TBQueue m a -> STM m (Maybe a))
-> TBQueue m a
-> WriterT w (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m (Maybe a)
forall a. TBQueue m a -> STM m (Maybe a)
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 = STM m a -> WriterT w (STM m) a
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> WriterT w (STM m) a)
-> (TBQueue m a -> STM m a) -> TBQueue m a -> WriterT w (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m a
forall a. TBQueue m a -> STM m a
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 = STM m (Maybe a) -> WriterT w (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> WriterT w (STM m) (Maybe a))
-> (TBQueue m a -> STM m (Maybe a))
-> TBQueue m a
-> WriterT w (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m (Maybe a)
forall a. TBQueue m a -> STM m (Maybe a)
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 = STM m [a] -> WriterT w (STM m) [a]
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m [a] -> WriterT w (STM m) [a])
-> (TBQueue m a -> STM m [a])
-> TBQueue m a
-> WriterT w (STM m) [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m [a]
forall a. TBQueue m a -> STM m [a]
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 = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TBQueue m a -> a -> STM m ())
-> TBQueue m a
-> a
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TBQueue m a -> a -> STM m ()
forall a. TBQueue m a -> a -> STM m ()
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 = STM m Natural -> WriterT w (STM m) Natural
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Natural -> WriterT w (STM m) Natural)
-> (TBQueue m a -> STM m Natural)
-> TBQueue m a
-> WriterT w (STM m) Natural
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m Natural
forall a. TBQueue m a -> STM m Natural
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 = STM m Bool -> WriterT w (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> WriterT w (STM m) Bool)
-> (TBQueue m a -> STM m Bool)
-> TBQueue m a
-> WriterT w (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m Bool
forall a. TBQueue m a -> STM m Bool
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 = STM m Bool -> WriterT w (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> WriterT w (STM m) Bool)
-> (TBQueue m a -> STM m Bool)
-> TBQueue m a
-> WriterT w (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m Bool
forall a. TBQueue m a -> STM m Bool
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 = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TBQueue m a -> a -> STM m ())
-> TBQueue m a
-> a
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TBQueue m a -> a -> STM m ()
forall a. TBQueue m a -> a -> STM m ()
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 = STM m (TSem m) -> WriterT w (STM m) (TSem m)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TSem m) -> WriterT w (STM m) (TSem m))
-> (Integer -> STM m (TSem m))
-> Integer
-> WriterT w (STM m) (TSem m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> STM m (TSem m)
forall (m :: * -> *). MonadSTM m => Integer -> STM m (TSem m)
newTSem
waitTSem :: TSem (WriterT w m) -> STM (WriterT w m) ()
waitTSem = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TSem m -> STM m ()) -> TSem m -> WriterT w (STM m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TSem m -> STM m ()
forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
waitTSem
signalTSem :: TSem (WriterT w m) -> STM (WriterT w m) ()
signalTSem = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TSem m -> STM m ()) -> TSem m -> WriterT w (STM m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TSem m -> STM m ()
forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
signalTSem
signalTSemN :: Natural -> TSem (WriterT w m) -> STM (WriterT w m) ()
signalTSemN = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (Natural -> TSem m -> STM m ())
-> Natural
-> TSem m
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Natural -> TSem m -> STM m ()
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 = STM m (TChan m a) -> WriterT w (STM m) (TChan m a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m (TChan m a)
forall a. STM m (TChan m a)
forall (m :: * -> *) a. MonadSTM m => STM m (TChan m a)
newTChan
newBroadcastTChan :: forall a. STM (WriterT w m) (TChan (WriterT w m) a)
newBroadcastTChan = STM m (TChan m a) -> WriterT w (STM m) (TChan m a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m (TChan m a)
forall a. STM m (TChan m a)
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 = STM m (TChan m a) -> WriterT w (STM m) (TChan m a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TChan m a) -> WriterT w (STM m) (TChan m a))
-> (TChan m a -> STM m (TChan m a))
-> TChan m a
-> WriterT w (STM m) (TChan m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (TChan m a)
forall a. TChan m a -> STM m (TChan m a)
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 = STM m (TChan m a) -> WriterT w (STM m) (TChan m a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TChan m a) -> WriterT w (STM m) (TChan m a))
-> (TChan m a -> STM m (TChan m a))
-> TChan m a
-> WriterT w (STM m) (TChan m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (TChan m a)
forall a. TChan m a -> STM m (TChan m a)
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 = STM m a -> WriterT w (STM m) a
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> WriterT w (STM m) a)
-> (TChan m a -> STM m a) -> TChan m a -> WriterT w (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m a
forall a. TChan m a -> STM m a
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 = STM m (Maybe a) -> WriterT w (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> WriterT w (STM m) (Maybe a))
-> (TChan m a -> STM m (Maybe a))
-> TChan m a
-> WriterT w (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (Maybe a)
forall a. TChan m a -> STM m (Maybe a)
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 = STM m a -> WriterT w (STM m) a
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> WriterT w (STM m) a)
-> (TChan m a -> STM m a) -> TChan m a -> WriterT w (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m a
forall a. TChan m a -> STM m a
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 = STM m (Maybe a) -> WriterT w (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> WriterT w (STM m) (Maybe a))
-> (TChan m a -> STM m (Maybe a))
-> TChan m a
-> WriterT w (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (Maybe a)
forall a. TChan m a -> STM m (Maybe a)
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 = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TChan m a -> a -> STM m ())
-> TChan m a
-> a
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TChan m a -> a -> STM m ()
forall a. TChan m a -> a -> STM m ()
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 = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TChan m a -> a -> STM m ())
-> TChan m a
-> a
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TChan m a -> a -> STM m ()
forall a. TChan m a -> a -> STM m ()
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 = STM m Bool -> WriterT w (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> WriterT w (STM m) Bool)
-> (TChan m a -> STM m Bool) -> TChan m a -> WriterT w (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m Bool
forall a. TChan m a -> STM m Bool
forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m Bool
isEmptyTChan
instance (Monoid w, MonadInspectSTM m) => MonadInspectSTM (Lazy.WriterT w m) where
type InspectMonad (Lazy.WriterT w m) = InspectMonad m
inspectTVar :: forall (proxy :: (* -> *) -> *) a.
proxy (WriterT w m)
-> TVar (WriterT w m) a -> InspectMonad (WriterT w m) a
inspectTVar proxy (WriterT w m)
_ = Proxy m -> TVar m a -> InspectMonad m a
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadInspectSTM m =>
proxy m -> TVar m a -> InspectMonad m a
forall (proxy :: (* -> *) -> *) a.
proxy m -> TVar m a -> InspectMonad m a
inspectTVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
inspectTMVar :: forall (proxy :: (* -> *) -> *) a.
proxy (WriterT w m)
-> TMVar (WriterT w m) a -> InspectMonad (WriterT w m) (Maybe a)
inspectTMVar proxy (WriterT w m)
_ = Proxy m -> TMVar m a -> InspectMonad m (Maybe a)
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadInspectSTM m =>
proxy m -> TMVar m a -> InspectMonad m (Maybe a)
forall (proxy :: (* -> *) -> *) a.
proxy m -> TMVar m a -> InspectMonad m (Maybe a)
inspectTMVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
instance (Monoid w, MonadTraceSTM m) => MonadTraceSTM (Lazy.WriterT w m) where
traceTVar :: forall (proxy :: (* -> *) -> *) a.
proxy (WriterT w m)
-> TVar (WriterT w m) a
-> (Maybe a -> a -> InspectMonad (WriterT w m) TraceValue)
-> STM (WriterT w m) ()
traceTVar proxy (WriterT w m)
_ = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue) -> STM m ())
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> STM m ()
traceTVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTMVar :: forall (proxy :: (* -> *) -> *) a.
proxy (WriterT w m)
-> TMVar (WriterT w m) a
-> (Maybe (Maybe a)
-> Maybe a -> InspectMonad (WriterT w m) TraceValue)
-> STM (WriterT w m) ()
traceTMVar proxy (WriterT w m)
_ = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ())
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ()
traceTMVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTQueue :: forall (proxy :: (* -> *) -> *) a.
proxy (WriterT w m)
-> TQueue (WriterT w m) a
-> (Maybe [a] -> [a] -> InspectMonad (WriterT w m) TraceValue)
-> STM (WriterT w m) ()
traceTQueue proxy (WriterT w m)
_ = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> STM m ())
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
traceTQueue (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTBQueue :: forall (proxy :: (* -> *) -> *) a.
proxy (WriterT w m)
-> TBQueue (WriterT w m) a
-> (Maybe [a] -> [a] -> InspectMonad (WriterT w m) TraceValue)
-> STM (WriterT w m) ()
traceTBQueue proxy (WriterT w m)
_ = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> STM m ())
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
traceTBQueue (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTSem :: forall (proxy :: (* -> *) -> *).
proxy (WriterT w m)
-> TSem (WriterT w m)
-> (Maybe Integer
-> Integer -> InspectMonad (WriterT w m) TraceValue)
-> STM (WriterT w m) ()
traceTSem proxy (WriterT w m)
_ = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ())
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *).
MonadTraceSTM m =>
proxy m
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *).
proxy m
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ()
traceTSem (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
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) = m (a, w) -> WriterT w m a
forall w (m :: * -> *) a. m (a, w) -> WriterT w m a
Strict.WriterT (STM m (a, w) -> m (a, w)
forall a. HasCallStack => STM m a -> m a
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 = STM m (TVar m a) -> WriterT w (STM m) (TVar m a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TVar m a) -> WriterT w (STM m) (TVar m a))
-> (a -> STM m (TVar m a)) -> a -> WriterT w (STM m) (TVar m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> STM m (TVar m a)
forall a. a -> STM m (TVar m a)
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 = STM m a -> WriterT w (STM m) a
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> WriterT w (STM m) a)
-> (TVar m a -> STM m a) -> TVar m a -> WriterT w (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TVar m a -> STM m a
forall a. TVar m a -> STM m a
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 = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TVar m a -> a -> STM m ())
-> TVar m a
-> a
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> a -> STM m ()
forall a. TVar m a -> a -> STM m ()
forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m ()
writeTVar
retry :: forall a. STM (WriterT w m) a
retry = STM m a -> WriterT w (STM m) a
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m a
forall a. STM m a
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) = STM m (a, w) -> WriterT w (STM m) a
forall w (m :: * -> *) a. m (a, w) -> WriterT w m a
Strict.WriterT (STM m (a, w) -> WriterT w (STM m) a)
-> STM m (a, w) -> WriterT w (STM m) a
forall a b. (a -> b) -> a -> b
$ STM m (a, w)
a STM m (a, w) -> STM m (a, w) -> STM m (a, w)
forall a. STM m a -> STM m a -> STM m 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 = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TVar m a -> (a -> a) -> STM m ())
-> TVar m a
-> (a -> a)
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> (a -> a) -> STM m ()
forall a. TVar m a -> (a -> a) -> STM m ()
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' = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TVar m a -> (a -> a) -> STM m ())
-> TVar m a
-> (a -> a)
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> (a -> a) -> STM m ()
forall a. TVar m a -> (a -> a) -> STM m ()
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 = STM m a -> WriterT w (STM m) a
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> WriterT w (STM m) a)
-> (TVar m s -> (s -> (a, s)) -> STM m a)
-> TVar m s
-> (s -> (a, s))
-> WriterT w (STM m) a
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m s -> (s -> (a, s)) -> STM m a
forall s a. TVar m s -> (s -> (a, s)) -> STM m a
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 = STM m a -> WriterT w (STM m) a
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> WriterT w (STM m) a)
-> (TVar m a -> a -> STM m a)
-> TVar m a
-> a
-> WriterT w (STM m) a
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> a -> STM m a
forall a. TVar m a -> a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m a
swapTVar
check :: Bool -> STM (WriterT w m) ()
check = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (Bool -> STM m ()) -> Bool -> WriterT w (STM m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> STM m ()
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 = STM m (TMVar m a) -> WriterT w (STM m) (TMVar m a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TMVar m a) -> WriterT w (STM m) (TMVar m a))
-> (a -> STM m (TMVar m a)) -> a -> WriterT w (STM m) (TMVar m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> STM m (TMVar m a)
forall a. a -> STM m (TMVar m a)
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 = STM m (TMVar m a) -> WriterT w (STM m) (TMVar m a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m (TMVar m a)
forall a. STM m (TMVar m a)
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 = STM m a -> WriterT w (STM m) a
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> WriterT w (STM m) a)
-> (TMVar m a -> STM m a) -> TMVar m a -> WriterT w (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m a
forall a. TMVar m a -> STM m a
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 = STM m (Maybe a) -> WriterT w (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> WriterT w (STM m) (Maybe a))
-> (TMVar m a -> STM m (Maybe a))
-> TMVar m a
-> WriterT w (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m (Maybe a)
forall a. TMVar m a -> STM m (Maybe a)
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 = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TMVar m a -> a -> STM m ())
-> TMVar m a
-> a
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m ()
forall a. TMVar m a -> a -> STM m ()
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 = STM m Bool -> WriterT w (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> WriterT w (STM m) Bool)
-> (TMVar m a -> a -> STM m Bool)
-> TMVar m a
-> a
-> WriterT w (STM m) Bool
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m Bool
forall a. TMVar m a -> a -> STM m Bool
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 = STM m a -> WriterT w (STM m) a
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> WriterT w (STM m) a)
-> (TMVar m a -> STM m a) -> TMVar m a -> WriterT w (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m a
forall a. TMVar m a -> STM m a
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 = STM m (Maybe a) -> WriterT w (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> WriterT w (STM m) (Maybe a))
-> (TMVar m a -> STM m (Maybe a))
-> TMVar m a
-> WriterT w (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m (Maybe a)
forall a. TMVar m a -> STM m (Maybe a)
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 = STM m a -> WriterT w (STM m) a
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> WriterT w (STM m) a)
-> (TMVar m a -> a -> STM m a)
-> TMVar m a
-> a
-> WriterT w (STM m) a
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m a
forall a. TMVar m a -> a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m a
swapTMVar
writeTMVar :: forall a. TMVar (WriterT w m) a -> a -> STM (WriterT w m) ()
writeTMVar = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TMVar m a -> a -> STM m ())
-> TMVar m a
-> a
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m ()
forall a. TMVar m a -> a -> STM m ()
forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m ()
writeTMVar
isEmptyTMVar :: forall a. TMVar (WriterT w m) a -> STM (WriterT w m) Bool
isEmptyTMVar = STM m Bool -> WriterT w (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> WriterT w (STM m) Bool)
-> (TMVar m a -> STM m Bool) -> TMVar m a -> WriterT w (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m Bool
forall a. TMVar m a -> STM m Bool
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 = STM m (TQueue m a) -> WriterT w (STM m) (TQueue m a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m (TQueue m a)
forall a. STM m (TQueue m a)
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 = STM m a -> WriterT w (STM m) a
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> WriterT w (STM m) a)
-> (TQueue m a -> STM m a) -> TQueue m a -> WriterT w (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m a
forall a. TQueue m a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
readTQueue
tryReadTQueue :: forall a. TQueue (WriterT w m) a -> STM (WriterT w m) (Maybe a)
tryReadTQueue = STM m (Maybe a) -> WriterT w (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> WriterT w (STM m) (Maybe a))
-> (TQueue m a -> STM m (Maybe a))
-> TQueue m a
-> WriterT w (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m (Maybe a)
forall a. TQueue m a -> STM m (Maybe a)
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryReadTQueue
peekTQueue :: forall a. TQueue (WriterT w m) a -> STM (WriterT w m) a
peekTQueue = STM m a -> WriterT w (STM m) a
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> WriterT w (STM m) a)
-> (TQueue m a -> STM m a) -> TQueue m a -> WriterT w (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m a
forall a. TQueue m a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
peekTQueue
tryPeekTQueue :: forall a. TQueue (WriterT w m) a -> STM (WriterT w m) (Maybe a)
tryPeekTQueue = STM m (Maybe a) -> WriterT w (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> WriterT w (STM m) (Maybe a))
-> (TQueue m a -> STM m (Maybe a))
-> TQueue m a
-> WriterT w (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m (Maybe a)
forall a. TQueue m a -> STM m (Maybe a)
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryPeekTQueue
flushTQueue :: forall a. TQueue (WriterT w m) a -> STM (WriterT w m) [a]
flushTQueue = STM m [a] -> WriterT w (STM m) [a]
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m [a] -> WriterT w (STM m) [a])
-> (TQueue m a -> STM m [a]) -> TQueue m a -> WriterT w (STM m) [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m [a]
forall a. TQueue m a -> STM m [a]
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m [a]
flushTQueue
writeTQueue :: forall a. TQueue (WriterT w m) a -> a -> STM (WriterT w m) ()
writeTQueue TQueue (WriterT w m) a
v = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (a -> STM m ()) -> a -> WriterT w (STM m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> a -> STM m ()
forall a. TQueue m a -> a -> STM m ()
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> a -> STM m ()
writeTQueue TQueue m a
TQueue (WriterT w m) a
v
isEmptyTQueue :: forall a. TQueue (WriterT w m) a -> STM (WriterT w m) Bool
isEmptyTQueue = STM m Bool -> WriterT w (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> WriterT w (STM m) Bool)
-> (TQueue m a -> STM m Bool)
-> TQueue m a
-> WriterT w (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m Bool
forall a. TQueue m a -> STM m Bool
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m Bool
isEmptyTQueue
unGetTQueue :: forall a. TQueue (WriterT w m) a -> a -> STM (WriterT w m) ()
unGetTQueue = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TQueue m a -> a -> STM m ())
-> TQueue m a
-> a
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TQueue m a -> a -> STM m ()
forall a. TQueue m a -> a -> STM m ()
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 = STM m (TBQueue m a) -> WriterT w (STM m) (TBQueue m a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TBQueue m a) -> WriterT w (STM m) (TBQueue m a))
-> (Natural -> STM m (TBQueue m a))
-> Natural
-> WriterT w (STM m) (TBQueue m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Natural -> STM m (TBQueue m a)
forall a. Natural -> STM m (TBQueue m a)
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 = STM m a -> WriterT w (STM m) a
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> WriterT w (STM m) a)
-> (TBQueue m a -> STM m a) -> TBQueue m a -> WriterT w (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m a
forall a. TBQueue m a -> STM m a
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 = STM m (Maybe a) -> WriterT w (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> WriterT w (STM m) (Maybe a))
-> (TBQueue m a -> STM m (Maybe a))
-> TBQueue m a
-> WriterT w (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m (Maybe a)
forall a. TBQueue m a -> STM m (Maybe a)
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 = STM m a -> WriterT w (STM m) a
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> WriterT w (STM m) a)
-> (TBQueue m a -> STM m a) -> TBQueue m a -> WriterT w (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m a
forall a. TBQueue m a -> STM m a
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 = STM m (Maybe a) -> WriterT w (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> WriterT w (STM m) (Maybe a))
-> (TBQueue m a -> STM m (Maybe a))
-> TBQueue m a
-> WriterT w (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m (Maybe a)
forall a. TBQueue m a -> STM m (Maybe a)
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 = STM m [a] -> WriterT w (STM m) [a]
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m [a] -> WriterT w (STM m) [a])
-> (TBQueue m a -> STM m [a])
-> TBQueue m a
-> WriterT w (STM m) [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m [a]
forall a. TBQueue m a -> STM m [a]
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 = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TBQueue m a -> a -> STM m ())
-> TBQueue m a
-> a
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TBQueue m a -> a -> STM m ()
forall a. TBQueue m a -> a -> STM m ()
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 = STM m Natural -> WriterT w (STM m) Natural
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Natural -> WriterT w (STM m) Natural)
-> (TBQueue m a -> STM m Natural)
-> TBQueue m a
-> WriterT w (STM m) Natural
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m Natural
forall a. TBQueue m a -> STM m Natural
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 = STM m Bool -> WriterT w (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> WriterT w (STM m) Bool)
-> (TBQueue m a -> STM m Bool)
-> TBQueue m a
-> WriterT w (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m Bool
forall a. TBQueue m a -> STM m Bool
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 = STM m Bool -> WriterT w (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> WriterT w (STM m) Bool)
-> (TBQueue m a -> STM m Bool)
-> TBQueue m a
-> WriterT w (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m Bool
forall a. TBQueue m a -> STM m Bool
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 = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TBQueue m a -> a -> STM m ())
-> TBQueue m a
-> a
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TBQueue m a -> a -> STM m ()
forall a. TBQueue m a -> a -> STM m ()
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 = STM m (TSem m) -> WriterT w (STM m) (TSem m)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TSem m) -> WriterT w (STM m) (TSem m))
-> (Integer -> STM m (TSem m))
-> Integer
-> WriterT w (STM m) (TSem m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> STM m (TSem m)
forall (m :: * -> *). MonadSTM m => Integer -> STM m (TSem m)
newTSem
waitTSem :: TSem (WriterT w m) -> STM (WriterT w m) ()
waitTSem = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TSem m -> STM m ()) -> TSem m -> WriterT w (STM m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TSem m -> STM m ()
forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
waitTSem
signalTSem :: TSem (WriterT w m) -> STM (WriterT w m) ()
signalTSem = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TSem m -> STM m ()) -> TSem m -> WriterT w (STM m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TSem m -> STM m ()
forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
signalTSem
signalTSemN :: Natural -> TSem (WriterT w m) -> STM (WriterT w m) ()
signalTSemN = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (Natural -> TSem m -> STM m ())
-> Natural
-> TSem m
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Natural -> TSem m -> STM m ()
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 = STM m (TChan m a) -> WriterT w (STM m) (TChan m a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m (TChan m a)
forall a. STM m (TChan m a)
forall (m :: * -> *) a. MonadSTM m => STM m (TChan m a)
newTChan
newBroadcastTChan :: forall a. STM (WriterT w m) (TChan (WriterT w m) a)
newBroadcastTChan = STM m (TChan m a) -> WriterT w (STM m) (TChan m a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m (TChan m a)
forall a. STM m (TChan m a)
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 = STM m (TChan m a) -> WriterT w (STM m) (TChan m a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TChan m a) -> WriterT w (STM m) (TChan m a))
-> (TChan m a -> STM m (TChan m a))
-> TChan m a
-> WriterT w (STM m) (TChan m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (TChan m a)
forall a. TChan m a -> STM m (TChan m a)
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 = STM m (TChan m a) -> WriterT w (STM m) (TChan m a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TChan m a) -> WriterT w (STM m) (TChan m a))
-> (TChan m a -> STM m (TChan m a))
-> TChan m a
-> WriterT w (STM m) (TChan m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (TChan m a)
forall a. TChan m a -> STM m (TChan m a)
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 = STM m a -> WriterT w (STM m) a
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> WriterT w (STM m) a)
-> (TChan m a -> STM m a) -> TChan m a -> WriterT w (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m a
forall a. TChan m a -> STM m a
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 = STM m (Maybe a) -> WriterT w (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> WriterT w (STM m) (Maybe a))
-> (TChan m a -> STM m (Maybe a))
-> TChan m a
-> WriterT w (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (Maybe a)
forall a. TChan m a -> STM m (Maybe a)
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 = STM m a -> WriterT w (STM m) a
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> WriterT w (STM m) a)
-> (TChan m a -> STM m a) -> TChan m a -> WriterT w (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m a
forall a. TChan m a -> STM m a
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 = STM m (Maybe a) -> WriterT w (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> WriterT w (STM m) (Maybe a))
-> (TChan m a -> STM m (Maybe a))
-> TChan m a
-> WriterT w (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (Maybe a)
forall a. TChan m a -> STM m (Maybe a)
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 = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TChan m a -> a -> STM m ())
-> TChan m a
-> a
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TChan m a -> a -> STM m ()
forall a. TChan m a -> a -> STM m ()
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 = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TChan m a -> a -> STM m ())
-> TChan m a
-> a
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TChan m a -> a -> STM m ()
forall a. TChan m a -> a -> STM m ()
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 = STM m Bool -> WriterT w (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> WriterT w (STM m) Bool)
-> (TChan m a -> STM m Bool) -> TChan m a -> WriterT w (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m Bool
forall a. TChan m a -> STM m Bool
forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m Bool
isEmptyTChan
instance (Monoid w, MonadInspectSTM m) => MonadInspectSTM (Strict.WriterT w m) where
type InspectMonad (Strict.WriterT w m) = InspectMonad m
inspectTVar :: forall (proxy :: (* -> *) -> *) a.
proxy (WriterT w m)
-> TVar (WriterT w m) a -> InspectMonad (WriterT w m) a
inspectTVar proxy (WriterT w m)
_ = Proxy m -> TVar m a -> InspectMonad m a
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadInspectSTM m =>
proxy m -> TVar m a -> InspectMonad m a
forall (proxy :: (* -> *) -> *) a.
proxy m -> TVar m a -> InspectMonad m a
inspectTVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
inspectTMVar :: forall (proxy :: (* -> *) -> *) a.
proxy (WriterT w m)
-> TMVar (WriterT w m) a -> InspectMonad (WriterT w m) (Maybe a)
inspectTMVar proxy (WriterT w m)
_ = Proxy m -> TMVar m a -> InspectMonad m (Maybe a)
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadInspectSTM m =>
proxy m -> TMVar m a -> InspectMonad m (Maybe a)
forall (proxy :: (* -> *) -> *) a.
proxy m -> TMVar m a -> InspectMonad m (Maybe a)
inspectTMVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
instance (Monoid w, MonadTraceSTM m) => MonadTraceSTM (Strict.WriterT w m) where
traceTVar :: forall (proxy :: (* -> *) -> *) a.
proxy (WriterT w m)
-> TVar (WriterT w m) a
-> (Maybe a -> a -> InspectMonad (WriterT w m) TraceValue)
-> STM (WriterT w m) ()
traceTVar proxy (WriterT w m)
_ = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue) -> STM m ())
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> STM m ()
traceTVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTMVar :: forall (proxy :: (* -> *) -> *) a.
proxy (WriterT w m)
-> TMVar (WriterT w m) a
-> (Maybe (Maybe a)
-> Maybe a -> InspectMonad (WriterT w m) TraceValue)
-> STM (WriterT w m) ()
traceTMVar proxy (WriterT w m)
_ = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ())
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ()
traceTMVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTQueue :: forall (proxy :: (* -> *) -> *) a.
proxy (WriterT w m)
-> TQueue (WriterT w m) a
-> (Maybe [a] -> [a] -> InspectMonad (WriterT w m) TraceValue)
-> STM (WriterT w m) ()
traceTQueue proxy (WriterT w m)
_ = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> STM m ())
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
traceTQueue (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTBQueue :: forall (proxy :: (* -> *) -> *) a.
proxy (WriterT w m)
-> TBQueue (WriterT w m) a
-> (Maybe [a] -> [a] -> InspectMonad (WriterT w m) TraceValue)
-> STM (WriterT w m) ()
traceTBQueue proxy (WriterT w m)
_ = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> STM m ())
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
traceTBQueue (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTSem :: forall (proxy :: (* -> *) -> *).
proxy (WriterT w m)
-> TSem (WriterT w m)
-> (Maybe Integer
-> Integer -> InspectMonad (WriterT w m) TraceValue)
-> STM (WriterT w m) ()
traceTSem proxy (WriterT w m)
_ = STM m () -> WriterT w (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> WriterT w (STM m) ())
-> (TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ())
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> WriterT w (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *).
MonadTraceSTM m =>
proxy m
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *).
proxy m
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ()
traceTSem (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
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) = (s -> m (a, s)) -> StateT s m a
forall s (m :: * -> *) a. (s -> m (a, s)) -> StateT s m a
Lazy.StateT ((s -> m (a, s)) -> StateT s m a)
-> (s -> m (a, s)) -> StateT s m a
forall a b. (a -> b) -> a -> b
$ \s
s -> STM m (a, s) -> m (a, s)
forall a. HasCallStack => STM m a -> m a
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 = STM m (TVar m a) -> StateT s (STM m) (TVar m a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TVar m a) -> StateT s (STM m) (TVar m a))
-> (a -> STM m (TVar m a)) -> a -> StateT s (STM m) (TVar m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> STM m (TVar m a)
forall a. a -> STM m (TVar m a)
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 = STM m a -> StateT s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> StateT s (STM m) a)
-> (TVar m a -> STM m a) -> TVar m a -> StateT s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TVar m a -> STM m a
forall a. TVar m a -> STM m a
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 = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TVar m a -> a -> STM m ())
-> TVar m a
-> a
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> a -> STM m ()
forall a. TVar m a -> a -> STM m ()
forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m ()
writeTVar
retry :: forall a. STM (StateT s m) a
retry = STM m a -> StateT s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m a
forall a. STM m a
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) = (s -> STM m (a, s)) -> StateT s (STM m) a
forall s (m :: * -> *) a. (s -> m (a, s)) -> StateT s m a
Lazy.StateT ((s -> STM m (a, s)) -> StateT s (STM m) a)
-> (s -> STM m (a, s)) -> StateT s (STM m) a
forall a b. (a -> b) -> a -> b
$ \s
s -> s -> STM m (a, s)
a s
s STM m (a, s) -> STM m (a, s) -> STM m (a, s)
forall a. STM m a -> STM m a -> STM m a
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 = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TVar m a -> (a -> a) -> STM m ())
-> TVar m a
-> (a -> a)
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> (a -> a) -> STM m ()
forall a. TVar m a -> (a -> a) -> STM m ()
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' = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TVar m a -> (a -> a) -> STM m ())
-> TVar m a
-> (a -> a)
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> (a -> a) -> STM m ()
forall a. TVar m a -> (a -> a) -> STM m ()
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 = STM m a -> StateT s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> StateT s (STM m) a)
-> (TVar m s -> (s -> (a, s)) -> STM m a)
-> TVar m s
-> (s -> (a, s))
-> StateT s (STM m) a
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m s -> (s -> (a, s)) -> STM m a
forall s a. TVar m s -> (s -> (a, s)) -> STM m a
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 = STM m a -> StateT s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> StateT s (STM m) a)
-> (TVar m a -> a -> STM m a)
-> TVar m a
-> a
-> StateT s (STM m) a
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> a -> STM m a
forall a. TVar m a -> a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m a
swapTVar
check :: Bool -> STM (StateT s m) ()
check = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (Bool -> STM m ()) -> Bool -> StateT s (STM m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> STM m ()
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 = STM m (TMVar m a) -> StateT s (STM m) (TMVar m a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TMVar m a) -> StateT s (STM m) (TMVar m a))
-> (a -> STM m (TMVar m a)) -> a -> StateT s (STM m) (TMVar m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> STM m (TMVar m a)
forall a. a -> STM m (TMVar m a)
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 = STM m (TMVar m a) -> StateT s (STM m) (TMVar m a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m (TMVar m a)
forall a. STM m (TMVar m a)
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 = STM m a -> StateT s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> StateT s (STM m) a)
-> (TMVar m a -> STM m a) -> TMVar m a -> StateT s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m a
forall a. TMVar m a -> STM m a
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 = STM m (Maybe a) -> StateT s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> StateT s (STM m) (Maybe a))
-> (TMVar m a -> STM m (Maybe a))
-> TMVar m a
-> StateT s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m (Maybe a)
forall a. TMVar m a -> STM m (Maybe a)
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 = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TMVar m a -> a -> STM m ())
-> TMVar m a
-> a
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m ()
forall a. TMVar m a -> a -> STM m ()
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 = STM m Bool -> StateT s (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> StateT s (STM m) Bool)
-> (TMVar m a -> a -> STM m Bool)
-> TMVar m a
-> a
-> StateT s (STM m) Bool
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m Bool
forall a. TMVar m a -> a -> STM m Bool
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 = STM m a -> StateT s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> StateT s (STM m) a)
-> (TMVar m a -> STM m a) -> TMVar m a -> StateT s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m a
forall a. TMVar m a -> STM m a
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 = STM m (Maybe a) -> StateT s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> StateT s (STM m) (Maybe a))
-> (TMVar m a -> STM m (Maybe a))
-> TMVar m a
-> StateT s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m (Maybe a)
forall a. TMVar m a -> STM m (Maybe a)
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 = STM m a -> StateT s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> StateT s (STM m) a)
-> (TMVar m a -> a -> STM m a)
-> TMVar m a
-> a
-> StateT s (STM m) a
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m a
forall a. TMVar m a -> a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m a
swapTMVar
writeTMVar :: forall a. TMVar (StateT s m) a -> a -> STM (StateT s m) ()
writeTMVar = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TMVar m a -> a -> STM m ())
-> TMVar m a
-> a
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m ()
forall a. TMVar m a -> a -> STM m ()
forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m ()
writeTMVar
isEmptyTMVar :: forall a. TMVar (StateT s m) a -> STM (StateT s m) Bool
isEmptyTMVar = STM m Bool -> StateT s (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> StateT s (STM m) Bool)
-> (TMVar m a -> STM m Bool) -> TMVar m a -> StateT s (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m Bool
forall a. TMVar m a -> STM m Bool
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 = STM m (TQueue m a) -> StateT s (STM m) (TQueue m a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m (TQueue m a)
forall a. STM m (TQueue m a)
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 = STM m a -> StateT s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> StateT s (STM m) a)
-> (TQueue m a -> STM m a) -> TQueue m a -> StateT s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m a
forall a. TQueue m a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
readTQueue
tryReadTQueue :: forall a. TQueue (StateT s m) a -> STM (StateT s m) (Maybe a)
tryReadTQueue = STM m (Maybe a) -> StateT s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> StateT s (STM m) (Maybe a))
-> (TQueue m a -> STM m (Maybe a))
-> TQueue m a
-> StateT s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m (Maybe a)
forall a. TQueue m a -> STM m (Maybe a)
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryReadTQueue
peekTQueue :: forall a. TQueue (StateT s m) a -> STM (StateT s m) a
peekTQueue = STM m a -> StateT s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> StateT s (STM m) a)
-> (TQueue m a -> STM m a) -> TQueue m a -> StateT s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m a
forall a. TQueue m a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
peekTQueue
tryPeekTQueue :: forall a. TQueue (StateT s m) a -> STM (StateT s m) (Maybe a)
tryPeekTQueue = STM m (Maybe a) -> StateT s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> StateT s (STM m) (Maybe a))
-> (TQueue m a -> STM m (Maybe a))
-> TQueue m a
-> StateT s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m (Maybe a)
forall a. TQueue m a -> STM m (Maybe a)
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryPeekTQueue
flushTQueue :: forall a. TQueue (StateT s m) a -> STM (StateT s m) [a]
flushTQueue = STM m [a] -> StateT s (STM m) [a]
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m [a] -> StateT s (STM m) [a])
-> (TQueue m a -> STM m [a]) -> TQueue m a -> StateT s (STM m) [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m [a]
forall a. TQueue m a -> STM m [a]
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m [a]
flushTQueue
writeTQueue :: forall a. TQueue (StateT s m) a -> a -> STM (StateT s m) ()
writeTQueue TQueue (StateT s m) a
v = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (a -> STM m ()) -> a -> StateT s (STM m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> a -> STM m ()
forall a. TQueue m a -> a -> STM m ()
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> a -> STM m ()
writeTQueue TQueue m a
TQueue (StateT s m) a
v
isEmptyTQueue :: forall a. TQueue (StateT s m) a -> STM (StateT s m) Bool
isEmptyTQueue = STM m Bool -> StateT s (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> StateT s (STM m) Bool)
-> (TQueue m a -> STM m Bool)
-> TQueue m a
-> StateT s (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m Bool
forall a. TQueue m a -> STM m Bool
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m Bool
isEmptyTQueue
unGetTQueue :: forall a. TQueue (StateT s m) a -> a -> STM (StateT s m) ()
unGetTQueue = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TQueue m a -> a -> STM m ())
-> TQueue m a
-> a
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TQueue m a -> a -> STM m ()
forall a. TQueue m a -> a -> STM m ()
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 = STM m (TBQueue m a) -> StateT s (STM m) (TBQueue m a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TBQueue m a) -> StateT s (STM m) (TBQueue m a))
-> (Natural -> STM m (TBQueue m a))
-> Natural
-> StateT s (STM m) (TBQueue m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Natural -> STM m (TBQueue m a)
forall a. Natural -> STM m (TBQueue m a)
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 = STM m a -> StateT s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> StateT s (STM m) a)
-> (TBQueue m a -> STM m a) -> TBQueue m a -> StateT s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m a
forall a. TBQueue m a -> STM m a
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 = STM m (Maybe a) -> StateT s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> StateT s (STM m) (Maybe a))
-> (TBQueue m a -> STM m (Maybe a))
-> TBQueue m a
-> StateT s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m (Maybe a)
forall a. TBQueue m a -> STM m (Maybe a)
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 = STM m a -> StateT s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> StateT s (STM m) a)
-> (TBQueue m a -> STM m a) -> TBQueue m a -> StateT s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m a
forall a. TBQueue m a -> STM m a
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 = STM m (Maybe a) -> StateT s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> StateT s (STM m) (Maybe a))
-> (TBQueue m a -> STM m (Maybe a))
-> TBQueue m a
-> StateT s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m (Maybe a)
forall a. TBQueue m a -> STM m (Maybe a)
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 = STM m [a] -> StateT s (STM m) [a]
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m [a] -> StateT s (STM m) [a])
-> (TBQueue m a -> STM m [a])
-> TBQueue m a
-> StateT s (STM m) [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m [a]
forall a. TBQueue m a -> STM m [a]
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 = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TBQueue m a -> a -> STM m ())
-> TBQueue m a
-> a
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TBQueue m a -> a -> STM m ()
forall a. TBQueue m a -> a -> STM m ()
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 = STM m Natural -> StateT s (STM m) Natural
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Natural -> StateT s (STM m) Natural)
-> (TBQueue m a -> STM m Natural)
-> TBQueue m a
-> StateT s (STM m) Natural
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m Natural
forall a. TBQueue m a -> STM m Natural
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 = STM m Bool -> StateT s (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> StateT s (STM m) Bool)
-> (TBQueue m a -> STM m Bool)
-> TBQueue m a
-> StateT s (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m Bool
forall a. TBQueue m a -> STM m Bool
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 = STM m Bool -> StateT s (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> StateT s (STM m) Bool)
-> (TBQueue m a -> STM m Bool)
-> TBQueue m a
-> StateT s (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m Bool
forall a. TBQueue m a -> STM m Bool
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 = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TBQueue m a -> a -> STM m ())
-> TBQueue m a
-> a
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TBQueue m a -> a -> STM m ()
forall a. TBQueue m a -> a -> STM m ()
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 = STM m (TSem m) -> StateT s (STM m) (TSem m)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TSem m) -> StateT s (STM m) (TSem m))
-> (Integer -> STM m (TSem m))
-> Integer
-> StateT s (STM m) (TSem m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> STM m (TSem m)
forall (m :: * -> *). MonadSTM m => Integer -> STM m (TSem m)
newTSem
waitTSem :: TSem (StateT s m) -> STM (StateT s m) ()
waitTSem = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TSem m -> STM m ()) -> TSem m -> StateT s (STM m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TSem m -> STM m ()
forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
waitTSem
signalTSem :: TSem (StateT s m) -> STM (StateT s m) ()
signalTSem = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TSem m -> STM m ()) -> TSem m -> StateT s (STM m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TSem m -> STM m ()
forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
signalTSem
signalTSemN :: Natural -> TSem (StateT s m) -> STM (StateT s m) ()
signalTSemN = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (Natural -> TSem m -> STM m ())
-> Natural
-> TSem m
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Natural -> TSem m -> STM m ()
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 = STM m (TChan m a) -> StateT s (STM m) (TChan m a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m (TChan m a)
forall a. STM m (TChan m a)
forall (m :: * -> *) a. MonadSTM m => STM m (TChan m a)
newTChan
newBroadcastTChan :: forall a. STM (StateT s m) (TChan (StateT s m) a)
newBroadcastTChan = STM m (TChan m a) -> StateT s (STM m) (TChan m a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m (TChan m a)
forall a. STM m (TChan m a)
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 = STM m (TChan m a) -> StateT s (STM m) (TChan m a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TChan m a) -> StateT s (STM m) (TChan m a))
-> (TChan m a -> STM m (TChan m a))
-> TChan m a
-> StateT s (STM m) (TChan m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (TChan m a)
forall a. TChan m a -> STM m (TChan m a)
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 = STM m (TChan m a) -> StateT s (STM m) (TChan m a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TChan m a) -> StateT s (STM m) (TChan m a))
-> (TChan m a -> STM m (TChan m a))
-> TChan m a
-> StateT s (STM m) (TChan m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (TChan m a)
forall a. TChan m a -> STM m (TChan m a)
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 = STM m a -> StateT s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> StateT s (STM m) a)
-> (TChan m a -> STM m a) -> TChan m a -> StateT s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m a
forall a. TChan m a -> STM m a
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 = STM m (Maybe a) -> StateT s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> StateT s (STM m) (Maybe a))
-> (TChan m a -> STM m (Maybe a))
-> TChan m a
-> StateT s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (Maybe a)
forall a. TChan m a -> STM m (Maybe a)
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 = STM m a -> StateT s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> StateT s (STM m) a)
-> (TChan m a -> STM m a) -> TChan m a -> StateT s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m a
forall a. TChan m a -> STM m a
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 = STM m (Maybe a) -> StateT s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> StateT s (STM m) (Maybe a))
-> (TChan m a -> STM m (Maybe a))
-> TChan m a
-> StateT s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (Maybe a)
forall a. TChan m a -> STM m (Maybe a)
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 = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TChan m a -> a -> STM m ())
-> TChan m a
-> a
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TChan m a -> a -> STM m ()
forall a. TChan m a -> a -> STM m ()
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 = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TChan m a -> a -> STM m ())
-> TChan m a
-> a
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TChan m a -> a -> STM m ()
forall a. TChan m a -> a -> STM m ()
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 = STM m Bool -> StateT s (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> StateT s (STM m) Bool)
-> (TChan m a -> STM m Bool) -> TChan m a -> StateT s (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m Bool
forall a. TChan m a -> STM m Bool
forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m Bool
isEmptyTChan
instance MonadInspectSTM m => MonadInspectSTM (Lazy.StateT s m) where
type InspectMonad (Lazy.StateT s m) = InspectMonad m
inspectTVar :: forall (proxy :: (* -> *) -> *) a.
proxy (StateT s m)
-> TVar (StateT s m) a -> InspectMonad (StateT s m) a
inspectTVar proxy (StateT s m)
_ = Proxy m -> TVar m a -> InspectMonad m a
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadInspectSTM m =>
proxy m -> TVar m a -> InspectMonad m a
forall (proxy :: (* -> *) -> *) a.
proxy m -> TVar m a -> InspectMonad m a
inspectTVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
inspectTMVar :: forall (proxy :: (* -> *) -> *) a.
proxy (StateT s m)
-> TMVar (StateT s m) a -> InspectMonad (StateT s m) (Maybe a)
inspectTMVar proxy (StateT s m)
_ = Proxy m -> TMVar m a -> InspectMonad m (Maybe a)
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadInspectSTM m =>
proxy m -> TMVar m a -> InspectMonad m (Maybe a)
forall (proxy :: (* -> *) -> *) a.
proxy m -> TMVar m a -> InspectMonad m (Maybe a)
inspectTMVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
instance MonadTraceSTM m => MonadTraceSTM (Lazy.StateT s m) where
traceTVar :: forall (proxy :: (* -> *) -> *) a.
proxy (StateT s m)
-> TVar (StateT s m) a
-> (Maybe a -> a -> InspectMonad (StateT s m) TraceValue)
-> STM (StateT s m) ()
traceTVar proxy (StateT s m)
_ = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue) -> STM m ())
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> STM m ()
traceTVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTMVar :: forall (proxy :: (* -> *) -> *) a.
proxy (StateT s m)
-> TMVar (StateT s m) a
-> (Maybe (Maybe a)
-> Maybe a -> InspectMonad (StateT s m) TraceValue)
-> STM (StateT s m) ()
traceTMVar proxy (StateT s m)
_ = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ())
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ()
traceTMVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTQueue :: forall (proxy :: (* -> *) -> *) a.
proxy (StateT s m)
-> TQueue (StateT s m) a
-> (Maybe [a] -> [a] -> InspectMonad (StateT s m) TraceValue)
-> STM (StateT s m) ()
traceTQueue proxy (StateT s m)
_ = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> STM m ())
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
traceTQueue (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTBQueue :: forall (proxy :: (* -> *) -> *) a.
proxy (StateT s m)
-> TBQueue (StateT s m) a
-> (Maybe [a] -> [a] -> InspectMonad (StateT s m) TraceValue)
-> STM (StateT s m) ()
traceTBQueue proxy (StateT s m)
_ = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> STM m ())
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
traceTBQueue (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTSem :: forall (proxy :: (* -> *) -> *).
proxy (StateT s m)
-> TSem (StateT s m)
-> (Maybe Integer
-> Integer -> InspectMonad (StateT s m) TraceValue)
-> STM (StateT s m) ()
traceTSem proxy (StateT s m)
_ = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ())
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *).
MonadTraceSTM m =>
proxy m
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *).
proxy m
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ()
traceTSem (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
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) = (s -> m (a, s)) -> StateT s m a
forall s (m :: * -> *) a. (s -> m (a, s)) -> StateT s m a
Strict.StateT ((s -> m (a, s)) -> StateT s m a)
-> (s -> m (a, s)) -> StateT s m a
forall a b. (a -> b) -> a -> b
$ \s
s -> STM m (a, s) -> m (a, s)
forall a. HasCallStack => STM m a -> m a
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 = STM m (TVar m a) -> StateT s (STM m) (TVar m a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TVar m a) -> StateT s (STM m) (TVar m a))
-> (a -> STM m (TVar m a)) -> a -> StateT s (STM m) (TVar m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> STM m (TVar m a)
forall a. a -> STM m (TVar m a)
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 = STM m a -> StateT s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> StateT s (STM m) a)
-> (TVar m a -> STM m a) -> TVar m a -> StateT s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TVar m a -> STM m a
forall a. TVar m a -> STM m a
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 = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TVar m a -> a -> STM m ())
-> TVar m a
-> a
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> a -> STM m ()
forall a. TVar m a -> a -> STM m ()
forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m ()
writeTVar
retry :: forall a. STM (StateT s m) a
retry = STM m a -> StateT s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m a
forall a. STM m a
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) = (s -> STM m (a, s)) -> StateT s (STM m) a
forall s (m :: * -> *) a. (s -> m (a, s)) -> StateT s m a
Strict.StateT ((s -> STM m (a, s)) -> StateT s (STM m) a)
-> (s -> STM m (a, s)) -> StateT s (STM m) a
forall a b. (a -> b) -> a -> b
$ \s
s -> s -> STM m (a, s)
a s
s STM m (a, s) -> STM m (a, s) -> STM m (a, s)
forall a. STM m a -> STM m a -> STM m a
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 = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TVar m a -> (a -> a) -> STM m ())
-> TVar m a
-> (a -> a)
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> (a -> a) -> STM m ()
forall a. TVar m a -> (a -> a) -> STM m ()
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' = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TVar m a -> (a -> a) -> STM m ())
-> TVar m a
-> (a -> a)
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> (a -> a) -> STM m ()
forall a. TVar m a -> (a -> a) -> STM m ()
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 = STM m a -> StateT s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> StateT s (STM m) a)
-> (TVar m s -> (s -> (a, s)) -> STM m a)
-> TVar m s
-> (s -> (a, s))
-> StateT s (STM m) a
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m s -> (s -> (a, s)) -> STM m a
forall s a. TVar m s -> (s -> (a, s)) -> STM m a
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 = STM m a -> StateT s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> StateT s (STM m) a)
-> (TVar m a -> a -> STM m a)
-> TVar m a
-> a
-> StateT s (STM m) a
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> a -> STM m a
forall a. TVar m a -> a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m a
swapTVar
check :: Bool -> STM (StateT s m) ()
check = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (Bool -> STM m ()) -> Bool -> StateT s (STM m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> STM m ()
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 = STM m (TMVar m a) -> StateT s (STM m) (TMVar m a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TMVar m a) -> StateT s (STM m) (TMVar m a))
-> (a -> STM m (TMVar m a)) -> a -> StateT s (STM m) (TMVar m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> STM m (TMVar m a)
forall a. a -> STM m (TMVar m a)
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 = STM m (TMVar m a) -> StateT s (STM m) (TMVar m a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m (TMVar m a)
forall a. STM m (TMVar m a)
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 = STM m a -> StateT s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> StateT s (STM m) a)
-> (TMVar m a -> STM m a) -> TMVar m a -> StateT s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m a
forall a. TMVar m a -> STM m a
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 = STM m (Maybe a) -> StateT s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> StateT s (STM m) (Maybe a))
-> (TMVar m a -> STM m (Maybe a))
-> TMVar m a
-> StateT s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m (Maybe a)
forall a. TMVar m a -> STM m (Maybe a)
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 = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TMVar m a -> a -> STM m ())
-> TMVar m a
-> a
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m ()
forall a. TMVar m a -> a -> STM m ()
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 = STM m Bool -> StateT s (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> StateT s (STM m) Bool)
-> (TMVar m a -> a -> STM m Bool)
-> TMVar m a
-> a
-> StateT s (STM m) Bool
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m Bool
forall a. TMVar m a -> a -> STM m Bool
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 = STM m a -> StateT s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> StateT s (STM m) a)
-> (TMVar m a -> STM m a) -> TMVar m a -> StateT s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m a
forall a. TMVar m a -> STM m a
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 = STM m (Maybe a) -> StateT s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> StateT s (STM m) (Maybe a))
-> (TMVar m a -> STM m (Maybe a))
-> TMVar m a
-> StateT s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m (Maybe a)
forall a. TMVar m a -> STM m (Maybe a)
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 = STM m a -> StateT s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> StateT s (STM m) a)
-> (TMVar m a -> a -> STM m a)
-> TMVar m a
-> a
-> StateT s (STM m) a
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m a
forall a. TMVar m a -> a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m a
swapTMVar
writeTMVar :: forall a. TMVar (StateT s m) a -> a -> STM (StateT s m) ()
writeTMVar = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TMVar m a -> a -> STM m ())
-> TMVar m a
-> a
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m ()
forall a. TMVar m a -> a -> STM m ()
forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m ()
writeTMVar
isEmptyTMVar :: forall a. TMVar (StateT s m) a -> STM (StateT s m) Bool
isEmptyTMVar = STM m Bool -> StateT s (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> StateT s (STM m) Bool)
-> (TMVar m a -> STM m Bool) -> TMVar m a -> StateT s (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m Bool
forall a. TMVar m a -> STM m Bool
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 = STM m (TQueue m a) -> StateT s (STM m) (TQueue m a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m (TQueue m a)
forall a. STM m (TQueue m a)
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 = STM m a -> StateT s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> StateT s (STM m) a)
-> (TQueue m a -> STM m a) -> TQueue m a -> StateT s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m a
forall a. TQueue m a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
readTQueue
tryReadTQueue :: forall a. TQueue (StateT s m) a -> STM (StateT s m) (Maybe a)
tryReadTQueue = STM m (Maybe a) -> StateT s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> StateT s (STM m) (Maybe a))
-> (TQueue m a -> STM m (Maybe a))
-> TQueue m a
-> StateT s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m (Maybe a)
forall a. TQueue m a -> STM m (Maybe a)
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryReadTQueue
peekTQueue :: forall a. TQueue (StateT s m) a -> STM (StateT s m) a
peekTQueue = STM m a -> StateT s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> StateT s (STM m) a)
-> (TQueue m a -> STM m a) -> TQueue m a -> StateT s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m a
forall a. TQueue m a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
peekTQueue
tryPeekTQueue :: forall a. TQueue (StateT s m) a -> STM (StateT s m) (Maybe a)
tryPeekTQueue = STM m (Maybe a) -> StateT s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> StateT s (STM m) (Maybe a))
-> (TQueue m a -> STM m (Maybe a))
-> TQueue m a
-> StateT s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m (Maybe a)
forall a. TQueue m a -> STM m (Maybe a)
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryPeekTQueue
flushTQueue :: forall a. TQueue (StateT s m) a -> STM (StateT s m) [a]
flushTQueue = STM m [a] -> StateT s (STM m) [a]
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m [a] -> StateT s (STM m) [a])
-> (TQueue m a -> STM m [a]) -> TQueue m a -> StateT s (STM m) [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m [a]
forall a. TQueue m a -> STM m [a]
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m [a]
flushTQueue
writeTQueue :: forall a. TQueue (StateT s m) a -> a -> STM (StateT s m) ()
writeTQueue TQueue (StateT s m) a
v = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (a -> STM m ()) -> a -> StateT s (STM m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> a -> STM m ()
forall a. TQueue m a -> a -> STM m ()
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> a -> STM m ()
writeTQueue TQueue m a
TQueue (StateT s m) a
v
isEmptyTQueue :: forall a. TQueue (StateT s m) a -> STM (StateT s m) Bool
isEmptyTQueue = STM m Bool -> StateT s (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> StateT s (STM m) Bool)
-> (TQueue m a -> STM m Bool)
-> TQueue m a
-> StateT s (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m Bool
forall a. TQueue m a -> STM m Bool
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m Bool
isEmptyTQueue
unGetTQueue :: forall a. TQueue (StateT s m) a -> a -> STM (StateT s m) ()
unGetTQueue = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TQueue m a -> a -> STM m ())
-> TQueue m a
-> a
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TQueue m a -> a -> STM m ()
forall a. TQueue m a -> a -> STM m ()
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 = STM m (TBQueue m a) -> StateT s (STM m) (TBQueue m a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TBQueue m a) -> StateT s (STM m) (TBQueue m a))
-> (Natural -> STM m (TBQueue m a))
-> Natural
-> StateT s (STM m) (TBQueue m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Natural -> STM m (TBQueue m a)
forall a. Natural -> STM m (TBQueue m a)
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 = STM m a -> StateT s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> StateT s (STM m) a)
-> (TBQueue m a -> STM m a) -> TBQueue m a -> StateT s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m a
forall a. TBQueue m a -> STM m a
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 = STM m (Maybe a) -> StateT s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> StateT s (STM m) (Maybe a))
-> (TBQueue m a -> STM m (Maybe a))
-> TBQueue m a
-> StateT s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m (Maybe a)
forall a. TBQueue m a -> STM m (Maybe a)
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 = STM m a -> StateT s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> StateT s (STM m) a)
-> (TBQueue m a -> STM m a) -> TBQueue m a -> StateT s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m a
forall a. TBQueue m a -> STM m a
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 = STM m (Maybe a) -> StateT s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> StateT s (STM m) (Maybe a))
-> (TBQueue m a -> STM m (Maybe a))
-> TBQueue m a
-> StateT s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m (Maybe a)
forall a. TBQueue m a -> STM m (Maybe a)
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 = STM m [a] -> StateT s (STM m) [a]
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m [a] -> StateT s (STM m) [a])
-> (TBQueue m a -> STM m [a])
-> TBQueue m a
-> StateT s (STM m) [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m [a]
forall a. TBQueue m a -> STM m [a]
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 = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TBQueue m a -> a -> STM m ())
-> TBQueue m a
-> a
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TBQueue m a -> a -> STM m ()
forall a. TBQueue m a -> a -> STM m ()
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 = STM m Natural -> StateT s (STM m) Natural
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Natural -> StateT s (STM m) Natural)
-> (TBQueue m a -> STM m Natural)
-> TBQueue m a
-> StateT s (STM m) Natural
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m Natural
forall a. TBQueue m a -> STM m Natural
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 = STM m Bool -> StateT s (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> StateT s (STM m) Bool)
-> (TBQueue m a -> STM m Bool)
-> TBQueue m a
-> StateT s (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m Bool
forall a. TBQueue m a -> STM m Bool
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 = STM m Bool -> StateT s (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> StateT s (STM m) Bool)
-> (TBQueue m a -> STM m Bool)
-> TBQueue m a
-> StateT s (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m Bool
forall a. TBQueue m a -> STM m Bool
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 = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TBQueue m a -> a -> STM m ())
-> TBQueue m a
-> a
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TBQueue m a -> a -> STM m ()
forall a. TBQueue m a -> a -> STM m ()
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 = STM m (TSem m) -> StateT s (STM m) (TSem m)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TSem m) -> StateT s (STM m) (TSem m))
-> (Integer -> STM m (TSem m))
-> Integer
-> StateT s (STM m) (TSem m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> STM m (TSem m)
forall (m :: * -> *). MonadSTM m => Integer -> STM m (TSem m)
newTSem
waitTSem :: TSem (StateT s m) -> STM (StateT s m) ()
waitTSem = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TSem m -> STM m ()) -> TSem m -> StateT s (STM m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TSem m -> STM m ()
forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
waitTSem
signalTSem :: TSem (StateT s m) -> STM (StateT s m) ()
signalTSem = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TSem m -> STM m ()) -> TSem m -> StateT s (STM m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TSem m -> STM m ()
forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
signalTSem
signalTSemN :: Natural -> TSem (StateT s m) -> STM (StateT s m) ()
signalTSemN = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (Natural -> TSem m -> STM m ())
-> Natural
-> TSem m
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Natural -> TSem m -> STM m ()
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 = STM m (TChan m a) -> StateT s (STM m) (TChan m a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m (TChan m a)
forall a. STM m (TChan m a)
forall (m :: * -> *) a. MonadSTM m => STM m (TChan m a)
newTChan
newBroadcastTChan :: forall a. STM (StateT s m) (TChan (StateT s m) a)
newBroadcastTChan = STM m (TChan m a) -> StateT s (STM m) (TChan m a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m (TChan m a)
forall a. STM m (TChan m a)
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 = STM m (TChan m a) -> StateT s (STM m) (TChan m a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TChan m a) -> StateT s (STM m) (TChan m a))
-> (TChan m a -> STM m (TChan m a))
-> TChan m a
-> StateT s (STM m) (TChan m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (TChan m a)
forall a. TChan m a -> STM m (TChan m a)
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 = STM m (TChan m a) -> StateT s (STM m) (TChan m a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TChan m a) -> StateT s (STM m) (TChan m a))
-> (TChan m a -> STM m (TChan m a))
-> TChan m a
-> StateT s (STM m) (TChan m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (TChan m a)
forall a. TChan m a -> STM m (TChan m a)
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 = STM m a -> StateT s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> StateT s (STM m) a)
-> (TChan m a -> STM m a) -> TChan m a -> StateT s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m a
forall a. TChan m a -> STM m a
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 = STM m (Maybe a) -> StateT s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> StateT s (STM m) (Maybe a))
-> (TChan m a -> STM m (Maybe a))
-> TChan m a
-> StateT s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (Maybe a)
forall a. TChan m a -> STM m (Maybe a)
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 = STM m a -> StateT s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> StateT s (STM m) a)
-> (TChan m a -> STM m a) -> TChan m a -> StateT s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m a
forall a. TChan m a -> STM m a
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 = STM m (Maybe a) -> StateT s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> StateT s (STM m) (Maybe a))
-> (TChan m a -> STM m (Maybe a))
-> TChan m a
-> StateT s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (Maybe a)
forall a. TChan m a -> STM m (Maybe a)
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 = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TChan m a -> a -> STM m ())
-> TChan m a
-> a
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TChan m a -> a -> STM m ()
forall a. TChan m a -> a -> STM m ()
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 = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TChan m a -> a -> STM m ())
-> TChan m a
-> a
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TChan m a -> a -> STM m ()
forall a. TChan m a -> a -> STM m ()
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 = STM m Bool -> StateT s (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> StateT s (STM m) Bool)
-> (TChan m a -> STM m Bool) -> TChan m a -> StateT s (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m Bool
forall a. TChan m a -> STM m Bool
forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m Bool
isEmptyTChan
instance MonadInspectSTM m => MonadInspectSTM (Strict.StateT s m) where
type InspectMonad (Strict.StateT s m) = InspectMonad m
inspectTVar :: forall (proxy :: (* -> *) -> *) a.
proxy (StateT s m)
-> TVar (StateT s m) a -> InspectMonad (StateT s m) a
inspectTVar proxy (StateT s m)
_ = Proxy m -> TVar m a -> InspectMonad m a
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadInspectSTM m =>
proxy m -> TVar m a -> InspectMonad m a
forall (proxy :: (* -> *) -> *) a.
proxy m -> TVar m a -> InspectMonad m a
inspectTVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
inspectTMVar :: forall (proxy :: (* -> *) -> *) a.
proxy (StateT s m)
-> TMVar (StateT s m) a -> InspectMonad (StateT s m) (Maybe a)
inspectTMVar proxy (StateT s m)
_ = Proxy m -> TMVar m a -> InspectMonad m (Maybe a)
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadInspectSTM m =>
proxy m -> TMVar m a -> InspectMonad m (Maybe a)
forall (proxy :: (* -> *) -> *) a.
proxy m -> TMVar m a -> InspectMonad m (Maybe a)
inspectTMVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
instance MonadTraceSTM m => MonadTraceSTM (Strict.StateT s m) where
traceTVar :: forall (proxy :: (* -> *) -> *) a.
proxy (StateT s m)
-> TVar (StateT s m) a
-> (Maybe a -> a -> InspectMonad (StateT s m) TraceValue)
-> STM (StateT s m) ()
traceTVar proxy (StateT s m)
_ = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue) -> STM m ())
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> STM m ()
traceTVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTMVar :: forall (proxy :: (* -> *) -> *) a.
proxy (StateT s m)
-> TMVar (StateT s m) a
-> (Maybe (Maybe a)
-> Maybe a -> InspectMonad (StateT s m) TraceValue)
-> STM (StateT s m) ()
traceTMVar proxy (StateT s m)
_ = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ())
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ()
traceTMVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTQueue :: forall (proxy :: (* -> *) -> *) a.
proxy (StateT s m)
-> TQueue (StateT s m) a
-> (Maybe [a] -> [a] -> InspectMonad (StateT s m) TraceValue)
-> STM (StateT s m) ()
traceTQueue proxy (StateT s m)
_ = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> STM m ())
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
traceTQueue (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTBQueue :: forall (proxy :: (* -> *) -> *) a.
proxy (StateT s m)
-> TBQueue (StateT s m) a
-> (Maybe [a] -> [a] -> InspectMonad (StateT s m) TraceValue)
-> STM (StateT s m) ()
traceTBQueue proxy (StateT s m)
_ = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> STM m ())
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
traceTBQueue (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTSem :: forall (proxy :: (* -> *) -> *).
proxy (StateT s m)
-> TSem (StateT s m)
-> (Maybe Integer
-> Integer -> InspectMonad (StateT s m) TraceValue)
-> STM (StateT s m) ()
traceTSem proxy (StateT s m)
_ = STM m () -> StateT s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> StateT s (STM m) ())
-> (TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ())
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> StateT s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *).
MonadTraceSTM m =>
proxy m
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *).
proxy m
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ()
traceTSem (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
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 = m (Either e a) -> ExceptT e m a
forall e (m :: * -> *) a. m (Either e a) -> ExceptT e m a
ExceptT (m (Either e a) -> ExceptT e m a)
-> (ExceptT e (STM m) a -> m (Either e a))
-> ExceptT e (STM m) a
-> ExceptT e m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. STM m (Either e a) -> m (Either e a)
forall a. HasCallStack => STM m a -> m a
forall (m :: * -> *) a.
(MonadSTM m, HasCallStack) =>
STM m a -> m a
atomically (STM m (Either e a) -> m (Either e a))
-> (ExceptT e (STM m) a -> STM m (Either e a))
-> ExceptT e (STM m) a
-> m (Either e a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ExceptT e (STM m) a -> STM m (Either e a)
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 = STM m (TVar m a) -> ExceptT e (STM m) (TVar m a)
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TVar m a) -> ExceptT e (STM m) (TVar m a))
-> (a -> STM m (TVar m a)) -> a -> ExceptT e (STM m) (TVar m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> STM m (TVar m a)
forall a. a -> STM m (TVar m a)
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 = STM m a -> ExceptT e (STM m) a
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> ExceptT e (STM m) a)
-> (TVar m a -> STM m a) -> TVar m a -> ExceptT e (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TVar m a -> STM m a
forall a. TVar m a -> STM m a
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 = STM m () -> ExceptT e (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> ExceptT e (STM m) ())
-> (TVar m a -> a -> STM m ())
-> TVar m a
-> a
-> ExceptT e (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> a -> STM m ()
forall a. TVar m a -> a -> STM m ()
forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m ()
writeTVar
retry :: forall a. STM (ExceptT e m) a
retry = STM m a -> ExceptT e (STM m) a
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m a
forall a. STM m a
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 = STM m (Either e a) -> ExceptT e (STM m) a
forall e (m :: * -> *) a. m (Either e a) -> ExceptT e m a
ExceptT (STM m (Either e a) -> ExceptT e (STM m) a)
-> (ExceptT e (STM m) a
-> ExceptT e (STM m) a -> STM m (Either e a))
-> ExceptT e (STM m) a
-> ExceptT e (STM m) a
-> ExceptT e (STM m) a
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: (STM m (Either e a) -> STM m (Either e a) -> STM m (Either e a))
-> (ExceptT e (STM m) a -> STM m (Either e a))
-> ExceptT e (STM m) a
-> ExceptT e (STM m) a
-> STM m (Either e a)
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
on STM m (Either e a) -> STM m (Either e a) -> STM m (Either e a)
forall a. STM m a -> STM m a -> STM m a
forall (m :: * -> *) a. MonadSTM m => STM m a -> STM m a -> STM m a
orElse ExceptT e (STM m) a -> STM m (Either e a)
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 = STM m () -> ExceptT e (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> ExceptT e (STM m) ())
-> (TVar m a -> (a -> a) -> STM m ())
-> TVar m a
-> (a -> a)
-> ExceptT e (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> (a -> a) -> STM m ()
forall a. TVar m a -> (a -> a) -> STM m ()
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' = STM m () -> ExceptT e (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> ExceptT e (STM m) ())
-> (TVar m a -> (a -> a) -> STM m ())
-> TVar m a
-> (a -> a)
-> ExceptT e (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> (a -> a) -> STM m ()
forall a. TVar m a -> (a -> a) -> STM m ()
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 = STM m a -> ExceptT e (STM m) a
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> ExceptT e (STM m) a)
-> (TVar m s -> (s -> (a, s)) -> STM m a)
-> TVar m s
-> (s -> (a, s))
-> ExceptT e (STM m) a
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m s -> (s -> (a, s)) -> STM m a
forall s a. TVar m s -> (s -> (a, s)) -> STM m a
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 = STM m a -> ExceptT e (STM m) a
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> ExceptT e (STM m) a)
-> (TVar m a -> a -> STM m a)
-> TVar m a
-> a
-> ExceptT e (STM m) a
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> a -> STM m a
forall a. TVar m a -> a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m a
swapTVar
check :: Bool -> STM (ExceptT e m) ()
check = STM m () -> ExceptT e (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> ExceptT e (STM m) ())
-> (Bool -> STM m ()) -> Bool -> ExceptT e (STM m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> STM m ()
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 = STM m (TMVar m a) -> ExceptT e (STM m) (TMVar m a)
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TMVar m a) -> ExceptT e (STM m) (TMVar m a))
-> (a -> STM m (TMVar m a)) -> a -> ExceptT e (STM m) (TMVar m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> STM m (TMVar m a)
forall a. a -> STM m (TMVar m a)
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 = STM m (TMVar m a) -> ExceptT e (STM m) (TMVar m a)
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m (TMVar m a)
forall a. STM m (TMVar m a)
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 = STM m a -> ExceptT e (STM m) a
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> ExceptT e (STM m) a)
-> (TMVar m a -> STM m a) -> TMVar m a -> ExceptT e (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m a
forall a. TMVar m a -> STM m a
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 = STM m (Maybe a) -> ExceptT e (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> ExceptT e (STM m) (Maybe a))
-> (TMVar m a -> STM m (Maybe a))
-> TMVar m a
-> ExceptT e (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m (Maybe a)
forall a. TMVar m a -> STM m (Maybe a)
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 = STM m () -> ExceptT e (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> ExceptT e (STM m) ())
-> (TMVar m a -> a -> STM m ())
-> TMVar m a
-> a
-> ExceptT e (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m ()
forall a. TMVar m a -> a -> STM m ()
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 = STM m Bool -> ExceptT e (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> ExceptT e (STM m) Bool)
-> (TMVar m a -> a -> STM m Bool)
-> TMVar m a
-> a
-> ExceptT e (STM m) Bool
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m Bool
forall a. TMVar m a -> a -> STM m Bool
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 = STM m a -> ExceptT e (STM m) a
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> ExceptT e (STM m) a)
-> (TMVar m a -> STM m a) -> TMVar m a -> ExceptT e (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m a
forall a. TMVar m a -> STM m a
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 = STM m (Maybe a) -> ExceptT e (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> ExceptT e (STM m) (Maybe a))
-> (TMVar m a -> STM m (Maybe a))
-> TMVar m a
-> ExceptT e (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m (Maybe a)
forall a. TMVar m a -> STM m (Maybe a)
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 = STM m a -> ExceptT e (STM m) a
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> ExceptT e (STM m) a)
-> (TMVar m a -> a -> STM m a)
-> TMVar m a
-> a
-> ExceptT e (STM m) a
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m a
forall a. TMVar m a -> a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m a
swapTMVar
writeTMVar :: forall a. TMVar (ExceptT e m) a -> a -> STM (ExceptT e m) ()
writeTMVar = STM m () -> ExceptT e (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> ExceptT e (STM m) ())
-> (TMVar m a -> a -> STM m ())
-> TMVar m a
-> a
-> ExceptT e (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m ()
forall a. TMVar m a -> a -> STM m ()
forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m ()
writeTMVar
isEmptyTMVar :: forall a. TMVar (ExceptT e m) a -> STM (ExceptT e m) Bool
isEmptyTMVar = STM m Bool -> ExceptT e (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> ExceptT e (STM m) Bool)
-> (TMVar m a -> STM m Bool) -> TMVar m a -> ExceptT e (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m Bool
forall a. TMVar m a -> STM m Bool
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 = STM m (TQueue m a) -> ExceptT e (STM m) (TQueue m a)
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m (TQueue m a)
forall a. STM m (TQueue m a)
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 = STM m a -> ExceptT e (STM m) a
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> ExceptT e (STM m) a)
-> (TQueue m a -> STM m a) -> TQueue m a -> ExceptT e (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m a
forall a. TQueue m a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
readTQueue
tryReadTQueue :: forall a. TQueue (ExceptT e m) a -> STM (ExceptT e m) (Maybe a)
tryReadTQueue = STM m (Maybe a) -> ExceptT e (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> ExceptT e (STM m) (Maybe a))
-> (TQueue m a -> STM m (Maybe a))
-> TQueue m a
-> ExceptT e (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m (Maybe a)
forall a. TQueue m a -> STM m (Maybe a)
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryReadTQueue
peekTQueue :: forall a. TQueue (ExceptT e m) a -> STM (ExceptT e m) a
peekTQueue = STM m a -> ExceptT e (STM m) a
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> ExceptT e (STM m) a)
-> (TQueue m a -> STM m a) -> TQueue m a -> ExceptT e (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m a
forall a. TQueue m a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
peekTQueue
tryPeekTQueue :: forall a. TQueue (ExceptT e m) a -> STM (ExceptT e m) (Maybe a)
tryPeekTQueue = STM m (Maybe a) -> ExceptT e (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> ExceptT e (STM m) (Maybe a))
-> (TQueue m a -> STM m (Maybe a))
-> TQueue m a
-> ExceptT e (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m (Maybe a)
forall a. TQueue m a -> STM m (Maybe a)
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryPeekTQueue
flushTQueue :: forall a. TQueue (ExceptT e m) a -> STM (ExceptT e m) [a]
flushTQueue = STM m [a] -> ExceptT e (STM m) [a]
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m [a] -> ExceptT e (STM m) [a])
-> (TQueue m a -> STM m [a]) -> TQueue m a -> ExceptT e (STM m) [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m [a]
forall a. TQueue m a -> STM m [a]
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m [a]
flushTQueue
writeTQueue :: forall a. TQueue (ExceptT e m) a -> a -> STM (ExceptT e m) ()
writeTQueue TQueue (ExceptT e m) a
v = STM m () -> ExceptT e (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> ExceptT e (STM m) ())
-> (a -> STM m ()) -> a -> ExceptT e (STM m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> a -> STM m ()
forall a. TQueue m a -> a -> STM m ()
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> a -> STM m ()
writeTQueue TQueue m a
TQueue (ExceptT e m) a
v
isEmptyTQueue :: forall a. TQueue (ExceptT e m) a -> STM (ExceptT e m) Bool
isEmptyTQueue = STM m Bool -> ExceptT e (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> ExceptT e (STM m) Bool)
-> (TQueue m a -> STM m Bool)
-> TQueue m a
-> ExceptT e (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m Bool
forall a. TQueue m a -> STM m Bool
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m Bool
isEmptyTQueue
unGetTQueue :: forall a. TQueue (ExceptT e m) a -> a -> STM (ExceptT e m) ()
unGetTQueue = STM m () -> ExceptT e (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> ExceptT e (STM m) ())
-> (TQueue m a -> a -> STM m ())
-> TQueue m a
-> a
-> ExceptT e (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TQueue m a -> a -> STM m ()
forall a. TQueue m a -> a -> STM m ()
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 = STM m (TBQueue m a) -> ExceptT e (STM m) (TBQueue m a)
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TBQueue m a) -> ExceptT e (STM m) (TBQueue m a))
-> (Natural -> STM m (TBQueue m a))
-> Natural
-> ExceptT e (STM m) (TBQueue m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Natural -> STM m (TBQueue m a)
forall a. Natural -> STM m (TBQueue m a)
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 = STM m a -> ExceptT e (STM m) a
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> ExceptT e (STM m) a)
-> (TBQueue m a -> STM m a) -> TBQueue m a -> ExceptT e (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m a
forall a. TBQueue m a -> STM m a
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 = STM m (Maybe a) -> ExceptT e (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> ExceptT e (STM m) (Maybe a))
-> (TBQueue m a -> STM m (Maybe a))
-> TBQueue m a
-> ExceptT e (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m (Maybe a)
forall a. TBQueue m a -> STM m (Maybe a)
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 = STM m a -> ExceptT e (STM m) a
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> ExceptT e (STM m) a)
-> (TBQueue m a -> STM m a) -> TBQueue m a -> ExceptT e (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m a
forall a. TBQueue m a -> STM m a
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 = STM m (Maybe a) -> ExceptT e (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> ExceptT e (STM m) (Maybe a))
-> (TBQueue m a -> STM m (Maybe a))
-> TBQueue m a
-> ExceptT e (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m (Maybe a)
forall a. TBQueue m a -> STM m (Maybe a)
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 = STM m [a] -> ExceptT e (STM m) [a]
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m [a] -> ExceptT e (STM m) [a])
-> (TBQueue m a -> STM m [a])
-> TBQueue m a
-> ExceptT e (STM m) [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m [a]
forall a. TBQueue m a -> STM m [a]
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 = STM m () -> ExceptT e (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> ExceptT e (STM m) ())
-> (TBQueue m a -> a -> STM m ())
-> TBQueue m a
-> a
-> ExceptT e (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TBQueue m a -> a -> STM m ()
forall a. TBQueue m a -> a -> STM m ()
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 = STM m Natural -> ExceptT e (STM m) Natural
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Natural -> ExceptT e (STM m) Natural)
-> (TBQueue m a -> STM m Natural)
-> TBQueue m a
-> ExceptT e (STM m) Natural
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m Natural
forall a. TBQueue m a -> STM m Natural
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 = STM m Bool -> ExceptT e (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> ExceptT e (STM m) Bool)
-> (TBQueue m a -> STM m Bool)
-> TBQueue m a
-> ExceptT e (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m Bool
forall a. TBQueue m a -> STM m Bool
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 = STM m Bool -> ExceptT e (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> ExceptT e (STM m) Bool)
-> (TBQueue m a -> STM m Bool)
-> TBQueue m a
-> ExceptT e (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m Bool
forall a. TBQueue m a -> STM m Bool
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 = STM m () -> ExceptT e (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> ExceptT e (STM m) ())
-> (TBQueue m a -> a -> STM m ())
-> TBQueue m a
-> a
-> ExceptT e (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TBQueue m a -> a -> STM m ()
forall a. TBQueue m a -> a -> STM m ()
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 = STM m (TSem m) -> ExceptT e (STM m) (TSem m)
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TSem m) -> ExceptT e (STM m) (TSem m))
-> (Integer -> STM m (TSem m))
-> Integer
-> ExceptT e (STM m) (TSem m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> STM m (TSem m)
forall (m :: * -> *). MonadSTM m => Integer -> STM m (TSem m)
newTSem
waitTSem :: TSem (ExceptT e m) -> STM (ExceptT e m) ()
waitTSem = STM m () -> ExceptT e (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> ExceptT e (STM m) ())
-> (TSem m -> STM m ()) -> TSem m -> ExceptT e (STM m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TSem m -> STM m ()
forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
waitTSem
signalTSem :: TSem (ExceptT e m) -> STM (ExceptT e m) ()
signalTSem = STM m () -> ExceptT e (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> ExceptT e (STM m) ())
-> (TSem m -> STM m ()) -> TSem m -> ExceptT e (STM m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TSem m -> STM m ()
forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
signalTSem
signalTSemN :: Natural -> TSem (ExceptT e m) -> STM (ExceptT e m) ()
signalTSemN = STM m () -> ExceptT e (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> ExceptT e (STM m) ())
-> (Natural -> TSem m -> STM m ())
-> Natural
-> TSem m
-> ExceptT e (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Natural -> TSem m -> STM m ()
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 = STM m (TChan m a) -> ExceptT e (STM m) (TChan m a)
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m (TChan m a)
forall a. STM m (TChan m a)
forall (m :: * -> *) a. MonadSTM m => STM m (TChan m a)
newTChan
newBroadcastTChan :: forall a. STM (ExceptT e m) (TChan (ExceptT e m) a)
newBroadcastTChan = STM m (TChan m a) -> ExceptT e (STM m) (TChan m a)
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m (TChan m a)
forall a. STM m (TChan m a)
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 = STM m (TChan m a) -> ExceptT e (STM m) (TChan m a)
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TChan m a) -> ExceptT e (STM m) (TChan m a))
-> (TChan m a -> STM m (TChan m a))
-> TChan m a
-> ExceptT e (STM m) (TChan m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (TChan m a)
forall a. TChan m a -> STM m (TChan m a)
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 = STM m (TChan m a) -> ExceptT e (STM m) (TChan m a)
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TChan m a) -> ExceptT e (STM m) (TChan m a))
-> (TChan m a -> STM m (TChan m a))
-> TChan m a
-> ExceptT e (STM m) (TChan m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (TChan m a)
forall a. TChan m a -> STM m (TChan m a)
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 = STM m a -> ExceptT e (STM m) a
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> ExceptT e (STM m) a)
-> (TChan m a -> STM m a) -> TChan m a -> ExceptT e (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m a
forall a. TChan m a -> STM m a
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 = STM m (Maybe a) -> ExceptT e (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> ExceptT e (STM m) (Maybe a))
-> (TChan m a -> STM m (Maybe a))
-> TChan m a
-> ExceptT e (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (Maybe a)
forall a. TChan m a -> STM m (Maybe a)
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 = STM m a -> ExceptT e (STM m) a
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> ExceptT e (STM m) a)
-> (TChan m a -> STM m a) -> TChan m a -> ExceptT e (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m a
forall a. TChan m a -> STM m a
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 = STM m (Maybe a) -> ExceptT e (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> ExceptT e (STM m) (Maybe a))
-> (TChan m a -> STM m (Maybe a))
-> TChan m a
-> ExceptT e (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (Maybe a)
forall a. TChan m a -> STM m (Maybe a)
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 = STM m () -> ExceptT e (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> ExceptT e (STM m) ())
-> (TChan m a -> a -> STM m ())
-> TChan m a
-> a
-> ExceptT e (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TChan m a -> a -> STM m ()
forall a. TChan m a -> a -> STM m ()
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 = STM m () -> ExceptT e (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> ExceptT e (STM m) ())
-> (TChan m a -> a -> STM m ())
-> TChan m a
-> a
-> ExceptT e (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TChan m a -> a -> STM m ()
forall a. TChan m a -> a -> STM m ()
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 = STM m Bool -> ExceptT e (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> ExceptT e (STM m) Bool)
-> (TChan m a -> STM m Bool) -> TChan m a -> ExceptT e (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m Bool
forall a. TChan m a -> STM m Bool
forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m Bool
isEmptyTChan
instance MonadInspectSTM m => MonadInspectSTM (ExceptT e m) where
type InspectMonad (ExceptT e m) = InspectMonad m
inspectTVar :: forall (proxy :: (* -> *) -> *) a.
proxy (ExceptT e m)
-> TVar (ExceptT e m) a -> InspectMonad (ExceptT e m) a
inspectTVar proxy (ExceptT e m)
_ = Proxy m -> TVar m a -> InspectMonad m a
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadInspectSTM m =>
proxy m -> TVar m a -> InspectMonad m a
forall (proxy :: (* -> *) -> *) a.
proxy m -> TVar m a -> InspectMonad m a
inspectTVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
inspectTMVar :: forall (proxy :: (* -> *) -> *) a.
proxy (ExceptT e m)
-> TMVar (ExceptT e m) a -> InspectMonad (ExceptT e m) (Maybe a)
inspectTMVar proxy (ExceptT e m)
_ = Proxy m -> TMVar m a -> InspectMonad m (Maybe a)
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadInspectSTM m =>
proxy m -> TMVar m a -> InspectMonad m (Maybe a)
forall (proxy :: (* -> *) -> *) a.
proxy m -> TMVar m a -> InspectMonad m (Maybe a)
inspectTMVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
instance MonadTraceSTM m => MonadTraceSTM (ExceptT e m) where
traceTVar :: forall (proxy :: (* -> *) -> *) a.
proxy (ExceptT e m)
-> TVar (ExceptT e m) a
-> (Maybe a -> a -> InspectMonad (ExceptT e m) TraceValue)
-> STM (ExceptT e m) ()
traceTVar proxy (ExceptT e m)
_ = STM m () -> ExceptT e (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> ExceptT e (STM m) ())
-> (TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue) -> STM m ())
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> ExceptT e (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> STM m ()
traceTVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTMVar :: forall (proxy :: (* -> *) -> *) a.
proxy (ExceptT e m)
-> TMVar (ExceptT e m) a
-> (Maybe (Maybe a)
-> Maybe a -> InspectMonad (ExceptT e m) TraceValue)
-> STM (ExceptT e m) ()
traceTMVar proxy (ExceptT e m)
_ = STM m () -> ExceptT e (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> ExceptT e (STM m) ())
-> (TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ())
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> ExceptT e (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ()
traceTMVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTQueue :: forall (proxy :: (* -> *) -> *) a.
proxy (ExceptT e m)
-> TQueue (ExceptT e m) a
-> (Maybe [a] -> [a] -> InspectMonad (ExceptT e m) TraceValue)
-> STM (ExceptT e m) ()
traceTQueue proxy (ExceptT e m)
_ = STM m () -> ExceptT e (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> ExceptT e (STM m) ())
-> (TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> STM m ())
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> ExceptT e (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
traceTQueue (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTBQueue :: forall (proxy :: (* -> *) -> *) a.
proxy (ExceptT e m)
-> TBQueue (ExceptT e m) a
-> (Maybe [a] -> [a] -> InspectMonad (ExceptT e m) TraceValue)
-> STM (ExceptT e m) ()
traceTBQueue proxy (ExceptT e m)
_ = STM m () -> ExceptT e (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> ExceptT e (STM m) ())
-> (TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> STM m ())
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> ExceptT e (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
traceTBQueue (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTSem :: forall (proxy :: (* -> *) -> *).
proxy (ExceptT e m)
-> TSem (ExceptT e m)
-> (Maybe Integer
-> Integer -> InspectMonad (ExceptT e m) TraceValue)
-> STM (ExceptT e m) ()
traceTSem proxy (ExceptT e m)
_ = STM m () -> ExceptT e (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> ExceptT e (STM m) ())
-> (TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ())
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> ExceptT e (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *).
MonadTraceSTM m =>
proxy m
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *).
proxy m
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ()
traceTSem (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
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) = (r -> s -> m (a, s, w)) -> RWST r w s m a
forall r w s (m :: * -> *) a.
(r -> s -> m (a, s, w)) -> RWST r w s m a
Lazy.RWST ((r -> s -> m (a, s, w)) -> RWST r w s m a)
-> (r -> s -> m (a, s, w)) -> RWST r w s m a
forall a b. (a -> b) -> a -> b
$ \r
r s
s -> STM m (a, s, w) -> m (a, s, w)
forall a. HasCallStack => STM m a -> m a
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 = STM m (TVar m a) -> RWST r w s (STM m) (TVar m a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TVar m a) -> RWST r w s (STM m) (TVar m a))
-> (a -> STM m (TVar m a)) -> a -> RWST r w s (STM m) (TVar m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> STM m (TVar m a)
forall a. a -> STM m (TVar m a)
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 = STM m a -> RWST r w s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> RWST r w s (STM m) a)
-> (TVar m a -> STM m a) -> TVar m a -> RWST r w s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TVar m a -> STM m a
forall a. TVar m a -> STM m a
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 = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TVar m a -> a -> STM m ())
-> TVar m a
-> a
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> a -> STM m ()
forall a. TVar m a -> a -> STM m ()
forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m ()
writeTVar
retry :: forall a. STM (RWST r w s m) a
retry = STM m a -> RWST r w s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m a
forall a. STM m a
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) = (r -> s -> STM m (a, s, w)) -> RWST r w s (STM m) a
forall r w s (m :: * -> *) a.
(r -> s -> m (a, s, w)) -> RWST r w s m a
Lazy.RWST ((r -> s -> STM m (a, s, w)) -> RWST r w s (STM m) a)
-> (r -> s -> STM m (a, s, w)) -> RWST r w s (STM m) a
forall a b. (a -> b) -> a -> b
$ \r
r s
s -> r -> s -> STM m (a, s, w)
a r
r s
s STM m (a, s, w) -> STM m (a, s, w) -> STM m (a, s, w)
forall a. STM m a -> STM m a -> STM m a
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 = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TVar m a -> (a -> a) -> STM m ())
-> TVar m a
-> (a -> a)
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> (a -> a) -> STM m ()
forall a. TVar m a -> (a -> a) -> STM m ()
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' = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TVar m a -> (a -> a) -> STM m ())
-> TVar m a
-> (a -> a)
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> (a -> a) -> STM m ()
forall a. TVar m a -> (a -> a) -> STM m ()
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 = STM m a -> RWST r w s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> RWST r w s (STM m) a)
-> (TVar m s -> (s -> (a, s)) -> STM m a)
-> TVar m s
-> (s -> (a, s))
-> RWST r w s (STM m) a
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m s -> (s -> (a, s)) -> STM m a
forall s a. TVar m s -> (s -> (a, s)) -> STM m a
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 = STM m a -> RWST r w s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> RWST r w s (STM m) a)
-> (TVar m a -> a -> STM m a)
-> TVar m a
-> a
-> RWST r w s (STM m) a
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> a -> STM m a
forall a. TVar m a -> a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m a
swapTVar
check :: Bool -> STM (RWST r w s m) ()
check = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (Bool -> STM m ()) -> Bool -> RWST r w s (STM m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> STM m ()
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 = STM m (TMVar m a) -> RWST r w s (STM m) (TMVar m a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TMVar m a) -> RWST r w s (STM m) (TMVar m a))
-> (a -> STM m (TMVar m a)) -> a -> RWST r w s (STM m) (TMVar m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> STM m (TMVar m a)
forall a. a -> STM m (TMVar m a)
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 = STM m (TMVar m a) -> RWST r w s (STM m) (TMVar m a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m (TMVar m a)
forall a. STM m (TMVar m a)
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 = STM m a -> RWST r w s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> RWST r w s (STM m) a)
-> (TMVar m a -> STM m a) -> TMVar m a -> RWST r w s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m a
forall a. TMVar m a -> STM m a
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 = STM m (Maybe a) -> RWST r w s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> RWST r w s (STM m) (Maybe a))
-> (TMVar m a -> STM m (Maybe a))
-> TMVar m a
-> RWST r w s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m (Maybe a)
forall a. TMVar m a -> STM m (Maybe a)
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 = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TMVar m a -> a -> STM m ())
-> TMVar m a
-> a
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m ()
forall a. TMVar m a -> a -> STM m ()
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 = STM m Bool -> RWST r w s (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> RWST r w s (STM m) Bool)
-> (TMVar m a -> a -> STM m Bool)
-> TMVar m a
-> a
-> RWST r w s (STM m) Bool
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m Bool
forall a. TMVar m a -> a -> STM m Bool
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 = STM m a -> RWST r w s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> RWST r w s (STM m) a)
-> (TMVar m a -> STM m a) -> TMVar m a -> RWST r w s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m a
forall a. TMVar m a -> STM m a
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 = STM m (Maybe a) -> RWST r w s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> RWST r w s (STM m) (Maybe a))
-> (TMVar m a -> STM m (Maybe a))
-> TMVar m a
-> RWST r w s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m (Maybe a)
forall a. TMVar m a -> STM m (Maybe a)
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 = STM m a -> RWST r w s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> RWST r w s (STM m) a)
-> (TMVar m a -> a -> STM m a)
-> TMVar m a
-> a
-> RWST r w s (STM m) a
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m a
forall a. TMVar m a -> a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m a
swapTMVar
writeTMVar :: forall a. TMVar (RWST r w s m) a -> a -> STM (RWST r w s m) ()
writeTMVar = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TMVar m a -> a -> STM m ())
-> TMVar m a
-> a
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m ()
forall a. TMVar m a -> a -> STM m ()
forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m ()
writeTMVar
isEmptyTMVar :: forall a. TMVar (RWST r w s m) a -> STM (RWST r w s m) Bool
isEmptyTMVar = STM m Bool -> RWST r w s (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> RWST r w s (STM m) Bool)
-> (TMVar m a -> STM m Bool)
-> TMVar m a
-> RWST r w s (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m Bool
forall a. TMVar m a -> STM m Bool
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 = STM m (TQueue m a) -> RWST r w s (STM m) (TQueue m a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m (TQueue m a)
forall a. STM m (TQueue m a)
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 = STM m a -> RWST r w s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> RWST r w s (STM m) a)
-> (TQueue m a -> STM m a) -> TQueue m a -> RWST r w s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m a
forall a. TQueue m a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
readTQueue
tryReadTQueue :: forall a. TQueue (RWST r w s m) a -> STM (RWST r w s m) (Maybe a)
tryReadTQueue = STM m (Maybe a) -> RWST r w s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> RWST r w s (STM m) (Maybe a))
-> (TQueue m a -> STM m (Maybe a))
-> TQueue m a
-> RWST r w s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m (Maybe a)
forall a. TQueue m a -> STM m (Maybe a)
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryReadTQueue
peekTQueue :: forall a. TQueue (RWST r w s m) a -> STM (RWST r w s m) a
peekTQueue = STM m a -> RWST r w s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> RWST r w s (STM m) a)
-> (TQueue m a -> STM m a) -> TQueue m a -> RWST r w s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m a
forall a. TQueue m a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
peekTQueue
tryPeekTQueue :: forall a. TQueue (RWST r w s m) a -> STM (RWST r w s m) (Maybe a)
tryPeekTQueue = STM m (Maybe a) -> RWST r w s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> RWST r w s (STM m) (Maybe a))
-> (TQueue m a -> STM m (Maybe a))
-> TQueue m a
-> RWST r w s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m (Maybe a)
forall a. TQueue m a -> STM m (Maybe a)
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryPeekTQueue
flushTQueue :: forall a. TQueue (RWST r w s m) a -> STM (RWST r w s m) [a]
flushTQueue = STM m [a] -> RWST r w s (STM m) [a]
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m [a] -> RWST r w s (STM m) [a])
-> (TQueue m a -> STM m [a])
-> TQueue m a
-> RWST r w s (STM m) [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m [a]
forall a. TQueue m a -> STM m [a]
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m [a]
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 = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (a -> STM m ()) -> a -> RWST r w s (STM m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> a -> STM m ()
forall a. TQueue m a -> a -> STM m ()
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> a -> STM m ()
writeTQueue TQueue m a
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 = STM m Bool -> RWST r w s (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> RWST r w s (STM m) Bool)
-> (TQueue m a -> STM m Bool)
-> TQueue m a
-> RWST r w s (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m Bool
forall a. TQueue m a -> STM m Bool
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m Bool
isEmptyTQueue
unGetTQueue :: forall a. TQueue (RWST r w s m) a -> a -> STM (RWST r w s m) ()
unGetTQueue = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TQueue m a -> a -> STM m ())
-> TQueue m a
-> a
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TQueue m a -> a -> STM m ()
forall a. TQueue m a -> a -> STM m ()
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 = STM m (TBQueue m a) -> RWST r w s (STM m) (TBQueue m a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TBQueue m a) -> RWST r w s (STM m) (TBQueue m a))
-> (Natural -> STM m (TBQueue m a))
-> Natural
-> RWST r w s (STM m) (TBQueue m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Natural -> STM m (TBQueue m a)
forall a. Natural -> STM m (TBQueue m a)
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 = STM m a -> RWST r w s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> RWST r w s (STM m) a)
-> (TBQueue m a -> STM m a) -> TBQueue m a -> RWST r w s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m a
forall a. TBQueue m a -> STM m a
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 = STM m (Maybe a) -> RWST r w s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> RWST r w s (STM m) (Maybe a))
-> (TBQueue m a -> STM m (Maybe a))
-> TBQueue m a
-> RWST r w s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m (Maybe a)
forall a. TBQueue m a -> STM m (Maybe a)
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 = STM m a -> RWST r w s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> RWST r w s (STM m) a)
-> (TBQueue m a -> STM m a) -> TBQueue m a -> RWST r w s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m a
forall a. TBQueue m a -> STM m a
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 = STM m (Maybe a) -> RWST r w s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> RWST r w s (STM m) (Maybe a))
-> (TBQueue m a -> STM m (Maybe a))
-> TBQueue m a
-> RWST r w s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m (Maybe a)
forall a. TBQueue m a -> STM m (Maybe a)
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 = STM m [a] -> RWST r w s (STM m) [a]
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m [a] -> RWST r w s (STM m) [a])
-> (TBQueue m a -> STM m [a])
-> TBQueue m a
-> RWST r w s (STM m) [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m [a]
forall a. TBQueue m a -> STM m [a]
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 = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TBQueue m a -> a -> STM m ())
-> TBQueue m a
-> a
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TBQueue m a -> a -> STM m ()
forall a. TBQueue m a -> a -> STM m ()
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 = STM m Natural -> RWST r w s (STM m) Natural
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Natural -> RWST r w s (STM m) Natural)
-> (TBQueue m a -> STM m Natural)
-> TBQueue m a
-> RWST r w s (STM m) Natural
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m Natural
forall a. TBQueue m a -> STM m Natural
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 = STM m Bool -> RWST r w s (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> RWST r w s (STM m) Bool)
-> (TBQueue m a -> STM m Bool)
-> TBQueue m a
-> RWST r w s (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m Bool
forall a. TBQueue m a -> STM m Bool
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 = STM m Bool -> RWST r w s (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> RWST r w s (STM m) Bool)
-> (TBQueue m a -> STM m Bool)
-> TBQueue m a
-> RWST r w s (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m Bool
forall a. TBQueue m a -> STM m Bool
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 = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TBQueue m a -> a -> STM m ())
-> TBQueue m a
-> a
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TBQueue m a -> a -> STM m ()
forall a. TBQueue m a -> a -> STM m ()
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 = STM m (TSem m) -> RWST r w s (STM m) (TSem m)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TSem m) -> RWST r w s (STM m) (TSem m))
-> (Integer -> STM m (TSem m))
-> Integer
-> RWST r w s (STM m) (TSem m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> STM m (TSem m)
forall (m :: * -> *). MonadSTM m => Integer -> STM m (TSem m)
newTSem
waitTSem :: TSem (RWST r w s m) -> STM (RWST r w s m) ()
waitTSem = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TSem m -> STM m ()) -> TSem m -> RWST r w s (STM m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TSem m -> STM m ()
forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
waitTSem
signalTSem :: TSem (RWST r w s m) -> STM (RWST r w s m) ()
signalTSem = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TSem m -> STM m ()) -> TSem m -> RWST r w s (STM m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TSem m -> STM m ()
forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
signalTSem
signalTSemN :: Natural -> TSem (RWST r w s m) -> STM (RWST r w s m) ()
signalTSemN = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (Natural -> TSem m -> STM m ())
-> Natural
-> TSem m
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Natural -> TSem m -> STM m ()
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 = STM m (TChan m a) -> RWST r w s (STM m) (TChan m a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m (TChan m a)
forall a. STM m (TChan m a)
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 = STM m (TChan m a) -> RWST r w s (STM m) (TChan m a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m (TChan m a)
forall a. STM m (TChan m a)
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 = STM m (TChan m a) -> RWST r w s (STM m) (TChan m a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TChan m a) -> RWST r w s (STM m) (TChan m a))
-> (TChan m a -> STM m (TChan m a))
-> TChan m a
-> RWST r w s (STM m) (TChan m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (TChan m a)
forall a. TChan m a -> STM m (TChan m a)
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 = STM m (TChan m a) -> RWST r w s (STM m) (TChan m a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TChan m a) -> RWST r w s (STM m) (TChan m a))
-> (TChan m a -> STM m (TChan m a))
-> TChan m a
-> RWST r w s (STM m) (TChan m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (TChan m a)
forall a. TChan m a -> STM m (TChan m a)
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 = STM m a -> RWST r w s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> RWST r w s (STM m) a)
-> (TChan m a -> STM m a) -> TChan m a -> RWST r w s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m a
forall a. TChan m a -> STM m a
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 = STM m (Maybe a) -> RWST r w s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> RWST r w s (STM m) (Maybe a))
-> (TChan m a -> STM m (Maybe a))
-> TChan m a
-> RWST r w s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (Maybe a)
forall a. TChan m a -> STM m (Maybe a)
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 = STM m a -> RWST r w s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> RWST r w s (STM m) a)
-> (TChan m a -> STM m a) -> TChan m a -> RWST r w s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m a
forall a. TChan m a -> STM m a
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 = STM m (Maybe a) -> RWST r w s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> RWST r w s (STM m) (Maybe a))
-> (TChan m a -> STM m (Maybe a))
-> TChan m a
-> RWST r w s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (Maybe a)
forall a. TChan m a -> STM m (Maybe a)
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 = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TChan m a -> a -> STM m ())
-> TChan m a
-> a
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TChan m a -> a -> STM m ()
forall a. TChan m a -> a -> STM m ()
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 = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TChan m a -> a -> STM m ())
-> TChan m a
-> a
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TChan m a -> a -> STM m ()
forall a. TChan m a -> a -> STM m ()
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 = STM m Bool -> RWST r w s (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> RWST r w s (STM m) Bool)
-> (TChan m a -> STM m Bool)
-> TChan m a
-> RWST r w s (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m Bool
forall a. TChan m a -> STM m Bool
forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m Bool
isEmptyTChan
instance (Monoid w, MonadInspectSTM m) => MonadInspectSTM (Lazy.RWST r w s m) where
type InspectMonad (Lazy.RWST r w s m) = InspectMonad m
inspectTVar :: forall (proxy :: (* -> *) -> *) a.
proxy (RWST r w s m)
-> TVar (RWST r w s m) a -> InspectMonad (RWST r w s m) a
inspectTVar proxy (RWST r w s m)
_ = Proxy m -> TVar m a -> InspectMonad m a
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadInspectSTM m =>
proxy m -> TVar m a -> InspectMonad m a
forall (proxy :: (* -> *) -> *) a.
proxy m -> TVar m a -> InspectMonad m a
inspectTVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
inspectTMVar :: forall (proxy :: (* -> *) -> *) a.
proxy (RWST r w s m)
-> TMVar (RWST r w s m) a -> InspectMonad (RWST r w s m) (Maybe a)
inspectTMVar proxy (RWST r w s m)
_ = Proxy m -> TMVar m a -> InspectMonad m (Maybe a)
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadInspectSTM m =>
proxy m -> TMVar m a -> InspectMonad m (Maybe a)
forall (proxy :: (* -> *) -> *) a.
proxy m -> TMVar m a -> InspectMonad m (Maybe a)
inspectTMVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
instance (Monoid w, MonadTraceSTM m) => MonadTraceSTM (Lazy.RWST r w s m) where
traceTVar :: forall (proxy :: (* -> *) -> *) a.
proxy (RWST r w s m)
-> TVar (RWST r w s m) a
-> (Maybe a -> a -> InspectMonad (RWST r w s m) TraceValue)
-> STM (RWST r w s m) ()
traceTVar proxy (RWST r w s m)
_ = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue) -> STM m ())
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> STM m ()
traceTVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTMVar :: forall (proxy :: (* -> *) -> *) a.
proxy (RWST r w s m)
-> TMVar (RWST r w s m) a
-> (Maybe (Maybe a)
-> Maybe a -> InspectMonad (RWST r w s m) TraceValue)
-> STM (RWST r w s m) ()
traceTMVar proxy (RWST r w s m)
_ = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ())
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ()
traceTMVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTQueue :: forall (proxy :: (* -> *) -> *) a.
proxy (RWST r w s m)
-> TQueue (RWST r w s m) a
-> (Maybe [a] -> [a] -> InspectMonad (RWST r w s m) TraceValue)
-> STM (RWST r w s m) ()
traceTQueue proxy (RWST r w s m)
_ = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> STM m ())
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
traceTQueue (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTBQueue :: forall (proxy :: (* -> *) -> *) a.
proxy (RWST r w s m)
-> TBQueue (RWST r w s m) a
-> (Maybe [a] -> [a] -> InspectMonad (RWST r w s m) TraceValue)
-> STM (RWST r w s m) ()
traceTBQueue proxy (RWST r w s m)
_ = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> STM m ())
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
traceTBQueue (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTSem :: forall (proxy :: (* -> *) -> *).
proxy (RWST r w s m)
-> TSem (RWST r w s m)
-> (Maybe Integer
-> Integer -> InspectMonad (RWST r w s m) TraceValue)
-> STM (RWST r w s m) ()
traceTSem proxy (RWST r w s m)
_ = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ())
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *).
MonadTraceSTM m =>
proxy m
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *).
proxy m
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ()
traceTSem (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
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) = (r -> s -> m (a, s, w)) -> RWST r w s m a
forall r w s (m :: * -> *) a.
(r -> s -> m (a, s, w)) -> RWST r w s m a
Strict.RWST ((r -> s -> m (a, s, w)) -> RWST r w s m a)
-> (r -> s -> m (a, s, w)) -> RWST r w s m a
forall a b. (a -> b) -> a -> b
$ \r
r s
s -> STM m (a, s, w) -> m (a, s, w)
forall a. HasCallStack => STM m a -> m a
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 = STM m (TVar m a) -> RWST r w s (STM m) (TVar m a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TVar m a) -> RWST r w s (STM m) (TVar m a))
-> (a -> STM m (TVar m a)) -> a -> RWST r w s (STM m) (TVar m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> STM m (TVar m a)
forall a. a -> STM m (TVar m a)
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 = STM m a -> RWST r w s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> RWST r w s (STM m) a)
-> (TVar m a -> STM m a) -> TVar m a -> RWST r w s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TVar m a -> STM m a
forall a. TVar m a -> STM m a
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 = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TVar m a -> a -> STM m ())
-> TVar m a
-> a
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> a -> STM m ()
forall a. TVar m a -> a -> STM m ()
forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m ()
writeTVar
retry :: forall a. STM (RWST r w s m) a
retry = STM m a -> RWST r w s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m a
forall a. STM m a
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) = (r -> s -> STM m (a, s, w)) -> RWST r w s (STM m) a
forall r w s (m :: * -> *) a.
(r -> s -> m (a, s, w)) -> RWST r w s m a
Strict.RWST ((r -> s -> STM m (a, s, w)) -> RWST r w s (STM m) a)
-> (r -> s -> STM m (a, s, w)) -> RWST r w s (STM m) a
forall a b. (a -> b) -> a -> b
$ \r
r s
s -> r -> s -> STM m (a, s, w)
a r
r s
s STM m (a, s, w) -> STM m (a, s, w) -> STM m (a, s, w)
forall a. STM m a -> STM m a -> STM m a
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 = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TVar m a -> (a -> a) -> STM m ())
-> TVar m a
-> (a -> a)
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> (a -> a) -> STM m ()
forall a. TVar m a -> (a -> a) -> STM m ()
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' = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TVar m a -> (a -> a) -> STM m ())
-> TVar m a
-> (a -> a)
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> (a -> a) -> STM m ()
forall a. TVar m a -> (a -> a) -> STM m ()
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 = STM m a -> RWST r w s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> RWST r w s (STM m) a)
-> (TVar m s -> (s -> (a, s)) -> STM m a)
-> TVar m s
-> (s -> (a, s))
-> RWST r w s (STM m) a
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m s -> (s -> (a, s)) -> STM m a
forall s a. TVar m s -> (s -> (a, s)) -> STM m a
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 = STM m a -> RWST r w s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> RWST r w s (STM m) a)
-> (TVar m a -> a -> STM m a)
-> TVar m a
-> a
-> RWST r w s (STM m) a
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TVar m a -> a -> STM m a
forall a. TVar m a -> a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TVar m a -> a -> STM m a
swapTVar
check :: Bool -> STM (RWST r w s m) ()
check = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (Bool -> STM m ()) -> Bool -> RWST r w s (STM m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> STM m ()
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 = STM m (TMVar m a) -> RWST r w s (STM m) (TMVar m a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TMVar m a) -> RWST r w s (STM m) (TMVar m a))
-> (a -> STM m (TMVar m a)) -> a -> RWST r w s (STM m) (TMVar m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> STM m (TMVar m a)
forall a. a -> STM m (TMVar m a)
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 = STM m (TMVar m a) -> RWST r w s (STM m) (TMVar m a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m (TMVar m a)
forall a. STM m (TMVar m a)
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 = STM m a -> RWST r w s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> RWST r w s (STM m) a)
-> (TMVar m a -> STM m a) -> TMVar m a -> RWST r w s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m a
forall a. TMVar m a -> STM m a
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 = STM m (Maybe a) -> RWST r w s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> RWST r w s (STM m) (Maybe a))
-> (TMVar m a -> STM m (Maybe a))
-> TMVar m a
-> RWST r w s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m (Maybe a)
forall a. TMVar m a -> STM m (Maybe a)
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 = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TMVar m a -> a -> STM m ())
-> TMVar m a
-> a
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m ()
forall a. TMVar m a -> a -> STM m ()
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 = STM m Bool -> RWST r w s (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> RWST r w s (STM m) Bool)
-> (TMVar m a -> a -> STM m Bool)
-> TMVar m a
-> a
-> RWST r w s (STM m) Bool
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m Bool
forall a. TMVar m a -> a -> STM m Bool
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 = STM m a -> RWST r w s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> RWST r w s (STM m) a)
-> (TMVar m a -> STM m a) -> TMVar m a -> RWST r w s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m a
forall a. TMVar m a -> STM m a
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 = STM m (Maybe a) -> RWST r w s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> RWST r w s (STM m) (Maybe a))
-> (TMVar m a -> STM m (Maybe a))
-> TMVar m a
-> RWST r w s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m (Maybe a)
forall a. TMVar m a -> STM m (Maybe a)
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 = STM m a -> RWST r w s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> RWST r w s (STM m) a)
-> (TMVar m a -> a -> STM m a)
-> TMVar m a
-> a
-> RWST r w s (STM m) a
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m a
forall a. TMVar m a -> a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m a
swapTMVar
writeTMVar :: forall a. TMVar (RWST r w s m) a -> a -> STM (RWST r w s m) ()
writeTMVar = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TMVar m a -> a -> STM m ())
-> TMVar m a
-> a
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TMVar m a -> a -> STM m ()
forall a. TMVar m a -> a -> STM m ()
forall (m :: * -> *) a. MonadSTM m => TMVar m a -> a -> STM m ()
writeTMVar
isEmptyTMVar :: forall a. TMVar (RWST r w s m) a -> STM (RWST r w s m) Bool
isEmptyTMVar = STM m Bool -> RWST r w s (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> RWST r w s (STM m) Bool)
-> (TMVar m a -> STM m Bool)
-> TMVar m a
-> RWST r w s (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TMVar m a -> STM m Bool
forall a. TMVar m a -> STM m Bool
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 = STM m (TQueue m a) -> RWST r w s (STM m) (TQueue m a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m (TQueue m a)
forall a. STM m (TQueue m a)
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 = STM m a -> RWST r w s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> RWST r w s (STM m) a)
-> (TQueue m a -> STM m a) -> TQueue m a -> RWST r w s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m a
forall a. TQueue m a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
readTQueue
tryReadTQueue :: forall a. TQueue (RWST r w s m) a -> STM (RWST r w s m) (Maybe a)
tryReadTQueue = STM m (Maybe a) -> RWST r w s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> RWST r w s (STM m) (Maybe a))
-> (TQueue m a -> STM m (Maybe a))
-> TQueue m a
-> RWST r w s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m (Maybe a)
forall a. TQueue m a -> STM m (Maybe a)
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryReadTQueue
peekTQueue :: forall a. TQueue (RWST r w s m) a -> STM (RWST r w s m) a
peekTQueue = STM m a -> RWST r w s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> RWST r w s (STM m) a)
-> (TQueue m a -> STM m a) -> TQueue m a -> RWST r w s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m a
forall a. TQueue m a -> STM m a
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m a
peekTQueue
tryPeekTQueue :: forall a. TQueue (RWST r w s m) a -> STM (RWST r w s m) (Maybe a)
tryPeekTQueue = STM m (Maybe a) -> RWST r w s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> RWST r w s (STM m) (Maybe a))
-> (TQueue m a -> STM m (Maybe a))
-> TQueue m a
-> RWST r w s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m (Maybe a)
forall a. TQueue m a -> STM m (Maybe a)
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m (Maybe a)
tryPeekTQueue
flushTQueue :: forall a. TQueue (RWST r w s m) a -> STM (RWST r w s m) [a]
flushTQueue = STM m [a] -> RWST r w s (STM m) [a]
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m [a] -> RWST r w s (STM m) [a])
-> (TQueue m a -> STM m [a])
-> TQueue m a
-> RWST r w s (STM m) [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m [a]
forall a. TQueue m a -> STM m [a]
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m [a]
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 = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (a -> STM m ()) -> a -> RWST r w s (STM m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> a -> STM m ()
forall a. TQueue m a -> a -> STM m ()
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> a -> STM m ()
writeTQueue TQueue m a
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 = STM m Bool -> RWST r w s (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> RWST r w s (STM m) Bool)
-> (TQueue m a -> STM m Bool)
-> TQueue m a
-> RWST r w s (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TQueue m a -> STM m Bool
forall a. TQueue m a -> STM m Bool
forall (m :: * -> *) a. MonadSTM m => TQueue m a -> STM m Bool
isEmptyTQueue
unGetTQueue :: forall a. TQueue (RWST r w s m) a -> a -> STM (RWST r w s m) ()
unGetTQueue = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TQueue m a -> a -> STM m ())
-> TQueue m a
-> a
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TQueue m a -> a -> STM m ()
forall a. TQueue m a -> a -> STM m ()
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 = STM m (TBQueue m a) -> RWST r w s (STM m) (TBQueue m a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TBQueue m a) -> RWST r w s (STM m) (TBQueue m a))
-> (Natural -> STM m (TBQueue m a))
-> Natural
-> RWST r w s (STM m) (TBQueue m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Natural -> STM m (TBQueue m a)
forall a. Natural -> STM m (TBQueue m a)
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 = STM m a -> RWST r w s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> RWST r w s (STM m) a)
-> (TBQueue m a -> STM m a) -> TBQueue m a -> RWST r w s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m a
forall a. TBQueue m a -> STM m a
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 = STM m (Maybe a) -> RWST r w s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> RWST r w s (STM m) (Maybe a))
-> (TBQueue m a -> STM m (Maybe a))
-> TBQueue m a
-> RWST r w s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m (Maybe a)
forall a. TBQueue m a -> STM m (Maybe a)
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 = STM m a -> RWST r w s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> RWST r w s (STM m) a)
-> (TBQueue m a -> STM m a) -> TBQueue m a -> RWST r w s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m a
forall a. TBQueue m a -> STM m a
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 = STM m (Maybe a) -> RWST r w s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> RWST r w s (STM m) (Maybe a))
-> (TBQueue m a -> STM m (Maybe a))
-> TBQueue m a
-> RWST r w s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m (Maybe a)
forall a. TBQueue m a -> STM m (Maybe a)
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 = STM m [a] -> RWST r w s (STM m) [a]
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m [a] -> RWST r w s (STM m) [a])
-> (TBQueue m a -> STM m [a])
-> TBQueue m a
-> RWST r w s (STM m) [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m [a]
forall a. TBQueue m a -> STM m [a]
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 = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TBQueue m a -> a -> STM m ())
-> TBQueue m a
-> a
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TBQueue m a -> a -> STM m ()
forall a. TBQueue m a -> a -> STM m ()
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 = STM m Natural -> RWST r w s (STM m) Natural
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Natural -> RWST r w s (STM m) Natural)
-> (TBQueue m a -> STM m Natural)
-> TBQueue m a
-> RWST r w s (STM m) Natural
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m Natural
forall a. TBQueue m a -> STM m Natural
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 = STM m Bool -> RWST r w s (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> RWST r w s (STM m) Bool)
-> (TBQueue m a -> STM m Bool)
-> TBQueue m a
-> RWST r w s (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m Bool
forall a. TBQueue m a -> STM m Bool
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 = STM m Bool -> RWST r w s (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> RWST r w s (STM m) Bool)
-> (TBQueue m a -> STM m Bool)
-> TBQueue m a
-> RWST r w s (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TBQueue m a -> STM m Bool
forall a. TBQueue m a -> STM m Bool
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 = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TBQueue m a -> a -> STM m ())
-> TBQueue m a
-> a
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TBQueue m a -> a -> STM m ()
forall a. TBQueue m a -> a -> STM m ()
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 = STM m (TSem m) -> RWST r w s (STM m) (TSem m)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TSem m) -> RWST r w s (STM m) (TSem m))
-> (Integer -> STM m (TSem m))
-> Integer
-> RWST r w s (STM m) (TSem m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> STM m (TSem m)
forall (m :: * -> *). MonadSTM m => Integer -> STM m (TSem m)
newTSem
waitTSem :: TSem (RWST r w s m) -> STM (RWST r w s m) ()
waitTSem = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TSem m -> STM m ()) -> TSem m -> RWST r w s (STM m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TSem m -> STM m ()
forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
waitTSem
signalTSem :: TSem (RWST r w s m) -> STM (RWST r w s m) ()
signalTSem = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TSem m -> STM m ()) -> TSem m -> RWST r w s (STM m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TSem m -> STM m ()
forall (m :: * -> *). MonadSTM m => TSem m -> STM m ()
signalTSem
signalTSemN :: Natural -> TSem (RWST r w s m) -> STM (RWST r w s m) ()
signalTSemN = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (Natural -> TSem m -> STM m ())
-> Natural
-> TSem m
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Natural -> TSem m -> STM m ()
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 = STM m (TChan m a) -> RWST r w s (STM m) (TChan m a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m (TChan m a)
forall a. STM m (TChan m a)
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 = STM m (TChan m a) -> RWST r w s (STM m) (TChan m a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift STM m (TChan m a)
forall a. STM m (TChan m a)
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 = STM m (TChan m a) -> RWST r w s (STM m) (TChan m a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TChan m a) -> RWST r w s (STM m) (TChan m a))
-> (TChan m a -> STM m (TChan m a))
-> TChan m a
-> RWST r w s (STM m) (TChan m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (TChan m a)
forall a. TChan m a -> STM m (TChan m a)
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 = STM m (TChan m a) -> RWST r w s (STM m) (TChan m a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (TChan m a) -> RWST r w s (STM m) (TChan m a))
-> (TChan m a -> STM m (TChan m a))
-> TChan m a
-> RWST r w s (STM m) (TChan m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (TChan m a)
forall a. TChan m a -> STM m (TChan m a)
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 = STM m a -> RWST r w s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> RWST r w s (STM m) a)
-> (TChan m a -> STM m a) -> TChan m a -> RWST r w s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m a
forall a. TChan m a -> STM m a
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 = STM m (Maybe a) -> RWST r w s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> RWST r w s (STM m) (Maybe a))
-> (TChan m a -> STM m (Maybe a))
-> TChan m a
-> RWST r w s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (Maybe a)
forall a. TChan m a -> STM m (Maybe a)
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 = STM m a -> RWST r w s (STM m) a
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m a -> RWST r w s (STM m) a)
-> (TChan m a -> STM m a) -> TChan m a -> RWST r w s (STM m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m a
forall a. TChan m a -> STM m a
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 = STM m (Maybe a) -> RWST r w s (STM m) (Maybe a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m (Maybe a) -> RWST r w s (STM m) (Maybe a))
-> (TChan m a -> STM m (Maybe a))
-> TChan m a
-> RWST r w s (STM m) (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m (Maybe a)
forall a. TChan m a -> STM m (Maybe a)
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 = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TChan m a -> a -> STM m ())
-> TChan m a
-> a
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TChan m a -> a -> STM m ()
forall a. TChan m a -> a -> STM m ()
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 = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TChan m a -> a -> STM m ())
-> TChan m a
-> a
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: TChan m a -> a -> STM m ()
forall a. TChan m a -> a -> STM m ()
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 = STM m Bool -> RWST r w s (STM m) Bool
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m Bool -> RWST r w s (STM m) Bool)
-> (TChan m a -> STM m Bool)
-> TChan m a
-> RWST r w s (STM m) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TChan m a -> STM m Bool
forall a. TChan m a -> STM m Bool
forall (m :: * -> *) a. MonadSTM m => TChan m a -> STM m Bool
isEmptyTChan
instance (Monoid w, MonadInspectSTM m) => MonadInspectSTM (Strict.RWST r w s m) where
type InspectMonad (Strict.RWST r w s m) = InspectMonad m
inspectTVar :: forall (proxy :: (* -> *) -> *) a.
proxy (RWST r w s m)
-> TVar (RWST r w s m) a -> InspectMonad (RWST r w s m) a
inspectTVar proxy (RWST r w s m)
_ = Proxy m -> TVar m a -> InspectMonad m a
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadInspectSTM m =>
proxy m -> TVar m a -> InspectMonad m a
forall (proxy :: (* -> *) -> *) a.
proxy m -> TVar m a -> InspectMonad m a
inspectTVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
inspectTMVar :: forall (proxy :: (* -> *) -> *) a.
proxy (RWST r w s m)
-> TMVar (RWST r w s m) a -> InspectMonad (RWST r w s m) (Maybe a)
inspectTMVar proxy (RWST r w s m)
_ = Proxy m -> TMVar m a -> InspectMonad m (Maybe a)
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadInspectSTM m =>
proxy m -> TMVar m a -> InspectMonad m (Maybe a)
forall (proxy :: (* -> *) -> *) a.
proxy m -> TMVar m a -> InspectMonad m (Maybe a)
inspectTMVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
instance (Monoid w, MonadTraceSTM m) => MonadTraceSTM (Strict.RWST r w s m) where
traceTVar :: forall (proxy :: (* -> *) -> *) a.
proxy (RWST r w s m)
-> TVar (RWST r w s m) a
-> (Maybe a -> a -> InspectMonad (RWST r w s m) TraceValue)
-> STM (RWST r w s m) ()
traceTVar proxy (RWST r w s m)
_ = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue) -> STM m ())
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TVar m a
-> (Maybe a -> a -> InspectMonad m TraceValue)
-> STM m ()
traceTVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTMVar :: forall (proxy :: (* -> *) -> *) a.
proxy (RWST r w s m)
-> TMVar (RWST r w s m) a
-> (Maybe (Maybe a)
-> Maybe a -> InspectMonad (RWST r w s m) TraceValue)
-> STM (RWST r w s m) ()
traceTMVar proxy (RWST r w s m)
_ = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ())
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TMVar m a
-> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue)
-> STM m ()
traceTMVar (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTQueue :: forall (proxy :: (* -> *) -> *) a.
proxy (RWST r w s m)
-> TQueue (RWST r w s m) a
-> (Maybe [a] -> [a] -> InspectMonad (RWST r w s m) TraceValue)
-> STM (RWST r w s m) ()
traceTQueue proxy (RWST r w s m)
_ = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> STM m ())
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
traceTQueue (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTBQueue :: forall (proxy :: (* -> *) -> *) a.
proxy (RWST r w s m)
-> TBQueue (RWST r w s m) a
-> (Maybe [a] -> [a] -> InspectMonad (RWST r w s m) TraceValue)
-> STM (RWST r w s m) ()
traceTBQueue proxy (RWST r w s m)
_ = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> STM m ())
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *) a.
MonadTraceSTM m =>
proxy m
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *) a.
proxy m
-> TBQueue m a
-> (Maybe [a] -> [a] -> InspectMonad m TraceValue)
-> STM m ()
traceTBQueue (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
traceTSem :: forall (proxy :: (* -> *) -> *).
proxy (RWST r w s m)
-> TSem (RWST r w s m)
-> (Maybe Integer
-> Integer -> InspectMonad (RWST r w s m) TraceValue)
-> STM (RWST r w s m) ()
traceTSem proxy (RWST r w s m)
_ = STM m () -> RWST r w s (STM m) ()
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (STM m () -> RWST r w s (STM m) ())
-> (TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ())
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> RWST r w s (STM m) ()
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
.: Proxy m
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ()
forall (m :: * -> *) (proxy :: (* -> *) -> *).
MonadTraceSTM m =>
proxy m
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ()
forall (proxy :: (* -> *) -> *).
proxy m
-> TSem m
-> (Maybe Integer -> Integer -> InspectMonad m TraceValue)
-> STM m ()
traceTSem (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @m)
(.:) :: (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)