module Main where import Graphics.UI.HGUI import Data.IORef bye_form closef ~(frm :+: stRef :+: txt :+: btn) = form [title "Buy!", onclose guiMainExit] $ newIORef True (text [title "Hello World"]) <|> (fillXY . expandXY 1 1) (button [title "Bye", onclick bye]) where bye = do st <- readIORef stRef if st then do btn # setText "Goodbye" writeIORef stRef False else closef >> guiMainExit main = showForm bye_form >> guiMain