Safe Haskell | None |
---|---|
Language | Haskell98 |
Synopsis
- data MomentIO a
- type Handler a = a -> IO ()
- data AddHandler a
- newAddHandler :: IO (AddHandler a, Handler a)
- fromAddHandler :: AddHandler a -> MomentIO (Event a)
- fromChanges :: a -> AddHandler a -> MomentIO (Behavior a)
- data Future a
- compile :: MomentIO () -> IO EventNetwork
- actuate :: EventNetwork -> IO ()
- pause :: EventNetwork -> IO ()
- liftIO :: MonadIO m => IO a -> m a
- changes :: Behavior a -> MomentIO (Event (Future a))
- newEvent :: MomentIO (Event a, Handler a)
- reactimate :: Event (IO ()) -> MomentIO ()
- reactimate' :: Event (Future (IO ())) -> MomentIO ()
- plainChanges :: Behavior a -> MomentIO (Event a)
Documentation
The MomentIO
monad is used to add inputs and outputs
to an event network.
Instances
Monad MomentIO | |
Functor MomentIO | |
MonadFix MomentIO | |
Defined in Reactive.Banana.Types | |
Applicative MomentIO | |
MonadIO MomentIO | |
Defined in Reactive.Banana.Types | |
MonadMoment MomentIO | |
Defined in Reactive.Banana.Types liftMoment :: Moment a -> MomentIO a # |
An event handler is a function that takes an event value and performs some computation.
data AddHandler a Source #
newAddHandler :: IO (AddHandler a, Handler a) Source #
fromAddHandler :: AddHandler a -> MomentIO (Event a) Source #
fromChanges :: a -> AddHandler a -> MomentIO (Behavior a) Source #
The Future
monad is just a helper type for the changes
function.
A value of type Future a
is only available in the context
of a reactimate
but not during event processing.
compile :: MomentIO () -> IO EventNetwork #
Compile the description of an event network
into an EventNetwork
that you can actuate
, pause
and so on.
actuate :: EventNetwork -> IO () #
Actuate an event network. The inputs will register their event handlers, so that the networks starts to produce outputs in response to input events.
pause :: EventNetwork -> IO () #
Pause an event network. Immediately stop producing output. (In a future version, it will also unregister all event handlers for inputs.) Hence, the network stops responding to input events, but it's state will be preserved.
You can resume the network with actuate
.
Note: You can stop a network even while it is processing events,
i.e. you can use pause
as an argument to reactimate
.
The network will not stop immediately though, only after
the current event has been processed completely.