@@ -4,6 +4,7 @@ module Reflex.Dom.Widget.Basic where
5import Reflex.Dom.Class
5import Reflex.Dom.Class
7+import Prelude hiding (mapM, sequence)
7import Reflex
8import Reflex
8import Reflex.Host.Class
9import Reflex.Host.Class
9import Data.Functor.Misc
10import Data.Functor.Misc
@@ -12,9 +13,10 @@ import qualified Data.Map as Map
12import Data.Set (Set)
13import Data.Set (Set)
13import qualified Data.Set as Set
14import qualified Data.Set as Set
14import Data.Dependent.Sum (DSum (..))
15import Data.Dependent.Sum (DSum (..))
16+import Data.Traversable
15import Control.Monad.Trans
17import Control.Monad.Trans
16−import Control.Monad.Reader
18+import Control.Monad.Reader hiding (forM, mapM, sequence)
17−import Control.Monad.State hiding (state)
19+import Control.Monad.State hiding (state, forM, mapM, sequence)
18import GHCJS.DOM.Node
20import GHCJS.DOM.Node
19import GHCJS.DOM.UIEvent
21import GHCJS.DOM.UIEvent
20import GHCJS.DOM.EventM (event, EventM)
22import GHCJS.DOM.EventM (event, EventM)
@@ -179,7 +181,7 @@ listWithKey vals mkChild = do
179 (result, postBuild, voidAction) <- buildChild df k v
181 (result, postBuild, voidAction) <- buildChild df k v
180 return ((result, voidAction), postBuild)
182 return ((result, voidAction), postBuild)
181 runFrameWithTriggerRef newChildrenTriggerRef $ fmap fst initialState --TODO: Do all these in a single runFrame
183 runFrameWithTriggerRef newChildrenTriggerRef $ fmap fst initialState --TODO: Do all these in a single runFrame
182− sequence_ $ fmap snd $ Map.elems initialState
184+ sequence $ fmap snd initialState
183 Just p <- liftIO $ nodeGetParentNode endPlaceholder
185 Just p <- liftIO $ nodeGetParentNode endPlaceholder
184 _ <- liftIO $ nodeInsertBefore p (Just df) (Just endPlaceholder)
186 _ <- liftIO $ nodeInsertBefore p (Just df) (Just endPlaceholder)
185 return ()
187 return ()
@@ -287,7 +289,7 @@ listViewWithKey' vals mkChild = do
287 (result, postBuild, voidAction) <- buildChild df k v
289 (result, postBuild, voidAction) <- buildChild df k v
288 return ((result, voidAction), postBuild)
290 return ((result, voidAction), postBuild)
289 runFrameWithTriggerRef newChildrenTriggerRef $ fmap fst initialState --TODO: Do all these in a single runFrame
291 runFrameWithTriggerRef newChildrenTriggerRef $ fmap fst initialState --TODO: Do all these in a single runFrame
290− sequence_ $ fmap snd $ Map.elems initialState
292+ sequence $ fmap snd initialState
291 Just p <- liftIO $ nodeGetParentNode endPlaceholder
293 Just p <- liftIO $ nodeGetParentNode endPlaceholder
292 _ <- liftIO $ nodeInsertBefore p (Just df) (Just endPlaceholder)
294 _ <- liftIO $ nodeInsertBefore p (Just df) (Just endPlaceholder)
293 return ()
295 return ()
@@ -373,7 +375,8 @@ wrapDomEventMaybe element elementOnevent getValue = do
373 e <- newEventWithTrigger $ \et -> do
375 e <- newEventWithTrigger $ \et -> do
374 unsubscribe <- {-# SCC "a" #-} liftIO $ {-# SCC "b" #-} elementOnevent element $ {-# SCC "c" #-} do
376 unsubscribe <- {-# SCC "a" #-} liftIO $ {-# SCC "b" #-} elementOnevent element $ {-# SCC "c" #-} do
375 mv <- {-# SCC "d" #-} getValue
377 mv <- {-# SCC "d" #-} getValue
376− forM_ (maybeToList mv) $ \v -> liftIO $ postGui $ runWithActions [et :=> v]
378+ forM mv $ \v -> liftIO $ postGui $ runWithActions [et :=> v]
377 return $ liftIO $ do
380 return $ liftIO $ do
378 {-# SCC "e" #-} unsubscribe
381 {-# SCC "e" #-} unsubscribe
379 return $! {-# SCC "f" #-} e
382 return $! {-# SCC "f" #-} e