Skip to content

Commit

Permalink
Always enable Template Haskell
Browse files Browse the repository at this point in the history
With splices, it should no longer be an issue.
  • Loading branch information
cidkidnix authored and Ericson2314 committed Dec 16, 2022
1 parent 8216e8f commit a32b028
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 39 deletions.
24 changes: 9 additions & 15 deletions reflex.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -122,6 +129,7 @@ library
Reflex.BehaviorWriter.Class,
Reflex.Collection,
Reflex.Dynamic,
Reflex.Dynamic.TH,
Reflex.Dynamic.Uniq,
Reflex.DynamicWriter,
Reflex.DynamicWriter.Base,
Expand Down Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions src/Reflex.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions src/Reflex/Spider/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
16 changes: 0 additions & 16 deletions src/Reflex/Time.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE TypeFamilies #-}
#ifdef USE_TEMPLATE_HASKELL
{-# LANGUAGE TemplateHaskell #-}
#endif
-- |
-- Module:
-- Reflex.Time
Expand Down Expand Up @@ -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
1 change: 0 additions & 1 deletion test/hlint.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
Expand Down

0 comments on commit a32b028

Please sign in to comment.