Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data TVar a where
- zoomTVar :: ALens' a b -> TVar a -> TVar b
- newTVar :: a -> STM (TVar a)
- newTVarIO :: a -> IO (TVar a)
- pairTVars :: TVar a -> TVar b -> TVar (a, b)
- readTVar :: TVar a -> STM a
- readTVarIO :: TVar a -> IO a
- modifyTVar :: TVar a -> (a -> a) -> STM ()
- modifyTVar' :: TVar a -> (a -> a) -> STM ()
- writeTVar :: TVar a -> a -> STM ()
- swapTVar :: TVar a -> a -> STM a
- data STM a :: * -> *
- atomically :: STM a -> IO a
Documentation
readTVarIO :: TVar a -> IO a Source
modifyTVar :: TVar a -> (a -> a) -> STM () Source
modifyTVar' :: TVar a -> (a -> a) -> STM () Source
data STM a :: * -> *
A monad supporting atomic memory transactions.
atomically :: STM a -> IO a
Perform a series of STM actions atomically.
You cannot use atomically
inside an unsafePerformIO
or unsafeInterleaveIO
.
Any attempt to do so will result in a runtime error. (Reason: allowing
this would effectively allow a transaction inside a transaction, depending
on exactly when the thunk is evaluated.)
However, see newTVarIO
, which can be called inside unsafePerformIO
,
and which allows top-level TVars to be allocated.