on develop help sign in
Merge branch 'ts-hydration' of github.com:reflex-frp/reflex-dom into ts-hydration
8d28de3Tom Smalley
reflex-dom-core/default.nix+6−2
@@ -8,9 +8,13 @@
8, random, ref-tf, reflex, semigroups, silently, stdenv, stm
8, random, ref-tf, reflex, semigroups, silently, stdenv, stm
9, template-haskell, temporary, text, these, transformers, unix, wai
9, template-haskell, temporary, text, these, transformers, unix, wai
10, wai-websockets, warp, webdriver, websockets, zenc
10, wai-websockets, warp, webdriver, websockets, zenc
11−, ghc, iproute, chromium, hashable, selenium-server-standalone, which
11+, ghc, iproute, chromium, hashable, selenium-server-standalone, which, fontconfig
12}:
12}:
13−let addGcTestDepends = drv: if stdenv.system != "x86_64-linux" then drv else drv // {
13+let addGcTestDepends = drv: if (stdenv.system != "x86_64-linux" || stdenv.hostPlatform != stdenv.buildPlatform || (ghc.isGhcjs or false)) then drv else drv // {
14+ # The headless browser run as part of gc tests would hang/crash without this
15+ preCheck = ''
16+ export FONTCONFIG_PATH=${fontconfig.out}/etc/fonts
17+ '';
14 testHaskellDepends = (drv.testHaskellDepends or []) ++ [ temporary jsaddle-warp process linux-namespaces ];
18 testHaskellDepends = (drv.testHaskellDepends or []) ++ [ temporary jsaddle-warp process linux-namespaces ];
15 testSystemDepends = (drv.testSystemDepends or []) ++ [ chromium iproute ];
19 testSystemDepends = (drv.testSystemDepends or []) ++ [ chromium iproute ];
16 };
20 };
reflex-dom-core/reflex-dom-core.cabal+1−1
@@ -210,7 +210,7 @@ test-suite gc
210 ghc-prof-options: -fprof-auto -optP-DPROFILING
210 ghc-prof-options: -fprof-auto -optP-DPROFILING
211 main-is: gc.hs
211 main-is: gc.hs
212 type: exitcode-stdio-1.0
212 type: exitcode-stdio-1.0
213− if !os(linux) || !arch(x86_64) || impl(ghc >= 8.4.0)
213+ if !os(linux) || !arch(x86_64)
214 buildable: False
214 buildable: False
215
215
216source-repository head
216source-repository head
reflex-dom-core/src/Reflex/Dom/Builder/Class.hs+7−7
@@ -436,7 +436,7 @@ concat <$> mapM (uncurry makeLensesWithoutField)
436#endif
436#endif
437
437
438-- | This lens is technically illegal. The implementation of 'TextNodeConfig' uses a 'Maybe' under the hood for efficiency reasons. However, always interacting with 'TextNodeConfig' via lenses will always behave correctly, and if you pattern match on it, you should always treat 'Nothing' as 'never'.
438-- | This lens is technically illegal. The implementation of 'TextNodeConfig' uses a 'Maybe' under the hood for efficiency reasons. However, always interacting with 'TextNodeConfig' via lenses will always behave correctly, and if you pattern match on it, you should always treat 'Nothing' as 'never'.
439−textNodeConfig_setContents :: Reflex t => Lens (TextNodeConfig t) (TextNodeConfig t) (Event t Text) (Event t Text)
439+textNodeConfig_setContents :: Reflex t => Lens' (TextNodeConfig t) (Event t Text)
440textNodeConfig_setContents =
440textNodeConfig_setContents =
441 let getter = fromMaybe never . _textNodeConfig_setContents
441 let getter = fromMaybe never . _textNodeConfig_setContents
442 setter t e = t { _textNodeConfig_setContents = Just e }
442 setter t e = t { _textNodeConfig_setContents = Just e }
@@ -450,42 +450,42 @@ commentNodeConfig_setContents =
450 in lens getter setter
450 in lens getter setter
451
451
452-- | This lens is technically illegal. The implementation of 'InputElementConfig' uses a 'Maybe' under the hood for efficiency reasons. However, always interacting with 'InputElementConfig' via lenses will always behave correctly, and if you pattern match on it, you should always treat 'Nothing' as 'never'.
452-- | This lens is technically illegal. The implementation of 'InputElementConfig' uses a 'Maybe' under the hood for efficiency reasons. However, always interacting with 'InputElementConfig' via lenses will always behave correctly, and if you pattern match on it, you should always treat 'Nothing' as 'never'.
453−inputElementConfig_setValue :: Reflex t => Lens (InputElementConfig er t m) (InputElementConfig er t m) (Event t Text) (Event t Text)
453+inputElementConfig_setValue :: Reflex t => Lens' (InputElementConfig er t m) (Event t Text)
454inputElementConfig_setValue =
454inputElementConfig_setValue =
455 let getter = fromMaybe never . _inputElementConfig_setValue
455 let getter = fromMaybe never . _inputElementConfig_setValue
456 setter t e = t { _inputElementConfig_setValue = Just e }
456 setter t e = t { _inputElementConfig_setValue = Just e }
457 in lens getter setter
457 in lens getter setter
458
458
459-- | This lens is technically illegal. The implementation of 'InputElementConfig' uses a 'Maybe' under the hood for efficiency reasons. However, always interacting with 'InputElementConfig' via lenses will always behave correctly, and if you pattern match on it, you should always treat 'Nothing' as 'never'.
459-- | This lens is technically illegal. The implementation of 'InputElementConfig' uses a 'Maybe' under the hood for efficiency reasons. However, always interacting with 'InputElementConfig' via lenses will always behave correctly, and if you pattern match on it, you should always treat 'Nothing' as 'never'.
460−inputElementConfig_setChecked :: Reflex t => Lens (InputElementConfig er t m) (InputElementConfig er t m) (Event t Bool) (Event t Bool)
460+inputElementConfig_setChecked :: Reflex t => Lens' (InputElementConfig er t m) (Event t Bool)
461inputElementConfig_setChecked =
461inputElementConfig_setChecked =
462 let getter = fromMaybe never . _inputElementConfig_setChecked
462 let getter = fromMaybe never . _inputElementConfig_setChecked
463 setter t e = t { _inputElementConfig_setChecked = Just e }
463 setter t e = t { _inputElementConfig_setChecked = Just e }
464 in lens getter setter
464 in lens getter setter
465
465
466-- | This lens is technically illegal. The implementation of 'RawElementConfig' uses a 'Maybe' under the hood for efficiency reasons. However, always interacting with 'RawElementConfig' via lenses will always behave correctly, and if you pattern match on it, you should always treat 'Nothing' as 'never'.
466-- | This lens is technically illegal. The implementation of 'RawElementConfig' uses a 'Maybe' under the hood for efficiency reasons. However, always interacting with 'RawElementConfig' via lenses will always behave correctly, and if you pattern match on it, you should always treat 'Nothing' as 'never'.
467−rawElementConfig_modifyAttributes :: Reflex t => Lens (RawElementConfig er t m) (RawElementConfig er t m) (Event t (Map AttributeName (Maybe Text))) (Event t (Map AttributeName (Maybe Text)))
467+rawElementConfig_modifyAttributes :: Reflex t => Lens' (RawElementConfig er t m) (Event t (Map AttributeName (Maybe Text)))
468rawElementConfig_modifyAttributes =
468rawElementConfig_modifyAttributes =
469 let getter = fromMaybe never . _rawElementConfig_modifyAttributes
469 let getter = fromMaybe never . _rawElementConfig_modifyAttributes
470 setter t e = t { _rawElementConfig_modifyAttributes = Just e }
470 setter t e = t { _rawElementConfig_modifyAttributes = Just e }
471 in lens getter setter
471 in lens getter setter
472
472
473-- | This lens is technically illegal. The implementation of 'RawElementConfig' uses a 'Maybe' under the hood for efficiency reasons. However, always interacting with 'RawElementConfig' via lenses will always behave correctly, and if you pattern match on it, you should always treat 'Nothing' as 'never'.
473-- | This lens is technically illegal. The implementation of 'RawElementConfig' uses a 'Maybe' under the hood for efficiency reasons. However, always interacting with 'RawElementConfig' via lenses will always behave correctly, and if you pattern match on it, you should always treat 'Nothing' as 'never'.
474−elementConfig_modifyAttributes :: Reflex t => Lens (ElementConfig er t m) (ElementConfig er t m) (Event t (Map AttributeName (Maybe Text))) (Event t (Map AttributeName (Maybe Text)))
474+elementConfig_modifyAttributes :: Reflex t => Lens' (ElementConfig er t m) (Event t (Map AttributeName (Maybe Text)))
475elementConfig_modifyAttributes =
475elementConfig_modifyAttributes =
476 let getter = fromMaybe never . _elementConfig_modifyAttributes
476 let getter = fromMaybe never . _elementConfig_modifyAttributes
477 setter t e = t { _elementConfig_modifyAttributes = Just e }
477 setter t e = t { _elementConfig_modifyAttributes = Just e }
478 in lens getter setter
478 in lens getter setter
479
479
480-- | This lens is technically illegal. The implementation of 'TextAreaElementConfig' uses a 'Maybe' under the hood for efficiency reasons. However, always interacting with 'TextAreaElementConfig' via lenses will always behave correctly, and if you pattern match on it, you should always treat 'Nothing' as 'never'.
480-- | This lens is technically illegal. The implementation of 'TextAreaElementConfig' uses a 'Maybe' under the hood for efficiency reasons. However, always interacting with 'TextAreaElementConfig' via lenses will always behave correctly, and if you pattern match on it, you should always treat 'Nothing' as 'never'.
481−textAreaElementConfig_setValue :: Reflex t => Lens (TextAreaElementConfig er t m) (TextAreaElementConfig er t m) (Event t Text) (Event t Text)
481+textAreaElementConfig_setValue :: Reflex t => Lens' (TextAreaElementConfig er t m) (Event t Text)
482textAreaElementConfig_setValue =
482textAreaElementConfig_setValue =
483 let getter = fromMaybe never . _textAreaElementConfig_setValue
483 let getter = fromMaybe never . _textAreaElementConfig_setValue
484 setter t e = t { _textAreaElementConfig_setValue = Just e }
484 setter t e = t { _textAreaElementConfig_setValue = Just e }
485 in lens getter setter
485 in lens getter setter
486
486
487-- | This lens is technically illegal. The implementation of 'SelectElementConfig' uses a 'Maybe' under the hood for efficiency reasons. However, always interacting with 'SelectElementConfig' via lenses will always behave correctly, and if you pattern match on it, you should always treat 'Nothing' as 'never'.
487-- | This lens is technically illegal. The implementation of 'SelectElementConfig' uses a 'Maybe' under the hood for efficiency reasons. However, always interacting with 'SelectElementConfig' via lenses will always behave correctly, and if you pattern match on it, you should always treat 'Nothing' as 'never'.
488−selectElementConfig_setValue :: Reflex t => Lens (SelectElementConfig er t m) (SelectElementConfig er t m) (Event t Text) (Event t Text)
488+selectElementConfig_setValue :: Reflex t => Lens' (SelectElementConfig er t m) (Event t Text)
489selectElementConfig_setValue =
489selectElementConfig_setValue =
490 let getter = fromMaybe never . _selectElementConfig_setValue
490 let getter = fromMaybe never . _selectElementConfig_setValue
491 setter t e = t { _selectElementConfig_setValue = Just e }
491 setter t e = t { _selectElementConfig_setValue = Just e }
reflex-dom-core/src/Reflex/Dom/Core.hs+4
@@ -1,3 +1,7 @@
1+-- Disable haddocks on this module due to a bug on haddocks when selectively
2+-- reexporting on ghc > 8.2.
3+-- https://github.com/haskell/haddock/issues/979
4+{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-}
1module Reflex.Dom.Core (module X) where
5module Reflex.Dom.Core (module X) where
2
6
3import Reflex as X hiding (askEvents)
7import Reflex as X hiding (askEvents)
reflex-dom-core/src/Reflex/Dom/Xhr.hs+1−1
@@ -215,7 +215,7 @@ _xhrResponse_body :: XhrResponse -> Maybe Text
215_xhrResponse_body = _xhrResponse_responseText
215_xhrResponse_body = _xhrResponse_responseText
216
216
217{-# DEPRECATED xhrResponse_body "Use xhrResponse_response or xhrResponse_responseText instead." #-}
217{-# DEPRECATED xhrResponse_body "Use xhrResponse_response or xhrResponse_responseText instead." #-}
218−xhrResponse_body :: Lens XhrResponse XhrResponse (Maybe Text) (Maybe Text)
218+xhrResponse_body :: Lens' XhrResponse (Maybe Text)
219xhrResponse_body = lens _xhrResponse_responseText (\r t -> r { _xhrResponse_responseText = t })
219xhrResponse_body = lens _xhrResponse_responseText (\r t -> r { _xhrResponse_responseText = t })
220
220
221instance a ~ () => Default (XhrRequestConfig a) where
221instance a ~ () => Default (XhrRequestConfig a) where
reflex-dom-core/test/gc.hs+10−2
@@ -8,7 +8,6 @@ import Control.Exception
8import Control.Monad
8import Control.Monad
9import Control.Monad.IO.Class
9import Control.Monad.IO.Class
10import Data.Int
10import Data.Int
11−import GHC.Stats
12import Language.Javascript.JSaddle.Warp
11import Language.Javascript.JSaddle.Warp
13import Reflex.Dom.Core
12import Reflex.Dom.Core
14import Reflex.Time
13import Reflex.Time
@@ -19,6 +18,15 @@ import System.Mem
19import System.Posix
18import System.Posix
20import System.Process
19import System.Process
21
20
21+#if MIN_VERSION_base(4,11,0)
22+import GHC.Stats (getRTSStatsEnabled, getRTSStats, RTSStats(..), gcdetails_live_bytes, gc)
23+currentBytesUsed :: RTSStats -> Int64
24+currentBytesUsed = fromIntegral . gcdetails_live_bytes . gc
25+#else
26+import GHC.Stats (getGCStats, GCStats(..))
27+getRTSStats = getGCStats
28+#endif
29+
22-- In initial testing, the minimum live bytes count was 233128 and maximum was
30-- In initial testing, the minimum live bytes count was 233128 and maximum was
23-- 363712. Going over the maximum means the test has actually failed - we
31-- 363712. Going over the maximum means the test has actually failed - we
24-- probably have a memory leak; going under the minimum doesn't indicate a
32-- probably have a memory leak; going under the minimum doesn't indicate a
@@ -63,7 +71,7 @@ main = do
63 let f (!failures, !n) = liftIO $ if n < 3000
71 let f (!failures, !n) = liftIO $ if n < 3000
64 then do performMajorGC
72 then do performMajorGC
65 threadDelay 5000 -- Wait a bit to allow requestAnimationFrame to call its callback sometimes; this value was experimentally determined
73 threadDelay 5000 -- Wait a bit to allow requestAnimationFrame to call its callback sometimes; this value was experimentally determined
66− gcStats <- getGCStats
74+ gcStats <- getRTSStats
67 print $ currentBytesUsed gcStats
75 print $ currentBytesUsed gcStats
68 when (currentBytesUsed gcStats < minBytesAllowed) $ do
76 when (currentBytesUsed gcStats < minBytesAllowed) $ do
69 putStrLn "FAILED: currentBytesUsed < minBytesAllowed"
77 putStrLn "FAILED: currentBytesUsed < minBytesAllowed"
reflex-dom/java/org/reflexfrp/reflexdom/MainWidget.java+7−1
@@ -21,6 +21,7 @@ import android.graphics.Bitmap;
21import java.io.IOException;
21import java.io.IOException;
22import java.io.InputStream;
22import java.io.InputStream;
23import android.content.Intent;
23import android.content.Intent;
24+import android.content.ActivityNotFoundException;
24
25
25import java.nio.charset.StandardCharsets;
26import java.nio.charset.StandardCharsets;
26
27
@@ -79,7 +80,12 @@ public class MainWidget {
79 @Override
80 @Override
80 public boolean shouldOverrideUrlLoading(WebView view, String url) {
81 public boolean shouldOverrideUrlLoading(WebView view, String url) {
81 if( url != null && !url.startsWith("http://") && !url.startsWith("https://") && !url.startsWith("file://")) {
82 if( url != null && !url.startsWith("http://") && !url.startsWith("https://") && !url.startsWith("file://")) {
83+ try {
82− view.getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
84+ view.getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
85+ }
86+ catch(ActivityNotFoundException e) {
87+ Log.e("reflex", "Starting activity for intent '" + url + "' failed!");
88+ }
83 return true;
89 return true;
84 } else {
90 } else {
85 return false;
91 return false;
reflex-dom/src/Reflex/Dom.hs+4
@@ -1,3 +1,7 @@
1+-- Disable haddocks on this module due to a bug on haddocks when selectively
2+-- reexporting on ghc > 8.2.
3+-- https://github.com/haskell/haddock/issues/979
4+{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-}
1module Reflex.Dom (module X) where
5module Reflex.Dom (module X) where
2
6
3import Foreign.JavaScript.Orphans ()
7import Foreign.JavaScript.Orphans ()