summaryrefslogtreecommitdiff
path: root/Tut.hs
blob: 0ae54943d1e0855bab807c0bfcc5cdaa79abf7ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{-# LANGUAGE OverloadedLabels  #-}
{-# LANGUAGE OverloadedLists   #-}
{-# LANGUAGE OverloadedStrings #-}
module Main where

import qualified GI.Gtk                        as Gtk
import           GI.Gtk.Declarative
import           GI.Gtk.Declarative.App.Simple

type State = ()

data Event = Closed

view' :: State -> AppView Gtk.Window Event
view' _ = bin
    Gtk.Window
    [ #title := "Demo"
    , on #deleteEvent $ {- GI.Gdk.Unions.Event.Event -> (Bool, Event) -} \_ -> (True,Closed)
    ]
    $ widget Gtk.Label [#label := "Hello, World!"]

update' :: State -> Event -> Transition State Event
update' _ Closed = Exit

main :: IO ()
main = run App
    -- :: App Gtk.Window State Event
    { view         = view'
    , update       = update'
    , inputs       = []
    , initialState = ()
    }