-- | Haste -- Examples to introduce web programming with Haste -- Functional Programming course 2016. -- Thomas Hallgren {- This started out as a skeleton, the definitions were filled in during the lecture. -} import Haste.DOM import Haste.Events main = do hello <- newTextElem "Hello" header <- newElem "h1" appendChild header hello appendChild documentBody header text <- newTextElem "Hello world!" appendChild documentBody text input <- newElem "input" button <- newElem "input" `with` [attr "type" =: "button", attr "value" =: "Click me"] --setAttr button "type" "button" --setAttr button "value" "Click me" appendChild documentBody input appendChild documentBody button let incr _ = do s <- getProp input "value" let n = read s setProp input "value" (show (n+1)) onEvent button Click incr