| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Vgrep.Event
Event handling
An event handler is a function
handleEvent ::MonadStates m => e -> s ->Next(mRedraw)
where e is the event type and s is the state of the handler. The
Next type determines the type of action to be performed. The state
s is passed as a parameter so the handler can decide which type of
action to perform, while not being able to modify the state.
Event handlers form a Monoid where the first handler that triggers
will perform the action:
(handleSome <> handleOther) event state
is identical to
case handleSome event state of
Skip -> handleOther event state
action -> action
The type of action to be performed on an event.
Constructors
| Suspend (forall m. MonadIO m => Environment -> m ()) | Suspend the application and run the action, e. g. invoking an external process, then resume the application. |
| Halt | Shut down. |
Dispatching Events
dispatchMap :: Ord e => Map e a -> e -> Next a Source #
Special case of dispatch where actions are looked up from a map.
Re-exports
module Data.Map