@@ -99,6 +99,9 @@ dynText s = do
99 liftIO $ nodeSetNodeValue n curS
99 liftIO $ nodeSetNodeValue n curS
100 addVoidAction $ fmap (liftIO . nodeSetNodeValue n) $ updated s
100 addVoidAction $ fmap (liftIO . nodeSetNodeValue n) $ updated s
102+display :: (MonadWidget t m, Show a) => Dynamic t a -> m ()
103+display a = dynText =<< mapDyn show a
102--TODO: Should this be renamed to 'widgetView' for consistency with 'widgetHold'?
105--TODO: Should this be renamed to 'widgetView' for consistency with 'widgetHold'?
103dyn :: MonadWidget t m => Dynamic t (m a) -> m (Event t a)
106dyn :: MonadWidget t m => Dynamic t (m a) -> m (Event t a)
104dyn child = do
107dyn child = do
@@ -257,7 +260,10 @@ listWithKey' initialVals valsChanged mkChild = do
258--TODO: Something better than Dynamic t (Map k v) - we want something where the Events carry diffs, not the whole value
261--TODO: Something better than Dynamic t (Map k v) - we want something where the Events carry diffs, not the whole value
259listViewWithKey :: (Ord k, MonadWidget t m) => Dynamic t (Map k v) -> (k -> Dynamic t v -> m (Event t a)) -> m (Event t (Map k a))
262listViewWithKey :: (Ord k, MonadWidget t m) => Dynamic t (Map k v) -> (k -> Dynamic t v -> m (Event t a)) -> m (Event t (Map k a))
260−listViewWithKey vals mkChild = do
263+listViewWithKey vals mkChild = liftM (switch . fmap mergeMap) $ listViewWithKey' vals mkChild
265+listViewWithKey' :: (Ord k, MonadWidget t m) => Dynamic t (Map k v) -> (k -> Dynamic t v -> m a) -> m (Behavior t (Map k a))
266+listViewWithKey' vals mkChild = do
261 doc <- askDocument
267 doc <- askDocument
262 startPlaceholder <- text' ""
268 startPlaceholder <- text' ""
263 endPlaceholder <- text' ""
269 endPlaceholder <- text' ""
@@ -304,7 +310,7 @@ listViewWithKey vals mkChild = do
304 liftIO $ putStrLn . ("newChildrenTriggerRef is Just? " <>) . show . isJust =<< readRef newChildrenTriggerRef
310 liftIO $ putStrLn . ("newChildrenTriggerRef is Just? " <>) . show . isJust =<< readRef newChildrenTriggerRef
305 runFrameWithTriggerRef newChildrenTriggerRef newState
311 runFrameWithTriggerRef newChildrenTriggerRef newState
306 liftIO $ putStrLn "Triggering newChildren done"
312 liftIO $ putStrLn "Triggering newChildren done"
307− return $ switch $ fmap (mergeMap . fmap (fst . fst)) children
313+ return $ fmap (fmap (fst . fst)) children
309--TODO: Deduplicate the various list*WithKey* implementations
315--TODO: Deduplicate the various list*WithKey* implementations