Updater-0.3: Monadic FRP library based on stm

Safe HaskellNone
LanguageHaskell98

Updater.Internal

Synopsis

Documentation

newtype Event a Source

Push based Updater.

Constructors

Event 

Fields

getEvent' :: Updater a
 

newtype Behavior a Source

Pull based Updater

Constructors

Behavior 

Fields

getBehavior' :: Updater a
 

newtype Updater a Source

This monad works very similar to a continuation monad on top of stm. You can do any basic stm computation you want simply using liftSTM. However, if you use getEvent everything after that call will be executed everytime the Signal given to getEvent is changed.

You can also use the Alternative instance to make a union of events.

You can also use the Applicative instance to run two things 'parallel'. Parallel meaning that events on one side will not cause the other side to be reevaluated completely.

Constructors

Updater 

Fields

runUpdater' :: (a -> DownState -> IO UpState) -> DownState -> IO UpState
 

newEvent' :: IO (Updater a, a -> IO ()) Source

runUpdater :: Updater (Either (IO ()) res) -> IO res Source

unsafeLiftIO :: IO a -> Behavior a Source

Don't execute the io-action returned by newEvent. Also, fork; don't block.

debug :: String -> Behavior () Source

Just for some quick debugging

putLine = unsafeLiftIO . putStrLn

debugCleanup :: String -> Behavior () Source

This can be useful to spot when listeners are removed.

data UpState Source

Constructors

UpState 

Fields

stateOnCleanup :: IO ()
 
stateOnCommit :: IO ()
 

Instances

data DownState Source

Constructors

DownState