From c4fbd16e74d8b68c24fd690dacef4e9a4c33aff2 Mon Sep 17 00:00:00 2001 From: Alexandre Esteves Date: Fri, 12 Apr 2024 02:05:34 +0100 Subject: [PATCH 01/20] Fix build of reflex-dom-test-selenium --- reflex-dom-core/test/hydration.hs | 17 ++++++++++------- .../src/Reflex/Dom/Test/Selenium.hs | 13 ++++++++----- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/reflex-dom-core/test/hydration.hs b/reflex-dom-core/test/hydration.hs index 16269a73..1f861c4d 100644 --- a/reflex-dom-core/test/hydration.hs +++ b/reflex-dom-core/test/hydration.hs @@ -1,4 +1,5 @@ {-# LANGUAGE BangPatterns #-} +{-# LANGUAGE CPP #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} @@ -89,8 +90,10 @@ import qualified Test.WebDriver.Capabilities as WD import Test.Util.ChromeFlags import Test.Util.UnshareNetwork --- ORPHAN: https://github.com/kallisti-dev/hs-webdriver/pull/167 + +#if !MIN_VERSION_webdriver(0,10,0) deriving instance MonadMask WD +#endif chromium :: FilePath chromium = $(staticWhich "chromium") @@ -166,11 +169,11 @@ tests withDebugging wdConfig caps _selenium = do r <- m putStrLnDebug "after" return r - testWidgetStatic :: WD b -> (forall m js. TestWidget (SpiderTimeline Global) m => m ()) -> WD b + testWidgetStatic :: WD b -> (forall m. TestWidget (SpiderTimeline Global) m => m ()) -> WD b testWidgetStatic = testWidgetStaticDebug withDebugging - testWidget :: WD () -> WD b -> (forall m js. TestWidget (SpiderTimeline Global) m => m ()) -> WD b + testWidget :: WD () -> WD b -> (forall m. TestWidget (SpiderTimeline Global) m => m ()) -> WD b testWidget = testWidgetDebug True withDebugging - testWidget' :: WD a -> (a -> WD b) -> (forall m js. TestWidget (SpiderTimeline Global) m => m ()) -> WD b + testWidget' :: WD a -> (a -> WD b) -> (forall m. TestWidget (SpiderTimeline Global) m => m ()) -> WD b testWidget' = testWidgetDebug' True withDebugging session' "text" $ do it "works" $ runWD $ do @@ -1722,7 +1725,7 @@ testWidgetStaticDebug :: Bool -> WD b -- ^ Webdriver commands to run before JS runs and after hydration switchover - -> (forall m js. TestWidget (SpiderTimeline Global) m => m ()) + -> (forall m. TestWidget (SpiderTimeline Global) m => m ()) -- ^ Widget we are testing -> WD b testWidgetStaticDebug withDebugging w = testWidgetDebug True withDebugging (void w) w @@ -1735,7 +1738,7 @@ testWidgetDebug -- ^ Webdriver commands to run before the JS runs (i.e. on the statically rendered page) -> WD b -- ^ Webdriver commands to run after hydration switchover - -> (forall m js. TestWidget (SpiderTimeline Global) m => m ()) + -> (forall m. TestWidget (SpiderTimeline Global) m => m ()) -- ^ Widget we are testing -> WD b testWidgetDebug hardFailure withDebugging beforeJS afterSwitchover = @@ -1752,7 +1755,7 @@ testWidgetDebug' -- ^ Webdriver commands to run before the JS runs (i.e. on the statically rendered page) -> (a -> WD b) -- ^ Webdriver commands to run after hydration switchover - -> (forall m js. TestWidget (SpiderTimeline Global) m => m ()) + -> (forall m. TestWidget (SpiderTimeline Global) m => m ()) -- ^ Widget we are testing (contents of body) -> WD b testWidgetDebug' hardFailure withDebugging beforeJS afterSwitchover bodyWidget = do diff --git a/reflex-dom-test-selenium/src/Reflex/Dom/Test/Selenium.hs b/reflex-dom-test-selenium/src/Reflex/Dom/Test/Selenium.hs index b0c14cf2..be7ead10 100644 --- a/reflex-dom-test-selenium/src/Reflex/Dom/Test/Selenium.hs +++ b/reflex-dom-test-selenium/src/Reflex/Dom/Test/Selenium.hs @@ -1,4 +1,5 @@ {-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE OverloadedStrings #-} @@ -54,7 +55,9 @@ import qualified Test.Hspec.Core.Spec as Hspec import qualified Test.WebDriver as WD import qualified Test.WebDriver.Capabilities as WD +#if !MIN_VERSION_webdriver(0,10,0) deriving instance MonadMask WD +#endif data SeleniumSetupConfig = SeleniumSetupConfig { _seleniumSetupConfig_chromiumPath :: FilePath @@ -116,7 +119,7 @@ type TestWidget t m = data TestWidgetConfig = TestWidgetConfig { _testWidgetConfig_debug :: Bool -- ^ If this flag is set to True, during the test we will emit debug messages - , _testWidgetConfig_headWidget :: (forall m js. TestWidget js (SpiderTimeline Global) m => m ()) + , _testWidgetConfig_headWidget :: (forall m. TestWidget (SpiderTimeline Global) m => m ()) -- ^ We can add widgets here that will be included in the head of the page -- (useful for example to include external js libraries in the tests) , _testWidgetConfig_jsaddlePort :: PortNumber @@ -131,7 +134,7 @@ testWidget -- ^ Webdriver commands to run before the JS runs (i.e. on the statically rendered page) -> WD b -- ^ Webdriver commands to run after hydration switchover - -> (forall m js. TestWidget js (SpiderTimeline Global) m => m ()) + -> (forall m. TestWidget (SpiderTimeline Global) m => m ()) -- ^ Widget we are testing (contents of body) -> WD b testWidget cfg before after widget = testWidget' cfg before (const after) widget @@ -142,7 +145,7 @@ testWidgetStatic :: TestWidgetConfig -> WD a -- ^ Webdriver commands to run before the JS runs (i.e. on the statically rendered page) - -> (forall m js. TestWidget js (SpiderTimeline Global) m => m ()) + -> (forall m. TestWidget (SpiderTimeline Global) m => m ()) -- ^ Widget we are testing (contents of body) -> WD a testWidgetStatic cfg before widget = testWidget' cfg before pure widget @@ -152,7 +155,7 @@ testWidgetHydrated :: TestWidgetConfig -> WD b -- ^ Webdriver commands to run after hydration switchover - -> (forall m js. TestWidget js (SpiderTimeline Global) m => m ()) + -> (forall m . TestWidget (SpiderTimeline Global) m => m ()) -- ^ Widget we are testing (contents of body) -> WD b testWidgetHydrated cfg after widget = testWidget' cfg (pure ()) (const after) widget @@ -166,7 +169,7 @@ testWidget' -- ^ Webdriver commands to run before the JS runs (i.e. on the statically rendered page) -> (a -> WD b) -- ^ Webdriver commands to run after hydration switchover - -> (forall m js. TestWidget js (SpiderTimeline Global) m => m ()) + -> (forall m. TestWidget (SpiderTimeline Global) m => m ()) -- ^ Widget we are testing (contents of body) -> WD b testWidget' (TestWidgetConfig withDebugging headWidget jsaddlePort) beforeJS afterSwitchover bodyWidget = do From e1c36141af21f1638194f0abaea4e88d760e16c2 Mon Sep 17 00:00:00 2001 From: Alexandre Esteves Date: Fri, 12 Apr 2024 00:51:28 +0100 Subject: [PATCH 02/20] Build with ghc 9.0 --- reflex-dom-core/reflex-dom-core.cabal | 4 +-- .../src/Reflex/Dom/Builder/Class.hs | 20 ++++++------ reflex-dom-core/src/Reflex/Dom/Main.hs | 6 ++-- reflex-dom-core/test/hydration.hs | 31 +++++++++---------- .../reflex-dom-test-selenium.cabal | 2 +- reflex-dom/reflex-dom.cabal | 2 +- 6 files changed, 32 insertions(+), 33 deletions(-) diff --git a/reflex-dom-core/reflex-dom-core.cabal b/reflex-dom-core/reflex-dom-core.cabal index 84b0aecc..46b32db3 100644 --- a/reflex-dom-core/reflex-dom-core.cabal +++ b/reflex-dom-core/reflex-dom-core.cabal @@ -68,7 +68,7 @@ library hs-source-dirs: src build-depends: aeson >= 0.8 && < 2.2, - base >= 4.7 && < 4.15, + base >= 4.7 && < 4.16, bifunctors >= 4.2 && < 6, bimap >= 0.3 && < 0.5, blaze-builder >= 0.4.1 && < 0.5, @@ -170,7 +170,7 @@ library if flag(use-template-haskell) build-depends: dependent-sum-template >= 0.1 && < 0.2, - template-haskell >= 2.12.0 && < 2.17 + template-haskell >= 2.12.0 && < 2.18 other-extensions: TemplateHaskell cpp-options: -DUSE_TEMPLATE_HASKELL other-modules: diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs index c75eb501..fd03cbc7 100644 --- a/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs +++ b/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs @@ -278,6 +278,15 @@ elementConfig_eventSpec f (ElementConfig a b c d) = (\d' -> ElementConfig a b c {-# INLINE elementConfig_eventSpec #-} #endif +instance (Reflex t, er ~ EventResult, DomSpace s) => Default (ElementConfig er t s) where + {-# INLINABLE def #-} + def = ElementConfig + { _elementConfig_namespace = Nothing + , _elementConfig_initialAttributes = mempty + , _elementConfig_modifyAttributes = Nothing + , _elementConfig_eventSpec = def + } + data Element er d t = Element { _element_events :: EventSelector t (WrapArg er EventName) --TODO: EventSelector should have two arguments , _element_raw :: RawElement d @@ -542,15 +551,6 @@ instance HasNamespace (ElementConfig er t m) where {-# INLINABLE namespace #-} namespace = elementConfig_namespace -instance (Reflex t, er ~ EventResult, DomSpace s) => Default (ElementConfig er t s) where - {-# INLINABLE def #-} - def = ElementConfig - { _elementConfig_namespace = Nothing - , _elementConfig_initialAttributes = mempty - , _elementConfig_modifyAttributes = Nothing - , _elementConfig_eventSpec = def - } - instance (DomBuilder t m, PerformEvent t m, MonadFix m, MonadHold t m) => DomBuilder t (PostBuildT t m) where type DomBuilderSpace (PostBuildT t m) = DomBuilderSpace m wrapRawElement e = lift . wrapRawElement e @@ -750,7 +750,7 @@ instance HasDocument m => HasDocument (QueryT t q m) class HasSetValue a where type SetValue a :: * setValue :: Lens' a (SetValue a) - + instance Reflex t => HasSetValue (TextAreaElementConfig er t m) where type SetValue (TextAreaElementConfig er t m) = Event t Text setValue = textAreaElementConfig_setValue diff --git a/reflex-dom-core/src/Reflex/Dom/Main.hs b/reflex-dom-core/src/Reflex/Dom/Main.hs index 24219c77..ba6d47ba 100644 --- a/reflex-dom-core/src/Reflex/Dom/Main.hs +++ b/reflex-dom-core/src/Reflex/Dom/Main.hs @@ -58,7 +58,7 @@ import Reflex.Profiled {-# INLINE mainHydrationWidgetWithHead #-} mainHydrationWidgetWithHead :: (forall x. HydrationWidget x ()) -> (forall x. HydrationWidget x ()) -> JSM () -mainHydrationWidgetWithHead = mainHydrationWidgetWithHead' +mainHydrationWidgetWithHead head' body = mainHydrationWidgetWithHead' head' body {-# INLINABLE mainHydrationWidgetWithHead' #-} -- | Warning: `mainHydrationWidgetWithHead'` is provided only as performance tweak. It is expected to disappear in future releases. @@ -67,7 +67,7 @@ mainHydrationWidgetWithHead' = mainHydrationWidgetWithSwitchoverAction' (pure () {-# INLINE mainHydrationWidgetWithSwitchoverAction #-} mainHydrationWidgetWithSwitchoverAction :: JSM () -> (forall x. HydrationWidget x ()) -> (forall x. HydrationWidget x ()) -> JSM () -mainHydrationWidgetWithSwitchoverAction = mainHydrationWidgetWithSwitchoverAction' +mainHydrationWidgetWithSwitchoverAction switchoverAction head' body = mainHydrationWidgetWithSwitchoverAction' switchoverAction head' body {-# INLINABLE mainHydrationWidgetWithSwitchoverAction' #-} -- | Warning: `mainHydrationWidgetWithSwitchoverAction'` is provided only as performance tweak. It is expected to disappear in future releases. @@ -187,7 +187,7 @@ runHydrationWidgetWithHeadAndBodyWithFailure onFailure switchoverAction app = wi {-# INLINE mainWidget #-} mainWidget :: (forall x. Widget x ()) -> JSM () -mainWidget = mainWidget' +mainWidget w = mainWidget' w {-# INLINABLE mainWidget' #-} -- | Warning: `mainWidget'` is provided only as performance tweak. It is expected to disappear in future releases. diff --git a/reflex-dom-core/test/hydration.hs b/reflex-dom-core/test/hydration.hs index 1f861c4d..564a6e8c 100644 --- a/reflex-dom-core/test/hydration.hs +++ b/reflex-dom-core/test/hydration.hs @@ -121,18 +121,11 @@ assertBool msg bool = liftIO $ HUnit.assertBool msg bool chromeConfig :: Text -> [Text] -> WD.WDConfig chromeConfig fp flags = WD.useBrowser (WD.chrome { WD.chromeBinary = Just $ T.unpack fp, WD.chromeOptions = T.unpack <$> flags }) WD.defaultConfig -keyMap :: DMap DKey Identity -keyMap = DMap.fromList - [ Key_Int ==> 0 - , Key_Char ==> 'A' - ] - data DKey a where Key_Int :: DKey Int Key_Char :: DKey Char Key_Bool :: DKey Bool - textKey :: DKey a -> Text textKey = \case Key_Int -> "Key_Int" @@ -144,6 +137,21 @@ deriveGEq ''DKey deriveGCompare ''DKey deriveGShow ''DKey +keyMap :: DMap DKey Identity +keyMap = DMap.fromList + [ Key_Int ==> 0 + , Key_Char ==> 'A' + ] + +data Key2 a where + Key2_Int :: Int -> Key2 Int + Key2_Char :: Char -> Key2 Char + +deriveGEq ''Key2 +deriveGCompare ''Key2 +deriveGShow ''Key2 +deriveArgDict ''Key2 + deriving instance MonadFail WD main :: IO () @@ -1820,12 +1828,3 @@ withAsync' f g = bracket (liftIO $ Async.async f) (liftIO . Async.uninterruptibleCancel) (const g) - -data Key2 a where - Key2_Int :: Int -> Key2 Int - Key2_Char :: Char -> Key2 Char - -deriveGEq ''Key2 -deriveGCompare ''Key2 -deriveGShow ''Key2 -deriveArgDict ''Key2 diff --git a/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal b/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal index df4106fc..f5cecf7b 100644 --- a/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal +++ b/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal @@ -15,7 +15,7 @@ library hs-source-dirs: src build-depends: async, - base >= 4.7 && < 4.15, + base >= 4.7 && < 4.16, bytestring == 0.10.*, chrome-test-utils, exceptions, diff --git a/reflex-dom/reflex-dom.cabal b/reflex-dom/reflex-dom.cabal index 55caaca3..46a9ca29 100644 --- a/reflex-dom/reflex-dom.cabal +++ b/reflex-dom/reflex-dom.cabal @@ -71,7 +71,7 @@ library cpp-options: -DANDROID build-tools: hsc2hs build-depends: - base >= 4.7 && < 4.15, + base >= 4.7 && < 4.16, bytestring == 0.10.*, reflex >= 0.8 && < 1, reflex-dom-core >= 0.6.1.0 && <0.9, From 9ab4277f91d01f9806c5dade2aee27b9e4398758 Mon Sep 17 00:00:00 2001 From: Alexandre Esteves Date: Fri, 12 Apr 2024 00:54:18 +0100 Subject: [PATCH 03/20] Build with ghc 9.2 --- reflex-dom-core/reflex-dom-core.cabal | 6 +++--- reflex-dom-test-selenium/reflex-dom-test-selenium.cabal | 4 ++-- reflex-dom/reflex-dom.cabal | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/reflex-dom-core/reflex-dom-core.cabal b/reflex-dom-core/reflex-dom-core.cabal index 46b32db3..1b05672c 100644 --- a/reflex-dom-core/reflex-dom-core.cabal +++ b/reflex-dom-core/reflex-dom-core.cabal @@ -68,11 +68,11 @@ library hs-source-dirs: src build-depends: aeson >= 0.8 && < 2.2, - base >= 4.7 && < 4.16, + base >= 4.7 && < 4.17, bifunctors >= 4.2 && < 6, bimap >= 0.3 && < 0.5, blaze-builder >= 0.4.1 && < 0.5, - bytestring == 0.10.*, + bytestring >= 0.10 && < 0.12, case-insensitive < 1.3, commutative-semigroups >=0.1 && <0.2, containers >= 0.6 && < 0.7, @@ -170,7 +170,7 @@ library if flag(use-template-haskell) build-depends: dependent-sum-template >= 0.1 && < 0.2, - template-haskell >= 2.12.0 && < 2.18 + template-haskell >= 2.12.0 && < 2.19 other-extensions: TemplateHaskell cpp-options: -DUSE_TEMPLATE_HASKELL other-modules: diff --git a/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal b/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal index f5cecf7b..dc5da7c1 100644 --- a/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal +++ b/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal @@ -15,8 +15,8 @@ library hs-source-dirs: src build-depends: async, - base >= 4.7 && < 4.16, - bytestring == 0.10.*, + base >= 4.7 && < 4.17, + bytestring >= 0.10 && < 0.12, chrome-test-utils, exceptions, -- Until hspec-webdriver supports newer hspec-core versions diff --git a/reflex-dom/reflex-dom.cabal b/reflex-dom/reflex-dom.cabal index 46a9ca29..cfa946f6 100644 --- a/reflex-dom/reflex-dom.cabal +++ b/reflex-dom/reflex-dom.cabal @@ -71,8 +71,8 @@ library cpp-options: -DANDROID build-tools: hsc2hs build-depends: - base >= 4.7 && < 4.16, - bytestring == 0.10.*, + base >= 4.7 && < 4.17, + bytestring >= 0.10 && < 0.12, reflex >= 0.8 && < 1, reflex-dom-core >= 0.6.1.0 && <0.9, text == 1.2.* From c3eaab14d0817d8738702821de34fdd264222694 Mon Sep 17 00:00:00 2001 From: Alexandre Esteves Date: Fri, 12 Apr 2024 00:57:48 +0100 Subject: [PATCH 04/20] Build with ghc 9.4 --- cabal.project | 5 ----- cabal.project-nogtk | 5 ----- reflex-dom-core/reflex-dom-core.cabal | 6 +++--- reflex-dom-test-selenium/reflex-dom-test-selenium.cabal | 7 +++---- reflex-dom/reflex-dom.cabal | 2 +- 5 files changed, 7 insertions(+), 18 deletions(-) diff --git a/cabal.project b/cabal.project index 66bf72d3..4768e2ff 100644 --- a/cabal.project +++ b/cabal.project @@ -3,8 +3,3 @@ packages: reflex-dom/ chrome-test-utils/ reflex-dom-test-selenium/ - -source-repository-package - type: git - location: https://github.com/dfordivam/hspec-webdriver-clone - tag: 0d748b7bb7cd74dce0a55a1ec86b01dbb8a71cd8 diff --git a/cabal.project-nogtk b/cabal.project-nogtk index 6694c040..a3fb1107 100644 --- a/cabal.project-nogtk +++ b/cabal.project-nogtk @@ -7,8 +7,3 @@ package reflex-dom-core package reflex-dom flags: +use-warp -webkit2gtk - -source-repository-package - type: git - location: https://github.com/dfordivam/hspec-webdriver-clone - tag: 0d748b7bb7cd74dce0a55a1ec86b01dbb8a71cd8 diff --git a/reflex-dom-core/reflex-dom-core.cabal b/reflex-dom-core/reflex-dom-core.cabal index 1b05672c..26ed8cf2 100644 --- a/reflex-dom-core/reflex-dom-core.cabal +++ b/reflex-dom-core/reflex-dom-core.cabal @@ -68,7 +68,7 @@ library hs-source-dirs: src build-depends: aeson >= 0.8 && < 2.2, - base >= 4.7 && < 4.17, + base >= 4.7 && < 4.18, bifunctors >= 4.2 && < 6, bimap >= 0.3 && < 0.5, blaze-builder >= 0.4.1 && < 0.5, @@ -170,7 +170,7 @@ library if flag(use-template-haskell) build-depends: dependent-sum-template >= 0.1 && < 0.2, - template-haskell >= 2.12.0 && < 2.19 + template-haskell >= 2.12.0 && < 2.20 other-extensions: TemplateHaskell cpp-options: -DUSE_TEMPLATE_HASKELL other-modules: @@ -226,7 +226,7 @@ test-suite hydration , websockets , which hs-source-dirs: test - ghc-options: -rtsopts -with-rtsopts=-T -Wall -fwarn-tabs -funbox-strict-fields -O2 -ferror-spans + ghc-options: -rtsopts "-with-rtsopts=-T -V0" -Wall -fwarn-tabs -funbox-strict-fields -O2 -ferror-spans ghc-prof-options: -fprof-auto -optP-DPROFILING main-is: hydration.hs type: exitcode-stdio-1.0 diff --git a/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal b/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal index dc5da7c1..abb268ac 100644 --- a/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal +++ b/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal @@ -15,13 +15,12 @@ library hs-source-dirs: src build-depends: async, - base >= 4.7 && < 4.17, + base >= 4.7 && < 4.18, bytestring >= 0.10 && < 0.12, chrome-test-utils, exceptions, - -- Until hspec-webdriver supports newer hspec-core versions - hspec-core < 2.8, - hspec-webdriver >= 1.2.1, + hspec-core < 2.12, + hspec-webdriver >= 1.2.2, http-types, jsaddle >= 0.9.0.0 && < 0.10, jsaddle-warp, diff --git a/reflex-dom/reflex-dom.cabal b/reflex-dom/reflex-dom.cabal index cfa946f6..27d747a5 100644 --- a/reflex-dom/reflex-dom.cabal +++ b/reflex-dom/reflex-dom.cabal @@ -71,7 +71,7 @@ library cpp-options: -DANDROID build-tools: hsc2hs build-depends: - base >= 4.7 && < 4.17, + base >= 4.7 && < 4.18, bytestring >= 0.10 && < 0.12, reflex >= 0.8 && < 1, reflex-dom-core >= 0.6.1.0 && <0.9, From a73705e981832e38eba81fc67192926cc7d4773c Mon Sep 17 00:00:00 2001 From: Alexandre Esteves Date: Fri, 12 Apr 2024 01:13:52 +0100 Subject: [PATCH 05/20] Build with ghc 9.6 --- reflex-dom-core/reflex-dom-core.cabal | 12 ++++++------ reflex-dom-core/src/Reflex/Dom/Builder/Class.hs | 1 + reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs | 2 ++ reflex-dom-core/src/Reflex/Dom/Builder/Static.hs | 2 ++ reflex-dom-core/src/Reflex/Dom/Prerender.hs | 2 ++ reflex-dom-core/src/Reflex/Dom/WebSocket.hs | 3 +-- reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs | 1 + reflex-dom-core/src/Reflex/Dom/Widget/Input.hs | 1 + .../reflex-dom-test-selenium.cabal | 2 +- reflex-dom/reflex-dom.cabal | 2 +- 10 files changed, 18 insertions(+), 10 deletions(-) diff --git a/reflex-dom-core/reflex-dom-core.cabal b/reflex-dom-core/reflex-dom-core.cabal index 26ed8cf2..67b181b6 100644 --- a/reflex-dom-core/reflex-dom-core.cabal +++ b/reflex-dom-core/reflex-dom-core.cabal @@ -68,7 +68,7 @@ library hs-source-dirs: src build-depends: aeson >= 0.8 && < 2.2, - base >= 4.7 && < 4.18, + base >= 4.7 && < 4.19, bifunctors >= 4.2 && < 6, bimap >= 0.3 && < 0.5, blaze-builder >= 0.4.1 && < 0.5, @@ -90,7 +90,7 @@ library keycode >= 0.2.1 && < 0.3, lens >= 4.7 && < 5.3, monad-control >= 1.0.1 && < 1.1, - mtl >= 2.1 && < 2.3, + mtl >= 2.1 && < 2.4, primitive >= 0.5 && < 0.8, random >= 1.1 && < 1.3, ref-tf >= 0.4 && < 0.6, @@ -98,7 +98,7 @@ library semigroups >= 0.16 && < 0.20, stm >= 2.4 && < 2.6, text == 1.2.*, - transformers >= 0.3 && < 0.6, + transformers >= 0.3 && < 0.7, network-uri >= 2.6.1 && < 2.7, zenc == 0.1.* @@ -110,11 +110,11 @@ library else hs-source-dirs: src-ghc if !os(windows) - build-depends: unix == 2.7.* + build-depends: unix >= 2.7 && <2.9 if flag(split-these) build-depends: - semialign >= 1 && < 1.3, + semialign >= 1 && < 1.4, these >= 1 && < 1.3 else build-depends: @@ -170,7 +170,7 @@ library if flag(use-template-haskell) build-depends: dependent-sum-template >= 0.1 && < 0.2, - template-haskell >= 2.12.0 && < 2.20 + template-haskell >= 2.12.0 && < 2.21 other-extensions: TemplateHaskell cpp-options: -DUSE_TEMPLATE_HASKELL other-modules: diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs index fd03cbc7..dedf268a 100644 --- a/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs +++ b/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs @@ -47,6 +47,7 @@ import Reflex.Requester.Base import qualified Control.Category import Control.Lens hiding (element) +import Control.Monad.Fix import Control.Monad.Reader import qualified Control.Monad.State as Lazy import Control.Monad.State.Strict diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs index fce08d03..031997ba 100644 --- a/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs +++ b/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs @@ -120,7 +120,9 @@ module Reflex.Dom.Builder.Immediate import Control.Concurrent import Control.Exception (bracketOnError) import Control.Lens (Identity(..), imapM_, iforM_, (^.), makeLenses) +import Control.Monad import Control.Monad.Exception +import Control.Monad.Fix import Control.Monad.Primitive import Control.Monad.Reader import Control.Monad.Ref diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Static.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Static.hs index 140c25ae..4463ee38 100644 --- a/reflex-dom-core/src/Reflex/Dom/Builder/Static.hs +++ b/reflex-dom-core/src/Reflex/Dom/Builder/Static.hs @@ -19,6 +19,8 @@ import Data.IORef (IORef) import Blaze.ByteString.Builder.Html.Utf8 import Control.Lens hiding (element) import Control.Monad.Exception +import Control.Monad +import Control.Monad.Fix import Control.Monad.Identity import Control.Monad.Primitive import Control.Monad.Ref diff --git a/reflex-dom-core/src/Reflex/Dom/Prerender.hs b/reflex-dom-core/src/Reflex/Dom/Prerender.hs index b7e9cbda..3fbf0cb9 100644 --- a/reflex-dom-core/src/Reflex/Dom/Prerender.hs +++ b/reflex-dom-core/src/Reflex/Dom/Prerender.hs @@ -22,6 +22,8 @@ module Reflex.Dom.Prerender , PrerenderBaseConstraints ) where +import Control.Monad +import Control.Monad.Fix import Control.Monad.Primitive (PrimMonad(..)) import Control.Monad.Reader import Control.Monad.Ref (MonadRef(..), MonadAtomicRef(..)) diff --git a/reflex-dom-core/src/Reflex/Dom/WebSocket.hs b/reflex-dom-core/src/Reflex/Dom/WebSocket.hs index 13e6fedc..66b34843 100644 --- a/reflex-dom-core/src/Reflex/Dom/WebSocket.hs +++ b/reflex-dom-core/src/Reflex/Dom/WebSocket.hs @@ -40,9 +40,8 @@ import Control.Concurrent import Control.Concurrent.STM import Control.Exception import Control.Lens -import Control.Monad hiding (forM, forM_, mapM, mapM_, sequence) +import Control.Monad hiding (forM, mapM, mapM_, sequence) import Control.Monad.IO.Class -import Control.Monad.State import Data.Aeson import Data.ByteString (ByteString) import Data.ByteString.Lazy (toStrict) diff --git a/reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs b/reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs index 66e6d5ab..c6dffa40 100644 --- a/reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs +++ b/reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs @@ -72,6 +72,7 @@ import Reflex.Workflow import Control.Arrow import Control.Lens hiding (children, element) +import Control.Monad.Fix import Control.Monad.Reader hiding (forM, forM_, mapM, mapM_, sequence, sequence_) import Data.Align import Data.Default diff --git a/reflex-dom-core/src/Reflex/Dom/Widget/Input.hs b/reflex-dom-core/src/Reflex/Dom/Widget/Input.hs index 2c67fcd3..086a8ed1 100644 --- a/reflex-dom-core/src/Reflex/Dom/Widget/Input.hs +++ b/reflex-dom-core/src/Reflex/Dom/Widget/Input.hs @@ -19,6 +19,7 @@ module Reflex.Dom.Widget.Input (module Reflex.Dom.Widget.Input, def, (&), (.~)) import Prelude import Control.Lens hiding (element, ix) +import Control.Monad import Control.Monad.Fix import Control.Monad.IO.Class import Control.Monad.Reader diff --git a/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal b/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal index abb268ac..85ae0668 100644 --- a/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal +++ b/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal @@ -15,7 +15,7 @@ library hs-source-dirs: src build-depends: async, - base >= 4.7 && < 4.18, + base >= 4.7 && < 4.19, bytestring >= 0.10 && < 0.12, chrome-test-utils, exceptions, diff --git a/reflex-dom/reflex-dom.cabal b/reflex-dom/reflex-dom.cabal index 27d747a5..92498ab8 100644 --- a/reflex-dom/reflex-dom.cabal +++ b/reflex-dom/reflex-dom.cabal @@ -71,7 +71,7 @@ library cpp-options: -DANDROID build-tools: hsc2hs build-depends: - base >= 4.7 && < 4.18, + base >= 4.7 && < 4.19, bytestring >= 0.10 && < 0.12, reflex >= 0.8 && < 1, reflex-dom-core >= 0.6.1.0 && <0.9, From 8068141c093aa27e5d34f418f479cdb923e06d74 Mon Sep 17 00:00:00 2001 From: Alexandre Esteves Date: Fri, 12 Apr 2024 06:11:56 +0100 Subject: [PATCH 06/20] Disable eta reduce hint --- reflex-dom-core/test/hlint.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/reflex-dom-core/test/hlint.hs b/reflex-dom-core/test/hlint.hs index f4137f2c..a2b4d361 100644 --- a/reflex-dom-core/test/hlint.hs +++ b/reflex-dom-core/test/hlint.hs @@ -20,6 +20,7 @@ main = do , "--ignore=Unnecessary hiding" -- Interferes with cross-version compatibility , "--ignore=Use <$>" , "--ignore=Reduce duplication" --TODO: Re-enable this test + , "--ignore=Eta reduce" -- simplified subsumption , "--ignore=Use list comprehension" , "--ignore=Evaluate" , "--cpp-define=USE_TEMPLATE_HASKELL" From c772c803ca6e7376ee4b9567cb7b3702222fd837 Mon Sep 17 00:00:00 2001 From: Alexandre Esteves Date: Fri, 12 Apr 2024 01:31:05 +0100 Subject: [PATCH 07/20] Build with ghc 9.8 --- reflex-dom-core/reflex-dom-core.cabal | 14 +++++++------- reflex-dom-core/src/Reflex/Dom/WebSocket.hs | 1 - reflex-dom-core/src/Reflex/Dom/Xhr/Foreign.hs | 1 - .../reflex-dom-test-selenium.cabal | 4 ++-- reflex-dom/reflex-dom.cabal | 6 +++--- 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/reflex-dom-core/reflex-dom-core.cabal b/reflex-dom-core/reflex-dom-core.cabal index 67b181b6..45d50641 100644 --- a/reflex-dom-core/reflex-dom-core.cabal +++ b/reflex-dom-core/reflex-dom-core.cabal @@ -67,12 +67,12 @@ flag gc-tests library hs-source-dirs: src build-depends: - aeson >= 0.8 && < 2.2, - base >= 4.7 && < 4.19, + aeson >= 0.8 && < 2.3, + base >= 4.7 && < 4.20, bifunctors >= 4.2 && < 6, bimap >= 0.3 && < 0.5, blaze-builder >= 0.4.1 && < 0.5, - bytestring >= 0.10 && < 0.12, + bytestring >= 0.10 && < 0.13, case-insensitive < 1.3, commutative-semigroups >=0.1 && <0.2, containers >= 0.6 && < 0.7, @@ -81,7 +81,7 @@ library data-default >= 0.5 && < 0.8, dependent-map >= 0.3 && < 0.5, dependent-sum >= 0.6 && < 0.8, - dependent-sum-template >= 0.1 && < 0.2, + dependent-sum-template >= 0.2 && < 0.3, directory >= 1.2 && < 1.4, exception-transformers == 0.4.*, ghcjs-dom >= 0.9.1.0 && < 0.10, @@ -91,7 +91,7 @@ library lens >= 4.7 && < 5.3, monad-control >= 1.0.1 && < 1.1, mtl >= 2.1 && < 2.4, - primitive >= 0.5 && < 0.8, + primitive >= 0.5 && < 0.9, random >= 1.1 && < 1.3, ref-tf >= 0.4 && < 0.6, reflex >= 0.8.2.1 && < 1, @@ -169,8 +169,8 @@ library if flag(use-template-haskell) build-depends: - dependent-sum-template >= 0.1 && < 0.2, - template-haskell >= 2.12.0 && < 2.21 + dependent-sum-template >= 0.2 && < 0.3, + template-haskell >= 2.12.0 && < 2.22 other-extensions: TemplateHaskell cpp-options: -DUSE_TEMPLATE_HASKELL other-modules: diff --git a/reflex-dom-core/src/Reflex/Dom/WebSocket.hs b/reflex-dom-core/src/Reflex/Dom/WebSocket.hs index 66b34843..b85faacf 100644 --- a/reflex-dom-core/src/Reflex/Dom/WebSocket.hs +++ b/reflex-dom-core/src/Reflex/Dom/WebSocket.hs @@ -8,7 +8,6 @@ {-# LANGUAGE ForeignFunctionInterface #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} -{-# LANGUAGE JavaScriptFFI #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE NoMonomorphismRestriction #-} diff --git a/reflex-dom-core/src/Reflex/Dom/Xhr/Foreign.hs b/reflex-dom-core/src/Reflex/Dom/Xhr/Foreign.hs index 210ac82e..2528f99d 100644 --- a/reflex-dom-core/src/Reflex/Dom/Xhr/Foreign.hs +++ b/reflex-dom-core/src/Reflex/Dom/Xhr/Foreign.hs @@ -1,5 +1,4 @@ {-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE JavaScriptFFI #-} {-# LANGUAGE OverloadedStrings #-} module Reflex.Dom.Xhr.Foreign ( diff --git a/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal b/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal index 85ae0668..a828230a 100644 --- a/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal +++ b/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal @@ -15,8 +15,8 @@ library hs-source-dirs: src build-depends: async, - base >= 4.7 && < 4.19, - bytestring >= 0.10 && < 0.12, + base >= 4.7 && < 4.20, + bytestring >= 0.10 && < 0.13, chrome-test-utils, exceptions, hspec-core < 2.12, diff --git a/reflex-dom/reflex-dom.cabal b/reflex-dom/reflex-dom.cabal index 92498ab8..635af032 100644 --- a/reflex-dom/reflex-dom.cabal +++ b/reflex-dom/reflex-dom.cabal @@ -61,7 +61,7 @@ library hs-source-dirs: src-android other-modules: Reflex.Dom.Android.MainWidget build-depends: - aeson >= 1.4 && < 2.2, + aeson >= 1.4 && < 2.3, android-activity == 0.2.*, data-default == 0.7.*, jsaddle >= 0.9.6 && < 0.10 @@ -71,8 +71,8 @@ library cpp-options: -DANDROID build-tools: hsc2hs build-depends: - base >= 4.7 && < 4.19, - bytestring >= 0.10 && < 0.12, + base >= 4.7 && < 4.20, + bytestring >= 0.10 && < 0.13, reflex >= 0.8 && < 1, reflex-dom-core >= 0.6.1.0 && <0.9, text == 1.2.* From 6b53f8ae4ec710be61284f54fd5291cc2c45e8d3 Mon Sep 17 00:00:00 2001 From: Slava Gorbunov Date: Wed, 8 May 2024 22:03:14 +0300 Subject: [PATCH 08/20] Fix build for ghc-9.6 --- reflex-dom-core/reflex-dom-core.cabal | 18 +++++++++--------- .../src/Reflex/Dom/Builder/Class.hs | 18 +++++++++--------- .../src/Reflex/Dom/Builder/Static.hs | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/reflex-dom-core/reflex-dom-core.cabal b/reflex-dom-core/reflex-dom-core.cabal index 45d50641..47ea1d58 100644 --- a/reflex-dom-core/reflex-dom-core.cabal +++ b/reflex-dom-core/reflex-dom-core.cabal @@ -70,18 +70,18 @@ library aeson >= 0.8 && < 2.3, base >= 4.7 && < 4.20, bifunctors >= 4.2 && < 6, - bimap >= 0.3 && < 0.5, + bimap >= 0.3 && < 0.6, blaze-builder >= 0.4.1 && < 0.5, bytestring >= 0.10 && < 0.13, case-insensitive < 1.3, - commutative-semigroups >=0.1 && <0.2, + commutative-semigroups >=0.1 && <0.3, containers >= 0.6 && < 0.7, - constraints >= 0.9 && < 0.14, + constraints >= 0.9 && < 0.15, contravariant >= 1.4 && < 1.6, data-default >= 0.5 && < 0.8, dependent-map >= 0.3 && < 0.5, dependent-sum >= 0.6 && < 0.8, - dependent-sum-template >= 0.2 && < 0.3, + dependent-sum-template >= 0.1 && < 0.3, directory >= 1.2 && < 1.4, exception-transformers == 0.4.*, ghcjs-dom >= 0.9.1.0 && < 0.10, @@ -95,9 +95,9 @@ library random >= 1.1 && < 1.3, ref-tf >= 0.4 && < 0.6, reflex >= 0.8.2.1 && < 1, - semigroups >= 0.16 && < 0.20, + semigroups >= 0.16 && < 0.21, stm >= 2.4 && < 2.6, - text == 1.2.*, + text >= 1.2 && < 2.1, transformers >= 0.3 && < 0.7, network-uri >= 2.6.1 && < 2.7, zenc == 0.1.* @@ -118,7 +118,7 @@ library these >= 1 && < 1.3 else build-depends: - these >= 0.4 && < 0.9 + these >= 0.4 && < 1.0 exposed-modules: Foreign.JavaScript.TH @@ -169,8 +169,8 @@ library if flag(use-template-haskell) build-depends: - dependent-sum-template >= 0.2 && < 0.3, - template-haskell >= 2.12.0 && < 2.22 + dependent-sum-template >= 0.1 && < 0.3, + template-haskell >= 2.12.0 && < 2.23 other-extensions: TemplateHaskell cpp-options: -DUSE_TEMPLATE_HASKELL other-modules: diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs index dedf268a..20eca905 100644 --- a/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs +++ b/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs @@ -279,15 +279,6 @@ elementConfig_eventSpec f (ElementConfig a b c d) = (\d' -> ElementConfig a b c {-# INLINE elementConfig_eventSpec #-} #endif -instance (Reflex t, er ~ EventResult, DomSpace s) => Default (ElementConfig er t s) where - {-# INLINABLE def #-} - def = ElementConfig - { _elementConfig_namespace = Nothing - , _elementConfig_initialAttributes = mempty - , _elementConfig_modifyAttributes = Nothing - , _elementConfig_eventSpec = def - } - data Element er d t = Element { _element_events :: EventSelector t (WrapArg er EventName) --TODO: EventSelector should have two arguments , _element_raw :: RawElement d @@ -317,6 +308,15 @@ inputElementConfig_elementConfig f (InputElementConfig a b c d e) = (\e' -> Inpu {-# INLINE inputElementConfig_elementConfig #-} #endif +instance (Reflex t, er ~ EventResult, DomSpace s) => Default (ElementConfig er t s) where + {-# INLINABLE def #-} + def = ElementConfig + { _elementConfig_namespace = Nothing + , _elementConfig_initialAttributes = mempty + , _elementConfig_modifyAttributes = Nothing + , _elementConfig_eventSpec = def + } + instance (Reflex t, er ~ EventResult, DomSpace s) => Default (InputElementConfig er t s) where {-# INLINABLE def #-} def = InputElementConfig diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Static.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Static.hs index 4463ee38..b2d94deb 100644 --- a/reflex-dom-core/src/Reflex/Dom/Builder/Static.hs +++ b/reflex-dom-core/src/Reflex/Dom/Builder/Static.hs @@ -18,8 +18,8 @@ module Reflex.Dom.Builder.Static where import Data.IORef (IORef) import Blaze.ByteString.Builder.Html.Utf8 import Control.Lens hiding (element) -import Control.Monad.Exception import Control.Monad +import Control.Monad.Exception import Control.Monad.Fix import Control.Monad.Identity import Control.Monad.Primitive From 65c64f08c999db0316011516670606badffe677c Mon Sep 17 00:00:00 2001 From: Slava Gorbunov Date: Mon, 13 May 2024 20:53:32 +0300 Subject: [PATCH 09/20] Make reflex-dom-core buildable on recent ghc js backend --- reflex-dom-core/reflex-dom-core.cabal | 4 ++-- .../src-ghcjs/Foreign/JavaScript/Internal/Utils.hs | 5 +++++ reflex-dom-core/src/Foreign/JavaScript/TH.hs | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/reflex-dom-core/reflex-dom-core.cabal b/reflex-dom-core/reflex-dom-core.cabal index 47ea1d58..1e4fcb7a 100644 --- a/reflex-dom-core/reflex-dom-core.cabal +++ b/reflex-dom-core/reflex-dom-core.cabal @@ -102,11 +102,11 @@ library network-uri >= 2.6.1 && < 2.7, zenc == 0.1.* - if impl(ghcjs) + if impl(ghcjs) || arch(javascript) hs-source-dirs: src-ghcjs build-depends: ghcjs-base, - hashable >= 1.2 && < 1.4 + hashable >= 1.2 && < 1.5 else hs-source-dirs: src-ghc if !os(windows) diff --git a/reflex-dom-core/src-ghcjs/Foreign/JavaScript/Internal/Utils.hs b/reflex-dom-core/src-ghcjs/Foreign/JavaScript/Internal/Utils.hs index 73d7a886..06cb003e 100644 --- a/reflex-dom-core/src-ghcjs/Foreign/JavaScript/Internal/Utils.hs +++ b/reflex-dom-core/src-ghcjs/Foreign/JavaScript/Internal/Utils.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE ForeignFunctionInterface #-} {-# LANGUAGE JavaScriptFFI #-} @@ -9,7 +10,11 @@ module Foreign.JavaScript.Internal.Utils import GHCJS.Concurrent import GHCJS.DOM.Types (JSM, JSVal, RequestAnimationFrameCallback (..)) +#ifdef __GHCJS__ import GHCJS.Foreign.Callback (releaseCallback) +#else +import GHC.JS.Foreign.Callback (releaseCallback) +#endif freeRequestAnimationFrameCallback :: RequestAnimationFrameCallback -> JSM () freeRequestAnimationFrameCallback (RequestAnimationFrameCallback cb) = releaseCallback cb diff --git a/reflex-dom-core/src/Foreign/JavaScript/TH.hs b/reflex-dom-core/src/Foreign/JavaScript/TH.hs index 602bd421..bf2080cc 100644 --- a/reflex-dom-core/src/Foreign/JavaScript/TH.hs +++ b/reflex-dom-core/src/Foreign/JavaScript/TH.hs @@ -35,8 +35,12 @@ import qualified GHCJS.Buffer as JS import GHCJS.DOM.Types (MonadJSM) import qualified GHCJS.DOM.Types as JS import qualified GHCJS.Foreign as JS +#ifdef __GHCJS__ import qualified GHCJS.Foreign.Callback as JS import qualified GHCJS.Foreign.Callback.Internal (Callback (..)) +#else +import qualified GHC.JS.Foreign.Callback as JS +#endif import qualified JavaScript.Array as JS import qualified JavaScript.Array.Internal (SomeJSArray (..)) import qualified JavaScript.Object as JS From cfa9ad20e21bf84ddbf38915350aba354d56b51b Mon Sep 17 00:00:00 2001 From: Slava Gorbunov Date: Fri, 7 Jun 2024 18:24:15 +0300 Subject: [PATCH 10/20] Support new js backend syntax --- reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs index 031997ba..ee7b5136 100644 --- a/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs +++ b/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs @@ -466,7 +466,11 @@ removeSubsequentNodes :: (MonadJSM m, IsNode n) => n -> m () #ifdef ghcjs_HOST_OS --NOTE: Although wrapping this javascript in a function seems unnecessary, GHCJS's optimizer will break it if it is entered without that wrapping (as of 2021-11-06) foreign import javascript unsafe +#ifdef __GHCJS__ "(function() { var n = $1; while (n['nextSibling']) { n['parentNode']['removeChild'](n['nextSibling']); }; })()" +#else + "(function(n) { while (n['nextSibling']) { n['parentNode']['removeChild'](n['nextSibling']); }; })" +#endif removeSubsequentNodes_ :: DOM.Node -> IO () removeSubsequentNodes n = liftJSM $ removeSubsequentNodes_ (toNode n) #else @@ -489,7 +493,11 @@ extractBetweenExclusive :: (MonadJSM m, IsNode start, IsNode end) => DOM.Documen #ifdef ghcjs_HOST_OS --NOTE: Although wrapping this javascript in a function seems unnecessary, GHCJS's optimizer will break it if it is entered without that wrapping (as of 2021-11-06) foreign import javascript unsafe +#ifdef __GHCJS__ "(function() { var df = $1; var s = $2; var e = $3; var x; for(;;) { x = s['nextSibling']; if(e===x) { break; }; df['appendChild'](x); } })()" +#else + "(function(df, s, e) { var x; for(;;) { x = s['nextSibling']; if(e===x) { break; }; df['appendChild'](x); } })" +#endif extractBetweenExclusive_ :: DOM.DocumentFragment -> DOM.Node -> DOM.Node -> IO () extractBetweenExclusive df s e = liftJSM $ extractBetweenExclusive_ df (toNode s) (toNode e) #else @@ -510,7 +518,11 @@ extractUpTo :: (MonadJSM m, IsNode start, IsNode end) => DOM.DocumentFragment -> #ifdef ghcjs_HOST_OS --NOTE: Although wrapping this javascript in a function seems unnecessary, GHCJS's optimizer will break it if it is entered without that wrapping (as of 2017-09-04) foreign import javascript unsafe +#ifdef __GHCJS__ "(function() { var x = $2; while(x !== $3) { var y = x['nextSibling']; $1['appendChild'](x); x = y; } })()" +#else + "(function(_, x, $3) { while(x !== $3) { var y = x['nextSibling']; $1['appendChild'](x); x = y; } })" +#endif extractUpTo_ :: DOM.DocumentFragment -> DOM.Node -> DOM.Node -> IO () extractUpTo df s e = liftJSM $ extractUpTo_ df (toNode s) (toNode e) #else From 69477d8f263923cd6da43e898acccd5c4c93462f Mon Sep 17 00:00:00 2001 From: ymeister <47071325+ymeister@users.noreply.github.com> Date: Thu, 1 Aug 2024 03:31:11 +0400 Subject: [PATCH 11/20] Remove JavaScriptFFI pragma --- reflex-dom-core/src-ghcjs/Foreign/JavaScript/Internal/Utils.hs | 1 - reflex-dom-core/src/Foreign/JavaScript/TH.hs | 1 - reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs | 1 - reflex-dom-core/src/Reflex/Dom/WebSocket/Foreign.hs | 1 - 4 files changed, 4 deletions(-) diff --git a/reflex-dom-core/src-ghcjs/Foreign/JavaScript/Internal/Utils.hs b/reflex-dom-core/src-ghcjs/Foreign/JavaScript/Internal/Utils.hs index 06cb003e..323637a0 100644 --- a/reflex-dom-core/src-ghcjs/Foreign/JavaScript/Internal/Utils.hs +++ b/reflex-dom-core/src-ghcjs/Foreign/JavaScript/Internal/Utils.hs @@ -1,6 +1,5 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE ForeignFunctionInterface #-} -{-# LANGUAGE JavaScriptFFI #-} module Foreign.JavaScript.Internal.Utils ( synchronously diff --git a/reflex-dom-core/src/Foreign/JavaScript/TH.hs b/reflex-dom-core/src/Foreign/JavaScript/TH.hs index bf2080cc..1e83a76d 100644 --- a/reflex-dom-core/src/Foreign/JavaScript/TH.hs +++ b/reflex-dom-core/src/Foreign/JavaScript/TH.hs @@ -10,7 +10,6 @@ {-# LANGUAGE UndecidableInstances #-} #ifdef ghcjs_HOST_OS {-# LANGUAGE ForeignFunctionInterface #-} -{-# LANGUAGE JavaScriptFFI #-} #endif module Foreign.JavaScript.TH ( module Foreign.JavaScript.TH #ifdef USE_TEMPLATE_HASKELL diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs index ee7b5136..b7e699e1 100644 --- a/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs +++ b/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs @@ -25,7 +25,6 @@ {-# LANGUAGE UndecidableInstances #-} #ifdef ghcjs_HOST_OS {-# LANGUAGE ForeignFunctionInterface #-} -{-# LANGUAGE JavaScriptFFI #-} #endif -- | This is a builder to be used on the client side. It can be run in two modes: -- diff --git a/reflex-dom-core/src/Reflex/Dom/WebSocket/Foreign.hs b/reflex-dom-core/src/Reflex/Dom/WebSocket/Foreign.hs index 1ad06a2a..4e274b82 100644 --- a/reflex-dom-core/src/Reflex/Dom/WebSocket/Foreign.hs +++ b/reflex-dom-core/src/Reflex/Dom/WebSocket/Foreign.hs @@ -1,7 +1,6 @@ {-# LANGUAGE CPP #-} #ifdef ghcjs_HOST_OS {-# LANGUAGE ForeignFunctionInterface #-} -{-# LANGUAGE JavaScriptFFI #-} #endif {-# LANGUAGE LambdaCase #-} From 9f716704784593d2a65447ff4db70c91afb6b166 Mon Sep 17 00:00:00 2001 From: ymeister <47071325+ymeister@users.noreply.github.com> Date: Thu, 1 Aug 2024 03:31:35 +0400 Subject: [PATCH 12/20] Make reflex-dom buildable on ghc js backend --- reflex-dom/reflex-dom.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reflex-dom/reflex-dom.cabal b/reflex-dom/reflex-dom.cabal index 635af032..6ff28874 100644 --- a/reflex-dom/reflex-dom.cabal +++ b/reflex-dom/reflex-dom.cabal @@ -76,7 +76,7 @@ library reflex >= 0.8 && < 1, reflex-dom-core >= 0.6.1.0 && <0.9, text == 1.2.* - if !impl(ghcjs) + if !(impl(ghcjs) || arch(javascript)) if flag(use-warp) build-depends: jsaddle >= 0.9.6 && < 0.10, From 29918d7bd538f61bf9bbfd5f19f860615cc7ee48 Mon Sep 17 00:00:00 2001 From: ymeister <47071325+ymeister@users.noreply.github.com> Date: Thu, 1 Aug 2024 03:42:44 +0400 Subject: [PATCH 13/20] Use Type from Data.Kind instead of * --- .../src/Reflex/Dom/Builder/Class.hs | 25 ++++++++++--------- .../src/Reflex/Dom/Builder/Class/Events.hs | 5 ++-- .../src/Reflex/Dom/Builder/Immediate.hs | 5 ++-- .../src/Reflex/Dom/Builder/Static.hs | 5 ++-- reflex-dom-core/src/Reflex/Dom/Prerender.hs | 3 ++- .../src/Reflex/Dom/Widget/Basic.hs | 3 ++- .../src/Reflex/Dom/Widget/Input.hs | 7 +++--- 7 files changed, 30 insertions(+), 23 deletions(-) diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs index 20eca905..7117e827 100644 --- a/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs +++ b/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs @@ -54,6 +54,7 @@ import Control.Monad.State.Strict import Control.Monad.Trans.Control import Data.Default import Data.Functor.Misc +import Data.Kind (Type) import Data.Map (Map) import qualified Data.Map as Map import Data.Maybe @@ -67,20 +68,20 @@ import GHCJS.DOM.Types (JSM) import qualified GHCJS.DOM.Types as DOM class Default (EventSpec d EventResult) => DomSpace d where - type EventSpec d :: (EventTag -> *) -> * - type RawDocument d :: * - type RawTextNode d :: * - type RawCommentNode d :: * - type RawElement d :: * - type RawInputElement d :: * - type RawTextAreaElement d :: * - type RawSelectElement d :: * + type EventSpec d :: (EventTag -> Type) -> Type + type RawDocument d :: Type + type RawTextNode d :: Type + type RawCommentNode d :: Type + type RawElement d :: Type + type RawInputElement d :: Type + type RawTextAreaElement d :: Type + type RawSelectElement d :: Type addEventSpecFlags :: proxy d -> EventName en -> (Maybe (er en) -> EventFlags) -> EventSpec d er -> EventSpec d er -- | @'DomBuilder' t m@ indicates that @m@ is a 'Monad' capable of building -- dynamic DOM in the 'Reflex' timeline @t@ class (Monad m, Reflex t, DomSpace (DomBuilderSpace m), NotReady t m, Adjustable t m) => DomBuilder t m | m -> t where - type DomBuilderSpace m :: * + type DomBuilderSpace m :: Type textNode :: TextNodeConfig t -> m (TextNode (DomBuilderSpace m) t) default textNode :: ( MonadTrans f , m ~ f m' @@ -160,7 +161,7 @@ class (Monad m, Reflex t, DomSpace (DomBuilderSpace m), NotReady t m, Adjustable {-# INLINABLE wrapRawElement #-} class DomBuilder t m => MountableDomBuilder t m where - type DomFragment m :: * + type DomFragment m :: Type buildDomFragment :: m a -> m (DomFragment m, a) mountDomFragment :: DomFragment m -> Event t (DomFragment m) -> m () @@ -642,7 +643,7 @@ instance (DomBuilder t m, MonadFix m, MonadHold t m, Group q, Query q, Commutati -- * Convenience functions class HasDomEvent t target eventName | target -> t where - type DomEventType target eventName :: * + type DomEventType target eventName :: Type domEvent :: EventName eventName -> target -> Event t (DomEventType target eventName) instance Reflex t => HasDomEvent t (Element EventResult d t) en where @@ -749,7 +750,7 @@ instance HasDocument m => HasDocument (RequesterT t request response m) instance HasDocument m => HasDocument (QueryT t q m) class HasSetValue a where - type SetValue a :: * + type SetValue a :: Type setValue :: Lens' a (SetValue a) instance Reflex t => HasSetValue (TextAreaElementConfig er t m) where diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Class/Events.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Class/Events.hs index 84085b3a..978be6fe 100644 --- a/reflex-dom-core/src/Reflex/Dom/Builder/Class/Events.hs +++ b/reflex-dom-core/src/Reflex/Dom/Builder/Class/Events.hs @@ -15,6 +15,7 @@ import Data.Type.Equality ((:~:)(..)) import Data.GADT.Compare (GOrdering(..), GEq(..), GCompare(..)) #endif +import Data.Kind (Type) import Data.Text (Text) data EventTag @@ -65,7 +66,7 @@ data EventTag | TouchendTag | TouchcancelTag -data EventName :: EventTag -> * where +data EventName :: EventTag -> Type where Abort :: EventName 'AbortTag Blur :: EventName 'BlurTag Change :: EventName 'ChangeTag @@ -115,7 +116,7 @@ data EventName :: EventTag -> * where newtype EventResult en = EventResult { unEventResult :: EventResultType en } -type family EventResultType (en :: EventTag) :: * where +type family EventResultType (en :: EventTag) :: Type where EventResultType 'ClickTag = () EventResultType 'DblclickTag = (Int, Int) EventResultType 'KeypressTag = Word diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs index b7e699e1..0496f55a 100644 --- a/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs +++ b/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs @@ -139,6 +139,7 @@ import Data.Functor.Product import Data.GADT.Compare (GCompare) import Data.IORef import Data.IntMap.Strict (IntMap) +import Data.Kind (Type) import Data.Maybe import Data.Monoid ((<>)) import Data.Some (Some(..)) @@ -675,7 +676,7 @@ instance DomSpace GhcjsDomSpace where newtype GhcjsEventFilter er en = GhcjsEventFilter (GhcjsDomEvent en -> JSM (EventFlags, JSM (Maybe (er en)))) -data Pair1 (f :: k -> *) (g :: k -> *) (a :: k) = Pair1 (f a) (g a) +data Pair1 (f :: k -> Type) (g :: k -> Type) (a :: k) = Pair1 (f a) (g a) data Maybe1 f a = Nothing1 | Just1 (f a) @@ -1702,7 +1703,7 @@ instance (Adjustable t m, MonadJSM m, MonadHold t m, MonadFix m, PrimMonad m, Ra {-# INLINABLE traverseDMapWithKeyWithAdjust' #-} traverseDMapWithKeyWithAdjust' - :: forall s t m (k :: * -> *) v v'. (Adjustable t m, MonadHold t m, MonadFix m, MonadJSM m, PrimMonad m, GCompare k, RawDocument (DomBuilderSpace (HydrationDomBuilderT s t m)) ~ Document) + :: forall s t m (k :: Type -> Type) v v'. (Adjustable t m, MonadHold t m, MonadFix m, MonadJSM m, PrimMonad m, GCompare k, RawDocument (DomBuilderSpace (HydrationDomBuilderT s t m)) ~ Document) => (forall a. k a -> v a -> HydrationDomBuilderT s t m (v' a)) -> DMap k v -> Event t (PatchDMap k v) diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Static.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Static.hs index b2d94deb..4bfed780 100644 --- a/reflex-dom-core/src/Reflex/Dom/Builder/Static.hs +++ b/reflex-dom-core/src/Reflex/Dom/Builder/Static.hs @@ -37,6 +37,7 @@ import Data.Functor.Compose import Data.Functor.Constant import Data.IntMap (IntMap) import qualified Data.IntMap as IntMap +import Data.Kind (Type) import qualified Data.Map as Map import Data.Map.Misc (applyMap) import Data.Maybe (fromMaybe) @@ -146,7 +147,7 @@ data StaticDomEvent (a :: k) -- | Static documents don't process events, so all handlers are equivalent data StaticDomHandler (a :: k) (b :: k) = StaticDomHandler -data StaticEventSpec (er :: EventTag -> *) = StaticEventSpec deriving (Generic) +data StaticEventSpec (er :: EventTag -> Type) = StaticEventSpec deriving (Generic) instance Default (StaticEventSpec er) @@ -221,7 +222,7 @@ hoistIntMapWithKeyWithAdjust base f im0 im' = do sample o return (result0, result') -hoistDMapWithKeyWithAdjust :: forall (k :: * -> *) v v' t m p. +hoistDMapWithKeyWithAdjust :: forall (k :: Type -> Type) v v' t m p. ( Adjustable t m , MonadHold t m , PatchTarget (p k (Constant (Behavior t Builder))) ~ DMap k (Constant (Behavior t Builder)) diff --git a/reflex-dom-core/src/Reflex/Dom/Prerender.hs b/reflex-dom-core/src/Reflex/Dom/Prerender.hs index 3fbf0cb9..abb93cfb 100644 --- a/reflex-dom-core/src/Reflex/Dom/Prerender.hs +++ b/reflex-dom-core/src/Reflex/Dom/Prerender.hs @@ -28,6 +28,7 @@ import Control.Monad.Primitive (PrimMonad(..)) import Control.Monad.Reader import Control.Monad.Ref (MonadRef(..), MonadAtomicRef(..)) import Data.IORef (IORef, newIORef) +import Data.Kind (Type) import Data.Semigroup (Semigroup) import Data.Semigroup.Commutative import Data.Text (Text) @@ -82,7 +83,7 @@ prerender_ server client = void $ prerender server client class (PrerenderClientConstraint t (Client m), Client (Client m) ~ Client m, Prerender t (Client m)) => Prerender t m | m -> t where -- | Monad in which the client widget is built - type Client m :: * -> * + type Client m :: Type -> Type -- | Render the first widget on the server, and the second on the client. The -- hydration builder will run *both* widgets, updating the result dynamic at -- switchover time. diff --git a/reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs b/reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs index c6dffa40..a42db70a 100644 --- a/reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs +++ b/reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs @@ -79,6 +79,7 @@ import Data.Default import Data.Either import Data.Foldable import Data.Functor (void) +import Data.Kind (Type) import Data.Map (Map) import qualified Data.Map as Map import Data.Map.Misc @@ -342,5 +343,5 @@ tabDisplay ulClass activeClass tabItems = do return $ fmap (const k) (_link_clicked a) class HasAttributes a where - type Attrs a :: * + type Attrs a :: Type attributes :: Lens' a (Attrs a) diff --git a/reflex-dom-core/src/Reflex/Dom/Widget/Input.hs b/reflex-dom-core/src/Reflex/Dom/Widget/Input.hs index 086a8ed1..2d99d552 100644 --- a/reflex-dom-core/src/Reflex/Dom/Widget/Input.hs +++ b/reflex-dom-core/src/Reflex/Dom/Widget/Input.hs @@ -28,6 +28,7 @@ import Data.Default import Data.Dependent.Map (DMap) import qualified Data.Dependent.Map as DMap import Data.Functor.Misc +import Data.Kind (Type) import Data.Map (Map) import qualified Data.Map as Map import Data.Maybe @@ -233,7 +234,7 @@ checkbox checked config = do , _checkbox_change = _inputElement_checkedChange i } -type family CheckboxViewEventResultType (en :: EventTag) :: * where +type family CheckboxViewEventResultType (en :: EventTag) :: Type where CheckboxViewEventResultType 'ClickTag = Bool CheckboxViewEventResultType t = EventResultType t @@ -369,7 +370,7 @@ instance Reflex t => Default (DropdownConfig t k) where , _dropdownConfig_attributes = constDyn mempty } -type family DropdownViewEventResultType (en :: EventTag) :: * where +type family DropdownViewEventResultType (en :: EventTag) :: Type where DropdownViewEventResultType 'ChangeTag = Text DropdownViewEventResultType t = EventResultType t @@ -649,7 +650,7 @@ instance HasSetValue (CheckboxConfig t) where setValue = checkboxConfig_setValue class HasValue a where - type Value a :: * + type Value a :: Type value :: a -> Value a instance HasValue (InputElement er d t) where From f269ed8d00777c899393722e2cd1271f2c61c5b5 Mon Sep 17 00:00:00 2001 From: ymeister <47071325+ymeister@users.noreply.github.com> Date: Thu, 1 Aug 2024 04:14:08 +0400 Subject: [PATCH 14/20] Cleanup warnings --- .../src/Reflex/Dom/Builder/Class.hs | 11 ++-- .../src/Reflex/Dom/Builder/Class/Events.hs | 1 + .../src/Reflex/Dom/Builder/Hydratable.hs | 3 +- .../src/Reflex/Dom/Builder/Immediate.hs | 5 +- .../src/Reflex/Dom/Builder/InputDisabled.hs | 2 +- .../src/Reflex/Dom/Builder/Static.hs | 3 +- reflex-dom-core/src/Reflex/Dom/Class.hs | 10 +-- reflex-dom-core/src/Reflex/Dom/Core.hs | 1 + reflex-dom-core/src/Reflex/Dom/Location.hs | 2 +- reflex-dom-core/src/Reflex/Dom/Main.hs | 4 +- .../src/Reflex/Dom/Modals/Class.hs | 1 + reflex-dom-core/src/Reflex/Dom/Old.hs | 64 ++++++++++--------- reflex-dom-core/src/Reflex/Dom/Prerender.hs | 13 ++-- .../src/Reflex/Dom/WebSocket/Query.hs | 6 +- .../src/Reflex/Dom/Widget/Basic.hs | 3 +- .../src/Reflex/Dom/Widget/Input.hs | 8 ++- reflex-dom-core/src/Reflex/Dom/Widget/Lazy.hs | 3 +- .../src/Reflex/Dom/Widget/Resize.hs | 4 +- reflex-dom-core/src/Reflex/Dom/Xhr.hs | 1 + reflex-dom-core/src/Reflex/Dom/Xhr/Foreign.hs | 6 +- .../src/Reflex/Dom/Xhr/FormData.hs | 5 +- reflex-dom/src/Reflex/Dom.hs | 8 ++- reflex-dom/src/Reflex/Dom/Internal.hs | 16 +++-- .../src/Reflex/Dom/Location/Platform.hs | 1 + 24 files changed, 99 insertions(+), 82 deletions(-) diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs index 7117e827..c4cd5339 100644 --- a/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs +++ b/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs @@ -22,12 +22,14 @@ {-# LANGUAGE TemplateHaskell #-} #endif {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} + module Reflex.Dom.Builder.Class - ( module Reflex.Dom.Builder.Class - , module Reflex.Dom.Builder.Class.Events - , module Reflex.NotReady.Class - ) where + ( module Reflex.Dom.Builder.Class + , module Reflex.Dom.Builder.Class.Events + , module Reflex.NotReady.Class + ) where import Reflex.Adjustable.Class import Reflex.Class as Reflex @@ -59,7 +61,6 @@ import Data.Map (Map) import qualified Data.Map as Map import Data.Maybe import Data.Proxy -import Data.Semigroup import Data.Semigroup.Commutative import Data.String import Data.Text (Text) diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Class/Events.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Class/Events.hs index 978be6fe..05721ad9 100644 --- a/reflex-dom-core/src/Reflex/Dom/Builder/Class/Events.hs +++ b/reflex-dom-core/src/Reflex/Dom/Builder/Class/Events.hs @@ -6,6 +6,7 @@ {-# LANGUAGE TemplateHaskell #-} #endif {-# LANGUAGE TypeFamilies #-} + module Reflex.Dom.Builder.Class.Events where #ifdef USE_TEMPLATE_HASKELL diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Hydratable.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Hydratable.hs index f864a756..24400361 100644 --- a/reflex-dom-core/src/Reflex/Dom/Builder/Hydratable.hs +++ b/reflex-dom-core/src/Reflex/Dom/Builder/Hydratable.hs @@ -6,6 +6,7 @@ {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-} + module Reflex.Dom.Builder.Hydratable where import Control.Monad.Fix @@ -20,7 +21,7 @@ import GHCJS.DOM.Types (MonadJSM (..)) #endif import Reflex import Reflex.Dom.Builder.Class -import Reflex.Dom.Builder.Immediate (HasDocument (..), hydratableAttribute) +import Reflex.Dom.Builder.Immediate (hydratableAttribute) import Reflex.Host.Class -- | A DomBuilder transformer that adds an attribute to all elements such that the diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs index 0496f55a..fb72a314 100644 --- a/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs +++ b/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs @@ -130,7 +130,6 @@ import Data.Bitraversable import Data.Default import Data.Dependent.Map (DMap) import Data.Dependent.Sum -import Data.FastMutableIntMap (PatchIntMap (..)) import Data.Foldable (for_, traverse_) import Data.Functor.Compose import Data.Functor.Constant @@ -141,7 +140,6 @@ import Data.IORef import Data.IntMap.Strict (IntMap) import Data.Kind (Type) import Data.Maybe -import Data.Monoid ((<>)) import Data.Some (Some(..)) import Data.String (IsString) import Data.Text (Text) @@ -154,7 +152,7 @@ import GHCJS.DOM.EventM (EventM, event, on) import GHCJS.DOM.KeyboardEvent as KeyboardEvent import GHCJS.DOM.MouseEvent import GHCJS.DOM.Node (appendChild_, getOwnerDocumentUnchecked, getParentNodeUnchecked, setNodeValue, toNode) -import GHCJS.DOM.Types (liftJSM, askJSM, runJSM, JSM, MonadJSM, FocusEvent, IsElement, IsEvent, IsNode, KeyboardEvent, Node, TouchEvent, WheelEvent, uncheckedCastTo, ClipboardEvent) +import GHCJS.DOM.Types (liftJSM, askJSM, runJSM, JSM, MonadJSM, FocusEvent, IsElement, IsEvent, IsNode, Node, TouchEvent, WheelEvent, uncheckedCastTo) import GHCJS.DOM.UIEvent #ifndef ghcjs_HOST_OS import Language.Javascript.JSaddle (call, eval) -- Avoid using eval in ghcjs. Use ffi instead @@ -164,7 +162,6 @@ import Reflex.Class as Reflex import Reflex.Dom.Builder.Class import Reflex.Dynamic import Reflex.Host.Class -import Reflex.Patch.DMapWithMove (PatchDMapWithMove(..)) import Reflex.Patch.MapWithMove (PatchMapWithMove(..)) import Reflex.PerformEvent.Base (PerformEventT) import Reflex.PerformEvent.Class diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/InputDisabled.hs b/reflex-dom-core/src/Reflex/Dom/Builder/InputDisabled.hs index 2bc8b50e..4ab6987d 100644 --- a/reflex-dom-core/src/Reflex/Dom/Builder/InputDisabled.hs +++ b/reflex-dom-core/src/Reflex/Dom/Builder/InputDisabled.hs @@ -6,6 +6,7 @@ {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-} + module Reflex.Dom.Builder.InputDisabled where import Control.Monad.Fix @@ -20,7 +21,6 @@ import GHCJS.DOM.Types (MonadJSM (..)) #endif import Reflex import Reflex.Dom.Builder.Class -import Reflex.Dom.Builder.Immediate (HasDocument (..)) import Reflex.Host.Class -- | A DomBuilder transformer that disables all 'inputElement's, diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Static.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Static.hs index 4bfed780..b493e4ae 100644 --- a/reflex-dom-core/src/Reflex/Dom/Builder/Static.hs +++ b/reflex-dom-core/src/Reflex/Dom/Builder/Static.hs @@ -13,6 +13,7 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} + module Reflex.Dom.Builder.Static where import Data.IORef (IORef) @@ -21,7 +22,6 @@ import Control.Lens hiding (element) import Control.Monad import Control.Monad.Exception import Control.Monad.Fix -import Control.Monad.Identity import Control.Monad.Primitive import Control.Monad.Ref import Control.Monad.State.Strict @@ -41,7 +41,6 @@ import Data.Kind (Type) import qualified Data.Map as Map import Data.Map.Misc (applyMap) import Data.Maybe (fromMaybe) -import Data.Monoid ((<>)) import qualified Data.Set as Set import Data.Text (Text) import qualified Data.Text as T diff --git a/reflex-dom-core/src/Reflex/Dom/Class.hs b/reflex-dom-core/src/Reflex/Dom/Class.hs index f774b69b..97452eb5 100644 --- a/reflex-dom-core/src/Reflex/Dom/Class.hs +++ b/reflex-dom-core/src/Reflex/Dom/Class.hs @@ -1,8 +1,10 @@ {-# LANGUAGE MultiParamTypeClasses #-} -module Reflex.Dom.Class ( module Reflex.Dom.Class - , module Foreign.JavaScript.TH - , module Web.KeyCode - ) where + +module Reflex.Dom.Class + ( module Reflex.Dom.Class + , module Foreign.JavaScript.TH + , module Web.KeyCode + ) where import Control.Lens import Reflex.Class diff --git a/reflex-dom-core/src/Reflex/Dom/Core.hs b/reflex-dom-core/src/Reflex/Dom/Core.hs index eb0b24c1..6a414b6a 100644 --- a/reflex-dom-core/src/Reflex/Dom/Core.hs +++ b/reflex-dom-core/src/Reflex/Dom/Core.hs @@ -2,6 +2,7 @@ -- reexporting on ghc > 8.2. -- https://github.com/haskell/haddock/issues/979 {-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} + module Reflex.Dom.Core (module X) where import Reflex as X hiding (askEvents) diff --git a/reflex-dom-core/src/Reflex/Dom/Location.hs b/reflex-dom-core/src/Reflex/Dom/Location.hs index 2408f870..0f47bd8d 100644 --- a/reflex-dom-core/src/Reflex/Dom/Location.hs +++ b/reflex-dom-core/src/Reflex/Dom/Location.hs @@ -3,6 +3,7 @@ {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RankNTypes #-} + module Reflex.Dom.Location ( browserHistoryWith , getLocationAfterHost @@ -28,7 +29,6 @@ import Control.Lens ((^.)) import Control.Monad ((>=>)) import Control.Monad.Fix (MonadFix) import Data.Align (align) -import Data.Monoid import Data.Text (Text) import Data.These (These(..)) import qualified GHCJS.DOM as DOM diff --git a/reflex-dom-core/src/Reflex/Dom/Main.hs b/reflex-dom-core/src/Reflex/Dom/Main.hs index ba6d47ba..0ce27b91 100644 --- a/reflex-dom-core/src/Reflex/Dom/Main.hs +++ b/reflex-dom-core/src/Reflex/Dom/Main.hs @@ -12,6 +12,7 @@ {-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -fspecialise-aggressively #-} + module Reflex.Dom.Main where import Prelude hiding (concat, mapM, mapM_, sequence, sequence_) @@ -33,14 +34,13 @@ import Reflex.Profiled import Control.Concurrent import Control.Lens import Control.Monad -import Control.Monad.Reader hiding (forM, forM_, mapM, mapM_, sequence, sequence_) +import Control.Monad.Reader import Control.Monad.Ref import Data.ByteString (ByteString) import Data.Dependent.Sum (DSum (..)) import Data.Foldable (for_) import Data.IORef import Data.Maybe -import Data.Monoid ((<>)) import Data.Text (Text) import qualified Data.Text as T import Data.Text.Encoding diff --git a/reflex-dom-core/src/Reflex/Dom/Modals/Class.hs b/reflex-dom-core/src/Reflex/Dom/Modals/Class.hs index f115e94d..03b0fa28 100644 --- a/reflex-dom-core/src/Reflex/Dom/Modals/Class.hs +++ b/reflex-dom-core/src/Reflex/Dom/Modals/Class.hs @@ -1,4 +1,5 @@ {-# LANGUAGE MultiParamTypeClasses #-} + module Reflex.Dom.Modals.Class where import Reflex diff --git a/reflex-dom-core/src/Reflex/Dom/Old.hs b/reflex-dom-core/src/Reflex/Dom/Old.hs index aa113979..9b1fa9a7 100644 --- a/reflex-dom-core/src/Reflex/Dom/Old.hs +++ b/reflex-dom-core/src/Reflex/Dom/Old.hs @@ -6,43 +6,45 @@ {-# LANGUAGE Rank2Types #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE LambdaCase #-} #ifdef USE_TEMPLATE_HASKELL {-# LANGUAGE TemplateHaskell #-} #endif + module Reflex.Dom.Old - ( MonadWidget - , El - , ElConfig (..) - , elConfig_namespace - , elConfig_attributes - , _el_clicked - , _el_element - , _el_events - , addVoidAction - , AttributeMap - , Attributes (..) - , buildElement - , buildElementNS - , buildEmptyElement - , buildEmptyElementNS - , elDynHtml' - , elDynHtmlAttr' - , elStopPropagationNS - , elWith - , elWith' - , emptyElWith - , emptyElWith' - , namedNodeMapGetNames - , nodeClear - , onEventName - , schedulePostBuild - , text' - , unsafePlaceElement - , WidgetHost - , wrapElement - ) where + ( MonadWidget + , El + , ElConfig (..) + , elConfig_namespace + , elConfig_attributes + , _el_clicked + , _el_element + , _el_events + , addVoidAction + , AttributeMap + , Attributes (..) + , buildElement + , buildElementNS + , buildEmptyElement + , buildEmptyElementNS + , elDynHtml' + , elDynHtmlAttr' + , elStopPropagationNS + , elWith + , elWith' + , emptyElWith + , emptyElWith' + , namedNodeMapGetNames + , nodeClear + , onEventName + , schedulePostBuild + , text' + , unsafePlaceElement + , WidgetHost + , wrapElement + ) where import Control.Arrow (first) #ifdef USE_TEMPLATE_HASKELL diff --git a/reflex-dom-core/src/Reflex/Dom/Prerender.hs b/reflex-dom-core/src/Reflex/Dom/Prerender.hs index abb93cfb..7fce9dc5 100644 --- a/reflex-dom-core/src/Reflex/Dom/Prerender.hs +++ b/reflex-dom-core/src/Reflex/Dom/Prerender.hs @@ -11,16 +11,17 @@ {-# LANGUAGE RecursiveDo #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE UndecidableSuperClasses #-} -- | Render the first widget on the server, and the second on the client. module Reflex.Dom.Prerender - ( Prerender (..) - , prerender_ - , PrerenderClientConstraint - , PrerenderBaseConstraints - ) where + ( Prerender (..) + , prerender_ + , PrerenderClientConstraint + , PrerenderBaseConstraints + ) where import Control.Monad import Control.Monad.Fix @@ -29,11 +30,9 @@ import Control.Monad.Reader import Control.Monad.Ref (MonadRef(..), MonadAtomicRef(..)) import Data.IORef (IORef, newIORef) import Data.Kind (Type) -import Data.Semigroup (Semigroup) import Data.Semigroup.Commutative import Data.Text (Text) import Data.Void -import Foreign.JavaScript.TH import GHCJS.DOM.Types (MonadJSM) import Reflex hiding (askEvents) import Reflex.Dom.Builder.Class diff --git a/reflex-dom-core/src/Reflex/Dom/WebSocket/Query.hs b/reflex-dom-core/src/Reflex/Dom/WebSocket/Query.hs index a8c4266a..3c79a0b4 100644 --- a/reflex-dom-core/src/Reflex/Dom/WebSocket/Query.hs +++ b/reflex-dom-core/src/Reflex/Dom/WebSocket/Query.hs @@ -1,6 +1,10 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE RecursiveDo #-} -module Reflex.Dom.WebSocket.Query (cropQueryT, runWebSocketQuery) where + +module Reflex.Dom.WebSocket.Query + ( cropQueryT + , runWebSocketQuery + ) where import Data.Default import Control.Monad.Fix diff --git a/reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs b/reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs index a42db70a..9ab64b8f 100644 --- a/reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs +++ b/reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs @@ -9,6 +9,7 @@ {-# LANGUAGE RecursiveDo #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} + module Reflex.Dom.Widget.Basic ( -- * Displaying Values @@ -70,10 +71,8 @@ import Reflex.Network import Reflex.PostBuild.Class import Reflex.Workflow -import Control.Arrow import Control.Lens hiding (children, element) import Control.Monad.Fix -import Control.Monad.Reader hiding (forM, forM_, mapM, mapM_, sequence, sequence_) import Data.Align import Data.Default import Data.Either diff --git a/reflex-dom-core/src/Reflex/Dom/Widget/Input.hs b/reflex-dom-core/src/Reflex/Dom/Widget/Input.hs index 2d99d552..87d4f03c 100644 --- a/reflex-dom-core/src/Reflex/Dom/Widget/Input.hs +++ b/reflex-dom-core/src/Reflex/Dom/Widget/Input.hs @@ -13,8 +13,13 @@ {-# LANGUAGE TemplateHaskell #-} #endif {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} -module Reflex.Dom.Widget.Input (module Reflex.Dom.Widget.Input, def, (&), (.~)) where + +module Reflex.Dom.Widget.Input + ( module Reflex.Dom.Widget.Input + , def, (&), (.~) + ) where import Prelude @@ -32,7 +37,6 @@ import Data.Kind (Type) import Data.Map (Map) import qualified Data.Map as Map import Data.Maybe -import Data.Semigroup import Data.Text (Text) import qualified Data.Text as T import GHCJS.DOM.HTMLInputElement (HTMLInputElement) diff --git a/reflex-dom-core/src/Reflex/Dom/Widget/Lazy.hs b/reflex-dom-core/src/Reflex/Dom/Widget/Lazy.hs index dd2aeecb..bc031e9c 100644 --- a/reflex-dom-core/src/Reflex/Dom/Widget/Lazy.hs +++ b/reflex-dom-core/src/Reflex/Dom/Widget/Lazy.hs @@ -4,6 +4,8 @@ {-# LANGUAGE RecursiveDo #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} + module Reflex.Dom.Widget.Lazy where import Reflex.Class @@ -20,7 +22,6 @@ import Control.Monad.Fix import Data.Fixed import Data.Map (Map) import qualified Data.Map as Map -import Data.Monoid import Data.Text (Text) import qualified Data.Text as T import GHCJS.DOM.Element diff --git a/reflex-dom-core/src/Reflex/Dom/Widget/Resize.hs b/reflex-dom-core/src/Reflex/Dom/Widget/Resize.hs index f6fd95ed..8dd6e5a8 100644 --- a/reflex-dom-core/src/Reflex/Dom/Widget/Resize.hs +++ b/reflex-dom-core/src/Reflex/Dom/Widget/Resize.hs @@ -4,6 +4,8 @@ {-# LANGUAGE RecursiveDo #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} + module Reflex.Dom.Widget.Resize where import Reflex.Class @@ -16,12 +18,10 @@ import Reflex.PerformEvent.Class import Reflex.PostBuild.Class import Reflex.TriggerEvent.Class -import Control.Monad import Control.Monad.Fix import Control.Monad.IO.Class import Data.Map (Map) import qualified Data.Map as Map -import Data.Monoid import Data.Text (Text) import qualified Data.Text as T import GHCJS.DOM.Element diff --git a/reflex-dom-core/src/Reflex/Dom/Xhr.hs b/reflex-dom-core/src/Reflex/Dom/Xhr.hs index 874938b2..31095e5a 100644 --- a/reflex-dom-core/src/Reflex/Dom/Xhr.hs +++ b/reflex-dom-core/src/Reflex/Dom/Xhr.hs @@ -8,6 +8,7 @@ #ifdef USE_TEMPLATE_HASKELL {-# LANGUAGE TemplateHaskell #-} #endif +{-# LANGUAGE TypeOperators #-} -- | A module for performing asynchronous HTTP calls from JavaScript -- using the diff --git a/reflex-dom-core/src/Reflex/Dom/Xhr/Foreign.hs b/reflex-dom-core/src/Reflex/Dom/Xhr/Foreign.hs index 2528f99d..3a72526f 100644 --- a/reflex-dom-core/src/Reflex/Dom/Xhr/Foreign.hs +++ b/reflex-dom-core/src/Reflex/Dom/Xhr/Foreign.hs @@ -1,11 +1,11 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE OverloadedStrings #-} -module Reflex.Dom.Xhr.Foreign ( - XMLHttpRequest +module Reflex.Dom.Xhr.Foreign + ( XMLHttpRequest , XMLHttpRequestResponseType(..) , module Reflex.Dom.Xhr.Foreign -) where + ) where import Control.Exception (throwIO) import Control.Monad.IO.Class (MonadIO(..)) diff --git a/reflex-dom-core/src/Reflex/Dom/Xhr/FormData.hs b/reflex-dom-core/src/Reflex/Dom/Xhr/FormData.hs index 664e003f..43094af0 100644 --- a/reflex-dom-core/src/Reflex/Dom/Xhr/FormData.hs +++ b/reflex-dom-core/src/Reflex/Dom/Xhr/FormData.hs @@ -1,12 +1,12 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE OverloadedStrings #-} + module Reflex.Dom.Xhr.FormData ( postForms , postForms' , FormValue (..) , fileToFormValue - ) - where + ) where import Control.Lens import Data.Default @@ -14,7 +14,6 @@ import Data.Map (Map) import Data.Text (Text) import Data.Traversable import qualified GHCJS.DOM.FormData as FD -import Foreign.JavaScript.TH import GHCJS.DOM.File (getName) import GHCJS.DOM.Types (File, IsBlob) import Language.Javascript.JSaddle.Monad (MonadJSM, liftJSM) diff --git a/reflex-dom/src/Reflex/Dom.hs b/reflex-dom/src/Reflex/Dom.hs index aad89735..8d86e316 100644 --- a/reflex-dom/src/Reflex/Dom.hs +++ b/reflex-dom/src/Reflex/Dom.hs @@ -5,7 +5,9 @@ module Reflex.Dom (module X) where import Foreign.JavaScript.Orphans () -import Reflex.Dom.Core as X hiding (mainWidget, mainWidgetInElementById, mainWidgetWithCss, - mainWidgetWithHead, mainWidgetWithHead', runApp', - mainHydrationWidgetWithHead, mainHydrationWidgetWithHead') +import Reflex.Dom.Core as X hiding + ( mainWidget, mainWidgetInElementById, mainWidgetWithCss + , mainWidgetWithHead, mainWidgetWithHead', runApp' + , mainHydrationWidgetWithHead, mainHydrationWidgetWithHead' + ) import Reflex.Dom.Internal as X diff --git a/reflex-dom/src/Reflex/Dom/Internal.hs b/reflex-dom/src/Reflex/Dom/Internal.hs index bacf0a64..1139e4f5 100644 --- a/reflex-dom/src/Reflex/Dom/Internal.hs +++ b/reflex-dom/src/Reflex/Dom/Internal.hs @@ -3,6 +3,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeFamilies #-} + module Reflex.Dom.Internal ( module Main , run @@ -13,15 +14,16 @@ module Reflex.Dom.Internal import Data.ByteString (ByteString) import Data.Text (Text) -import Reflex.Dom.Core (Widget) import Reflex.Dom.Main as Main hiding - (mainWidget, mainWidgetWithHead, mainWidgetWithCss, - mainWidgetWithHead', mainWidgetInElementById, runApp', - mainHydrationWidgetWithHead, mainHydrationWidgetWithHead') + ( mainWidget, mainWidgetWithHead, mainWidgetWithCss + , mainWidgetWithHead', mainWidgetInElementById, runApp' + , mainHydrationWidgetWithHead, mainHydrationWidgetWithHead' + ) import qualified Reflex.Dom.Main as Main - (mainWidget, mainWidgetWithHead, mainWidgetWithCss, - mainWidgetWithHead', mainWidgetInElementById, runApp', - mainHydrationWidgetWithHead, mainHydrationWidgetWithHead') + ( mainWidget, mainWidgetWithHead, mainWidgetWithCss + , mainWidgetWithHead', mainWidgetInElementById, runApp' + , mainHydrationWidgetWithHead, mainHydrationWidgetWithHead' + ) #if defined(ghcjs_HOST_OS) run :: a -> a diff --git a/reflex-dom/src/Reflex/Dom/Location/Platform.hs b/reflex-dom/src/Reflex/Dom/Location/Platform.hs index 220111ec..10c1edc1 100644 --- a/reflex-dom/src/Reflex/Dom/Location/Platform.hs +++ b/reflex-dom/src/Reflex/Dom/Location/Platform.hs @@ -1,5 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} + #if defined(ANDROID) module Reflex.Dom.Location.Platform where From 65adc4558c4e6d37f008c8928b089d98c045b743 Mon Sep 17 00:00:00 2001 From: ymeister <47071325+ymeister@users.noreply.github.com> Date: Mon, 5 Aug 2024 03:07:12 +0400 Subject: [PATCH 15/20] Build with ghc(js)-9.10 --- cabal.project | 24 +++++++++++++++++++ reflex-dom-core/reflex-dom-core.cabal | 14 ++++++----- reflex-dom-core/src/Foreign/JavaScript/TH.hs | 18 +------------- .../reflex-dom-test-selenium.cabal | 7 ++++-- reflex-dom/reflex-dom.cabal | 4 ++-- 5 files changed, 40 insertions(+), 27 deletions(-) diff --git a/cabal.project b/cabal.project index 4768e2ff..237a2b1f 100644 --- a/cabal.project +++ b/cabal.project @@ -3,3 +3,27 @@ packages: reflex-dom/ chrome-test-utils/ reflex-dom-test-selenium/ + +allow-newer: + which:base + , which:template-haskell + , dependent-sum-template:template-haskell + +if !arch(javascript) + source-repository-package + type: git + location: https://github.com/ndmitchell/hlint.git + tag: 49f47288040400f1a4c4af71646d2037fdbbd72b + --sha256: sha256-gHVNiyYkCX8DKzOEt2HeV+2v/AyafpjsgfZbZjHo0lM= + + source-repository-package + type: git + location: https://github.com/gtk2hs/webkit-javascriptcore.git + tag: 0.14.4.6 + --sha256: sha256-AHqqMG7RkCZGjtEKXD94VAzxa8vP0K4LMX9ZjUyPC5M= + + package webkit2gtk3-javascriptcore + documentation: false + +if arch(javascript) + extra-packages: ghci diff --git a/reflex-dom-core/reflex-dom-core.cabal b/reflex-dom-core/reflex-dom-core.cabal index 1e4fcb7a..6f623b8d 100644 --- a/reflex-dom-core/reflex-dom-core.cabal +++ b/reflex-dom-core/reflex-dom-core.cabal @@ -68,36 +68,36 @@ library hs-source-dirs: src build-depends: aeson >= 0.8 && < 2.3, - base >= 4.7 && < 4.20, + base >= 4.7 && <= 4.21, bifunctors >= 4.2 && < 6, bimap >= 0.3 && < 0.6, blaze-builder >= 0.4.1 && < 0.5, bytestring >= 0.10 && < 0.13, case-insensitive < 1.3, commutative-semigroups >=0.1 && <0.3, - containers >= 0.6 && < 0.7, + containers >= 0.6 && <= 0.7, constraints >= 0.9 && < 0.15, contravariant >= 1.4 && < 1.6, data-default >= 0.5 && < 0.8, dependent-map >= 0.3 && < 0.5, dependent-sum >= 0.6 && < 0.8, - dependent-sum-template >= 0.1 && < 0.3, + dependent-sum-template >= 0.2 && < 0.3, directory >= 1.2 && < 1.4, exception-transformers == 0.4.*, ghcjs-dom >= 0.9.1.0 && < 0.10, jsaddle >= 0.9.0.0 && < 0.10, -- keycode-0.2 has a bug on firefox keycode >= 0.2.1 && < 0.3, - lens >= 4.7 && < 5.3, + lens >= 4.7 && <= 5.3.2, monad-control >= 1.0.1 && < 1.1, mtl >= 2.1 && < 2.4, - primitive >= 0.5 && < 0.9, + primitive >= 0.5 && <= 0.9.1.0, random >= 1.1 && < 1.3, ref-tf >= 0.4 && < 0.6, reflex >= 0.8.2.1 && < 1, semigroups >= 0.16 && < 0.21, stm >= 2.4 && < 2.6, - text >= 1.2 && < 2.1, + text >= 1.2 && <= 2.1.1, transformers >= 0.3 && < 0.7, network-uri >= 2.6.1 && < 2.7, zenc == 0.1.* @@ -184,6 +184,8 @@ test-suite hlint main-is: hlint.hs type: exitcode-stdio-1.0 default-language: Haskell98 + if arch(javascript) + buildable: False test-suite hydration build-depends: base diff --git a/reflex-dom-core/src/Foreign/JavaScript/TH.hs b/reflex-dom-core/src/Foreign/JavaScript/TH.hs index 1e83a76d..732ee639 100644 --- a/reflex-dom-core/src/Foreign/JavaScript/TH.hs +++ b/reflex-dom-core/src/Foreign/JavaScript/TH.hs @@ -30,27 +30,11 @@ import Language.Haskell.TH import GHCJS.DOM.Types (JSContextRef, askJSM) #ifdef ghcjs_HOST_OS -import qualified GHCJS.Buffer as JS import GHCJS.DOM.Types (MonadJSM) -import qualified GHCJS.DOM.Types as JS -import qualified GHCJS.Foreign as JS #ifdef __GHCJS__ -import qualified GHCJS.Foreign.Callback as JS import qualified GHCJS.Foreign.Callback.Internal (Callback (..)) -#else -import qualified GHC.JS.Foreign.Callback as JS #endif -import qualified JavaScript.Array as JS -import qualified JavaScript.Array.Internal (SomeJSArray (..)) -import qualified JavaScript.Object as JS -import qualified JavaScript.Object.Internal (Object (..)) -import qualified JavaScript.TypedArray.ArrayBuffer as JSArrayBuffer - -import Data.Hashable -import Data.Word -import Foreign.C.Types -import Foreign.Ptr -import Text.Encoding.Z + #else import GHCJS.DOM.Types (MonadJSM (..), runJSM) #endif diff --git a/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal b/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal index a828230a..ee601e72 100644 --- a/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal +++ b/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal @@ -15,7 +15,7 @@ library hs-source-dirs: src build-depends: async, - base >= 4.7 && < 4.20, + base >= 4.7 && <= 4.21, bytestring >= 0.10 && < 0.13, chrome-test-utils, exceptions, @@ -28,7 +28,7 @@ library process, reflex-dom-core, silently, - text == 1.2.*, + text >= 1.2 && <= 2.1.1, wai, warp, webdriver, @@ -39,3 +39,6 @@ library default-language: Haskell98 ghc-options: -Wall -fwarn-tabs -funbox-strict-fields -O2 -ferror-spans -fspecialise-aggressively + + if !os(linux) || !arch(x86_64) + buildable: False diff --git a/reflex-dom/reflex-dom.cabal b/reflex-dom/reflex-dom.cabal index 6ff28874..47eaed31 100644 --- a/reflex-dom/reflex-dom.cabal +++ b/reflex-dom/reflex-dom.cabal @@ -71,11 +71,11 @@ library cpp-options: -DANDROID build-tools: hsc2hs build-depends: - base >= 4.7 && < 4.20, + base >= 4.7 && <= 4.21, bytestring >= 0.10 && < 0.13, reflex >= 0.8 && < 1, reflex-dom-core >= 0.6.1.0 && <0.9, - text == 1.2.* + text >= 1.2 && < 2.2 if !(impl(ghcjs) || arch(javascript)) if flag(use-warp) build-depends: From b69b759a0d90d3ac7fc35083db985603088afda1 Mon Sep 17 00:00:00 2001 From: ymeister <47071325+ymeister@users.noreply.github.com> Date: Mon, 5 Aug 2024 22:28:25 -0400 Subject: [PATCH 16/20] Move project dependecies into a separate project file for transitivity --- cabal.dependencies.project | 20 ++++++++++++++++++++ cabal.project | 23 ++--------------------- 2 files changed, 22 insertions(+), 21 deletions(-) create mode 100644 cabal.dependencies.project diff --git a/cabal.dependencies.project b/cabal.dependencies.project new file mode 100644 index 00000000..d9cf5e45 --- /dev/null +++ b/cabal.dependencies.project @@ -0,0 +1,20 @@ +allow-newer: + which:base + , which:template-haskell + , dependent-sum-template:template-haskell + +if !arch(javascript) + source-repository-package + type: git + location: https://github.com/ndmitchell/hlint.git + tag: 49f47288040400f1a4c4af71646d2037fdbbd72b + --sha256: sha256-gHVNiyYkCX8DKzOEt2HeV+2v/AyafpjsgfZbZjHo0lM= + + source-repository-package + type: git + location: https://github.com/gtk2hs/webkit-javascriptcore.git + tag: 0.14.4.6 + --sha256: sha256-AHqqMG7RkCZGjtEKXD94VAzxa8vP0K4LMX9ZjUyPC5M= + + package webkit2gtk3-javascriptcore + documentation: false diff --git a/cabal.project b/cabal.project index 237a2b1f..1362d589 100644 --- a/cabal.project +++ b/cabal.project @@ -4,26 +4,7 @@ packages: chrome-test-utils/ reflex-dom-test-selenium/ -allow-newer: - which:base - , which:template-haskell - , dependent-sum-template:template-haskell - -if !arch(javascript) - source-repository-package - type: git - location: https://github.com/ndmitchell/hlint.git - tag: 49f47288040400f1a4c4af71646d2037fdbbd72b - --sha256: sha256-gHVNiyYkCX8DKzOEt2HeV+2v/AyafpjsgfZbZjHo0lM= - - source-repository-package - type: git - location: https://github.com/gtk2hs/webkit-javascriptcore.git - tag: 0.14.4.6 - --sha256: sha256-AHqqMG7RkCZGjtEKXD94VAzxa8vP0K4LMX9ZjUyPC5M= - - package webkit2gtk3-javascriptcore - documentation: false - if arch(javascript) extra-packages: ghci + +import: cabal.dependencies.project From 3eac6a88367cd581f1b02f57e1d1df9addc84880 Mon Sep 17 00:00:00 2001 From: ymeister <47071325+ymeister@users.noreply.github.com> Date: Wed, 7 Aug 2024 11:44:57 +0400 Subject: [PATCH 17/20] Update bounds with 'cabal-bounds' & recover backwards compatibility --- .gitignore | 1 + reflex-dom-core/reflex-dom-core.cabal | 496 +++++++++--------- .../Foreign/JavaScript/Internal/Utils.hs | 3 + reflex-dom-core/src/Foreign/JavaScript/TH.hs | 26 +- .../src/Reflex/Dom/Builder/Class.hs | 36 +- .../src/Reflex/Dom/Builder/Hydratable.hs | 1 + .../src/Reflex/Dom/Builder/Immediate.hs | 47 +- .../src/Reflex/Dom/Builder/Static.hs | 7 + reflex-dom-core/src/Reflex/Dom/Location.hs | 11 +- reflex-dom-core/src/Reflex/Dom/Main.hs | 32 +- reflex-dom-core/src/Reflex/Dom/Prerender.hs | 18 +- reflex-dom-core/src/Reflex/Dom/WebSocket.hs | 23 +- .../src/Reflex/Dom/WebSocket/Foreign.hs | 3 + .../src/Reflex/Dom/Widget/Basic.hs | 29 +- .../src/Reflex/Dom/Widget/Input.hs | 13 +- reflex-dom-core/src/Reflex/Dom/Widget/Lazy.hs | 23 +- .../src/Reflex/Dom/Widget/Resize.hs | 26 +- reflex-dom-core/src/Reflex/Dom/Xhr/Foreign.hs | 4 + .../src/Reflex/Dom/Xhr/FormData.hs | 6 + .../reflex-dom-test-selenium.cabal | 79 +-- reflex-dom/reflex-dom.cabal | 399 +++++++------- 21 files changed, 719 insertions(+), 564 deletions(-) diff --git a/.gitignore b/.gitignore index e28ef49b..a241d7e1 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,7 @@ hsenv.log *_stub.h .cabal-sandbox/ cabal.sandbox.config +cabal.project.local .stack-work codex.tags *.dump-* diff --git a/reflex-dom-core/reflex-dom-core.cabal b/reflex-dom-core/reflex-dom-core.cabal index 6f623b8d..c7d3a68e 100644 --- a/reflex-dom-core/reflex-dom-core.cabal +++ b/reflex-dom-core/reflex-dom-core.cabal @@ -1,262 +1,280 @@ -cabal-version: 1.24 -Name: reflex-dom-core -Version: 0.8.0.0 -Synopsis: Functional Reactive Web Apps with Reflex -Description: - Web applications without callbacks or side-effects. - Reflex-DOM brings the power of functional reactive programming (FRP) to the web. - Build HTML and other Document Object Model (DOM) data with a pure functional interface. - . - Reflex-DOM is a Functional Reactive web framework based on the Reflex FRP engine: . - . - The @reflex-dom@ package is a small wrapper around the @reflex-dom-core@ package. It pulls in the - correct set of dependencies for each target platform (GHCJS, WebKitGTK, WASM, mobile, etc.). - Libraries should depend on @reflex-dom-core@ and executables will usually depend on @reflex-dom@. - All of @reflex-dom-core@'s modules are re-exported by @reflex-dom@. -License: BSD3 -License-file: LICENSE -Author: Ryan Trinkle -Maintainer: ryan.trinkle@gmail.com -Stability: Experimental -Category: FRP, Web, GUI, HTML, Javascript, Reactive, Reactivity, User Interfaces, User-interface -Build-type: Simple --- Deal with https://github.com/haskell/cabal/issues/2544 / https://github.com/haskell/cabal/issues/367 -extra-source-files: src-ghc/Foreign/JavaScript/Internal/Utils.hs - src-ghcjs/Foreign/JavaScript/Internal/Utils.hs - src/Reflex/Dom/Xhr/Foreign.hs - src/Reflex/Dom/WebSocket/Foreign.hs - src/Reflex/Dom/Xhr/ResponseType.hs - src/Reflex/Dom/Xhr/Exception.hs - ChangeLog.md +cabal-version: 1.24 +name: reflex-dom-core +version: 0.8.0.0 +license: BSD3 +license-file: LICENSE +maintainer: ryan.trinkle@gmail.com +author: Ryan Trinkle +stability: Experimental +synopsis: Functional Reactive Web Apps with Reflex +description: + Web applications without callbacks or side-effects. + Reflex-DOM brings the power of functional reactive programming (FRP) to the web. + Build HTML and other Document Object Model (DOM) data with a pure functional interface. + . + Reflex-DOM is a Functional Reactive web framework based on the Reflex FRP engine: . + . + The @reflex-dom@ package is a small wrapper around the @reflex-dom-core@ package. It pulls in the + correct set of dependencies for each target platform (GHCJS, WebKitGTK, WASM, mobile, etc.). + Libraries should depend on @reflex-dom-core@ and executables will usually depend on @reflex-dom@. + All of @reflex-dom-core@'s modules are re-exported by @reflex-dom@. + +category: + FRP, Web, GUI, HTML, Javascript, Reactive, Reactivity, User Interfaces, User-interface + +build-type: Simple +extra-source-files: + src-ghc/Foreign/JavaScript/Internal/Utils.hs + src-ghcjs/Foreign/JavaScript/Internal/Utils.hs + src/Reflex/Dom/Xhr/Foreign.hs + src/Reflex/Dom/WebSocket/Foreign.hs + src/Reflex/Dom/Xhr/ResponseType.hs + src/Reflex/Dom/Xhr/Exception.hs + ChangeLog.md + +source-repository head + type: git + location: https://github.com/reflex-frp/reflex-dom + subdir: reflex-dom-core flag use-template-haskell - description: Use template haskell to generate lenses - default: True - manual: True + description: Use template haskell to generate lenses + manual: True flag use-reflex-optimizer - description: Use the GHC plugin Reflex.Optimizer on some of the modules in the package. This is still experimental. - default: False - manual: True + description: + Use the GHC plugin Reflex.Optimizer on some of the modules in the package. This is still experimental. + + default: False + manual: True flag expose-all-unfoldings - description: Build the library with -fexpose-all-unfoldings which can help client code specialize better - default: False - manual: True + description: + Build the library with -fexpose-all-unfoldings which can help client code specialize better + + default: False + manual: True flag profile-reflex - description: Add a layer of profiling to all Reflex events in the system - default: False - manual: True + description: Add a layer of profiling to all Reflex events in the system + default: False + manual: True flag split-these - description: Use split these/semialign packages - manual: False - default: True + description: Use split these/semialign packages flag hydration-tests - description: Whether to run the hydration tests (currently only available on linux) - default: True - manual: True + description: + Whether to run the hydration tests (currently only available on linux) + + manual: True flag gc-tests - description: Whether to run the gc tests (currently only available on linux) - default: True - manual: True + description: + Whether to run the gc tests (currently only available on linux) + + manual: True library - hs-source-dirs: src - build-depends: - aeson >= 0.8 && < 2.3, - base >= 4.7 && <= 4.21, - bifunctors >= 4.2 && < 6, - bimap >= 0.3 && < 0.6, - blaze-builder >= 0.4.1 && < 0.5, - bytestring >= 0.10 && < 0.13, - case-insensitive < 1.3, - commutative-semigroups >=0.1 && <0.3, - containers >= 0.6 && <= 0.7, - constraints >= 0.9 && < 0.15, - contravariant >= 1.4 && < 1.6, - data-default >= 0.5 && < 0.8, - dependent-map >= 0.3 && < 0.5, - dependent-sum >= 0.6 && < 0.8, - dependent-sum-template >= 0.2 && < 0.3, - directory >= 1.2 && < 1.4, - exception-transformers == 0.4.*, - ghcjs-dom >= 0.9.1.0 && < 0.10, - jsaddle >= 0.9.0.0 && < 0.10, - -- keycode-0.2 has a bug on firefox - keycode >= 0.2.1 && < 0.3, - lens >= 4.7 && <= 5.3.2, - monad-control >= 1.0.1 && < 1.1, - mtl >= 2.1 && < 2.4, - primitive >= 0.5 && <= 0.9.1.0, - random >= 1.1 && < 1.3, - ref-tf >= 0.4 && < 0.6, - reflex >= 0.8.2.1 && < 1, - semigroups >= 0.16 && < 0.21, - stm >= 2.4 && < 2.6, - text >= 1.2 && <= 2.1.1, - transformers >= 0.3 && < 0.7, - network-uri >= 2.6.1 && < 2.7, - zenc == 0.1.* - - if impl(ghcjs) || arch(javascript) - hs-source-dirs: src-ghcjs - build-depends: - ghcjs-base, - hashable >= 1.2 && < 1.5 - else - hs-source-dirs: src-ghc - if !os(windows) - build-depends: unix >= 2.7 && <2.9 - - if flag(split-these) - build-depends: - semialign >= 1 && < 1.4, - these >= 1 && < 1.3 - else - build-depends: - these >= 0.4 && < 1.0 - - exposed-modules: - Foreign.JavaScript.TH - Foreign.JavaScript.Orphans - Foreign.JavaScript.Utils - Reflex.Dom.Builder.Class - Reflex.Dom.Builder.Class.Events - Reflex.Dom.Builder.Immediate - Reflex.Dom.Builder.InputDisabled - Reflex.Dom.Builder.Hydratable - Reflex.Dom.Builder.Static - Reflex.Dom.Class - Reflex.Dom.Core - Reflex.Dom.Location - Reflex.Dom.Main - Reflex.Dom.Modals.Class - Reflex.Dom.Old - Reflex.Dom.Prerender - Reflex.Dom.Time - Reflex.Dom.WebSocket - Reflex.Dom.WebSocket.Query - Reflex.Dom.Widget - Reflex.Dom.Widget.Basic - Reflex.Dom.Widget.Input - Reflex.Dom.Widget.Lazy - Reflex.Dom.Widget.Resize - Reflex.Dom.Xhr - Reflex.Dom.Xhr.FormData - other-modules: - Foreign.JavaScript.Internal.Utils - Reflex.Dom.WebSocket.Foreign - Reflex.Dom.Xhr.Foreign - Reflex.Dom.Xhr.ResponseType - Reflex.Dom.Xhr.Exception - - default-language: Haskell98 - ghc-options: -Wall -fwarn-tabs -funbox-strict-fields -O2 -ferror-spans -fspecialise-aggressively - ghc-prof-options: -fprof-auto - - if flag(expose-all-unfoldings) - ghc-options: -fexpose-all-unfoldings - - if flag(use-reflex-optimizer) - ghc-options: -fplugin=Reflex.Optimizer - - if flag(profile-reflex) - cpp-options: -DPROFILE_REFLEX - - if flag(use-template-haskell) - build-depends: - dependent-sum-template >= 0.1 && < 0.3, - template-haskell >= 2.12.0 && < 2.23 - other-extensions: TemplateHaskell - cpp-options: -DUSE_TEMPLATE_HASKELL + exposed-modules: + Foreign.JavaScript.TH + Foreign.JavaScript.Orphans + Foreign.JavaScript.Utils + Reflex.Dom.Builder.Class + Reflex.Dom.Builder.Class.Events + Reflex.Dom.Builder.Immediate + Reflex.Dom.Builder.InputDisabled + Reflex.Dom.Builder.Hydratable + Reflex.Dom.Builder.Static + Reflex.Dom.Class + Reflex.Dom.Core + Reflex.Dom.Location + Reflex.Dom.Main + Reflex.Dom.Modals.Class + Reflex.Dom.Old + Reflex.Dom.Prerender + Reflex.Dom.Time + Reflex.Dom.WebSocket + Reflex.Dom.WebSocket.Query + Reflex.Dom.Widget + Reflex.Dom.Widget.Basic + Reflex.Dom.Widget.Input + Reflex.Dom.Widget.Lazy + Reflex.Dom.Widget.Resize + Reflex.Dom.Xhr + Reflex.Dom.Xhr.FormData + + hs-source-dirs: src other-modules: - Reflex.Dom.Builder.Class.TH + Foreign.JavaScript.Internal.Utils + Reflex.Dom.WebSocket.Foreign + Reflex.Dom.Xhr.Foreign + Reflex.Dom.Xhr.ResponseType + Reflex.Dom.Xhr.Exception + + default-language: Haskell98 + ghc-options: + -Wall -fwarn-tabs -funbox-strict-fields -O2 -ferror-spans + -fspecialise-aggressively + + ghc-prof-options: -fprof-auto + build-depends: + aeson >=0.8 && <2.3, + base >=4.7 && <4.21, + bifunctors >=4.2 && <6, + bimap >=0.3 && <0.6, + blaze-builder >=0.4.1 && <0.5, + bytestring >=0.10 && <0.13, + case-insensitive <1.3, + commutative-semigroups >=0.1 && <0.3, + containers >=0.6 && <0.8, + constraints >=0.9 && <0.15, + contravariant >=1.4 && <1.6, + data-default >=0.5 && <0.8, + dependent-map >=0.3 && <0.5, + dependent-sum >=0.6 && <0.8, + dependent-sum-template >=0.2 && <0.3, + directory >=1.2 && <1.4, + exception-transformers >=0.4 && <0.5, + ghcjs-dom >=0.9.1.0 && <0.10, + jsaddle >=0.9.0.0 && <0.10, + keycode >=0.2.1 && <0.3, + lens >=4.7 && <5.4, + monad-control >=1.0.1 && <1.1, + mtl >=2.1 && <2.4, + primitive >=0.5 && <0.10, + random >=1.1 && <1.3, + ref-tf >=0.4 && <0.6, + reflex >=0.8.2.1 && <1, + semigroups >=0.16 && <0.21, + stm >=2.4 && <2.6, + text >=1.2 && <2.2, + transformers >=0.3 && <0.7, + network-uri >=2.6.1 && <2.7, + zenc >=0.1 && <0.2 + + if (impl(ghcjs >=0) || arch(javascript)) + hs-source-dirs: src-ghcjs + build-depends: + ghcjs-base, + hashable >=1.2 && <1.5 + + else + hs-source-dirs: src-ghc + + if !os(windows) + build-depends: unix >=2.7 && <2.9 + + if flag(split-these) + build-depends: + semialign >=1 && <1.4, + these >=1 && <1.3 + + else + build-depends: these >=0.4 && <1.0 + + if flag(expose-all-unfoldings) + ghc-options: -fexpose-all-unfoldings + + if flag(use-reflex-optimizer) + ghc-options: -fplugin=Reflex.Optimizer + + if flag(profile-reflex) + cpp-options: -DPROFILE_REFLEX + + if flag(use-template-haskell) + cpp-options: -DUSE_TEMPLATE_HASKELL + other-modules: Reflex.Dom.Builder.Class.TH + other-extensions: TemplateHaskell + build-depends: + dependent-sum-template >=0.1 && <0.3, + template-haskell >=2.12.0 && <2.23 test-suite hlint - build-depends: - base, - hlint >= 2.0 && < 4.0 - hs-source-dirs: test - main-is: hlint.hs - type: exitcode-stdio-1.0 - default-language: Haskell98 - if arch(javascript) - buildable: False + type: exitcode-stdio-1.0 + main-is: hlint.hs + hs-source-dirs: test + default-language: Haskell98 + build-depends: + base, + hlint >=2.0 && <4.0 + + if arch(javascript) + buildable: False test-suite hydration - build-depends: base - , aeson - , async - , bytestring - , chrome-test-utils - , constraints - , constraints-extras - , containers - , dependent-map - , dependent-sum - , dependent-sum-template - , directory - , exceptions - , filepath - , ghcjs-dom - , hspec - , hspec-core - , hspec-webdriver - , http-types - , HUnit - , jsaddle - , jsaddle-warp - , lens - , lifted-base - , network - , random - , ref-tf - , reflex - , reflex-dom-core - , process - , silently - , temporary - , text - , wai - , wai-websockets - , warp - , webdriver - , websockets - , which - hs-source-dirs: test - ghc-options: -rtsopts "-with-rtsopts=-T -V0" -Wall -fwarn-tabs -funbox-strict-fields -O2 -ferror-spans - ghc-prof-options: -fprof-auto -optP-DPROFILING - main-is: hydration.hs - type: exitcode-stdio-1.0 - default-language: Haskell98 - if !os(linux) || !arch(x86_64) || flag(profile-reflex) || !flag(hydration-tests) - buildable: False - --- broken test on base 4.11 & ghc 8.4.3 --- needs to be updated for changes in GHC.Stats + type: exitcode-stdio-1.0 + main-is: hydration.hs + hs-source-dirs: test + default-language: Haskell98 + ghc-options: + -rtsopts "-with-rtsopts=-T -V0" -Wall -fwarn-tabs + -funbox-strict-fields -O2 -ferror-spans + + ghc-prof-options: -fprof-auto -optP-DPROFILING + build-depends: + base, + aeson <2.3, + async <2.3, + bytestring, + chrome-test-utils, + constraints <0.15, + constraints-extras <0.5, + containers <0.7, + dependent-map <0.5, + dependent-sum <0.8, + dependent-sum-template <0.3, + directory, + exceptions, + filepath, + ghcjs-dom <0.10, + hspec <2.12, + hspec-core <2.12, + hspec-webdriver <1.3, + http-types <0.13, + HUnit <1.7, + jsaddle <0.10, + jsaddle-warp <0.10, + lens <5.4, + lifted-base <0.3, + network <3.3, + random <1.3, + ref-tf <0.6, + reflex <0.10, + reflex-dom-core, + process, + silently <1.3, + temporary <1.4, + text <2.2, + wai <3.3, + wai-websockets <3.1, + warp <3.5, + webdriver <0.13, + websockets <0.14, + which <0.3 + + if (((!os(linux) || !arch(x86_64)) || flag(profile-reflex)) || !flag(hydration-tests)) + buildable: False + test-suite gc - build-depends: base - , chrome-test-utils - , jsaddle - , jsaddle-warp - , process - , reflex - , reflex-dom-core - , text - hs-source-dirs: test - ghc-options: -rtsopts -with-rtsopts=-T -Wall -fwarn-tabs -funbox-strict-fields -O2 -ferror-spans - ghc-prof-options: -fprof-auto -optP-DPROFILING - main-is: gc.hs - type: exitcode-stdio-1.0 - default-language: Haskell98 - if !os(linux) || !arch(x86_64) || !flag(gc-tests) - buildable: False + type: exitcode-stdio-1.0 + main-is: gc.hs + hs-source-dirs: test + default-language: Haskell98 + ghc-options: + -rtsopts -with-rtsopts=-T -Wall -fwarn-tabs -funbox-strict-fields + -O2 -ferror-spans -source-repository head - type: git - location: https://github.com/reflex-frp/reflex-dom - subdir: reflex-dom-core + ghc-prof-options: -fprof-auto -optP-DPROFILING + build-depends: + base, + chrome-test-utils, + jsaddle <0.10, + jsaddle-warp <0.10, + process, + reflex <0.10, + reflex-dom-core, + text <2.2 + + if ((!os(linux) || !arch(x86_64)) || !flag(gc-tests)) + buildable: False diff --git a/reflex-dom-core/src-ghcjs/Foreign/JavaScript/Internal/Utils.hs b/reflex-dom-core/src-ghcjs/Foreign/JavaScript/Internal/Utils.hs index 323637a0..8bdd7adb 100644 --- a/reflex-dom-core/src-ghcjs/Foreign/JavaScript/Internal/Utils.hs +++ b/reflex-dom-core/src-ghcjs/Foreign/JavaScript/Internal/Utils.hs @@ -1,5 +1,8 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE ForeignFunctionInterface #-} +#ifdef __GHCJS__ +{-# LANGUAGE JavaScriptFFI #-} +#endif module Foreign.JavaScript.Internal.Utils ( synchronously diff --git a/reflex-dom-core/src/Foreign/JavaScript/TH.hs b/reflex-dom-core/src/Foreign/JavaScript/TH.hs index 732ee639..c5c2d004 100644 --- a/reflex-dom-core/src/Foreign/JavaScript/TH.hs +++ b/reflex-dom-core/src/Foreign/JavaScript/TH.hs @@ -10,12 +10,17 @@ {-# LANGUAGE UndecidableInstances #-} #ifdef ghcjs_HOST_OS {-# LANGUAGE ForeignFunctionInterface #-} +#ifdef __GHCJS__ +{-# LANGUAGE JavaScriptFFI #-} +#endif #endif -module Foreign.JavaScript.TH ( module Foreign.JavaScript.TH + +module Foreign.JavaScript.TH + ( module Foreign.JavaScript.TH #ifdef USE_TEMPLATE_HASKELL - , Safety (..) + , Safety (..) #endif - ) where + ) where import Foreign.JavaScript.Orphans () import Prelude hiding ((!!)) @@ -32,7 +37,22 @@ import GHCJS.DOM.Types (JSContextRef, askJSM) #ifdef ghcjs_HOST_OS import GHCJS.DOM.Types (MonadJSM) #ifdef __GHCJS__ +import qualified GHCJS.Buffer as JS +import qualified GHCJS.DOM.Types as JS +import qualified GHCJS.Foreign as JS +import qualified GHCJS.Foreign.Callback as JS import qualified GHCJS.Foreign.Callback.Internal (Callback (..)) +import qualified JavaScript.Array as JS +import qualified JavaScript.Array.Internal (SomeJSArray (..)) +import qualified JavaScript.Object as JS +import qualified JavaScript.Object.Internal (Object (..)) +import qualified JavaScript.TypedArray.ArrayBuffer as JSArrayBuffer + +import Data.Hashable +import Data.Word +import Foreign.C.Types +import Foreign.Ptr +import Text.Encoding.Z #endif #else diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs index c4cd5339..ebef16b3 100644 --- a/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs +++ b/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs @@ -31,22 +31,6 @@ module Reflex.Dom.Builder.Class , module Reflex.NotReady.Class ) where -import Reflex.Adjustable.Class -import Reflex.Class as Reflex -import Reflex.Dom.Builder.Class.Events -#ifdef USE_TEMPLATE_HASKELL -import Reflex.Dom.Builder.Class.TH -#endif -import Reflex.BehaviorWriter.Base -import Reflex.DynamicWriter.Base -import Reflex.EventWriter.Base -import Reflex.NotReady.Class -import Reflex.PerformEvent.Class -import Reflex.PostBuild.Base -import Reflex.Query.Base -import Reflex.Query.Class -import Reflex.Requester.Base - import qualified Control.Category import Control.Lens hiding (element) import Control.Monad.Fix @@ -68,6 +52,26 @@ import Data.Type.Coercion import GHCJS.DOM.Types (JSM) import qualified GHCJS.DOM.Types as DOM +#if !MIN_VERSION_base(4,18,0) +import Data.Semigroup +#endif + +import Reflex.Adjustable.Class +import Reflex.Class as Reflex +import Reflex.Dom.Builder.Class.Events +#ifdef USE_TEMPLATE_HASKELL +import Reflex.Dom.Builder.Class.TH +#endif +import Reflex.BehaviorWriter.Base +import Reflex.DynamicWriter.Base +import Reflex.EventWriter.Base +import Reflex.NotReady.Class +import Reflex.PerformEvent.Class +import Reflex.PostBuild.Base +import Reflex.Query.Base +import Reflex.Query.Class +import Reflex.Requester.Base + class Default (EventSpec d EventResult) => DomSpace d where type EventSpec d :: (EventTag -> Type) -> Type type RawDocument d :: Type diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Hydratable.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Hydratable.hs index 24400361..32bcb62b 100644 --- a/reflex-dom-core/src/Reflex/Dom/Builder/Hydratable.hs +++ b/reflex-dom-core/src/Reflex/Dom/Builder/Hydratable.hs @@ -19,6 +19,7 @@ import qualified Data.Map as Map #ifndef ghcjs_HOST_OS import GHCJS.DOM.Types (MonadJSM (..)) #endif + import Reflex import Reflex.Dom.Builder.Class import Reflex.Dom.Builder.Immediate (hydratableAttribute) diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs index fb72a314..d3ce97d2 100644 --- a/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs +++ b/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs @@ -25,7 +25,11 @@ {-# LANGUAGE UndecidableInstances #-} #ifdef ghcjs_HOST_OS {-# LANGUAGE ForeignFunctionInterface #-} +#ifdef __GHCJS__ +{-# LANGUAGE JavaScriptFFI #-} +#endif #endif + -- | This is a builder to be used on the client side. It can be run in two modes: -- -- 1. in "hydration mode", reusing DOM nodes already in the page (as produced @@ -157,24 +161,6 @@ import GHCJS.DOM.UIEvent #ifndef ghcjs_HOST_OS import Language.Javascript.JSaddle (call, eval) -- Avoid using eval in ghcjs. Use ffi instead #endif -import Reflex.Adjustable.Class -import Reflex.Class as Reflex -import Reflex.Dom.Builder.Class -import Reflex.Dynamic -import Reflex.Host.Class -import Reflex.Patch.MapWithMove (PatchMapWithMove(..)) -import Reflex.PerformEvent.Base (PerformEventT) -import Reflex.PerformEvent.Class -import Reflex.PostBuild.Base (PostBuildT) -import Reflex.PostBuild.Class -#ifdef PROFILE_REFLEX -import Reflex.Profiled -#endif -import Reflex.Requester.Base -import Reflex.Requester.Class -import Reflex.Spider (Spider, SpiderHost, Global) -import Reflex.TriggerEvent.Base hiding (askEvents) -import Reflex.TriggerEvent.Class import qualified Data.Dependent.Map as DMap import qualified Data.FastMutableIntMap as FastMutableIntMap @@ -201,6 +187,31 @@ import qualified GHCJS.DOM.TouchList as TouchList import qualified GHCJS.DOM.Types as DOM import qualified GHCJS.DOM.Window as Window import qualified GHCJS.DOM.WheelEvent as WheelEvent + +#if !MIN_VERSION_base(4,18,0) +import Data.FastMutableIntMap (PatchIntMap (..)) +import Data.Monoid ((<>)) +import GHCJS.DOM.Types (KeyboardEvent, ClipboardEvent) +#endif + +import Reflex.Adjustable.Class +import Reflex.Class as Reflex +import Reflex.Dom.Builder.Class +import Reflex.Dynamic +import Reflex.Host.Class +import Reflex.Patch.MapWithMove (PatchMapWithMove(..)) +import Reflex.PerformEvent.Base (PerformEventT) +import Reflex.PerformEvent.Class +import Reflex.PostBuild.Base (PostBuildT) +import Reflex.PostBuild.Class +#ifdef PROFILE_REFLEX +import Reflex.Profiled +#endif +import Reflex.Requester.Base +import Reflex.Requester.Class +import Reflex.Spider (Spider, SpiderHost, Global) +import Reflex.TriggerEvent.Base hiding (askEvents) +import Reflex.TriggerEvent.Class import qualified Reflex.Patch.DMap as PatchDMap import qualified Reflex.Patch.DMapWithMove as PatchDMapWithMove import qualified Reflex.Patch.MapWithMove as PatchMapWithMove diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Static.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Static.hs index b493e4ae..2835667a 100644 --- a/reflex-dom-core/src/Reflex/Dom/Builder/Static.hs +++ b/reflex-dom-core/src/Reflex/Dom/Builder/Static.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} @@ -47,6 +48,12 @@ import qualified Data.Text as T import Data.Text.Encoding import Data.Tuple import GHC.Generics + +#if !MIN_VERSION_base(4,18,0) +import Control.Monad.Identity +import Data.Monoid ((<>)) +#endif + import Reflex.Adjustable.Class import Reflex.Class import Reflex.Dom.Main (DomHost, DomTimeline, runDomHost) diff --git a/reflex-dom-core/src/Reflex/Dom/Location.hs b/reflex-dom-core/src/Reflex/Dom/Location.hs index 0f47bd8d..7f68d83e 100644 --- a/reflex-dom-core/src/Reflex/Dom/Location.hs +++ b/reflex-dom-core/src/Reflex/Dom/Location.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE MultiParamTypeClasses #-} @@ -22,9 +23,6 @@ module Reflex.Dom.Location , popHistoryState ) where -import Reflex -import Reflex.Dom.Builder.Immediate (wrapDomEvent) - import Control.Lens ((^.)) import Control.Monad ((>=>)) import Control.Monad.Fix (MonadFix) @@ -43,6 +41,13 @@ import qualified GHCJS.DOM.WindowEventHandlers as DOM import Language.Javascript.JSaddle (FromJSString, MonadJSM, ToJSString, fromJSValUnchecked, js1, ToJSVal (..), FromJSVal (..)) import Network.URI +#if !MIN_VERSION_base(4,18,0) +import Data.Monoid +#endif + +import Reflex +import Reflex.Dom.Builder.Immediate (wrapDomEvent) + withLocation :: (MonadJSM m) => (Location -> m a) -> m a withLocation f = DOM.currentWindowUnchecked >>= Window.getLocation >>= f diff --git a/reflex-dom-core/src/Reflex/Dom/Main.hs b/reflex-dom-core/src/Reflex/Dom/Main.hs index 0ce27b91..3345fba8 100644 --- a/reflex-dom-core/src/Reflex/Dom/Main.hs +++ b/reflex-dom-core/src/Reflex/Dom/Main.hs @@ -17,24 +17,14 @@ module Reflex.Dom.Main where import Prelude hiding (concat, mapM, mapM_, sequence, sequence_) -import Reflex.Adjustable.Class -import Reflex.Class -import Reflex.Dom.Builder.Immediate -import Reflex.Dom.Class -import Reflex.Host.Class -import Reflex.PerformEvent.Base -import Reflex.PostBuild.Base -import Reflex.Spider (Global, Spider, SpiderHost, runSpiderHost) -import Reflex.TriggerEvent.Base -import Reflex.TriggerEvent.Class -#ifdef PROFILE_REFLEX -import Reflex.Profiled -#endif - import Control.Concurrent import Control.Lens import Control.Monad +#if MIN_VERSION_base(4,18,0) import Control.Monad.Reader +#else +import Control.Monad.Reader hiding (forM, forM_, mapM, mapM_, sequence, sequence_) +#endif import Control.Monad.Ref import Data.ByteString (ByteString) import Data.Dependent.Sum (DSum (..)) @@ -52,6 +42,20 @@ import GHCJS.DOM.NonElementParentNode import GHCJS.DOM.Types (JSM) import qualified GHCJS.DOM.Types as DOM +#if !MIN_VERSION_base(4,18,0) +import Data.Monoid ((<>)) +#endif + +import Reflex.Adjustable.Class +import Reflex.Class +import Reflex.Dom.Builder.Immediate +import Reflex.Dom.Class +import Reflex.Host.Class +import Reflex.PerformEvent.Base +import Reflex.PostBuild.Base +import Reflex.Spider (Global, Spider, SpiderHost, runSpiderHost) +import Reflex.TriggerEvent.Base +import Reflex.TriggerEvent.Class #ifdef PROFILE_REFLEX import Reflex.Profiled #endif diff --git a/reflex-dom-core/src/Reflex/Dom/Prerender.hs b/reflex-dom-core/src/Reflex/Dom/Prerender.hs index 7fce9dc5..702b4587 100644 --- a/reflex-dom-core/src/Reflex/Dom/Prerender.hs +++ b/reflex-dom-core/src/Reflex/Dom/Prerender.hs @@ -33,7 +33,19 @@ import Data.Kind (Type) import Data.Semigroup.Commutative import Data.Text (Text) import Data.Void +import Data.IntMap.Strict (IntMap) +import qualified Data.IntMap.Strict as IntMap + +#if !MIN_VERSION_base(4,18,0) +import Data.Semigroup (Semigroup) +import Foreign.JavaScript.TH +#endif + import GHCJS.DOM.Types (MonadJSM) +import qualified GHCJS.DOM.Document as Document +import qualified GHCJS.DOM.Node as Node +import qualified GHCJS.DOM.Types as DOM + import Reflex hiding (askEvents) import Reflex.Dom.Builder.Class import Reflex.Dom.Builder.Hydratable @@ -41,12 +53,6 @@ import Reflex.Dom.Builder.Immediate import Reflex.Dom.Builder.InputDisabled import Reflex.Dom.Builder.Static import Reflex.Host.Class -import Data.IntMap.Strict (IntMap) -import qualified Data.IntMap.Strict as IntMap - -import qualified GHCJS.DOM.Document as Document -import qualified GHCJS.DOM.Node as Node -import qualified GHCJS.DOM.Types as DOM type PrerenderClientConstraint t m = ( DomBuilder t m diff --git a/reflex-dom-core/src/Reflex/Dom/WebSocket.hs b/reflex-dom-core/src/Reflex/Dom/WebSocket.hs index b85faacf..fb9770b5 100644 --- a/reflex-dom-core/src/Reflex/Dom/WebSocket.hs +++ b/reflex-dom-core/src/Reflex/Dom/WebSocket.hs @@ -8,6 +8,9 @@ {-# LANGUAGE ForeignFunctionInterface #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} +#ifdef __GHCJS__ +{-# LANGUAGE JavaScriptFFI #-} +#endif {-# LANGUAGE LambdaCase #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE NoMonomorphismRestriction #-} @@ -29,17 +32,15 @@ module Reflex.Dom.WebSocket import Prelude hiding (all, concat, concatMap, div, mapM, mapM_, sequence, span) -import Reflex.Class -import Reflex.Dom.WebSocket.Foreign -import Reflex.PerformEvent.Class -import Reflex.PostBuild.Class -import Reflex.TriggerEvent.Class - import Control.Concurrent import Control.Concurrent.STM import Control.Exception import Control.Lens +#if MIN_VERSION_base(4,18,0) import Control.Monad hiding (forM, mapM, mapM_, sequence) +#else +import Control.Monad hiding (forM, forM_, mapM, mapM_, sequence) +#endif import Control.Monad.IO.Class import Data.Aeson import Data.ByteString (ByteString) @@ -56,6 +57,16 @@ import GHCJS.DOM.WebSocket (getReadyState) import GHCJS.Marshal import qualified Language.Javascript.JSaddle.Monad as JS (catch) +#if !MIN_VERSION_base(4,18,0) +import Control.Monad.State +#endif + +import Reflex.Class +import Reflex.Dom.WebSocket.Foreign +import Reflex.PerformEvent.Class +import Reflex.PostBuild.Class +import Reflex.TriggerEvent.Class + data WebSocketConfig t a = WebSocketConfig { _webSocketConfig_send :: Event t [a] , _webSocketConfig_close :: Event t (Word, Text) diff --git a/reflex-dom-core/src/Reflex/Dom/WebSocket/Foreign.hs b/reflex-dom-core/src/Reflex/Dom/WebSocket/Foreign.hs index 4e274b82..753e6c13 100644 --- a/reflex-dom-core/src/Reflex/Dom/WebSocket/Foreign.hs +++ b/reflex-dom-core/src/Reflex/Dom/WebSocket/Foreign.hs @@ -1,6 +1,9 @@ {-# LANGUAGE CPP #-} #ifdef ghcjs_HOST_OS {-# LANGUAGE ForeignFunctionInterface #-} +#ifdef __GHCJS__ +{-# LANGUAGE JavaScriptFFI #-} +#endif #endif {-# LANGUAGE LambdaCase #-} diff --git a/reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs b/reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs index 9ab64b8f..95ce2f55 100644 --- a/reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs +++ b/reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs @@ -1,4 +1,5 @@ {-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} @@ -61,21 +62,12 @@ module Reflex.Dom.Widget.Basic , partitionMapBySetLT ) where -import Reflex.Adjustable.Class -import Reflex.Class -import Reflex.Collection -import Reflex.Dom.Builder.Class -import Reflex.Dom.Class -import Reflex.Dynamic -import Reflex.Network -import Reflex.PostBuild.Class -import Reflex.Workflow +import Prelude hiding (mapM, mapM_, sequence, sequence_) import Control.Lens hiding (children, element) import Control.Monad.Fix import Data.Align import Data.Default -import Data.Either import Data.Foldable import Data.Functor (void) import Data.Kind (Type) @@ -89,7 +81,22 @@ import Data.Text (Text) import qualified Data.Text as T import Data.These import Data.Traversable -import Prelude hiding (mapM, mapM_, sequence, sequence_) + +#if !MIN_VERSION_base(4,18,0) +import Control.Arrow +import Control.Monad.Reader hiding (forM, forM_, mapM, mapM_, sequence, sequence_) +import Data.Either +#endif + +import Reflex.Adjustable.Class +import Reflex.Class +import Reflex.Collection +import Reflex.Dom.Builder.Class +import Reflex.Dom.Class +import Reflex.Dynamic +import Reflex.Network +import Reflex.PostBuild.Class +import Reflex.Workflow -- | Breaks the given Map into pieces based on the given Set. Each piece will contain only keys that are less than the key of the piece, and greater than or equal to the key of the piece with the next-smaller key. There will be one additional piece containing all keys from the original Map that are larger or equal to the largest key in the Set. -- Either k () is used instead of Maybe k so that the resulting map of pieces is sorted so that the additional piece has the largest key. diff --git a/reflex-dom-core/src/Reflex/Dom/Widget/Input.hs b/reflex-dom-core/src/Reflex/Dom/Widget/Input.hs index 87d4f03c..e745b7b8 100644 --- a/reflex-dom-core/src/Reflex/Dom/Widget/Input.hs +++ b/reflex-dom-core/src/Reflex/Dom/Widget/Input.hs @@ -39,10 +39,19 @@ import qualified Data.Map as Map import Data.Maybe import Data.Text (Text) import qualified Data.Text as T +import qualified Text.Read as T + +#if !MIN_VERSION_base(4,18,0) +import Data.Semigroup +#endif + +import qualified GHCJS.DOM.Event as Event +import qualified GHCJS.DOM.HTMLInputElement as Input import GHCJS.DOM.HTMLInputElement (HTMLInputElement) import GHCJS.DOM.HTMLTextAreaElement (HTMLTextAreaElement) import GHCJS.DOM.Types (MonadJSM, File, uncheckedCastTo) import qualified GHCJS.DOM.Types as DOM (HTMLElement(..), EventTarget(..)) + import Reflex.Class import Reflex.Collection import Reflex.Dom.Builder.Class @@ -52,10 +61,6 @@ import Reflex.Dom.Widget.Basic import Reflex.Dynamic import Reflex.PostBuild.Class import Reflex.TriggerEvent.Class -import qualified Text.Read as T - -import qualified GHCJS.DOM.Event as Event -import qualified GHCJS.DOM.HTMLInputElement as Input {-# DEPRECATED TextInput, _textInput_element, TextInputConfig, textInput "Use 'inputElement' directly" #-} data TextInput t diff --git a/reflex-dom-core/src/Reflex/Dom/Widget/Lazy.hs b/reflex-dom-core/src/Reflex/Dom/Widget/Lazy.hs index bc031e9c..db67c92d 100644 --- a/reflex-dom-core/src/Reflex/Dom/Widget/Lazy.hs +++ b/reflex-dom-core/src/Reflex/Dom/Widget/Lazy.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} @@ -8,6 +9,19 @@ module Reflex.Dom.Widget.Lazy where +import Control.Monad.Fix +import Data.Fixed +import Data.Map (Map) +import qualified Data.Map as Map +import Data.Text (Text) +import qualified Data.Text as T +import GHCJS.DOM.Element +import GHCJS.DOM.Types (MonadJSM) + +#if !MIN_VERSION_base(4,18,0) +import Data.Monoid +#endif + import Reflex.Class import Reflex.Collection import Reflex.Dom.Builder.Class @@ -18,15 +32,6 @@ import Reflex.Dynamic import Reflex.PerformEvent.Class import Reflex.PostBuild.Class -import Control.Monad.Fix -import Data.Fixed -import Data.Map (Map) -import qualified Data.Map as Map -import Data.Text (Text) -import qualified Data.Text as T -import GHCJS.DOM.Element -import GHCJS.DOM.Types (MonadJSM) - -- |A list view for long lists. Creates a scrollable element and only renders child row elements near the current scroll position. virtualListWithSelection :: forall t m k v. (DomBuilder t m, PostBuild t m, MonadHold t m, PerformEvent t m, MonadJSM (Performable m), DomBuilderSpace m ~ GhcjsDomSpace, MonadFix m, Ord k, Eq v) => Dynamic t Int -- ^ The height of the visible region in pixels diff --git a/reflex-dom-core/src/Reflex/Dom/Widget/Resize.hs b/reflex-dom-core/src/Reflex/Dom/Widget/Resize.hs index 8dd6e5a8..65b71930 100644 --- a/reflex-dom-core/src/Reflex/Dom/Widget/Resize.hs +++ b/reflex-dom-core/src/Reflex/Dom/Widget/Resize.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} @@ -8,16 +9,6 @@ module Reflex.Dom.Widget.Resize where -import Reflex.Class -import Reflex.Time -import Reflex.Dom.Builder.Class -import Reflex.Dom.Builder.Immediate -import Reflex.Dom.Class -import Reflex.Dom.Widget.Basic -import Reflex.PerformEvent.Class -import Reflex.PostBuild.Class -import Reflex.TriggerEvent.Class - import Control.Monad.Fix import Control.Monad.IO.Class import Data.Map (Map) @@ -31,6 +22,21 @@ import GHCJS.DOM.Types (MonadJSM, liftJSM, uncheckedCastTo, HTMLElement(..)) import GHCJS.DOM.HTMLElement (getOffsetWidth, getOffsetHeight) import qualified GHCJS.DOM.Types as DOM +#if !MIN_VERSION_base(4,18,0) +import Control.Monad +import Data.Monoid +#endif + +import Reflex.Class +import Reflex.Time +import Reflex.Dom.Builder.Class +import Reflex.Dom.Builder.Immediate +import Reflex.Dom.Class +import Reflex.Dom.Widget.Basic +import Reflex.PerformEvent.Class +import Reflex.PostBuild.Class +import Reflex.TriggerEvent.Class + -- | A widget that wraps the given widget in a div and fires an event when resized. -- Adapted from @github.com\/marcj\/css-element-queries@ -- diff --git a/reflex-dom-core/src/Reflex/Dom/Xhr/Foreign.hs b/reflex-dom-core/src/Reflex/Dom/Xhr/Foreign.hs index 3a72526f..09d476ad 100644 --- a/reflex-dom-core/src/Reflex/Dom/Xhr/Foreign.hs +++ b/reflex-dom-core/src/Reflex/Dom/Xhr/Foreign.hs @@ -1,4 +1,8 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} +#ifdef __GHCJS__ +{-# LANGUAGE JavaScriptFFI #-} +#endif {-# LANGUAGE OverloadedStrings #-} module Reflex.Dom.Xhr.Foreign diff --git a/reflex-dom-core/src/Reflex/Dom/Xhr/FormData.hs b/reflex-dom-core/src/Reflex/Dom/Xhr/FormData.hs index 43094af0..556e0e64 100644 --- a/reflex-dom-core/src/Reflex/Dom/Xhr/FormData.hs +++ b/reflex-dom-core/src/Reflex/Dom/Xhr/FormData.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE OverloadedStrings #-} @@ -17,6 +18,11 @@ import qualified GHCJS.DOM.FormData as FD import GHCJS.DOM.File (getName) import GHCJS.DOM.Types (File, IsBlob) import Language.Javascript.JSaddle.Monad (MonadJSM, liftJSM) + +#if !MIN_VERSION_base(4,18,0) +import Foreign.JavaScript.TH +#endif + import Reflex import Reflex.Dom.Xhr diff --git a/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal b/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal index ee601e72..a536b3bd 100644 --- a/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal +++ b/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal @@ -1,44 +1,45 @@ cabal-version: 1.24 -Name: reflex-dom-test-selenium -Version: 0.0.0.1 -Synopsis: Testing framework for selenium tests -Description: -License: BSD3 -License-file: LICENSE -Author: Ryan Trinkle -Maintainer: ryan.trinkle@gmail.com -Stability: Experimental -Category: FRP, Web, GUI, HTML, Javascript, Reactive, Reactivity, User Interfaces, User-interface -Build-type: Simple +name: reflex-dom-test-selenium +version: 0.0.0.1 +license: BSD3 +license-file: LICENSE +maintainer: ryan.trinkle@gmail.com +author: Ryan Trinkle +stability: Experimental +synopsis: Testing framework for selenium tests +category: + FRP, Web, GUI, HTML, Javascript, Reactive, Reactivity, User Interfaces, User-interface -library - hs-source-dirs: src - build-depends: - async, - base >= 4.7 && <= 4.21, - bytestring >= 0.10 && < 0.13, - chrome-test-utils, - exceptions, - hspec-core < 2.12, - hspec-webdriver >= 1.2.2, - http-types, - jsaddle >= 0.9.0.0 && < 0.10, - jsaddle-warp, - network, - process, - reflex-dom-core, - silently, - text >= 1.2 && <= 2.1.1, - wai, - warp, - webdriver, - websockets +build-type: Simple - exposed-modules: - Reflex.Dom.Test.Selenium +library + exposed-modules: Reflex.Dom.Test.Selenium + hs-source-dirs: src + default-language: Haskell98 + ghc-options: + -Wall -fwarn-tabs -funbox-strict-fields -O2 -ferror-spans + -fspecialise-aggressively - default-language: Haskell98 - ghc-options: -Wall -fwarn-tabs -funbox-strict-fields -O2 -ferror-spans -fspecialise-aggressively + build-depends: + async <2.3, + base >=4.7 && <=4.21, + bytestring >=0.10 && <0.13, + chrome-test-utils, + exceptions, + hspec-core <2.12, + hspec-webdriver >=1.2.2 && <1.3, + http-types <0.13, + jsaddle >=0.9.0.0 && <0.10, + jsaddle-warp <0.10, + network <3.3, + process, + reflex-dom-core, + silently <1.3, + text >=1.2 && <2.2, + wai <3.3, + warp <3.5, + webdriver <0.13, + websockets <0.14 - if !os(linux) || !arch(x86_64) - buildable: False + if (!os(linux) || !arch(x86_64)) + buildable: False diff --git a/reflex-dom/reflex-dom.cabal b/reflex-dom/reflex-dom.cabal index 47eaed31..487db377 100644 --- a/reflex-dom/reflex-dom.cabal +++ b/reflex-dom/reflex-dom.cabal @@ -1,211 +1,238 @@ -cabal-version: 1.24 -Name: reflex-dom -Version: 0.6.3.1 -Synopsis: Functional Reactive Web Apps with Reflex -Description: - Web applications without callbacks or side-effects. - Reflex-DOM brings the power of functional reactive programming (FRP) to the web. - Build HTML and other Document Object Model (DOM) data with a pure functional interface. - . - Reflex-DOM is a Functional Reactive web framework based on the Reflex FRP engine: . - . - The @reflex-dom@ package is a small wrapper around the @reflex-dom-core@ package. It pulls in the - correct set of dependencies for each target platform (GHCJS, WebKitGTK, WASM, mobile, etc.). - Libraries should depend on @reflex-dom-core@ and executables will usually depend on @reflex-dom@. - All of @reflex-dom-core@'s modules are re-exported by @reflex-dom@. - . - For Hackage documentation, please see: . -License: BSD3 -License-file: LICENSE -Author: Ryan Trinkle -Maintainer: ryan.trinkle@gmail.com -Stability: Experimental -Category: FRP, Web, GUI, HTML, Javascript, Reactive, Reactivity, User Interfaces, User-interface -Build-type: Simple +cabal-version: 1.24 +name: reflex-dom +version: 0.6.3.1 +license: BSD3 +license-file: LICENSE +maintainer: ryan.trinkle@gmail.com +author: Ryan Trinkle +stability: Experimental +synopsis: Functional Reactive Web Apps with Reflex +description: + Web applications without callbacks or side-effects. + Reflex-DOM brings the power of functional reactive programming (FRP) to the web. + Build HTML and other Document Object Model (DOM) data with a pure functional interface. + . + Reflex-DOM is a Functional Reactive web framework based on the Reflex FRP engine: . + . + The @reflex-dom@ package is a small wrapper around the @reflex-dom-core@ package. It pulls in the + correct set of dependencies for each target platform (GHCJS, WebKitGTK, WASM, mobile, etc.). + Libraries should depend on @reflex-dom-core@ and executables will usually depend on @reflex-dom@. + All of @reflex-dom-core@'s modules are re-exported by @reflex-dom@. + . + For Hackage documentation, please see: . + +category: + FRP, Web, GUI, HTML, Javascript, Reactive, Reactivity, User Interfaces, User-interface + +build-type: Simple extra-source-files: - java/org/reflexfrp/reflexdom/MainWidget.java - ChangeLog.md + java/org/reflexfrp/reflexdom/MainWidget.java + ChangeLog.md + +source-repository head + type: git + location: https://github.com/reflex-frp/reflex-dom + subdir: reflex-dom flag use-warp - description: Use jsaddle-warp server - default: False - manual: True + description: Use jsaddle-warp server + default: False + manual: True flag webkit2gtk - description: Use WebKit2 version of WebKitGTK. - default: True + description: Use WebKit2 version of WebKitGTK. flag use-reflex-optimizer - description: Use the GHC plugin Reflex.Optimizer on some of the modules in the package. This is still experimental. - default: False - manual: True + description: + Use the GHC plugin Reflex.Optimizer on some of the modules in the package. This is still experimental. + + default: False + manual: True flag expose-all-unfoldings - description: Build the library with -fexpose-all-unfoldings which can help client code specialize better - default: False - manual: True + description: + Build the library with -fexpose-all-unfoldings which can help client code specialize better + + default: False + manual: True flag build-examples - description: Build the executables in ./examples - default: False - manual: True + description: Build the executables in ./examples + default: False + manual: True flag wasm32 - description: Build for wasm32 architecture - default: False - manual: True + description: Build for wasm32 architecture + default: False + manual: True library - hs-source-dirs: src - if os(android) - hs-source-dirs: src-android - other-modules: Reflex.Dom.Android.MainWidget + exposed-modules: + Reflex.Dom + Reflex.Dom.Internal + Reflex.Dom.Location.Platform + + reexported-modules: + Foreign.JavaScript.Orphans, + Foreign.JavaScript.TH, + Foreign.JavaScript.Utils, + Reflex.Dom.Builder.Class, + Reflex.Dom.Builder.Class.Events, + Reflex.Dom.Builder.Hydratable, + Reflex.Dom.Builder.Immediate, + Reflex.Dom.Builder.InputDisabled, + Reflex.Dom.Builder.Static, + Reflex.Dom.Class, + Reflex.Dom.Core, + Reflex.Dom.Location, + Reflex.Dom.Main, + Reflex.Dom.Modals.Class, + Reflex.Dom.Old, + Reflex.Dom.Prerender, + Reflex.Dom.Time, + Reflex.Dom.WebSocket, + Reflex.Dom.WebSocket.Query, + Reflex.Dom.Widget, + Reflex.Dom.Widget.Basic, + Reflex.Dom.Widget.Input, + Reflex.Dom.Widget.Lazy, + Reflex.Dom.Widget.Resize, + Reflex.Dom.Xhr, + Reflex.Dom.Xhr.FormData + + cc-options: -fPIC + hs-source-dirs: src + default-language: Haskell2010 + ghc-options: + -Wall -fwarn-tabs -funbox-strict-fields -O2 -ferror-spans -fPIC + build-depends: - aeson >= 1.4 && < 2.3, - android-activity == 0.2.*, - data-default == 0.7.*, - jsaddle >= 0.9.6 && < 0.10 - c-sources: cbits/MainWidget.c - include-dirs: cbits/include - install-includes: MainWidget.h - cpp-options: -DANDROID - build-tools: hsc2hs - build-depends: - base >= 4.7 && <= 4.21, - bytestring >= 0.10 && < 0.13, - reflex >= 0.8 && < 1, - reflex-dom-core >= 0.6.1.0 && <0.9, - text >= 1.2 && < 2.2 - if !(impl(ghcjs) || arch(javascript)) - if flag(use-warp) - build-depends: - jsaddle >= 0.9.6 && < 0.10, - jsaddle-warp >= 0.9.6 && < 0.10 - else - if os(osx) || os(ios) + base >=4.7 && <4.21, + bytestring >=0.10 && <0.13, + reflex >=0.8 && <1, + reflex-dom-core >=0.6.1.0 && <0.9, + text >=1.2 && <2.2 + + if os(android) + build-tools: hsc2hs >=0 + cpp-options: -DANDROID + c-sources: cbits/MainWidget.c + hs-source-dirs: src-android + other-modules: Reflex.Dom.Android.MainWidget + include-dirs: cbits/include + install-includes: MainWidget.h build-depends: - data-default == 0.7.*, - jsaddle >= 0.9.6 && < 0.10, - jsaddle-wkwebview >= 0.9.6 && < 0.10 - else - if flag(wasm32) - build-depends: - jsaddle >= 0.9.6 && < 0.10, - jsaddle-wasm >= 0.1 && < 0.2 - else - if flag(webkit2gtk) && !os(android) + aeson >=1.4 && <2.3, + android-activity >=0.2 && <0.3, + data-default >=0.7 && <0.8, + jsaddle >=0.9.6 && <0.10 + + if !(impl(ghcjs >=0) || arch(javascript)) + if flag(use-warp) build-depends: - jsaddle-webkit2gtk >= 0.9.6 && < 0.10 - - exposed-modules: - Reflex.Dom - Reflex.Dom.Internal - Reflex.Dom.Location.Platform - reexported-modules: - Foreign.JavaScript.Orphans - , Foreign.JavaScript.TH - , Foreign.JavaScript.Utils - , Reflex.Dom.Builder.Class - , Reflex.Dom.Builder.Class.Events - , Reflex.Dom.Builder.Hydratable - , Reflex.Dom.Builder.Immediate - , Reflex.Dom.Builder.InputDisabled - , Reflex.Dom.Builder.Static - , Reflex.Dom.Class - , Reflex.Dom.Core - , Reflex.Dom.Location - , Reflex.Dom.Main - , Reflex.Dom.Modals.Class - , Reflex.Dom.Old - , Reflex.Dom.Prerender - , Reflex.Dom.Time - , Reflex.Dom.WebSocket - , Reflex.Dom.WebSocket.Query - , Reflex.Dom.Widget - , Reflex.Dom.Widget.Basic - , Reflex.Dom.Widget.Input - , Reflex.Dom.Widget.Lazy - , Reflex.Dom.Widget.Resize - , Reflex.Dom.Xhr - , Reflex.Dom.Xhr.FormData - ghc-options: -Wall -fwarn-tabs -funbox-strict-fields -O2 -ferror-spans -fPIC - cc-options: -fPIC - if flag(expose-all-unfoldings) - ghc-options: -fexpose-all-unfoldings - if flag(use-reflex-optimizer) - ghc-options: -fplugin=Reflex.Optimizer - default-language: Haskell2010 + jsaddle >=0.9.6 && <0.10, + jsaddle-warp >=0.9.6 && <0.10 + + else + if (os(osx) || os(ios)) + build-depends: + data-default >=0.7 && <0.8, + jsaddle >=0.9.6 && <0.10, + jsaddle-wkwebview >=0.9.6 && <0.10 + + else + if flag(wasm32) + build-depends: + jsaddle >=0.9.6 && <0.10, + jsaddle-wasm >=0.1 && <0.2 + + else + if (flag(webkit2gtk) && !os(android)) + build-depends: jsaddle-webkit2gtk >=0.9.6 && <0.10 + + if flag(expose-all-unfoldings) + ghc-options: -fexpose-all-unfoldings + + if flag(use-reflex-optimizer) + ghc-options: -fplugin=Reflex.Optimizer executable sortableList - build-depends: base - , containers - , dependent-map - , lens - , mtl - , random - , reflex - , reflex-dom - , text - , time - , transformers - hs-source-dirs: examples - main-is: sortableList.hs - ghc-options: -Wall -fwarn-tabs -funbox-strict-fields -O2 -ferror-spans -fspecialise-aggressively - if !flag(build-examples) - buildable: False - if flag(expose-all-unfoldings) - ghc-options: -fexpose-all-unfoldings - if flag(use-reflex-optimizer) - ghc-options: -fplugin=Reflex.Optimizer - default-language: Haskell2010 + main-is: sortableList.hs + hs-source-dirs: examples + default-language: Haskell2010 + ghc-options: + -Wall -fwarn-tabs -funbox-strict-fields -O2 -ferror-spans + -fspecialise-aggressively + + build-depends: + base, + containers <0.8, + dependent-map <0.5, + lens <5.4, + mtl, + random <1.3, + reflex <0.10, + reflex-dom, + text <2.2, + time, + transformers + + if !flag(build-examples) + buildable: False + + if flag(expose-all-unfoldings) + ghc-options: -fexpose-all-unfoldings + + if flag(use-reflex-optimizer) + ghc-options: -fplugin=Reflex.Optimizer executable benchmark - build-depends: base - , containers - , dependent-map - , dependent-sum - , ghc-prim - , ghcjs-dom - , mtl - , prim-uniq - , random - , reflex - , reflex-dom - , text - , transformers - hs-source-dirs: . - main-is: benchmark.hs - ghc-options: -O2 -fspecialise-aggressively - if !impl(ghcjs) - buildable: False - default-language: Haskell2010 + main-is: benchmark.hs + hs-source-dirs: . + default-language: Haskell2010 + ghc-options: -O2 -fspecialise-aggressively + build-depends: + base, + containers <0.8, + dependent-map <0.5, + dependent-sum <0.8, + ghc-prim, + ghcjs-dom <0.10, + mtl, + prim-uniq <0.3, + random <1.3, + reflex <0.10, + reflex-dom, + text <2.2, + transformers + + if !impl(ghcjs >=0) + buildable: False executable krausest - build-depends: base - , containers - , dependent-map - , dependent-sum - , ghc-prim - , ghcjs-dom - , mtl - , prim-uniq - , random - , reflex - , reflex-dom - , text - , transformers - , vector - hs-source-dirs: benchmarks - main-is: krausest.hs - ghc-options: -O2 -fspecialise-aggressively - if impl(ghcjs) - ghcjs-options: -dedupe - cpp-options: -DGHCJS_BROWSER -DGHCJS_GC_INTERVAL=60000 - else - buildable: False - default-language: Haskell2010 + main-is: krausest.hs + hs-source-dirs: benchmarks + default-language: Haskell2010 + ghc-options: -O2 -fspecialise-aggressively + build-depends: + base, + containers <0.8, + dependent-map <0.5, + dependent-sum <0.8, + ghc-prim, + ghcjs-dom <0.10, + mtl, + prim-uniq <0.3, + random <1.3, + reflex <0.10, + reflex-dom, + text <2.2, + transformers, + vector <0.14 -source-repository head - type: git - location: https://github.com/reflex-frp/reflex-dom - subdir: reflex-dom + if impl(ghcjs >=0) + cpp-options: -DGHCJS_BROWSER -DGHCJS_GC_INTERVAL=60000 + ghcjs-options: -dedupe + + else + buildable: False From 546989b6368efd6ecc4f88bcab500b6b6361be28 Mon Sep 17 00:00:00 2001 From: ymeister <47071325+ymeister@users.noreply.github.com> Date: Wed, 7 Aug 2024 11:50:17 +0400 Subject: [PATCH 18/20] Extend CI --- .github/workflows/haskell.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index 80c8541e..105acf67 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -1,12 +1,12 @@ name: github-action -on: [push, pull_request] +on: [push, pull_request] jobs: build: strategy: matrix: - ghc: ['8.4.4', '8.6.5', '8.8.4', '8.10.2'] + ghc: ['8.4.4', '8.6.5', '8.8.4', '8.10.2', '9.8.2', '9.10.1'] os: ['ubuntu-latest', 'macos-latest'] exclude: # There are some linker warnings in 802 on darwin that From ede863e98247deb8268f15d663292eb8a714437b Mon Sep 17 00:00:00 2001 From: ymeister <47071325+ymeister@users.noreply.github.com> Date: Wed, 21 Aug 2024 14:34:14 +0400 Subject: [PATCH 19/20] Fix ghcjs-dom-javascript --- cabal.dependencies.project | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cabal.dependencies.project b/cabal.dependencies.project index d9cf5e45..853f8b76 100644 --- a/cabal.dependencies.project +++ b/cabal.dependencies.project @@ -3,6 +3,13 @@ allow-newer: , which:template-haskell , dependent-sum-template:template-haskell +source-repository-package + type: git + location: https://github.com/ymeister/ghcjs-dom.git + tag: 5bff37b7f83072b732eedaea4661083b3d35e4b6 + subdir: ghcjs-dom-javascript + --sha256: 0dxiskgx3f2f4bnkwghk0kqfp7pp2m5r3pma9dxlhxggj9a95brm + if !arch(javascript) source-repository-package type: git From e43e0525d643f656a0a5b0f10e13e2a04712cd4e Mon Sep 17 00:00:00 2001 From: ymeister <47071325+ymeister@users.noreply.github.com> Date: Thu, 5 Sep 2024 22:37:23 +0400 Subject: [PATCH 20/20] Fix foreign JS --- reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs index d3ce97d2..2b715e4c 100644 --- a/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs +++ b/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs @@ -529,7 +529,7 @@ foreign import javascript unsafe #ifdef __GHCJS__ "(function() { var x = $2; while(x !== $3) { var y = x['nextSibling']; $1['appendChild'](x); x = y; } })()" #else - "(function(_, x, $3) { while(x !== $3) { var y = x['nextSibling']; $1['appendChild'](x); x = y; } })" + "(function($1, x, $3) { while(x !== $3) { var y = x['nextSibling']; $1['appendChild'](x); x = y; } })" #endif extractUpTo_ :: DOM.DocumentFragment -> DOM.Node -> DOM.Node -> IO () extractUpTo df s e = liftJSM $ extractUpTo_ df (toNode s) (toNode e)