Documentation
data MVar a
An MVar
(pronounced "em-var") is a synchronising variable, used
for communication between concurrent threads. It can be thought of
as a a box, which may be empty or full.
data STM a
A monad supporting atomic memory transactions.
Monad STM | |
Functor STM | |
Typeable1 STM | |
MonadPlus STM | |
HasMRef STM | |
HasRef STM | |
PutMRef (TVar (Maybe a)) STM a | |
PutMRef (TMVar a) STM a | |
TakeMRef (TVar (Maybe a)) STM a | |
TakeMRef (TMVar a) STM a | |
NewMRef (TVar (Maybe a)) STM a | |
NewMRef (TMVar a) STM a | |
NewRef (TVar a) STM a | |
ModifyRef (TVar a) STM a | |
MonadIO m => ReadRef (STM a) m a | |
ReadRef (STM a) STM a | |
ReadRef (TVar a) STM a | |
WriteRef (TVar a) STM a | |
NewRef (TMVar a) STM (Maybe a) | |
ReadRef (TMVar a) STM (Maybe a) | |
PutMRef (MRef STM a) IO a | |
TakeMRef (MRef STM a) IO a | |
NewMRef (MRef STM a) IO a | |
MonadIO m => NewRef (Ref STM a) m a | |
MonadIO m => ModifyRef (Ref STM a) m a | |
MonadIO m => ReadRef (Ref STM a) m a | |
MonadIO m => WriteRef (Ref STM a) m a |
data TMVar a
A TMVar
is a synchronising variable, used
for communication between concurrent threads. It can be thought of
as a box, which may be empty or full.
Typeable1 TMVar | |
Eq (TMVar a) | |
PutMRef (TMVar a) IO a | |
PutMRef (TMVar a) STM a | |
TakeMRef (TMVar a) IO a | |
TakeMRef (TMVar a) STM a | |
NewMRef (TMVar a) IO a | |
NewMRef (TMVar a) STM a | |
MonadIO m => NewRef (TMVar a) m (Maybe a) | |
NewRef (TMVar a) STM (Maybe a) | |
MonadIO m => ReadRef (TMVar a) m (Maybe a) | |
ReadRef (TMVar a) STM (Maybe a) |
data TVar a
Shared memory locations that support atomic memory transactions.
Typeable1 TVar | |
Eq (TVar a) | |
PutMRef (TVar (Maybe a)) IO a | |
PutMRef (TVar (Maybe a)) STM a | |
TakeMRef (TVar (Maybe a)) IO a | |
TakeMRef (TVar (Maybe a)) STM a | |
NewMRef (TVar (Maybe a)) IO a | |
NewMRef (TVar (Maybe a)) STM a | |
MonadIO m => NewRef (TVar a) m a | |
NewRef (TVar a) STM a | |
MonadIO m => ModifyRef (TVar a) m a | |
ModifyRef (TVar a) STM a | |
MonadIO m => ReadRef (TVar a) m a | |
ReadRef (TVar a) STM a | |
MonadIO m => WriteRef (TVar a) m a | |
WriteRef (TVar a) STM a |
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.