Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always enable Template Haskell #484

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -261,7 +261,7 @@
-- caching; if the computation function is very cheap, this is (much) more
-- efficient than 'push'
{-# INLINE [1] pushCheap #-}
pushCheap :: HasSpiderTimeline x => (a -> ComputeM x (Maybe b)) -> Event x a -> Event x b

Check warning on line 264 in src/Reflex/Spider/Internal.hs

View workflow job for this annotation

GitHub Actions / GHC 8.6.5 on ubuntu-latest

• Redundant constraint: HasSpiderTimeline x

Check warning on line 264 in src/Reflex/Spider/Internal.hs

View workflow job for this annotation

GitHub Actions / GHC 8.6.5 on macos-latest

• Redundant constraint: HasSpiderTimeline x

Check warning on line 264 in src/Reflex/Spider/Internal.hs

View workflow job for this annotation

GitHub Actions / GHC 8.8.4 on ubuntu-latest

• Redundant constraint: HasSpiderTimeline x

Check warning on line 264 in src/Reflex/Spider/Internal.hs

View workflow job for this annotation

GitHub Actions / GHC 8.8.4 on macos-latest

• Redundant constraint: HasSpiderTimeline x

Check warning on line 264 in src/Reflex/Spider/Internal.hs

View workflow job for this annotation

GitHub Actions / GHC 8.6.5 on ubuntu-latest

• Redundant constraint: HasSpiderTimeline x

Check warning on line 264 in src/Reflex/Spider/Internal.hs

View workflow job for this annotation

GitHub Actions / GHC 8.10.7 on ubuntu-latest

• Redundant constraint: HasSpiderTimeline x

Check warning on line 264 in src/Reflex/Spider/Internal.hs

View workflow job for this annotation

GitHub Actions / GHC 8.6.5 on macos-latest

• Redundant constraint: HasSpiderTimeline x

Check warning on line 264 in src/Reflex/Spider/Internal.hs

View workflow job for this annotation

GitHub Actions / GHC 8.10.7 on macos-latest

• Redundant constraint: HasSpiderTimeline x

Check warning on line 264 in src/Reflex/Spider/Internal.hs

View workflow job for this annotation

GitHub Actions / GHC 8.8.4 on ubuntu-latest

• Redundant constraint: HasSpiderTimeline x

Check warning on line 264 in src/Reflex/Spider/Internal.hs

View workflow job for this annotation

GitHub Actions / GHC 8.8.4 on macos-latest

• Redundant constraint: HasSpiderTimeline x

Check warning on line 264 in src/Reflex/Spider/Internal.hs

View workflow job for this annotation

GitHub Actions / GHC 8.10.7 on ubuntu-latest

• Redundant constraint: HasSpiderTimeline x

Check warning on line 264 in src/Reflex/Spider/Internal.hs

View workflow job for this annotation

GitHub Actions / GHC 8.10.7 on macos-latest

• Redundant constraint: HasSpiderTimeline x
pushCheap !f e = Event $ \sub -> do
(subscription, occ) <- subscribeAndRead e $ debugSubscriber' "push" $ sub
{ subscriberPropagate = \a -> do
Expand Down Expand Up @@ -1165,9 +1165,7 @@
, 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 @@ -1616,9 +1614,7 @@
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 @@
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 @@ -366,18 +364,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
Loading