IOSpec-0.2.1: A pure specification of the IO monad.Source codeContentsIndex
Test.IOSpec.STM
Contents
The specification of STM
Atomically
The STM monad
Synopsis
data STMS a
atomically :: STMS :<: f => STM a -> IOSpec f a
data STM a
data TVar a
newTVar :: Typeable a => a -> STM (TVar a)
readTVar :: Typeable a => TVar a -> STM a
writeTVar :: Typeable a => TVar a -> a -> STM ()
retry :: STM a
orElse :: STM a -> STM a -> STM a
check :: Bool -> STM ()
The specification of STM
data STMS a Source

An expression of type IOSpec STMS a corresponds to an IO computation that may use atomically and returns a value of type a.

By itself, STMS is not terribly useful. You will probably want to use IOSpec (ForkS :+: STMS).

show/hide Instances
Atomically
atomically :: STMS :<: f => STM a -> IOSpec f aSource
The atomically function atomically executes an STM action.
The STM monad
data STM a Source
show/hide Instances
data TVar a Source
A TVar is a shared, mutable variable used by STM.
newTVar :: Typeable a => a -> STM (TVar a)Source
The newTVar function creates a new transactional variable.
readTVar :: Typeable a => TVar a -> STM aSource
The readTVar function reads the value stored in a transactional variable.
writeTVar :: Typeable a => TVar a -> a -> STM ()Source
The writeTVar function overwrites the value stored in a transactional variable.
retry :: STM aSource
The retry function abandons a transaction and retries at some later time.
orElse :: STM a -> STM a -> STM aSource
The orElse function takes two STM actions stm1 and stm2 and performs stm1. If stm1 calls retry it performs stm2. If stm1 succeeds, on the other hand, stm2 is not executed.
check :: Bool -> STM ()Source
The check function checks if its boolean argument holds. If the boolean is true, it returns (); otherwise it calls retry.
Produced by Haddock version 2.4.2