keid-frp-banana-0.1.1.0: Reactive Banana integration for Keid engine.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Engine.ReactiveBanana

Synopsis

Network setup

allocateActuated :: MonadUnliftIO m => (UnliftIO m -> Event () -> MomentIO ()) -> ResourceT m EventNetwork Source #

Set up a network, run it and fire the started event before returning.

allocatePaused :: MonadUnliftIO m => (UnliftIO m -> MomentIO ()) -> ResourceT m EventNetwork Source #

Set up a network, passing a current context to the network-building function.

The network would pause when leaving resource region.

Event utilities

eventHandler :: (MonadResource m, MonadIO io) => ((a -> io ()) -> m ReleaseKey) -> ResourceT m (MomentIO (Event a)) Source #

Make an Event that can be fired by a callback registered in a current resource region.

debounce :: Eq a => a -> Event a -> MomentIO (Event a) Source #

Filter out successive events with the same data.

The output event will be delayed by one step due to reactimate use.

reactimateDebugShow Source #

Arguments

:: (Show a, MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) 
=> (m () -> IO ())

Unlift into application

-> Event a

Event to monitor

-> MomentIO () 

Dump event contents to application debug log.

timer Source #

Arguments

:: MonadUnliftIO m 
=> Int

Timer interval in microseconds

-> ResourceT m (MomentIO (Event Double)) 

Deprecated: Use Engine.ReactiveBanana.Timer.every

An async process that will fire monotonic timestamp events and self-adjust for the delays induced by its handling.

Engine.Worker interface

From workers to networks

observe :: MonadUnliftIO m => Var a -> ResourceT m (MomentIO (Event a)) Source #

Convert Var updates into events.

From networks to workers

pushWorkerInput :: HasInput var => var -> Event (GetInput var) -> MomentIO () Source #

Set worker input to event contents.

pushWorkerInputJust :: HasInput var => var -> Event (Maybe (GetInput var)) -> MomentIO () Source #

Set worker input to event contents, if present.

pushWorkerOutput :: HasOutput var => var -> Event (GetOutput var) -> MomentIO () Source #

Set worker output to event contents.

pushWorkerOutputJust :: HasOutput var => var -> Event (Maybe (GetOutput var)) -> MomentIO () Source #

Set worker output to event contents, if present.