git @ Cat's Eye Technologies PL-GOTO.NET / 7b4e32d
Simplify Haste driver code. Chris Pressey 1 year, 1 month ago
1 changed file(s) with 5 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
00 module Main where
11
22 import Haste
3 import Haste.DOM
4 import Haste.Events
3 import Haste.DOM (withElems, getValue, setProp)
4 import Haste.Events (onEvent, MouseEvent(Click))
55
66 import PLexceptGOTOdotNET
77
88 main = withElems ["prog", "result", "run-button"] driver
99
1010 driver [progElem, resultElem, runButtonElem] = do
11 onEvent runButtonElem Click $ \_ -> execute
12 where
13 execute = do
14 Just prog <- getValue progElem
15 setProp resultElem "textContent" $ run prog
11 onEvent runButtonElem Click $ \_ -> do
12 Just prog <- getValue progElem
13 setProp resultElem "textContent" $ run prog