packages feed

time 1.11 → 1.11.1

raw patch · 48 files changed

+181/−44 lines, 48 files

Files

changelog.md view
@@ -1,5 +1,10 @@ # Change Log +## [1.11.1]+- all modules Safe or Trustworthy+- fix NFData instances for DiffTime, NominalDiffTime, TimeOfDay+- add missing Ix, Enum, NFData instances to DayOfWeek, CalendarDiffDays, CalendarDiffTime, Month, Quarter, QuarterOfYear+ ## [1.11] - new calendrical type synonyms and abstract constructors - new Month type, with appropriate functions
configure.ac view
@@ -1,4 +1,4 @@-AC_INIT([Haskell time package], [1.11], [ashley@semantic.org], [time])+AC_INIT([Haskell time package], [1.11.1], [ashley@semantic.org], [time])  # Safety check: Ensure that we are in the correct source directory. AC_CONFIG_SRCDIR([lib/include/HsTime.h])
lib/Data/Format.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ module Data.Format     ( Productish(..)     , Summish(..)
lib/Data/Time.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ {-|  = Quick Start
lib/Data/Time/Calendar.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ module Data.Time.Calendar     ( module Data.Time.Calendar.Days     , module Data.Time.Calendar.CalendarDiffDays
lib/Data/Time/Calendar/CalendarDiffDays.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ module Data.Time.Calendar.CalendarDiffDays     (         -- * Calendar Duration@@ -10,6 +12,7 @@ #endif import Data.Typeable import Data.Data+import Control.DeepSeq  data CalendarDiffDays = CalendarDiffDays     { cdMonths :: Integer@@ -24,6 +27,9 @@     -- ^ @since 1.9.2 #endif     )++instance NFData CalendarDiffDays where+    rnf (CalendarDiffDays m d) = rnf m `seq` rnf d `seq` ()  -- | Additive instance Semigroup CalendarDiffDays where
lib/Data/Time/Calendar/Days.hs view
@@ -1,5 +1,4 @@-{-# LANGUAGE Trustworthy #-}-{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE Safe #-}  module Data.Time.Calendar.Days     (@@ -21,7 +20,6 @@ instance NFData Day where     rnf (ModifiedJulianDay a) = rnf a --- necessary because H98 doesn't have "cunning newtype" derivation instance Enum Day where     succ (ModifiedJulianDay a) = ModifiedJulianDay (succ a)     pred (ModifiedJulianDay a) = ModifiedJulianDay (pred a)@@ -33,7 +31,6 @@     enumFromThenTo (ModifiedJulianDay a) (ModifiedJulianDay b) (ModifiedJulianDay c) =         fmap ModifiedJulianDay (enumFromThenTo a b c) --- necessary because H98 doesn't have "cunning newtype" derivation instance Ix Day where     range (ModifiedJulianDay a, ModifiedJulianDay b) = fmap ModifiedJulianDay (range (a, b))     index (ModifiedJulianDay a, ModifiedJulianDay b) (ModifiedJulianDay c) = index (a, b) c
lib/Data/Time/Calendar/Easter.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ module Data.Time.Calendar.Easter     ( sundayAfter     , orthodoxPaschalMoon
lib/Data/Time/Calendar/Gregorian.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE Safe #-} {-# OPTIONS -fno-warn-orphans #-}  module Data.Time.Calendar.Gregorian
lib/Data/Time/Calendar/Julian.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ module Data.Time.Calendar.Julian     ( Year     , MonthOfYear
lib/Data/Time/Calendar/JulianYearDay.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ module Data.Time.Calendar.JulianYearDay     (     -- * Year and day format
lib/Data/Time/Calendar/Month.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE Safe #-} #if __GLASGOW_HASKELL__ < 802 {-# OPTIONS_GHC -Wno-incomplete-patterns -Wno-incomplete-uni-patterns #-} #endif@@ -21,10 +21,32 @@ import Data.Fixed import Text.Read import Text.ParserCombinators.ReadP+import Control.DeepSeq+import Data.Ix  -- | An absolute count of common calendar months. -- Number is equal to @(year * 12) + (monthOfYear - 1)@. newtype Month = MkMonth Integer deriving (Eq, Ord, Data, Typeable)++instance NFData Month where+    rnf (MkMonth m) = rnf m++instance Enum Month where+    succ (MkMonth a) = MkMonth (succ a)+    pred (MkMonth a) = MkMonth (pred a)+    toEnum = MkMonth . toEnum+    fromEnum (MkMonth a) = fromEnum a+    enumFrom (MkMonth a) = fmap MkMonth (enumFrom a)+    enumFromThen (MkMonth a) (MkMonth b) = fmap MkMonth (enumFromThen a b)+    enumFromTo (MkMonth a) (MkMonth b) = fmap MkMonth (enumFromTo a b)+    enumFromThenTo (MkMonth a) (MkMonth b) (MkMonth c) =+        fmap MkMonth (enumFromThenTo a b c)++instance Ix Month where+    range (MkMonth a, MkMonth b) = fmap MkMonth (range (a, b))+    index (MkMonth a, MkMonth b) (MkMonth c) = index (a, b) c+    inRange (MkMonth a, MkMonth b) (MkMonth c) = inRange (a, b) c+    rangeSize (MkMonth a, MkMonth b) = rangeSize (a, b)  -- | Show as @yyyy-mm@. instance Show Month where
lib/Data/Time/Calendar/MonthDay.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ module Data.Time.Calendar.MonthDay     ( MonthOfYear, DayOfMonth, DayOfYear     , monthAndDayToDayOfYear
lib/Data/Time/Calendar/OrdinalDate.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ -- | ISO 8601 Ordinal Date format module Data.Time.Calendar.OrdinalDate (Day, Year, DayOfYear, WeekOfYear, module Data.Time.Calendar.OrdinalDate) where 
lib/Data/Time/Calendar/Private.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ module Data.Time.Calendar.Private where  import Data.Fixed
lib/Data/Time/Calendar/Quarter.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE Safe #-} #if __GLASGOW_HASKELL__ < 802 {-# OPTIONS_GHC -Wno-incomplete-patterns -Wno-incomplete-uni-patterns #-} #endif@@ -22,9 +22,11 @@ import Data.Fixed import Text.Read import Text.ParserCombinators.ReadP+import Control.DeepSeq+import Data.Ix  -- | Quarters of each year. Each quarter corresponds to three months.-data QuarterOfYear = Q1 | Q2 | Q3 | Q4 deriving (Eq, Ord, Data, Typeable, Read, Show)+data QuarterOfYear = Q1 | Q2 | Q3 | Q4 deriving (Eq, Ord, Data, Typeable, Read, Show, Ix)  -- | maps Q1..Q4 to 1..4 instance Enum QuarterOfYear where@@ -43,9 +45,35 @@     minBound = Q1     maxBound = Q4 +instance NFData QuarterOfYear where+    rnf Q1 = ()+    rnf Q2 = ()+    rnf Q3 = ()+    rnf Q4 = ()+ -- | An absolute count of year quarters. -- Number is equal to @(year * 4) + (quarterOfYear - 1)@. newtype Quarter = MkQuarter Integer deriving (Eq, Ord, Data, Typeable)++instance NFData Quarter where+    rnf (MkQuarter m) = rnf m++instance Enum Quarter where+    succ (MkQuarter a) = MkQuarter (succ a)+    pred (MkQuarter a) = MkQuarter (pred a)+    toEnum = MkQuarter . toEnum+    fromEnum (MkQuarter a) = fromEnum a+    enumFrom (MkQuarter a) = fmap MkQuarter (enumFrom a)+    enumFromThen (MkQuarter a) (MkQuarter b) = fmap MkQuarter (enumFromThen a b)+    enumFromTo (MkQuarter a) (MkQuarter b) = fmap MkQuarter (enumFromTo a b)+    enumFromThenTo (MkQuarter a) (MkQuarter b) (MkQuarter c) =+        fmap MkQuarter (enumFromThenTo a b c)++instance Ix Quarter where+    range (MkQuarter a, MkQuarter b) = fmap MkQuarter (range (a, b))+    index (MkQuarter a, MkQuarter b) (MkQuarter c) = index (a, b) c+    inRange (MkQuarter a, MkQuarter b) (MkQuarter c) = inRange (a, b) c+    rangeSize (MkQuarter a, MkQuarter b) = rangeSize (a, b)  -- | Show as @yyyy-Qn@. instance Show Quarter where
lib/Data/Time/Calendar/Types.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ module Data.Time.Calendar.Types where  
lib/Data/Time/Calendar/Week.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ module Data.Time.Calendar.Week     (       -- * Week@@ -8,7 +10,9 @@     ) where  import Data.Fixed+import Data.Ix import Data.Data+import Control.DeepSeq import Data.Time.Calendar.Days  data DayOfWeek@@ -19,7 +23,16 @@     | Friday     | Saturday     | Sunday-    deriving (Eq, Show, Read, Data, Typeable, Ord)+    deriving (Eq, Show, Read, Data, Typeable, Ord, Ix)++instance NFData DayOfWeek where+    rnf Monday = ()+    rnf Tuesday = ()+    rnf Wednesday = ()+    rnf Thursday = ()+    rnf Friday = ()+    rnf Saturday = ()+    rnf Sunday = ()  -- | \"Circular\", so for example @[Tuesday ..]@ gives an endless sequence. -- Also: 'fromEnum' gives [1 .. 7] for [Monday .. Sunday], and 'toEnum' performs mod 7 to give a cycle of days.
lib/Data/Time/Calendar/WeekDate.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ -- | Week-based calendars module Data.Time.Calendar.WeekDate     (
lib/Data/Time/Clock.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ -- | Types and functions for UTC and UT1 module Data.Time.Clock     ( module Data.Time.Clock.Internal.UniversalTime
lib/Data/Time/Clock/Internal/AbsoluteTime.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ -- | TAI and leap-second maps for converting to UTC: most people won't need this module. module Data.Time.Clock.Internal.AbsoluteTime     (
lib/Data/Time/Clock/Internal/CTimeval.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ module Data.Time.Clock.Internal.CTimeval where #ifndef mingw32_HOST_OS -- All Unix-specific, this
lib/Data/Time/Clock/Internal/DiffTime.hs view
@@ -25,12 +25,9 @@     MkDiffTime Pico     deriving (Eq, Ord, Data, Typeable) --- necessary because H98 doesn't have "cunning newtype" derivation-instance NFData DiffTime -- FIXME: Data.Fixed had no NFData instances yet at time of writing-                                                                                             where-    rnf dt = seq dt ()+instance NFData DiffTime where+    rnf (MkDiffTime t) = rnf t --- necessary because H98 doesn't have "cunning newtype" derivation instance Enum DiffTime where     succ (MkDiffTime a) = MkDiffTime (succ a)     pred (MkDiffTime a) = MkDiffTime (pred a)@@ -50,7 +47,6 @@         _ <- lift $ char 's'         return $ MkDiffTime t --- necessary because H98 doesn't have "cunning newtype" derivation instance Num DiffTime where     (MkDiffTime a) + (MkDiffTime b) = MkDiffTime (a + b)     (MkDiffTime a) - (MkDiffTime b) = MkDiffTime (a - b)@@ -60,17 +56,14 @@     signum (MkDiffTime a) = MkDiffTime (signum a)     fromInteger i = MkDiffTime (fromInteger i) --- necessary because H98 doesn't have "cunning newtype" derivation instance Real DiffTime where     toRational (MkDiffTime a) = toRational a --- necessary because H98 doesn't have "cunning newtype" derivation instance Fractional DiffTime where     (MkDiffTime a) / (MkDiffTime b) = MkDiffTime (a / b)     recip (MkDiffTime a) = MkDiffTime (recip a)     fromRational r = MkDiffTime (fromRational r) --- necessary because H98 doesn't have "cunning newtype" derivation instance RealFrac DiffTime where     properFraction (MkDiffTime a) = let         (b', a') = properFraction a
lib/Data/Time/Clock/Internal/NominalDiffTime.hs view
@@ -41,10 +41,8 @@ nominalDiffTimeToSeconds :: NominalDiffTime -> Pico nominalDiffTimeToSeconds (MkNominalDiffTime t) = t --- necessary because H98 doesn't have "cunning newtype" derivation-instance NFData NominalDiffTime -- FIXME: Data.Fixed had no NFData instances yet at time of writing-                                                                                                    where-    rnf ndt = seq ndt ()+instance NFData NominalDiffTime where+    rnf (MkNominalDiffTime t) = rnf t  instance Enum NominalDiffTime where     succ (MkNominalDiffTime a) = MkNominalDiffTime (succ a)@@ -66,7 +64,6 @@         _ <- lift $ char 's'         return $ MkNominalDiffTime t --- necessary because H98 doesn't have "cunning newtype" derivation instance Num NominalDiffTime where     (MkNominalDiffTime a) + (MkNominalDiffTime b) = MkNominalDiffTime (a + b)     (MkNominalDiffTime a) - (MkNominalDiffTime b) = MkNominalDiffTime (a - b)@@ -76,17 +73,14 @@     signum (MkNominalDiffTime a) = MkNominalDiffTime (signum a)     fromInteger i = MkNominalDiffTime (fromInteger i) --- necessary because H98 doesn't have "cunning newtype" derivation instance Real NominalDiffTime where     toRational (MkNominalDiffTime a) = toRational a --- necessary because H98 doesn't have "cunning newtype" derivation instance Fractional NominalDiffTime where     (MkNominalDiffTime a) / (MkNominalDiffTime b) = MkNominalDiffTime (a / b)     recip (MkNominalDiffTime a) = MkNominalDiffTime (recip a)     fromRational r = MkNominalDiffTime (fromRational r) --- necessary because H98 doesn't have "cunning newtype" derivation instance RealFrac NominalDiffTime where     properFraction (MkNominalDiffTime a) = (i, MkNominalDiffTime f)       where
lib/Data/Time/Clock/Internal/POSIXTime.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ module Data.Time.Clock.Internal.POSIXTime where  import Data.Time.Clock.Internal.NominalDiffTime
lib/Data/Time/Clock/Internal/UTCDiff.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ module Data.Time.Clock.Internal.UTCDiff where  import Data.Time.Clock.Internal.NominalDiffTime
lib/Data/Time/Clock/Internal/UTCTime.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ module Data.Time.Clock.Internal.UTCTime     (     -- * UTC
lib/Data/Time/Clock/Internal/UniversalTime.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ module Data.Time.Clock.Internal.UniversalTime     (     -- * Universal Time@@ -14,6 +16,5 @@     { getModJulianDate :: Rational     } deriving (Eq, Ord, Data, Typeable) --- necessary because H98 doesn't have "cunning newtype" derivation instance NFData UniversalTime where     rnf (ModJulianDate a) = rnf a
lib/Data/Time/Clock/POSIX.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ -- | POSIX time, if you need to deal with timestamps and the like. -- Most people won't need this module. --
lib/Data/Time/Clock/System.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ -- | Fast access to the system clock. module Data.Time.Clock.System     ( systemEpochDay
lib/Data/Time/Clock/TAI.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE Safe #-} {-# OPTIONS -fno-warn-orphans #-}  -- | TAI and leap-second maps for converting to UTC: most people won't need this module.
lib/Data/Time/Format.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ module Data.Time.Format     (     -- * UNIX-style formatting
lib/Data/Time/Format/Format/Class.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ module Data.Time.Format.Format.Class     (         -- * Formatting
lib/Data/Time/Format/Format/Instances.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE Safe #-} {-# OPTIONS -fno-warn-orphans #-} #if __GLASGOW_HASKELL__ < 802 {-# OPTIONS_GHC -Wno-incomplete-patterns -Wno-incomplete-uni-patterns #-}
lib/Data/Time/Format/ISO8601.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ module Data.Time.Format.ISO8601     (         -- * Format
lib/Data/Time/Format/Internal.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ {-| The contents of this module is liable to change, or disappear entirely. Please <https://github.com/haskell/time/issues/new let me know> if you depend on anything here.
lib/Data/Time/Format/Locale.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ -- Note: this file derives from old-locale:System.Locale.hs, which is copyright (c) The University of Glasgow 2001 module Data.Time.Format.Locale     ( TimeLocale(..)
lib/Data/Time/Format/Parse.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE Safe #-} {-# OPTIONS -fno-warn-orphans #-}  module Data.Time.Format.Parse
lib/Data/Time/Format/Parse/Class.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ module Data.Time.Format.Parse.Class     (         -- * Parsing
lib/Data/Time/Format/Parse/Instances.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE Safe #-} {-# OPTIONS -fno-warn-orphans #-}  module Data.Time.Format.Parse.Instances
lib/Data/Time/LocalTime.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ module Data.Time.LocalTime     (     -- * Time zones
lib/Data/Time/LocalTime/Internal/CalendarDiffTime.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ module Data.Time.LocalTime.Internal.CalendarDiffTime     (         -- * Calendar Duration@@ -9,6 +11,7 @@ import Data.Fixed import Data.Typeable import Data.Data+import Control.DeepSeq import Data.Time.Calendar.CalendarDiffDays import Data.Time.Clock.Internal.NominalDiffTime @@ -25,6 +28,9 @@     -- ^ @since 1.9.2 #endif     )++instance NFData CalendarDiffTime where+    rnf (CalendarDiffTime m t) = rnf m `seq` rnf t `seq` ()  -- | Additive instance Semigroup CalendarDiffTime where
lib/Data/Time/LocalTime/Internal/LocalTime.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE Safe #-} {-# OPTIONS -fno-warn-orphans #-}  module Data.Time.LocalTime.Internal.LocalTime
lib/Data/Time/LocalTime/Internal/TimeOfDay.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Safe #-}+ module Data.Time.LocalTime.Internal.TimeOfDay     (     -- * Time of day@@ -37,7 +39,7 @@     } deriving (Eq, Ord, Data, Typeable)  instance NFData TimeOfDay where-    rnf (TimeOfDay h m s) = rnf h `seq` rnf m `seq` s `seq` () -- FIXME: Data.Fixed had no NFData instances yet at time of writing+    rnf (TimeOfDay h m s) = rnf h `seq` rnf m `seq` rnf s `seq` ()  -- | Hour zero midnight :: TimeOfDay
lib/Data/Time/LocalTime/Internal/TimeZone.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE Safe #-} {-# LANGUAGE ForeignFunctionInterface #-}  module Data.Time.LocalTime.Internal.TimeZone
lib/Data/Time/LocalTime/Internal/ZonedTime.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE Safe #-} {-# OPTIONS -fno-warn-orphans #-}  module Data.Time.LocalTime.Internal.ZonedTime
test/main/Test/Types.hs view
@@ -1,26 +1,36 @@-module Test.Types(CheckInstances) where+module Test.Types() where +import Control.DeepSeq import Data.Data+import Data.Ix import Data.Time+import Data.Time.Calendar.Month+import Data.Time.Calendar.Quarter import Data.Time.Clock.System import Data.Time.Clock.TAI -class (Typeable t, Data t) => CheckDataInstances t-class (Typeable t, Data t, Eq t) => CheckInstances t+class (Typeable t, Data t, NFData t) => CheckDataInstances t+class (Typeable t, Data t, NFData t, Eq t) => CheckEqInstances t+class (Typeable t, Data t, NFData t, Eq t, Ord t) => CheckOrdInstances t+class (Typeable t, Data t, NFData t, Eq t, Ord t, Ix t, Enum t) => CheckEnumInstances t+class (Typeable t, Data t, NFData t, Eq t, Ord t, Ix t, Enum t, Bounded t) => CheckBoundedInstances t -instance CheckInstances UTCTime-instance CheckInstances NominalDiffTime+instance CheckOrdInstances UTCTime+instance CheckOrdInstances NominalDiffTime -instance CheckInstances Day-instance CheckInstances DayOfWeek-instance CheckInstances TimeOfDay-instance CheckInstances LocalTime-instance CheckInstances TimeZone+instance CheckEnumInstances Day+instance CheckEnumInstances DayOfWeek+instance CheckOrdInstances TimeOfDay+instance CheckOrdInstances LocalTime+instance CheckOrdInstances TimeZone instance CheckDataInstances ZonedTime-instance CheckInstances CalendarDiffDays-instance CheckInstances CalendarDiffTime+instance CheckEqInstances CalendarDiffDays+instance CheckEqInstances CalendarDiffTime+instance CheckEnumInstances Month+instance CheckEnumInstances Quarter+instance CheckBoundedInstances QuarterOfYear -instance CheckInstances SystemTime+instance CheckOrdInstances SystemTime -instance CheckInstances AbsoluteTime-instance CheckInstances UniversalTime+instance CheckOrdInstances AbsoluteTime+instance CheckOrdInstances UniversalTime
time.cabal view
@@ -1,5 +1,5 @@ name:           time-version:        1.11+version:        1.11.1 stability:      stable license:        BSD3 license-file:   LICENSE