Safe Haskell | None |
---|---|
Language | Haskell2010 |
Control.Monad.IOSim.Types
Synopsis
- newtype IOSim s a = IOSim {}
- runIOSim ∷ IOSim s a → SimA s a
- traceM ∷ Typeable a ⇒ a → IOSim s ()
- traceSTM ∷ Typeable a ⇒ a → STMSim s ()
- liftST ∷ ST s a → IOSim s a
- data SimA s a where
- Return ∷ a → SimA s a
- Say ∷ String → SimA s b → SimA s b
- Output ∷ Dynamic → SimA s b → SimA s b
- LiftST ∷ ST s a → (a → SimA s b) → SimA s b
- GetMonoTime ∷ (Time → SimA s b) → SimA s b
- GetWallTime ∷ (UTCTime → SimA s b) → SimA s b
- SetWallTime ∷ UTCTime → SimA s b → SimA s b
- UnshareClock ∷ SimA s b → SimA s b
- NewTimeout ∷ DiffTime → (Timeout (IOSim s) → SimA s b) → SimA s b
- UpdateTimeout ∷ Timeout (IOSim s) → DiffTime → SimA s b → SimA s b
- CancelTimeout ∷ Timeout (IOSim s) → SimA s b → SimA s b
- Throw ∷ SomeException → SimA s a
- Catch ∷ Exception e ⇒ SimA s a → (e → SimA s a) → (a → SimA s b) → SimA s b
- Evaluate ∷ a → (a → SimA s b) → SimA s b
- Fork ∷ IOSim s () → (ThreadId → SimA s b) → SimA s b
- GetThreadId ∷ (ThreadId → SimA s b) → SimA s b
- LabelThread ∷ ThreadId → String → SimA s b → SimA s b
- Atomically ∷ STM s a → (a → SimA s b) → SimA s b
- ThrowTo ∷ SomeException → ThreadId → SimA s a → SimA s a
- SetMaskState ∷ MaskingState → IOSim s a → (a → SimA s b) → SimA s b
- GetMaskState ∷ (MaskingState → SimA s b) → SimA s b
- YieldSim ∷ SimA s a → SimA s a
- ExploreRaces ∷ SimA s b → SimA s b
- Fix ∷ (x → IOSim s x) → (x → SimA s r) → SimA s r
- type StepId = (ThreadId, Int)
- type STMSim = STM
- newtype STM s a = STM {}
- runSTM ∷ STM s a → StmA s a
- data StmA s a where
- ReturnStm ∷ a → StmA s a
- ThrowStm ∷ SomeException → StmA s a
- NewTVar ∷ Maybe String → x → (TVar s x → StmA s b) → StmA s b
- LabelTVar ∷ String → TVar s a → StmA s b → StmA s b
- ReadTVar ∷ TVar s a → (a → StmA s b) → StmA s b
- WriteTVar ∷ TVar s a → a → StmA s b → StmA s b
- Retry ∷ StmA s b
- OrElse ∷ StmA s a → StmA s a → (a → StmA s b) → StmA s b
- SayStm ∷ String → StmA s b → StmA s b
- OutputStm ∷ Dynamic → StmA s b → StmA s b
- TraceTVar ∷ ∀ s a b. TVar s a → (Maybe a → a → ST s TraceValue) → StmA s b → StmA s b
- data StmTxResult s a
- = StmTxCommitted a [SomeTVar s] [SomeTVar s] [SomeTVar s] [Dynamic] [String] TVarId
- | StmTxBlocked [SomeTVar s]
- | StmTxAborted [SomeTVar s] SomeException
- data StmStack s b a where
- data family Timeout (m ∷ Type → Type)
- newtype TimeoutException = TimeoutException TimeoutId
- setCurrentTime ∷ UTCTime → IOSim s ()
- unshareClock ∷ IOSim s ()
- data ScheduleControl
- data ScheduleMod = ScheduleMod {}
- data ExplorationOptions = ExplorationOptions {}
- type ExplorationSpec = ExplorationOptions → ExplorationOptions
- withScheduleBound ∷ Int → ExplorationSpec
- withBranching ∷ Int → ExplorationSpec
- withStepTimelimit ∷ Int → ExplorationSpec
- withReplay ∷ ScheduleControl → ExplorationSpec
- stdExplorationOptions ∷ ExplorationOptions
- newtype EventlogEvent = EventlogEvent String
- newtype EventlogMarker = EventlogMarker String
- data SimEventType
- = EventSimStart ScheduleControl
- | EventSay String
- | EventLog Dynamic
- | EventMask MaskingState
- | EventThrow SomeException
- | EventThrowTo SomeException ThreadId
- | EventThrowToBlocked
- | EventThrowToWakeup
- | EventThrowToUnmasked (Labelled ThreadId)
- | EventThreadForked ThreadId
- | EventThreadFinished
- | EventThreadUnhandled SomeException
- | EventTxCommitted [Labelled TVarId] [Labelled TVarId] (Maybe Effect)
- | EventTxAborted (Maybe Effect)
- | EventTxBlocked [Labelled TVarId] (Maybe Effect)
- | EventTxWakeup [Labelled TVarId]
- | EventTimerCreated TimeoutId TVarId Time
- | EventTimerUpdated TimeoutId Time
- | EventTimerCancelled TimeoutId
- | EventTimerExpired TimeoutId
- | EventThreadSleep
- | EventThreadWake
- | EventDeschedule Deschedule
- | EventFollowControl ScheduleControl
- | EventAwaitControl StepId ScheduleControl
- | EventPerformAction StepId
- | EventReschedule ScheduleControl
- | EventUnblocked [ThreadId]
- data SimEvent
- = SimEvent {
- seTime ∷ !Time
- seThreadId ∷ !ThreadId
- seThreadLabel ∷ !(Maybe ThreadLabel)
- seType ∷ !SimEventType
- | SimPOREvent {
- seTime ∷ !Time
- seThreadId ∷ !ThreadId
- seStep ∷ !Int
- seThreadLabel ∷ !(Maybe ThreadLabel)
- seType ∷ !SimEventType
- | SimRacesFound [ScheduleControl]
- = SimEvent {
- data SimResult a
- = MainReturn !Time a ![Labelled ThreadId]
- | MainException !Time SomeException ![Labelled ThreadId]
- | Deadlock !Time ![Labelled ThreadId]
- | Loop
- type SimTrace a = Trace (SimResult a) SimEvent
- data Trace a b where
- pattern Trace ∷ Time → ThreadId → Maybe ThreadLabel → SimEventType → SimTrace a → SimTrace a
- pattern SimTrace ∷ Time → ThreadId → Maybe ThreadLabel → SimEventType → SimTrace a → SimTrace a
- pattern SimPORTrace ∷ Time → ThreadId → Int → Maybe ThreadLabel → SimEventType → SimTrace a → SimTrace a
- pattern TraceMainReturn ∷ Time → a → [Labelled ThreadId] → SimTrace a
- pattern TraceMainException ∷ Time → SomeException → [Labelled ThreadId] → SimTrace a
- pattern TraceDeadlock ∷ Time → [Labelled ThreadId] → SimTrace a
- pattern TraceRacesFound ∷ [ScheduleControl] → SimTrace a → SimTrace a
- pattern TraceLoop ∷ SimTrace a
- ppTrace ∷ Show a ⇒ SimTrace a → String
- ppTrace_ ∷ SimTrace a → String
- ppSimEvent ∷ Int → Int → Int → SimEvent → String
- ppDebug ∷ SimTrace a → x → x
- type TraceEvent = SimEventType
- data Labelled a = Labelled {
- l_labelled ∷ !a
- l_label ∷ !(Maybe String)
- module Control.Monad.IOSim.CommonTypes
- type SimM s = IOSim s
- type SimSTM = STM
Documentation
Instances
Constructors
Constructors
ReturnStm ∷ a → StmA s a | |
ThrowStm ∷ SomeException → StmA s a | |
NewTVar ∷ Maybe String → x → (TVar s x → StmA s b) → StmA s b | |
LabelTVar ∷ String → TVar s a → StmA s b → StmA s b | |
ReadTVar ∷ TVar s a → (a → StmA s b) → StmA s b | |
WriteTVar ∷ TVar s a → a → StmA s b → StmA s b | |
Retry ∷ StmA s b | |
OrElse ∷ StmA s a → StmA s a → (a → StmA s b) → StmA s b | |
SayStm ∷ String → StmA s b → StmA s b | |
OutputStm ∷ Dynamic → StmA s b → StmA s b | |
TraceTVar ∷ ∀ s a b. TVar s a → (Maybe a → a → ST s TraceValue) → StmA s b → StmA s b |
data StmTxResult s a Source #
Constructors
StmTxCommitted | A committed transaction reports the vars that were written (in order of first write) so that the scheduler can unblock other threads that were blocked in STM transactions that read any of these vars. It reports the vars that were read, so we can update vector clocks appropriately. The third list of vars is ones that were created during this
transaction. This is useful for an implementation of It also includes the updated TVarId name supply. |
StmTxBlocked [SomeTVar s] | A blocked transaction reports the vars that were read so that the scheduler can block the thread on those vars. |
StmTxAborted [SomeTVar s] SomeException | An aborted transaction reports the vars that were read so that the vector clock can be updated. |
data StmStack s b a where Source #
Constructors
AtomicallyFrame ∷ StmStack s a a | Executing in the context of a top level |
OrElseLeftFrame ∷ StmA s a → (a → StmA s b) → Map TVarId (SomeTVar s) → [SomeTVar s] → [SomeTVar s] → StmStack s b c → StmStack s a c | Executing in the context of the left hand side of an |
OrElseRightFrame ∷ (a → StmA s b) → Map TVarId (SomeTVar s) → [SomeTVar s] → [SomeTVar s] → StmStack s b c → StmStack s a c | Executing in the context of the right hand side of an |
data family Timeout (m ∷ Type → Type) Source #
Instances
data Timeout IO | |
Defined in Control.Monad.Class.MonadTimer | |
data Timeout (IOSim s) Source # | |
Defined in Control.Monad.IOSim.Types data Timeout (IOSim s)
| |
newtype Timeout (ReaderT r m) | |
Defined in Control.Monad.Class.MonadTimer | |
newtype Timeout (StateT s m) | |
Defined in Control.Monad.Class.MonadTimer | |
newtype Timeout (WriterT w m) | |
Defined in Control.Monad.Class.MonadTimer | |
newtype Timeout (RWST r w s m) | |
Defined in Control.Monad.Class.MonadTimer |
newtype TimeoutException Source #
Constructors
TimeoutException TimeoutId |
Instances
Eq TimeoutException Source # | |
Defined in Control.Monad.IOSim.Types Methods | |
Show TimeoutException Source # | |
Defined in Control.Monad.IOSim.Types | |
Exception TimeoutException Source # | |
Defined in Control.Monad.IOSim.Types |
setCurrentTime ∷ UTCTime → IOSim s () Source #
Set the current wall clock time for the thread's clock domain.
unshareClock ∷ IOSim s () Source #
Put the thread into a new wall clock domain, not shared with the parent thread. Changing the wall clock time in the new clock domain will not affect the other clock of other threads. All threads forked by this thread from this point onwards will share the new clock domain.
data ScheduleControl Source #
Constructors
ControlDefault | default scheduling mode |
ControlAwait [ScheduleMod] | if the current control is |
ControlFollow [StepId] [ScheduleMod] | follow the steps then continue with schedule
modifications. This control is set by |
Instances
Eq ScheduleControl Source # | |
Defined in Control.Monad.IOSim.Types Methods | |
Ord ScheduleControl Source # | |
Defined in Control.Monad.IOSim.Types Methods compare ∷ ScheduleControl → ScheduleControl → Ordering Source # (<) ∷ ScheduleControl → ScheduleControl → Bool Source # (<=) ∷ ScheduleControl → ScheduleControl → Bool Source # (>) ∷ ScheduleControl → ScheduleControl → Bool Source # (>=) ∷ ScheduleControl → ScheduleControl → Bool Source # max ∷ ScheduleControl → ScheduleControl → ScheduleControl Source # min ∷ ScheduleControl → ScheduleControl → ScheduleControl Source # | |
Show ScheduleControl Source # | |
Defined in Control.Monad.IOSim.Types |
data ScheduleMod Source #
Constructors
ScheduleMod | |
Fields
|
Instances
Eq ScheduleMod Source # | |
Defined in Control.Monad.IOSim.Types Methods (==) ∷ ScheduleMod → ScheduleMod → Bool Source # (/=) ∷ ScheduleMod → ScheduleMod → Bool Source # | |
Ord ScheduleMod Source # | |
Defined in Control.Monad.IOSim.Types Methods compare ∷ ScheduleMod → ScheduleMod → Ordering Source # (<) ∷ ScheduleMod → ScheduleMod → Bool Source # (<=) ∷ ScheduleMod → ScheduleMod → Bool Source # (>) ∷ ScheduleMod → ScheduleMod → Bool Source # (>=) ∷ ScheduleMod → ScheduleMod → Bool Source # max ∷ ScheduleMod → ScheduleMod → ScheduleMod Source # min ∷ ScheduleMod → ScheduleMod → ScheduleMod Source # | |
Show ScheduleMod Source # | |
Defined in Control.Monad.IOSim.Types |
data ExplorationOptions Source #
Constructors
ExplorationOptions | |
Instances
Show ExplorationOptions Source # | |
Defined in Control.Monad.IOSim.Types |
newtype EventlogEvent Source #
Wrapper for Eventlog events so they can be retrieved from the trace with
selectTraceEventsDynamic
.
Constructors
EventlogEvent String |
newtype EventlogMarker Source #
Wrapper for Eventlog markers so they can be retrieved from the trace with
selectTraceEventsDynamic
.
Constructors
EventlogMarker String |
data SimEventType Source #
Constructors
Instances
Show SimEventType Source # | |
Defined in Control.Monad.IOSim.Types |
Trace
is a recursive data type, it is the trace of a IOSim
computation.
The trace will contain information about thread sheduling, blocking on
TVar
s, and other internal state changes of IOSim
. More importantly it
also supports traces generated by the computation with say
(which
corresponds to using putStrLn
in IO
), traceEventM
, or dynamically typed
traces with traceM
(which generalise the base
library
traceM
)
It also contains information on races discovered.
See also: traceEvents
, traceResult
, selectTraceEvents
,
selectTraceEventsDynamic
and printTraceEventsSay
.
Constructors
SimEvent | |
Fields
| |
SimPOREvent | |
Fields
| |
SimRacesFound [ScheduleControl] |
Instances
Constructors
MainReturn !Time a ![Labelled ThreadId] | |
MainException !Time SomeException ![Labelled ThreadId] | |
Deadlock !Time ![Labelled ThreadId] | |
Loop |
A cons
list with polymorphic nil
, thus an octopus.
Usually used with a
being a non empty sum type.
Bundled Patterns
pattern Trace ∷ Time → ThreadId → Maybe ThreadLabel → SimEventType → SimTrace a → SimTrace a | Deprecated: Use |
pattern SimTrace ∷ Time → ThreadId → Maybe ThreadLabel → SimEventType → SimTrace a → SimTrace a | |
pattern SimPORTrace ∷ Time → ThreadId → Int → Maybe ThreadLabel → SimEventType → SimTrace a → SimTrace a | |
pattern TraceMainReturn ∷ Time → a → [Labelled ThreadId] → SimTrace a | |
pattern TraceMainException ∷ Time → SomeException → [Labelled ThreadId] → SimTrace a | |
pattern TraceDeadlock ∷ Time → [Labelled ThreadId] → SimTrace a | |
pattern TraceRacesFound ∷ [ScheduleControl] → SimTrace a → SimTrace a | |
pattern TraceLoop ∷ SimTrace a |
Instances
Bitraversable Trace Source # | |
Defined in Data.List.Trace Methods bitraverse ∷ Applicative f ⇒ (a → f c) → (b → f d) → Trace a b → f (Trace c d) Source # | |
Bifoldable Trace Source # | |
Bifunctor Trace Source # | |
Monoid a ⇒ Monad (Trace a) Source # | |
Functor (Trace a) Source # | |
Monoid a ⇒ MonadFix (Trace a) Source # | |
Monoid a ⇒ MonadFail (Trace a) Source # | |
Monoid a ⇒ Applicative (Trace a) Source # | |
Eq a ⇒ Eq1 (Trace a) Source # | |
Ord a ⇒ Ord1 (Trace a) Source # | |
Defined in Data.List.Trace | |
Show a ⇒ Show1 (Trace a) Source # | |
Monoid a ⇒ Alternative (Trace a) Source # | |
Monoid a ⇒ MonadPlus (Trace a) Source # | |
(Eq b, Eq a) ⇒ Eq (Trace a b) Source # | |
(Ord b, Ord a) ⇒ Ord (Trace a b) Source # | |
Defined in Data.List.Trace | |
(Show b, Show a) ⇒ Show (Trace a b) Source # | |
Semigroup a ⇒ Semigroup (Trace a b) Source # | |
Monoid a ⇒ Monoid (Trace a b) Source # | |
ppDebug ∷ SimTrace a → x → x Source #
Trace each event using trace
; this is useful when a trace ends with
a pure error, e.g. an assertion.
type TraceEvent = SimEventType Source #
Deprecated: Use SimEventType
instead.
Constructors
Labelled | |
Fields
|
Instances
Eq a ⇒ Eq (Labelled a) Source # | |
Ord a ⇒ Ord (Labelled a) Source # | |
Defined in Control.Monad.IOSim.Types | |
Show a ⇒ Show (Labelled a) Source # | |
Generic (Labelled a) Source # | |
type Rep (Labelled a) Source # | |
Defined in Control.Monad.IOSim.Types type Rep (Labelled a) = D1 ('MetaData "Labelled" "Control.Monad.IOSim.Types" "io-sim-0.2.0.0-inplace" 'False) (C1 ('MetaCons "Labelled" 'PrefixI 'True) (S1 ('MetaSel ('Just "l_labelled") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: S1 ('MetaSel ('Just "l_label") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe String)))) |