essence-of-live-coding-0.2.5: General purpose live coding framework
Safe HaskellSafe-Inferred
LanguageHaskell2010

LiveCoding.Cell.NonBlocking

Synopsis

Documentation

nonBlocking Source #

Arguments

:: Typeable b 
=> Bool

Pass True to abort the computation when new data arrives. False discards new data.

-> Cell IO a b 
-> Cell (HandlingStateT IO) (Maybe a) (Maybe b) 

Wrap a cell in a non-blocking way. Every incoming sample of nonBlocking cell results in an immediate output, either Just b if the value was computed since the last poll, or Nothing if no new value was computed yet. The resulting cell can be polled by sending Nothing. The boolean flag controls whether the current computation is aborted and restarted when new data arrives.