Safe Haskell | None |
---|---|
Language | Haskell98 |
This module defines TriggerEvent
, which describes actions that may create
new Event
s that can be triggered from IO
.
Synopsis
- class Monad m => TriggerEvent t m | m -> t where
- newTriggerEvent :: m (Event t a, a -> IO ())
- newTriggerEventWithOnComplete :: m (Event t a, a -> IO () -> IO ())
- newEventWithLazyTriggerWithOnComplete :: ((a -> IO () -> IO ()) -> IO (IO ())) -> m (Event t a)
Documentation
class Monad m => TriggerEvent t m | m -> t where Source #
TriggerEvent
represents actions that can create Event
s that can be
triggered by IO
actions.
newTriggerEvent :: m (Event t a, a -> IO ()) Source #
Create a triggerable Event
. Whenever the resulting function is called,
the resulting Event
will fire at some point in the future. Note that
this may not be synchronous.
newTriggerEventWithOnComplete :: m (Event t a, a -> IO () -> IO ()) Source #
Like newTriggerEvent
, but the callback itself takes another callback,
to be invoked once the requested Event
occurrence has finished firing.
This allows synchronous operation.
newEventWithLazyTriggerWithOnComplete :: ((a -> IO () -> IO ()) -> IO (IO ())) -> m (Event t a) Source #
Like newTriggerEventWithOnComplete
, but with setup and teardown. This
relatively complex type signature allows any external listeners to be
subscribed lazily and then removed whenever the returned Event
is no
longer being listened to. Note that the setup/teardown may happen multiple
times, and there is no guarantee that the teardown will be executed
promptly, or even at all, in the case of program termination.