on develop help sign in
Merge pull request #44 from ryantrinkle/cale-develop-new-dmap
21627c8Ryan Trinkle
default.nix+1−1
@@ -7,7 +7,7 @@
7
7
8mkDerivation {
8mkDerivation {
9 pname = "reflex-dom";
9 pname = "reflex-dom";
10− version = "0.2";
10+ version = "0.3";
11 src = builtins.filterSource (path: type: baseNameOf path != ".git") ./.;
11 src = builtins.filterSource (path: type: baseNameOf path != ".git") ./.;
12 buildDepends = [
12 buildDepends = [
13 reflex
13 reflex
reflex-dom.cabal+4−4
@@ -1,5 +1,5 @@
1Name: reflex-dom
1Name: reflex-dom
2−Version: 0.2
2+Version: 0.3
3Synopsis: Functional Reactive Web Apps with Reflex
3Synopsis: Functional Reactive Web Apps with Reflex
4Description: Reflex-DOM is a Functional Reactive web framework based on the Reflex FRP engine
4Description: Reflex-DOM is a Functional Reactive web framework based on the Reflex FRP engine
5License: BSD3
5License: BSD3
@@ -20,9 +20,9 @@ library
20 hs-source-dirs: src
20 hs-source-dirs: src
21 build-depends:
21 build-depends:
22 base >= 4.7 && < 4.9,
22 base >= 4.7 && < 4.9,
23− reflex == 0.3.*,
23+ reflex == 0.4.*,
24+ dependent-sum == 0.3.*,
24− dependent-sum == 0.2.*,
25+ dependent-map == 0.2.*,
25− dependent-map == 0.1.*,
26 semigroups == 0.16.*,
26 semigroups == 0.16.*,
27 mtl >= 2.1 && < 2.3,
27 mtl >= 2.1 && < 2.3,
28 containers == 0.5.*,
28 containers == 0.5.*,
src/Reflex/Dom/Class.hs+3−3
@@ -77,13 +77,13 @@ instance MonadIORestore m => MonadIORestore (ReaderT r m) where
77
77
78class (MonadRef h, Ref h ~ Ref m, MonadRef m) => HasPostGui t h m | m -> t h where
78class (MonadRef h, Ref h ~ Ref m, MonadRef m) => HasPostGui t h m | m -> t h where
79 askPostGui :: m (h () -> IO ())
79 askPostGui :: m (h () -> IO ())
80− askRunWithActions :: m ([DSum (EventTrigger t)] -> h ())
80+ askRunWithActions :: m ([DSum (EventTrigger t) Identity] -> h ())
81
81
82runFrameWithTriggerRef :: (HasPostGui t h m, MonadRef m, MonadIO m) => Ref m (Maybe (EventTrigger t a)) -> a -> m ()
82runFrameWithTriggerRef :: (HasPostGui t h m, MonadRef m, MonadIO m) => Ref m (Maybe (EventTrigger t a)) -> a -> m ()
83runFrameWithTriggerRef r a = do
83runFrameWithTriggerRef r a = do
84 postGui <- askPostGui
84 postGui <- askPostGui
85 runWithActions <- askRunWithActions
85 runWithActions <- askRunWithActions
86− liftIO . postGui $ mapM_ (\t -> runWithActions [t :=> a]) =<< readRef r
86+ liftIO . postGui $ mapM_ (\t -> runWithActions [t :=> Identity a]) =<< readRef r
87
87
88instance HasPostGui t h m => HasPostGui t h (ReaderT r m) where
88instance HasPostGui t h m => HasPostGui t h (ReaderT r m) where
89 askPostGui = lift askPostGui
89 askPostGui = lift askPostGui
@@ -126,7 +126,7 @@ performEventAsync e = do
126 addVoidAction $ ffor e $ \o -> do
126 addVoidAction $ ffor e $ \o -> do
127 postGui <- askPostGui
127 postGui <- askPostGui
128 runWithActions <- askRunWithActions
128 runWithActions <- askRunWithActions
129− o $ \a -> postGui $ mapM_ (\t -> runWithActions [t :=> a]) =<< readRef reResultTrigger
129+ o $ \a -> postGui $ mapM_ (\t -> runWithActions [t :=> Identity a]) =<< readRef reResultTrigger
130 return eResult
130 return eResult
131
131
132getPostBuild :: MonadWidget t m => m (Event t ())
132getPostBuild :: MonadWidget t m => m (Event t ())
src/Reflex/Dom/Internal.hs+1−1
@@ -33,7 +33,7 @@ import Data.Monoid ((<>))
33data GuiEnv t h
33data GuiEnv t h
34 = GuiEnv { _guiEnvDocument :: !HTMLDocument
34 = GuiEnv { _guiEnvDocument :: !HTMLDocument
35 , _guiEnvPostGui :: !(h () -> IO ())
35 , _guiEnvPostGui :: !(h () -> IO ())
36− , _guiEnvRunWithActions :: !([DSum (EventTrigger t)] -> h ())
36+ , _guiEnvRunWithActions :: !([DSum (EventTrigger t) Identity] -> h ())
37 , _guiEnvWebView :: !WebView
37 , _guiEnvWebView :: !WebView
38 }
38 }
39
39
src/Reflex/Dom/WebSocket.hs+2−2
@@ -44,10 +44,10 @@ webSocket url config = do
44 let onMessage :: ByteString -> IO ()
44 let onMessage :: ByteString -> IO ()
45 onMessage m = postGui $ do
45 onMessage m = postGui $ do
46 mt <- readRef eRecvTriggerRef
46 mt <- readRef eRecvTriggerRef
47− forM_ mt $ \t -> runWithActions [t :=> m]
47+ forM_ mt $ \t -> runWithActions [t :=> Identity m]
48 onOpen = postGui $ do
48 onOpen = postGui $ do
49 mt <- readRef eOpenTriggerRef
49 mt <- readRef eOpenTriggerRef
50− forM_ mt $ \t -> runWithActions [t :=> ()]
50+ forM_ mt $ \t -> runWithActions [t :=> Identity ()]
51 start = do
51 start = do
52 ws <- liftIO $ newWebSocket wv url onMessage onOpen $ do
52 ws <- liftIO $ newWebSocket wv url onMessage onOpen $ do
53 void $ forkIO $ do --TODO: Is the fork necessary, or do event handlers run in their own threads automatically?
53 void $ forkIO $ do --TODO: Is the fork necessary, or do event handlers run in their own threads automatically?
src/Reflex/Dom/Widget/Basic.hs+2−2
@@ -353,7 +353,7 @@ wrapDomEventMaybe element elementOnevent getValue = do
353 e <- newEventWithTrigger $ \et -> do
353 e <- newEventWithTrigger $ \et -> do
354 unsubscribe <- {-# SCC "a" #-} liftIO $ {-# SCC "b" #-} elementOnevent element $ {-# SCC "c" #-} do
354 unsubscribe <- {-# SCC "a" #-} liftIO $ {-# SCC "b" #-} elementOnevent element $ {-# SCC "c" #-} do
355 mv <- {-# SCC "d" #-} getValue
355 mv <- {-# SCC "d" #-} getValue
356− forM_ mv $ \v -> liftIO $ postGui $ runWithActions [et :=> v]
356+ forM_ mv $ \v -> liftIO $ postGui $ runWithActions [et :=> Identity v]
357 return $ liftIO $ do
357 return $ liftIO $ do
358 {-# SCC "e" #-} unsubscribe
358 {-# SCC "e" #-} unsubscribe
359 return $! {-# SCC "f" #-} e
359 return $! {-# SCC "f" #-} e
@@ -606,7 +606,7 @@ wrapDomEventsMaybe element handlers = do
606 e <- newFanEventWithTrigger $ \(WrapArg en) et -> do
606 e <- newFanEventWithTrigger $ \(WrapArg en) et -> do
607 unsubscribe <- liftIO $ (onEventName en) element $ do
607 unsubscribe <- liftIO $ (onEventName en) element $ do
608 mv <- handlers en
608 mv <- handlers en
609− forM_ mv $ \v -> liftIO $ postGui $ runWithActions [et :=> v]
609+ forM_ mv $ \v -> liftIO $ postGui $ runWithActions [et :=> Identity v]
610 return $ liftIO $ do
610 return $ liftIO $ do
611 unsubscribe
611 unsubscribe
612 return $! e
612 return $! e
src/Reflex/Dom/Widget/Input.hs+4−4
@@ -60,9 +60,9 @@ textInput (TextInputConfig inputType initial eSetValue dAttrs) = do
60 runWithActions <- askRunWithActions
60 runWithActions <- askRunWithActions
61 eChangeFocus <- newEventWithTrigger $ \eChangeFocusTrigger -> do
61 eChangeFocus <- newEventWithTrigger $ \eChangeFocusTrigger -> do
62 unsubscribeOnblur <- liftIO $ elementOnblur e $ liftIO $ do
62 unsubscribeOnblur <- liftIO $ elementOnblur e $ liftIO $ do
63− postGui $ runWithActions [eChangeFocusTrigger :=> False]
63+ postGui $ runWithActions [eChangeFocusTrigger :=> Identity False]
64 unsubscribeOnfocus <- liftIO $ elementOnfocus e $ liftIO $ do
64 unsubscribeOnfocus <- liftIO $ elementOnfocus e $ liftIO $ do
65− postGui $ runWithActions [eChangeFocusTrigger :=> True]
65+ postGui $ runWithActions [eChangeFocusTrigger :=> Identity True]
66 return $ liftIO $ unsubscribeOnblur >> unsubscribeOnfocus
66 return $ liftIO $ unsubscribeOnblur >> unsubscribeOnfocus
67 dFocus <- holdDyn False eChangeFocus
67 dFocus <- holdDyn False eChangeFocus
68 eKeypress <- wrapDomEvent e elementOnkeypress getKeyEvent
68 eKeypress <- wrapDomEvent e elementOnkeypress getKeyEvent
@@ -102,9 +102,9 @@ textArea (TextAreaConfig initial eSet attrs) = do
102 runWithActions <- askRunWithActions
102 runWithActions <- askRunWithActions
103 eChangeFocus <- newEventWithTrigger $ \eChangeFocusTrigger -> do
103 eChangeFocus <- newEventWithTrigger $ \eChangeFocusTrigger -> do
104 unsubscribeOnblur <- liftIO $ elementOnblur e $ liftIO $ do
104 unsubscribeOnblur <- liftIO $ elementOnblur e $ liftIO $ do
105− postGui $ runWithActions [eChangeFocusTrigger :=> False]
105+ postGui $ runWithActions [eChangeFocusTrigger :=> Identity False]
106 unsubscribeOnfocus <- liftIO $ elementOnfocus e $ liftIO $ do
106 unsubscribeOnfocus <- liftIO $ elementOnfocus e $ liftIO $ do
107− postGui $ runWithActions [eChangeFocusTrigger :=> True]
107+ postGui $ runWithActions [eChangeFocusTrigger :=> Identity True]
108 return $ liftIO $ unsubscribeOnblur >> unsubscribeOnfocus
108 return $ liftIO $ unsubscribeOnblur >> unsubscribeOnfocus
109 performEvent_ $ fmap (liftIO . htmlTextAreaElementSetValue e) eSet
109 performEvent_ $ fmap (liftIO . htmlTextAreaElementSetValue e) eSet
110 f <- holdDyn False eChangeFocus
110 f <- holdDyn False eChangeFocus