on develop help sign in
Merge branch 'develop' into ghcjs-improved-base-2
8c28c87Ryan 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+5−5
@@ -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
@@ -22,10 +22,10 @@ library
22 hs-source-dirs: src
22 hs-source-dirs: src
23 build-depends:
23 build-depends:
24 base >= 4.7 && < 4.9,
24 base >= 4.7 && < 4.9,
25− reflex == 0.3.*,
25+ reflex == 0.4.*,
26+ dependent-sum == 0.3.*,
26− dependent-sum == 0.2.*,
27+ dependent-map == 0.2.*,
27− dependent-map == 0.1.*,
28− semigroups >= 0.16 && < 0.18,
28+ semigroups >= 0.16 && < 0.19,
29 mtl >= 2.1 && < 2.3,
29 mtl >= 2.1 && < 2.3,
30 containers == 0.5.*,
30 containers == 0.5.*,
31 these >= 0.4 && < 0.7,
31 these >= 0.4 && < 0.7,
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/Time.hs+1−1
@@ -63,7 +63,7 @@ delay dt e = performEventAsync $ ffor e $ \a cb -> liftIO $ void $ forkIO $ do
63 threadDelay $ ceiling $ dt * 1000000
63 threadDelay $ ceiling $ dt * 1000000
64 cb a
64 cb a
65
65
66−-- | Block occurrences of an Event until th given number of seconds elapses without
66+-- | Block occurrences of an Event until the given number of seconds elapses without
67-- the Event firing, at which point the last occurrence of the Event will fire.
67-- the Event firing, at which point the last occurrence of the Event will fire.
68debounce :: MonadWidget t m => NominalDiffTime -> Event t a -> m (Event t a)
68debounce :: MonadWidget t m => NominalDiffTime -> Event t a -> m (Event t a)
69debounce dt e = do
69debounce dt e = do
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
@@ -608,7 +608,7 @@ wrapDomEventsMaybe element handlers = do
608 e <- newFanEventWithTrigger $ \(WrapArg en) et -> do
608 e <- newFanEventWithTrigger $ \(WrapArg en) et -> do
609 unsubscribe <- onEventName en element $ do
609 unsubscribe <- onEventName en element $ do
610 mv <- handlers en
610 mv <- handlers en
611− forM_ mv $ \v -> liftIO $ postGui $ runWithActions [et :=> v]
611+ forM_ mv $ \v -> liftIO $ postGui $ runWithActions [et :=> Identity v]
612 return $ liftIO $ do
612 return $ liftIO $ do
613 unsubscribe
613 unsubscribe
614 return $! e
614 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 <- on e blurEvent $ liftIO $ do
62 unsubscribeOnblur <- on e blurEvent $ liftIO $ do
63− postGui $ runWithActions [eChangeFocusTrigger :=> False]
63+ postGui $ runWithActions [eChangeFocusTrigger :=> Identity False]
64 unsubscribeOnfocus <- on e focusEvent $ liftIO $ do
64 unsubscribeOnfocus <- on e focusEvent $ 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 (`on` keyPress) getKeyEvent
68 eKeypress <- wrapDomEvent e (`on` keyPress) 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 <- on e blurEvent $ liftIO $ do
104 unsubscribeOnblur <- on e blurEvent $ liftIO $ do
105− postGui $ runWithActions [eChangeFocusTrigger :=> False]
105+ postGui $ runWithActions [eChangeFocusTrigger :=> Identity False]
106 unsubscribeOnfocus <- on e focusEvent $ liftIO $ do
106 unsubscribeOnfocus <- on e focusEvent $ 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 (TextArea.setValue e . Just) eSet
109 performEvent_ $ fmap (TextArea.setValue e . Just) eSet
110 f <- holdDyn False eChangeFocus
110 f <- holdDyn False eChangeFocus