Skip to content
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
7 changes: 6 additions & 1 deletion lib/Data/Time/Calendar/CalendarDiffDays.hs
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE Safe #-}

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
Expand Down
7 changes: 6 additions & 1 deletion lib/Data/Time/Calendar/Days.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE Safe #-}

module Data.Time.Calendar.Days where
Expand All @@ -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
Expand Down
7 changes: 6 additions & 1 deletion lib/Data/Time/Calendar/Month.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE Safe #-}

-- | An absolute count of common calendar months.
Expand All @@ -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

Expand Down
7 changes: 6 additions & 1 deletion lib/Data/Time/Calendar/Quarter.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE Safe #-}

-- | Year quarters.
Expand All @@ -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

Expand Down
7 changes: 6 additions & 1 deletion lib/Data/Time/Calendar/Week.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE Safe #-}

module Data.Time.Calendar.Week where
Expand All @@ -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
Expand Down
7 changes: 6 additions & 1 deletion lib/Data/Time/Calendar/WeekDate.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE Safe #-}

-- | Week-based calendars
Expand All @@ -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
Expand Down
7 changes: 6 additions & 1 deletion lib/Data/Time/Clock/Internal/AbsoluteTime.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE Safe #-}

-- | TAI and leap-second maps for converting to UTC: most people won't need this module.
Expand All @@ -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
Expand Down
6 changes: 5 additions & 1 deletion lib/Data/Time/Clock/Internal/DiffTime.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 5 additions & 1 deletion lib/Data/Time/Clock/Internal/NominalDiffTime.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 5 additions & 1 deletion lib/Data/Time/Clock/Internal/SystemTime.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion lib/Data/Time/Clock/Internal/UTCTime.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE Safe #-}

module Data.Time.Clock.Internal.UTCTime where
Expand All @@ -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.
Expand Down
7 changes: 6 additions & 1 deletion lib/Data/Time/Clock/Internal/UniversalTime.hs
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE Safe #-}

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.
Expand Down
7 changes: 6 additions & 1 deletion lib/Data/Time/LocalTime/Internal/CalendarDiffTime.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE Safe #-}

module Data.Time.LocalTime.Internal.CalendarDiffTime where
Expand All @@ -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
Expand Down
7 changes: 6 additions & 1 deletion lib/Data/Time/LocalTime/Internal/LocalTime.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE Safe #-}

{-# OPTIONS -fno-warn-orphans #-}
Expand All @@ -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.
Expand Down
7 changes: 6 additions & 1 deletion lib/Data/Time/LocalTime/Internal/TimeOfDay.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE Safe #-}

module Data.Time.LocalTime.Internal.TimeOfDay where
Expand All @@ -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.
--
Expand Down
7 changes: 6 additions & 1 deletion lib/Data/Time/LocalTime/Internal/TimeZone.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE Safe #-}

module Data.Time.LocalTime.Internal.TimeZone (
Expand All @@ -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
Expand Down
7 changes: 6 additions & 1 deletion lib/Data/Time/LocalTime/Internal/ZonedTime.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE Safe #-}

{-# OPTIONS -fno-warn-orphans #-}
Expand All @@ -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.
--
Expand Down
7 changes: 6 additions & 1 deletion test/template/Main.hs
Original file line number Diff line number Diff line change
@@ -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

Expand Down
23 changes: 19 additions & 4 deletions time.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Loading