@@ -26,10 +26,14 @@ run = do
2626 b' :: Event t () <- button "Get int"
2727 res :: Event t (Maybe (), XhrResponse) <- getUnit b
2828 res' :: Event t (Maybe Int, XhrResponse) <- getInt b'
29+ score <- foldDyn (+) 0 (fmapMaybe fst res')
2930 r <- holdDyn "Waiting" $ leftmost [fmap (showXhrResponse . snd) res
3031 ,fmap (showXhrResponse . snd) res'
3132 ]
3233 dynText r
34+ el "br" $ return ()
35+ text "Total: "
36+ display score
3337
3438showXhrResponse :: XhrResponse -> String
3539showXhrResponse (XhrResponse stat stattxt rbmay rtmay) =