Safe Haskell | None |
---|---|
Language | Haskell2010 |
MonadSTM
testing implementation, internal types and
definitions.
- type M n r a = Cont (STMAction n r) a
- type Fixed n r = Ref n r (Cont (STMAction n r))
- data STMAction n r
- = forall a e . Exception e => SCatch (e -> M n r a) (M n r a) (a -> STMAction n r)
- | forall a . SRead (TVar r a) (a -> STMAction n r)
- | forall a . SWrite (TVar r a) a (STMAction n r)
- | forall a . SOrElse (M n r a) (M n r a) (a -> STMAction n r)
- | forall a . SNew String a (TVar r a -> STMAction n r)
- | SLift (n (STMAction n r))
- | forall e . Exception e => SThrow e
- | SRetry
- | SStop
- newtype TVar r a = TVar (TVarId, r a)
- data Result a
- doTransaction :: Monad n => Fixed n r -> M n r a -> IdSource -> n (Result a, n (), IdSource, TTrace)
- stepTrans :: Monad n => Fixed n r -> STMAction n r -> IdSource -> n (STMAction n r, n (), IdSource, [TVarId], [TVarId], TAction)
Documentation
type M n r a = Cont (STMAction n r) a Source
The underlying monad is based on continuations over primitive actions.
type Fixed n r = Ref n r (Cont (STMAction n r)) Source
Dict of methods for implementations to override.
Primitive actions
STM transactions are represented as a sequence of primitive actions.
forall a e . Exception e => SCatch (e -> M n r a) (M n r a) (a -> STMAction n r) | |
forall a . SRead (TVar r a) (a -> STMAction n r) | |
forall a . SWrite (TVar r a) a (STMAction n r) | |
forall a . SOrElse (M n r a) (M n r a) (a -> STMAction n r) | |
forall a . SNew String a (TVar r a -> STMAction n r) | |
SLift (n (STMAction n r)) | |
forall e . Exception e => SThrow e | |
SRetry | |
SStop |
TVar
s
Output
The result of an STM transaction, along with which TVar
s it
touched whilst executing.
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. |