summaryrefslogtreecommitdiff
path: root/Tut.hs
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2019-04-07 02:53:16 -0400
committerJoe Crayne <joe@jerkface.net>2019-04-07 02:53:16 -0400
commit483ffac7da055342598b44800e69ee5217cb47cd (patch)
treef2c5780ea4bbcbfd443a3c77cd789d34905e2d90 /Tut.hs
initial commit
Diffstat (limited to 'Tut.hs')
-rw-r--r--Tut.hs32
1 files changed, 32 insertions, 0 deletions
diff --git a/Tut.hs b/Tut.hs
new file mode 100644
index 0000000..0ae5494
--- /dev/null
+++ b/Tut.hs
@@ -0,0 +1,32 @@
1{-# LANGUAGE OverloadedLabels #-}
2{-# LANGUAGE OverloadedLists #-}
3{-# LANGUAGE OverloadedStrings #-}
4module Main where
5
6import qualified GI.Gtk as Gtk
7import GI.Gtk.Declarative
8import GI.Gtk.Declarative.App.Simple
9
10type State = ()
11
12data Event = Closed
13
14view' :: State -> AppView Gtk.Window Event
15view' _ = bin
16 Gtk.Window
17 [ #title := "Demo"
18 , on #deleteEvent $ {- GI.Gdk.Unions.Event.Event -> (Bool, Event) -} \_ -> (True,Closed)
19 ]
20 $ widget Gtk.Label [#label := "Hello, World!"]
21
22update' :: State -> Event -> Transition State Event
23update' _ Closed = Exit
24
25main :: IO ()
26main = run App
27 -- :: App Gtk.Window State Event
28 { view = view'
29 , update = update'
30 , inputs = []
31 , initialState = ()
32 }