Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Logical time (in terms of abstract " ticks ")
Intended for qualified import
import Test.Util.LogicalClock (LogicalClock) import qualified Test.Util.LogicalClock as LogicalClock
Synopsis
- data LogicalClock m = LogicalClock {
- getCurrentTick ∷ STM m Tick
- waitUntilDone ∷ m ()
- mockSystemTime ∷ SystemTime m
- newtype NumTicks = NumTicks Word64
- newtype Tick = Tick {}
- new ∷ IOLike m ⇒ ResourceRegistry m → NumTicks → m (LogicalClock m)
- sufficientTimeFor ∷ HasCallStack ⇒ [Tick] → NumTicks
- blockUntilTick ∷ MonadSTM m ⇒ LogicalClock m → Tick → m Bool
- onTick ∷ (IOLike m, HasCallStack) ⇒ ResourceRegistry m → LogicalClock m → String → Tick → m () → m ()
- tickWatcher ∷ LogicalClock m → (Tick → m ()) → Watcher m Tick Tick
- tickTracer ∷ MonadSTM m ⇒ LogicalClock m → Tracer m (Tick, ev) → Tracer m ev
API
data LogicalClock m Source #
Logical clock (in terms of ticks rather than actual UTCTime
)
LogicalClock | |
|
Logical time unit
Construction
new ∷ IOLike m ⇒ ResourceRegistry m → NumTicks → m (LogicalClock m) Source #
sufficientTimeFor ∷ HasCallStack ⇒ [Tick] → NumTicks Source #
Scheduling actions
blockUntilTick ∷ MonadSTM m ⇒ LogicalClock m → Tick → m Bool Source #
onTick ∷ (IOLike m, HasCallStack) ⇒ ResourceRegistry m → LogicalClock m → String → Tick → m () → m () Source #
Execute action once at the specified tick
tickWatcher ∷ LogicalClock m → (Tick → m ()) → Watcher m Tick Tick Source #
Execute action on every clock tick
Utilities
tickTracer ∷ MonadSTM m ⇒ LogicalClock m → Tracer m (Tick, ev) → Tracer m ev Source #