dejafu-2.4.0.6: A library for unit-testing concurrent programs.
Copyright(c) 2016--2019 Michael Walker
LicenseMIT
MaintainerMichael Walker <mike@barrucadu.co.uk>
Stabilityexperimental
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.DejaFu.Conc

Description

Deterministic traced execution of concurrent computations.

This works by executing the computation on a single thread, calling out to the supplied scheduler after each step to determine which thread runs next.

Synopsis

Expressing concurrent programs

data Program pty n a Source #

A representation of a concurrent program for testing.

To construct these, use the MonadConc instance, or see withSetup, withTeardown, and withSetupAndTeardown.

Since: 2.0.0.0

Instances

Instances details
pty ~ Basic => MonadTrans (Program pty) Source # 
Instance details

Defined in Test.DejaFu.Conc.Internal.Program

Methods

lift :: Monad m => m a -> Program pty m a #

pty ~ Basic => MonadFail (Program pty n) Source # 
Instance details

Defined in Test.DejaFu.Conc.Internal.Common

Methods

fail :: String -> Program pty n a #

(pty ~ Basic, MonadIO n) => MonadIO (Program pty n) Source # 
Instance details

Defined in Test.DejaFu.Conc.Internal.Program

Methods

liftIO :: IO a -> Program pty n a #

pty ~ Basic => Applicative (Program pty n) Source # 
Instance details

Defined in Test.DejaFu.Conc.Internal.Common

Methods

pure :: a -> Program pty n a #

(<*>) :: Program pty n (a -> b) -> Program pty n a -> Program pty n b #

liftA2 :: (a -> b -> c) -> Program pty n a -> Program pty n b -> Program pty n c #

(*>) :: Program pty n a -> Program pty n b -> Program pty n b #

(<*) :: Program pty n a -> Program pty n b -> Program pty n a #

pty ~ Basic => Functor (Program pty n) Source # 
Instance details

Defined in Test.DejaFu.Conc.Internal.Common

Methods

fmap :: (a -> b) -> Program pty n a -> Program pty n b #

(<$) :: a -> Program pty n b -> Program pty n a #

pty ~ Basic => Monad (Program pty n) Source # 
Instance details

Defined in Test.DejaFu.Conc.Internal.Common

Methods

(>>=) :: Program pty n a -> (a -> Program pty n b) -> Program pty n b #

(>>) :: Program pty n a -> Program pty n b -> Program pty n b #

return :: a -> Program pty n a #

(pty ~ Basic, Monad n) => MonadConc (Program pty n) Source # 
Instance details

Defined in Test.DejaFu.Conc.Internal.Program

Associated Types

type STM (Program pty n) :: Type -> Type #

type MVar (Program pty n) :: Type -> Type #

type IORef (Program pty n) :: Type -> Type #

type Ticket (Program pty n) :: Type -> Type #

type ThreadId (Program pty n) #

Methods

forkWithUnmask :: ((forall a. Program pty n a -> Program pty n a) -> Program pty n ()) -> Program pty n (ThreadId (Program pty n)) #

forkWithUnmaskN :: String -> ((forall a. Program pty n a -> Program pty n a) -> Program pty n ()) -> Program pty n (ThreadId (Program pty n)) #

forkOnWithUnmask :: Int -> ((forall a. Program pty n a -> Program pty n a) -> Program pty n ()) -> Program pty n (ThreadId (Program pty n)) #

forkOnWithUnmaskN :: String -> Int -> ((forall a. Program pty n a -> Program pty n a) -> Program pty n ()) -> Program pty n (ThreadId (Program pty n)) #

forkOSWithUnmask :: ((forall a. Program pty n a -> Program pty n a) -> Program pty n ()) -> Program pty n (ThreadId (Program pty n)) #

forkOSWithUnmaskN :: String -> ((forall a. Program pty n a -> Program pty n a) -> Program pty n ()) -> Program pty n (ThreadId (Program pty n)) #

supportsBoundThreads :: Program pty n Bool #

isCurrentThreadBound :: Program pty n Bool #

getNumCapabilities :: Program pty n Int #

setNumCapabilities :: Int -> Program pty n () #

myThreadId :: Program pty n (ThreadId (Program pty n)) #

yield :: Program pty n () #

threadDelay :: Int -> Program pty n () #

newEmptyMVar :: Program pty n (MVar (Program pty n) a) #

newEmptyMVarN :: String -> Program pty n (MVar (Program pty n) a) #

putMVar :: MVar (Program pty n) a -> a -> Program pty n () #

tryPutMVar :: MVar (Program pty n) a -> a -> Program pty n Bool #

readMVar :: MVar (Program pty n) a -> Program pty n a #

tryReadMVar :: MVar (Program pty n) a -> Program pty n (Maybe a) #

takeMVar :: MVar (Program pty n) a -> Program pty n a #

tryTakeMVar :: MVar (Program pty n) a -> Program pty n (Maybe a) #

newIORef :: a -> Program pty n (IORef (Program pty n) a) #

newIORefN :: String -> a -> Program pty n (IORef (Program pty n) a) #

readIORef :: IORef (Program pty n) a -> Program pty n a #

atomicModifyIORef :: IORef (Program pty n) a -> (a -> (a, b)) -> Program pty n b #

writeIORef :: IORef (Program pty n) a -> a -> Program pty n () #

atomicWriteIORef :: IORef (Program pty n) a -> a -> Program pty n () #

readForCAS :: IORef (Program pty n) a -> Program pty n (Ticket (Program pty n) a) #

peekTicket' :: Proxy (Program pty n) -> Ticket (Program pty n) a -> a #

casIORef :: IORef (Program pty n) a -> Ticket (Program pty n) a -> a -> Program pty n (Bool, Ticket (Program pty n) a) #

modifyIORefCAS :: IORef (Program pty n) a -> (a -> (a, b)) -> Program pty n b #

modifyIORefCAS_ :: IORef (Program pty n) a -> (a -> a) -> Program pty n () #

atomically :: STM (Program pty n) a -> Program pty n a #

newTVarConc :: a -> Program pty n (TVar (STM (Program pty n)) a) #

readTVarConc :: TVar (STM (Program pty n)) a -> Program pty n a #

throwTo :: Exception e => ThreadId (Program pty n) -> e -> Program pty n () #

getMaskingState :: Program pty n MaskingState #

unsafeUnmask :: Program pty n a -> Program pty n a #

pty ~ Basic => MonadCatch (Program pty n) Source # 
Instance details

Defined in Test.DejaFu.Conc.Internal.Program

Methods

catch :: Exception e => Program pty n a -> (e -> Program pty n a) -> Program pty n a #

pty ~ Basic => MonadMask (Program pty n) Source # 
Instance details

Defined in Test.DejaFu.Conc.Internal.Program

Methods

mask :: ((forall a. Program pty n a -> Program pty n a) -> Program pty n b) -> Program pty n b #

uninterruptibleMask :: ((forall a. Program pty n a -> Program pty n a) -> Program pty n b) -> Program pty n b #

generalBracket :: Program pty n a -> (a -> ExitCase b -> Program pty n c) -> (a -> Program pty n b) -> Program pty n (b, c) #

pty ~ Basic => MonadThrow (Program pty n) Source # 
Instance details

Defined in Test.DejaFu.Conc.Internal.Program

Methods

throwM :: Exception e => e -> Program pty n a #

type IORef (Program pty n) Source # 
Instance details

Defined in Test.DejaFu.Conc.Internal.Program

type IORef (Program pty n) = ModelIORef n
type MVar (Program pty n) Source # 
Instance details

Defined in Test.DejaFu.Conc.Internal.Program

type MVar (Program pty n) = ModelMVar n
type STM (Program pty n) Source # 
Instance details

Defined in Test.DejaFu.Conc.Internal.Program

type STM (Program pty n) = ModelSTM n
type ThreadId (Program pty n) Source # 
Instance details

Defined in Test.DejaFu.Conc.Internal.Program

type ThreadId (Program pty n) = ThreadId
type Ticket (Program pty n) Source # 
Instance details

Defined in Test.DejaFu.Conc.Internal.Program

type Ticket (Program pty n) = ModelTicket

data Basic Source #

A type used to constrain Program: a Program Basic is a "basic" program with no set-up or teardown.

Construct with the MonadConc instance.

Since: 2.0.0.0

type ConcT = Program Basic Source #

Since: 1.4.0.0

type ConcIO = ConcT IO Source #

A MonadConc implementation using IO.

Since: 0.4.0.0

Setup and teardown

data WithSetup x Source #

A type used to constrain Program: a Program (WithSetup x) is a program with some set-up action producing a value of type x.

Construct with withSetup.

Since: 2.0.0.0

data WithSetupAndTeardown x y Source #

A type used to constrain Program: a Program (WithSetupAndTeardown x y) is a program producing a value of type y with some set-up action producing a value of type x and a teardown action producing the final result.

Construct with withTeardown or withSetupAndTeardown.

Since: 2.0.0.0

withSetup Source #

Arguments

:: Program Basic n x

Setup action

-> (x -> Program Basic n a)

Main program

-> Program (WithSetup x) n a 

A concurrent program with some set-up action.

In terms of results, this is the same as setup >>= program. However, the setup action will be snapshotted (see recordSnapshot and runSnapshot) by the testing functions. This means that even if dejafu runs this program many many times, the setup action will only be run the first time, and its effects remembered for subsequent executions.

Since: 2.0.0.0

withTeardown Source #

Arguments

:: (x -> Either Condition y -> Program Basic n a)

Teardown action

-> Program (WithSetup x) n y

Main program

-> Program (WithSetupAndTeardown x y) n a 

A concurrent program with some set-up and teardown actions.

This is similar to

do
  x <- setup
  y <- program x
  teardown x y

But with two differences:

  • The setup action can be snapshotted, as described for withSetup
  • The teardown action will be executed even if the main action fails to produce a value.

Since: 2.0.0.0

withSetupAndTeardown Source #

Arguments

:: Program Basic n x

Setup action

-> (x -> Either Condition y -> Program Basic n a)

Teardown action

-> (x -> Program Basic n y)

Main program

-> Program (WithSetupAndTeardown x y) n a 

A combination of withSetup and withTeardown for convenience.

withSetupAndTeardown setup teardown =
  withTeardown teardown . withSetup setup

Since: 2.0.0.0

Invariants

data Invariant n a Source #

Invariants are atomic actions which can inspect the shared state of your computation, and terminate it on failure. Invariants have no visible effects, and are checked after each scheduling point.

To be checked, an invariant must be created during the setup phase of your Program, using registerInvariant. The invariant will then be checked in the main phase (but not in the setup or teardown phase). As a consequence of this, any shared state you want your invariant to check must also be created in the setup phase, and passed into the main phase as a parameter.

Since: 2.0.0.0

Instances

Instances details
MonadFail (Invariant n) Source # 
Instance details

Defined in Test.DejaFu.Conc.Internal.Common

Methods

fail :: String -> Invariant n a #

Applicative (Invariant n) Source # 
Instance details

Defined in Test.DejaFu.Conc.Internal.Common

Methods

pure :: a -> Invariant n a #

(<*>) :: Invariant n (a -> b) -> Invariant n a -> Invariant n b #

liftA2 :: (a -> b -> c) -> Invariant n a -> Invariant n b -> Invariant n c #

(*>) :: Invariant n a -> Invariant n b -> Invariant n b #

(<*) :: Invariant n a -> Invariant n b -> Invariant n a #

Functor (Invariant n) Source # 
Instance details

Defined in Test.DejaFu.Conc.Internal.Common

Methods

fmap :: (a -> b) -> Invariant n a -> Invariant n b #

(<$) :: a -> Invariant n b -> Invariant n a #

Monad (Invariant n) Source # 
Instance details

Defined in Test.DejaFu.Conc.Internal.Common

Methods

(>>=) :: Invariant n a -> (a -> Invariant n b) -> Invariant n b #

(>>) :: Invariant n a -> Invariant n b -> Invariant n b #

return :: a -> Invariant n a #

MonadCatch (Invariant n) Source # 
Instance details

Defined in Test.DejaFu.Conc.Internal.Common

Methods

catch :: Exception e => Invariant n a -> (e -> Invariant n a) -> Invariant n a #

MonadThrow (Invariant n) Source # 
Instance details

Defined in Test.DejaFu.Conc.Internal.Common

Methods

throwM :: Exception e => e -> Invariant n a #

registerInvariant :: Invariant n a -> Program Basic n () Source #

Call this in the setup phase to register new invariant which will be checked after every scheduling point in the main phase. Invariants are atomic actions which can inspect the shared state of your computation.

If the invariant throws an exception, the execution will be aborted with n InvariantFailure. Any teardown action will still be run.

Since: 2.0.0.0

inspectIORef :: ModelIORef n a -> Invariant n a Source #

Read the content of an IORef.

This returns the globally visible value, which may not be the same as the value visible to any particular thread when using a memory model other than SequentialConsistency.

Since: 2.0.0.0

inspectMVar :: ModelMVar n a -> Invariant n (Maybe a) Source #

Read the content of an MVar.

This is essentially tryReadMVar.

Since: 2.0.0.0

inspectTVar :: ModelTVar n a -> Invariant n a Source #

Read the content of a TVar.

This is essentially readTVar.

Since: 2.0.0.0

Executing concurrent programs

data Snapshot pty n a Source #

A record of the state of a concurrent program immediately after completing the setup action.

Since: 2.0.0.0

data MemType Source #

The memory model to use for non-synchronised IORef operations.

Since: 0.4.0.0

Constructors

SequentialConsistency

The most intuitive model: a program behaves as a simple interleaving of the actions in different threads. When a IORef is written to, that write is immediately visible to all threads.

TotalStoreOrder

Each thread has a write buffer. A thread sees its writes immediately, but other threads will only see writes when they are committed, which may happen later. Writes are committed in the same order that they are created.

PartialStoreOrder

Each IORef has a write buffer. A thread sees its writes immediately, but other threads will only see writes when they are committed, which may happen later. Writes to different IORefs are not necessarily committed in the same order that they are created.

Instances

Instances details
Bounded MemType Source # 
Instance details

Defined in Test.DejaFu.Types

Enum MemType Source # 
Instance details

Defined in Test.DejaFu.Types

Generic MemType Source # 
Instance details

Defined in Test.DejaFu.Types

Associated Types

type Rep MemType :: Type -> Type #

Methods

from :: MemType -> Rep MemType x #

to :: Rep MemType x -> MemType #

Read MemType Source # 
Instance details

Defined in Test.DejaFu.Types

Show MemType Source # 
Instance details

Defined in Test.DejaFu.Types

NFData MemType Source #

Since: 0.5.1.0

Instance details

Defined in Test.DejaFu.Types

Methods

rnf :: MemType -> () #

Eq MemType Source # 
Instance details

Defined in Test.DejaFu.Types

Methods

(==) :: MemType -> MemType -> Bool #

(/=) :: MemType -> MemType -> Bool #

Ord MemType Source # 
Instance details

Defined in Test.DejaFu.Types

type Rep MemType Source #

Since: 1.3.1.0

Instance details

Defined in Test.DejaFu.Types

type Rep MemType = D1 ('MetaData "MemType" "Test.DejaFu.Types" "dejafu-2.4.0.6-2Exh5SnWzcKIwmIryqnn01" 'False) (C1 ('MetaCons "SequentialConsistency" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "TotalStoreOrder" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PartialStoreOrder" 'PrefixI 'False) (U1 :: Type -> Type)))

runConcurrent :: MonadDejaFu n => Scheduler s -> MemType -> s -> Program pty n a -> n (Either Condition a, s, Trace) Source #

Run a concurrent computation with a given Scheduler and initial state, returning either the final result or the condition which prevented that. Also returned is the final state of the scheduler, and an execution trace.

If the RTS supports bound threads (ghc -threaded when linking) then the main thread of the concurrent computation will be bound, and forkOS / forkOSN will work during execution. If not, then the main thread will not be found, and attempting to fork a bound thread will raise an error.

Warning: Blocking on the action of another thread in liftIO cannot be detected! So if you perform some potentially blocking action in a liftIO the entire collection of threads may deadlock! You should therefore keep IO blocks small, and only perform blocking operations with the supplied primitives, insofar as possible.

Note: In order to prevent computation from hanging, the runtime will assume that a deadlock situation has arisen if the scheduler attempts to (a) schedule a blocked thread, or (b) schedule a nonexistent thread. In either of those cases, the computation will be halted.

Since: 2.1.0.0

recordSnapshot :: MonadDejaFu n => Program pty n a -> n (Maybe (Either Condition (Snapshot pty n a), Trace)) Source #

Runs any setup action and returns a Snapshot which can be passed to runSnapshot. If there is no setup action (this is a Program Basic, then Nothing is returned. The snapshot captures the state at the end of the setup, so the full program can be run multiple times without repeating the setup.

The setup action is executed atomically with a deterministic scheduler under sequential consistency. Any forked threads continue to exist in the main program.

If the setup action does not successfully produce a value (deadlock, uncaught exception, etc), no snapshot is produced.

Snapshotting IO: A snapshot captures entire state of your concurrent program: the state of every thread, the number of capabilities, the values of any IORefs, MVars, and TVars, and records any IO that you performed.

When restoring a snapshot this IO is replayed, in order. But the whole snapshotted computation is not. So the effects of the IO take place again, but any return values are ignored. For example, this program will not do what you want:

bad_snapshot = withSetup
  (do r <- liftIO (newIORef 0)
      liftIO (modifyIORef r (+1))
      pure r)
  (liftIO . readIORef)

When the snapshot is taken, the value in the IORef will be 1. When the snapshot is restored for the first time, those IO actions will be run again, /but their return values will be discarded/. The value in the IORef will be 2. When the snapshot is restored for the second time, the value in the IORef will be 3. And so on.

To safely use IO in a snapshotted computation, __the combined effect must be idempotent__. You should either use actions which set the state to the final value directly, rather than modifying it (eg, using a combination of liftIO . readIORef and liftIO . writeIORef here), or reset the state to a known value. Both of these approaches will work:

good_snapshot1 = withSetup
  (do let modify r f = liftIO (readIORef r) >>= liftIO . writeIORef r . f
       r <- liftIO (newIORef 0)
       modify r (+1)
       pure r)
  (liftIO . readIORef)

good_snapshot2 = withSetup
  (do r <- liftIO (newIORef 0)
      liftIO (writeIORef r 0)
      liftIO (modifyIORef r (+1))
      pure r)
  (liftIO . readIORef)

Since: 2.1.0.0

runSnapshot :: MonadDejaFu n => Scheduler s -> MemType -> s -> Snapshot pty n a -> n (Either Condition a, s, Trace) Source #

Runs a program with snapshotted setup to completion.

Since: 2.1.0.0

Scheduling

Results

data Condition Source #

An indication of how a concurrent computation terminated, if it didn't produce a value.

The Eq, Ord, and NFData instances compare/evaluate the exception with show in the UncaughtException and InvariantFailure cases.

Since: 2.0.0.0

Constructors

Abort

The scheduler chose to abort execution. This will be produced if, for example, all possible decisions exceed the specified bounds (there have been too many pre-emptions, the computation has executed for too long, or there have been too many yields).

Deadlock

Every thread is blocked

UncaughtException SomeException

An uncaught exception bubbled to the top of the computation.

InvariantFailure SomeException

An uncaught exception caused an invariant to fail.

Instances

Instances details
Generic Condition Source # 
Instance details

Defined in Test.DejaFu.Types

Associated Types

type Rep Condition :: Type -> Type #

Show Condition Source # 
Instance details

Defined in Test.DejaFu.Types

NFData Condition Source # 
Instance details

Defined in Test.DejaFu.Types

Methods

rnf :: Condition -> () #

Eq Condition Source # 
Instance details

Defined in Test.DejaFu.Types

Ord Condition Source # 
Instance details

Defined in Test.DejaFu.Types

type Rep Condition Source # 
Instance details

Defined in Test.DejaFu.Types

type Rep Condition = D1 ('MetaData "Condition" "Test.DejaFu.Types" "dejafu-2.4.0.6-2Exh5SnWzcKIwmIryqnn01" 'False) ((C1 ('MetaCons "Abort" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Deadlock" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "UncaughtException" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SomeException)) :+: C1 ('MetaCons "InvariantFailure" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SomeException))))

type Trace = [(Decision, [(ThreadId, Lookahead)], ThreadAction)] Source #

One of the outputs of the runner is a Trace, which is a log of decisions made, all the alternative unblocked threads and what they would do, and the action a thread took in its step.

Since: 0.8.0.0

data Decision Source #

Scheduling decisions are based on the state of the running program, and so we can capture some of that state in recording what specific decision we made.

Since: 0.5.0.0

Constructors

Start ThreadId

Start a new thread, because the last was blocked (or it's the start of computation).

Continue

Continue running the last thread for another step.

SwitchTo ThreadId

Pre-empt the running thread, and switch to another.

Instances

Instances details
Generic Decision Source # 
Instance details

Defined in Test.DejaFu.Types

Associated Types

type Rep Decision :: Type -> Type #

Methods

from :: Decision -> Rep Decision x #

to :: Rep Decision x -> Decision #

Show Decision Source # 
Instance details

Defined in Test.DejaFu.Types

NFData Decision Source #

Since: 0.5.1.0

Instance details

Defined in Test.DejaFu.Types

Methods

rnf :: Decision -> () #

Eq Decision Source # 
Instance details

Defined in Test.DejaFu.Types

type Rep Decision Source #

Since: 1.3.1.0

Instance details

Defined in Test.DejaFu.Types

type Rep Decision = D1 ('MetaData "Decision" "Test.DejaFu.Types" "dejafu-2.4.0.6-2Exh5SnWzcKIwmIryqnn01" 'False) (C1 ('MetaCons "Start" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ThreadId)) :+: (C1 ('MetaCons "Continue" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SwitchTo" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ThreadId))))

newtype ThreadId Source #

Every thread has a unique identitifer.

Since: 1.0.0.0

Constructors

ThreadId Id 

Instances

Instances details
Generic ThreadId Source # 
Instance details

Defined in Test.DejaFu.Types

Associated Types

type Rep ThreadId :: Type -> Type #

Methods

from :: ThreadId -> Rep ThreadId x #

to :: Rep ThreadId x -> ThreadId #

Show ThreadId Source # 
Instance details

Defined in Test.DejaFu.Types

NFData ThreadId Source # 
Instance details

Defined in Test.DejaFu.Types

Methods

rnf :: ThreadId -> () #

Eq ThreadId Source # 
Instance details

Defined in Test.DejaFu.Types

Ord ThreadId Source # 
Instance details

Defined in Test.DejaFu.Types

type Rep ThreadId Source #

Since: 1.3.1.0

Instance details

Defined in Test.DejaFu.Types

type Rep ThreadId = D1 ('MetaData "ThreadId" "Test.DejaFu.Types" "dejafu-2.4.0.6-2Exh5SnWzcKIwmIryqnn01" 'True) (C1 ('MetaCons "ThreadId" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Id)))

data ThreadAction Source #

All the actions that a thread can perform.

Since: 2.2.0.0

Constructors

Fork ThreadId

Start a new thread.

ForkOS ThreadId

Start a new bound thread.

SupportsBoundThreads Bool

Check if bound threads are supported.

IsCurrentThreadBound Bool

Check if the current thread is bound.

MyThreadId

Get the ThreadId of the current thread.

GetNumCapabilities Int

Get the number of Haskell threads that can run simultaneously.

SetNumCapabilities Int

Set the number of Haskell threads that can run simultaneously.

Yield

Yield the current thread.

ThreadDelay Int

Yield/delay the current thread.

NewMVar MVarId

Create a new MVar.

PutMVar MVarId [ThreadId]

Put into a MVar, possibly waking up some threads.

BlockedPutMVar MVarId

Get blocked on a put.

TryPutMVar MVarId Bool [ThreadId]

Try to put into a MVar, possibly waking up some threads.

ReadMVar MVarId

Read from a MVar.

TryReadMVar MVarId Bool

Try to read from a MVar.

BlockedReadMVar MVarId

Get blocked on a read.

TakeMVar MVarId [ThreadId]

Take from a MVar, possibly waking up some threads.

BlockedTakeMVar MVarId

Get blocked on a take.

TryTakeMVar MVarId Bool [ThreadId]

Try to take from a MVar, possibly waking up some threads.

NewIORef IORefId

Create a new IORef.

ReadIORef IORefId

Read from a IORef.

ReadIORefCas IORefId

Read from a IORef for a future compare-and-swap.

ModIORef IORefId

Modify a IORef.

ModIORefCas IORefId

Modify a IORef using a compare-and-swap.

WriteIORef IORefId

Write to a IORef without synchronising.

CasIORef IORefId Bool

Attempt to to a IORef using a compare-and-swap, synchronising it.

CommitIORef ThreadId IORefId

Commit the last write to the given IORef by the given thread, so that all threads can see the updated value.

STM [TAction] [ThreadId]

An STM transaction was executed, possibly waking up some threads.

ThrownSTM [TAction] (Maybe MaskingState)

An STM transaction threw an exception. Give the resultant masking state after jumping to the exception handler (if the thread is still alive).

BlockedSTM [TAction]

Got blocked in an STM transaction.

Catching

Register a new exception handler

PopCatching

Pop the innermost exception handler from the stack.

Throw (Maybe MaskingState)

Throw an exception, and give the resultant masking state after jumping to the exception handler (if the thread is still alive).

ThrowTo ThreadId (Maybe MaskingState)

Throw an exception to a thread, and give the resultant masking state after jumping to the exception handler (if the thread is still alive).

BlockedThrowTo ThreadId

Get blocked on a throwTo.

SetMasking Bool MaskingState

Set the masking state. If True, this is being used to set the masking state to the original state in the argument passed to a masked function.

ResetMasking Bool MaskingState

Return to an earlier masking state. If True, this is being used to return to the state of the masked block in the argument passed to a masked function.

GetMaskingState MaskingState

Get the current masking state.

LiftIO

Lift an IO action. Note that this can only happen with ConcIO.

Return

A return or pure action was executed.

Stop

Cease execution and terminate.

RegisterInvariant

Register an invariant.

Instances

Instances details
Generic ThreadAction Source # 
Instance details

Defined in Test.DejaFu.Types

Associated Types

type Rep ThreadAction :: Type -> Type #

Show ThreadAction Source # 
Instance details

Defined in Test.DejaFu.Types

NFData ThreadAction Source # 
Instance details

Defined in Test.DejaFu.Types

Methods

rnf :: ThreadAction -> () #

Eq ThreadAction Source # 
Instance details

Defined in Test.DejaFu.Types

type Rep ThreadAction Source # 
Instance details

Defined in Test.DejaFu.Types

type Rep ThreadAction = D1 ('MetaData "ThreadAction" "Test.DejaFu.Types" "dejafu-2.4.0.6-2Exh5SnWzcKIwmIryqnn01" 'False) (((((C1 ('MetaCons "Fork" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ThreadId)) :+: C1 ('MetaCons "ForkOS" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ThreadId))) :+: (C1 ('MetaCons "SupportsBoundThreads" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)) :+: (C1 ('MetaCons "IsCurrentThreadBound" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)) :+: C1 ('MetaCons "MyThreadId" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "GetNumCapabilities" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :+: C1 ('MetaCons "SetNumCapabilities" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int))) :+: (C1 ('MetaCons "Yield" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ThreadDelay" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :+: C1 ('MetaCons "NewMVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MVarId)))))) :+: (((C1 ('MetaCons "PutMVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MVarId) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [ThreadId])) :+: C1 ('MetaCons "BlockedPutMVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MVarId))) :+: (C1 ('MetaCons "TryPutMVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MVarId) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [ThreadId]))) :+: (C1 ('MetaCons "ReadMVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MVarId)) :+: C1 ('MetaCons "TryReadMVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MVarId) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))))) :+: ((C1 ('MetaCons "BlockedReadMVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MVarId)) :+: (C1 ('MetaCons "TakeMVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MVarId) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [ThreadId])) :+: C1 ('MetaCons "BlockedTakeMVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MVarId)))) :+: (C1 ('MetaCons "TryTakeMVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MVarId) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [ThreadId]))) :+: (C1 ('MetaCons "NewIORef" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 IORefId)) :+: C1 ('MetaCons "ReadIORef" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 IORefId))))))) :+: ((((C1 ('MetaCons "ReadIORefCas" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 IORefId)) :+: C1 ('MetaCons "ModIORef" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 IORefId))) :+: (C1 ('MetaCons "ModIORefCas" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 IORefId)) :+: (C1 ('MetaCons "WriteIORef" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 IORefId)) :+: C1 ('MetaCons "CasIORef" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 IORefId) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))))) :+: ((C1 ('MetaCons "CommitIORef" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ThreadId) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 IORefId)) :+: C1 ('MetaCons "STM" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [TAction]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [ThreadId]))) :+: (C1 ('MetaCons "ThrownSTM" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [TAction]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe MaskingState))) :+: (C1 ('MetaCons "BlockedSTM" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [TAction])) :+: C1 ('MetaCons "Catching" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "PopCatching" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Throw" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe MaskingState)))) :+: (C1 ('MetaCons "ThrowTo" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ThreadId) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe MaskingState))) :+: (C1 ('MetaCons "BlockedThrowTo" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ThreadId)) :+: C1 ('MetaCons "SetMasking" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MaskingState))))) :+: ((C1 ('MetaCons "ResetMasking" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MaskingState)) :+: (C1 ('MetaCons "GetMaskingState" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MaskingState)) :+: C1 ('MetaCons "LiftIO" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "Return" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Stop" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "RegisterInvariant" 'PrefixI 'False) (U1 :: Type -> Type)))))))

data Lookahead Source #

A one-step look-ahead at what a thread will do next.

Since: 2.2.0.0

Constructors

WillFork

Will start a new thread.

WillForkOS

Will start a new bound thread.

WillSupportsBoundThreads

Will check if bound threads are supported.

WillIsCurrentThreadBound

Will check if the current thread is bound.

WillMyThreadId

Will get the ThreadId.

WillGetNumCapabilities

Will get the number of Haskell threads that can run simultaneously.

WillSetNumCapabilities Int

Will set the number of Haskell threads that can run simultaneously.

WillYield

Will yield the current thread.

WillThreadDelay Int

Will yield/delay the current thread.

WillNewMVar

Will create a new MVar.

WillPutMVar MVarId

Will put into a MVar, possibly waking up some threads.

WillTryPutMVar MVarId

Will try to put into a MVar, possibly waking up some threads.

WillReadMVar MVarId

Will read from a MVar.

WillTryReadMVar MVarId

Will try to read from a MVar.

WillTakeMVar MVarId

Will take from a MVar, possibly waking up some threads.

WillTryTakeMVar MVarId

Will try to take from a MVar, possibly waking up some threads.

WillNewIORef

Will create a new IORef.

WillReadIORef IORefId

Will read from a IORef.

WillReadIORefCas IORefId

Will read from a IORef for a future compare-and-swap.

WillModIORef IORefId

Will modify a IORef.

WillModIORefCas IORefId

Will modify a IORef using a compare-and-swap.

WillWriteIORef IORefId

Will write to a IORef without synchronising.

WillCasIORef IORefId

Will attempt to to a IORef using a compare-and-swap, synchronising it.

WillCommitIORef ThreadId IORefId

Will commit the last write by the given thread to the IORef.

WillSTM

Will execute an STM transaction, possibly waking up some threads.

WillCatching

Will register a new exception handler

WillPopCatching

Will pop the innermost exception handler from the stack.

WillThrow

Will throw an exception.

WillThrowTo ThreadId

Will throw an exception to a thread.

WillSetMasking Bool MaskingState

Will set the masking state. If True, this is being used to set the masking state to the original state in the argument passed to a masked function.

WillResetMasking Bool MaskingState

Will return to an earlier masking state. If True, this is being used to return to the state of the masked block in the argument passed to a masked function.

WillGetMaskingState

Will get the masking state.

WillLiftIO

Will lift an IO action. Note that this can only happen with ConcIO.

WillReturn

Will execute a return or pure action.

WillStop

Will cease execution and terminate.

WillRegisterInvariant

Will register an invariant

Instances

Instances details
Generic Lookahead Source # 
Instance details

Defined in Test.DejaFu.Types

Associated Types

type Rep Lookahead :: Type -> Type #

Show Lookahead Source # 
Instance details

Defined in Test.DejaFu.Types

NFData Lookahead Source # 
Instance details

Defined in Test.DejaFu.Types

Methods

rnf :: Lookahead -> () #

Eq Lookahead Source # 
Instance details

Defined in Test.DejaFu.Types

type Rep Lookahead Source # 
Instance details

Defined in Test.DejaFu.Types

type Rep Lookahead = D1 ('MetaData "Lookahead" "Test.DejaFu.Types" "dejafu-2.4.0.6-2Exh5SnWzcKIwmIryqnn01" 'False) (((((C1 ('MetaCons "WillFork" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WillForkOS" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "WillSupportsBoundThreads" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WillIsCurrentThreadBound" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "WillMyThreadId" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WillGetNumCapabilities" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "WillSetNumCapabilities" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :+: (C1 ('MetaCons "WillYield" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WillThreadDelay" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))))) :+: (((C1 ('MetaCons "WillNewMVar" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WillPutMVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MVarId))) :+: (C1 ('MetaCons "WillTryPutMVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MVarId)) :+: C1 ('MetaCons "WillReadMVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MVarId)))) :+: ((C1 ('MetaCons "WillTryReadMVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MVarId)) :+: C1 ('MetaCons "WillTakeMVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MVarId))) :+: (C1 ('MetaCons "WillTryTakeMVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MVarId)) :+: (C1 ('MetaCons "WillNewIORef" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WillReadIORef" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 IORefId))))))) :+: ((((C1 ('MetaCons "WillReadIORefCas" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 IORefId)) :+: C1 ('MetaCons "WillModIORef" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 IORefId))) :+: (C1 ('MetaCons "WillModIORefCas" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 IORefId)) :+: C1 ('MetaCons "WillWriteIORef" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 IORefId)))) :+: ((C1 ('MetaCons "WillCasIORef" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 IORefId)) :+: C1 ('MetaCons "WillCommitIORef" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ThreadId) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 IORefId))) :+: (C1 ('MetaCons "WillSTM" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "WillCatching" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WillPopCatching" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "WillThrow" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WillThrowTo" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ThreadId))) :+: (C1 ('MetaCons "WillSetMasking" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MaskingState)) :+: C1 ('MetaCons "WillResetMasking" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MaskingState)))) :+: ((C1 ('MetaCons "WillGetMaskingState" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WillLiftIO" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "WillReturn" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "WillStop" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WillRegisterInvariant" 'PrefixI 'False) (U1 :: Type -> Type)))))))

data MVarId Source #

Every MVar has a unique identifier.

Since: 1.0.0.0

Instances

Instances details
Generic MVarId Source # 
Instance details

Defined in Test.DejaFu.Types

Associated Types

type Rep MVarId :: Type -> Type #

Methods

from :: MVarId -> Rep MVarId x #

to :: Rep MVarId x -> MVarId #

Show MVarId Source # 
Instance details

Defined in Test.DejaFu.Types

NFData MVarId Source # 
Instance details

Defined in Test.DejaFu.Types

Methods

rnf :: MVarId -> () #

Eq MVarId Source # 
Instance details

Defined in Test.DejaFu.Types

Methods

(==) :: MVarId -> MVarId -> Bool #

(/=) :: MVarId -> MVarId -> Bool #

Ord MVarId Source # 
Instance details

Defined in Test.DejaFu.Types

type Rep MVarId Source #

Since: 1.3.1.0

Instance details

Defined in Test.DejaFu.Types

type Rep MVarId = D1 ('MetaData "MVarId" "Test.DejaFu.Types" "dejafu-2.4.0.6-2Exh5SnWzcKIwmIryqnn01" 'True) (C1 ('MetaCons "MVarId" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Id)))

data IORefId Source #

Every IORef has a unique identifier.

Since: 1.11.0.0

Instances

Instances details
Generic IORefId Source # 
Instance details

Defined in Test.DejaFu.Types

Associated Types

type Rep IORefId :: Type -> Type #

Methods

from :: IORefId -> Rep IORefId x #

to :: Rep IORefId x -> IORefId #

Show IORefId Source # 
Instance details

Defined in Test.DejaFu.Types

NFData IORefId Source # 
Instance details

Defined in Test.DejaFu.Types

Methods

rnf :: IORefId -> () #

Eq IORefId Source # 
Instance details

Defined in Test.DejaFu.Types

Methods

(==) :: IORefId -> IORefId -> Bool #

(/=) :: IORefId -> IORefId -> Bool #

Ord IORefId Source # 
Instance details

Defined in Test.DejaFu.Types

type Rep IORefId Source # 
Instance details

Defined in Test.DejaFu.Types

type Rep IORefId = D1 ('MetaData "IORefId" "Test.DejaFu.Types" "dejafu-2.4.0.6-2Exh5SnWzcKIwmIryqnn01" 'True) (C1 ('MetaCons "IORefId" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Id)))

data MaskingState #

Describes the behaviour of a thread when an asynchronous exception is received.

Constructors

Unmasked

asynchronous exceptions are unmasked (the normal state)

MaskedInterruptible

the state during mask: asynchronous exceptions are masked, but blocking operations may still be interrupted

MaskedUninterruptible

the state during uninterruptibleMask: asynchronous exceptions are masked, and blocking operations may not be interrupted

Instances

Instances details
Show MaskingState

Since: base-4.3.0.0

Instance details

Defined in GHC.IO

NFData MaskingState

Since: deepseq-1.4.4.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: MaskingState -> () #

Eq MaskingState

Since: base-4.3.0.0

Instance details

Defined in GHC.IO

showTrace :: Trace -> String Source #

Pretty-print a trace, including a key of the thread IDs (not including thread 0). Each line of the key is indented by two spaces.

Since: 0.5.0.0

showCondition :: Condition -> String Source #

Pretty-print a condition

Since: 1.12.0.0