Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Data.LVar
Description
LVar
is like Control.Concurrent.STM.TMVar
but with a capability for
listening to its changes.
Types
Creating a LVar
new :: forall a m. MonadIO m => a -> m (LVar a) Source #
Create a new LVar
with the given initial value
empty :: MonadIO m => m (LVar a) Source #
Like new
, but there is no initial value. A get
will block until an
initial value is set using set
or modify
Modifying a LVar
set :: MonadIO m => LVar a -> a -> m () Source #
Set the LVar
value; active listeners are automatically notifed.
modify :: MonadIO m => LVar a -> (a -> a) -> m () Source #
Modify the LVar
value; active listeners are automatically notified.
Listening to a LVar
listenNext :: MonadIO m => LVar a -> m a Source #
Listen for the next value update (since the last listenNext
or
addListener
).