| Copyright | (c) 2016 Michael Walker |
|---|---|
| License | MIT |
| Maintainer | Michael Walker <mike@barrucadu.co.uk> |
| Stability | experimental |
| Portability | ExistentialQuantification, RankNTypes |
| Safe Haskell | None |
| Language | Haskell2010 |
Test.DejaFu.STM.Internal
Description
MonadSTM testing implementation, internal types and
definitions. This module is NOT considered to form part of the
public interface of this library.
- 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
- = Exception e => SCatch (e -> M n r a) (M n r a) (a -> STMAction n r)
- | SRead (TVar r a) (a -> STMAction n r)
- | SWrite (TVar r a) a (STMAction n r)
- | SOrElse (M n r a) (M n r a) (a -> STMAction n r)
- | SNew String a (TVar r a -> STMAction n r)
- | SLift (n (STMAction n r))
- | 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.
Constructors
| Exception e => SCatch (e -> M n r a) (M n r a) (a -> STMAction n r) | |
| SRead (TVar r a) (a -> STMAction n r) | |
| SWrite (TVar r a) a (STMAction n r) | |
| SOrElse (M n r a) (M n r a) (a -> STMAction n r) | |
| SNew String a (TVar r a -> STMAction n r) | |
| SLift (n (STMAction n r)) | |
| Exception e => SThrow e | |
| SRetry | |
| SStop |
TVars
Output
The result of an STM transaction, along with which TVars it
touched whilst executing.
Constructors
| 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. |