Safe Haskell | None |
---|---|
Language | Haskell98 |
This module defines PerformEvent
and TriggerEvent
, which mediate the
interaction between a Reflex-based program and the external side-effecting
actions such as IO
.
Synopsis
- class (Reflex t, Monad (Performable m), Monad m) => PerformEvent t m | m -> t where
- type Performable m :: * -> *
- performEventAsync :: (TriggerEvent t m, PerformEvent t m) => Event t ((a -> IO ()) -> Performable m ()) -> m (Event t a)
Documentation
class (Reflex t, Monad (Performable m), Monad m) => PerformEvent t m | m -> t where Source #
PerformEvent
represents actions that can trigger other actions based on
Event
s.
type Performable m :: * -> * Source #
The type of action to be triggered; this is often not the same type as the triggering action.
performEvent :: Event t (Performable m a) -> m (Event t a) Source #
Perform the action contained in the given Event
whenever the Event
fires. Return the result in another Event
. Note that the output Event
will generally occur later than the input Event
, since most Performable
actions cannot be performed during Event
propagation.
performEvent_ :: Event t (Performable m ()) -> m () Source #
Like performEvent
, but do not return the result. May have slightly
better performance.
Instances
performEventAsync :: (TriggerEvent t m, PerformEvent t m) => Event t ((a -> IO ()) -> Performable m ()) -> m (Event t a) Source #
Like performEvent
, but the resulting Event
occurs only when the
callback (a -> IO ()
) is called, not when the included action finishes.
NOTE: Despite the name, performEventAsync
does not run its action in a
separate thread - although the action is free to invoke forkIO and then call
the callback whenever it is ready. This will work properly, even in GHCJS
(which fully implements concurrency even though JavaScript does not have
built in concurrency).