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

Engine.ReactiveBanana.Stateful

Description

"Crank the world"-style stateful process.

An input event comes in, an update step runs and an output event is fired.

Synopsis
  • setup :: MonadMoment m => m acc -> (a -> acc -> (x, acc)) -> Event a -> m (Event x, Behavior acc)
  • runWorldWith :: forall world update s. (world -> ST s (Thaw world s)) -> (Thaw world s -> ST s world) -> world -> (Thaw world s -> ST s update) -> ST s (update, world)
  • type family Thaw world s

Documentation

setup Source #

Arguments

:: MonadMoment m 
=> m acc

An action to produce the initial stat

-> (a -> acc -> (x, acc))

Step function

-> Event a

Step event

-> m (Event x, Behavior acc)

A post-step event and a current state snapshot

runWorldWith Source #

Arguments

:: forall world update s. (world -> ST s (Thaw world s))

Thaw the world into STRefs

-> (Thaw world s -> ST s world)

Read the world STRefs and freeze

-> world

Previous world snapshot

-> (Thaw world s -> ST s update)

Update procedure yielding a result and a new world snapshot

-> ST s (update, world) 

type family Thaw world s Source #

A helper to connect a world snapshot with its dynamic representation under an existential s.