-- ByeDemo using FranTk -- Simon Guest, 21 May 2003 module Main where import FranTk byeDemo :: Component byeDemo = do -- the displayed text m <- mkBVar "Hello World" -- the count of button presses n <- mkBVar 1 -- a listener which quits on 2 quitL <- mkGUIL (\(_,i) -> if i == 2 then quit else return ()) -- the label and button beside (mkLabel [textB (bvarBehavior m)]) (mkButton [text "Bye"] (allL [tellL (bvarInput m) "Goodbye", snapshotL (bvarBehavior n) quitL, tellL (bvarUpdInput n) (+ 1)])) -- main loop main = start (render (withRootWindow [] byeDemo))