From aad781612af91ccfd059f6a76c5b110943c7bbbc Mon Sep 17 00:00:00 2001 From: Malte Brandy Date: Sun, 13 Mar 2022 23:27:00 +0100 Subject: [PATCH 1/5] reflex-dom-core: Reorder instance because of TH for ghc 9.0 ghc 9 is pickier regarding the order of TH statements --- .../src/Reflex/Dom/Builder/Class.hs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs index c75eb501..eef9359c 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 From f5901c8dfd071a71d169611a7e594c479431fe99 Mon Sep 17 00:00:00 2001 From: Malte Brandy Date: Tue, 15 Mar 2022 22:52:10 +0100 Subject: [PATCH 2/5] reflex-dom-core: Eta expand some functions to appease the ghc 9 typechecker This is a sad change, because hlint will complain about the unnecessary eta expansion. The problem is that ghc 9 will not unify the forall x. x with () in an argument position. Although obviously a supplied value of the type forall x. WidgetT x () can be used as a WidgetT () (). eta expanding helps the type checker to agree with this. --- reflex-dom-core/src/Reflex/Dom/Main.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reflex-dom-core/src/Reflex/Dom/Main.hs b/reflex-dom-core/src/Reflex/Dom/Main.hs index 24219c77..75651c86 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 x y = mainHydrationWidgetWithHead' x y {-# 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 x y z = mainHydrationWidgetWithSwitchoverAction' x y z {-# 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 x = mainWidget' x {-# INLINABLE mainWidget' #-} -- | Warning: `mainWidget'` is provided only as performance tweak. It is expected to disappear in future releases. From 51cdd96dde9d65fcde326a16a797397bf62102d9 Mon Sep 17 00:00:00 2001 From: Malte Brandy Date: Tue, 15 Mar 2022 22:51:49 +0100 Subject: [PATCH 3/5] reflex-dom-core: Bump bounds for ghc 9.6 compat --- reflex-dom-core/reflex-dom-core.cabal | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/reflex-dom-core/reflex-dom-core.cabal b/reflex-dom-core/reflex-dom-core.cabal index 84b0aecc..18baeca3 100644 --- a/reflex-dom-core/reflex-dom-core.cabal +++ b/reflex-dom-core/reflex-dom-core.cabal @@ -68,15 +68,15 @@ library hs-source-dirs: src build-depends: aeson >= 0.8 && < 2.2, - base >= 4.7 && < 4.15, + 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.*, + bytestring >= 0.10 && <= 0.12, case-insensitive < 1.3, commutative-semigroups >=0.1 && <0.2, 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, @@ -90,15 +90,15 @@ library keycode >= 0.2.1 && < 0.3, lens >= 4.7 && < 5.3, monad-control >= 1.0.1 && < 1.1, - mtl >= 2.1 && < 2.3, - primitive >= 0.5 && < 0.8, + mtl >= 2.1 && < 2.4, + primitive >= 0.5 && < 0.9, 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.*, - transformers >= 0.3 && < 0.6, + text >= 1.2 && < 2.1, + 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.17 + template-haskell >= 2.12.0 && < 2.21 other-extensions: TemplateHaskell cpp-options: -DUSE_TEMPLATE_HASKELL other-modules: From 54d649392b49670bd9be43422e82cb2e583d93a8 Mon Sep 17 00:00:00 2001 From: maralorn Date: Tue, 12 Mar 2024 14:07:34 +0100 Subject: [PATCH 4/5] reflex-dom-core: Add imports to fix build --- 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 | 1 + reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs | 1 + reflex-dom-core/src/Reflex/Dom/Widget/Input.hs | 1 + 7 files changed, 10 insertions(+) diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs index eef9359c..27f32636 100644 --- a/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs +++ b/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs @@ -51,6 +51,7 @@ import Control.Monad.Reader import qualified Control.Monad.State as Lazy import Control.Monad.State.Strict import Control.Monad.Trans.Control +import Control.Monad.Fix import Data.Default import Data.Functor.Misc import Data.Map (Map) diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs index fce08d03..fa5797ba 100644 --- a/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs +++ b/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs @@ -125,6 +125,8 @@ import Control.Monad.Primitive import Control.Monad.Reader import Control.Monad.Ref import Control.Monad.State.Strict (StateT, mapStateT, get, modify', gets, runStateT) +import Control.Monad.Fix +import Control.Monad import Data.Bitraversable import Data.Default import Data.Dependent.Map (DMap) diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Static.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Static.hs index 140c25ae..5fef574f 100644 --- a/reflex-dom-core/src/Reflex/Dom/Builder/Static.hs +++ b/reflex-dom-core/src/Reflex/Dom/Builder/Static.hs @@ -22,6 +22,8 @@ import Control.Monad.Exception import Control.Monad.Identity import Control.Monad.Primitive import Control.Monad.Ref +import Control.Monad +import Control.Monad.Fix import Control.Monad.State.Strict import Control.Monad.Trans.Reader import Data.ByteString (ByteString) diff --git a/reflex-dom-core/src/Reflex/Dom/Prerender.hs b/reflex-dom-core/src/Reflex/Dom/Prerender.hs index b7e9cbda..4c818e0f 100644 --- a/reflex-dom-core/src/Reflex/Dom/Prerender.hs +++ b/reflex-dom-core/src/Reflex/Dom/Prerender.hs @@ -24,6 +24,8 @@ module Reflex.Dom.Prerender import Control.Monad.Primitive (PrimMonad(..)) import Control.Monad.Reader +import Control.Monad +import Control.Monad.Fix import Control.Monad.Ref (MonadRef(..), MonadAtomicRef(..)) import Data.IORef (IORef, newIORef) import Data.Semigroup (Semigroup) diff --git a/reflex-dom-core/src/Reflex/Dom/WebSocket.hs b/reflex-dom-core/src/Reflex/Dom/WebSocket.hs index 13e6fedc..41c2b713 100644 --- a/reflex-dom-core/src/Reflex/Dom/WebSocket.hs +++ b/reflex-dom-core/src/Reflex/Dom/WebSocket.hs @@ -43,6 +43,7 @@ import Control.Lens import Control.Monad hiding (forM, forM_, mapM, mapM_, sequence) import Control.Monad.IO.Class import Control.Monad.State +import Control.Monad 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..a9e5c243 100644 --- a/reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs +++ b/reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs @@ -73,6 +73,7 @@ import Reflex.Workflow import Control.Arrow import Control.Lens hiding (children, element) import Control.Monad.Reader hiding (forM, forM_, mapM, mapM_, sequence, sequence_) +import Control.Monad.Fix 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 2c67fcd3..b51b48b0 100644 --- a/reflex-dom-core/src/Reflex/Dom/Widget/Input.hs +++ b/reflex-dom-core/src/Reflex/Dom/Widget/Input.hs @@ -20,6 +20,7 @@ import Prelude import Control.Lens hiding (element, ix) import Control.Monad.Fix +import Control.Monad import Control.Monad.IO.Class import Control.Monad.Reader import qualified Data.Bimap as Bimap From 70ff88942f9d2bcd364e301c70df8702f452df38 Mon Sep 17 00:00:00 2001 From: Malte Brandy Date: Tue, 22 Mar 2022 00:30:42 +0100 Subject: [PATCH 5/5] reflex-dom: bump bounds --- reflex-dom/reflex-dom.cabal | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reflex-dom/reflex-dom.cabal b/reflex-dom/reflex-dom.cabal index 55caaca3..d3d0e016 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.15, - bytestring == 0.10.*, + base >= 4.7 && < 4.20, + bytestring >= 0.10 && <= 0.12, reflex >= 0.8 && < 1, reflex-dom-core >= 0.6.1.0 && <0.9, - text == 1.2.* + text >= 1.2 && < 2.1 if !impl(ghcjs) if flag(use-warp) build-depends: