Copyright | (c) 2016 Michael Walker |
---|---|
License | MIT |
Maintainer | Michael Walker <mike@barrucadu.co.uk> |
Stability | experimental |
Portability | CPP, ExistentialQuantification, MultiParamTypeClasses, RankNTypes |
Safe Haskell | Safe |
Language | Haskell2010 |
MonadSTM
testing implementation, internal types and
definitions. This module is NOT considered to form part of the
public interface of this library.
- newtype M n r a = M {}
- cont :: ((a -> STMAction n r) -> STMAction n r) -> M n r a
- runCont :: M n r a -> (a -> STMAction n r) -> STMAction n r
- data STMAction n r
- newtype TVar r a = TVar (TVarId, r a)
- data Result a
- isSTMSuccess :: Result a -> Bool
- doTransaction :: MonadRef r n => M n r a -> IdSource -> n (Result a, n (), IdSource, TTrace)
- stepTrans :: MonadRef r n => STMAction n r -> IdSource -> n (STMAction n r, n (), IdSource, [TVarId], [TVarId], TAction)
Documentation
The underlying monad is based on continuations over primitive actions.
This is not Cont
because we want to give it a custom MonadFail
instance.
cont :: ((a -> STMAction n r) -> STMAction n r) -> M n r a Source #
Construct a continuation-passing operation from a function.
runCont :: M n r a -> (a -> STMAction n r) -> STMAction n r Source #
Run a CPS computation with the given final computation.
Primitive actions
STM transactions are represented as a sequence of primitive actions.
TVar
s
Output
The result of an STM transaction, along with which TVar
s it
touched whilst executing.
Since: 0.1.0.0
Success [TVarId] [TVarId] a | The transaction completed successfully, reading the first list
|
Retry [TVarId] | The transaction aborted by calling |
Exception SomeException | The transaction aborted by throwing an exception. |