lifted-base-0.2.3.0: lifted IO operations from the base library

Stabilityexperimental
MaintainerBas van Dijk <v.dijk.bas@gmail.com>
Safe HaskellTrustworthy

Control.Concurrent.SampleVar.Lifted

Description

This is a wrapped version of Control.Concurrent.SampleVar with types generalised from IO to all monads in MonadBase.

Synopsis

Documentation

data SampleVar a

Sample variables are slightly different from a normal MVar:

  • Reading an empty SampleVar causes the reader to block. (same as takeMVar on empty MVar)
  • Reading a filled SampleVar empties it and returns value. (same as takeMVar)
  • Writing to an empty SampleVar fills it with a value, and potentially, wakes up a blocked reader (same as for putMVar on empty MVar).
  • Writing to a filled SampleVar overwrites the current value. (different from putMVar on full MVar.)

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.