From c9629d9052094b46d194b8c081311d73faf4bf12 Mon Sep 17 00:00:00 2001 From: Lennart Augustsson Date: Mon, 18 Nov 2024 23:50:30 +0100 Subject: [PATCH 1/3] Revert some of the MicroHs change, since Generic and TH.Lift are now just ignored. --- lib/Data/Time/Calendar/CalendarDiffDays.hs | 5 ----- lib/Data/Time/Calendar/Days.hs | 9 +-------- lib/Data/Time/Calendar/Month.hs | 8 +------- lib/Data/Time/Calendar/Quarter.hs | 14 ++------------ lib/Data/Time/Calendar/Week.hs | 9 +-------- lib/Data/Time/Clock/Internal/SystemTime.hs | 8 +------- lib/Data/Time/Clock/Internal/UTCTime.hs | 9 +-------- lib/Data/Time/Clock/Internal/UniversalTime.hs | 9 +-------- .../Time/LocalTime/Internal/CalendarDiffTime.hs | 5 ----- lib/Data/Time/LocalTime/Internal/LocalTime.hs | 9 +-------- lib/Data/Time/LocalTime/Internal/TimeOfDay.hs | 9 +-------- lib/Data/Time/LocalTime/Internal/TimeZone.hs | 9 +-------- lib/Data/Time/LocalTime/Internal/ZonedTime.hs | 9 +-------- 13 files changed, 12 insertions(+), 100 deletions(-) diff --git a/lib/Data/Time/Calendar/CalendarDiffDays.hs b/lib/Data/Time/Calendar/CalendarDiffDays.hs index 45199e3c..3740be03 100644 --- a/lib/Data/Time/Calendar/CalendarDiffDays.hs +++ b/lib/Data/Time/Calendar/CalendarDiffDays.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} module Data.Time.Calendar.CalendarDiffDays ( @@ -8,10 +7,8 @@ module Data.Time.Calendar.CalendarDiffDays ( import Control.DeepSeq import Data.Data -#ifdef __GLASGOW_HASKELL__ import GHC.Generics import qualified Language.Haskell.TH.Syntax as TH -#endif data CalendarDiffDays = CalendarDiffDays { cdMonths :: Integer @@ -23,12 +20,10 @@ data CalendarDiffDays = CalendarDiffDays Data , -- | @since 1.9.2 Typeable -#ifdef __GLASGOW_HASKELL__ , -- | @since 1.14 TH.Lift , -- | @since 1.14 Generic -#endif ) instance NFData CalendarDiffDays where diff --git a/lib/Data/Time/Calendar/Days.hs b/lib/Data/Time/Calendar/Days.hs index 6563c3da..8a2c1511 100644 --- a/lib/Data/Time/Calendar/Days.hs +++ b/lib/Data/Time/Calendar/Days.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} module Data.Time.Calendar.Days ( @@ -19,20 +18,14 @@ module Data.Time.Calendar.Days ( import Control.DeepSeq import Data.Data import Data.Ix -#ifdef __GLASGOW_HASKELL__ import GHC.Generics 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 { toModifiedJulianDay :: Integer } - deriving (Eq, Ord, Data, Typeable -#ifdef __GLASGOW_HASKELL__ - , TH.Lift, Generic -#endif - ) + deriving (Eq, Ord, Data, Typeable, TH.Lift, Generic) instance NFData Day where rnf (ModifiedJulianDay a) = rnf a diff --git a/lib/Data/Time/Calendar/Month.hs b/lib/Data/Time/Calendar/Month.hs index 4e267c1d..6fa3563c 100644 --- a/lib/Data/Time/Calendar/Month.hs +++ b/lib/Data/Time/Calendar/Month.hs @@ -21,20 +21,14 @@ import Data.Ix import Data.Time.Calendar.Days import Data.Time.Calendar.Gregorian import Data.Time.Calendar.Private -#if __GLASGOW_HASKELL__ import GHC.Generics import qualified Language.Haskell.TH.Syntax as TH -#endif import Text.ParserCombinators.ReadP import Text.Read -- | An absolute count of common calendar months. -- Number is equal to @(year * 12) + (monthOfYear - 1)@. -newtype Month = MkMonth Integer deriving (Eq, Ord, Data, Typeable -#if __GLASGOW_HASKELL__ - , TH.Lift, Generic -#endif - ) +newtype Month = MkMonth Integer deriving (Eq, Ord, Data, Typeable, TH.Lift, Generic) instance NFData Month where rnf (MkMonth m) = rnf m diff --git a/lib/Data/Time/Calendar/Quarter.hs b/lib/Data/Time/Calendar/Quarter.hs index 922b10c4..52d83519 100644 --- a/lib/Data/Time/Calendar/Quarter.hs +++ b/lib/Data/Time/Calendar/Quarter.hs @@ -29,19 +29,13 @@ import Data.Time.Calendar.Days import Data.Time.Calendar.Month import Data.Time.Calendar.Private import Data.Time.Calendar.Types -#ifdef __GLASGOW_HASKELL__ import GHC.Generics import qualified Language.Haskell.TH.Syntax as TH -#endif import Text.ParserCombinators.ReadP import Text.Read -- | Quarters of each year. Each quarter corresponds to three months. -data QuarterOfYear = Q1 | Q2 | Q3 | Q4 deriving (Eq, Ord, Data, Typeable, Read, Show, Ix -#ifdef __GLASGOW_HASKELL__ - , TH.Lift, Generic -#endif - ) +data QuarterOfYear = Q1 | Q2 | Q3 | Q4 deriving (Eq, Ord, Data, Typeable, Read, Show, Ix, TH.Lift, Generic) -- | maps Q1..Q4 to 1..4 instance Enum QuarterOfYear where @@ -68,11 +62,7 @@ instance NFData QuarterOfYear where -- | An absolute count of year quarters. -- Number is equal to @(year * 4) + (quarterOfYear - 1)@. -newtype Quarter = MkQuarter Integer deriving (Eq, Ord, Data, Typeable -#ifdef __GLASGOW_HASKELL__ - , Generic -#endif - ) +newtype Quarter = MkQuarter Integer deriving (Eq, Ord, Data, Typeable, Generic) instance NFData Quarter where rnf (MkQuarter m) = rnf m diff --git a/lib/Data/Time/Calendar/Week.hs b/lib/Data/Time/Calendar/Week.hs index 7460f3a4..4a174304 100644 --- a/lib/Data/Time/Calendar/Week.hs +++ b/lib/Data/Time/Calendar/Week.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} module Data.Time.Calendar.Week ( @@ -17,10 +16,8 @@ import Data.Data import Data.Fixed import Data.Ix import Data.Time.Calendar.Days -#ifdef __GLASGOW_HASKELL__ import GHC.Generics import qualified Language.Haskell.TH.Syntax as TH -#endif data DayOfWeek = Monday @@ -30,11 +27,7 @@ data DayOfWeek | Friday | Saturday | Sunday - deriving (Eq, Show, Read, Data, Typeable, Ord, Ix -#ifdef __GLASGOW_HASKELL__ - , TH.Lift, Generic -#endif - ) + deriving (Eq, Show, Read, Data, Typeable, Ord, Ix, TH.Lift, Generic) instance NFData DayOfWeek where rnf Monday = () diff --git a/lib/Data/Time/Clock/Internal/SystemTime.hs b/lib/Data/Time/Clock/Internal/SystemTime.hs index d19dd3a0..15b330d9 100644 --- a/lib/Data/Time/Clock/Internal/SystemTime.hs +++ b/lib/Data/Time/Clock/Internal/SystemTime.hs @@ -22,10 +22,8 @@ import Data.Data import Data.Int (Int64) import Data.Time.Clock.Internal.DiffTime import Data.Word -#ifdef __GLASGOW_HASKELL__ import GHC.Generics import qualified Language.Haskell.TH.Syntax as TH -#endif #ifdef mingw32_HOST_OS import qualified System.Win32.Time as Win32 @@ -45,11 +43,7 @@ data SystemTime = MkSystemTime { systemSeconds :: {-# UNPACK #-} !Int64 , systemNanoseconds :: {-# UNPACK #-} !Word32 } - deriving (Eq, Ord, Show, Data, Typeable -#ifdef __GLASGOW_HASKELL__ - , TH.Lift, Generic -#endif - ) + deriving (Eq, Ord, Show, Data, Typeable, TH.Lift, Generic) instance NFData SystemTime where rnf a = a `seq` () diff --git a/lib/Data/Time/Clock/Internal/UTCTime.hs b/lib/Data/Time/Clock/Internal/UTCTime.hs index e5ae32fd..62287968 100644 --- a/lib/Data/Time/Clock/Internal/UTCTime.hs +++ b/lib/Data/Time/Clock/Internal/UTCTime.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} module Data.Time.Clock.Internal.UTCTime ( @@ -19,10 +18,8 @@ import Control.DeepSeq import Data.Data import Data.Time.Calendar.Days import Data.Time.Clock.Internal.DiffTime -#ifdef __GLASGOW_HASKELL__ import GHC.Generics 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. @@ -33,11 +30,7 @@ data UTCTime = UTCTime , utctDayTime :: DiffTime -- ^ the time from midnight, 0 <= t < 86401s (because of leap-seconds) } - deriving (Data, Typeable -#ifdef __GLASGOW_HASKELL__ - , TH.Lift, Generic -#endif - ) + deriving (Data, Typeable, TH.Lift, Generic) instance NFData UTCTime where rnf (UTCTime d t) = rnf d `seq` rnf t `seq` () diff --git a/lib/Data/Time/Clock/Internal/UniversalTime.hs b/lib/Data/Time/Clock/Internal/UniversalTime.hs index becaa7fa..0af975e7 100644 --- a/lib/Data/Time/Clock/Internal/UniversalTime.hs +++ b/lib/Data/Time/Clock/Internal/UniversalTime.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} module Data.Time.Clock.Internal.UniversalTime ( @@ -10,21 +9,15 @@ module Data.Time.Clock.Internal.UniversalTime ( import Control.DeepSeq import Data.Data -#ifdef __GLASGOW_HASKELL__ import GHC.Generics 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. newtype UniversalTime = ModJulianDate { getModJulianDate :: Rational } - deriving (Eq, Ord, Data, Typeable -#ifdef __GLASGOW_HASKELL__ - , TH.Lift, Generic -#endif - ) + deriving (Eq, Ord, Data, Typeable, TH.Lift, Generic) instance NFData UniversalTime where rnf (ModJulianDate a) = rnf a diff --git a/lib/Data/Time/LocalTime/Internal/CalendarDiffTime.hs b/lib/Data/Time/LocalTime/Internal/CalendarDiffTime.hs index c68ad038..ad1c0cda 100644 --- a/lib/Data/Time/LocalTime/Internal/CalendarDiffTime.hs +++ b/lib/Data/Time/LocalTime/Internal/CalendarDiffTime.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} module Data.Time.LocalTime.Internal.CalendarDiffTime ( @@ -10,9 +9,7 @@ import Control.DeepSeq import Data.Data import Data.Time.Calendar.CalendarDiffDays import Data.Time.Clock.Internal.NominalDiffTime -#ifdef __GLASGOW_HASKELL__ import GHC.Generics -#endif data CalendarDiffTime = CalendarDiffTime { ctMonths :: Integer @@ -24,9 +21,7 @@ data CalendarDiffTime = CalendarDiffTime Data , -- | @since 1.9.2 Typeable -#ifdef __GLASGOW_HASKELL__ , Generic -#endif ) instance NFData CalendarDiffTime where diff --git a/lib/Data/Time/LocalTime/Internal/LocalTime.hs b/lib/Data/Time/LocalTime/Internal/LocalTime.hs index ec7087a5..88412cba 100644 --- a/lib/Data/Time/LocalTime/Internal/LocalTime.hs +++ b/lib/Data/Time/LocalTime/Internal/LocalTime.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} {-# OPTIONS -fno-warn-orphans #-} @@ -25,9 +24,7 @@ import Data.Time.Clock.Internal.UTCTime import Data.Time.Clock.Internal.UniversalTime import Data.Time.LocalTime.Internal.TimeOfDay import Data.Time.LocalTime.Internal.TimeZone -#ifdef __GLASGOW_HASKELL__ import GHC.Generics -#endif -- | A simple day and time aggregate, where the day is of the specified parameter, -- and the time is a TimeOfDay. @@ -37,11 +34,7 @@ data LocalTime = LocalTime { localDay :: Day , localTimeOfDay :: TimeOfDay } - deriving (Eq, Ord, Data, Typeable -#ifdef __GLASGOW_HASKELL__ - , Generic -#endif - ) + deriving (Eq, Ord, Data, Typeable, Generic) instance NFData LocalTime where rnf (LocalTime d t) = rnf d `seq` rnf t `seq` () diff --git a/lib/Data/Time/LocalTime/Internal/TimeOfDay.hs b/lib/Data/Time/LocalTime/Internal/TimeOfDay.hs index 98af2612..6bcf1706 100644 --- a/lib/Data/Time/LocalTime/Internal/TimeOfDay.hs +++ b/lib/Data/Time/LocalTime/Internal/TimeOfDay.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} module Data.Time.LocalTime.Internal.TimeOfDay ( @@ -26,9 +25,7 @@ import Data.Time.Calendar.Private import Data.Time.Clock.Internal.DiffTime import Data.Time.Clock.Internal.NominalDiffTime import Data.Time.LocalTime.Internal.TimeZone -#ifdef __GLASGOW_HASKELL__ import GHC.Generics -#endif -- | Time of day as represented in hour, minute and second (with picoseconds), typically used to express local time of day. -- @@ -43,11 +40,7 @@ data TimeOfDay = TimeOfDay -- ^ Note that 0 <= 'todSec' < 61, accomodating leap seconds. -- Any local minute may have a leap second, since leap seconds happen in all zones simultaneously } - deriving (Eq, Ord, Data, Typeable -#ifdef __GLASGOW_HASKELL__ - , Generic -#endif - ) + deriving (Eq, Ord, Data, Typeable, Generic) instance NFData TimeOfDay where rnf (TimeOfDay h m s) = rnf h `seq` rnf m `seq` rnf s `seq` () diff --git a/lib/Data/Time/LocalTime/Internal/TimeZone.hs b/lib/Data/Time/LocalTime/Internal/TimeZone.hs index 8ca66c73..c6d75d0a 100644 --- a/lib/Data/Time/LocalTime/Internal/TimeZone.hs +++ b/lib/Data/Time/LocalTime/Internal/TimeZone.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE ForeignFunctionInterface #-} {-# LANGUAGE Safe #-} @@ -24,9 +23,7 @@ import Data.Time.Clock.POSIX import Data.Time.Clock.System import Foreign import Foreign.C -#ifdef __GLASGOW_HASKELL__ import GHC.Generics -#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 @@ -37,11 +34,7 @@ data TimeZone = TimeZone , timeZoneName :: String -- ^ The name of the zone, typically a three- or four-letter acronym. } - deriving (Eq, Ord, Data, Typeable -#ifdef __GLASGOW_HASKELL__ - , Generic -#endif - ) + deriving (Eq, Ord, Data, Typeable, Generic) instance NFData TimeZone where rnf (TimeZone m so n) = rnf m `seq` rnf so `seq` rnf n `seq` () diff --git a/lib/Data/Time/LocalTime/Internal/ZonedTime.hs b/lib/Data/Time/LocalTime/Internal/ZonedTime.hs index fa61abd4..a64f343f 100644 --- a/lib/Data/Time/LocalTime/Internal/ZonedTime.hs +++ b/lib/Data/Time/LocalTime/Internal/ZonedTime.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} {-# OPTIONS -fno-warn-orphans #-} @@ -17,9 +16,7 @@ import Data.Time.Clock.Internal.UTCTime import Data.Time.Clock.POSIX import Data.Time.LocalTime.Internal.LocalTime import Data.Time.LocalTime.Internal.TimeZone -#ifdef __GLASGOW_HASKELL__ import GHC.Generics -#endif -- | A local time together with a time zone. -- @@ -30,11 +27,7 @@ data ZonedTime = ZonedTime { zonedTimeToLocalTime :: LocalTime , zonedTimeZone :: TimeZone } - deriving (Data, Typeable -#ifdef __GLASGOW_HASKELL__ - , Generic -#endif - ) + deriving (Data, Typeable, Generic) instance NFData ZonedTime where rnf (ZonedTime lt z) = rnf lt `seq` rnf z `seq` () From ac1ebc1663eb05069a07f01039887533ad7a7ef5 Mon Sep 17 00:00:00 2001 From: Lennart Augustsson Date: Mon, 18 Nov 2024 23:51:45 +0100 Subject: [PATCH 2/3] Fix typo. --- .github/workflows/ci.mhs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.mhs.yml b/.github/workflows/ci.mhs.yml index ba97129c..757b85cc 100644 --- a/.github/workflows/ci.mhs.yml +++ b/.github/workflows/ci.mhs.yml @@ -43,4 +43,4 @@ jobs: ./ShowTime - name: cleanup run: | - rm -rf $HOME/.cabal + rm -rf $HOME/.mcabal From 6e90e841da703527b55850483f056c10530a31dd Mon Sep 17 00:00:00 2001 From: Lennart Augustsson Date: Tue, 19 Nov 2024 00:05:55 +0100 Subject: [PATCH 3/3] Remove a GHC warning. --- lib/Data/Time/Clock/Internal/DiffTime.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/Data/Time/Clock/Internal/DiffTime.hs b/lib/Data/Time/Clock/Internal/DiffTime.hs index 87bd8b3d..07987601 100644 --- a/lib/Data/Time/Clock/Internal/DiffTime.hs +++ b/lib/Data/Time/Clock/Internal/DiffTime.hs @@ -21,7 +21,6 @@ import qualified Language.Haskell.TH.Syntax as TH #endif import Text.Read import Text.ParserCombinators.ReadP -import Text.ParserCombinators.ReadPrec -- | This is a length of time, as measured by a clock. -- Conversion functions such as 'fromInteger' and 'realToFrac' will treat it as seconds.