gi-gtk-declarative-app-simple-0.5.0: Declarative GTK+ programming in Haskell in the style of Pux.

Safe HaskellNone



A simple application architecture style inspired by PureScript's Pux framework.



data App window state event Source #

Describes an state reducer application.




  • update :: state -> event -> Transition state event

    The update function of an application reduces the current state and a new event to a Transition, which decides if and how to transition to the next state.

  • view :: state -> AppView window event

    The view renders a state value as a window, parameterized by the Apps event type.

  • inputs :: [Producer event IO ()]

    Inputs are pipes Producers that feed events into the application.

  • initialState :: state

    The initial state value of the state reduction loop.

type AppView window event = Bin window event Source #

The top-level widget for the view function of an App, requiring a GTK+ Window.

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 the application.

run Source #


:: (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.