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 Oct 1, 2024
1 parent 4cb53c5 commit 830a203
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 43 deletions.
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

* Add support for GHC 9.8 and 9.10

* Get rid of the `use-template-haskell` flag.
Template Haskell is now always used.

## 0.9.3.0

* Headless Host: Generalize to allow returning arbitrary types
Expand Down
3 changes: 0 additions & 3 deletions cabal.haskell-ci
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ installed: -all
-- https://github.com/haskell/cabal/issues/6106
install-dependencies: False

constraint-set no-th
constraints: reflex -use-template-haskell

constraint-set old-these
ghc: <8.8
constraints: these <1
Expand Down
24 changes: 8 additions & 16 deletions reflex.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ flag use-reflex-optimizer
default: False
manual: True

flag use-template-haskell
description: Use template haskell to generate lenses
default: True
manual: True

flag debug-trace-events
description: Add instrumentation that outputs the stack trace of the definition of an event whenever it is subscribed to. Warning: It is very slow!
default: False
Expand Down Expand Up @@ -100,7 +95,13 @@ library
time >= 1.4 && < 1.13,
transformers >= 0.5 && < 0.7,
unbounded-delays >= 0.1.0.0 && < 0.2,
witherable >= 0.4 && < 0.5
witherable >= 0.4 && < 0.5,
haskell-src-exts >= 1.16 && < 1.24,
haskell-src-meta >= 0.6 && < 0.9,
template-haskell >= 2.9 && < 2.23

other-extensions:
TemplateHaskell

if flag(split-these)
build-depends: these >= 1 && <1.3,
Expand All @@ -124,6 +125,7 @@ library
Reflex.BehaviorWriter.Class,
Reflex.Collection,
Reflex.Dynamic,
Reflex.Dynamic.TH,
Reflex.Dynamic.Uniq,
Reflex.DynamicWriter,
Reflex.DynamicWriter.Base,
Expand Down Expand Up @@ -184,16 +186,6 @@ library
if flag(debug-cycles)
cpp-options: -DDEBUG_CYCLES

if flag(use-template-haskell)
cpp-options: -DUSE_TEMPLATE_HASKELL
build-depends:
haskell-src-exts >= 1.16 && < 1.24,
haskell-src-meta >= 0.6 && < 0.9,
template-haskell >= 2.9 && < 2.23
exposed-modules:
Reflex.Dynamic.TH
other-extensions: TemplateHaskell

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 @@ -1161,9 +1161,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 @@ -1612,9 +1610,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 @@ -2614,7 +2610,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 @@ -22,7 +22,6 @@ main = do
, "--ignore=Use unless"
, "--ignore=Reduce duplication"
, "--ignore=Replace case with maybe"
, "--cpp-define=USE_TEMPLATE_HASKELL"
, "--cpp-define=DEBUG"
, "--ignore=Use tuple-section"
]
Expand Down

0 comments on commit 830a203

Please sign in to comment.