Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {-# LANGUAGE RecursiveDo #-}
- import Control.Applicative
- import Control.Monad
- import Data.Maybe
- import qualified Graphics.UI.Threepenny as UI
- import Graphics.UI.Threepenny.Core
- main :: IO ()
- main = startGUI defaultConfig setup
- setup :: Window -> UI ()
- setup w = mdo
- return w # set UI.title "Simple example"
- display <- UI.textarea # set UI.text "Initial value"
- listBox <- UI.listBox (pure ["first", "second"]) listB ((UI.string .) <$> (pure id))
- listB <- stepper Nothing (rumors $ UI.userSelection listBox)
- button <- UI.button # set UI.text "Button"
- cutedListB <- stepper Nothing (listB <@ UI.click button)
- element listBox # set (attr "size") "10"
- getBody w #+ [element listBox, element button, element display]
- on UI.click button $ const $ do
- element display # sink UI.text ((maybe "new text" id) <$> cutedListB)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement