Safe Haskell | None |
---|---|
Language | Haskell2010 |
A simple application architecture style inspired by PureScript's Pux framework.
Synopsis
- data App window state event = App {
- update :: state -> event -> Transition state event
- view :: state -> AppView window event
- inputs :: [Producer event IO ()]
- initialState :: state
- type AppView window event = Bin window event
- data Transition state event
- = Transition state (IO (Maybe event))
- | Exit
- run :: (Typeable event, IsWindow window, IsBin window) => App window state event -> IO state
- runLoop :: (Typeable event, IsWindow window, IsBin window) => App window state event -> IO state
Documentation
data App window state event Source #
Describes an state reducer application.
App | |
|
data Transition state event Source #
The result of applying the update
function, deciding if and how to
transition to the next state.
Transition state (IO (Maybe event)) | |
Exit | Exit the application. |
:: (Typeable event, IsWindow window, IsBin window) | |
=> App window state event | Application to run |
-> IO state |
Initialize GTK and run the application in it. This is a
convenience function that is highly recommended. If you need more
flexibility, e.g. to set up GTK+ yourself, use runLoop
instead.
runLoop :: (Typeable event, IsWindow window, IsBin window) => App window state event -> IO state Source #
Run an App
. This IO action will loop, so run it in a separate thread
using async
if you're calling it before the GTK main loop.
void $ Gtk.init Nothing void . async $ do runLoop app -- In case the run loop exits, quit the main GTK loop. Gtk.mainQuit Gtk.main