From a32b0284b9078000a1726e34720704cfe137468d Mon Sep 17 00:00:00 2001 From: cidkidnix Date: Fri, 16 Dec 2022 14:22:53 -0600 Subject: [PATCH] Always enable Template Haskell With splices, it should no longer be an issue. --- reflex.cabal | 24 +++++++++--------------- src/Reflex.hs | 2 -- src/Reflex/Spider/Internal.hs | 6 +----- src/Reflex/Time.hs | 16 ---------------- test/hlint.hs | 1 - 5 files changed, 10 insertions(+), 39 deletions(-) diff --git a/reflex.cabal b/reflex.cabal index f275e9e0..eec6a2fc 100644 --- a/reflex.cabal +++ b/reflex.cabal @@ -98,7 +98,14 @@ library time >= 1.4 && < 1.12, transformers >= 0.5.6.0 && < 0.6, unbounded-delays >= 0.1.0.0 && < 0.2, - witherable >= 0.4 && < 0.5 + witherable >= 0.4 && < 0.5, + dependent-sum >= 0.6 && < 0.8, + haskell-src-exts >= 1.16 && < 1.24, + haskell-src-meta >= 0.6 && < 0.9, + template-haskell >= 2.9 && < 2.19 + + other-extensions: + TemplateHaskell if flag(split-these) build-depends: these >= 1 && <1.3, @@ -122,6 +129,7 @@ library Reflex.BehaviorWriter.Class, Reflex.Collection, Reflex.Dynamic, + Reflex.Dynamic.TH, Reflex.Dynamic.Uniq, Reflex.DynamicWriter, Reflex.DynamicWriter.Base, @@ -181,20 +189,6 @@ library if flag(debug-cycles) cpp-options: -DDEBUG_CYCLES - if flag(use-template-haskell) - cpp-options: -DUSE_TEMPLATE_HASKELL - build-depends: - dependent-sum >= 0.6 && < 0.8, - haskell-src-exts >= 1.16 && < 1.24, - haskell-src-meta >= 0.6 && < 0.9, - template-haskell >= 2.9 && < 2.19 - exposed-modules: - Reflex.Dynamic.TH - other-extensions: TemplateHaskell - else - build-depends: - dependent-sum >= 0.6 && < 0.8 - if flag(fast-weak) && impl(ghcjs) cpp-options: -DGHCJS_FAST_WEAK diff --git a/src/Reflex.hs b/src/Reflex.hs index 1529280b..945accb7 100644 --- a/src/Reflex.hs +++ b/src/Reflex.hs @@ -13,9 +13,7 @@ import Reflex.Collection as X import Reflex.Dynamic as X import Reflex.EventWriter.Base as X import Reflex.EventWriter.Class as X -#ifdef USE_TEMPLATE_HASKELL import Reflex.Dynamic.TH as X -#endif import Reflex.Dynamic.Uniq as X import Reflex.DynamicWriter.Base as X import Reflex.DynamicWriter.Class as X diff --git a/src/Reflex/Spider/Internal.hs b/src/Reflex/Spider/Internal.hs index ff4b4835..39f697de 100644 --- a/src/Reflex/Spider/Internal.hs +++ b/src/Reflex/Spider/Internal.hs @@ -1158,9 +1158,7 @@ data Switch x a , switchSubscribed :: !(IORef (Maybe (SwitchSubscribed x a))) } -#ifdef USE_TEMPLATE_HASKELL {-# ANN CoincidenceSubscribed "HLint: ignore Redundant bracket" #-} -#endif data CoincidenceSubscribed x a = CoincidenceSubscribed { coincidenceSubscribedCachedSubscribed :: !(IORef (Maybe (CoincidenceSubscribed x a))) , coincidenceSubscribedOccurrence :: !(IORef (Maybe a)) @@ -1609,9 +1607,7 @@ getRootSubscribed k r sub = do occ <- getOcc return (sln, subscribed, occ) -#ifdef USE_TEMPLATE_HASKELL {-# ANN cleanupRootSubscribed "HLint: ignore Redundant bracket" #-} -#endif cleanupRootSubscribed :: RootSubscribed x a -> IO () cleanupRootSubscribed self@RootSubscribed { rootSubscribedKey = k, rootSubscribedCachedSubscribed = cached } = do rootSubscribedUninit self @@ -2611,7 +2607,7 @@ instance HasSpiderTimeline x => Reflex.Class.MonadHold (SpiderTimeline x) (Spide headE e = runFrame . runSpiderHostFrame $ Reflex.Class.headE e {-# INLINABLE now #-} now = runFrame . runSpiderHostFrame $ Reflex.Class.now - + instance HasSpiderTimeline x => Reflex.Class.MonadSample (SpiderTimeline x) (SpiderHostFrame x) where sample = SpiderHostFrame . readBehaviorUntracked . unSpiderBehavior --TODO: This can cause problems with laziness, so we should get rid of it if we can diff --git a/src/Reflex/Time.hs b/src/Reflex/Time.hs index 4ae42f26..df4c42a1 100644 --- a/src/Reflex/Time.hs +++ b/src/Reflex/Time.hs @@ -8,9 +8,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE TypeFamilies #-} -#ifdef USE_TEMPLATE_HASKELL {-# LANGUAGE TemplateHaskell #-} -#endif -- | -- Module: -- Reflex.Time @@ -367,18 +365,4 @@ throttleBatchWithLag lag e = do delayed <- lag (void outE) return outE -#ifdef USE_TEMPLATE_HASKELL makeLensesWith (lensRules & simpleLenses .~ True) ''TickInfo -#else -tickInfo_lastUTC :: Lens' TickInfo UTCTime -tickInfo_lastUTC f (TickInfo x1 x2 x3) = (\y -> TickInfo y x2 x3) <$> f x1 -{-# INLINE tickInfo_lastUTC #-} - -tickInfo_n :: Lens' TickInfo Integer -tickInfo_n f (TickInfo x1 x2 x3) = (\y -> TickInfo x1 y x3) <$> f x2 -{-# INLINE tickInfo_n #-} - -tickInfo_alreadyElapsed :: Lens' TickInfo NominalDiffTime -tickInfo_alreadyElapsed f (TickInfo x1 x2 x3) = (\y -> TickInfo x1 x2 y) <$> f x3 -{-# INLINE tickInfo_alreadyElapsed #-} -#endif diff --git a/test/hlint.hs b/test/hlint.hs index 1d0e319d..95f83e2b 100644 --- a/test/hlint.hs +++ b/test/hlint.hs @@ -21,7 +21,6 @@ main = do , "--ignore=Use ." , "--ignore=Use unless" , "--ignore=Reduce duplication" - , "--cpp-define=USE_TEMPLATE_HASKELL" , "--cpp-define=DEBUG" , "--ignore=Use tuple-section" ]