| Stability | experimental |
|---|---|
| Maintainer | Bas van Dijk <v.dijk.bas@gmail.com> |
| Safe Haskell | Trustworthy |
Control.Concurrent.SampleVar.Lifted
Description
This is a wrapped version of Control.Concurrent.SampleVar with types
generalised from IO to all monads in MonadBase.
- data SampleVar a
- newEmptySampleVar :: MonadBase IO m => m (SampleVar a)
- newSampleVar :: MonadBase IO m => a -> m (SampleVar a)
- emptySampleVar :: MonadBase IO m => SampleVar a -> m ()
- readSampleVar :: MonadBase IO m => SampleVar a -> m a
- writeSampleVar :: MonadBase IO m => SampleVar a -> a -> m ()
- isEmptySampleVar :: MonadBase IO m => SampleVar a -> m Bool
Documentation
data SampleVar a
Sample variables are slightly different from a normal MVar:
- Reading an empty
SampleVarcauses the reader to block. (same astakeMVaron emptyMVar) - Reading a filled
SampleVarempties it and returns value. (same astakeMVar) - Writing to an empty
SampleVarfills it with a value, and potentially, wakes up a blocked reader (same as forputMVaron emptyMVar). - Writing to a filled
SampleVaroverwrites the current value. (different fromputMVaron fullMVar.)
newEmptySampleVar :: MonadBase IO m => m (SampleVar a)Source
Generalized version of newEmptySampleVar.
newSampleVar :: MonadBase IO m => a -> m (SampleVar a)Source
Generalized version of newSampleVar.
emptySampleVar :: MonadBase IO m => SampleVar a -> m ()Source
Generalized version of emptySampleVar.
readSampleVar :: MonadBase IO m => SampleVar a -> m aSource
Generalized version of readSampleVar.
writeSampleVar :: MonadBase IO m => SampleVar a -> a -> m ()Source
Generalized version of writeSampleVar.
isEmptySampleVar :: MonadBase IO m => SampleVar a -> m BoolSource
Generalized version of isEmptySampleVar.