diff --git a/lib/Data/Time/Calendar/CalendarDiffDays.hs b/lib/Data/Time/Calendar/CalendarDiffDays.hs index bbc8f48c..ead257b5 100644 --- a/lib/Data/Time/Calendar/CalendarDiffDays.hs +++ b/lib/Data/Time/Calendar/CalendarDiffDays.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} module Data.Time.Calendar.CalendarDiffDays where @@ -5,7 +6,11 @@ module Data.Time.Calendar.CalendarDiffDays where import Control.DeepSeq import Data.Data import GHC.Generics -import Language.Haskell.TH.Syntax qualified as TH +#if __GLASGOW_HASKELL__ >= 914 +import qualified Language.Haskell.TH.Lift as TH +#else +import qualified Language.Haskell.TH.Syntax as TH +#endif data CalendarDiffDays = CalendarDiffDays { cdMonths :: Integer diff --git a/lib/Data/Time/Calendar/Days.hs b/lib/Data/Time/Calendar/Days.hs index 54532df4..7e401f8d 100644 --- a/lib/Data/Time/Calendar/Days.hs +++ b/lib/Data/Time/Calendar/Days.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} module Data.Time.Calendar.Days where @@ -7,7 +8,11 @@ import Data.Data import Data.Ix import Data.Time.Calendar.Private import GHC.Generics -import Language.Haskell.TH.Syntax qualified as TH +#if __GLASGOW_HASKELL__ >= 914 +import qualified Language.Haskell.TH.Lift as TH +#else +import qualified Language.Haskell.TH.Syntax as TH +#endif -- | The Modified Julian Day is a standard count of days, with zero being the day 1858-11-17. newtype Day = ModifiedJulianDay diff --git a/lib/Data/Time/Calendar/Month.hs b/lib/Data/Time/Calendar/Month.hs index f3fcb6f1..3f9b973e 100644 --- a/lib/Data/Time/Calendar/Month.hs +++ b/lib/Data/Time/Calendar/Month.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} -- | An absolute count of common calendar months. @@ -20,7 +21,11 @@ import Data.Time.Calendar.Gregorian import Data.Time.Calendar.Private import Data.Time.Calendar.Types import GHC.Generics -import Language.Haskell.TH.Syntax qualified as TH +#if __GLASGOW_HASKELL__ >= 914 +import qualified Language.Haskell.TH.Lift as TH +#else +import qualified Language.Haskell.TH.Syntax as TH +#endif import Text.ParserCombinators.ReadP import Text.Read diff --git a/lib/Data/Time/Calendar/Quarter.hs b/lib/Data/Time/Calendar/Quarter.hs index cbdbab7a..b4c11378 100644 --- a/lib/Data/Time/Calendar/Quarter.hs +++ b/lib/Data/Time/Calendar/Quarter.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} -- | Year quarters. @@ -23,7 +24,11 @@ import Data.Time.Calendar.Month import Data.Time.Calendar.Private import Data.Time.Calendar.Types import GHC.Generics -import Language.Haskell.TH.Syntax qualified as TH +#if __GLASGOW_HASKELL__ >= 914 +import qualified Language.Haskell.TH.Lift as TH +#else +import qualified Language.Haskell.TH.Syntax as TH +#endif import Text.ParserCombinators.ReadP import Text.Read diff --git a/lib/Data/Time/Calendar/Week.hs b/lib/Data/Time/Calendar/Week.hs index 1166f447..cf38fd50 100644 --- a/lib/Data/Time/Calendar/Week.hs +++ b/lib/Data/Time/Calendar/Week.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} module Data.Time.Calendar.Week where @@ -8,7 +9,11 @@ import Data.Fixed import Data.Ix import Data.Time.Calendar.Days import GHC.Generics -import Language.Haskell.TH.Syntax qualified as TH +#if __GLASGOW_HASKELL__ >= 914 +import qualified Language.Haskell.TH.Lift as TH +#else +import qualified Language.Haskell.TH.Syntax as TH +#endif data DayOfWeek = Monday diff --git a/lib/Data/Time/Calendar/WeekDate.hs b/lib/Data/Time/Calendar/WeekDate.hs index 9c399b25..9258d07a 100644 --- a/lib/Data/Time/Calendar/WeekDate.hs +++ b/lib/Data/Time/Calendar/WeekDate.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} -- | Week-based calendars @@ -23,7 +24,11 @@ import Data.Time.Calendar.Days import Data.Time.Calendar.OrdinalDate import Data.Time.Calendar.Private import Data.Time.Calendar.Week -import Language.Haskell.TH.Syntax qualified as TH +#if __GLASGOW_HASKELL__ >= 914 +import qualified Language.Haskell.TH.Lift as TH +#else +import qualified Language.Haskell.TH.Syntax as TH +#endif data FirstWeekType = -- | first week is the first whole week of the year diff --git a/lib/Data/Time/Clock/Internal/AbsoluteTime.hs b/lib/Data/Time/Clock/Internal/AbsoluteTime.hs index 4024dd35..3f6ceabe 100644 --- a/lib/Data/Time/Clock/Internal/AbsoluteTime.hs +++ b/lib/Data/Time/Clock/Internal/AbsoluteTime.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} -- | TAI and leap-second maps for converting to UTC: most people won't need this module. @@ -7,7 +8,11 @@ import Control.DeepSeq import Data.Data import Data.Time.Calendar.Days import Data.Time.Clock.Internal.DiffTime -import Language.Haskell.TH.Syntax qualified as TH +#if __GLASGOW_HASKELL__ >= 914 +import qualified Language.Haskell.TH.Lift as TH +#else +import qualified Language.Haskell.TH.Syntax as TH +#endif -- | AbsoluteTime is TAI, time as measured by a clock. newtype AbsoluteTime diff --git a/lib/Data/Time/Clock/Internal/DiffTime.hs b/lib/Data/Time/Clock/Internal/DiffTime.hs index 3d4773e3..3948980d 100644 --- a/lib/Data/Time/Clock/Internal/DiffTime.hs +++ b/lib/Data/Time/Clock/Internal/DiffTime.hs @@ -9,7 +9,11 @@ import Data.Fixed #ifdef __GLASGOW_HASKELL__ import GHC.Read #endif -import Language.Haskell.TH.Syntax qualified as TH +#if __GLASGOW_HASKELL__ >= 914 +import qualified Language.Haskell.TH.Lift as TH +#else +import qualified Language.Haskell.TH.Syntax as TH +#endif import Text.ParserCombinators.ReadP import Text.Read diff --git a/lib/Data/Time/Clock/Internal/NominalDiffTime.hs b/lib/Data/Time/Clock/Internal/NominalDiffTime.hs index e7a89d99..3309734a 100644 --- a/lib/Data/Time/Clock/Internal/NominalDiffTime.hs +++ b/lib/Data/Time/Clock/Internal/NominalDiffTime.hs @@ -10,7 +10,11 @@ import Data.Fixed import GHC.Read #endif import Data.Time.Clock.Internal.DiffTime -import Language.Haskell.TH.Syntax qualified as TH +#if __GLASGOW_HASKELL__ >= 914 +import qualified Language.Haskell.TH.Lift as TH +#else +import qualified Language.Haskell.TH.Syntax as TH +#endif import Text.ParserCombinators.ReadP import Text.ParserCombinators.ReadPrec diff --git a/lib/Data/Time/Clock/Internal/SystemTime.hs b/lib/Data/Time/Clock/Internal/SystemTime.hs index 5400a18a..8bf688e7 100644 --- a/lib/Data/Time/Clock/Internal/SystemTime.hs +++ b/lib/Data/Time/Clock/Internal/SystemTime.hs @@ -23,7 +23,11 @@ import Data.Int (Int64) import Data.Time.Clock.Internal.DiffTime import Data.Word import GHC.Generics -import Language.Haskell.TH.Syntax qualified as TH +#if __GLASGOW_HASKELL__ >= 914 +import qualified Language.Haskell.TH.Lift as TH +#else +import qualified Language.Haskell.TH.Syntax as TH +#endif #ifdef mingw32_HOST_OS import qualified System.Win32.Time as Win32 diff --git a/lib/Data/Time/Clock/Internal/UTCTime.hs b/lib/Data/Time/Clock/Internal/UTCTime.hs index 69d0b110..b8d7ec99 100644 --- a/lib/Data/Time/Clock/Internal/UTCTime.hs +++ b/lib/Data/Time/Clock/Internal/UTCTime.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} module Data.Time.Clock.Internal.UTCTime where @@ -7,7 +8,11 @@ import Data.Data import Data.Time.Calendar.Days import Data.Time.Clock.Internal.DiffTime import GHC.Generics -import Language.Haskell.TH.Syntax qualified as TH +#if __GLASGOW_HASKELL__ >= 914 +import qualified Language.Haskell.TH.Lift as TH +#else +import qualified Language.Haskell.TH.Syntax as TH +#endif -- | This is the simplest representation of UTC. -- It consists of the day number, and a time offset from midnight. diff --git a/lib/Data/Time/Clock/Internal/UniversalTime.hs b/lib/Data/Time/Clock/Internal/UniversalTime.hs index e84002c6..77e0675c 100644 --- a/lib/Data/Time/Clock/Internal/UniversalTime.hs +++ b/lib/Data/Time/Clock/Internal/UniversalTime.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} module Data.Time.Clock.Internal.UniversalTime where @@ -5,7 +6,11 @@ module Data.Time.Clock.Internal.UniversalTime where import Control.DeepSeq import Data.Data import GHC.Generics -import Language.Haskell.TH.Syntax qualified as TH +#if __GLASGOW_HASKELL__ >= 914 +import qualified Language.Haskell.TH.Lift as TH +#else +import qualified Language.Haskell.TH.Syntax as TH +#endif -- | The Modified Julian Date is the day with the fraction of the day, measured from UT midnight. -- It's used to represent UT1, which is time as measured by the earth's rotation, adjusted for various wobbles. diff --git a/lib/Data/Time/LocalTime/Internal/CalendarDiffTime.hs b/lib/Data/Time/LocalTime/Internal/CalendarDiffTime.hs index 5f05f02f..3656f34b 100644 --- a/lib/Data/Time/LocalTime/Internal/CalendarDiffTime.hs +++ b/lib/Data/Time/LocalTime/Internal/CalendarDiffTime.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} module Data.Time.LocalTime.Internal.CalendarDiffTime where @@ -10,7 +11,11 @@ import Data.Time.Clock.Internal.NominalDiffTime import Data.Time.Clock.Internal.UTCDiff import Data.Time.Clock.Internal.UTCTime import GHC.Generics -import Language.Haskell.TH.Syntax qualified as TH +#if __GLASGOW_HASKELL__ >= 914 +import qualified Language.Haskell.TH.Lift as TH +#else +import qualified Language.Haskell.TH.Syntax as TH +#endif data CalendarDiffTime = CalendarDiffTime { ctMonths :: Integer diff --git a/lib/Data/Time/LocalTime/Internal/LocalTime.hs b/lib/Data/Time/LocalTime/Internal/LocalTime.hs index a2221d4e..49b45010 100644 --- a/lib/Data/Time/LocalTime/Internal/LocalTime.hs +++ b/lib/Data/Time/LocalTime/Internal/LocalTime.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} {-# OPTIONS -fno-warn-orphans #-} @@ -16,7 +17,11 @@ import Data.Time.LocalTime.Internal.CalendarDiffTime import Data.Time.LocalTime.Internal.TimeOfDay import Data.Time.LocalTime.Internal.TimeZone import GHC.Generics -import Language.Haskell.TH.Syntax qualified as TH +#if __GLASGOW_HASKELL__ >= 914 +import qualified Language.Haskell.TH.Lift as TH +#else +import qualified Language.Haskell.TH.Syntax as TH +#endif -- | A simple day and time aggregate, where the day is of the specified parameter, -- and the time is a TimeOfDay. diff --git a/lib/Data/Time/LocalTime/Internal/TimeOfDay.hs b/lib/Data/Time/LocalTime/Internal/TimeOfDay.hs index 1f42d9ae..66575fc5 100644 --- a/lib/Data/Time/LocalTime/Internal/TimeOfDay.hs +++ b/lib/Data/Time/LocalTime/Internal/TimeOfDay.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} module Data.Time.LocalTime.Internal.TimeOfDay where @@ -10,7 +11,11 @@ import Data.Time.Clock.Internal.DiffTime import Data.Time.Clock.Internal.NominalDiffTime import Data.Time.LocalTime.Internal.TimeZone import GHC.Generics -import Language.Haskell.TH.Syntax qualified as TH +#if __GLASGOW_HASKELL__ >= 914 +import qualified Language.Haskell.TH.Lift as TH +#else +import qualified Language.Haskell.TH.Syntax as TH +#endif -- | Time of day as represented in hour, minute and second (with picoseconds), typically used to express local time of day. -- diff --git a/lib/Data/Time/LocalTime/Internal/TimeZone.hs b/lib/Data/Time/LocalTime/Internal/TimeZone.hs index 2f3a5693..47fa72a9 100644 --- a/lib/Data/Time/LocalTime/Internal/TimeZone.hs +++ b/lib/Data/Time/LocalTime/Internal/TimeZone.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} module Data.Time.LocalTime.Internal.TimeZone ( @@ -15,7 +16,11 @@ import Control.DeepSeq import Data.Data import Data.Time.Calendar.Private import GHC.Generics -import Language.Haskell.TH.Syntax qualified as TH +#if __GLASGOW_HASKELL__ >= 914 +import qualified Language.Haskell.TH.Lift as TH +#else +import qualified Language.Haskell.TH.Syntax as TH +#endif -- | A TimeZone is a whole number of minutes offset from UTC, together with a name and a \"just for summer\" flag. data TimeZone = TimeZone diff --git a/lib/Data/Time/LocalTime/Internal/ZonedTime.hs b/lib/Data/Time/LocalTime/Internal/ZonedTime.hs index e375f582..36beec2a 100644 --- a/lib/Data/Time/LocalTime/Internal/ZonedTime.hs +++ b/lib/Data/Time/LocalTime/Internal/ZonedTime.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} {-# OPTIONS -fno-warn-orphans #-} @@ -12,7 +13,11 @@ import Data.Time.LocalTime.Internal.Foreign import Data.Time.LocalTime.Internal.LocalTime import Data.Time.LocalTime.Internal.TimeZone import GHC.Generics -import Language.Haskell.TH.Syntax qualified as TH +#if __GLASGOW_HASKELL__ >= 914 +import qualified Language.Haskell.TH.Lift as TH +#else +import qualified Language.Haskell.TH.Syntax as TH +#endif -- | A local time together with a time zone. -- diff --git a/test/template/Main.hs b/test/template/Main.hs index ce27439c..722bad81 100644 --- a/test/template/Main.hs +++ b/test/template/Main.hs @@ -1,7 +1,12 @@ +{-# LANGUAGE CPP #-} module Main (main) where import Data.Time.Clock -import Language.Haskell.TH.Syntax qualified as TH +#if __GLASGOW_HASKELL__ >= 914 +import qualified Language.Haskell.TH.Lift as TH +#else +import qualified Language.Haskell.TH.Syntax as TH +#endif import Test.Tasty import Test.Tasty.HUnit diff --git a/time.cabal b/time.cabal index 4bc385b0..6e88e50b 100644 --- a/time.cabal +++ b/time.cabal @@ -54,8 +54,13 @@ library build-depends: base >= 4.19 && < 5, deepseq >= 1.1, - if impl(ghc) - build-depends: template-haskell >= 2.17, + -- template-haskell-lift was added as a boot library in GHC-9.14 + -- once we no longer wish to backport releases to older major releases, + -- this conditional can be dropped + if impl(ghc < 9.14) + build-depends: template-haskell + elif impl(ghc) + build-depends: template-haskell-lift >= 0.1 && <0.2 if os(windows) build-depends: Win32 exposed-modules: @@ -175,7 +180,10 @@ test-suite test-main tasty, tasty-hunit, tasty-quickcheck, - template-haskell + if impl(ghc < 9.14) + build-depends: template-haskell + elif impl(ghc) + build-depends: template-haskell-lift >= 0.1 && <0.2 main-is: Main.hs other-modules: Test.Types @@ -235,7 +243,10 @@ test-suite test-template tasty, tasty-hunit, tasty-quickcheck, - template-haskell + if impl(ghc < 9.14) + build-depends: template-haskell + elif impl(ghc) + build-depends: template-haskell-lift >= 0.1 && <0.2 main-is: Main.hs test-suite test-unix @@ -275,4 +286,8 @@ benchmark time-bench deepseq, time, criterion + if impl(ghc < 9.14) + build-depends: template-haskell + elif impl(ghc) + build-depends: template-haskell-lift >= 0.1 && <0.2 main-is: Main.hs