cabal install threepenny-gui
.
Graphics.UI.Threepenny
:
string :: String -> UI Element -- a text element mkElemement :: String -> UI Elemement -- createElement (+#) :: UI Element -> [UI Element] -> UI () getBody :: Window -> UI Element -- document.body startGUI :: Config -> (Window -> UI ()) -> IO ()
Element
UI
Elements
mkButton :: String -> UI Element mkButton label = do button <- mkElement "input" button # set (attr "type") "button" button # set (attr "value") label return button
counterExample w = do input <- mkElement "input" button <- mkButton "Increment" getBody w #+ [element input,element button] let incr _ = do s <- input # get value let v = read s input # set value (show (v+1)) on click button incr
UI
IO
i
o
[i] -> [o]
IO
F hi ho
buttonF :: String -> F x Click counterF :: F Click Int displayF :: F Int x
(=<=) :: F t o -> F i t -> F i o (>+<) :: F i1 o1 -> F i2 o2 -> F (Either i1 i2) (Either o1 o2) loopLeftF :: F (Either l i) (Either l o) -> F i o
mapF :: (i->o) -> F i o filterF :: (i->Bool) -> F i i concatF :: F [i] i
stateF :: (s -> hi -> (s, [ho])) -> s -> F hi ho