event-monad-0.0.1.0: Event-graph simulation monad transformerSource codeContentsIndex
Control.Monad.EventM
Synopsis
type EventM = EventIO Double
data EventIO t a
runEventIO :: EventIO t a -> EventIOState t -> IO a
runEventGraph :: (MonadEvent (EventIO t) e, Ord t, Num t, Show t) => e -> IO (EventIOState t)
runEventGraphWithState :: (Ord t, Show t) => EventIOState t -> IO ()
newEventIOState :: Ord t => t -> IO (EventIOState t)
onClockChanged :: EventIOHandlers t -> TVar (HandlerSet (EventIO t) (t, t) ())
onEventDispatch :: EventIOHandlers t -> TVar (HandlerSet (EventIO t) (EventDescriptor (EventIO t) t) ())
onEventComplete :: EventIOHandlers t -> TVar (HandlerSet (EventIO t) (EventDescriptor (EventIO t) t) ())
onEventSchedule :: EventIOHandlers t -> TVar (HandlerSet (EventIO t) (EventDescriptor (EventIO t) t) ())
onEventCancel :: EventIOHandlers t -> TVar (HandlerSet (EventIO t) (Either EventID (EventDescriptor (EventIO t) t)) ())
addHandler :: HandlerAccessor t a b -> (a -> EventIO t b) -> EventIO t HandlerID
removeHandler :: HandlerAccessor t a b -> HandlerID -> EventIO t (Maybe (a -> EventIO t b))
Documentation
type EventM = EventIO DoubleSource
data EventIO t a Source
show/hide Instances
runEventIO :: EventIO t a -> EventIOState t -> IO aSource
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.
runEventGraph :: (MonadEvent (EventIO t) e, Ord t, Num t, Show t) => e -> IO (EventIOState t)Source
Initialize the event queue and other stuff, run the provided "start event", and run the queue until it's empty or until the simulation is paused.
runEventGraphWithState :: (Ord t, Show t) => EventIOState t -> IO ()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.
newEventIOState :: Ord t => t -> IO (EventIOState t)Source
onClockChanged :: EventIOHandlers t -> TVar (HandlerSet (EventIO t) (t, t) ())Source
onEventDispatch :: EventIOHandlers t -> TVar (HandlerSet (EventIO t) (EventDescriptor (EventIO t) t) ())Source
onEventComplete :: EventIOHandlers t -> TVar (HandlerSet (EventIO t) (EventDescriptor (EventIO t) t) ())Source
onEventSchedule :: EventIOHandlers t -> TVar (HandlerSet (EventIO t) (EventDescriptor (EventIO t) t) ())Source
onEventCancel :: EventIOHandlers t -> TVar (HandlerSet (EventIO t) (Either EventID (EventDescriptor (EventIO t) t)) ())Source
addHandler :: HandlerAccessor t a b -> (a -> EventIO t b) -> EventIO t HandlerIDSource
Add an event handler to be called when the specified event happens.
removeHandler :: HandlerAccessor t a b -> HandlerID -> EventIO t (Maybe (a -> EventIO t b))Source
Remove an event handler given its ID, and return it if it was in the set.
Produced by Haddock version 2.4.2