event-monad-0.0.1.0: Event-graph simulation monad transformerSource codeContentsIndex
Control.Monad.Event.BasicEvents
Synopsis
data SimControl m
= StopSim
| StartSim
data AdHocEvent m = AdHocEvent (m Doc) (m ())
(?:) :: (Monad m, Pretty desc) => desc -> m a -> AdHocEvent m
(?::) :: Monad m => m Doc -> m a -> AdHocEvent m
(&) :: (MonadEvent m e1, MonadEvent m e2) => e1 -> e2 -> AdHocEvent m
(&-) :: (ScheduleEvent m t e2, MonadEvent m e1) => e1 -> e2 -> AdHocEvent m
(@:) :: (ScheduleEvent m t e, Pretty t, Num t) => e -> t -> AdHocEvent m
Documentation
data SimControl m Source
Constructors
StopSim
StartSim
show/hide Instances
data AdHocEvent m Source
An event with description and effect supplied at run time
Constructors
AdHocEvent (m Doc) (m ())
show/hide Instances
(?:) :: (Monad m, Pretty desc) => desc -> m a -> AdHocEvent mSource
An infix operator to construct an event from a description and an action
(?::) :: Monad m => m Doc -> m a -> AdHocEvent mSource
Same thing, but use an action to generate the description
(&) :: (MonadEvent m e1, MonadEvent m e2) => e1 -> e2 -> AdHocEvent mSource
An infix operator for sequential composition of events
(&-) :: (ScheduleEvent m t e2, MonadEvent m e1) => e1 -> e2 -> AdHocEvent mSource

A version of & that preserves distinctness of events at the expense of being able to guarantee "proper" interleaving with other events scheduled at the same time. For example, suppose a composite event e1 &- e2 of this type is scheduled, then a third event e3 is scheduled for the same time. The "expected" order of execution is e1; e2; e3. What actually happens is e1; e3; e2 - because (e1 &- e2) runs, having the effect of running e1 and scheduling e2, then e3 runs (because it's next in the queue), then e2 finally runs. This situation could be solved by changing the semantics for doNext as proposed there.

This is primarily useful for separating an initial SetDebugHandlers event from the other event(s) being fired at the start of the simulation, so that they will be "seen" by the newly installed handlers.

(@:) :: (ScheduleEvent m t e, Pretty t, Num t) => e -> t -> AdHocEvent mSource
An infix operator for defining a "delayed" event - or rather a new event that schedules its payload at a later time
Produced by Haddock version 2.4.2