|
|
|
|
Synopsis |
|
data EventT t m a | | runEventT :: Monad m => EventT t m a -> EventT_RState t m -> EventT_RWState t m -> m (a, EventT_RWState t m) | | runEventGraph :: (Monad m, MonadEvent (EventT t m) e, Ord t, Num t, Show t) => e -> m (EventT_RState t m, EventT_RWState t m) | | runEventGraphWithState :: (Monad m, Ord t, Show t) => EventT_RState t m -> EventT_RWState t m -> m (EventT_RWState t m) | | newEventT_RState :: EventT_RState t m | | newEventT_RWState :: (Monad m, Ord t) => t -> EventT_RWState t m | | onClockChanged :: HandlerAccessor t m (t, t) () | | onEventDispatch :: HandlerAccessor t m (EventDescriptor (EventT t m) t) () | | onEventComplete :: HandlerAccessor t m (EventDescriptor (EventT t m) t) () | | onEventSchedule :: HandlerAccessor t m (EventDescriptor (EventT t m) t) () | | onEventCancel :: HandlerAccessor t m (Either EventID (EventDescriptor (EventT t m) t)) () | | addHandler :: Monad m => HandlerAccessor t m a b -> (a -> EventT t m b) -> EventT t m HandlerID | | removeHandler :: Monad m => HandlerAccessor t m a b -> HandlerID -> EventT t m (Maybe (a -> EventT t m b)) |
|
|
Documentation |
|
|
A monad transformer which adds an event queue and related operations to
an underlying monad. The "t" parameter specifies the type of the
simulation time.
Several hooks are provided to allow special handling of various events,
such as the progression of time, the scheduling or canceling or dispatch
of an event, etc.
| Instances | |
|
|
runEventT :: Monad m => EventT t m a -> EventT_RState t m -> EventT_RWState t m -> m (a, EventT_RWState t m) | Source |
|
Run an EventT wrapped action. This is a "raw" action - there is no
interaction with the state (including event graph) except whatever the
action itself does.
|
|
|
Initialize the event queue and other stuff, enqueue the provided "start
event", and run the queue until it's empty or until the simulation is
paused.
|
|
runEventGraphWithState :: (Monad m, Ord t, Show t) => EventT_RState t m -> EventT_RWState t m -> m (EventT_RWState t m) | Source |
|
Repeatedly pull and run the next event in the queue until it's
empty or until the simulation is paused using pauseSimulation
or something equivalent.
|
|
newEventT_RState :: EventT_RState t m | Source |
|
A new instance of the read-only portion of the EventT internal
state.
|
|
newEventT_RWState :: (Monad m, Ord t) => t -> EventT_RWState t m | Source |
|
A new instance of the read/write portion of the EventT internal
state. The parameter is the initial time value.
|
|
onClockChanged :: HandlerAccessor t m (t, t) () | Source |
|
Fires whenever the clock changes, and is passed a tuple containing
(old time, new time)
|
|
|
Fires just before an event is dispatched. Is passed an EventDescriptor
describing the event about to be run.
|
|
|
Fires after an event returns. Is passed an EventDescriptor for the
event that just finished.
|
|
|
Fires after an event is scheduled. Is passed an EventDescriptor for
the event.
|
|
|
Fires after an event is canceled. Is passed either an EventID (if the
cancellation failed) or an EventDescriptor for the event that was canceled.
|
|
|
Add an event handler to be called when the specified event happens.
|
|
|
Remove an event handler given its ID, and return it if it was in the set.
|
|
Produced by Haddock version 2.4.2 |