eve-0.1.8: An extensible event framework

Safe HaskellNone




eve :: (MonadIO m, Typeable m) => AppT AppState m () -> m AppState Source #

This runs your application like eve_, It is polymorphic in the Monad it operates over, so you may use it with any custom base monad which implements MonadIO. Upon termination of the app it returns the final AppState.

eve_ :: App () -> IO () Source #

This runs your application. It accepts an initialization block (which is the same as any other App or Action block, which registers event listeners and event providers. Note that nothing in this block should use dispatchEvent since it is possible that not all listeners have yet been registered. You can use the afterInit trigger to dispatch any events you'd like to run at start-up. Here's a simple example:

import Eve

initialize = App ()
initialize = do
  addListener_ myListener
  asyncEventProvider myProvider

startApp :: IO ()
startApp = eve_ initialize