ST +Control.Monad +stm

module Control.Monad.STM
stm Control.Monad.STM
Software Transactional Memory: a modular composable concurrency abstraction. See * Composable memory transactions, by Tim Harris, Simon Marlow, Simon Peyton Jones, and Maurice Herlihy, in /ACM Conference on Principles and Practice of Parallel Programming/ 2005. http://research.microsoft.com/Users/simonpj/papers/stm/index.htm This module only defines the STM monad; you probably want to import Control.Concurrent.STM (which exports Control.Monad.STM).
data STM a :: * -> *
stm Control.Monad.STM
A monad supporting atomic memory transactions.
catchSTM :: Exception e => STM a -> (e -> STM a) -> STM a
stm Control.Monad.STM
Exception handling within STM actions.
throwSTM :: Exception e => e -> STM a
stm Control.Monad.STM
A variant of throw that can only be used within the STM monad. Throwing an exception in STM aborts the transaction and propagates the exception. Although throwSTM has a type that is an instance of the type of throw, the two functions are subtly different: > throw e `seq` x ===> throw e > throwSTM e `seq` x ===> x The first example will cause the exception e to be raised, whereas the second one won't. In fact, throwSTM will only cause an exception to be raised when it is used within the STM monad. The throwSTM variant should be used in preference to throw to raise an exception within the STM monad because it guarantees ordering with respect to other STM operations, whereas throw does not.