packages feed

time 1.9.3 → 1.10

raw patch · 82 files changed

+5862/−5175 lines, 82 filesdep ~basesetup-changed

Dependency ranges changed: base

Files

Setup.hs view
@@ -1,4 +1,6 @@-module Main (main) where+module Main+    ( main+    ) where  import Distribution.Simple 
changelog.md view
@@ -1,5 +1,14 @@ # Change Log +## [1.10]+- remove deprecated functions parseTime, readTime, readsTime+- deprecate iso8601DateFormat+- parsing: fix %_Q %-Q %_q %-q+- parsing: fix parsing of BCE years+- formatting: fix %3ES %3Es+- change internal members of ParseTime to allow newtype-deriving+- new functions (aliases) pastMidnight & sinceMidnight+ ## [1.9.3] - documentation fixes 
configure view
@@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles.-# Generated by GNU Autoconf 2.69 for Haskell time package 1.8.+# Generated by GNU Autoconf 2.69 for Haskell time package 1.10. # # Report bugs to <ashley@semantic.org>. #@@ -580,8 +580,8 @@ # Identity of this package. PACKAGE_NAME='Haskell time package' PACKAGE_TARNAME='time'-PACKAGE_VERSION='1.8'-PACKAGE_STRING='Haskell time package 1.8'+PACKAGE_VERSION='1.10'+PACKAGE_STRING='Haskell time package 1.10' PACKAGE_BUGREPORT='ashley@semantic.org' PACKAGE_URL='' @@ -1238,7 +1238,7 @@   # Omit some internal or obsolete options to make the list less imposing.   # This message is too long to be a string in the A/UX 3.1 sh.   cat <<_ACEOF-\`configure' configures Haskell time package 1.8 to adapt to many kinds of systems.+\`configure' configures Haskell time package 1.10 to adapt to many kinds of systems.  Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1300,7 +1300,7 @@  if test -n "$ac_init_help"; then   case $ac_init_help in-     short | recursive ) echo "Configuration of Haskell time package 1.8:";;+     short | recursive ) echo "Configuration of Haskell time package 1.10:";;    esac   cat <<\_ACEOF @@ -1386,7 +1386,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then   cat <<\_ACEOF-Haskell time package configure 1.8+Haskell time package configure 1.10 generated by GNU Autoconf 2.69  Copyright (C) 2012 Free Software Foundation, Inc.@@ -1858,7 +1858,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Haskell time package $as_me 1.8, which was+It was created by Haskell time package $as_me 1.10, which was generated by GNU Autoconf 2.69.  Invocation command line was    $ $0 $@@@ -4193,7 +4193,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log="-This file was extended by Haskell time package $as_me 1.8, which was+This file was extended by Haskell time package $as_me 1.10, which was generated by GNU Autoconf 2.69.  Invocation command line was    CONFIG_FILES    = $CONFIG_FILES@@ -4246,7 +4246,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\-Haskell time package config.status 1.8+Haskell time package config.status 1.10 configured by $0, generated by GNU Autoconf 2.69,   with options \\"\$ac_cs_config\\" 
configure.ac view
@@ -1,4 +1,4 @@-AC_INIT([Haskell time package], [1.9.3], [ashley@semantic.org], [time])+AC_INIT([Haskell time package], [1.10], [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
@@ -22,56 +22,40 @@     , decimalFormat     ) where -#if MIN_VERSION_base(4,9,0) import Control.Monad.Fail-import Prelude hiding (fail)-#endif-#if MIN_VERSION_base(4,8,0)-import Data.Void-#endif import Data.Char+import Data.Void+import Prelude hiding (fail) import Text.ParserCombinators.ReadP --#if MIN_VERSION_base(4,8,0)-#else-data Void-absurd :: Void -> a-absurd v = seq v $ error "absurd"-#endif- class IsoVariant f where     isoMap :: (a -> b) -> (b -> a) -> f a -> f b -enumMap :: (IsoVariant f,Enum a) => f Int -> f a+enumMap :: (IsoVariant f, Enum a) => f Int -> f a enumMap = isoMap toEnum fromEnum  infixr 3 <**>, **>, <**+ class IsoVariant f => Productish f where     pUnit :: f ()-    (<**>) :: f a -> f b -> f (a,b)-    (**>) ::  f () -> f a -> f a-    fu **> fa = isoMap (\((),a) -> a) (\a -> ((),a)) $ fu <**> fa-    (<**) ::  f a -> f () -> f a-    fa <** fu = isoMap (\(a,()) -> a) (\a -> (a,())) $ fa <**> fu+    (<**>) :: f a -> f b -> f (a, b)+    (**>) :: f () -> f a -> f a+    fu **> fa = isoMap (\((), a) -> a) (\a -> ((), a)) $ fu <**> fa+    (<**) :: f a -> f () -> f a+    fa <** fu = isoMap (\(a, ()) -> a) (\a -> (a, ())) $ fa <**> fu  infixr 2 <++>+ class IsoVariant f => Summish f where     pVoid :: f Void     (<++>) :: f a -> f b -> f (Either a b) --parseReader :: (-#if MIN_VERSION_base(4,9,0)-    MonadFail m-#else-    Monad m-#endif-    ) => ReadP t -> String -> m t-parseReader readp s = case [ t | (t,"") <- readP_to_S readp s] of-    [t] -> return t-    []  -> fail $ "no parse of " ++ show s-    _   -> fail $ "multiple parses of " ++ show s+parseReader :: (MonadFail m) => ReadP t -> String -> m t+parseReader readp s =+    case [t | (t, "") <- readP_to_S readp s] of+        [t] -> return t+        [] -> fail $ "no parse of " ++ show s+        _ -> fail $ "multiple parses of " ++ show s  -- | A text format for a type data Format t = MkFormat@@ -83,36 +67,41 @@  -- | Show a value in the format, or error if unrepresentable formatShow :: Format t -> t -> String-formatShow fmt t = case formatShowM fmt t of-    Just str -> str-    Nothing -> error "formatShow: bad value"+formatShow fmt t =+    case formatShowM fmt t of+        Just str -> str+        Nothing -> error "formatShow: bad value"  -- | Parse a value in the format-formatParseM :: (-#if MIN_VERSION_base(4,9,0)-    MonadFail m-#else-    Monad m-#endif-    ) => Format t -> String -> m t+formatParseM :: (MonadFail m) => Format t -> String -> m t formatParseM format = parseReader $ formatReadP format  instance IsoVariant Format where     isoMap ab ba (MkFormat sa ra) = MkFormat (\b -> sa $ ba b) (fmap ab ra)  mapMFormat :: (a -> Maybe b) -> (b -> Maybe a) -> Format a -> Format b-mapMFormat amb bma (MkFormat sa ra) = MkFormat (\b -> bma b >>= sa) $ do-    a <- ra-    case amb a of-        Just b -> return b-        Nothing -> pfail+mapMFormat amb bma (MkFormat sa ra) =+    MkFormat (\b -> bma b >>= sa) $ do+        a <- ra+        case amb a of+            Just b -> return b+            Nothing -> pfail  filterFormat :: (a -> Bool) -> Format a -> Format a-filterFormat test = mapMFormat (\a -> if test a then Just a else Nothing) (\a -> if test a then Just a else Nothing)+filterFormat test =+    mapMFormat+        (\a ->+             if test a+                 then Just a+                 else Nothing)+        (\a ->+             if test a+                 then Just a+                 else Nothing)  -- | Limits are inclusive-clipFormat :: Ord a => (a,a) -> Format a -> Format a-clipFormat (lo,hi) = filterFormat (\a -> a >= lo && a <= hi)+clipFormat :: Ord a => (a, a) -> Format a -> Format a+clipFormat (lo, hi) = filterFormat (\a -> a >= lo && a <= hi)  instance Productish Format where     pUnit = MkFormat {formatShowM = \_ -> Just "", formatReadP = return ()}@@ -157,45 +146,36 @@ literalFormat :: String -> Format () literalFormat s = MkFormat {formatShowM = \_ -> Just s, formatReadP = string s >> return ()} -specialCaseShowFormat :: Eq a => (a,String) -> Format a -> Format a-specialCaseShowFormat (val,str) (MkFormat s r) = let-    s' t | t == val = Just str+specialCaseShowFormat :: Eq a => (a, String) -> Format a -> Format a+specialCaseShowFormat (val, str) (MkFormat s r) = let+    s' t+        | t == val = Just str     s' t = s t     in MkFormat s' r -specialCaseFormat :: Eq a => (a,String) -> Format a -> Format a-specialCaseFormat (val,str) (MkFormat s r) = let-    s' t | t == val = Just str+specialCaseFormat :: Eq a => (a, String) -> Format a -> Format a+specialCaseFormat (val, str) (MkFormat s r) = let+    s' t+        | t == val = Just str     s' t = s t     r' = (string str >> return val) +++ r     in MkFormat s' r'  optionalFormat :: Eq a => a -> Format a -> Format a-optionalFormat val = specialCaseFormat (val,"")+optionalFormat val = specialCaseFormat (val, "") -casesFormat :: Eq a => [(a,String)] -> Format a+casesFormat :: Eq a => [(a, String)] -> Format a casesFormat pairs = let     s t = lookup t pairs     r [] = pfail-    r ((v,str):pp) = (string str >> return v) <++ r pp+    r ((v, str):pp) = (string str >> return v) <++ r pp     in MkFormat s $ r pairs -optionalSignFormat :: (Eq t,Num t) => Format t-optionalSignFormat = casesFormat-    [-        (1,""),-        (1,"+"),-        (0,""),-        (-1,"-")-    ]+optionalSignFormat :: (Eq t, Num t) => Format t+optionalSignFormat = casesFormat [(1, ""), (1, "+"), (0, ""), (-1, "-")] -mandatorySignFormat :: (Eq t,Num t) => Format t-mandatorySignFormat = casesFormat-    [-        (1,"+"),-        (0,"+"),-        (-1,"-")-    ]+mandatorySignFormat :: (Eq t, Num t) => Format t+mandatorySignFormat = casesFormat [(1, "+"), (0, "+"), (-1, "-")]  data SignOption     = NoSign@@ -231,7 +211,8 @@ trimTrailing :: String -> String trimTrailing "" = "" trimTrailing "." = ""-trimTrailing s | last s == '0' = trimTrailing $ init s+trimTrailing s+    | last s == '0' = trimTrailing $ init s trimTrailing s = s  showNumber :: Show t => SignOption -> Maybe Int -> t -> Maybe String@@ -245,12 +226,13 @@                    NoSign -> Nothing                    _ -> Just $ '-' : showIt str            str ->-               Just $ case signOpt of+               Just $+               case signOpt of                    PosNegSign -> '+' : showIt str                    _ -> showIt str -integerFormat :: (Show t,Read t,Num t) => SignOption -> Maybe Int -> Format t+integerFormat :: (Show t, Read t, Num t) => SignOption -> Maybe Int -> Format t integerFormat signOpt mdigitcount = MkFormat (showNumber signOpt mdigitcount) (readNumber signOpt mdigitcount False) -decimalFormat :: (Show t,Read t,Num t) => SignOption -> Maybe Int -> Format t+decimalFormat :: (Show t, Read t, Num t) => SignOption -> Maybe Int -> Format t decimalFormat signOpt mdigitcount = MkFormat (showNumber signOpt mdigitcount) (readNumber signOpt mdigitcount True)
lib/Data/Time.hs view
@@ -29,14 +29,13 @@ * 'UniversalTime' for time based on Earth rotation -} module Data.Time-(-    module Data.Time.Calendar,-    module Data.Time.Clock,-    module Data.Time.LocalTime,-    module Data.Time.Format-) where+    ( module Data.Time.Calendar+    , module Data.Time.Clock+    , module Data.Time.LocalTime+    , module Data.Time.Format+    ) where  import Data.Time.Calendar import Data.Time.Clock-import Data.Time.LocalTime import Data.Time.Format+import Data.Time.LocalTime
lib/Data/Time/Calendar.hs view
@@ -1,13 +1,12 @@ module Data.Time.Calendar-(-    module Data.Time.Calendar.Days,-    module Data.Time.Calendar.CalendarDiffDays,-    module Data.Time.Calendar.Gregorian,-    module Data.Time.Calendar.Week-) where+    ( module Data.Time.Calendar.Days+    , module Data.Time.Calendar.CalendarDiffDays+    , module Data.Time.Calendar.Gregorian+    , module Data.Time.Calendar.Week+    ) where -import Data.Time.Calendar.Days import Data.Time.Calendar.CalendarDiffDays+import Data.Time.Calendar.Days import Data.Time.Calendar.Gregorian import Data.Time.Calendar.Week-import Data.Time.Format()+import Data.Time.Format ()
lib/Data/Time/Calendar/CalendarDiffDays.hs view
@@ -4,11 +4,8 @@         module Data.Time.Calendar.CalendarDiffDays     ) where -#if MIN_VERSION_base(4,8,0)+#if MIN_VERSION_base(4,11,0) #else-import Data.Monoid-#endif-#if MIN_VERSION_base(4,9,0) && !MIN_VERSION_base(4,11,0) import Data.Semigroup hiding (option) #endif import Data.Typeable@@ -28,20 +25,14 @@ #endif     ) -#if MIN_VERSION_base(4,9,0) -- | Additive instance Semigroup CalendarDiffDays where     CalendarDiffDays m1 d1 <> CalendarDiffDays m2 d2 = CalendarDiffDays (m1 + m2) (d1 + d2)-#endif  -- | Additive instance Monoid CalendarDiffDays where     mempty = CalendarDiffDays 0 0-#if MIN_VERSION_base(4,9,0)     mappend = (<>)-#else-    mappend (CalendarDiffDays m1 d1) (CalendarDiffDays m2 d2) = CalendarDiffDays (m1 + m2) (d1 + d2)-#endif  instance Show CalendarDiffDays where     show (CalendarDiffDays m d) = "P" ++ show m ++ "M" ++ show d ++ "D"
lib/Data/Time/Calendar/Days.hs view
@@ -1,17 +1,22 @@ {-# OPTIONS -fno-warn-unused-imports #-}+ module Data.Time.Calendar.Days-(+    (     -- * Days-    Day(..),addDays,diffDays-) where+      Day(..)+    , addDays+    , diffDays+    ) where  import Control.DeepSeq+import Data.Data import Data.Ix import Data.Typeable-import Data.Data  -- | 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)+newtype Day = ModifiedJulianDay+    { toModifiedJulianDay :: Integer+    } deriving (Eq, Ord, Data, Typeable)  instance NFData Day where     rnf (ModifiedJulianDay a) = rnf a@@ -25,14 +30,15 @@     enumFrom (ModifiedJulianDay a) = fmap ModifiedJulianDay (enumFrom a)     enumFromThen (ModifiedJulianDay a) (ModifiedJulianDay b) = fmap ModifiedJulianDay (enumFromThen a b)     enumFromTo (ModifiedJulianDay a) (ModifiedJulianDay b) = fmap ModifiedJulianDay (enumFromTo a b)-    enumFromThenTo (ModifiedJulianDay a) (ModifiedJulianDay b) (ModifiedJulianDay c) = fmap ModifiedJulianDay (enumFromThenTo a b c)+    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-    inRange (ModifiedJulianDay a,ModifiedJulianDay b) (ModifiedJulianDay c) = inRange (a,b) c-    rangeSize (ModifiedJulianDay a,ModifiedJulianDay b) = rangeSize (a,b)+    range (ModifiedJulianDay a, ModifiedJulianDay b) = fmap ModifiedJulianDay (range (a, b))+    index (ModifiedJulianDay a, ModifiedJulianDay b) (ModifiedJulianDay c) = index (a, b) c+    inRange (ModifiedJulianDay a, ModifiedJulianDay b) (ModifiedJulianDay c) = inRange (a, b) c+    rangeSize (ModifiedJulianDay a, ModifiedJulianDay b) = rangeSize (a, b)  addDays :: Integer -> Day -> Day addDays n (ModifiedJulianDay a) = ModifiedJulianDay (a + n)
lib/Data/Time/Calendar/Easter.hs view
@@ -1,12 +1,12 @@ module Data.Time.Calendar.Easter-    (-    sundayAfter,-    orthodoxPaschalMoon,orthodoxEaster,-    gregorianPaschalMoon,gregorianEaster+    ( sundayAfter+    , orthodoxPaschalMoon+    , orthodoxEaster+    , gregorianPaschalMoon+    , gregorianEaster     ) where  -- formulae from Reingold & Dershowitz, _Calendrical Calculations_, ch. 8.- import Data.Time.Calendar import Data.Time.Calendar.Julian @@ -16,9 +16,13 @@  -- | Given a year, find the Paschal full moon according to Orthodox Christian tradition orthodoxPaschalMoon :: Integer -> Day-orthodoxPaschalMoon year  = addDays (- shiftedEpact) (fromJulian jyear 4 19) where+orthodoxPaschalMoon year = addDays (-shiftedEpact) (fromJulian jyear 4 19)+  where     shiftedEpact = mod (14 + 11 * (mod year 19)) 30-    jyear = if year > 0 then year else year - 1+    jyear =+        if year > 0+            then year+            else year - 1  -- | Given a year, find Easter according to Orthodox Christian tradition orthodoxEaster :: Integer -> Day@@ -26,10 +30,14 @@  -- | Given a year, find the Paschal full moon according to the Gregorian method gregorianPaschalMoon :: Integer -> Day-gregorianPaschalMoon year  = addDays (- adjustedEpact) (fromGregorian year 4 19) where+gregorianPaschalMoon year = addDays (-adjustedEpact) (fromGregorian year 4 19)+  where     century = (div year 100) + 1     shiftedEpact = mod (14 + 11 * (mod year 19) - (div (3 * century) 4) + (div (5 + 8 * century) 25)) 30-    adjustedEpact = if shiftedEpact == 0 || ((shiftedEpact == 1) && (mod year 19 < 10)) then shiftedEpact + 1 else shiftedEpact+    adjustedEpact =+        if shiftedEpact == 0 || ((shiftedEpact == 1) && (mod year 19 < 10))+            then shiftedEpact + 1+            else shiftedEpact  -- | Given a year, find Easter according to the Gregorian method gregorianEaster :: Integer -> Day
lib/Data/Time/Calendar/Gregorian.hs view
@@ -1,31 +1,39 @@ {-# OPTIONS -fno-warn-orphans #-}+ module Data.Time.Calendar.Gregorian-(+    (     -- * Gregorian calendar-    toGregorian,fromGregorian,fromGregorianValid,showGregorian,gregorianMonthLength,-+      toGregorian+    , fromGregorian+    , fromGregorianValid+    , showGregorian+    , gregorianMonthLength     -- calendrical arithmetic     -- e.g. "one month after March 31st"-    addGregorianMonthsClip,addGregorianMonthsRollOver,-    addGregorianYearsClip,addGregorianYearsRollOver,-    addGregorianDurationClip,addGregorianDurationRollOver,-    diffGregorianDurationClip,diffGregorianDurationRollOver,-+    , addGregorianMonthsClip+    , addGregorianMonthsRollOver+    , addGregorianYearsClip+    , addGregorianYearsRollOver+    , addGregorianDurationClip+    , addGregorianDurationRollOver+    , diffGregorianDurationClip+    , diffGregorianDurationRollOver     -- re-exported from OrdinalDate-    isLeapYear-) where+    , isLeapYear+    ) where +import Data.Time.Calendar.CalendarDiffDays+import Data.Time.Calendar.Days import Data.Time.Calendar.MonthDay import Data.Time.Calendar.OrdinalDate-import Data.Time.Calendar.Days-import Data.Time.Calendar.CalendarDiffDays import Data.Time.Calendar.Private  -- | Convert to proleptic Gregorian calendar. First element of result is year, second month number (1-12), third day (1-31).-toGregorian :: Day -> (Integer,Int,Int)-toGregorian date = (year,month,day) where-    (year,yd) = toOrdinalDate date-    (month,day) = dayOfYearToMonthAndDay (isLeapYear year) yd+toGregorian :: Day -> (Integer, Int, Int)+toGregorian date = (year, month, day)+  where+    (year, yd) = toOrdinalDate date+    (month, day) = dayOfYearToMonthAndDay (isLeapYear year) yd  -- | Convert from proleptic Gregorian calendar. First argument is year, second month number (1-12), third day (1-31). -- Invalid values will be clipped to the correct range, month first, then day.@@ -41,32 +49,36 @@  -- | Show in ISO 8601 format (yyyy-mm-dd) showGregorian :: Day -> String-showGregorian date = (show4 y) ++ "-" ++ (show2 m) ++ "-" ++ (show2 d) where-    (y,m,d) = toGregorian date+showGregorian date = (show4 y) ++ "-" ++ (show2 m) ++ "-" ++ (show2 d)+  where+    (y, m, d) = toGregorian date  -- | The number of days in a given month according to the proleptic Gregorian calendar. First argument is year, second is month. gregorianMonthLength :: Integer -> Int -> Int gregorianMonthLength year = monthLength (isLeapYear year) -rolloverMonths :: (Integer,Integer) -> (Integer,Int)-rolloverMonths (y,m) = (y + (div (m - 1) 12),fromIntegral (mod (m - 1) 12) + 1)+rolloverMonths :: (Integer, Integer) -> (Integer, Int)+rolloverMonths (y, m) = (y + (div (m - 1) 12), fromIntegral (mod (m - 1) 12) + 1) -addGregorianMonths :: Integer -> Day -> (Integer,Int,Int)-addGregorianMonths n day = (y',m',d) where-    (y,m,d) = toGregorian day-    (y',m') = rolloverMonths (y,fromIntegral m + n)+addGregorianMonths :: Integer -> Day -> (Integer, Int, Int)+addGregorianMonths n day = (y', m', d)+  where+    (y, m, d) = toGregorian day+    (y', m') = rolloverMonths (y, fromIntegral m + n)  -- | Add months, with days past the last day of the month clipped to the last day. -- For instance, 2005-01-30 + 1 month = 2005-02-28. addGregorianMonthsClip :: Integer -> Day -> Day-addGregorianMonthsClip n day = fromGregorian y m d where-    (y,m,d) = addGregorianMonths n day+addGregorianMonthsClip n day = fromGregorian y m d+  where+    (y, m, d) = addGregorianMonths n day  -- | Add months, with days past the last day of the month rolling over to the next month. -- For instance, 2005-01-30 + 1 month = 2005-03-02. addGregorianMonthsRollOver :: Integer -> Day -> Day-addGregorianMonthsRollOver n day = addDays (fromIntegral d - 1) (fromGregorian y m 1) where-    (y,m,d) = addGregorianMonths n day+addGregorianMonthsRollOver n day = addDays (fromIntegral d - 1) (fromGregorian y m 1)+  where+    (y, m, d) = addGregorianMonths n day  -- | Add years, matching month and day, with Feb 29th clipped to Feb 28th if necessary. -- For instance, 2004-02-29 + 2 years = 2006-02-28.@@ -89,15 +101,19 @@ -- | Calendrical difference, with as many whole months as possible diffGregorianDurationClip :: Day -> Day -> CalendarDiffDays diffGregorianDurationClip day2 day1 = let-    (y1,m1,d1) = toGregorian day1-    (y2,m2,d2) = toGregorian day2+    (y1, m1, d1) = toGregorian day1+    (y2, m2, d2) = toGregorian day2     ym1 = y1 * 12 + toInteger m1     ym2 = y2 * 12 + toInteger m2     ymdiff = ym2 - ym1     ymAllowed =-        if day2 >= day1 then-        if d2 >= d1 then ymdiff else ymdiff - 1-        else if d2 <= d1 then ymdiff else ymdiff + 1+        if day2 >= day1+            then if d2 >= d1+                     then ymdiff+                     else ymdiff - 1+            else if d2 <= d1+                     then ymdiff+                     else ymdiff + 1     dayAllowed = addGregorianDurationClip (CalendarDiffDays ymAllowed 0) day1     in CalendarDiffDays ymAllowed $ diffDays day2 dayAllowed @@ -105,15 +121,19 @@ -- Same as 'diffGregorianDurationClip' for positive durations. diffGregorianDurationRollOver :: Day -> Day -> CalendarDiffDays diffGregorianDurationRollOver day2 day1 = let-    (y1,m1,d1) = toGregorian day1-    (y2,m2,d2) = toGregorian day2+    (y1, m1, d1) = toGregorian day1+    (y2, m2, d2) = toGregorian day2     ym1 = y1 * 12 + toInteger m1     ym2 = y2 * 12 + toInteger m2     ymdiff = ym2 - ym1     ymAllowed =-        if day2 >= day1 then-        if d2 >= d1 then ymdiff else ymdiff - 1-        else if d2 <= d1 then ymdiff else ymdiff + 1+        if day2 >= day1+            then if d2 >= d1+                     then ymdiff+                     else ymdiff - 1+            else if d2 <= d1+                     then ymdiff+                     else ymdiff + 1     dayAllowed = addGregorianDurationRollOver (CalendarDiffDays ymAllowed 0) day1     in CalendarDiffDays ymAllowed $ diffDays day2 dayAllowed 
lib/Data/Time/Calendar/Julian.hs view
@@ -1,28 +1,34 @@ module Data.Time.Calendar.Julian-(-    module Data.Time.Calendar.JulianYearDay,--    toJulian,fromJulian,fromJulianValid,showJulian,julianMonthLength,-+    ( module Data.Time.Calendar.JulianYearDay+    , toJulian+    , fromJulian+    , fromJulianValid+    , showJulian+    , julianMonthLength     -- calendrical arithmetic     -- e.g. "one month after March 31st"-    addJulianMonthsClip,addJulianMonthsRollOver,-    addJulianYearsClip,addJulianYearsRollOver,-    addJulianDurationClip,addJulianDurationRollOver,-    diffJulianDurationClip,diffJulianDurationRollOver,-) where+    , addJulianMonthsClip+    , addJulianMonthsRollOver+    , addJulianYearsClip+    , addJulianYearsRollOver+    , addJulianDurationClip+    , addJulianDurationRollOver+    , diffJulianDurationClip+    , diffJulianDurationRollOver+    ) where -import Data.Time.Calendar.MonthDay-import Data.Time.Calendar.JulianYearDay-import Data.Time.Calendar.Days import Data.Time.Calendar.CalendarDiffDays+import Data.Time.Calendar.Days+import Data.Time.Calendar.JulianYearDay+import Data.Time.Calendar.MonthDay import Data.Time.Calendar.Private  -- | Convert to proleptic Julian calendar. First element of result is year, second month number (1-12), third day (1-31).-toJulian :: Day -> (Integer,Int,Int)-toJulian date = (year,month,day) where-    (year,yd) = toJulianYearAndDay date-    (month,day) = dayOfYearToMonthAndDay (isJulianLeapYear year) yd+toJulian :: Day -> (Integer, Int, Int)+toJulian date = (year, month, day)+  where+    (year, yd) = toJulianYearAndDay date+    (month, day) = dayOfYearToMonthAndDay (isJulianLeapYear year) yd  -- | Convert from proleptic Julian calendar. First argument is year, second month number (1-12), third day (1-31). -- Invalid values will be clipped to the correct range, month first, then day.@@ -38,32 +44,36 @@  -- | Show in ISO 8601 format (yyyy-mm-dd) showJulian :: Day -> String-showJulian date = (show4 y) ++ "-" ++ (show2 m) ++ "-" ++ (show2 d) where-    (y,m,d) = toJulian date+showJulian date = (show4 y) ++ "-" ++ (show2 m) ++ "-" ++ (show2 d)+  where+    (y, m, d) = toJulian date  -- | The number of days in a given month according to the proleptic Julian calendar. First argument is year, second is month. julianMonthLength :: Integer -> Int -> Int julianMonthLength year = monthLength (isJulianLeapYear year) -rolloverMonths :: (Integer,Integer) -> (Integer,Int)-rolloverMonths (y,m) = (y + (div (m - 1) 12),fromIntegral (mod (m - 1) 12) + 1)+rolloverMonths :: (Integer, Integer) -> (Integer, Int)+rolloverMonths (y, m) = (y + (div (m - 1) 12), fromIntegral (mod (m - 1) 12) + 1) -addJulianMonths :: Integer -> Day -> (Integer,Int,Int)-addJulianMonths n day = (y',m',d) where-    (y,m,d) = toJulian day-    (y',m') = rolloverMonths (y,fromIntegral m + n)+addJulianMonths :: Integer -> Day -> (Integer, Int, Int)+addJulianMonths n day = (y', m', d)+  where+    (y, m, d) = toJulian day+    (y', m') = rolloverMonths (y, fromIntegral m + n)  -- | Add months, with days past the last day of the month clipped to the last day. -- For instance, 2005-01-30 + 1 month = 2005-02-28. addJulianMonthsClip :: Integer -> Day -> Day-addJulianMonthsClip n day = fromJulian y m d where-    (y,m,d) = addJulianMonths n day+addJulianMonthsClip n day = fromJulian y m d+  where+    (y, m, d) = addJulianMonths n day  -- | Add months, with days past the last day of the month rolling over to the next month. -- For instance, 2005-01-30 + 1 month = 2005-03-02. addJulianMonthsRollOver :: Integer -> Day -> Day-addJulianMonthsRollOver n day = addDays (fromIntegral d - 1) (fromJulian y m 1) where-    (y,m,d) = addJulianMonths n day+addJulianMonthsRollOver n day = addDays (fromIntegral d - 1) (fromJulian y m 1)+  where+    (y, m, d) = addJulianMonths n day  -- | Add years, matching month and day, with Feb 29th clipped to Feb 28th if necessary. -- For instance, 2004-02-29 + 2 years = 2006-02-28.@@ -86,15 +96,19 @@ -- | Calendrical difference, with as many whole months as possible diffJulianDurationClip :: Day -> Day -> CalendarDiffDays diffJulianDurationClip day2 day1 = let-    (y1,m1,d1) = toJulian day1-    (y2,m2,d2) = toJulian day2+    (y1, m1, d1) = toJulian day1+    (y2, m2, d2) = toJulian day2     ym1 = y1 * 12 + toInteger m1     ym2 = y2 * 12 + toInteger m2     ymdiff = ym2 - ym1     ymAllowed =-        if day2 >= day1 then-        if d2 >= d1 then ymdiff else ymdiff - 1-        else if d2 <= d1 then ymdiff else ymdiff + 1+        if day2 >= day1+            then if d2 >= d1+                     then ymdiff+                     else ymdiff - 1+            else if d2 <= d1+                     then ymdiff+                     else ymdiff + 1     dayAllowed = addJulianDurationClip (CalendarDiffDays ymAllowed 0) day1     in CalendarDiffDays ymAllowed $ diffDays day2 dayAllowed @@ -102,14 +116,18 @@ -- Same as 'diffJulianDurationClip' for positive durations. diffJulianDurationRollOver :: Day -> Day -> CalendarDiffDays diffJulianDurationRollOver day2 day1 = let-    (y1,m1,d1) = toJulian day1-    (y2,m2,d2) = toJulian day2+    (y1, m1, d1) = toJulian day1+    (y2, m2, d2) = toJulian day2     ym1 = y1 * 12 + toInteger m1     ym2 = y2 * 12 + toInteger m2     ymdiff = ym2 - ym1     ymAllowed =-        if day2 >= day1 then-        if d2 >= d1 then ymdiff else ymdiff - 1-        else if d2 <= d1 then ymdiff else ymdiff + 1+        if day2 >= day1+            then if d2 >= d1+                     then ymdiff+                     else ymdiff - 1+            else if d2 <= d1+                     then ymdiff+                     else ymdiff + 1     dayAllowed = addJulianDurationRollOver (CalendarDiffDays ymAllowed 0) day1     in CalendarDiffDays ymAllowed $ diffDays day2 dayAllowed
lib/Data/Time/Calendar/JulianYearDay.hs view
@@ -1,7 +1,7 @@ module Data.Time.Calendar.JulianYearDay     (     -- * Year and day format-    module Data.Time.Calendar.JulianYearDay+      module Data.Time.Calendar.JulianYearDay     ) where  import Data.Time.Calendar.Days@@ -9,8 +9,9 @@  -- | Convert to proleptic Julian year and day format. First element of result is year (proleptic Julian calendar), -- second is the day of the year, with 1 for Jan 1, and 365 (or 366 in leap years) for Dec 31.-toJulianYearAndDay :: Day -> (Integer,Int)-toJulianYearAndDay (ModifiedJulianDay mjd) = (year,yd) where+toJulianYearAndDay :: Day -> (Integer, Int)+toJulianYearAndDay (ModifiedJulianDay mjd) = (year, yd)+  where     a = mjd + 678577     quad = div a 1461     d = mod a 1461@@ -21,15 +22,32 @@ -- | Convert from proleptic Julian year and day format. -- Invalid day numbers will be clipped to the correct range (1 to 365 or 366). fromJulianYearAndDay :: Integer -> Int -> Day-fromJulianYearAndDay year day = ModifiedJulianDay mjd where+fromJulianYearAndDay year day = ModifiedJulianDay mjd+  where     y = year - 1-    mjd = (fromIntegral (clip 1 (if isJulianLeapYear year then 366 else 365) day)) + (365 * y) + (div y 4) - 678578+    mjd =+        (fromIntegral+             (clip+                  1+                  (if isJulianLeapYear year+                       then 366+                       else 365)+                  day)) ++        (365 * y) ++        (div y 4) -+        678578  -- | Convert from proleptic Julian year and day format. -- Invalid day numbers will return Nothing fromJulianYearAndDayValid :: Integer -> Int -> Maybe Day fromJulianYearAndDayValid year day = do-    day' <- clipValid 1 (if isJulianLeapYear year then 366 else 365) day+    day' <-+        clipValid+            1+            (if isJulianLeapYear year+                 then 366+                 else 365)+            day     let         y = year - 1         mjd = (fromIntegral day') + (365 * y) + (div y 4) - 678578@@ -37,8 +55,9 @@  -- | Show in proleptic Julian year and day format (yyyy-ddd) showJulianYearAndDay :: Day -> String-showJulianYearAndDay date = (show4 y) ++ "-" ++ (show3 d) where-    (y,d) = toJulianYearAndDay date+showJulianYearAndDay date = (show4 y) ++ "-" ++ (show3 d)+  where+    (y, d) = toJulianYearAndDay date  -- | Is this year a leap year according to the proleptic Julian calendar? isJulianLeapYear :: Integer -> Bool
lib/Data/Time/Calendar/MonthDay.hs view
@@ -1,6 +1,8 @@ module Data.Time.Calendar.MonthDay-    (-    monthAndDayToDayOfYear,monthAndDayToDayOfYearValid,dayOfYearToMonthAndDay,monthLength+    ( monthAndDayToDayOfYear+    , monthAndDayToDayOfYearValid+    , dayOfYearToMonthAndDay+    , monthLength     ) where  import Data.Time.Calendar.Private@@ -8,11 +10,17 @@ -- | Convert month and day in the Gregorian or Julian calendars to day of year. -- First arg is leap year flag. monthAndDayToDayOfYear :: Bool -> Int -> Int -> Int-monthAndDayToDayOfYear isLeap month day = (div (367 * month'' - 362) 12) + k + day' where+monthAndDayToDayOfYear isLeap month day = (div (367 * month'' - 362) 12) + k + day'+  where     month' = clip 1 12 month     day' = fromIntegral (clip 1 (monthLength' isLeap month') day)     month'' = fromIntegral month'-    k = if month' <= 2 then 0 else if isLeap then -1 else -2+    k =+        if month' <= 2+            then 0+            else if isLeap+                     then -1+                     else -2  -- | Convert month and day in the Gregorian or Julian calendars to day of year. -- First arg is leap year flag.@@ -23,17 +31,31 @@     let         day'' = fromIntegral day'         month'' = fromIntegral month'-        k = if month' <= 2 then 0 else if isLeap then -1 else -2+        k =+            if month' <= 2+                then 0+                else if isLeap+                         then -1+                         else -2     return ((div (367 * month'' - 362) 12) + k + day'')  -- | Convert day of year in the Gregorian or Julian calendars to month and day. -- First arg is leap year flag.-dayOfYearToMonthAndDay :: Bool -> Int -> (Int,Int)-dayOfYearToMonthAndDay isLeap yd = findMonthDay (monthLengths isLeap) (clip 1 (if isLeap then 366 else 365) yd)+dayOfYearToMonthAndDay :: Bool -> Int -> (Int, Int)+dayOfYearToMonthAndDay isLeap yd =+    findMonthDay+        (monthLengths isLeap)+        (clip+             1+             (if isLeap+                  then 366+                  else 365)+             yd) -findMonthDay :: [Int] -> Int -> (Int,Int)-findMonthDay (n:ns) yd | yd > n = (\(m,d) -> (m + 1,d)) (findMonthDay ns (yd - n))-findMonthDay _ yd = (1,yd)+findMonthDay :: [Int] -> Int -> (Int, Int)+findMonthDay (n:ns) yd+    | yd > n = (\(m, d) -> (m + 1, d)) (findMonthDay ns (yd - n))+findMonthDay _ yd = (1, yd)  -- | The length of a given month in the Gregorian or Julian calendars. -- First arg is leap year flag.@@ -45,5 +67,19 @@  monthLengths :: Bool -> [Int] monthLengths isleap =-    [31,if isleap then 29 else 28,31,30,31,30,31,31,30,31,30,31]+    [ 31+    , if isleap+          then 29+          else 28+    , 31+    , 30+    , 31+    , 30+    , 31+    , 31+    , 30+    , 31+    , 30+    , 31+    ]     --J        F                   M  A  M  J  J  A  S  O  N  D
lib/Data/Time/Calendar/OrdinalDate.hs view
@@ -6,8 +6,9 @@  -- | Convert to ISO 8601 Ordinal Date format. First element of result is year (proleptic Gregoran calendar), -- second is the day of the year, with 1 for Jan 1, and 365 (or 366 in leap years) for Dec 31.-toOrdinalDate :: Day -> (Integer,Int)-toOrdinalDate (ModifiedJulianDay mjd) = (year,yd) where+toOrdinalDate :: Day -> (Integer, Int)+toOrdinalDate (ModifiedJulianDay mjd) = (year, yd)+  where     a = mjd + 678575     quadcent = div a 146097     b = mod a 146097@@ -22,15 +23,34 @@ -- | Convert from ISO 8601 Ordinal Date format. -- Invalid day numbers will be clipped to the correct range (1 to 365 or 366). fromOrdinalDate :: Integer -> Int -> Day-fromOrdinalDate year day = ModifiedJulianDay mjd where+fromOrdinalDate year day = ModifiedJulianDay mjd+  where     y = year - 1-    mjd = (fromIntegral (clip 1 (if isLeapYear year then 366 else 365) day)) + (365 * y) + (div y 4) - (div y 100) + (div y 400) - 678576+    mjd =+        (fromIntegral+             (clip+                  1+                  (if isLeapYear year+                       then 366+                       else 365)+                  day)) ++        (365 * y) ++        (div y 4) -+        (div y 100) ++        (div y 400) -+        678576  -- | Convert from ISO 8601 Ordinal Date format. -- Invalid day numbers return 'Nothing' fromOrdinalDateValid :: Integer -> Int -> Maybe Day fromOrdinalDateValid year day = do-    day' <- clipValid 1 (if isLeapYear year then 366 else 365) day+    day' <-+        clipValid+            1+            (if isLeapYear year+                 then 366+                 else 365)+            day     let         y = year - 1         mjd = (fromIntegral day') + (365 * y) + (div y 4) - (div y 100) + (div y 400) - 678576@@ -38,8 +58,9 @@  -- | Show in ISO 8601 Ordinal Date format (yyyy-ddd) showOrdinalDate :: Day -> String-showOrdinalDate date = (show4 y) ++ "-" ++ (show3 d) where-    (y,d) = toOrdinalDate date+showOrdinalDate date = (show4 y) ++ "-" ++ (show3 d)+  where+    (y, d) = toOrdinalDate date  -- | Is this year a leap year according to the proleptic Gregorian calendar? isLeapYear :: Integer -> Bool@@ -48,8 +69,9 @@ -- | Get the number of the Monday-starting week in the year and the day of the week. -- The first Monday is the first day of week 1, any earlier days in the year are week 0 (as @%W@ in 'Data.Time.Format.formatTime'). -- Monday is 1, Sunday is 7 (as @%u@ in 'Data.Time.Format.formatTime').-mondayStartWeek :: Day -> (Int,Int)-mondayStartWeek date = (fromInteger ((div d 7) - (div k 7)),fromInteger (mod d 7) + 1) where+mondayStartWeek :: Day -> (Int, Int)+mondayStartWeek date = (fromInteger ((div d 7) - (div k 7)), fromInteger (mod d 7) + 1)+  where     yd = snd (toOrdinalDate date)     d = (toModifiedJulianDay date) + 2     k = d - (toInteger yd)@@ -57,8 +79,9 @@ -- | Get the number of the Sunday-starting week in the year and the day of the week. -- The first Sunday is the first day of week 1, any earlier days in the year are week 0 (as @%U@ in 'Data.Time.Format.formatTime'). -- Sunday is 0, Saturday is 6 (as @%w@ in 'Data.Time.Format.formatTime').-sundayStartWeek :: Day -> (Int,Int)-sundayStartWeek date =(fromInteger ((div d 7) - (div k 7)),fromInteger (mod d 7)) where+sundayStartWeek :: Day -> (Int, Int)+sundayStartWeek date = (fromInteger ((div d 7) - (div k 7)), fromInteger (mod d 7))+  where     yd = snd (toOrdinalDate date)     d = (toModifiedJulianDay date) + 3     k = d - (toInteger yd)@@ -67,104 +90,100 @@ -- the number of the Monday-starting week, and the day of the week. -- The first Monday is the first day of week 1, any earlier days in the year -- are week 0 (as @%W@ in 'Data.Time.Format.formatTime').-fromMondayStartWeek :: Integer -- ^ Year.-                    -> Int     -- ^ Monday-starting week number (as @%W@ in 'Data.Time.Format.formatTime').-                    -> Int     -- ^ Day of week.+fromMondayStartWeek ::+       Integer -- ^ Year.+    -> Int -- ^ Monday-starting week number (as @%W@ in 'Data.Time.Format.formatTime').+    -> Int -- ^ Day of week.                                -- Monday is 1, Sunday is 7 (as @%u@ in 'Data.Time.Format.formatTime').-                    -> Day+    -> Day fromMondayStartWeek year w d = let     -- first day of the year     firstDay = fromOrdinalDate year 1-     -- 0-based year day of first monday of the year     zbFirstMonday = (5 - toModifiedJulianDay firstDay) `mod` 7-     -- 0-based week of year     zbWeek = w - 1-     -- 0-based day of week     zbDay = d - 1-     -- 0-based day in year     zbYearDay = zbFirstMonday + 7 * toInteger zbWeek + toInteger zbDay-     in addDays zbYearDay firstDay -fromMondayStartWeekValid :: Integer -- ^ Year.-                    -> Int     -- ^ Monday-starting week number (as @%W@ in 'Data.Time.Format.formatTime').-                    -> Int     -- ^ Day of week.+fromMondayStartWeekValid ::+       Integer -- ^ Year.+    -> Int -- ^ Monday-starting week number (as @%W@ in 'Data.Time.Format.formatTime').+    -> Int -- ^ Day of week.                                -- Monday is 1, Sunday is 7 (as @%u@ in 'Data.Time.Format.formatTime').-                    -> Maybe Day+    -> Maybe Day fromMondayStartWeekValid year w d = do     d' <- clipValid 1 7 d     let         -- first day of the year         firstDay = fromOrdinalDate year 1-         -- 0-based week of year         zbFirstMonday = (5 - toModifiedJulianDay firstDay) `mod` 7-         -- 0-based week number         zbWeek = w - 1-         -- 0-based day of week         zbDay = d' - 1-         -- 0-based day in year         zbYearDay = zbFirstMonday + 7 * toInteger zbWeek + toInteger zbDay--    zbYearDay' <- clipValid 0 (if isLeapYear year then 365 else 364) zbYearDay+    zbYearDay' <-+        clipValid+            0+            (if isLeapYear year+                 then 365+                 else 364)+            zbYearDay     return $ addDays zbYearDay' firstDay  -- | The inverse of 'sundayStartWeek'. Get a 'Day' given the year and -- the number of the day of a Sunday-starting week. -- The first Sunday is the first day of week 1, any earlier days in the -- year are week 0 (as @%U@ in 'Data.Time.Format.formatTime').-fromSundayStartWeek :: Integer -- ^ Year.-                    -> Int     -- ^ Sunday-starting week number (as @%U@ in 'Data.Time.Format.formatTime').-                    -> Int     -- ^ Day of week+fromSundayStartWeek ::+       Integer -- ^ Year.+    -> Int -- ^ Sunday-starting week number (as @%U@ in 'Data.Time.Format.formatTime').+    -> Int -- ^ Day of week                                -- Sunday is 0, Saturday is 6 (as @%w@ in 'Data.Time.Format.formatTime').-                    -> Day+    -> Day fromSundayStartWeek year w d = let     -- first day of the year     firstDay = fromOrdinalDate year 1-     -- 0-based year day of first monday of the year     zbFirstSunday = (4 - toModifiedJulianDay firstDay) `mod` 7-     -- 0-based week of year     zbWeek = w - 1-     -- 0-based day of week     zbDay = d-     -- 0-based day in year     zbYearDay = zbFirstSunday + 7 * toInteger zbWeek + toInteger zbDay-     in addDays zbYearDay firstDay -fromSundayStartWeekValid :: Integer -- ^ Year.-                    -> Int     -- ^ Sunday-starting week number (as @%U@ in 'Data.Time.Format.formatTime').-                    -> Int     -- ^ Day of week.+fromSundayStartWeekValid ::+       Integer -- ^ Year.+    -> Int -- ^ Sunday-starting week number (as @%U@ in 'Data.Time.Format.formatTime').+    -> Int -- ^ Day of week.                                -- Sunday is 0, Saturday is 6 (as @%w@ in 'Data.Time.Format.formatTime').-                    -> Maybe Day-fromSundayStartWeekValid year w d =  do+    -> Maybe Day+fromSundayStartWeekValid year w d = do     d' <- clipValid 0 6 d     let         -- first day of the year         firstDay = fromOrdinalDate year 1-         -- 0-based week of year         zbFirstSunday = (4 - toModifiedJulianDay firstDay) `mod` 7-         -- 0-based week number         zbWeek = w - 1-         -- 0-based day of week         zbDay = d'-         -- 0-based day in year         zbYearDay = zbFirstSunday + 7 * toInteger zbWeek + toInteger zbDay--    zbYearDay' <- clipValid 0 (if isLeapYear year then 365 else 364) zbYearDay+    zbYearDay' <-+        clipValid+            0+            (if isLeapYear year+                 then 365+                 else 364)+            zbYearDay     return $ addDays zbYearDay' firstDay
lib/Data/Time/Calendar/Private.hs view
@@ -2,28 +2,35 @@  import Data.Fixed -data PadOption = Pad Int Char | NoPad+data PadOption+    = Pad Int+          Char+    | NoPad  showPadded :: PadOption -> String -> String showPadded NoPad s = s showPadded (Pad i c) s = replicate (i - length s) c ++ s -class (Num t,Ord t,Show t) => ShowPadded t where+class (Num t, Ord t, Show t) => ShowPadded t where     showPaddedNum :: PadOption -> t -> String  instance ShowPadded Integer where     showPaddedNum NoPad i = show i-    showPaddedNum pad i | i < 0 = '-':(showPaddedNum pad (negate i))+    showPaddedNum pad i+        | i < 0 = '-' : (showPaddedNum pad (negate i))     showPaddedNum pad i = showPadded pad $ show i  instance ShowPadded Int where     showPaddedNum NoPad i = show i-    showPaddedNum _pad i | i == minBound = show i-    showPaddedNum pad i | i < 0 = '-':(showPaddedNum pad (negate i))+    showPaddedNum _pad i+        | i == minBound = show i+    showPaddedNum pad i+        | i < 0 = '-' : (showPaddedNum pad (negate i))     showPaddedNum pad i = showPadded pad $ show i  show2Fixed :: Pico -> String-show2Fixed x | x < 10 = '0':(showFixed True x)+show2Fixed x+    | x < 10 = '0' : (showFixed True x) show2Fixed x = showFixed True x  show2 :: (ShowPadded t) => t -> String@@ -42,23 +49,28 @@ div100 x = div x 100  clip :: (Ord t) => t -> t -> t -> t-clip a _ x | x < a = a-clip _ b x | x > b = b+clip a _ x+    | x < a = a+clip _ b x+    | x > b = b clip _ _ x = x  clipValid :: (Ord t) => t -> t -> t -> Maybe t-clipValid a _ x | x < a = Nothing-clipValid _ b x | x > b = Nothing+clipValid a _ x+    | x < a = Nothing+clipValid _ b x+    | x > b = Nothing clipValid _ _ x = Just x -quotBy :: (Real a,Integral b) => a -> a -> b+quotBy :: (Real a, Integral b) => a -> a -> b quotBy d n = truncate ((toRational n) / (toRational d))  remBy :: Real a => a -> a -> a-remBy d n = n - (fromInteger f) * d where+remBy d n = n - (fromInteger f) * d+  where     f = quotBy d n -quotRemBy :: (Real a,Integral b) => a -> a -> (b,a)+quotRemBy :: (Real a, Integral b) => a -> a -> (b, a) quotRemBy d n = let     f = quotBy d n-    in (f,n - (fromIntegral f) * d)+    in (f, n - (fromIntegral f) * d)
lib/Data/Time/Calendar/Week.hs view
@@ -5,6 +5,7 @@     , dayOfWeek     ) where +import Data.Data import Data.Time.Calendar.Days  data DayOfWeek@@ -15,7 +16,7 @@     | Friday     | Saturday     | Sunday-    deriving (Eq, Show, Read)+    deriving (Eq, Show, Read, Data, Typeable)  -- | \"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,35 +1,52 @@ -- | ISO 8601 Week Date format module Data.Time.Calendar.WeekDate where -import Data.Time.Calendar.OrdinalDate import Data.Time.Calendar.Days+import Data.Time.Calendar.OrdinalDate import Data.Time.Calendar.Private  -- | Convert to ISO 8601 Week Date format. First element of result is year, second week number (1-53), third day of week (1 for Monday to 7 for Sunday). -- Note that \"Week\" years are not quite the same as Gregorian years, as the first day of the year is always a Monday. -- The first week of a year is the first week to contain at least four days in the corresponding Gregorian year.-toWeekDate :: Day -> (Integer,Int,Int)-toWeekDate date@(ModifiedJulianDay mjd) = (y1,fromInteger (w1 + 1),fromInteger d_mod_7 + 1) where+toWeekDate :: Day -> (Integer, Int, Int)+toWeekDate date@(ModifiedJulianDay mjd) = (y1, fromInteger (w1 + 1), fromInteger d_mod_7 + 1)+  where     (d_div_7, d_mod_7) = d `divMod` 7-    (y0,yd) = toOrdinalDate date+    (y0, yd) = toOrdinalDate date     d = mjd + 2     foo :: Integer -> Integer     foo y = bar (toModifiedJulianDay (fromOrdinalDate y 6))     bar k = d_div_7 - k `div` 7-    (y1,w1) = case bar (d - toInteger yd + 4) of-                -1 -> (y0 - 1, foo (y0 - 1))-                52 -> if foo (y0 + 1) == 0-                      then (y0 + 1, 0)-                      else (y0, 52)-                w0  -> (y0, w0)+    (y1, w1) =+        case bar (d - toInteger yd + 4) of+            -1 -> (y0 - 1, foo (y0 - 1))+            52 ->+                if foo (y0 + 1) == 0+                    then (y0 + 1, 0)+                    else (y0, 52)+            w0 -> (y0, w0)  -- | Convert from ISO 8601 Week Date format. First argument is year, second week number (1-52 or 53), third day of week (1 for Monday to 7 for Sunday). -- Invalid week and day values will be clipped to the correct range. fromWeekDate :: Integer -> Int -> Int -> Day-fromWeekDate y w d = ModifiedJulianDay (k - (mod k 7) + (toInteger (((clip 1 (if longYear then 53 else 52) w) * 7) + (clip 1 7 d))) - 10) where-        k = toModifiedJulianDay (fromOrdinalDate y 6)-        longYear = case toWeekDate (fromOrdinalDate y 365) of-            (_,53,_) -> True+fromWeekDate y w d =+    ModifiedJulianDay+        (k - (mod k 7) ++         (toInteger+              (((clip+                     1+                     (if longYear+                          then 53+                          else 52)+                     w) *+                7) ++               (clip 1 7 d))) -+         10)+  where+    k = toModifiedJulianDay (fromOrdinalDate y 6)+    longYear =+        case toWeekDate (fromOrdinalDate y 365) of+            (_, 53, _) -> True             _ -> False  -- | Convert from ISO 8601 Week Date format. First argument is year, second week number (1-52 or 53), third day of week (1 for Monday to 7 for Sunday).@@ -38,15 +55,22 @@ fromWeekDateValid y w d = do     d' <- clipValid 1 7 d     let-        longYear = case toWeekDate (fromOrdinalDate y 365) of-            (_,53,_) -> True-            _ -> False-    w' <- clipValid 1 (if longYear then 53 else 52) w-    let-        k = toModifiedJulianDay (fromOrdinalDate y 6)+        longYear =+            case toWeekDate (fromOrdinalDate y 365) of+                (_, 53, _) -> True+                _ -> False+    w' <-+        clipValid+            1+            (if longYear+                 then 53+                 else 52)+            w+    let k = toModifiedJulianDay (fromOrdinalDate y 6)     return (ModifiedJulianDay (k - (mod k 7) + (toInteger ((w' * 7) + d')) - 10))  -- | Show in ISO 8601 Week Date format as yyyy-Www-d (e.g. \"2006-W46-3\"). showWeekDate :: Day -> String-showWeekDate date = (show4 y) ++ "-W" ++ (show2 w) ++ "-" ++ (show d) where-    (y,w,d) = toWeekDate date+showWeekDate date = (show4 y) ++ "-W" ++ (show2 w) ++ "-" ++ (show d)+  where+    (y, w, d) = toWeekDate date
lib/Data/Time/Clock.hs view
@@ -1,21 +1,20 @@ -- | Types and functions for UTC and UT1 module Data.Time.Clock-(-    module Data.Time.Clock.Internal.UniversalTime,-    module Data.Time.Clock.Internal.DiffTime,-    module Data.Time.Clock.Internal.UTCTime,-    module Data.Time.Clock.Internal.NominalDiffTime,-    module Data.Time.Clock.Internal.UTCDiff,-    getCurrentTime,-    getTime_resolution-) where+    ( module Data.Time.Clock.Internal.UniversalTime+    , module Data.Time.Clock.Internal.DiffTime+    , module Data.Time.Clock.Internal.UTCTime+    , module Data.Time.Clock.Internal.NominalDiffTime+    , module Data.Time.Clock.Internal.UTCDiff+    , getCurrentTime+    , getTime_resolution+    ) where -import Data.Time.Clock.Internal.UniversalTime import Data.Time.Clock.Internal.DiffTime+import Data.Time.Clock.Internal.NominalDiffTime import Data.Time.Clock.Internal.SystemTime import Data.Time.Clock.Internal.UTCDiff-import Data.Time.Clock.Internal.NominalDiffTime import Data.Time.Clock.Internal.UTCTime+import Data.Time.Clock.Internal.UniversalTime import Data.Time.Clock.POSIX-import Data.Time.Format.Parse()-import Data.Time.LocalTime()+import Data.Time.Format.Parse ()+import Data.Time.LocalTime ()
lib/Data/Time/Clock/Internal/AbsoluteTime.hs view
@@ -1,20 +1,23 @@ -- | TAI and leap-second maps for converting to UTC: most people won't need this module. module Data.Time.Clock.Internal.AbsoluteTime-(+    (     -- TAI arithmetic-    AbsoluteTime,taiEpoch,addAbsoluteTime,diffAbsoluteTime,-    taiNominalDayStart,-) where+      AbsoluteTime+    , taiEpoch+    , addAbsoluteTime+    , diffAbsoluteTime+    , taiNominalDayStart+    ) where -import Data.Typeable-import Data.Data import Control.DeepSeq+import Data.Data import Data.Time.Calendar.Days import Data.Time.Clock.Internal.DiffTime - -- | AbsoluteTime is TAI, time as measured by a clock.-newtype AbsoluteTime = MkAbsoluteTime DiffTime deriving (Eq,Ord,Data,Typeable)+newtype AbsoluteTime =+    MkAbsoluteTime DiffTime+    deriving (Eq, Ord, Data, Typeable)  instance NFData AbsoluteTime where     rnf (MkAbsoluteTime a) = rnf a
lib/Data/Time/Clock/Internal/CTimespec.hsc view
@@ -4,11 +4,7 @@  #if !defined(mingw32_HOST_OS) && HAVE_CLOCK_GETTIME -#if __GLASGOW_HASKELL__ >= 709 import Foreign-#else-import Foreign.Safe-#endif import Foreign.C import System.IO.Unsafe 
lib/Data/Time/Clock/Internal/CTimeval.hs view
@@ -1,22 +1,18 @@ module Data.Time.Clock.Internal.CTimeval where- #ifndef mingw32_HOST_OS -- All Unix-specific, this--#if __GLASGOW_HASKELL__ >= 709 import Foreign-#else-import Foreign.Safe-#endif import Foreign.C -data CTimeval = MkCTimeval CLong CLong+data CTimeval =+    MkCTimeval CLong+               CLong  instance Storable CTimeval where     sizeOf _ = (sizeOf (undefined :: CLong)) * 2     alignment _ = alignment (undefined :: CLong)     peek p = do-        s   <- peekElemOff (castPtr p) 0+        s <- peekElemOff (castPtr p) 0         mus <- peekElemOff (castPtr p) 1         return (MkCTimeval s mus)     poke p (MkCTimeval s mus) = do@@ -27,9 +23,10 @@  -- | Get the current POSIX time from the system clock. getCTimeval :: IO CTimeval-getCTimeval = with (MkCTimeval 0 0) (\ptval -> do-    throwErrnoIfMinus1_ "gettimeofday" $ gettimeofday ptval nullPtr-    peek ptval-    )-+getCTimeval =+    with+        (MkCTimeval 0 0)+        (\ptval -> do+             throwErrnoIfMinus1_ "gettimeofday" $ gettimeofday ptval nullPtr+             peek ptval) #endif
lib/Data/Time/Clock/Internal/DiffTime.hs view
@@ -1,29 +1,32 @@ {-# LANGUAGE Trustworthy #-} {-# OPTIONS -fno-warn-unused-imports #-}+ module Data.Time.Clock.Internal.DiffTime     (     -- * Absolute intervals-    DiffTime,-    secondsToDiffTime,-    picosecondsToDiffTime,-    diffTimeToPicoseconds,+      DiffTime+    , secondsToDiffTime+    , picosecondsToDiffTime+    , diffTimeToPicoseconds     ) where -import Data.Typeable+import Control.DeepSeq import Data.Data-import Data.Ratio ((%)) import Data.Fixed-import Control.DeepSeq-+import Data.Ratio ((%))+import Data.Typeable  -- | This is a length of time, as measured by a clock. -- Conversion functions will treat it as seconds. -- It has a precision of 10^-12 s.-newtype DiffTime = MkDiffTime Pico deriving (Eq,Ord,Data, Typeable)+newtype DiffTime =+    MkDiffTime Pico+    deriving (Eq, Ord, Data, Typeable)  -- necessary because H98 doesn't have "cunning newtype" derivation-instance NFData DiffTime where -- FIXME: Data.Fixed had no NFData instances yet at time of writing-        rnf dt = seq dt ()+instance NFData DiffTime -- FIXME: Data.Fixed had no NFData instances yet at time of writing+                                                                                             where+    rnf dt = seq dt ()  -- necessary because H98 doesn't have "cunning newtype" derivation instance Enum DiffTime where@@ -61,7 +64,9 @@  -- necessary because H98 doesn't have "cunning newtype" derivation instance RealFrac DiffTime where-    properFraction (MkDiffTime a) = let (b',a') = properFraction a in (b',MkDiffTime a')+    properFraction (MkDiffTime a) = let+        (b', a') = properFraction a+        in (b', MkDiffTime a')     truncate (MkDiffTime a) = truncate a     round (MkDiffTime a) = round a     ceiling (MkDiffTime a) = ceiling a@@ -80,6 +85,6 @@ diffTimeToPicoseconds (MkDiffTime (MkFixed x)) = x  {-# RULES-"realToFrac/DiffTime->Pico"              realToFrac = \ (MkDiffTime ps) -> ps-"realToFrac/Pico->DiffTime"              realToFrac = MkDiffTime-  #-}+"realToFrac/DiffTime->Pico" realToFrac = \ (MkDiffTime ps) -> ps+"realToFrac/Pico->DiffTime" realToFrac = MkDiffTime+ #-}
lib/Data/Time/Clock/Internal/NominalDiffTime.hs view
@@ -1,19 +1,18 @@ {-# OPTIONS -fno-warn-unused-imports #-} {-# LANGUAGE Trustworthy #-}+ module Data.Time.Clock.Internal.NominalDiffTime-    (-    NominalDiffTime,-    secondsToNominalDiffTime,-    nominalDiffTimeToSeconds,-    nominalDay,+    ( NominalDiffTime+    , secondsToNominalDiffTime+    , nominalDiffTimeToSeconds+    , nominalDay     ) where -import Data.Typeable+import Control.DeepSeq import Data.Data import Data.Fixed import Data.Time.Calendar.Days-import Control.DeepSeq-+import Data.Typeable  -- | This is a length of time, as measured by UTC. -- It has a precision of 10^-12 s.@@ -24,7 +23,9 @@ -- It ignores leap-seconds, so it's not necessarily a fixed amount of clock time. -- For instance, 23:00 UTC + 2 hours of NominalDiffTime = 01:00 UTC (+ 1 day), -- regardless of whether a leap-second intervened.-newtype NominalDiffTime = MkNominalDiffTime Pico deriving (Eq,Ord,Data,Typeable)+newtype NominalDiffTime =+    MkNominalDiffTime Pico+    deriving (Eq, Ord, Data, Typeable)  -- | Create a 'NominalDiffTime' from a number of seconds. --@@ -39,7 +40,8 @@ nominalDiffTimeToSeconds (MkNominalDiffTime t) = t  -- necessary because H98 doesn't have "cunning newtype" derivation-instance NFData NominalDiffTime where -- FIXME: Data.Fixed had no NFData instances yet at time of writing+instance NFData NominalDiffTime -- FIXME: Data.Fixed had no NFData instances yet at time of writing+                                                                                                    where     rnf ndt = seq ndt ()  instance Enum NominalDiffTime where@@ -50,7 +52,8 @@     enumFrom (MkNominalDiffTime a) = fmap MkNominalDiffTime (enumFrom a)     enumFromThen (MkNominalDiffTime a) (MkNominalDiffTime b) = fmap MkNominalDiffTime (enumFromThen a b)     enumFromTo (MkNominalDiffTime a) (MkNominalDiffTime b) = fmap MkNominalDiffTime (enumFromTo a b)-    enumFromThenTo (MkNominalDiffTime a) (MkNominalDiffTime b) (MkNominalDiffTime c) = fmap MkNominalDiffTime (enumFromThenTo a b c)+    enumFromThenTo (MkNominalDiffTime a) (MkNominalDiffTime b) (MkNominalDiffTime c) =+        fmap MkNominalDiffTime (enumFromThenTo a b c)  instance Show NominalDiffTime where     show (MkNominalDiffTime t) = (showFixed True t) ++ "s"@@ -77,20 +80,23 @@  -- necessary because H98 doesn't have "cunning newtype" derivation instance RealFrac NominalDiffTime where-    properFraction (MkNominalDiffTime a) = (i,MkNominalDiffTime f) where-        (i,f) = properFraction a+    properFraction (MkNominalDiffTime a) = (i, MkNominalDiffTime f)+      where+        (i, f) = properFraction a     truncate (MkNominalDiffTime a) = truncate a     round (MkNominalDiffTime a) = round a     ceiling (MkNominalDiffTime a) = ceiling a     floor (MkNominalDiffTime a) = floor a  {-# RULES-"realToFrac/DiffTime->NominalDiffTime"   realToFrac = \ dt -> MkNominalDiffTime (realToFrac dt)-"realToFrac/NominalDiffTime->DiffTime"   realToFrac = \ (MkNominalDiffTime ps) -> realToFrac ps--"realToFrac/NominalDiffTime->Pico"       realToFrac = \ (MkNominalDiffTime ps) -> ps-"realToFrac/Pico->NominalDiffTime"       realToFrac = MkNominalDiffTime-  #-}+"realToFrac/DiffTime->NominalDiffTime" realToFrac =+                                       \ dt -> MkNominalDiffTime (realToFrac dt)+"realToFrac/NominalDiffTime->DiffTime" realToFrac =+                                       \ (MkNominalDiffTime ps) -> realToFrac ps+"realToFrac/NominalDiffTime->Pico" realToFrac =+                                   \ (MkNominalDiffTime ps) -> ps+"realToFrac/Pico->NominalDiffTime" realToFrac = MkNominalDiffTime+ #-}  -- | One day in 'NominalDiffTime'. nominalDay :: NominalDiffTime
lib/Data/Time/Clock/Internal/POSIXTime.hs view
@@ -2,7 +2,6 @@  import Data.Time.Clock.Internal.NominalDiffTime - -- | 86400 nominal seconds in every day posixDayLength :: NominalDiffTime posixDayLength = nominalDay
lib/Data/Time/Clock/Internal/SystemTime.hs view
@@ -1,41 +1,38 @@-#if __GLASGOW_HASKELL__ >= 710 {-# OPTIONS -fno-warn-trustworthy-safe #-}-#endif {-# LANGUAGE Trustworthy #-}+ module Data.Time.Clock.Internal.SystemTime-    (-    SystemTime(..),-    getSystemTime,-    getTime_resolution,-    getTAISystemTime,+    ( SystemTime(..)+    , getSystemTime+    , getTime_resolution+    , getTAISystemTime     ) where -import Data.Int (Int64)-import Data.Word+import Data.Data import Control.DeepSeq+import Data.Int (Int64) import Data.Time.Clock.Internal.DiffTime-+import Data.Word #include "HsTimeConfig.h"  #ifdef mingw32_HOST_OS import qualified System.Win32.Time as Win32 #elif defined(HAVE_CLOCK_GETTIME) import Data.Time.Clock.Internal.CTimespec-import Foreign.C.Types (CTime(..), CLong(..))+import Foreign.C.Types (CLong(..), CTime(..)) #else import Data.Time.Clock.Internal.CTimeval import Foreign.C.Types (CLong(..)) #endif- --------------------------------------------------------------------------------  -- | 'SystemTime' is time returned by system clock functions. -- Its semantics depends on the clock function, but the epoch is typically the beginning of 1970. -- Note that 'systemNanoseconds' of 1E9 to 2E9-1 can be used to represent leap seconds. data SystemTime = MkSystemTime-    { systemSeconds ::     {-# UNPACK #-} !Int64-    , systemNanoseconds :: {-# UNPACK #-} !Word32-    } deriving (Eq,Ord,Show)+    { systemSeconds :: {-# UNPACK #-}!Int64+    , systemNanoseconds :: {-# UNPACK #-}!Word32+    } deriving (Eq, Ord, Show, Data, Typeable)  instance NFData SystemTime where     rnf a = a `seq` ()@@ -43,20 +40,16 @@ -- | Get the system time, epoch start of 1970 UTC, leap-seconds ignored. -- 'getSystemTime' is typically much faster than 'getCurrentTime'. getSystemTime :: IO SystemTime- -- | The resolution of 'getSystemTime', 'getCurrentTime', 'getPOSIXTime' getTime_resolution :: DiffTime- -- | If supported, get TAI time, epoch start of 1970 TAI, with resolution. -- This is supported only on UNIX systems, and only those with CLOCK_TAI available at run-time.-getTAISystemTime :: Maybe (DiffTime,IO SystemTime)-+getTAISystemTime :: Maybe (DiffTime, IO SystemTime) #ifdef mingw32_HOST_OS -- On Windows, the equlvalent of POSIX time is "file time", defined as -- the number of 100-nanosecond intervals that have elapsed since -- 12:00 A.M. January 1, 1601 (UTC).  We can convert this into a POSIX -- time by adjusting the offset to be relative to the POSIX epoch.- getSystemTime = do     Win32.FILETIME ft <- Win32.getSystemTimeAsFileTime     let (s, us) = (ft - win32_epoch_adjust) `divMod` 10000000@@ -64,12 +57,12 @@   where     win32_epoch_adjust :: Word64     win32_epoch_adjust = 116444736000000000+ getTime_resolution = 100E-9 -- 100ns-getTAISystemTime = Nothing +getTAISystemTime = Nothing #elif defined(HAVE_CLOCK_GETTIME) -- Use hi-res clock_gettime- timespecToSystemTime :: CTimespec -> SystemTime timespecToSystemTime (MkCTimespec (CTime s) (CLong ns)) = (MkSystemTime (fromIntegral s) (fromIntegral ns)) @@ -80,15 +73,18 @@ clockGetSystemTime clock = fmap timespecToSystemTime $ clockGetTime clock  getSystemTime = clockGetSystemTime clock_REALTIME+ getTime_resolution = timespecToDiffTime realtimeRes-getTAISystemTime = fmap (\resolution -> (timespecToDiffTime resolution,clockGetSystemTime clock_TAI)) $ clockResolution clock_TAI +getTAISystemTime =+    fmap (\resolution -> (timespecToDiffTime resolution, clockGetSystemTime clock_TAI)) $ clockResolution clock_TAI #else -- Use gettimeofday getSystemTime = do     MkCTimeval (CLong s) (CLong us) <- getCTimeval     return (MkSystemTime (fromIntegral s) (fromIntegral us * 1000))+ getTime_resolution = 1E-6 -- microsecond-getTAISystemTime = Nothing +getTAISystemTime = Nothing #endif
lib/Data/Time/Clock/Internal/UTCTime.hs view
@@ -1,5 +1,5 @@ module Data.Time.Clock.Internal.UTCTime-(+    (     -- * UTC     -- | UTC is time as measured by a clock, corrected to keep pace with the earth by adding or removing     -- occasional seconds, known as \"leap seconds\".@@ -9,25 +9,21 @@     --     -- If you don't care about leap seconds, use 'UTCTime' and 'NominalDiffTime' for your clock calculations,     -- and you'll be fine.-    UTCTime(..),-) where+      UTCTime(..)+    ) where -import Data.Typeable-import Data.Data import Control.DeepSeq+import Data.Data import Data.Time.Calendar.Days import Data.Time.Clock.Internal.DiffTime - -- | This is the simplest representation of UTC. -- It consists of the day number, and a time offset from midnight. -- Note that if a day has a leap second added to it, it will have 86401 seconds.-data UTCTime = UTCTime {-    -- | the day-    utctDay :: Day,-    -- | the time from midnight, 0 <= t < 86401s (because of leap-seconds)-    utctDayTime :: DiffTime-} deriving (Data, Typeable)+data UTCTime = UTCTime+    { utctDay :: Day -- ^ the day+    , utctDayTime :: DiffTime -- ^ the time from midnight, 0 <= t < 86401s (because of leap-seconds)+    } deriving (Data, Typeable)  instance NFData UTCTime where     rnf (UTCTime d t) = rnf d `seq` rnf t `seq` ()@@ -36,6 +32,7 @@     (UTCTime da ta) == (UTCTime db tb) = (da == db) && (ta == tb)  instance Ord UTCTime where-    compare (UTCTime da ta) (UTCTime db tb) = case (compare da db) of-        EQ -> compare ta tb-        cmp -> cmp+    compare (UTCTime da ta) (UTCTime db tb) =+        case (compare da db) of+            EQ -> compare ta tb+            cmp -> cmp
lib/Data/Time/Clock/Internal/UniversalTime.hs view
@@ -2,17 +2,17 @@     (     -- * Universal Time     -- | Time as measured by the Earth.-    UniversalTime(..),+      UniversalTime(..)     ) where -import Data.Typeable-import Data.Data import Control.DeepSeq-+import Data.Data  -- | 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)+newtype UniversalTime = ModJulianDate+    { getModJulianDate :: Rational+    } deriving (Eq, Ord, Data, Typeable)  -- necessary because H98 doesn't have "cunning newtype" derivation instance NFData UniversalTime where
lib/Data/Time/Clock/POSIX.hs view
@@ -16,25 +16,29 @@ -- >     u <- getCurrentTime -- >     print $ nanosSinceEpoch u module Data.Time.Clock.POSIX-(-    posixDayLength,POSIXTime,posixSecondsToUTCTime,utcTimeToPOSIXSeconds,getPOSIXTime,getCurrentTime,-    systemToPOSIXTime,-) where+    ( posixDayLength+    , POSIXTime+    , posixSecondsToUTCTime+    , utcTimeToPOSIXSeconds+    , getPOSIXTime+    , getCurrentTime+    , systemToPOSIXTime+    ) where +import Data.Fixed+import Data.Time.Calendar.Days import Data.Time.Clock.Internal.POSIXTime import Data.Time.Clock.Internal.UTCTime import Data.Time.Clock.System-import Data.Time.Calendar.Days-import Data.Fixed  posixSecondsToUTCTime :: POSIXTime -> UTCTime posixSecondsToUTCTime i = let-    (d,t) = divMod' i posixDayLength- in UTCTime (addDays d systemEpochDay) (realToFrac t)+    (d, t) = divMod' i posixDayLength+    in UTCTime (addDays d systemEpochDay) (realToFrac t)  utcTimeToPOSIXSeconds :: UTCTime -> POSIXTime utcTimeToPOSIXSeconds (UTCTime d t) =- (fromInteger (diffDays d systemEpochDay) * posixDayLength) + min posixDayLength (realToFrac t)+    (fromInteger (diffDays d systemEpochDay) * posixDayLength) + min posixDayLength (realToFrac t)  systemToPOSIXTime :: SystemTime -> POSIXTime systemToPOSIXTime (MkSystemTime s ns) = (fromIntegral s) + (fromIntegral ns) * 1E-9
lib/Data/Time/Clock/System.hs view
@@ -1,27 +1,26 @@ -- | Fast access to the system clock. module Data.Time.Clock.System-(-    systemEpochDay,-    SystemTime(..),-    truncateSystemTimeLeapSecond,-    getSystemTime,-    systemToUTCTime,-    utcToSystemTime,-    systemToTAITime,-) where+    ( systemEpochDay+    , SystemTime(..)+    , truncateSystemTimeLeapSecond+    , getSystemTime+    , systemToUTCTime+    , utcToSystemTime+    , systemToTAITime+    ) where +import Data.Int (Int64)+import Data.Time.Calendar.Days import Data.Time.Clock.Internal.AbsoluteTime import Data.Time.Clock.Internal.DiffTime import Data.Time.Clock.Internal.SystemTime import Data.Time.Clock.Internal.UTCTime-import Data.Time.Calendar.Days-import Data.Int (Int64) - -- | Map leap-second values to the start of the following second. -- The resulting 'systemNanoseconds' will always be in the range 0 to 1E9-1. truncateSystemTimeLeapSecond :: SystemTime -> SystemTime-truncateSystemTimeLeapSecond (MkSystemTime seconds nanoseconds) | nanoseconds >= 1000000000 = MkSystemTime (succ seconds) 0+truncateSystemTimeLeapSecond (MkSystemTime seconds nanoseconds)+    | nanoseconds >= 1000000000 = MkSystemTime (succ seconds) 0 truncateSystemTimeLeapSecond t = t  -- | Convert 'SystemTime' to 'UTCTime', matching zero 'SystemTime' to midnight of 'systemEpochDay' UTC.@@ -30,16 +29,12 @@     days :: Int64     timeSeconds :: Int64     (days, timeSeconds) = seconds `divMod` 86400-     day :: Day     day = addDays (fromIntegral days) systemEpochDay-     timeNanoseconds :: Int64     timeNanoseconds = timeSeconds * 1000000000 + (fromIntegral nanoseconds)-     timePicoseconds :: Int64     timePicoseconds = timeNanoseconds * 1000-     time :: DiffTime     time = picosecondsToDiffTime $ fromIntegral timePicoseconds     in UTCTime day time@@ -49,20 +44,18 @@ utcToSystemTime (UTCTime day time) = let     days :: Int64     days = fromIntegral $ diffDays day systemEpochDay-     timePicoseconds :: Int64     timePicoseconds = fromIntegral $ diffTimeToPicoseconds time-     timeNanoseconds :: Int64     timeNanoseconds = timePicoseconds `div` 1000-     timeSeconds :: Int64     nanoseconds :: Int64-    (timeSeconds,nanoseconds) = if timeNanoseconds >= 86400000000000 then (86399,timeNanoseconds - 86399000000000) else timeNanoseconds `divMod` 1000000000-+    (timeSeconds, nanoseconds) =+        if timeNanoseconds >= 86400000000000+            then (86399, timeNanoseconds - 86399000000000)+            else timeNanoseconds `divMod` 1000000000     seconds :: Int64     seconds = days * 86400 + timeSeconds-     in MkSystemTime seconds $ fromIntegral nanoseconds  systemEpochAbsolute :: AbsoluteTime
lib/Data/Time/Clock/TAI.hs view
@@ -1,27 +1,27 @@ {-# OPTIONS -fno-warn-orphans #-}+ -- | TAI and leap-second maps for converting to UTC: most people won't need this module. module Data.Time.Clock.TAI-(+    (     -- TAI arithmetic-    module Data.Time.Clock.Internal.AbsoluteTime,-+      module Data.Time.Clock.Internal.AbsoluteTime     -- leap-second map type-    LeapSecondMap,-+    , LeapSecondMap     -- conversion between UTC and TAI with map-    utcDayLength,utcToTAITime,taiToUTCTime,--    taiClock,-) where+    , utcDayLength+    , utcToTAITime+    , taiToUTCTime+    , taiClock+    ) where -import Data.Time.Clock.Internal.AbsoluteTime-import Data.Time.LocalTime+import Data.Fixed+import Data.Maybe import Data.Time.Calendar.Days+import Data.Time.Clock+import Data.Time.Clock.Internal.AbsoluteTime import Data.Time.Clock.Internal.SystemTime import Data.Time.Clock.System-import Data.Time.Clock-import Data.Maybe-import Data.Fixed+import Data.Time.LocalTime  instance Show AbsoluteTime where     show t = show (utcToLocalTime utc (fromJust (taiToUTCTime (const (Just 0)) t))) ++ " TAI" -- ugly, but standard apparently@@ -55,9 +55,11 @@         let             dtime = diffAbsoluteTime abstime dayt             day' = addDays (div' dtime len) day-        if day == day' then return (UTCTime day dtime) else stable day'+        if day == day'+            then return (UTCTime day dtime)+            else stable day'     in stable $ ModifiedJulianDay $ div' (diffAbsoluteTime abstime taiEpoch) 86400  -- | TAI clock, if it exists. Note that it is unlikely to be set correctly, without due care and attention.-taiClock :: Maybe (DiffTime,IO AbsoluteTime)+taiClock :: Maybe (DiffTime, IO AbsoluteTime) taiClock = fmap (fmap (fmap systemToTAITime)) getTAISystemTime
lib/Data/Time/Format.hs view
@@ -1,9 +1,11 @@ module Data.Time.Format     (     -- * UNIX-style formatting-    FormatTime(),formatTime,-    module Data.Time.Format.Parse+      FormatTime()+    , formatTime+    , module Data.Time.Format.Parse     ) where+ import Data.Time.Format.Format.Class-import Data.Time.Format.Format.Instances()+import Data.Time.Format.Format.Instances () import Data.Time.Format.Parse
lib/Data/Time/Format/Format/Class.hs view
@@ -1,59 +1,75 @@ module Data.Time.Format.Format.Class     (         -- * Formatting-        formatTime,-        FormatNumericPadding,-        FormatOptions(..),-        FormatTime(..),-        ShowPadded,PadOption,-        formatGeneral,formatString,formatNumber,formatNumberStd,-        showPaddedFixed,showPaddedFixedFraction,-        quotBy,remBy,-    )-    where+      formatTime+    , FormatNumericPadding+    , FormatOptions(..)+    , FormatTime(..)+    , ShowPadded+    , PadOption+    , formatGeneral+    , formatString+    , formatNumber+    , formatNumberStd+    , showPaddedFixed+    , showPaddedFixedFraction+    , quotBy+    , remBy+    ) where  import Data.Char-import Data.Maybe import Data.Fixed+import Data.Maybe import Data.Time.Calendar.Private import Data.Time.Format.Locale  type FormatNumericPadding = Maybe Char -data FormatOptions = MkFormatOptions {-    foLocale :: TimeLocale,-    foPadding :: Maybe FormatNumericPadding,-    foWidth :: Maybe Int-}+data FormatOptions = MkFormatOptions+    { foLocale :: TimeLocale+    , foPadding :: Maybe FormatNumericPadding+    , foWidth :: Maybe Int+    }  -- <http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html> class FormatTime t where     -- | @since 1.9.1     formatCharacter :: Bool -> Char -> Maybe (FormatOptions -> t -> String) - -- the weird UNIX logic is here getPadOption :: Bool -> Bool -> Int -> Char -> Maybe FormatNumericPadding -> Maybe Int -> PadOption getPadOption trunc fdef idef cdef mnpad mi = let-    c = case mnpad of-        Just (Just c') -> c'-        Just Nothing -> ' '-        _ -> cdef-    i = case mi of-        Just i' -> case mnpad of-            Just Nothing -> i'-            _ -> if trunc then i' else max i' idef-        Nothing -> idef-    f = case mi of-        Just _ -> True-        Nothing -> case mnpad of-            Nothing -> fdef-            Just Nothing -> False-            Just (Just _) -> True-    in if f then Pad i c else NoPad+    c =+        case mnpad of+            Just (Just c') -> c'+            Just Nothing -> ' '+            _ -> cdef+    i =+        case mi of+            Just i' ->+                case mnpad of+                    Just Nothing -> i'+                    _ ->+                        if trunc+                            then i'+                            else max i' idef+            Nothing -> idef+    f =+        case mi of+            Just _ -> True+            Nothing ->+                case mnpad of+                    Nothing -> fdef+                    Just Nothing -> False+                    Just (Just _) -> True+    in if f+           then Pad i c+           else NoPad -formatGeneral :: Bool -> Bool -> Int -> Char -> (TimeLocale -> PadOption -> t -> String) -> (FormatOptions -> t -> String)-formatGeneral trunc fdef idef cdef ff fo = ff (foLocale fo) $ getPadOption trunc fdef idef cdef (foPadding fo) (foWidth fo)+formatGeneral ::+       Bool -> Bool -> Int -> Char -> (TimeLocale -> PadOption -> t -> String) -> (FormatOptions -> t -> String)+formatGeneral trunc fdef idef cdef ff fo =+    ff (foLocale fo) $ getPadOption trunc fdef idef cdef (foPadding fo) (foWidth fo)  formatString :: (TimeLocale -> t -> String) -> (FormatOptions -> t -> String) formatString ff = formatGeneral False False 1 ' ' $ \locale pado -> showPadded pado . ff locale@@ -65,23 +81,27 @@ formatNumberStd n = formatNumber False n '0'  showPaddedFixed :: HasResolution a => PadOption -> PadOption -> Fixed a -> String-showPaddedFixed padn padf x | x < 0 = '-' : showPaddedFixed padn padf (negate x)+showPaddedFixed padn padf x+    | x < 0 = '-' : showPaddedFixed padn padf (negate x) showPaddedFixed padn padf x = let     ns = showPaddedNum padn $ (floor x :: Integer)     fs = showPaddedFixedFraction padf x-    ds = if null fs then "" else "."+    ds =+        if null fs+            then ""+            else "."     in ns ++ ds ++ fs  showPaddedFixedFraction :: HasResolution a => PadOption -> Fixed a -> String showPaddedFixedFraction pado x = let-    digits = dropWhile (=='.') $ dropWhile (/='.') $ showFixed True x+    digits = dropWhile (== '.') $ dropWhile (/= '.') $ showFixed True x     n = length digits     in case pado of-        NoPad -> digits-        Pad i c -> if i < n-            then take i digits-            else digits ++ replicate (i - n) c-+           NoPad -> digits+           Pad i c ->+               if i < n+                   then take i digits+                   else digits ++ replicate (i - n) c  -- | Substitute various time-related information for each %-code in the string, as per 'formatCharacter'. --@@ -304,10 +324,11 @@ -- [@%0ES@] seconds of minute as two digits, with decimal point and \<width\> (default 12) decimal places. formatTime :: (FormatTime t) => TimeLocale -> String -> t -> String formatTime _ [] _ = ""-formatTime locale ('%':cs) t = case formatTime1 locale cs t of-    Just result -> result-    Nothing -> '%':(formatTime locale cs t)-formatTime locale (c:cs) t = c:(formatTime locale cs t)+formatTime locale ('%':cs) t =+    case formatTime1 locale cs t of+        Just result -> result+        Nothing -> '%' : (formatTime locale cs t)+formatTime locale (c:cs) t = c : (formatTime locale cs t)  formatTime1 :: (FormatTime t) => TimeLocale -> String -> t -> Maybe String formatTime1 locale ('_':cs) t = formatTime2 locale id (Just (Just ' ')) cs t@@ -318,22 +339,34 @@ formatTime1 locale cs t = formatTime2 locale id Nothing cs t  getDigit :: Char -> Maybe Int-getDigit c | c < '0' = Nothing-getDigit c | c > '9' = Nothing+getDigit c+    | c < '0' = Nothing+getDigit c+    | c > '9' = Nothing getDigit c = Just $ (ord c) - (ord '0') -pullNumber :: Maybe Int -> String -> (Maybe Int,String)-pullNumber mx [] = (mx,[])-pullNumber mx s@(c:cs) = case getDigit c of-    Just i -> pullNumber (Just $ (fromMaybe 0 mx)*10+i) cs-    Nothing -> (mx,s)+pullNumber :: Maybe Int -> String -> (Maybe Int, String)+pullNumber mx [] = (mx, [])+pullNumber mx s@(c:cs) =+    case getDigit c of+        Just i -> pullNumber (Just $ (fromMaybe 0 mx) * 10 + i) cs+        Nothing -> (mx, s) -formatTime2 :: (FormatTime t) => TimeLocale -> (String -> String) -> Maybe FormatNumericPadding -> String -> t -> Maybe String+formatTime2 ::+       (FormatTime t) => TimeLocale -> (String -> String) -> Maybe FormatNumericPadding -> String -> t -> Maybe String formatTime2 locale recase mpad cs t = let-    (mwidth,rest) = pullNumber Nothing cs+    (mwidth, rest) = pullNumber Nothing cs     in formatTime3 locale recase mpad mwidth rest t -formatTime3 :: (FormatTime t) => TimeLocale -> (String -> String) -> Maybe FormatNumericPadding -> Maybe Int -> String -> t -> Maybe String+formatTime3 ::+       (FormatTime t)+    => TimeLocale+    -> (String -> String)+    -> Maybe FormatNumericPadding+    -> Maybe Int+    -> String+    -> t+    -> Maybe String formatTime3 locale recase mpad mwidth ('E':cs) = formatTime4 True recase (MkFormatOptions locale mpad mwidth) cs formatTime3 locale recase mpad mwidth cs = formatTime4 False recase (MkFormatOptions locale mpad mwidth) cs @@ -345,6 +378,7 @@ formatChar _ '%' = formatString $ \_ _ -> "%" formatChar _ 't' = formatString $ \_ _ -> "\t" formatChar _ 'n' = formatString $ \_ _ -> "\n"-formatChar alt c = case formatCharacter alt c of-    Just f -> f-    _ -> \_ _ -> ""+formatChar alt c =+    case formatCharacter alt c of+        Just f -> f+        _ -> \_ _ -> ""
lib/Data/Time/Format/Format/Instances.hs view
@@ -1,41 +1,47 @@ {-# OPTIONS -fno-warn-orphans #-}-module Data.Time.Format.Format.Instances () where +module Data.Time.Format.Format.Instances+    (+    ) where+ import Data.Char import Data.Fixed-import Data.Time.Clock.Internal.DiffTime-import Data.Time.Clock.Internal.NominalDiffTime-import Data.Time.Clock.Internal.UniversalTime-import Data.Time.Clock.Internal.UTCTime-import Data.Time.Clock.POSIX-import Data.Time.Calendar.Days import Data.Time.Calendar.CalendarDiffDays+import Data.Time.Calendar.Days import Data.Time.Calendar.Gregorian-import Data.Time.Calendar.Week-import Data.Time.Calendar.WeekDate import Data.Time.Calendar.OrdinalDate import Data.Time.Calendar.Private+import Data.Time.Calendar.Week+import Data.Time.Calendar.WeekDate+import Data.Time.Clock.Internal.DiffTime+import Data.Time.Clock.Internal.NominalDiffTime+import Data.Time.Clock.Internal.UTCTime+import Data.Time.Clock.Internal.UniversalTime+import Data.Time.Clock.POSIX+import Data.Time.Format.Format.Class+import Data.Time.Format.Locale import Data.Time.LocalTime.Internal.CalendarDiffTime-import Data.Time.LocalTime.Internal.TimeZone-import Data.Time.LocalTime.Internal.TimeOfDay import Data.Time.LocalTime.Internal.LocalTime+import Data.Time.LocalTime.Internal.TimeOfDay+import Data.Time.LocalTime.Internal.TimeZone import Data.Time.LocalTime.Internal.ZonedTime-import Data.Time.Format.Locale-import Data.Time.Format.Format.Class - instance FormatTime LocalTime where     formatCharacter _ 'c' = Just $ \fo -> formatTime (foLocale fo) $ dateTimeFmt $ foLocale fo-    formatCharacter alt c = case formatCharacter alt c of-        Just f -> Just $ \fo dt -> f fo (localDay dt)-        Nothing -> case formatCharacter alt c of-            Just f -> Just $ \fo dt -> f fo (localTimeOfDay dt)-            Nothing -> Nothing+    formatCharacter alt c =+        case formatCharacter alt c of+            Just f -> Just $ \fo dt -> f fo (localDay dt)+            Nothing ->+                case formatCharacter alt c of+                    Just f -> Just $ \fo dt -> f fo (localTimeOfDay dt)+                    Nothing -> Nothing  todAMPM :: TimeLocale -> TimeOfDay -> String todAMPM locale day = let-    (am,pm) = amPm locale-    in if (todHour day) < 12 then am else pm+    (am, pm) = amPm locale+    in if (todHour day) < 12+           then am+           else pm  tod12Hour :: TimeOfDay -> Int tod12Hour day = (mod (todHour day - 1) 12) + 1@@ -50,85 +56,93 @@     formatCharacter _ 'P' = Just $ formatString $ \locale -> map toLower . todAMPM locale     formatCharacter _ 'p' = Just $ formatString $ \locale -> todAMPM locale     -- Hour-    formatCharacter _ 'H' = Just $ formatNumber True  2 '0' todHour-    formatCharacter _ 'I' = Just $ formatNumber True  2 '0' tod12Hour-    formatCharacter _ 'k' = Just $ formatNumber True  2 ' ' todHour-    formatCharacter _ 'l' = Just $ formatNumber True  2 ' ' tod12Hour+    formatCharacter _ 'H' = Just $ formatNumber True 2 '0' todHour+    formatCharacter _ 'I' = Just $ formatNumber True 2 '0' tod12Hour+    formatCharacter _ 'k' = Just $ formatNumber True 2 ' ' todHour+    formatCharacter _ 'l' = Just $ formatNumber True 2 ' ' tod12Hour     -- Minute-    formatCharacter _ 'M' = Just $ formatNumber True  2 '0' todMin+    formatCharacter _ 'M' = Just $ formatNumber True 2 '0' todMin     -- Second-    formatCharacter _ 'S' = Just $ formatNumber True  2 '0' $ (floor . todSec :: TimeOfDay -> Int)+    formatCharacter _ 'S' = Just $ formatNumber True 2 '0' $ (floor . todSec :: TimeOfDay -> Int)     formatCharacter _ 'q' = Just $ formatGeneral True True 12 '0' $ \_ pado -> showPaddedFixedFraction pado . todSec-    formatCharacter _ 'Q' = Just $ formatGeneral True False 12 '0' $ \_ pado -> dotNonEmpty . showPaddedFixedFraction pado . todSec where+    formatCharacter _ 'Q' =+        Just $ formatGeneral True False 12 '0' $ \_ pado -> dotNonEmpty . showPaddedFixedFraction pado . todSec+      where         dotNonEmpty "" = ""-        dotNonEmpty s = '.':s-+        dotNonEmpty s = '.' : s     -- Default-    formatCharacter _ _   = Nothing+    formatCharacter _ _ = Nothing  instance FormatTime ZonedTime where     formatCharacter _ 'c' = Just $ formatString $ \locale -> formatTime locale (dateTimeFmt locale)-    formatCharacter _ 's' = Just $ formatNumber True  1 '0' $ (floor . utcTimeToPOSIXSeconds . zonedTimeToUTC :: ZonedTime -> Integer)-    formatCharacter alt c = case formatCharacter alt c of-        Just f -> Just $ \fo dt -> f fo (zonedTimeToLocalTime dt)-        Nothing -> case formatCharacter alt c of-            Just f -> Just $ \fo dt -> f fo (zonedTimeZone dt)-            Nothing -> Nothing+    formatCharacter _ 's' =+        Just $ formatNumber True 1 '0' $ (floor . utcTimeToPOSIXSeconds . zonedTimeToUTC :: ZonedTime -> Integer)+    formatCharacter alt c =+        case formatCharacter alt c of+            Just f -> Just $ \fo dt -> f fo (zonedTimeToLocalTime dt)+            Nothing ->+                case formatCharacter alt c of+                    Just f -> Just $ \fo dt -> f fo (zonedTimeZone dt)+                    Nothing -> Nothing  instance FormatTime TimeZone where     formatCharacter False 'z' = Just $ formatGeneral False True 4 '0' $ \_ -> timeZoneOffsetString'' False     formatCharacter True 'z' = Just $ formatGeneral False True 5 '0' $ \_ -> timeZoneOffsetString'' True-    formatCharacter alt 'Z' = Just $ \fo z -> let-        n = timeZoneName z-        idef = if alt then 5 else 4-        in if null n then formatGeneral False True idef '0' (\_ -> timeZoneOffsetString'' alt) fo z else formatString (\_ -> timeZoneName) fo z+    formatCharacter alt 'Z' =+        Just $ \fo z -> let+            n = timeZoneName z+            idef =+                if alt+                    then 5+                    else 4+            in if null n+                   then formatGeneral False True idef '0' (\_ -> timeZoneOffsetString'' alt) fo z+                   else formatString (\_ -> timeZoneName) fo z     formatCharacter _ _ = Nothing  instance FormatTime DayOfWeek where-    formatCharacter _ 'u' = Just $ formatNumber True  1 '0' $ fromEnum-    formatCharacter _ 'w' = Just $ formatNumber True  1 '0' $ \wd -> (mod (fromEnum wd) 7)+    formatCharacter _ 'u' = Just $ formatNumber True 1 '0' $ fromEnum+    formatCharacter _ 'w' = Just $ formatNumber True 1 '0' $ \wd -> (mod (fromEnum wd) 7)     formatCharacter _ 'a' = Just $ formatString $ \locale wd -> snd $ (wDays locale) !! (mod (fromEnum wd) 7)     formatCharacter _ 'A' = Just $ formatString $ \locale wd -> fst $ (wDays locale) !! (mod (fromEnum wd) 7)-    formatCharacter _ _   = Nothing+    formatCharacter _ _ = Nothing  instance FormatTime Day where     -- Aggregate     formatCharacter _ 'D' = Just $ formatString $ \locale -> formatTime locale "%m/%d/%y"     formatCharacter _ 'F' = Just $ formatString $ \locale -> formatTime locale "%Y-%m-%d"     formatCharacter _ 'x' = Just $ formatString $ \locale -> formatTime locale (dateFmt locale)-     -- Year Count-    formatCharacter _ 'Y' = Just $ formatNumber False 4 '0' $          fst . toOrdinalDate-    formatCharacter _ 'y' = Just $ formatNumber True  2 '0' $ mod100 . fst . toOrdinalDate+    formatCharacter _ 'Y' = Just $ formatNumber False 4 '0' $ fst . toOrdinalDate+    formatCharacter _ 'y' = Just $ formatNumber True 2 '0' $ mod100 . fst . toOrdinalDate     formatCharacter _ 'C' = Just $ formatNumber False 2 '0' $ div100 . fst . toOrdinalDate     -- Month of Year-    formatCharacter _ 'B' = Just $ formatString $ \locale -> fst . (\(_,m,_) -> (months locale) !! (m - 1)) . toGregorian-    formatCharacter _ 'b' = Just $ formatString $ \locale -> snd . (\(_,m,_) -> (months locale) !! (m - 1)) . toGregorian-    formatCharacter _ 'h' = Just $ formatString $ \locale -> snd . (\(_,m,_) -> (months locale) !! (m - 1)) . toGregorian-    formatCharacter _ 'm' = Just $ formatNumber True  2 '0' $ (\(_,m,_) -> m) . toGregorian+    formatCharacter _ 'B' =+        Just $ formatString $ \locale -> fst . (\(_, m, _) -> (months locale) !! (m - 1)) . toGregorian+    formatCharacter _ 'b' =+        Just $ formatString $ \locale -> snd . (\(_, m, _) -> (months locale) !! (m - 1)) . toGregorian+    formatCharacter _ 'h' =+        Just $ formatString $ \locale -> snd . (\(_, m, _) -> (months locale) !! (m - 1)) . toGregorian+    formatCharacter _ 'm' = Just $ formatNumber True 2 '0' $ (\(_, m, _) -> m) . toGregorian     -- Day of Month-    formatCharacter _ 'd' = Just $ formatNumber True  2 '0' $ (\(_,_,d) -> d) . toGregorian-    formatCharacter _ 'e' = Just $ formatNumber True  2 ' ' $ (\(_,_,d) -> d) . toGregorian+    formatCharacter _ 'd' = Just $ formatNumber True 2 '0' $ (\(_, _, d) -> d) . toGregorian+    formatCharacter _ 'e' = Just $ formatNumber True 2 ' ' $ (\(_, _, d) -> d) . toGregorian     -- Day of Year-    formatCharacter _ 'j' = Just $ formatNumber True  3 '0' $ snd . toOrdinalDate-+    formatCharacter _ 'j' = Just $ formatNumber True 3 '0' $ snd . toOrdinalDate     -- ISO 8601 Week Date-    formatCharacter _ 'G' = Just $ formatNumber False 4 '0' $ (\(y,_,_) -> y) . toWeekDate-    formatCharacter _ 'g' = Just $ formatNumber True  2 '0' $ mod100 . (\(y,_,_) -> y) . toWeekDate-    formatCharacter _ 'f' = Just $ formatNumber False 2 '0' $ div100 . (\(y,_,_) -> y) . toWeekDate--    formatCharacter _ 'V' = Just $ formatNumber True  2 '0' $ (\(_,w,_) -> w) . toWeekDate-    formatCharacter _ 'u' = Just $ formatNumber True  1 '0' $ (\(_,_,d) -> d) . toWeekDate-+    formatCharacter _ 'G' = Just $ formatNumber False 4 '0' $ (\(y, _, _) -> y) . toWeekDate+    formatCharacter _ 'g' = Just $ formatNumber True 2 '0' $ mod100 . (\(y, _, _) -> y) . toWeekDate+    formatCharacter _ 'f' = Just $ formatNumber False 2 '0' $ div100 . (\(y, _, _) -> y) . toWeekDate+    formatCharacter _ 'V' = Just $ formatNumber True 2 '0' $ (\(_, w, _) -> w) . toWeekDate+    formatCharacter _ 'u' = Just $ formatNumber True 1 '0' $ (\(_, _, d) -> d) . toWeekDate     -- Day of week     formatCharacter _ 'a' = Just $ formatString $ \locale -> snd . ((wDays locale) !!) . snd . sundayStartWeek     formatCharacter _ 'A' = Just $ formatString $ \locale -> fst . ((wDays locale) !!) . snd . sundayStartWeek-    formatCharacter _ 'U' = Just $ formatNumber True  2 '0' $ fst . sundayStartWeek-    formatCharacter _ 'w' = Just $ formatNumber True  1 '0' $ snd . sundayStartWeek-    formatCharacter _ 'W' = Just $ formatNumber True  2 '0' $ fst . mondayStartWeek-+    formatCharacter _ 'U' = Just $ formatNumber True 2 '0' $ fst . sundayStartWeek+    formatCharacter _ 'w' = Just $ formatNumber True 1 '0' $ snd . sundayStartWeek+    formatCharacter _ 'W' = Just $ formatNumber True 2 '0' $ fst . mondayStartWeek     -- Default-    formatCharacter _ _   = Nothing+    formatCharacter _ _ = Nothing  instance FormatTime UTCTime where     formatCharacter alt c = fmap (\f fo t -> f fo (utcToZonedTime utc t)) (formatCharacter alt c)@@ -145,14 +159,18 @@     formatCharacter _ 'm' = Just $ formatNumberStd 1 $ quotBy 60     formatCharacter _ 'M' = Just $ formatNumberStd 2 $ remBy 60 . quotBy 60     formatCharacter False 's' = Just $ formatNumberStd 1 $ quotBy 1-    formatCharacter True 's' = Just $ formatGeneral False False 12 '0' $ \_ padf t -> showPaddedFixed NoPad padf (realToFrac t :: Pico)+    formatCharacter True 's' =+        Just $ formatGeneral True False 12 '0' $ \_ padf t -> showPaddedFixed NoPad padf (realToFrac t :: Pico)     formatCharacter False 'S' = Just $ formatNumberStd 2 $ remBy 60 . quotBy 1-    formatCharacter True 'S' = Just $ formatGeneral False False 12 '0' $ \_ padf t -> let-        padn = case padf of-            NoPad -> NoPad-            Pad _ c -> Pad 2 c-        in showPaddedFixed padn padf (realToFrac $ remBy 60 t :: Pico)-    formatCharacter _ _   = Nothing+    formatCharacter True 'S' =+        Just $+        formatGeneral True False 12 '0' $ \_ padf t -> let+            padn =+                case padf of+                    NoPad -> NoPad+                    Pad _ c -> Pad 2 c+            in showPaddedFixed padn padf (realToFrac $ remBy 60 t :: Pico)+    formatCharacter _ _ = Nothing  instance FormatTime DiffTime where     formatCharacter _ 'w' = Just $ formatNumberStd 1 $ quotBy $ 7 * 86400@@ -163,14 +181,18 @@     formatCharacter _ 'm' = Just $ formatNumberStd 1 $ quotBy 60     formatCharacter _ 'M' = Just $ formatNumberStd 2 $ remBy 60 . quotBy 60     formatCharacter False 's' = Just $ formatNumberStd 1 $ quotBy 1-    formatCharacter True 's' = Just $ formatGeneral False False 12 '0' $ \_ padf t -> showPaddedFixed NoPad padf (realToFrac t :: Pico)+    formatCharacter True 's' =+        Just $ formatGeneral True False 12 '0' $ \_ padf t -> showPaddedFixed NoPad padf (realToFrac t :: Pico)     formatCharacter False 'S' = Just $ formatNumberStd 2 $ remBy 60 . quotBy 1-    formatCharacter True 'S' = Just $ formatGeneral False False 12 '0' $ \_ padf t -> let-        padn = case padf of-            NoPad -> NoPad-            Pad _ c -> Pad 2 c-        in showPaddedFixed padn padf (realToFrac $ remBy 60 t :: Pico)-    formatCharacter _ _   = Nothing+    formatCharacter True 'S' =+        Just $+        formatGeneral True False 12 '0' $ \_ padf t -> let+            padn =+                case padf of+                    NoPad -> NoPad+                    Pad _ c -> Pad 2 c+            in showPaddedFixed padn padf (realToFrac $ remBy 60 t :: Pico)+    formatCharacter _ _ = Nothing  instance FormatTime CalendarDiffDays where     formatCharacter _ 'y' = Just $ formatNumberStd 1 $ quotBy 12 . cdMonths@@ -179,7 +201,7 @@     formatCharacter _ 'w' = Just $ formatNumberStd 1 $ quotBy 7 . cdDays     formatCharacter _ 'd' = Just $ formatNumberStd 1 $ cdDays     formatCharacter _ 'D' = Just $ formatNumberStd 1 $ remBy 7 . cdDays-    formatCharacter _ _   = Nothing+    formatCharacter _ _ = Nothing  instance FormatTime CalendarDiffTime where     formatCharacter _ 'y' = Just $ formatNumberStd 1 $ quotBy 12 . ctMonths
lib/Data/Time/Format/ISO8601.hs view
@@ -1,104 +1,93 @@ module Data.Time.Format.ISO8601     (         -- * Format-        Format,-        formatShowM,-        formatShow,-        formatReadP,-        formatParseM,+      Format+    , formatShowM+    , formatShow+    , formatReadP+    , formatParseM         -- * Common formats-        ISO8601(..),-        iso8601Show,-        iso8601ParseM,+    , ISO8601(..)+    , iso8601Show+    , iso8601ParseM         -- * All formats-        FormatExtension(..),-        formatReadPExtension,-        parseFormatExtension,-        calendarFormat,-        yearMonthFormat,-        yearFormat,-        centuryFormat,-        expandedCalendarFormat,-        expandedYearMonthFormat,-        expandedYearFormat,-        expandedCenturyFormat,-        ordinalDateFormat,-        expandedOrdinalDateFormat,-        weekDateFormat,-        yearWeekFormat,-        expandedWeekDateFormat,-        expandedYearWeekFormat,-        timeOfDayFormat,-        hourMinuteFormat,-        hourFormat,-        withTimeDesignator,-        withUTCDesignator,-        timeOffsetFormat,-        timeOfDayAndOffsetFormat,-        localTimeFormat,-        zonedTimeFormat,-        utcTimeFormat,-        dayAndTimeFormat,-        timeAndOffsetFormat,-        durationDaysFormat,-        durationTimeFormat,-        alternativeDurationDaysFormat,-        alternativeDurationTimeFormat,-        intervalFormat,-        recurringIntervalFormat,+    , FormatExtension(..)+    , formatReadPExtension+    , parseFormatExtension+    , calendarFormat+    , yearMonthFormat+    , yearFormat+    , centuryFormat+    , expandedCalendarFormat+    , expandedYearMonthFormat+    , expandedYearFormat+    , expandedCenturyFormat+    , ordinalDateFormat+    , expandedOrdinalDateFormat+    , weekDateFormat+    , yearWeekFormat+    , expandedWeekDateFormat+    , expandedYearWeekFormat+    , timeOfDayFormat+    , hourMinuteFormat+    , hourFormat+    , withTimeDesignator+    , withUTCDesignator+    , timeOffsetFormat+    , timeOfDayAndOffsetFormat+    , localTimeFormat+    , zonedTimeFormat+    , utcTimeFormat+    , dayAndTimeFormat+    , timeAndOffsetFormat+    , durationDaysFormat+    , durationTimeFormat+    , alternativeDurationDaysFormat+    , alternativeDurationTimeFormat+    , intervalFormat+    , recurringIntervalFormat     ) where -#if MIN_VERSION_base(4,9,0) import Control.Monad.Fail-import Prelude hiding (fail)-#endif-#if MIN_VERSION_base(4,8,0)-#else-import Data.Monoid-#endif-import Data.Ratio import Data.Fixed-import Text.ParserCombinators.ReadP import Data.Format+import Data.Ratio import Data.Time import Data.Time.Calendar.OrdinalDate-import Data.Time.Calendar.WeekDate import Data.Time.Calendar.Private+import Data.Time.Calendar.WeekDate+import Prelude hiding (fail)+import Text.ParserCombinators.ReadP -data FormatExtension =+data FormatExtension+    =      -- | ISO 8601:2004(E) sec. 2.3.4. Use hyphens and colons.-    ExtendedFormat |+      ExtendedFormat     -- | ISO 8601:2004(E) sec. 2.3.3. Omit hyphens and colons. "The basic format should be avoided in plain text."-    BasicFormat+    | BasicFormat  -- | Read a value in either extended or basic format formatReadPExtension :: (FormatExtension -> Format t) -> ReadP t formatReadPExtension ff = formatReadP (ff ExtendedFormat) +++ formatReadP (ff BasicFormat)  -- | Parse a value in either extended or basic format-parseFormatExtension :: (-#if MIN_VERSION_base(4,9,0)-    MonadFail m-#else-    Monad m-#endif-    ) => (FormatExtension -> Format t) -> String -> m t+parseFormatExtension :: (MonadFail m) => (FormatExtension -> Format t) -> String -> m t parseFormatExtension ff = parseReader $ formatReadPExtension ff -sepFormat :: String -> Format a -> Format b -> Format (a,b)+sepFormat :: String -> Format a -> Format b -> Format (a, b) sepFormat sep fa fb = (fa <** literalFormat sep) <**> fb -dashFormat :: Format a -> Format b -> Format (a,b)+dashFormat :: Format a -> Format b -> Format (a, b) dashFormat = sepFormat "-" -colnFormat :: Format a -> Format b -> Format (a,b)+colnFormat :: Format a -> Format b -> Format (a, b) colnFormat = sepFormat ":" -extDashFormat :: FormatExtension -> Format a -> Format b -> Format (a,b)+extDashFormat :: FormatExtension -> Format a -> Format b -> Format (a, b) extDashFormat ExtendedFormat = dashFormat extDashFormat BasicFormat = (<**>) -extColonFormat :: FormatExtension -> Format a -> Format b -> Format (a,b)+extColonFormat :: FormatExtension -> Format a -> Format b -> Format (a, b) extColonFormat ExtendedFormat = colnFormat extColonFormat BasicFormat = (<**>) @@ -127,9 +116,12 @@ hourFormat' = integerFormat NoSign (Just 2)  data E14+ instance HasResolution E14 where     resolution _ = 100000000000000+ data E16+ instance HasResolution E16 where     resolution _ = 10000000000000000 @@ -145,25 +137,26 @@ secondFormat :: Format Pico secondFormat = decimalFormat NoSign (Just 2) -mapGregorian :: Format (Integer,(Int,Int)) -> Format Day-mapGregorian = mapMFormat (\(y,(m,d)) -> fromGregorianValid y m d) (\day -> (\(y,m,d) -> Just (y,(m,d))) $ toGregorian day)--mapOrdinalDate :: Format (Integer,Int) -> Format Day-mapOrdinalDate = mapMFormat (\(y,d) -> fromOrdinalDateValid y d) (Just . toOrdinalDate)+mapGregorian :: Format (Integer, (Int, Int)) -> Format Day+mapGregorian =+    mapMFormat (\(y, (m, d)) -> fromGregorianValid y m d) (\day -> (\(y, m, d) -> Just (y, (m, d))) $ toGregorian day) -mapWeekDate :: Format (Integer,(Int,Int)) -> Format Day-mapWeekDate = mapMFormat (\(y,(w,d)) -> fromWeekDateValid y w d) (\day -> (\(y,w,d) -> Just (y,(w,d))) $ toWeekDate day)+mapOrdinalDate :: Format (Integer, Int) -> Format Day+mapOrdinalDate = mapMFormat (\(y, d) -> fromOrdinalDateValid y d) (Just . toOrdinalDate) -mapTimeOfDay :: Format (Int,(Int,Pico)) -> Format TimeOfDay-mapTimeOfDay = mapMFormat (\(h,(m,s)) -> makeTimeOfDayValid h m s) (\(TimeOfDay h m s) -> Just (h,(m,s)))+mapWeekDate :: Format (Integer, (Int, Int)) -> Format Day+mapWeekDate =+    mapMFormat (\(y, (w, d)) -> fromWeekDateValid y w d) (\day -> (\(y, w, d) -> Just (y, (w, d))) $ toWeekDate day) +mapTimeOfDay :: Format (Int, (Int, Pico)) -> Format TimeOfDay+mapTimeOfDay = mapMFormat (\(h, (m, s)) -> makeTimeOfDayValid h m s) (\(TimeOfDay h m s) -> Just (h, (m, s)))  -- | ISO 8601:2004(E) sec. 4.1.2.2 calendarFormat :: FormatExtension -> Format Day calendarFormat fe = mapGregorian $ extDashFormat fe yearFormat $ extDashFormat fe monthFormat dayOfMonthFormat  -- | ISO 8601:2004(E) sec. 4.1.2.3(a)-yearMonthFormat :: Format (Integer,Int)+yearMonthFormat :: Format (Integer, Int) yearMonthFormat = yearFormat <**> literalFormat "-" **> monthFormat  -- | ISO 8601:2004(E) sec. 4.1.2.3(b)@@ -176,10 +169,11 @@  -- | ISO 8601:2004(E) sec. 4.1.2.4(a) expandedCalendarFormat :: Int -> FormatExtension -> Format Day-expandedCalendarFormat n fe = mapGregorian $ extDashFormat fe (expandedYearFormat n) $ extDashFormat fe monthFormat dayOfMonthFormat+expandedCalendarFormat n fe =+    mapGregorian $ extDashFormat fe (expandedYearFormat n) $ extDashFormat fe monthFormat dayOfMonthFormat  -- | ISO 8601:2004(E) sec. 4.1.2.4(b)-expandedYearMonthFormat :: Int -> Format (Integer,Int)+expandedYearMonthFormat :: Int -> Format (Integer, Int) expandedYearMonthFormat n = dashFormat (expandedYearFormat n) monthFormat  -- | ISO 8601:2004(E) sec. 4.1.2.4(c)@@ -203,15 +197,16 @@ weekDateFormat fe = mapWeekDate $ extDashFormat fe yearFormat $ extDashFormat fe weekOfYearFormat dayOfWeekFormat  -- | ISO 8601:2004(E) sec. 4.1.4.3-yearWeekFormat :: FormatExtension -> Format  (Integer,Int)+yearWeekFormat :: FormatExtension -> Format (Integer, Int) yearWeekFormat fe = extDashFormat fe yearFormat weekOfYearFormat  -- | ISO 8601:2004(E) sec. 4.1.4.2 expandedWeekDateFormat :: Int -> FormatExtension -> Format Day-expandedWeekDateFormat n fe = mapWeekDate $ extDashFormat fe (expandedYearFormat n) $ extDashFormat fe weekOfYearFormat dayOfWeekFormat+expandedWeekDateFormat n fe =+    mapWeekDate $ extDashFormat fe (expandedYearFormat n) $ extDashFormat fe weekOfYearFormat dayOfWeekFormat  -- | ISO 8601:2004(E) sec. 4.1.4.3-expandedYearWeekFormat :: Int -> FormatExtension -> Format (Integer,Int)+expandedYearWeekFormat :: Int -> FormatExtension -> Format (Integer, Int) expandedYearWeekFormat n fe = extDashFormat fe (expandedYearFormat n) weekOfYearFormat  -- | ISO 8601:2004(E) sec. 4.2.2.2, 4.2.2.4(a)@@ -225,9 +220,10 @@ -- | ISO 8601:2004(E) sec. 4.2.2.3(a), 4.2.2.4(b) hourMinuteFormat :: FormatExtension -> Format TimeOfDay hourMinuteFormat fe = let-    toTOD (h,m) = case timeToDaysAndTimeOfDay $ fromRationalRound $ toRational $ (fromIntegral h) * 3600 + m * 60 of-        (0,tod) -> Just tod-        _ -> Nothing+    toTOD (h, m) =+        case timeToDaysAndTimeOfDay $ fromRationalRound $ toRational $ (fromIntegral h) * 3600 + m * 60 of+            (0, tod) -> Just tod+            _ -> Nothing     fromTOD tod = let         mm = (realToFrac $ daysAndTimeOfDayToTime 0 tod) / 60         in Just $ quotRemBy 60 mm@@ -236,9 +232,10 @@ -- | ISO 8601:2004(E) sec. 4.2.2.3(b), 4.2.2.4(c) hourFormat :: Format TimeOfDay hourFormat = let-    toTOD h = case timeToDaysAndTimeOfDay $ fromRationalRound $ toRational $ h * 3600 of-        (0,tod) -> Just tod-        _ -> Nothing+    toTOD h =+        case timeToDaysAndTimeOfDay $ fromRationalRound $ toRational $ h * 3600 of+            (0, tod) -> Just tod+            _ -> Nothing     fromTOD tod = Just $ (realToFrac $ daysAndTimeOfDayToTime 0 tod) / 3600     in mapMFormat toTOD fromTOD $ hourDecimalFormat @@ -253,96 +250,108 @@ -- | ISO 8601:2004(E) sec. 4.2.5.1 timeOffsetFormat :: FormatExtension -> Format TimeZone timeOffsetFormat fe = let-    toTimeZone (sign,(h,m)) = minutesToTimeZone $ sign * (h * 60 + m)+    toTimeZone (sign, (h, m)) = minutesToTimeZone $ sign * (h * 60 + m)     fromTimeZone tz = let         mm = timeZoneMinutes tz         hm = quotRem (abs mm) 60-        in (signum mm,hm)+        in (signum mm, hm)     in isoMap toTimeZone fromTimeZone $-        mandatorySignFormat <**> extColonFormat fe (integerFormat NoSign (Just 2)) (integerFormat NoSign (Just 2))+       mandatorySignFormat <**> extColonFormat fe (integerFormat NoSign (Just 2)) (integerFormat NoSign (Just 2))  -- | ISO 8601:2004(E) sec. 4.2.5.2-timeOfDayAndOffsetFormat :: FormatExtension -> Format (TimeOfDay,TimeZone)+timeOfDayAndOffsetFormat :: FormatExtension -> Format (TimeOfDay, TimeZone) timeOfDayAndOffsetFormat fe = timeOfDayFormat fe <**> timeOffsetFormat fe  -- | ISO 8601:2004(E) sec. 4.3.2 localTimeFormat :: Format Day -> Format TimeOfDay -> Format LocalTime-localTimeFormat fday ftod = isoMap (\(day,tod) -> LocalTime day tod) (\(LocalTime day tod) -> (day,tod)) $ fday <**> withTimeDesignator ftod+localTimeFormat fday ftod =+    isoMap (\(day, tod) -> LocalTime day tod) (\(LocalTime day tod) -> (day, tod)) $ fday <**> withTimeDesignator ftod  -- | ISO 8601:2004(E) sec. 4.3.2 zonedTimeFormat :: Format Day -> Format TimeOfDay -> FormatExtension -> Format ZonedTime-zonedTimeFormat fday ftod fe = isoMap (\(lt,tz) -> ZonedTime lt tz) (\(ZonedTime lt tz) -> (lt,tz)) $ timeAndOffsetFormat (localTimeFormat fday ftod) fe+zonedTimeFormat fday ftod fe =+    isoMap (\(lt, tz) -> ZonedTime lt tz) (\(ZonedTime lt tz) -> (lt, tz)) $+    timeAndOffsetFormat (localTimeFormat fday ftod) fe  -- | ISO 8601:2004(E) sec. 4.3.2 utcTimeFormat :: Format Day -> Format TimeOfDay -> Format UTCTime-utcTimeFormat fday ftod = isoMap (localTimeToUTC utc) (utcToLocalTime utc) $ withUTCDesignator $ localTimeFormat fday ftod+utcTimeFormat fday ftod =+    isoMap (localTimeToUTC utc) (utcToLocalTime utc) $ withUTCDesignator $ localTimeFormat fday ftod  -- | ISO 8601:2004(E) sec. 4.3.3-dayAndTimeFormat :: Format Day -> Format time -> Format (Day,time)+dayAndTimeFormat :: Format Day -> Format time -> Format (Day, time) dayAndTimeFormat fday ft = fday <**> withTimeDesignator ft  -- | ISO 8601:2004(E) sec. 4.3.3-timeAndOffsetFormat :: Format t -> FormatExtension -> Format (t,TimeZone)+timeAndOffsetFormat :: Format t -> FormatExtension -> Format (t, TimeZone) timeAndOffsetFormat ft fe = ft <**> timeOffsetFormat fe -intDesignator :: (Eq t,Show t,Read t,Num t) => Char -> Format t+intDesignator :: (Eq t, Show t, Read t, Num t) => Char -> Format t intDesignator c = optionalFormat 0 $ integerFormat NoSign Nothing <** literalFormat [c] -decDesignator :: (Eq t,Show t,Read t,Num t) => Char -> Format t+decDesignator :: (Eq t, Show t, Read t, Num t) => Char -> Format t decDesignator c = optionalFormat 0 $ decimalFormat NoSign Nothing <** literalFormat [c]  daysDesigs :: Format CalendarDiffDays daysDesigs = let-    toCD (y,(m,(w,d))) = CalendarDiffDays (y * 12 + m) (w * 7 + d)-    fromCD (CalendarDiffDays mm d) = (quot mm 12,(rem mm 12,(0,d)))-    in isoMap toCD fromCD $-        intDesignator 'Y' <**> intDesignator 'M' <**> intDesignator 'W' <**> intDesignator 'D'+    toCD (y, (m, (w, d))) = CalendarDiffDays (y * 12 + m) (w * 7 + d)+    fromCD (CalendarDiffDays mm d) = (quot mm 12, (rem mm 12, (0, d)))+    in isoMap toCD fromCD $ intDesignator 'Y' <**> intDesignator 'M' <**> intDesignator 'W' <**> intDesignator 'D'  -- | ISO 8601:2004(E) sec. 4.4.3.2 durationDaysFormat :: Format CalendarDiffDays-durationDaysFormat = (**>) (literalFormat "P") $ specialCaseShowFormat (mempty,"0D") $ daysDesigs+durationDaysFormat = (**>) (literalFormat "P") $ specialCaseShowFormat (mempty, "0D") $ daysDesigs  -- | ISO 8601:2004(E) sec. 4.4.3.2 durationTimeFormat :: Format CalendarDiffTime durationTimeFormat = let-    toCT (cd,(h,(m,s))) = mappend (calendarTimeDays cd) (calendarTimeTime $ daysAndTimeOfDayToTime 0 $ TimeOfDay h m s)+    toCT (cd, (h, (m, s))) =+        mappend (calendarTimeDays cd) (calendarTimeTime $ daysAndTimeOfDayToTime 0 $ TimeOfDay h m s)     fromCT (CalendarDiffTime mm t) = let-        (d,TimeOfDay h m s) = timeToDaysAndTimeOfDay t-        in (CalendarDiffDays mm d,(h,(m,s)))-    in (**>) (literalFormat "P") $ specialCaseShowFormat (mempty,"0D") $ isoMap toCT fromCT $-        (<**>) daysDesigs $ optionalFormat (0,(0,0)) $ literalFormat "T" **> intDesignator 'H' <**> intDesignator 'M' <**> decDesignator 'S'+        (d, TimeOfDay h m s) = timeToDaysAndTimeOfDay t+        in (CalendarDiffDays mm d, (h, (m, s)))+    in (**>) (literalFormat "P") $+       specialCaseShowFormat (mempty, "0D") $+       isoMap toCT fromCT $+       (<**>) daysDesigs $+       optionalFormat (0, (0, 0)) $+       literalFormat "T" **> intDesignator 'H' <**> intDesignator 'M' <**> decDesignator 'S'  -- | ISO 8601:2004(E) sec. 4.4.3.3 alternativeDurationDaysFormat :: FormatExtension -> Format CalendarDiffDays alternativeDurationDaysFormat fe = let-    toCD (y,(m,d)) = CalendarDiffDays (y * 12 + m) d-    fromCD (CalendarDiffDays mm d) = (quot mm 12,(rem mm 12,d))-    in isoMap toCD fromCD $ (**>) (literalFormat "P") $-        extDashFormat fe (clipFormat (0,9999) $ integerFormat NegSign $ Just 4) $-        extDashFormat fe (clipFormat (0,12) $ integerFormat NegSign $ Just 2) $-        (clipFormat (0,30) $ integerFormat NegSign $ Just 2)+    toCD (y, (m, d)) = CalendarDiffDays (y * 12 + m) d+    fromCD (CalendarDiffDays mm d) = (quot mm 12, (rem mm 12, d))+    in isoMap toCD fromCD $+       (**>) (literalFormat "P") $+       extDashFormat fe (clipFormat (0, 9999) $ integerFormat NegSign $ Just 4) $+       extDashFormat fe (clipFormat (0, 12) $ integerFormat NegSign $ Just 2) $+       (clipFormat (0, 30) $ integerFormat NegSign $ Just 2)  -- | ISO 8601:2004(E) sec. 4.4.3.3 alternativeDurationTimeFormat :: FormatExtension -> Format CalendarDiffTime alternativeDurationTimeFormat fe = let-    toCT (cd,(h,(m,s))) = mappend (calendarTimeDays cd) (calendarTimeTime $ daysAndTimeOfDayToTime 0 $ TimeOfDay h m s)+    toCT (cd, (h, (m, s))) =+        mappend (calendarTimeDays cd) (calendarTimeTime $ daysAndTimeOfDayToTime 0 $ TimeOfDay h m s)     fromCT (CalendarDiffTime mm t) = let-        (d,TimeOfDay h m s) = timeToDaysAndTimeOfDay t-        in (CalendarDiffDays mm d,(h,(m,s)))+        (d, TimeOfDay h m s) = timeToDaysAndTimeOfDay t+        in (CalendarDiffDays mm d, (h, (m, s)))     in isoMap toCT fromCT $-        (<**>) (alternativeDurationDaysFormat fe) $-        withTimeDesignator $-        extColonFormat fe (clipFormat (0,24) $ integerFormat NegSign (Just 2)) $-        extColonFormat fe (clipFormat (0,60) $ integerFormat NegSign (Just 2)) $-        (clipFormat (0,60) $ decimalFormat NegSign (Just 2))+       (<**>) (alternativeDurationDaysFormat fe) $+       withTimeDesignator $+       extColonFormat fe (clipFormat (0, 24) $ integerFormat NegSign (Just 2)) $+       extColonFormat fe (clipFormat (0, 60) $ integerFormat NegSign (Just 2)) $+       (clipFormat (0, 60) $ decimalFormat NegSign (Just 2))  -- | ISO 8601:2004(E) sec. 4.4.4.1-intervalFormat :: Format a -> Format b -> Format (a,b)+intervalFormat :: Format a -> Format b -> Format (a, b) intervalFormat = sepFormat "/"  -- | ISO 8601:2004(E) sec. 4.5-recurringIntervalFormat :: Format a -> Format b -> Format (Int,a,b)-recurringIntervalFormat fa fb = isoMap (\(r,(a,b)) -> (r,a,b)) (\(r,a,b) -> (r,(a,b))) $ sepFormat "/" (literalFormat "R" **> integerFormat NoSign Nothing) $ intervalFormat fa fb+recurringIntervalFormat :: Format a -> Format b -> Format (Int, a, b)+recurringIntervalFormat fa fb =+    isoMap (\(r, (a, b)) -> (r, a, b)) (\(r, a, b) -> (r, (a, b))) $+    sepFormat "/" (literalFormat "R" **> integerFormat NoSign Nothing) $ intervalFormat fa fb  class ISO8601 t where     -- | The most commonly used ISO 8601 format for this type.@@ -353,36 +362,37 @@ iso8601Show = formatShow iso8601Format  -- | Parse the most commonly used ISO 8601 format.-iso8601ParseM :: (-#if MIN_VERSION_base(4,9,0)-    MonadFail m-#else-    Monad m-#endif-    ,ISO8601 t) => String -> m t+iso8601ParseM :: (MonadFail m, ISO8601 t) => String -> m t iso8601ParseM = formatParseM iso8601Format  -- | @yyyy-mm-dd@ (ISO 8601:2004(E) sec. 4.1.2.2 extended format) instance ISO8601 Day where     iso8601Format = calendarFormat ExtendedFormat+ -- | @hh:mm:ss[.sss]@ (ISO 8601:2004(E) sec. 4.2.2.2, 4.2.2.4(a) extended format) instance ISO8601 TimeOfDay where     iso8601Format = timeOfDayFormat ExtendedFormat+ -- | @±hh:mm@ (ISO 8601:2004(E) sec. 4.2.5.1 extended format) instance ISO8601 TimeZone where     iso8601Format = timeOffsetFormat ExtendedFormat+ -- | @yyyy-mm-ddThh:mm:ss[.sss]@ (ISO 8601:2004(E) sec. 4.3.2 extended format) instance ISO8601 LocalTime where     iso8601Format = localTimeFormat iso8601Format iso8601Format+ -- | @yyyy-mm-ddThh:mm:ss[.sss]±hh:mm@ (ISO 8601:2004(E) sec. 4.3.2 extended format) instance ISO8601 ZonedTime where     iso8601Format = zonedTimeFormat iso8601Format iso8601Format ExtendedFormat+ -- | @yyyy-mm-ddThh:mm:ss[.sss]Z@ (ISO 8601:2004(E) sec. 4.3.2 extended format) instance ISO8601 UTCTime where     iso8601Format = utcTimeFormat iso8601Format iso8601Format+ -- | @PyYmMdD@ (ISO 8601:2004(E) sec. 4.4.3.2) instance ISO8601 CalendarDiffDays where     iso8601Format = durationDaysFormat+ -- | @PyYmMdDThHmMs[.sss]S@ (ISO 8601:2004(E) sec. 4.4.3.2) instance ISO8601 CalendarDiffTime where     iso8601Format = durationTimeFormat
lib/Data/Time/Format/Internal.hs view
@@ -2,7 +2,10 @@ 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. -}-module Data.Time.Format.Internal (FormatTime(..),ParseTime(..)) where+module Data.Time.Format.Internal+    ( FormatTime(..)+    , ParseTime(..)+    ) where  import Data.Time.Format.Format.Class import Data.Time.Format.Parse.Class
lib/Data/Time/Format/Locale.hs view
@@ -1,32 +1,25 @@ -- 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(..)-+module Data.Time.Format.Locale+    ( TimeLocale(..)     , defaultTimeLocale-     , iso8601DateFormat     , rfc822DateFormat-    )-where+    ) where  import Data.Time.LocalTime.Internal.TimeZone --data TimeLocale = TimeLocale {-        -- |full and abbreviated week days, starting with Sunday-        wDays  :: [(String, String)],-        -- |full and abbreviated months-        months :: [(String, String)],-        -- |AM\/PM symbols-        amPm   :: (String, String),-        -- |formatting strings-        dateTimeFmt, dateFmt,-        timeFmt, time12Fmt :: String,-        -- |time zones known by name-        knownTimeZones :: [TimeZone]-        } deriving (Eq, Ord, Show)+data TimeLocale = TimeLocale+    { wDays :: [(String, String)]+        -- ^ full and abbreviated week days, starting with Sunday+    , months :: [(String, String)]+        -- ^ full and abbreviated months+    , amPm :: (String, String)+        -- ^ AM\/PM symbols+    , dateTimeFmt, dateFmt, timeFmt, time12Fmt :: String+        -- ^ formatting strings+    , knownTimeZones :: [TimeZone]+        -- ^ time zones known by name+    } deriving (Eq, Ord, Show)  -- | Locale representing American usage. --@@ -34,39 +27,54 @@ -- \"UT\", \"GMT\", \"EST\", \"EDT\", \"CST\", \"CDT\", \"MST\", \"MDT\", \"PST\", \"PDT\". -- Note that the parsing functions will regardless parse \"UTC\", single-letter military time-zones, and +HHMM format. defaultTimeLocale :: TimeLocale-defaultTimeLocale =  TimeLocale {-        wDays  = [("Sunday",   "Sun"),  ("Monday",    "Mon"),-                  ("Tuesday",  "Tue"),  ("Wednesday", "Wed"),-                  ("Thursday", "Thu"),  ("Friday",    "Fri"),-                  ("Saturday", "Sat")],--        months = [("January",   "Jan"), ("February",  "Feb"),-                  ("March",     "Mar"), ("April",     "Apr"),-                  ("May",       "May"), ("June",      "Jun"),-                  ("July",      "Jul"), ("August",    "Aug"),-                  ("September", "Sep"), ("October",   "Oct"),-                  ("November",  "Nov"), ("December",  "Dec")],--        amPm = ("AM", "PM"),-        dateTimeFmt = "%a %b %e %H:%M:%S %Z %Y",-        dateFmt = "%m/%d/%y",-        timeFmt = "%H:%M:%S",-        time12Fmt = "%I:%M:%S %p",-        knownTimeZones =-            [-            TimeZone 0 False "UT",-            TimeZone 0 False "GMT",-            TimeZone (-5 * 60) False "EST",-            TimeZone (-4 * 60) True "EDT",-            TimeZone (-6 * 60) False "CST",-            TimeZone (-5 * 60) True "CDT",-            TimeZone (-7 * 60) False "MST",-            TimeZone (-6 * 60) True "MDT",-            TimeZone (-8 * 60) False "PST",-            TimeZone (-7 * 60) True "PDT"-            ]+defaultTimeLocale =+    TimeLocale+        { wDays =+              [ ("Sunday", "Sun")+              , ("Monday", "Mon")+              , ("Tuesday", "Tue")+              , ("Wednesday", "Wed")+              , ("Thursday", "Thu")+              , ("Friday", "Fri")+              , ("Saturday", "Sat")+              ]+        , months =+              [ ("January", "Jan")+              , ("February", "Feb")+              , ("March", "Mar")+              , ("April", "Apr")+              , ("May", "May")+              , ("June", "Jun")+              , ("July", "Jul")+              , ("August", "Aug")+              , ("September", "Sep")+              , ("October", "Oct")+              , ("November", "Nov")+              , ("December", "Dec")+              ]+        , amPm = ("AM", "PM")+        , dateTimeFmt = "%a %b %e %H:%M:%S %Z %Y"+        , dateFmt = "%m/%d/%y"+        , timeFmt = "%H:%M:%S"+        , time12Fmt = "%I:%M:%S %p"+        , knownTimeZones =+              [ TimeZone 0 False "UT"+              , TimeZone 0 False "GMT"+              , TimeZone (-5 * 60) False "EST"+              , TimeZone (-4 * 60) True "EDT"+              , TimeZone (-6 * 60) False "CST"+              , TimeZone (-5 * 60) True "CDT"+              , TimeZone (-7 * 60) False "MST"+              , TimeZone (-6 * 60) True "MDT"+              , TimeZone (-8 * 60) False "PST"+              , TimeZone (-7 * 60) True "PDT"+              ]         } +{-# DEPRECATED+iso8601DateFormat "use \"Data.Time.Format.ISO8601\" functions instead"+ #-}+ {- | Construct format string according to <http://en.wikipedia.org/wiki/ISO_8601 ISO-8601>.  The @Maybe String@ argument allows to supply an optional time specification. E.g.:@@ -76,12 +84,12 @@ 'iso8601DateFormat' (Just "%H:%M:%S")  == "%Y-%m-%dT%H:%M:%S"  -- i.e. @/YYYY-MM-DD/T/HH:MM:SS/@ @ -}- iso8601DateFormat :: Maybe String -> String iso8601DateFormat mTimeFmt =-    "%Y-%m-%d" ++ case mTimeFmt of-             Nothing  -> ""-             Just fmt -> 'T' : fmt+    "%Y-%m-%d" +++    case mTimeFmt of+        Nothing -> ""+        Just fmt -> 'T' : fmt  -- | Format string according to <http://tools.ietf.org/html/rfc822#section-5 RFC822>. rfc822DateFormat :: String
lib/Data/Time/Format/Parse.hs view
@@ -1,40 +1,41 @@ {-# OPTIONS -fno-warn-orphans #-}+ module Data.Time.Format.Parse     (     -- * UNIX-style parsing-    parseTimeM, parseTimeOrError, readSTime, readPTime,-    parseTime, readTime, readsTime,-    ParseTime(),+      parseTimeM+    , parseTimeOrError+    , readSTime+    , readPTime+    , ParseTime()     -- * Locale-    module Data.Time.Format.Locale+    , module Data.Time.Format.Locale     ) where -import Data.Proxy-#if MIN_VERSION_base(4,9,0) import Control.Monad.Fail-import Prelude hiding (fail)-#endif import Data.Char-import Data.Time.Format.Locale-import Text.ParserCombinators.ReadP hiding (char, string)-import Data.Time.Clock.Internal.UniversalTime-import Data.Time.Clock.Internal.UTCTime+import Data.Proxy import Data.Time.Calendar.Days-import Data.Time.LocalTime.Internal.TimeZone-import Data.Time.LocalTime.Internal.TimeOfDay+import Data.Time.Clock.Internal.UTCTime+import Data.Time.Clock.Internal.UniversalTime+import Data.Time.Format.Locale+import Data.Time.Format.Parse.Class+import Data.Time.Format.Parse.Instances () import Data.Time.LocalTime.Internal.LocalTime+import Data.Time.LocalTime.Internal.TimeOfDay+import Data.Time.LocalTime.Internal.TimeZone import Data.Time.LocalTime.Internal.ZonedTime-import Data.Time.Format.Parse.Class-import Data.Time.Format.Parse.Instances()+import Prelude hiding (fail)+import Text.ParserCombinators.ReadP hiding (char, string)  -- | Parses a time value given a format string. -- Supports the same %-codes as 'formatTime', including @%-@, @%_@ and @%0@ modifiers, however padding widths are not supported. -- Case is not significant in the input string. -- Some variations in the input are accepted: ----- [@%z@] accepts any of @±HHMM@ or @±HH:MM@.+-- [@%z@ @%Ez@] accepts any of @±HHMM@ or @±HH:MM@. ----- [@%Z@] accepts any string of letters, or any of the formats accepted by @%z@.+-- [@%Z@ @%EZ@] accepts any string of letters, or any of the formats accepted by @%z@. -- -- [@%0Y@] accepts exactly four digits. --@@ -51,64 +52,65 @@ -- > Prelude Data.Time> parseTimeM True defaultTimeLocale "%Y-%-m-%-d" "2010-3-04" :: Maybe Day -- > Just 2010-03-04 ---parseTimeM :: (-#if MIN_VERSION_base(4,9,0)-    MonadFail m-#else-    Monad m-#endif-    ,ParseTime t) =>-             Bool       -- ^ Accept leading and trailing whitespace?-          -> TimeLocale -- ^ Time locale.-          -> String     -- ^ Format string.-          -> String     -- ^ Input string.-          -> m t    -- ^ Return the time value, or fail if the input could+parseTimeM ::+       (MonadFail m, ParseTime t)+    => Bool -- ^ Accept leading and trailing whitespace?+    -> TimeLocale -- ^ Time locale.+    -> String -- ^ Format string.+    -> String -- ^ Input string.+    -> m t -- ^ Return the time value, or fail if the input could                         -- not be parsed using the given format.-parseTimeM acceptWS l fmt s = case parseTimeList acceptWS l fmt s of-    [t] -> return t-    []  -> fail $ "parseTimeM: no parse of " ++ show s-    _   -> fail $ "parseTimeM: multiple parses of " ++ show s+parseTimeM acceptWS l fmt s =+    case parseTimeList acceptWS l fmt s of+        [t] -> return t+        [] -> fail $ "parseTimeM: no parse of " ++ show s+        _ -> fail $ "parseTimeM: multiple parses of " ++ show s  -- | Parse a time value given a format string. Fails if the input could -- not be parsed using the given format. See 'parseTimeM' for details.-parseTimeOrError :: ParseTime t =>-             Bool       -- ^ Accept leading and trailing whitespace?-          -> TimeLocale -- ^ Time locale.-          -> String     -- ^ Format string.-          -> String     -- ^ Input string.-          -> t          -- ^ The time value.-parseTimeOrError acceptWS l fmt s = case parseTimeList acceptWS l fmt s of-    [t] -> t-    []  -> error $ "parseTimeOrError: no parse of " ++ show s-    _   -> error $ "parseTimeOrError: multiple parses of " ++ show s+parseTimeOrError ::+       ParseTime t+    => Bool -- ^ Accept leading and trailing whitespace?+    -> TimeLocale -- ^ Time locale.+    -> String -- ^ Format string.+    -> String -- ^ Input string.+    -> t -- ^ The time value.+parseTimeOrError acceptWS l fmt s =+    case parseTimeList acceptWS l fmt s of+        [t] -> t+        [] -> error $ "parseTimeOrError: no parse of " ++ show s+        _ -> error $ "parseTimeOrError: multiple parses of " ++ show s -parseTimeList :: ParseTime t =>-             Bool       -- ^ Accept leading and trailing whitespace?-          -> TimeLocale -- ^ Time locale.-          -> String     -- ^ Format string-          -> String     -- ^ Input string.-          -> [t]-parseTimeList False l fmt s = [t | (t,"") <- readSTime False l fmt s]-parseTimeList True l fmt s = [t | (t,r) <- readSTime True l fmt s, all isSpace r]+parseTimeList ::+       ParseTime t+    => Bool -- ^ Accept leading and trailing whitespace?+    -> TimeLocale -- ^ Time locale.+    -> String -- ^ Format string+    -> String -- ^ Input string.+    -> [t]+parseTimeList False l fmt s = [t | (t, "") <- readSTime False l fmt s]+parseTimeList True l fmt s = [t | (t, r) <- readSTime True l fmt s, all isSpace r]  -- | Parse a time value given a format string.  See 'parseTimeM' for details.-readSTime :: ParseTime t =>-             Bool       -- ^ Accept leading whitespace?-          -> TimeLocale -- ^ Time locale.-          -> String     -- ^ Format string-          -> ReadS t+readSTime ::+       ParseTime t+    => Bool -- ^ Accept leading whitespace?+    -> TimeLocale -- ^ Time locale.+    -> String -- ^ Format string+    -> ReadS t readSTime acceptWS l f = readP_to_S (readPTime acceptWS l f)  -- | Parse a time value given a format string.  See 'parseTimeM' for details.-readPTime :: ParseTime t =>-             Bool       -- ^ Accept leading whitespace?-          -> TimeLocale -- ^ Time locale.-          -> String     -- ^ Format string-          -> ReadP t+readPTime ::+       ParseTime t+    => Bool -- ^ Accept leading whitespace?+    -> TimeLocale -- ^ Time locale.+    -> String -- ^ Format string+    -> ReadP t readPTime False l f = readPOnlyTime l f readPTime True l f = (skipSpaces >> readPOnlyTime l f) <++ readPOnlyTime l f -readPOnlyTime' :: ParseTime t => proxy t -> TimeLocale -> String -> ReadP t+readPOnlyTime' :: ParseTime t => Proxy t -> TimeLocale -> String -> ReadP t readPOnlyTime' pt l f = do     pairs <- parseSpecifiers pt l f     case buildTime l pairs of@@ -116,38 +118,14 @@         Nothing -> pfail  -- | Parse a time value given a format string (without allowing leading whitespace).  See 'parseTimeM' for details.-readPOnlyTime :: ParseTime t =>-             TimeLocale -- ^ Time locale.-          -> String     -- ^ Format string-          -> ReadP t+readPOnlyTime ::+       ParseTime t+    => TimeLocale -- ^ Time locale.+    -> String -- ^ Format string+    -> ReadP t readPOnlyTime = readPOnlyTime' Proxy -{-# DEPRECATED parseTime "use \"parseTimeM True\" instead" #-}-parseTime :: ParseTime t =>-             TimeLocale -- ^ Time locale.-          -> String     -- ^ Format string.-          -> String     -- ^ Input string.-          -> Maybe t    -- ^ The time value, or 'Nothing' if the input could-                        -- not be parsed using the given format.-parseTime = parseTimeM True--{-# DEPRECATED readTime "use \"parseTimeOrError True\" instead" #-}-readTime :: ParseTime t =>-            TimeLocale -- ^ Time locale.-         -> String     -- ^ Format string.-         -> String     -- ^ Input string.-         -> t          -- ^ The time value.-readTime = parseTimeOrError True--{-# DEPRECATED readsTime "use \"readSTime True\" instead" #-}-readsTime :: ParseTime t =>-             TimeLocale -- ^ Time locale.-          -> String     -- ^ Format string-          -> ReadS t-readsTime = readSTime True- -- * Read instances for time package types- instance Read Day where     readsPrec _ = readParen False $ readSTime True defaultTimeLocale "%Y-%m-%d" @@ -167,11 +145,10 @@ -- single-letter military time-zones, -- and these time-zones: \"UTC\", \"UT\", \"GMT\", \"EST\", \"EDT\", \"CST\", \"CDT\", \"MST\", \"MDT\", \"PST\", \"PDT\". instance Read ZonedTime where-    readsPrec n = readParen False $ \s ->-        [(ZonedTime t z, r2) | (t,r1) <- readsPrec n s, (z,r2) <- readsPrec n r1]+    readsPrec n = readParen False $ \s -> [(ZonedTime t z, r2) | (t, r1) <- readsPrec n s, (z, r2) <- readsPrec n r1]  instance Read UTCTime where-    readsPrec n s = [ (zonedTimeToUTC t, r) | (t,r) <- readsPrec n s ]+    readsPrec n s = [(zonedTimeToUTC t, r) | (t, r) <- readsPrec n s]  instance Read UniversalTime where-    readsPrec n s = [ (localTimeToUT1 0 t, r) | (t,r) <- readsPrec n s ]+    readsPrec n s = [(localTimeToUT1 0 t, r) | (t, r) <- readsPrec n s]
lib/Data/Time/Format/Parse/Class.hs view
@@ -1,33 +1,35 @@ module Data.Time.Format.Parse.Class     (         -- * Parsing-        ParseNumericPadding(..),-        ParseTime(..),-        parseSpecifiers,-        timeSubstituteTimeSpecifier,-        timeParseTimeSpecifier,-        durationParseTimeSpecifier,-    )-    where+      ParseNumericPadding(..)+    , ParseTime(..)+    , parseSpecifiers+    , timeSubstituteTimeSpecifier+    , timeParseTimeSpecifier+    , durationParseTimeSpecifier+    ) where -import Control.Applicative hiding (optional,many) import Data.Char import Data.Maybe+import Data.Proxy import Data.Time.Format.Locale import Text.ParserCombinators.ReadP -data ParseNumericPadding = NoPadding | SpacePadding | ZeroPadding+data ParseNumericPadding+    = NoPadding+    | SpacePadding+    | ZeroPadding  -- | The class of types which can be parsed given a UNIX-style time format -- string. class ParseTime t where     -- | @since 1.9.1-    substituteTimeSpecifier :: proxy t -> TimeLocale -> Char -> Maybe String+    substituteTimeSpecifier :: Proxy t -> TimeLocale -> Char -> Maybe String     substituteTimeSpecifier _ _ _ = Nothing     -- | Get the string corresponding to the given format specifier.     --     -- @since 1.9.1-    parseTimeSpecifier :: proxy t -> TimeLocale -> Maybe ParseNumericPadding -> Char -> ReadP String+    parseTimeSpecifier :: Proxy t -> TimeLocale -> Maybe ParseNumericPadding -> Char -> ReadP String     -- | Builds a time value from a parsed input string.     -- If the input does not include all the information needed to     -- construct a complete value, any missing parts should be taken@@ -35,10 +37,11 @@     -- In the absence of @%C@ or @%Y@, century is 1969 - 2068.     --     -- @since 1.9.1-    buildTime :: TimeLocale -- ^ The time locale.-              -> [(Char,String)] -- ^ Pairs of format characters and the+    buildTime ::+           TimeLocale -- ^ The time locale.+        -> [(Char, String)] -- ^ Pairs of format characters and the                                  -- corresponding part of the input.-              -> Maybe t+        -> Maybe t  -- | Case-insensitive version of 'Text.ParserCombinators.ReadP.char'. charCI :: Char -> ReadP Char@@ -49,59 +52,73 @@ stringCI this = do     let         scan [] _ = return this-        scan (x:xs) (y:ys) | toUpper x == toUpper y = do-            _ <- get-            scan xs ys+        scan (x:xs) (y:ys)+            | toUpper x == toUpper y = do+                _ <- get+                scan xs ys         scan _ _ = pfail     s <- look     scan this s -parseSpecifiers :: ParseTime t => proxy t -> TimeLocale -> String -> ReadP [(Char,String)]+parseSpecifiers :: ParseTime t => Proxy t -> TimeLocale -> String -> ReadP [(Char, String)] parseSpecifiers pt locale = let-    parse :: String -> ReadP [(Char,String)]+    parse :: String -> ReadP [(Char, String)]     parse [] = return []     parse ('%':cs) = parse1 cs-    parse (c:cs) | isSpace c = do-        _ <- satisfy isSpace-        case cs of-            (c':_) | isSpace c' -> return ()-            _ -> skipSpaces-        parse cs+    parse (c:cs)+        | isSpace c = do+            _ <- satisfy isSpace+            case cs of+                (c':_)+                    | isSpace c' -> return ()+                _ -> skipSpaces+            parse cs     parse (c:cs) = do         _ <- charCI c         parse cs--    parse1 :: String -> ReadP [(Char,String)]+    parse1 :: String -> ReadP [(Char, String)]     parse1 ('-':cs) = parse2 (Just NoPadding) cs     parse1 ('_':cs) = parse2 (Just SpacePadding) cs     parse1 ('0':cs) = parse2 (Just ZeroPadding) cs     parse1 cs = parse2 Nothing cs--    parse2 :: Maybe ParseNumericPadding -> String -> ReadP [(Char,String)]+    parse2 :: Maybe ParseNumericPadding -> String -> ReadP [(Char, String)]     parse2 mpad ('E':cs) = parse3 mpad True cs     parse2 mpad cs = parse3 mpad False cs--    parse3 :: Maybe ParseNumericPadding -> Bool -> String -> ReadP [(Char,String)]+    parse3 :: Maybe ParseNumericPadding -> Bool -> String -> ReadP [(Char, String)]     parse3 _ _ ('%':cs) = do         _ <- char '%'         parse cs-    parse3 _ _ (c:cs) | Just s <- substituteTimeSpecifier pt locale c = parse $ s ++ cs+    parse3 _ _ (c:cs)+        | Just s <- substituteTimeSpecifier pt locale c = parse $ s ++ cs     parse3 mpad _alt (c:cs) = do         str <- parseTimeSpecifier pt locale mpad c         specs <- parse cs-        return $ (c,str) : specs+        return $ (c, str) : specs     parse3 _ _ [] = return []     in parse -parsePaddedDigits :: ParseNumericPadding -> Int -> ReadP String-parsePaddedDigits ZeroPadding n = count n (satisfy isDigit)-parsePaddedDigits SpacePadding _n = skipSpaces >> many1 (satisfy isDigit)-parsePaddedDigits NoPadding _n = many1 (satisfy isDigit)+data PaddingSide+    = PrePadding+    | PostPadding +allowEmptyParser :: Bool -> ReadP String+allowEmptyParser False = many1 (satisfy isDigit)+allowEmptyParser True = many (satisfy isDigit)++parsePaddedDigits :: PaddingSide -> ParseNumericPadding -> Bool -> Int -> ReadP String+parsePaddedDigits _ ZeroPadding _ n = count n (satisfy isDigit)+parsePaddedDigits PrePadding SpacePadding allowEmpty _n = skipSpaces >> allowEmptyParser allowEmpty+parsePaddedDigits PostPadding SpacePadding allowEmpty _n = do+    r <- allowEmptyParser allowEmpty+    skipSpaces+    return r+parsePaddedDigits _ NoPadding False _n = many1 (satisfy isDigit)+parsePaddedDigits _ NoPadding True _n = many (satisfy isDigit)+ parsePaddedSignedDigits :: ParseNumericPadding -> Int -> ReadP String parsePaddedSignedDigits pad n = do     sign <- option "" $ char '-' >> return "-"-    digits <- parsePaddedDigits pad n+    digits <- parsePaddedDigits PrePadding pad False n     return $ sign ++ digits  parseSignedDecimal :: ReadP String@@ -109,90 +126,82 @@     sign <- option "" $ char '-' >> return "-"     skipSpaces     digits <- many1 $ satisfy isDigit-    decimaldigits <- option "" $ do-        _ <- char '.'-        dd <- many $ satisfy isDigit-        return $ '.':dd+    decimaldigits <-+        option "" $ do+            _ <- char '.'+            dd <- many $ satisfy isDigit+            return $ '.' : dd     return $ sign ++ digits ++ decimaldigits  timeParseTimeSpecifier :: TimeLocale -> Maybe ParseNumericPadding -> Char -> ReadP String timeParseTimeSpecifier l mpad c = let-    digits pad = parsePaddedDigits (fromMaybe pad mpad)+    digits' ps pad = parsePaddedDigits ps (fromMaybe pad mpad)+    digits pad = digits' PrePadding pad False     oneOf = choice . map stringCI     numericTZ = do         s <- choice [char '+', char '-']-        h <- parsePaddedDigits ZeroPadding 2+        h <- parsePaddedDigits PrePadding ZeroPadding False 2         optional (char ':')-        m <- parsePaddedDigits ZeroPadding 2-        return (s:h++m)+        m <- parsePaddedDigits PrePadding ZeroPadding False 2+        return (s : h ++ m)     in case c of         -- century-        'C' -> digits SpacePadding 2-        'f' -> digits SpacePadding 2-+           'C' -> (char '-' >> fmap ('-' :) (digits SpacePadding 2)) <++ digits SpacePadding 2+           'f' -> digits SpacePadding 2         -- year-        'Y' -> digits SpacePadding 4-        'G' -> digits SpacePadding 4-+           'Y' -> (char '-' >> fmap ('-' :) (digits SpacePadding 4)) <++ digits SpacePadding 4+           'G' -> digits SpacePadding 4         -- year of century-        'y' -> digits ZeroPadding 2-        'g' -> digits ZeroPadding 2-+           'y' -> digits ZeroPadding 2+           'g' -> digits ZeroPadding 2         -- month of year-        'B' -> oneOf (map fst (months l))-        'b' -> oneOf (map snd (months l))-        'm' -> digits ZeroPadding 2-+           'B' -> oneOf (map fst (months l))+           'b' -> oneOf (map snd (months l))+           'm' -> digits ZeroPadding 2         -- day of month-        'd' -> digits ZeroPadding 2-        'e' -> digits SpacePadding 2-+           'd' -> digits ZeroPadding 2+           'e' -> digits SpacePadding 2         -- week of year-        'V' -> digits ZeroPadding 2-        'U' -> digits ZeroPadding 2-        'W' -> digits ZeroPadding 2-+           'V' -> digits ZeroPadding 2+           'U' -> digits ZeroPadding 2+           'W' -> digits ZeroPadding 2         -- day of week-        'u' -> oneOf $ map (:[]) ['1'..'7']-        'a' -> oneOf (map snd (wDays l))-        'A' -> oneOf (map fst (wDays l))-        'w' -> oneOf $ map (:[]) ['0'..'6']-+           'u' -> oneOf $ map (: []) ['1' .. '7']+           'a' -> oneOf (map snd (wDays l))+           'A' -> oneOf (map fst (wDays l))+           'w' -> oneOf $ map (: []) ['0' .. '6']         -- day of year-        'j' -> digits ZeroPadding 3-+           'j' -> digits ZeroPadding 3         -- dayhalf of day (i.e. AM or PM)-        'P' -> oneOf (let (am,pm) = amPm l in [am, pm])-        'p' -> oneOf (let (am,pm) = amPm l in [am, pm])-+           'P' ->+               oneOf+                   (let+                        (am, pm) = amPm l+                        in [am, pm])+           'p' ->+               oneOf+                   (let+                        (am, pm) = amPm l+                        in [am, pm])         -- hour of day (i.e. 24h)-        'H' -> digits ZeroPadding 2-        'k' -> digits SpacePadding 2-+           'H' -> digits ZeroPadding 2+           'k' -> digits SpacePadding 2         -- hour of dayhalf (i.e. 12h)-        'I' -> digits ZeroPadding 2-        'l' -> digits SpacePadding 2-+           'I' -> digits ZeroPadding 2+           'l' -> digits SpacePadding 2         -- minute of hour-        'M' -> digits ZeroPadding 2-+           'M' -> digits ZeroPadding 2         -- second of minute-        'S' -> digits ZeroPadding 2-+           'S' -> digits ZeroPadding 2         -- picosecond of second-        'q' -> digits ZeroPadding 12-        'Q' -> liftA2 (:) (char '.') (munch isDigit) <++ return ""-+           'q' -> digits' PostPadding ZeroPadding True 12+           'Q' -> (char '.' >> digits' PostPadding NoPadding True 12) <++ return ""         -- time zone-        'z' -> numericTZ-        'Z' -> munch1 isAlpha <++-             numericTZ-+           'z' -> numericTZ+           'Z' -> munch1 isAlpha <++ numericTZ         -- seconds since epoch-        's' -> (char '-' >> fmap ('-':) (munch1 isDigit))-             <++ munch1 isDigit--        _   -> fail $ "Unknown format character: " ++ show c+           's' -> (char '-' >> fmap ('-' :) (munch1 isDigit)) <++ munch1 isDigit+           _ -> fail $ "Unknown format character: " ++ show c  timeSubstituteTimeSpecifier :: TimeLocale -> Char -> Maybe String timeSubstituteTimeSpecifier l 'c' = Just $ dateTimeFmt l@@ -204,22 +213,22 @@ timeSubstituteTimeSpecifier _ 'F' = Just "%Y-%m-%d" timeSubstituteTimeSpecifier l 'x' = Just $ dateFmt l timeSubstituteTimeSpecifier _ 'h' = Just "%b"-timeSubstituteTimeSpecifier _  _ = Nothing+timeSubstituteTimeSpecifier _ _ = Nothing  durationParseTimeSpecifier :: TimeLocale -> Maybe ParseNumericPadding -> Char -> ReadP String durationParseTimeSpecifier _ mpad c = let     padopt = parsePaddedSignedDigits $ fromMaybe NoPadding mpad     in case c of-        'y' -> padopt 1-        'b' -> padopt 1-        'B' -> padopt 2-        'w' -> padopt 1-        'd' -> padopt 1-        'D' -> padopt 1-        'h' -> padopt 1-        'H' -> padopt 2-        'm' -> padopt 1-        'M' -> padopt 2-        's' -> parseSignedDecimal-        'S' -> parseSignedDecimal-        _   -> fail $ "Unknown format character: " ++ show c+           'y' -> padopt 1+           'b' -> padopt 1+           'B' -> padopt 2+           'w' -> padopt 1+           'd' -> padopt 1+           'D' -> padopt 1+           'h' -> padopt 1+           'H' -> padopt 2+           'm' -> padopt 1+           'M' -> padopt 2+           's' -> parseSignedDecimal+           'S' -> parseSignedDecimal+           _ -> fail $ "Unknown format character: " ++ show c
lib/Data/Time/Format/Parse/Instances.hs view
@@ -1,162 +1,184 @@ {-# OPTIONS -fno-warn-orphans #-}-module Data.Time.Format.Parse.Instances() where -#if !MIN_VERSION_base(4,8,0)-import Control.Applicative ((<$>),(<*>))+module Data.Time.Format.Parse.Instances+    (+    ) where++#if MIN_VERSION_base(4,13,0)+import Control.Applicative ((<|>))+#else+import Control.Applicative ((<$>), (<*>), (<|>)) #endif import Data.Char import Data.Fixed import Data.List import Data.Ratio-import Data.Traversable-import Text.Read(readMaybe)-import Data.Time.Clock.Internal.DiffTime-import Data.Time.Clock.Internal.NominalDiffTime-import Data.Time.Clock.Internal.UniversalTime-import Data.Time.Clock.POSIX-import Data.Time.Clock.Internal.UTCTime+import Data.Time.Calendar.CalendarDiffDays import Data.Time.Calendar.Days import Data.Time.Calendar.Gregorian-import Data.Time.Calendar.CalendarDiffDays import Data.Time.Calendar.OrdinalDate+import Data.Time.Calendar.Private (clipValid) import Data.Time.Calendar.WeekDate-import Data.Time.Calendar.Private(clipValid)+import Data.Time.Clock.Internal.DiffTime+import Data.Time.Clock.Internal.NominalDiffTime+import Data.Time.Clock.Internal.UTCTime+import Data.Time.Clock.Internal.UniversalTime+import Data.Time.Clock.POSIX+import Data.Time.Format.Locale+import Data.Time.Format.Parse.Class import Data.Time.LocalTime.Internal.CalendarDiffTime-import Data.Time.LocalTime.Internal.TimeZone-import Data.Time.LocalTime.Internal.TimeOfDay import Data.Time.LocalTime.Internal.LocalTime+import Data.Time.LocalTime.Internal.TimeOfDay+import Data.Time.LocalTime.Internal.TimeZone import Data.Time.LocalTime.Internal.ZonedTime-import Data.Time.Format.Locale-import Data.Time.Format.Parse.Class+import Data.Traversable+import Text.Read (readMaybe) -data DayComponent = Century Integer -- century of all years-                  | CenturyYear Integer -- 0-99, last two digits of both real years and week years-                  | YearMonth Int -- 1-12-                  | MonthDay Int -- 1-31-                  | YearDay Int -- 1-366-                  | WeekDay Int -- 1-7 (mon-sun)-                  | YearWeek WeekType Int -- 1-53 or 0-53+data DayComponent+    = Century Integer -- century of all years+    | CenturyYear Integer -- 0-99, last two digits of both real years and week years+    | YearMonth Int -- 1-12+    | MonthDay Int -- 1-31+    | YearDay Int -- 1-366+    | WeekDay Int -- 1-7 (mon-sun)+    | YearWeek WeekType+               Int -- 1-53 or 0-53 -data WeekType = ISOWeek | SundayWeek | MondayWeek+data WeekType+    = ISOWeek+    | SundayWeek+    | MondayWeek  instance ParseTime Day where     substituteTimeSpecifier _ = timeSubstituteTimeSpecifier     parseTimeSpecifier _ = timeParseTimeSpecifier     buildTime l = let-         -- 'Nothing' indicates a parse failure,         -- while 'Just []' means no information         f :: Char -> String -> Maybe [DayComponent]         f c x = let             ra :: (Read a) => Maybe a             ra = readMaybe x-             zeroBasedListIndex :: [String] -> Maybe Int             zeroBasedListIndex ss = elemIndex (map toUpper x) $ fmap (map toUpper) ss-             oneBasedListIndex :: [String] -> Maybe Int             oneBasedListIndex ss = do                 index <- zeroBasedListIndex ss                 return $ 1 + index-             in case c of             -- %C: century (all but the last two digits of the year), 00 - 99-            'C' -> do-                a <- ra-                return [Century a]+                   'C' -> do+                       a <- ra+                       return [Century a]             -- %f century (all but the last two digits of the year), 00 - 99-            'f' -> do-                a <- ra-                return [Century a]+                   'f' -> do+                       a <- ra+                       return [Century a]             -- %Y: year-            'Y' -> do-                a <- ra-                return [Century (a `div` 100), CenturyYear (a `mod` 100)]+                   'Y' -> do+                       a <- ra+                       return [Century (a `div` 100), CenturyYear (a `mod` 100)]             -- %G: year for Week Date format-            'G' -> do-                a <- ra-                return [Century (a `div` 100), CenturyYear (a `mod` 100)]+                   'G' -> do+                       a <- ra+                       return [Century (a `div` 100), CenturyYear (a `mod` 100)]             -- %y: last two digits of year, 00 - 99-            'y' -> do-                a <- ra-                return [CenturyYear a]+                   'y' -> do+                       a <- ra+                       return [CenturyYear a]             -- %g: last two digits of year for Week Date format, 00 - 99-            'g' -> do-                a <- ra-                return [CenturyYear a]+                   'g' -> do+                       a <- ra+                       return [CenturyYear a]             -- %B: month name, long form (fst from months locale), January - December-            'B' -> do-                a <- oneBasedListIndex $ fmap fst $ months l-                return [YearMonth a]+                   'B' -> do+                       a <- oneBasedListIndex $ fmap fst $ months l+                       return [YearMonth a]             -- %b: month name, short form (snd from months locale), Jan - Dec-            'b' -> do-                a <- oneBasedListIndex $ fmap snd $ months l-                return [YearMonth a]+                   'b' -> do+                       a <- oneBasedListIndex $ fmap snd $ months l+                       return [YearMonth a]             -- %m: month of year, leading 0 as needed, 01 - 12-            'm' -> do-                raw <- ra-                a <- clipValid 1 12 raw-                return [YearMonth a]+                   'm' -> do+                       raw <- ra+                       a <- clipValid 1 12 raw+                       return [YearMonth a]             -- %d: day of month, leading 0 as needed, 01 - 31-            'd' -> do-                raw <- ra-                a <- clipValid 1 31 raw-                return [MonthDay a]+                   'd' -> do+                       raw <- ra+                       a <- clipValid 1 31 raw+                       return [MonthDay a]             -- %e: day of month, leading space as needed, 1 - 31-            'e' -> do-                raw <- ra-                a <- clipValid 1 31 raw-                return [MonthDay a]+                   'e' -> do+                       raw <- ra+                       a <- clipValid 1 31 raw+                       return [MonthDay a]             -- %V: week for Week Date format, 01 - 53-            'V' -> do-                raw <- ra-                a <- clipValid 1 53 raw-                return [YearWeek ISOWeek a]+                   'V' -> do+                       raw <- ra+                       a <- clipValid 1 53 raw+                       return [YearWeek ISOWeek a]             -- %U: week number of year, where weeks start on Sunday (as sundayStartWeek), 00 - 53-            'U' -> do-                raw <- ra-                a <- clipValid 0 53 raw-                return [YearWeek SundayWeek a]+                   'U' -> do+                       raw <- ra+                       a <- clipValid 0 53 raw+                       return [YearWeek SundayWeek a]             -- %W: week number of year, where weeks start on Monday (as mondayStartWeek), 00 - 53-            'W' -> do-                raw <- ra-                a <- clipValid 0 53 raw-                return [YearWeek MondayWeek a]+                   'W' -> do+                       raw <- ra+                       a <- clipValid 0 53 raw+                       return [YearWeek MondayWeek a]             -- %u: day for Week Date format, 1 - 7-            'u' -> do-                raw <- ra-                a <- clipValid 1 7 raw-                return [WeekDay a]+                   'u' -> do+                       raw <- ra+                       a <- clipValid 1 7 raw+                       return [WeekDay a]             -- %a: day of week, short form (snd from wDays locale), Sun - Sat-            'a' -> do-                a' <- zeroBasedListIndex $ fmap snd $ wDays l-                let a = if a' == 0 then 7 else a'-                return [WeekDay a]+                   'a' -> do+                       a' <- zeroBasedListIndex $ fmap snd $ wDays l+                       let+                           a =+                               if a' == 0+                                   then 7+                                   else a'+                       return [WeekDay a]             -- %A: day of week, long form (fst from wDays locale), Sunday - Saturday-            'A' -> do-                a' <- zeroBasedListIndex $ fmap fst $ wDays l-                let a = if a' == 0 then 7 else a'-                return [WeekDay a]+                   'A' -> do+                       a' <- zeroBasedListIndex $ fmap fst $ wDays l+                       let+                           a =+                               if a' == 0+                                   then 7+                                   else a'+                       return [WeekDay a]             -- %w: day of week number, 0 (= Sunday) - 6 (= Saturday)-            'w' -> do-                raw <- ra-                a' <- clipValid 0 6 raw-                let a = if a' == 0 then 7 else a'-                return [WeekDay a]+                   'w' -> do+                       raw <- ra+                       a' <- clipValid 0 6 raw+                       let+                           a =+                               if a' == 0+                                   then 7+                                   else a'+                       return [WeekDay a]             -- %j: day of year for Ordinal Date format, 001 - 366-            'j' -> do-                raw <- ra-                a <- clipValid 1 366 raw-                return [YearDay a]+                   'j' -> do+                       raw <- ra+                       a <- clipValid 1 366 raw+                       return [YearDay a]             -- unrecognised, pass on to other parsers-            _   -> return []-+                   _ -> return []         buildDay :: [DayComponent] -> Maybe Day         buildDay cs = let-            safeLast x xs = last (x:xs)+            safeLast x xs = last (x : xs)             y = let                 d = safeLast 70 [x | CenturyYear x <- cs]-                c = safeLast (if d >= 69 then 19 else 20) [x | Century x <- cs]+                c =+                    safeLast+                        (if d >= 69+                             then 19+                             else 20)+                        [x | Century x <- cs]                 in 100 * c + d             rest (YearMonth m:_) = let                 d = safeLast 1 [x | MonthDay x <- cs]@@ -165,17 +187,15 @@             rest (YearWeek wt w:_) = let                 d = safeLast 4 [x | WeekDay x <- cs]                 in case wt of-                    ISOWeek    -> fromWeekDateValid y w d-                    SundayWeek -> fromSundayStartWeekValid y w (d `mod` 7)-                    MondayWeek -> fromMondayStartWeekValid y w d-            rest (_:xs)        = rest xs-            rest []            = rest [YearMonth 1]-+                       ISOWeek -> fromWeekDateValid y w d+                       SundayWeek -> fromSundayStartWeekValid y w (d `mod` 7)+                       MondayWeek -> fromMondayStartWeekValid y w d+            rest (_:xs) = rest xs+            rest [] = rest [YearMonth 1]             in rest cs-         in \pairs -> do-            components <- for pairs $ \(c,x) -> f c x-            buildDay $ concat components+               components <- for pairs $ \(c, x) -> f c x+               buildDay $ concat components  mfoldl :: (Monad m) => (a -> b -> m a) -> m a -> [b] -> m a mfoldl f = let@@ -188,54 +208,60 @@     substituteTimeSpecifier _ = timeSubstituteTimeSpecifier     parseTimeSpecifier _ = timeParseTimeSpecifier     buildTime l = let-        f t@(TimeOfDay h m s) (c,x) = let+        f t@(TimeOfDay h m s) (c, x) = let             ra :: (Read a) => Maybe a             ra = readMaybe x-             getAmPm = let                 upx = map toUpper x-                (amStr,pmStr) = amPm l+                (amStr, pmStr) = amPm l                 in if upx == amStr-                    then Just $ TimeOfDay (h `mod` 12) m s-                    else if upx == pmStr-                    then Just $ TimeOfDay (if h < 12 then h + 12 else h) m s-                    else Nothing-+                       then Just $ TimeOfDay (h `mod` 12) m s+                       else if upx == pmStr+                                then Just $+                                     TimeOfDay+                                         (if h < 12+                                              then h + 12+                                              else h)+                                         m+                                         s+                                else Nothing             in case c of-                'P' -> getAmPm-                'p' -> getAmPm-                'H' -> do-                    raw <- ra-                    a <- clipValid 0 23 raw-                    return $ TimeOfDay a m s-                'I' -> do-                    raw <- ra-                    a <- clipValid 1 12 raw-                    return $ TimeOfDay a m s-                'k' -> do-                    raw <- ra-                    a <- clipValid 0 23 raw-                    return $ TimeOfDay a m s-                'l' -> do-                    raw <- ra-                    a <- clipValid 1 12 raw-                    return $ TimeOfDay a m s-                'M' -> do-                    raw <- ra-                    a <- clipValid 0 59 raw-                    return $ TimeOfDay h a s-                'S' -> do-                    raw <- ra-                    a <- clipValid 0 60 raw-                    return $ TimeOfDay h m (fromInteger a)-                'q' -> do-                    a <- ra-                    return $ TimeOfDay h m (mkPico (floor s) a)-                'Q' -> if null x then Just t else do-                    ps <- readMaybe $ take 12 $ rpad 12 '0' $ drop 1 x-                    return $ TimeOfDay h m (mkPico (floor s) ps)-                _   -> Just t-+                   'P' -> getAmPm+                   'p' -> getAmPm+                   'H' -> do+                       raw <- ra+                       a <- clipValid 0 23 raw+                       return $ TimeOfDay a m s+                   'I' -> do+                       raw <- ra+                       a <- clipValid 1 12 raw+                       return $ TimeOfDay a m s+                   'k' -> do+                       raw <- ra+                       a <- clipValid 0 23 raw+                       return $ TimeOfDay a m s+                   'l' -> do+                       raw <- ra+                       a <- clipValid 1 12 raw+                       return $ TimeOfDay a m s+                   'M' -> do+                       raw <- ra+                       a <- clipValid 0 59 raw+                       return $ TimeOfDay h a s+                   'S' -> do+                       raw <- ra+                       a <- clipValid 0 60 raw+                       return $ TimeOfDay h m (fromInteger a)+                   'q' -> do+                       ps <- (readMaybe $ take 12 $ rpad 12 '0' x) <|> return 0+                       return $ TimeOfDay h m (mkPico (floor s) ps)+                   'Q' ->+                       if null x+                           then Just t+                           else do+                               ps <- (readMaybe $ take 12 $ rpad 12 '0' x) <|> return 0+                               return $ TimeOfDay h m (mkPico (floor s) ps)+                   _ -> Just t         in mfoldl f (Just midnight)  rpad :: Int -> a -> [a] -> [a]@@ -253,11 +279,15 @@ enumDiff a b = (fromEnum a) - (fromEnum b)  getMilZoneHours :: Char -> Maybe Int-getMilZoneHours c | c < 'A' = Nothing-getMilZoneHours c | c <= 'I' = Just $ 1 + enumDiff c 'A'+getMilZoneHours c+    | c < 'A' = Nothing+getMilZoneHours c+    | c <= 'I' = Just $ 1 + enumDiff c 'A' getMilZoneHours 'J' = Nothing-getMilZoneHours c | c <= 'M' = Just $ 10 + enumDiff c 'K'-getMilZoneHours c | c <= 'Y' = Just $ (enumDiff 'N' c) - 1+getMilZoneHours c+    | c <= 'M' = Just $ 10 + enumDiff c 'K'+getMilZoneHours c+    | c <= 'Y' = Just $ (enumDiff 'N' c) - 1 getMilZoneHours 'Z' = Just 0 getMilZoneHours _ = Nothing @@ -265,8 +295,8 @@ getMilZone c = let     yc = toUpper c     in do-        hours <- getMilZoneHours yc-        return $ TimeZone (hours * 60) False [yc]+           hours <- getMilZoneHours yc+           return $ TimeZone (hours * 60) False [yc]  getKnownTimeZone :: TimeLocale -> String -> Maybe TimeZone getKnownTimeZone locale x = find (\tz -> map toUpper x == timeZoneName tz) (knownTimeZones locale)@@ -276,43 +306,44 @@     parseTimeSpecifier _ = timeParseTimeSpecifier     buildTime l = let         f :: Char -> String -> TimeZone -> Maybe TimeZone-        f 'z' str (TimeZone _ dst name) | Just offset <- readTzOffset str = Just $ TimeZone offset dst name+        f 'z' str (TimeZone _ dst name)+            | Just offset <- readTzOffset str = Just $ TimeZone offset dst name         f 'z' _ _ = Nothing-        f 'Z' str _ | Just offset <- readTzOffset str = Just $ TimeZone offset False ""-        f 'Z' str _ | Just zone <- getKnownTimeZone l str = Just zone+        f 'Z' str _+            | Just offset <- readTzOffset str = Just $ TimeZone offset False ""+        f 'Z' str _+            | Just zone <- getKnownTimeZone l str = Just zone         f 'Z' "UTC" _ = Just utc-        f 'Z' [c] _ | Just zone <- getMilZone c = Just zone+        f 'Z' [c] _+            | Just zone <- getMilZone c = Just zone         f 'Z' _ _ = Nothing         f _ _ tz = Just tz-        in foldl (\mt (c,s) -> mt >>= f c s) (Just $ minutesToTimeZone 0)+        in foldl (\mt (c, s) -> mt >>= f c s) (Just $ minutesToTimeZone 0)  readTzOffset :: String -> Maybe Int readTzOffset str = let-     getSign '+' = Just 1     getSign '-' = Just (-1)     getSign _ = Nothing-     calc s h1 h2 m1 m2 = do         sign <- getSign s-        h <- readMaybe [h1,h2]-        m <- readMaybe [m1,m2]+        h <- readMaybe [h1, h2]+        m <- readMaybe [m1, m2]         return $ sign * (60 * h + m)-     in case str of-        (s:h1:h2:':':m1:m2:[]) -> calc s h1 h2 m1 m2-        (s:h1:h2:m1:m2:[]) -> calc s h1 h2 m1 m2-        _ -> Nothing+           (s:h1:h2:':':m1:m2:[]) -> calc s h1 h2 m1 m2+           (s:h1:h2:m1:m2:[]) -> calc s h1 h2 m1 m2+           _ -> Nothing  instance ParseTime ZonedTime where     substituteTimeSpecifier _ = timeSubstituteTimeSpecifier     parseTimeSpecifier _ = timeParseTimeSpecifier     buildTime l xs = let-        f (ZonedTime (LocalTime _ tod) z) ('s',x) = do+        f (ZonedTime (LocalTime _ tod) z) ('s', x) = do             a <- readMaybe x             let                 s = fromInteger a-                (_,ps) = properFraction (todSec tod) :: (Integer,Pico)+                (_, ps) = properFraction (todSec tod) :: (Integer, Pico)                 s' = s + fromRational (toRational ps)             return $ utcToZonedTime z (posixSecondsToUTCTime s')         f t _ = Just t@@ -328,39 +359,44 @@     parseTimeSpecifier _ = timeParseTimeSpecifier     buildTime l xs = localTimeToUT1 0 <$> buildTime l xs -buildTimeMonths :: [(Char,String)] -> Maybe Integer+buildTimeMonths :: [(Char, String)] -> Maybe Integer buildTimeMonths xs = do-    tt <- for xs $ \(c,s) -> case c of-        'y' -> fmap ((*) 12) $ readMaybe s-        'b' -> readMaybe s-        'B' -> readMaybe s-        _ -> return 0+    tt <-+        for xs $ \(c, s) ->+            case c of+                'y' -> fmap ((*) 12) $ readMaybe s+                'b' -> readMaybe s+                'B' -> readMaybe s+                _ -> return 0     return $ sum tt -buildTimeDays :: [(Char,String)] -> Maybe Integer+buildTimeDays :: [(Char, String)] -> Maybe Integer buildTimeDays xs = do-    tt <- for xs $ \(c,s) -> case c of-        'w' -> fmap ((*) 7) $ readMaybe s-        'd' -> readMaybe s-        'D' -> readMaybe s-        _ -> return 0+    tt <-+        for xs $ \(c, s) ->+            case c of+                'w' -> fmap ((*) 7) $ readMaybe s+                'd' -> readMaybe s+                'D' -> readMaybe s+                _ -> return 0     return $ sum tt -buildTimeSeconds :: [(Char,String)] -> Maybe Pico+buildTimeSeconds :: [(Char, String)] -> Maybe Pico buildTimeSeconds xs = do-    tt <- for xs $ \(c,s) -> let-        readInt :: Integer -> Maybe Pico-        readInt t = do-            i <- readMaybe s-            return $ fromInteger $ i * t-        in case c of-            'h' -> readInt 3600-            'H' -> readInt 3600-            'm' -> readInt 60-            'M' -> readInt 60-            's' -> readMaybe s-            'S' -> readMaybe s-            _ -> return 0+    tt <-+        for xs $ \(c, s) -> let+            readInt :: Integer -> Maybe Pico+            readInt t = do+                i <- readMaybe s+                return $ fromInteger $ i * t+            in case c of+                   'h' -> readInt 3600+                   'H' -> readInt 3600+                   'm' -> readInt 60+                   'M' -> readInt 60+                   's' -> readMaybe s+                   'S' -> readMaybe s+                   _ -> return 0     return $ sum tt  instance ParseTime NominalDiffTime where
lib/Data/Time/LocalTime.hs view
@@ -1,20 +1,24 @@ module Data.Time.LocalTime-(+    (     -- * Time zones-    TimeZone(..),timeZoneOffsetString,timeZoneOffsetString',minutesToTimeZone,hoursToTimeZone,utc,-+      TimeZone(..)+    , timeZoneOffsetString+    , timeZoneOffsetString'+    , minutesToTimeZone+    , hoursToTimeZone+    , utc     -- getting the locale time zone-    getTimeZone,getCurrentTimeZone,--    module Data.Time.LocalTime.Internal.TimeOfDay,-    module Data.Time.LocalTime.Internal.CalendarDiffTime,-    module Data.Time.LocalTime.Internal.LocalTime,-    module Data.Time.LocalTime.Internal.ZonedTime,-) where+    , getTimeZone+    , getCurrentTimeZone+    , module Data.Time.LocalTime.Internal.TimeOfDay+    , module Data.Time.LocalTime.Internal.CalendarDiffTime+    , module Data.Time.LocalTime.Internal.LocalTime+    , module Data.Time.LocalTime.Internal.ZonedTime+    ) where -import Data.Time.Format()-import Data.Time.LocalTime.Internal.TimeZone hiding (timeZoneOffsetString'')-import Data.Time.LocalTime.Internal.TimeOfDay+import Data.Time.Format () import Data.Time.LocalTime.Internal.CalendarDiffTime import Data.Time.LocalTime.Internal.LocalTime+import Data.Time.LocalTime.Internal.TimeOfDay+import Data.Time.LocalTime.Internal.TimeZone hiding (timeZoneOffsetString'') import Data.Time.LocalTime.Internal.ZonedTime
lib/Data/Time/LocalTime/Internal/CalendarDiffTime.hs view
@@ -3,11 +3,7 @@         -- * Calendar Duration         module Data.Time.LocalTime.Internal.CalendarDiffTime     ) where-#if MIN_VERSION_base(4,8,0)-#else-import Data.Monoid-#endif-#if MIN_VERSION_base(4,9,0) && !MIN_VERSION_base(4,11,0)+#if !MIN_VERSION_base(4,11,0) import Data.Semigroup hiding (option) #endif import Data.Fixed@@ -30,19 +26,14 @@ #endif     ) -#if MIN_VERSION_base(4,9,0) -- | Additive instance Semigroup CalendarDiffTime where     CalendarDiffTime m1 d1 <> CalendarDiffTime m2 d2 = CalendarDiffTime (m1 + m2) (d1 + d2)-#endif+ -- | Additive instance Monoid CalendarDiffTime where     mempty = CalendarDiffTime 0 0-#if MIN_VERSION_base(4,9,0)     mappend = (<>)-#else-    mappend (CalendarDiffTime m1 d1) (CalendarDiffTime m2 d2) = CalendarDiffTime (m1 + m2) (d1 + d2)-#endif  instance Show CalendarDiffTime where     show (CalendarDiffTime m t) = "P" ++ show m ++ "MT" ++ showFixed True (realToFrac t :: Pico) ++ "S"
lib/Data/Time/LocalTime/Internal/LocalTime.hs view
@@ -1,38 +1,37 @@ {-# OPTIONS -fno-warn-orphans #-}+ module Data.Time.LocalTime.Internal.LocalTime-(+    (     -- * Local Time-    LocalTime(..),--    addLocalTime,diffLocalTime,-+      LocalTime(..)+    , addLocalTime+    , diffLocalTime     -- converting UTC and UT1 times to LocalTime-    utcToLocalTime,localTimeToUTC,ut1ToLocalTime,localTimeToUT1,-) where--+    , utcToLocalTime+    , localTimeToUTC+    , ut1ToLocalTime+    , localTimeToUT1+    ) where  import Control.DeepSeq-import Data.Typeable import Data.Data import Data.Time.Calendar.Days import Data.Time.Calendar.Gregorian import Data.Time.Clock.Internal.NominalDiffTime-import Data.Time.Clock.Internal.UniversalTime import Data.Time.Clock.Internal.UTCDiff import Data.Time.Clock.Internal.UTCTime+import Data.Time.Clock.Internal.UniversalTime import Data.Time.LocalTime.Internal.TimeOfDay import Data.Time.LocalTime.Internal.TimeZone - -- | A simple day and time aggregate, where the day is of the specified parameter, -- and the time is a TimeOfDay. -- Conversion of this (as local civil time) to UTC depends on the time zone. -- Conversion of this (as local mean time) to UT1 depends on the longitude.-data LocalTime = LocalTime {-    localDay    :: Day,-    localTimeOfDay   :: TimeOfDay-} deriving (Eq,Ord,Data, Typeable)+data LocalTime = LocalTime+    { localDay :: Day+    , localTimeOfDay :: TimeOfDay+    } deriving (Eq, Ord, Data, Typeable)  instance NFData LocalTime where     rnf (LocalTime d t) = rnf d `seq` rnf t `seq` ()@@ -50,24 +49,29 @@  -- | Get the local time of a UTC time in a time zone. utcToLocalTime :: TimeZone -> UTCTime -> LocalTime-utcToLocalTime tz (UTCTime day dt) = LocalTime (addDays i day) tod where-    (i,tod) = utcToLocalTimeOfDay tz (timeToTimeOfDay dt)+utcToLocalTime tz (UTCTime day dt) = LocalTime (addDays i day) tod+  where+    (i, tod) = utcToLocalTimeOfDay tz (timeToTimeOfDay dt)  -- | Get the UTC time of a local time in a time zone. localTimeToUTC :: TimeZone -> LocalTime -> UTCTime-localTimeToUTC tz (LocalTime day tod) = UTCTime (addDays i day) (timeOfDayToTime todUTC) where-    (i,todUTC) = localToUTCTimeOfDay tz tod+localTimeToUTC tz (LocalTime day tod) = UTCTime (addDays i day) (timeOfDayToTime todUTC)+  where+    (i, todUTC) = localToUTCTimeOfDay tz tod  -- | Get the local time of a UT1 time on a particular meridian (in degrees, positive is East). ut1ToLocalTime :: Rational -> UniversalTime -> LocalTime-ut1ToLocalTime long (ModJulianDate date) = LocalTime (ModifiedJulianDay localMJD) (dayFractionToTimeOfDay localToDOffset) where+ut1ToLocalTime long (ModJulianDate date) =+    LocalTime (ModifiedJulianDay localMJD) (dayFractionToTimeOfDay localToDOffset)+  where     localTime = date + long / 360 :: Rational     localMJD = floor localTime     localToDOffset = localTime - (fromIntegral localMJD)  -- | Get the UT1 time of a local time on a particular meridian (in degrees, positive is East). localTimeToUT1 :: Rational -> LocalTime -> UniversalTime-localTimeToUT1 long (LocalTime (ModifiedJulianDay localMJD) tod) = ModJulianDate ((fromIntegral localMJD) + (timeOfDayToDayFraction tod) - (long / 360))+localTimeToUT1 long (LocalTime (ModifiedJulianDay localMJD) tod) =+    ModJulianDate ((fromIntegral localMJD) + (timeOfDayToDayFraction tod) - (long / 360))  -- orphan instance instance Show UniversalTime where
lib/Data/Time/LocalTime/Internal/TimeOfDay.hs view
@@ -1,34 +1,43 @@ {-# OPTIONS -fno-warn-unused-imports #-}+ module Data.Time.LocalTime.Internal.TimeOfDay-(+    (     -- * Time of day-    TimeOfDay(..),midnight,midday,makeTimeOfDayValid,-    timeToDaysAndTimeOfDay,daysAndTimeOfDayToTime,-    utcToLocalTimeOfDay,localToUTCTimeOfDay,-    timeToTimeOfDay,timeOfDayToTime,-    dayFractionToTimeOfDay,timeOfDayToDayFraction-) where+      TimeOfDay(..)+    , midnight+    , midday+    , makeTimeOfDayValid+    , timeToDaysAndTimeOfDay+    , daysAndTimeOfDayToTime+    , utcToLocalTimeOfDay+    , localToUTCTimeOfDay+    , timeToTimeOfDay+    , pastMidnight+    , timeOfDayToTime+    , sinceMidnight+    , dayFractionToTimeOfDay+    , timeOfDayToDayFraction+    ) where  import Control.DeepSeq-import Data.Typeable-import Data.Fixed import Data.Data+import Data.Fixed+import Data.Time.Calendar.Private import Data.Time.Clock.Internal.DiffTime import Data.Time.Clock.Internal.NominalDiffTime-import Data.Time.Calendar.Private import Data.Time.LocalTime.Internal.TimeZone-+import Data.Typeable  -- | Time of day as represented in hour, minute and second (with picoseconds), typically used to express local time of day.-data TimeOfDay = TimeOfDay {-    -- | range 0 - 23-    todHour    :: Int,-    -- | range 0 - 59-    todMin     :: Int,-    -- | Note that 0 <= 'todSec' < 61, accomodating leap seconds.+data TimeOfDay = TimeOfDay+    { todHour :: Int+    -- ^ range 0 - 23+    , todMin :: Int+    -- ^ range 0 - 59+    , todSec :: Pico+    -- ^ Note that 0 <= 'todSec' < 61, accomodating leap seconds.     -- Any local minute may have a leap second, since leap seconds happen in all zones simultaneously-    todSec     :: Pico-} deriving (Eq,Ord,Data, Typeable)+    } 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@@ -53,26 +62,28 @@  -- | Convert a period of time into a count of days and a time of day since midnight. -- The time of day will never have a leap second.-timeToDaysAndTimeOfDay :: NominalDiffTime -> (Integer,TimeOfDay)+timeToDaysAndTimeOfDay :: NominalDiffTime -> (Integer, TimeOfDay) timeToDaysAndTimeOfDay dt = let     s = realToFrac dt-    (m,ms) = divMod' s 60-    (h,hm) = divMod' m 60-    (d,dh) = divMod' h 24-    in (d,TimeOfDay dh hm ms)+    (m, ms) = divMod' s 60+    (h, hm) = divMod' m 60+    (d, dh) = divMod' h 24+    in (d, TimeOfDay dh hm ms)  -- | Convert a count of days and a time of day since midnight into a period of time. daysAndTimeOfDayToTime :: Integer -> TimeOfDay -> NominalDiffTime-daysAndTimeOfDayToTime d (TimeOfDay dh hm ms) = (+) (realToFrac ms) $ (*) 60 $ (+) (realToFrac hm) $ (*) 60 $ (+) (realToFrac dh) $ (*) 24 $ realToFrac d+daysAndTimeOfDayToTime d (TimeOfDay dh hm ms) =+    (+) (realToFrac ms) $ (*) 60 $ (+) (realToFrac hm) $ (*) 60 $ (+) (realToFrac dh) $ (*) 24 $ realToFrac d  -- | Convert a time of day in UTC to a time of day in some timezone, together with a day adjustment.-utcToLocalTimeOfDay :: TimeZone -> TimeOfDay -> (Integer,TimeOfDay)-utcToLocalTimeOfDay zone (TimeOfDay h m s) = (fromIntegral (div h' 24),TimeOfDay (mod h' 24) (mod m' 60) s) where+utcToLocalTimeOfDay :: TimeZone -> TimeOfDay -> (Integer, TimeOfDay)+utcToLocalTimeOfDay zone (TimeOfDay h m s) = (fromIntegral (div h' 24), TimeOfDay (mod h' 24) (mod m' 60) s)+  where     m' = m + timeZoneMinutes zone     h' = h + (div m' 60)  -- | Convert a time of day in some timezone to a time of day in UTC, together with a day adjustment.-localToUTCTimeOfDay :: TimeZone -> TimeOfDay -> (Integer,TimeOfDay)+localToUTCTimeOfDay :: TimeZone -> TimeOfDay -> (Integer, TimeOfDay) localToUTCTimeOfDay zone = utcToLocalTimeOfDay (minutesToTimeZone (negate (timeZoneMinutes zone)))  posixDayLength :: DiffTime@@ -81,17 +92,27 @@ -- | Get the time of day given a time since midnight. -- Time more than 24h will be converted to leap-seconds. timeToTimeOfDay :: DiffTime -> TimeOfDay-timeToTimeOfDay dt | dt >= posixDayLength = TimeOfDay 23 59 (60 + (realToFrac (dt - posixDayLength)))-timeToTimeOfDay dt = TimeOfDay (fromInteger h) (fromInteger m) s where+timeToTimeOfDay dt+    | dt >= posixDayLength = TimeOfDay 23 59 (60 + (realToFrac (dt - posixDayLength)))+timeToTimeOfDay dt = TimeOfDay (fromInteger h) (fromInteger m) s+  where     s' = realToFrac dt     s = mod' s' 60     m' = div' s' 60     m = mod' m' 60     h = div' m' 60 +-- | Same as 'timeToTimeOfDay'.+pastMidnight :: DiffTime -> TimeOfDay+pastMidnight = timeToTimeOfDay+ -- | Get the time since midnight for a given time of day. timeOfDayToTime :: TimeOfDay -> DiffTime timeOfDayToTime (TimeOfDay h m s) = ((fromIntegral h) * 60 + (fromIntegral m)) * 60 + (realToFrac s)++-- | Same as 'timeOfDayToTime'.+sinceMidnight :: TimeOfDay -> DiffTime+sinceMidnight = timeOfDayToTime  -- | Get the time of day given the fraction of a day since midnight. dayFractionToTimeOfDay :: Rational -> TimeOfDay
lib/Data/Time/LocalTime/Internal/TimeZone.hs view
@@ -1,39 +1,40 @@ {-# OPTIONS -fno-warn-unused-imports #-} {-# LANGUAGE ForeignFunctionInterface #-}+ module Data.Time.LocalTime.Internal.TimeZone-(+    (     -- * Time zones-    TimeZone(..),timeZoneOffsetString,timeZoneOffsetString',timeZoneOffsetString'',minutesToTimeZone,hoursToTimeZone,utc,-+      TimeZone(..)+    , timeZoneOffsetString+    , timeZoneOffsetString'+    , timeZoneOffsetString''+    , minutesToTimeZone+    , hoursToTimeZone+    , utc     -- getting the locale time zone-    getTimeZone,getCurrentTimeZone-) where+    , getTimeZone+    , getCurrentTimeZone+    ) where ---import System.Time.Calendar.Format+import Control.DeepSeq+import Data.Data import Data.Time.Calendar.Private-import Data.Time.Clock.System-import Data.Time.Clock.POSIX import Data.Time.Clock.Internal.UTCTime--#if __GLASGOW_HASKELL__ >= 709+import Data.Time.Clock.POSIX+import Data.Time.Clock.System+import Data.Typeable import Foreign-#else-import Foreign.Safe-#endif import Foreign.C-import Control.DeepSeq-import Data.Typeable-import Data.Data  -- | A TimeZone is a whole number of minutes offset from UTC, together with a name and a \"just for summer\" flag.-data TimeZone = TimeZone {-    -- | The number of minutes offset from UTC. Positive means local time will be later in the day than UTC.-    timeZoneMinutes :: Int,-    -- | Is this time zone just persisting for the summer?-    timeZoneSummerOnly :: Bool,-    -- | The name of the zone, typically a three- or four-letter acronym.-    timeZoneName :: String-} deriving (Eq,Ord,Data, Typeable)+data TimeZone = TimeZone+    { timeZoneMinutes :: Int+    -- ^ The number of minutes offset from UTC. Positive means local time will be later in the day than UTC.+    , timeZoneSummerOnly :: Bool+    -- ^ Is this time zone just persisting for the summer?+    , timeZoneName :: String+    -- ^ The name of the zone, typically a three- or four-letter acronym.+    } deriving (Eq, Ord, Data, Typeable)  instance NFData TimeZone where     rnf (TimeZone m so n) = rnf m `seq` rnf so `seq` rnf n `seq` ()@@ -49,14 +50,16 @@ showT :: Bool -> PadOption -> Int -> String showT False opt t = showPaddedNum opt ((div t 60) * 100 + (mod t 60)) showT True opt t = let-    opt' = case opt of-        NoPad -> NoPad-        Pad i c -> Pad (max 0 $ i - 3) c+    opt' =+        case opt of+            NoPad -> NoPad+            Pad i c -> Pad (max 0 $ i - 3) c     in showPaddedNum opt' (div t 60) ++ ":" ++ show2 (mod t 60)  timeZoneOffsetString'' :: Bool -> PadOption -> TimeZone -> String-timeZoneOffsetString'' colon opt (TimeZone t _ _) | t < 0 = '-':(showT colon opt (negate t))-timeZoneOffsetString'' colon opt (TimeZone t _ _) = '+':(showT colon opt t)+timeZoneOffsetString'' colon opt (TimeZone t _ _)+    | t < 0 = '-' : (showT colon opt (negate t))+timeZoneOffsetString'' colon opt (TimeZone t _ _) = '+' : (showT colon opt t)  -- | Text representing the offset of this timezone, such as \"-0800\" or \"+0400\" (like @%z@ in formatTime), with arbitrary padding. timeZoneOffsetString' :: Maybe Char -> TimeZone -> String@@ -77,26 +80,34 @@ utc = TimeZone 0 False "UTC"  {-# CFILES cbits/HsTime.c #-}-foreign import ccall unsafe "HsTime.h get_current_timezone_seconds" get_current_timezone_seconds :: CTime -> Ptr CInt -> Ptr CString -> IO CLong+foreign import ccall unsafe "HsTime.h get_current_timezone_seconds" get_current_timezone_seconds+    :: CTime -> Ptr CInt -> Ptr CString -> IO CLong  getTimeZoneCTime :: CTime -> IO TimeZone-getTimeZoneCTime ctime = with 0 (\pdst -> with nullPtr (\pcname -> do-    secs <- get_current_timezone_seconds ctime pdst pcname-    case secs of-        0x80000000 -> fail "localtime_r failed"-        _ -> do-            dst <- peek pdst-            cname <- peek pcname-            name <- peekCString cname-            return (TimeZone (div (fromIntegral secs) 60) (dst == 1) name)-    ))+getTimeZoneCTime ctime =+    with+        0+        (\pdst ->+             with+                 nullPtr+                 (\pcname -> do+                      secs <- get_current_timezone_seconds ctime pdst pcname+                      case secs of+                          0x80000000 -> fail "localtime_r failed"+                          _ -> do+                              dst <- peek pdst+                              cname <- peek pcname+                              name <- peekCString cname+                              return (TimeZone (div (fromIntegral secs) 60) (dst == 1) name)))  toCTime :: Int64 -> IO CTime toCTime t = let     tt = fromIntegral t     t' = fromIntegral tt     -- there's no instance Bounded CTime, so this is the easiest way to check for overflow-    in if t' == t then return $ CTime tt else fail "Data.Time.LocalTime.Internal.TimeZone.toCTime: Overflow"+    in if t' == t+           then return $ CTime tt+           else fail "Data.Time.LocalTime.Internal.TimeZone.toCTime: Overflow"  -- | Get the local time-zone for a given time (varying as per summertime adjustments). getTimeZoneSystem :: SystemTime -> IO TimeZone
lib/Data/Time/LocalTime/Internal/ZonedTime.hs view
@@ -1,28 +1,29 @@ {-# OPTIONS -fno-warn-orphans #-}+ module Data.Time.LocalTime.Internal.ZonedTime-(-    ZonedTime(..),utcToZonedTime,zonedTimeToUTC,getZonedTime,utcToLocalZonedTime-) where+    ( ZonedTime(..)+    , utcToZonedTime+    , zonedTimeToUTC+    , getZonedTime+    , utcToLocalZonedTime+    ) where  import Control.DeepSeq-import Data.Typeable import Data.Data import Data.Time.Clock.Internal.UTCTime import Data.Time.Clock.POSIX-import Data.Time.LocalTime.Internal.TimeZone import Data.Time.LocalTime.Internal.LocalTime-+import Data.Time.LocalTime.Internal.TimeZone  -- | A local time together with a time zone. -- -- There is no 'Eq' instance for @ZonedTime@. -- If you want to compare local times, use 'zonedTimeToLocalTime'. -- If you want to compare absolute times, use 'zonedTimeToUTC'.-data ZonedTime = ZonedTime {-    zonedTimeToLocalTime :: LocalTime,-    zonedTimeZone :: TimeZone-}-    deriving (Data, Typeable)+data ZonedTime = ZonedTime+    { zonedTimeToLocalTime :: LocalTime+    , zonedTimeZone :: TimeZone+    } deriving (Data, Typeable)  instance NFData ZonedTime where     rnf (ZonedTime lt z) = rnf lt `seq` rnf z `seq` ()
lib/include/HsTimeConfig.h view
@@ -69,7 +69,7 @@ #define PACKAGE_NAME "Haskell time package"  /* Define to the full name and version of this package. */-#define PACKAGE_STRING "Haskell time package 1.8"+#define PACKAGE_STRING "Haskell time package 1.10"  /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "time"@@ -78,7 +78,7 @@ #define PACKAGE_URL ""  /* Define to the version of this package. */-#define PACKAGE_VERSION "1.8"+#define PACKAGE_VERSION "1.10"  /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1
test/ShowDefaultTZAbbreviations.hs view
@@ -3,7 +3,11 @@ import Data.Time  showTZ :: TimeZone -> String-showTZ tz = (formatTime defaultTimeLocale "%Z %z" tz) ++ (if timeZoneSummerOnly tz then " DST" else "")+showTZ tz =+    (formatTime defaultTimeLocale "%Z %z" tz) +++    (if timeZoneSummerOnly tz+         then " DST"+         else "")  main :: IO () main = mapM_ (\tz -> putStrLn (showTZ tz)) (knownTimeZones defaultTimeLocale)
test/main/Main.hs view
@@ -1,6 +1,6 @@ module Main where -import Test.Tasty+import Test.Types() import Test.Calendar.AddDays import Test.Calendar.Calendars import Test.Calendar.ClipDates@@ -14,44 +14,36 @@ import Test.Clock.Conversion import Test.Clock.Resolution import Test.Clock.TAI+import Test.Format.Compile () import Test.Format.Format-import Test.Format.ParseTime import Test.Format.ISO8601+import Test.Format.ParseTime+import Test.LocalTime.CalendarDiffTime import Test.LocalTime.Time import Test.LocalTime.TimeOfDay-import Test.LocalTime.CalendarDiffTime-+import Test.Tasty  tests :: TestTree-tests = testGroup "Time" [-    testGroup "Calendar" [-        addDaysTest,-        testCalendars,-        clipDates,-        convertBack,-        longWeekYears,-        testMonthDay,-        testEaster,-        testValid,-        testWeek,-        testDuration-        ],-    testGroup "Clock" [-        testClockConversion,-        testResolutions,-        testTAI-        ],-    testGroup "Format" [-        testFormat,-        testParseTime,-        testISO8601-        ],-    testGroup "LocalTime" [-        testTime,-        testTimeOfDay,-        testCalendarDiffTime+tests =+    testGroup+        "Time"+        [ testGroup+              "Calendar"+              [ addDaysTest+              , testCalendars+              , clipDates+              , convertBack+              , longWeekYears+              , testMonthDay+              , testEaster+              , testValid+              , testWeek+              , testDuration+              ]+        , testGroup "Clock" [testClockConversion, testResolutions, testTAI]+        , testGroup "Format" [testFormat, testParseTime, testISO8601]+        , testGroup "LocalTime" [testTime, testTimeOfDay, testCalendarDiffTime]         ]-    ]  main :: IO () main = defaultMain tests
test/main/Test/Arbitrary.hs view
@@ -3,13 +3,14 @@ module Test.Arbitrary where  import Control.Monad+import Data.Fixed import Data.Ratio import Data.Time import Data.Time.Clock.POSIX import Test.Tasty.QuickCheck hiding (reason)  instance Arbitrary DayOfWeek where-    arbitrary = fmap toEnum $ choose (1,7)+    arbitrary = fmap toEnum $ choose (1, 7)  instance Arbitrary Day where     arbitrary = liftM ModifiedJulianDay $ choose (-313698, 2973483) -- 1000-01-1 to 9999-12-31@@ -68,32 +69,59 @@ instance Arbitrary CalendarDiffTime where     arbitrary = liftM2 CalendarDiffTime arbitrary arbitrary +reduceDigits :: Int -> Pico -> Maybe Pico+reduceDigits (-1) _ = Nothing+reduceDigits n x = let+    d :: Pico+    d = 10 ^^ (negate n)+    r = mod' x d+    in case r of+           0 -> reduceDigits (n - 1) x+           _ -> Just $ x - r+ instance Arbitrary TimeOfDay where     arbitrary = liftM timeToTimeOfDay arbitrary+    shrink (TimeOfDay h m s) = let+        shrinkInt 0 = []+        shrinkInt 1 = [0]+        shrinkInt _ = [0, 1]+        shrinkPico 0 = []+        shrinkPico 1 = [0]+        shrinkPico p =+            case reduceDigits 12 p of+                Just p' -> [0, 1, p']+                Nothing -> [0, 1]+        in [TimeOfDay h' m s | h' <- shrinkInt h] +++           [TimeOfDay h m' s | m' <- shrinkInt m] ++ [TimeOfDay h m s' | s' <- shrinkPico s]  instance CoArbitrary TimeOfDay where     coarbitrary t = coarbitrary (timeOfDayToTime t)  instance Arbitrary LocalTime where     arbitrary = liftM2 LocalTime arbitrary arbitrary+    shrink (LocalTime d tod) = [LocalTime d' tod | d' <- shrink d] ++ [LocalTime d tod' | tod' <- shrink tod]  instance CoArbitrary LocalTime where     coarbitrary t = coarbitrary (floor (utcTimeToPOSIXSeconds (localTimeToUTC utc t)) :: Integer)  instance Arbitrary TimeZone where     arbitrary = liftM minutesToTimeZone $ choose (-720, 720)+    shrink (TimeZone 0 _ _) = []+    shrink (TimeZone _ s n) = [TimeZone 0 s n]  instance CoArbitrary TimeZone where     coarbitrary tz = coarbitrary (timeZoneMinutes tz)  instance Arbitrary ZonedTime where     arbitrary = liftM2 ZonedTime arbitrary arbitrary+    shrink (ZonedTime d tz) = [ZonedTime d' tz | d' <- shrink d] ++ [ZonedTime d tz' | tz' <- shrink tz]  instance CoArbitrary ZonedTime where     coarbitrary t = coarbitrary (floor (utcTimeToPOSIXSeconds (zonedTimeToUTC t)) :: Integer)  instance Arbitrary UTCTime where     arbitrary = liftM2 UTCTime arbitrary arbitrary+    shrink t = fmap (localTimeToUTC utc) $ shrink $ utcToLocalTime utc t  instance CoArbitrary UTCTime where     coarbitrary t = coarbitrary (floor (utcTimeToPOSIXSeconds t) :: Integer)@@ -102,6 +130,7 @@     arbitrary = liftM (\n -> ModJulianDate $ n % k) $ choose (-313698 * k, 2973483 * k) -- 1000-01-1 to 9999-12-31       where         k = 86400+    shrink t = fmap (localTimeToUT1 0) $ shrink $ ut1ToLocalTime 0 t  instance CoArbitrary UniversalTime where     coarbitrary (ModJulianDate d) = coarbitrary d
test/main/Test/Calendar/AddDays.hs view
@@ -1,42 +1,43 @@-module Test.Calendar.AddDays(addDaysTest) where+module Test.Calendar.AddDays+    ( addDaysTest+    ) where  import Data.Time.Calendar+import Test.Calendar.AddDaysRef import Test.Tasty import Test.Tasty.HUnit-import Test.Calendar.AddDaysRef -days ::[Day]+days :: [Day] days =-    [-    fromGregorian 2005 2 28,-    fromGregorian 2004 2 29,-    fromGregorian 2004 1 31,-    fromGregorian 2004 12 31,-    fromGregorian 2005 7 1,-    fromGregorian 2005 4 21,-    fromGregorian 2005 6 30+    [ fromGregorian 2005 2 28+    , fromGregorian 2004 2 29+    , fromGregorian 2004 1 31+    , fromGregorian 2004 12 31+    , fromGregorian 2005 7 1+    , fromGregorian 2005 4 21+    , fromGregorian 2005 6 30     ]  increments :: [Integer]-increments = [-10,-4,-1,0,1,7,83]+increments = [-10, -4, -1, 0, 1, 7, 83] -adders :: [(String,Integer -> Day -> Day)]+adders :: [(String, Integer -> Day -> Day)] adders =-    [-    ("day",addDays),-    ("month (clip)",addGregorianMonthsClip),-    ("month (roll over)",addGregorianMonthsRollOver),-    ("year (clip)",addGregorianYearsClip),-    ("year (roll over)",addGregorianYearsRollOver)+    [ ("day", addDays)+    , ("month (clip)", addGregorianMonthsClip)+    , ("month (roll over)", addGregorianMonthsRollOver)+    , ("year (clip)", addGregorianYearsClip)+    , ("year (roll over)", addGregorianYearsRollOver)     ]  resultDays :: [String] resultDays = do-    (aname,adder) <- adders+    (aname, adder) <- adders     increment <- increments     day <- days-    return ((showGregorian day) ++ " + " ++ (show increment) ++ " * " ++ aname ++ " = " ++ showGregorian (adder increment day))+    return+        ((showGregorian day) +++         " + " ++ (show increment) ++ " * " ++ aname ++ " = " ++ showGregorian (adder increment day))  addDaysTest :: TestTree-addDaysTest = testCase "addDays" $-    assertEqual "" addDaysRef $ unlines resultDays+addDaysTest = testCase "addDays" $ assertEqual "" addDaysRef $ unlines resultDays
test/main/Test/Calendar/AddDaysRef.hs view
@@ -2,249 +2,250 @@  addDaysRef :: String addDaysRef =- unlines-  [ "2005-02-28 + -10 * day = 2005-02-18"-  , "2004-02-29 + -10 * day = 2004-02-19"-  , "2004-01-31 + -10 * day = 2004-01-21"-  , "2004-12-31 + -10 * day = 2004-12-21"-  , "2005-07-01 + -10 * day = 2005-06-21"-  , "2005-04-21 + -10 * day = 2005-04-11"-  , "2005-06-30 + -10 * day = 2005-06-20"-  , "2005-02-28 + -4 * day = 2005-02-24"-  , "2004-02-29 + -4 * day = 2004-02-25"-  , "2004-01-31 + -4 * day = 2004-01-27"-  , "2004-12-31 + -4 * day = 2004-12-27"-  , "2005-07-01 + -4 * day = 2005-06-27"-  , "2005-04-21 + -4 * day = 2005-04-17"-  , "2005-06-30 + -4 * day = 2005-06-26"-  , "2005-02-28 + -1 * day = 2005-02-27"-  , "2004-02-29 + -1 * day = 2004-02-28"-  , "2004-01-31 + -1 * day = 2004-01-30"-  , "2004-12-31 + -1 * day = 2004-12-30"-  , "2005-07-01 + -1 * day = 2005-06-30"-  , "2005-04-21 + -1 * day = 2005-04-20"-  , "2005-06-30 + -1 * day = 2005-06-29"-  , "2005-02-28 + 0 * day = 2005-02-28"-  , "2004-02-29 + 0 * day = 2004-02-29"-  , "2004-01-31 + 0 * day = 2004-01-31"-  , "2004-12-31 + 0 * day = 2004-12-31"-  , "2005-07-01 + 0 * day = 2005-07-01"-  , "2005-04-21 + 0 * day = 2005-04-21"-  , "2005-06-30 + 0 * day = 2005-06-30"-  , "2005-02-28 + 1 * day = 2005-03-01"-  , "2004-02-29 + 1 * day = 2004-03-01"-  , "2004-01-31 + 1 * day = 2004-02-01"-  , "2004-12-31 + 1 * day = 2005-01-01"-  , "2005-07-01 + 1 * day = 2005-07-02"-  , "2005-04-21 + 1 * day = 2005-04-22"-  , "2005-06-30 + 1 * day = 2005-07-01"-  , "2005-02-28 + 7 * day = 2005-03-07"-  , "2004-02-29 + 7 * day = 2004-03-07"-  , "2004-01-31 + 7 * day = 2004-02-07"-  , "2004-12-31 + 7 * day = 2005-01-07"-  , "2005-07-01 + 7 * day = 2005-07-08"-  , "2005-04-21 + 7 * day = 2005-04-28"-  , "2005-06-30 + 7 * day = 2005-07-07"-  , "2005-02-28 + 83 * day = 2005-05-22"-  , "2004-02-29 + 83 * day = 2004-05-22"-  , "2004-01-31 + 83 * day = 2004-04-23"-  , "2004-12-31 + 83 * day = 2005-03-24"-  , "2005-07-01 + 83 * day = 2005-09-22"-  , "2005-04-21 + 83 * day = 2005-07-13"-  , "2005-06-30 + 83 * day = 2005-09-21"-  , "2005-02-28 + -10 * month (clip) = 2004-04-28"-  , "2004-02-29 + -10 * month (clip) = 2003-04-29"-  , "2004-01-31 + -10 * month (clip) = 2003-03-31"-  , "2004-12-31 + -10 * month (clip) = 2004-02-29"-  , "2005-07-01 + -10 * month (clip) = 2004-09-01"-  , "2005-04-21 + -10 * month (clip) = 2004-06-21"-  , "2005-06-30 + -10 * month (clip) = 2004-08-30"-  , "2005-02-28 + -4 * month (clip) = 2004-10-28"-  , "2004-02-29 + -4 * month (clip) = 2003-10-29"-  , "2004-01-31 + -4 * month (clip) = 2003-09-30"-  , "2004-12-31 + -4 * month (clip) = 2004-08-31"-  , "2005-07-01 + -4 * month (clip) = 2005-03-01"-  , "2005-04-21 + -4 * month (clip) = 2004-12-21"-  , "2005-06-30 + -4 * month (clip) = 2005-02-28"-  , "2005-02-28 + -1 * month (clip) = 2005-01-28"-  , "2004-02-29 + -1 * month (clip) = 2004-01-29"-  , "2004-01-31 + -1 * month (clip) = 2003-12-31"-  , "2004-12-31 + -1 * month (clip) = 2004-11-30"-  , "2005-07-01 + -1 * month (clip) = 2005-06-01"-  , "2005-04-21 + -1 * month (clip) = 2005-03-21"-  , "2005-06-30 + -1 * month (clip) = 2005-05-30"-  , "2005-02-28 + 0 * month (clip) = 2005-02-28"-  , "2004-02-29 + 0 * month (clip) = 2004-02-29"-  , "2004-01-31 + 0 * month (clip) = 2004-01-31"-  , "2004-12-31 + 0 * month (clip) = 2004-12-31"-  , "2005-07-01 + 0 * month (clip) = 2005-07-01"-  , "2005-04-21 + 0 * month (clip) = 2005-04-21"-  , "2005-06-30 + 0 * month (clip) = 2005-06-30"-  , "2005-02-28 + 1 * month (clip) = 2005-03-28"-  , "2004-02-29 + 1 * month (clip) = 2004-03-29"-  , "2004-01-31 + 1 * month (clip) = 2004-02-29"-  , "2004-12-31 + 1 * month (clip) = 2005-01-31"-  , "2005-07-01 + 1 * month (clip) = 2005-08-01"-  , "2005-04-21 + 1 * month (clip) = 2005-05-21"-  , "2005-06-30 + 1 * month (clip) = 2005-07-30"-  , "2005-02-28 + 7 * month (clip) = 2005-09-28"-  , "2004-02-29 + 7 * month (clip) = 2004-09-29"-  , "2004-01-31 + 7 * month (clip) = 2004-08-31"-  , "2004-12-31 + 7 * month (clip) = 2005-07-31"-  , "2005-07-01 + 7 * month (clip) = 2006-02-01"-  , "2005-04-21 + 7 * month (clip) = 2005-11-21"-  , "2005-06-30 + 7 * month (clip) = 2006-01-30"-  , "2005-02-28 + 83 * month (clip) = 2012-01-28"-  , "2004-02-29 + 83 * month (clip) = 2011-01-29"-  , "2004-01-31 + 83 * month (clip) = 2010-12-31"-  , "2004-12-31 + 83 * month (clip) = 2011-11-30"-  , "2005-07-01 + 83 * month (clip) = 2012-06-01"-  , "2005-04-21 + 83 * month (clip) = 2012-03-21"-  , "2005-06-30 + 83 * month (clip) = 2012-05-30"-  , "2005-02-28 + -10 * month (roll over) = 2004-04-28"-  , "2004-02-29 + -10 * month (roll over) = 2003-04-29"-  , "2004-01-31 + -10 * month (roll over) = 2003-03-31"-  , "2004-12-31 + -10 * month (roll over) = 2004-03-02"-  , "2005-07-01 + -10 * month (roll over) = 2004-09-01"-  , "2005-04-21 + -10 * month (roll over) = 2004-06-21"-  , "2005-06-30 + -10 * month (roll over) = 2004-08-30"-  , "2005-02-28 + -4 * month (roll over) = 2004-10-28"-  , "2004-02-29 + -4 * month (roll over) = 2003-10-29"-  , "2004-01-31 + -4 * month (roll over) = 2003-10-01"-  , "2004-12-31 + -4 * month (roll over) = 2004-08-31"-  , "2005-07-01 + -4 * month (roll over) = 2005-03-01"-  , "2005-04-21 + -4 * month (roll over) = 2004-12-21"-  , "2005-06-30 + -4 * month (roll over) = 2005-03-02"-  , "2005-02-28 + -1 * month (roll over) = 2005-01-28"-  , "2004-02-29 + -1 * month (roll over) = 2004-01-29"-  , "2004-01-31 + -1 * month (roll over) = 2003-12-31"-  , "2004-12-31 + -1 * month (roll over) = 2004-12-01"-  , "2005-07-01 + -1 * month (roll over) = 2005-06-01"-  , "2005-04-21 + -1 * month (roll over) = 2005-03-21"-  , "2005-06-30 + -1 * month (roll over) = 2005-05-30"-  , "2005-02-28 + 0 * month (roll over) = 2005-02-28"-  , "2004-02-29 + 0 * month (roll over) = 2004-02-29"-  , "2004-01-31 + 0 * month (roll over) = 2004-01-31"-  , "2004-12-31 + 0 * month (roll over) = 2004-12-31"-  , "2005-07-01 + 0 * month (roll over) = 2005-07-01"-  , "2005-04-21 + 0 * month (roll over) = 2005-04-21"-  , "2005-06-30 + 0 * month (roll over) = 2005-06-30"-  , "2005-02-28 + 1 * month (roll over) = 2005-03-28"-  , "2004-02-29 + 1 * month (roll over) = 2004-03-29"-  , "2004-01-31 + 1 * month (roll over) = 2004-03-02"-  , "2004-12-31 + 1 * month (roll over) = 2005-01-31"-  , "2005-07-01 + 1 * month (roll over) = 2005-08-01"-  , "2005-04-21 + 1 * month (roll over) = 2005-05-21"-  , "2005-06-30 + 1 * month (roll over) = 2005-07-30"-  , "2005-02-28 + 7 * month (roll over) = 2005-09-28"-  , "2004-02-29 + 7 * month (roll over) = 2004-09-29"-  , "2004-01-31 + 7 * month (roll over) = 2004-08-31"-  , "2004-12-31 + 7 * month (roll over) = 2005-07-31"-  , "2005-07-01 + 7 * month (roll over) = 2006-02-01"-  , "2005-04-21 + 7 * month (roll over) = 2005-11-21"-  , "2005-06-30 + 7 * month (roll over) = 2006-01-30"-  , "2005-02-28 + 83 * month (roll over) = 2012-01-28"-  , "2004-02-29 + 83 * month (roll over) = 2011-01-29"-  , "2004-01-31 + 83 * month (roll over) = 2010-12-31"-  , "2004-12-31 + 83 * month (roll over) = 2011-12-01"-  , "2005-07-01 + 83 * month (roll over) = 2012-06-01"-  , "2005-04-21 + 83 * month (roll over) = 2012-03-21"-  , "2005-06-30 + 83 * month (roll over) = 2012-05-30"-  , "2005-02-28 + -10 * year (clip) = 1995-02-28"-  , "2004-02-29 + -10 * year (clip) = 1994-02-28"-  , "2004-01-31 + -10 * year (clip) = 1994-01-31"-  , "2004-12-31 + -10 * year (clip) = 1994-12-31"-  , "2005-07-01 + -10 * year (clip) = 1995-07-01"-  , "2005-04-21 + -10 * year (clip) = 1995-04-21"-  , "2005-06-30 + -10 * year (clip) = 1995-06-30"-  , "2005-02-28 + -4 * year (clip) = 2001-02-28"-  , "2004-02-29 + -4 * year (clip) = 2000-02-29"-  , "2004-01-31 + -4 * year (clip) = 2000-01-31"-  , "2004-12-31 + -4 * year (clip) = 2000-12-31"-  , "2005-07-01 + -4 * year (clip) = 2001-07-01"-  , "2005-04-21 + -4 * year (clip) = 2001-04-21"-  , "2005-06-30 + -4 * year (clip) = 2001-06-30"-  , "2005-02-28 + -1 * year (clip) = 2004-02-28"-  , "2004-02-29 + -1 * year (clip) = 2003-02-28"-  , "2004-01-31 + -1 * year (clip) = 2003-01-31"-  , "2004-12-31 + -1 * year (clip) = 2003-12-31"-  , "2005-07-01 + -1 * year (clip) = 2004-07-01"-  , "2005-04-21 + -1 * year (clip) = 2004-04-21"-  , "2005-06-30 + -1 * year (clip) = 2004-06-30"-  , "2005-02-28 + 0 * year (clip) = 2005-02-28"-  , "2004-02-29 + 0 * year (clip) = 2004-02-29"-  , "2004-01-31 + 0 * year (clip) = 2004-01-31"-  , "2004-12-31 + 0 * year (clip) = 2004-12-31"-  , "2005-07-01 + 0 * year (clip) = 2005-07-01"-  , "2005-04-21 + 0 * year (clip) = 2005-04-21"-  , "2005-06-30 + 0 * year (clip) = 2005-06-30"-  , "2005-02-28 + 1 * year (clip) = 2006-02-28"-  , "2004-02-29 + 1 * year (clip) = 2005-02-28"-  , "2004-01-31 + 1 * year (clip) = 2005-01-31"-  , "2004-12-31 + 1 * year (clip) = 2005-12-31"-  , "2005-07-01 + 1 * year (clip) = 2006-07-01"-  , "2005-04-21 + 1 * year (clip) = 2006-04-21"-  , "2005-06-30 + 1 * year (clip) = 2006-06-30"-  , "2005-02-28 + 7 * year (clip) = 2012-02-28"-  , "2004-02-29 + 7 * year (clip) = 2011-02-28"-  , "2004-01-31 + 7 * year (clip) = 2011-01-31"-  , "2004-12-31 + 7 * year (clip) = 2011-12-31"-  , "2005-07-01 + 7 * year (clip) = 2012-07-01"-  , "2005-04-21 + 7 * year (clip) = 2012-04-21"-  , "2005-06-30 + 7 * year (clip) = 2012-06-30"-  , "2005-02-28 + 83 * year (clip) = 2088-02-28"-  , "2004-02-29 + 83 * year (clip) = 2087-02-28"-  , "2004-01-31 + 83 * year (clip) = 2087-01-31"-  , "2004-12-31 + 83 * year (clip) = 2087-12-31"-  , "2005-07-01 + 83 * year (clip) = 2088-07-01"-  , "2005-04-21 + 83 * year (clip) = 2088-04-21"-  , "2005-06-30 + 83 * year (clip) = 2088-06-30"-  , "2005-02-28 + -10 * year (roll over) = 1995-02-28"-  , "2004-02-29 + -10 * year (roll over) = 1994-03-01"-  , "2004-01-31 + -10 * year (roll over) = 1994-01-31"-  , "2004-12-31 + -10 * year (roll over) = 1994-12-31"-  , "2005-07-01 + -10 * year (roll over) = 1995-07-01"-  , "2005-04-21 + -10 * year (roll over) = 1995-04-21"-  , "2005-06-30 + -10 * year (roll over) = 1995-06-30"-  , "2005-02-28 + -4 * year (roll over) = 2001-02-28"-  , "2004-02-29 + -4 * year (roll over) = 2000-02-29"-  , "2004-01-31 + -4 * year (roll over) = 2000-01-31"-  , "2004-12-31 + -4 * year (roll over) = 2000-12-31"-  , "2005-07-01 + -4 * year (roll over) = 2001-07-01"-  , "2005-04-21 + -4 * year (roll over) = 2001-04-21"-  , "2005-06-30 + -4 * year (roll over) = 2001-06-30"-  , "2005-02-28 + -1 * year (roll over) = 2004-02-28"-  , "2004-02-29 + -1 * year (roll over) = 2003-03-01"-  , "2004-01-31 + -1 * year (roll over) = 2003-01-31"-  , "2004-12-31 + -1 * year (roll over) = 2003-12-31"-  , "2005-07-01 + -1 * year (roll over) = 2004-07-01"-  , "2005-04-21 + -1 * year (roll over) = 2004-04-21"-  , "2005-06-30 + -1 * year (roll over) = 2004-06-30"-  , "2005-02-28 + 0 * year (roll over) = 2005-02-28"-  , "2004-02-29 + 0 * year (roll over) = 2004-02-29"-  , "2004-01-31 + 0 * year (roll over) = 2004-01-31"-  , "2004-12-31 + 0 * year (roll over) = 2004-12-31"-  , "2005-07-01 + 0 * year (roll over) = 2005-07-01"-  , "2005-04-21 + 0 * year (roll over) = 2005-04-21"-  , "2005-06-30 + 0 * year (roll over) = 2005-06-30"-  , "2005-02-28 + 1 * year (roll over) = 2006-02-28"-  , "2004-02-29 + 1 * year (roll over) = 2005-03-01"-  , "2004-01-31 + 1 * year (roll over) = 2005-01-31"-  , "2004-12-31 + 1 * year (roll over) = 2005-12-31"-  , "2005-07-01 + 1 * year (roll over) = 2006-07-01"-  , "2005-04-21 + 1 * year (roll over) = 2006-04-21"-  , "2005-06-30 + 1 * year (roll over) = 2006-06-30"-  , "2005-02-28 + 7 * year (roll over) = 2012-02-28"-  , "2004-02-29 + 7 * year (roll over) = 2011-03-01"-  , "2004-01-31 + 7 * year (roll over) = 2011-01-31"-  , "2004-12-31 + 7 * year (roll over) = 2011-12-31"-  , "2005-07-01 + 7 * year (roll over) = 2012-07-01"-  , "2005-04-21 + 7 * year (roll over) = 2012-04-21"-  , "2005-06-30 + 7 * year (roll over) = 2012-06-30"-  , "2005-02-28 + 83 * year (roll over) = 2088-02-28"-  , "2004-02-29 + 83 * year (roll over) = 2087-03-01"-  , "2004-01-31 + 83 * year (roll over) = 2087-01-31"-  , "2004-12-31 + 83 * year (roll over) = 2087-12-31"-  , "2005-07-01 + 83 * year (roll over) = 2088-07-01"-  , "2005-04-21 + 83 * year (roll over) = 2088-04-21"-  , "2005-06-30 + 83 * year (roll over) = 2088-06-30" ]+    unlines+        [ "2005-02-28 + -10 * day = 2005-02-18"+        , "2004-02-29 + -10 * day = 2004-02-19"+        , "2004-01-31 + -10 * day = 2004-01-21"+        , "2004-12-31 + -10 * day = 2004-12-21"+        , "2005-07-01 + -10 * day = 2005-06-21"+        , "2005-04-21 + -10 * day = 2005-04-11"+        , "2005-06-30 + -10 * day = 2005-06-20"+        , "2005-02-28 + -4 * day = 2005-02-24"+        , "2004-02-29 + -4 * day = 2004-02-25"+        , "2004-01-31 + -4 * day = 2004-01-27"+        , "2004-12-31 + -4 * day = 2004-12-27"+        , "2005-07-01 + -4 * day = 2005-06-27"+        , "2005-04-21 + -4 * day = 2005-04-17"+        , "2005-06-30 + -4 * day = 2005-06-26"+        , "2005-02-28 + -1 * day = 2005-02-27"+        , "2004-02-29 + -1 * day = 2004-02-28"+        , "2004-01-31 + -1 * day = 2004-01-30"+        , "2004-12-31 + -1 * day = 2004-12-30"+        , "2005-07-01 + -1 * day = 2005-06-30"+        , "2005-04-21 + -1 * day = 2005-04-20"+        , "2005-06-30 + -1 * day = 2005-06-29"+        , "2005-02-28 + 0 * day = 2005-02-28"+        , "2004-02-29 + 0 * day = 2004-02-29"+        , "2004-01-31 + 0 * day = 2004-01-31"+        , "2004-12-31 + 0 * day = 2004-12-31"+        , "2005-07-01 + 0 * day = 2005-07-01"+        , "2005-04-21 + 0 * day = 2005-04-21"+        , "2005-06-30 + 0 * day = 2005-06-30"+        , "2005-02-28 + 1 * day = 2005-03-01"+        , "2004-02-29 + 1 * day = 2004-03-01"+        , "2004-01-31 + 1 * day = 2004-02-01"+        , "2004-12-31 + 1 * day = 2005-01-01"+        , "2005-07-01 + 1 * day = 2005-07-02"+        , "2005-04-21 + 1 * day = 2005-04-22"+        , "2005-06-30 + 1 * day = 2005-07-01"+        , "2005-02-28 + 7 * day = 2005-03-07"+        , "2004-02-29 + 7 * day = 2004-03-07"+        , "2004-01-31 + 7 * day = 2004-02-07"+        , "2004-12-31 + 7 * day = 2005-01-07"+        , "2005-07-01 + 7 * day = 2005-07-08"+        , "2005-04-21 + 7 * day = 2005-04-28"+        , "2005-06-30 + 7 * day = 2005-07-07"+        , "2005-02-28 + 83 * day = 2005-05-22"+        , "2004-02-29 + 83 * day = 2004-05-22"+        , "2004-01-31 + 83 * day = 2004-04-23"+        , "2004-12-31 + 83 * day = 2005-03-24"+        , "2005-07-01 + 83 * day = 2005-09-22"+        , "2005-04-21 + 83 * day = 2005-07-13"+        , "2005-06-30 + 83 * day = 2005-09-21"+        , "2005-02-28 + -10 * month (clip) = 2004-04-28"+        , "2004-02-29 + -10 * month (clip) = 2003-04-29"+        , "2004-01-31 + -10 * month (clip) = 2003-03-31"+        , "2004-12-31 + -10 * month (clip) = 2004-02-29"+        , "2005-07-01 + -10 * month (clip) = 2004-09-01"+        , "2005-04-21 + -10 * month (clip) = 2004-06-21"+        , "2005-06-30 + -10 * month (clip) = 2004-08-30"+        , "2005-02-28 + -4 * month (clip) = 2004-10-28"+        , "2004-02-29 + -4 * month (clip) = 2003-10-29"+        , "2004-01-31 + -4 * month (clip) = 2003-09-30"+        , "2004-12-31 + -4 * month (clip) = 2004-08-31"+        , "2005-07-01 + -4 * month (clip) = 2005-03-01"+        , "2005-04-21 + -4 * month (clip) = 2004-12-21"+        , "2005-06-30 + -4 * month (clip) = 2005-02-28"+        , "2005-02-28 + -1 * month (clip) = 2005-01-28"+        , "2004-02-29 + -1 * month (clip) = 2004-01-29"+        , "2004-01-31 + -1 * month (clip) = 2003-12-31"+        , "2004-12-31 + -1 * month (clip) = 2004-11-30"+        , "2005-07-01 + -1 * month (clip) = 2005-06-01"+        , "2005-04-21 + -1 * month (clip) = 2005-03-21"+        , "2005-06-30 + -1 * month (clip) = 2005-05-30"+        , "2005-02-28 + 0 * month (clip) = 2005-02-28"+        , "2004-02-29 + 0 * month (clip) = 2004-02-29"+        , "2004-01-31 + 0 * month (clip) = 2004-01-31"+        , "2004-12-31 + 0 * month (clip) = 2004-12-31"+        , "2005-07-01 + 0 * month (clip) = 2005-07-01"+        , "2005-04-21 + 0 * month (clip) = 2005-04-21"+        , "2005-06-30 + 0 * month (clip) = 2005-06-30"+        , "2005-02-28 + 1 * month (clip) = 2005-03-28"+        , "2004-02-29 + 1 * month (clip) = 2004-03-29"+        , "2004-01-31 + 1 * month (clip) = 2004-02-29"+        , "2004-12-31 + 1 * month (clip) = 2005-01-31"+        , "2005-07-01 + 1 * month (clip) = 2005-08-01"+        , "2005-04-21 + 1 * month (clip) = 2005-05-21"+        , "2005-06-30 + 1 * month (clip) = 2005-07-30"+        , "2005-02-28 + 7 * month (clip) = 2005-09-28"+        , "2004-02-29 + 7 * month (clip) = 2004-09-29"+        , "2004-01-31 + 7 * month (clip) = 2004-08-31"+        , "2004-12-31 + 7 * month (clip) = 2005-07-31"+        , "2005-07-01 + 7 * month (clip) = 2006-02-01"+        , "2005-04-21 + 7 * month (clip) = 2005-11-21"+        , "2005-06-30 + 7 * month (clip) = 2006-01-30"+        , "2005-02-28 + 83 * month (clip) = 2012-01-28"+        , "2004-02-29 + 83 * month (clip) = 2011-01-29"+        , "2004-01-31 + 83 * month (clip) = 2010-12-31"+        , "2004-12-31 + 83 * month (clip) = 2011-11-30"+        , "2005-07-01 + 83 * month (clip) = 2012-06-01"+        , "2005-04-21 + 83 * month (clip) = 2012-03-21"+        , "2005-06-30 + 83 * month (clip) = 2012-05-30"+        , "2005-02-28 + -10 * month (roll over) = 2004-04-28"+        , "2004-02-29 + -10 * month (roll over) = 2003-04-29"+        , "2004-01-31 + -10 * month (roll over) = 2003-03-31"+        , "2004-12-31 + -10 * month (roll over) = 2004-03-02"+        , "2005-07-01 + -10 * month (roll over) = 2004-09-01"+        , "2005-04-21 + -10 * month (roll over) = 2004-06-21"+        , "2005-06-30 + -10 * month (roll over) = 2004-08-30"+        , "2005-02-28 + -4 * month (roll over) = 2004-10-28"+        , "2004-02-29 + -4 * month (roll over) = 2003-10-29"+        , "2004-01-31 + -4 * month (roll over) = 2003-10-01"+        , "2004-12-31 + -4 * month (roll over) = 2004-08-31"+        , "2005-07-01 + -4 * month (roll over) = 2005-03-01"+        , "2005-04-21 + -4 * month (roll over) = 2004-12-21"+        , "2005-06-30 + -4 * month (roll over) = 2005-03-02"+        , "2005-02-28 + -1 * month (roll over) = 2005-01-28"+        , "2004-02-29 + -1 * month (roll over) = 2004-01-29"+        , "2004-01-31 + -1 * month (roll over) = 2003-12-31"+        , "2004-12-31 + -1 * month (roll over) = 2004-12-01"+        , "2005-07-01 + -1 * month (roll over) = 2005-06-01"+        , "2005-04-21 + -1 * month (roll over) = 2005-03-21"+        , "2005-06-30 + -1 * month (roll over) = 2005-05-30"+        , "2005-02-28 + 0 * month (roll over) = 2005-02-28"+        , "2004-02-29 + 0 * month (roll over) = 2004-02-29"+        , "2004-01-31 + 0 * month (roll over) = 2004-01-31"+        , "2004-12-31 + 0 * month (roll over) = 2004-12-31"+        , "2005-07-01 + 0 * month (roll over) = 2005-07-01"+        , "2005-04-21 + 0 * month (roll over) = 2005-04-21"+        , "2005-06-30 + 0 * month (roll over) = 2005-06-30"+        , "2005-02-28 + 1 * month (roll over) = 2005-03-28"+        , "2004-02-29 + 1 * month (roll over) = 2004-03-29"+        , "2004-01-31 + 1 * month (roll over) = 2004-03-02"+        , "2004-12-31 + 1 * month (roll over) = 2005-01-31"+        , "2005-07-01 + 1 * month (roll over) = 2005-08-01"+        , "2005-04-21 + 1 * month (roll over) = 2005-05-21"+        , "2005-06-30 + 1 * month (roll over) = 2005-07-30"+        , "2005-02-28 + 7 * month (roll over) = 2005-09-28"+        , "2004-02-29 + 7 * month (roll over) = 2004-09-29"+        , "2004-01-31 + 7 * month (roll over) = 2004-08-31"+        , "2004-12-31 + 7 * month (roll over) = 2005-07-31"+        , "2005-07-01 + 7 * month (roll over) = 2006-02-01"+        , "2005-04-21 + 7 * month (roll over) = 2005-11-21"+        , "2005-06-30 + 7 * month (roll over) = 2006-01-30"+        , "2005-02-28 + 83 * month (roll over) = 2012-01-28"+        , "2004-02-29 + 83 * month (roll over) = 2011-01-29"+        , "2004-01-31 + 83 * month (roll over) = 2010-12-31"+        , "2004-12-31 + 83 * month (roll over) = 2011-12-01"+        , "2005-07-01 + 83 * month (roll over) = 2012-06-01"+        , "2005-04-21 + 83 * month (roll over) = 2012-03-21"+        , "2005-06-30 + 83 * month (roll over) = 2012-05-30"+        , "2005-02-28 + -10 * year (clip) = 1995-02-28"+        , "2004-02-29 + -10 * year (clip) = 1994-02-28"+        , "2004-01-31 + -10 * year (clip) = 1994-01-31"+        , "2004-12-31 + -10 * year (clip) = 1994-12-31"+        , "2005-07-01 + -10 * year (clip) = 1995-07-01"+        , "2005-04-21 + -10 * year (clip) = 1995-04-21"+        , "2005-06-30 + -10 * year (clip) = 1995-06-30"+        , "2005-02-28 + -4 * year (clip) = 2001-02-28"+        , "2004-02-29 + -4 * year (clip) = 2000-02-29"+        , "2004-01-31 + -4 * year (clip) = 2000-01-31"+        , "2004-12-31 + -4 * year (clip) = 2000-12-31"+        , "2005-07-01 + -4 * year (clip) = 2001-07-01"+        , "2005-04-21 + -4 * year (clip) = 2001-04-21"+        , "2005-06-30 + -4 * year (clip) = 2001-06-30"+        , "2005-02-28 + -1 * year (clip) = 2004-02-28"+        , "2004-02-29 + -1 * year (clip) = 2003-02-28"+        , "2004-01-31 + -1 * year (clip) = 2003-01-31"+        , "2004-12-31 + -1 * year (clip) = 2003-12-31"+        , "2005-07-01 + -1 * year (clip) = 2004-07-01"+        , "2005-04-21 + -1 * year (clip) = 2004-04-21"+        , "2005-06-30 + -1 * year (clip) = 2004-06-30"+        , "2005-02-28 + 0 * year (clip) = 2005-02-28"+        , "2004-02-29 + 0 * year (clip) = 2004-02-29"+        , "2004-01-31 + 0 * year (clip) = 2004-01-31"+        , "2004-12-31 + 0 * year (clip) = 2004-12-31"+        , "2005-07-01 + 0 * year (clip) = 2005-07-01"+        , "2005-04-21 + 0 * year (clip) = 2005-04-21"+        , "2005-06-30 + 0 * year (clip) = 2005-06-30"+        , "2005-02-28 + 1 * year (clip) = 2006-02-28"+        , "2004-02-29 + 1 * year (clip) = 2005-02-28"+        , "2004-01-31 + 1 * year (clip) = 2005-01-31"+        , "2004-12-31 + 1 * year (clip) = 2005-12-31"+        , "2005-07-01 + 1 * year (clip) = 2006-07-01"+        , "2005-04-21 + 1 * year (clip) = 2006-04-21"+        , "2005-06-30 + 1 * year (clip) = 2006-06-30"+        , "2005-02-28 + 7 * year (clip) = 2012-02-28"+        , "2004-02-29 + 7 * year (clip) = 2011-02-28"+        , "2004-01-31 + 7 * year (clip) = 2011-01-31"+        , "2004-12-31 + 7 * year (clip) = 2011-12-31"+        , "2005-07-01 + 7 * year (clip) = 2012-07-01"+        , "2005-04-21 + 7 * year (clip) = 2012-04-21"+        , "2005-06-30 + 7 * year (clip) = 2012-06-30"+        , "2005-02-28 + 83 * year (clip) = 2088-02-28"+        , "2004-02-29 + 83 * year (clip) = 2087-02-28"+        , "2004-01-31 + 83 * year (clip) = 2087-01-31"+        , "2004-12-31 + 83 * year (clip) = 2087-12-31"+        , "2005-07-01 + 83 * year (clip) = 2088-07-01"+        , "2005-04-21 + 83 * year (clip) = 2088-04-21"+        , "2005-06-30 + 83 * year (clip) = 2088-06-30"+        , "2005-02-28 + -10 * year (roll over) = 1995-02-28"+        , "2004-02-29 + -10 * year (roll over) = 1994-03-01"+        , "2004-01-31 + -10 * year (roll over) = 1994-01-31"+        , "2004-12-31 + -10 * year (roll over) = 1994-12-31"+        , "2005-07-01 + -10 * year (roll over) = 1995-07-01"+        , "2005-04-21 + -10 * year (roll over) = 1995-04-21"+        , "2005-06-30 + -10 * year (roll over) = 1995-06-30"+        , "2005-02-28 + -4 * year (roll over) = 2001-02-28"+        , "2004-02-29 + -4 * year (roll over) = 2000-02-29"+        , "2004-01-31 + -4 * year (roll over) = 2000-01-31"+        , "2004-12-31 + -4 * year (roll over) = 2000-12-31"+        , "2005-07-01 + -4 * year (roll over) = 2001-07-01"+        , "2005-04-21 + -4 * year (roll over) = 2001-04-21"+        , "2005-06-30 + -4 * year (roll over) = 2001-06-30"+        , "2005-02-28 + -1 * year (roll over) = 2004-02-28"+        , "2004-02-29 + -1 * year (roll over) = 2003-03-01"+        , "2004-01-31 + -1 * year (roll over) = 2003-01-31"+        , "2004-12-31 + -1 * year (roll over) = 2003-12-31"+        , "2005-07-01 + -1 * year (roll over) = 2004-07-01"+        , "2005-04-21 + -1 * year (roll over) = 2004-04-21"+        , "2005-06-30 + -1 * year (roll over) = 2004-06-30"+        , "2005-02-28 + 0 * year (roll over) = 2005-02-28"+        , "2004-02-29 + 0 * year (roll over) = 2004-02-29"+        , "2004-01-31 + 0 * year (roll over) = 2004-01-31"+        , "2004-12-31 + 0 * year (roll over) = 2004-12-31"+        , "2005-07-01 + 0 * year (roll over) = 2005-07-01"+        , "2005-04-21 + 0 * year (roll over) = 2005-04-21"+        , "2005-06-30 + 0 * year (roll over) = 2005-06-30"+        , "2005-02-28 + 1 * year (roll over) = 2006-02-28"+        , "2004-02-29 + 1 * year (roll over) = 2005-03-01"+        , "2004-01-31 + 1 * year (roll over) = 2005-01-31"+        , "2004-12-31 + 1 * year (roll over) = 2005-12-31"+        , "2005-07-01 + 1 * year (roll over) = 2006-07-01"+        , "2005-04-21 + 1 * year (roll over) = 2006-04-21"+        , "2005-06-30 + 1 * year (roll over) = 2006-06-30"+        , "2005-02-28 + 7 * year (roll over) = 2012-02-28"+        , "2004-02-29 + 7 * year (roll over) = 2011-03-01"+        , "2004-01-31 + 7 * year (roll over) = 2011-01-31"+        , "2004-12-31 + 7 * year (roll over) = 2011-12-31"+        , "2005-07-01 + 7 * year (roll over) = 2012-07-01"+        , "2005-04-21 + 7 * year (roll over) = 2012-04-21"+        , "2005-06-30 + 7 * year (roll over) = 2012-06-30"+        , "2005-02-28 + 83 * year (roll over) = 2088-02-28"+        , "2004-02-29 + 83 * year (roll over) = 2087-03-01"+        , "2004-01-31 + 83 * year (roll over) = 2087-01-31"+        , "2004-12-31 + 83 * year (roll over) = 2087-12-31"+        , "2005-07-01 + 83 * year (roll over) = 2088-07-01"+        , "2005-04-21 + 83 * year (roll over) = 2088-04-21"+        , "2005-06-30 + 83 * year (roll over) = 2088-06-30"+        ]
test/main/Test/Calendar/Calendars.hs view
@@ -1,31 +1,26 @@-module Test.Calendar.Calendars(testCalendars) where+module Test.Calendar.Calendars+    ( testCalendars+    ) where +import Data.Time.Calendar import Data.Time.Calendar.Julian import Data.Time.Calendar.WeekDate-import Data.Time.Calendar+import Test.Calendar.CalendarsRef import Test.Tasty import Test.Tasty.HUnit-import Test.Calendar.CalendarsRef -showers :: [(String,Day -> String)]-showers = [-    ("MJD",show . toModifiedJulianDay),-    ("Gregorian",showGregorian),-    ("Julian",showJulian),-    ("ISO 8601",showWeekDate)+showers :: [(String, Day -> String)]+showers =+    [ ("MJD", show . toModifiedJulianDay)+    , ("Gregorian", showGregorian)+    , ("Julian", showJulian)+    , ("ISO 8601", showWeekDate)     ]  days :: [Day]-days = [-    fromGregorian 0 12 31,-    fromJulian 1752 9 2,-    fromGregorian 1752 9 14,-    fromGregorian 2005 1 23-    ]+days = [fromGregorian 0 12 31, fromJulian 1752 9 2, fromGregorian 1752 9 14, fromGregorian 2005 1 23]  testCalendars :: TestTree-testCalendars = testCase "testCalendars" $-    assertEqual "" testCalendarsRef $ unlines $ map (\d -> showShowers d) days+testCalendars = testCase "testCalendars" $ assertEqual "" testCalendarsRef $ unlines $ map (\d -> showShowers d) days   where-    showShowers day =-        concatMap (\(nm,shower) -> unwords [" ==", nm, shower day]) showers+    showShowers day = concatMap (\(nm, shower) -> unwords [" ==", nm, shower day]) showers
test/main/Test/Calendar/CalendarsRef.hs view
@@ -2,8 +2,9 @@  testCalendarsRef :: String testCalendarsRef =- unlines-  [ " == MJD -678576 == Gregorian 0000-12-31 == Julian 0001-01-02 == ISO 8601 0000-W52-7"-  , " == MJD -38780 == Gregorian 1752-09-13 == Julian 1752-09-02 == ISO 8601 1752-W37-3"-  , " == MJD -38779 == Gregorian 1752-09-14 == Julian 1752-09-03 == ISO 8601 1752-W37-4"-  , " == MJD 53393 == Gregorian 2005-01-23 == Julian 2005-01-10 == ISO 8601 2005-W03-7" ]+    unlines+        [ " == MJD -678576 == Gregorian 0000-12-31 == Julian 0001-01-02 == ISO 8601 0000-W52-7"+        , " == MJD -38780 == Gregorian 1752-09-13 == Julian 1752-09-02 == ISO 8601 1752-W37-3"+        , " == MJD -38779 == Gregorian 1752-09-14 == Julian 1752-09-03 == ISO 8601 1752-W37-4"+        , " == MJD 53393 == Gregorian 2005-01-23 == Julian 2005-01-10 == ISO 8601 2005-W03-7"+        ]
test/main/Test/Calendar/ClipDates.hs view
@@ -1,45 +1,43 @@-module Test.Calendar.ClipDates(clipDates) where+module Test.Calendar.ClipDates+    ( clipDates+    ) where +import Data.Time.Calendar import Data.Time.Calendar.OrdinalDate import Data.Time.Calendar.WeekDate-import Data.Time.Calendar+import Test.Calendar.ClipDatesRef import Test.Tasty import Test.Tasty.HUnit-import Test.Calendar.ClipDatesRef -yearAndDay :: (Integer,Int) -> String-yearAndDay (y,d) = (show y) ++ "-" ++ (show d) ++ " = " ++ (showOrdinalDate (fromOrdinalDate y d))+yearAndDay :: (Integer, Int) -> String+yearAndDay (y, d) = (show y) ++ "-" ++ (show d) ++ " = " ++ (showOrdinalDate (fromOrdinalDate y d)) -gregorian :: (Integer,Int,Int) -> String-gregorian (y,m,d) = (show y) ++ "-" ++ (show m) ++ "-" ++ (show d) ++ " = " ++ (showGregorian (fromGregorian y m d))+gregorian :: (Integer, Int, Int) -> String+gregorian (y, m, d) = (show y) ++ "-" ++ (show m) ++ "-" ++ (show d) ++ " = " ++ (showGregorian (fromGregorian y m d)) -iSOWeekDay :: (Integer,Int,Int) -> String-iSOWeekDay (y,w,d) = (show y) ++ "-W" ++ (show w) ++ "-" ++ (show d) ++ " = " ++ (showWeekDate (fromWeekDate y w d))+iSOWeekDay :: (Integer, Int, Int) -> String+iSOWeekDay (y, w, d) = (show y) ++ "-W" ++ (show w) ++ "-" ++ (show d) ++ " = " ++ (showWeekDate (fromWeekDate y w d))  --- tupleUp2 :: [a] -> [b] -> [(a, b)]-tupleUp2 l1 l2 = concatMap (\e -> map (e,) l2) l1+tupleUp2 l1 l2 = concatMap (\e -> map (e, ) l2) l1  tupleUp3 :: [a] -> [b] -> [c] -> [(a, b, c)]-tupleUp3 l1 l2 l3-  = let ts = tupleUp2 l2 l3+tupleUp3 l1 l2 l3 = let+    ts = tupleUp2 l2 l3     in concatMap (\e -> map (\(f, g) -> (e, f, g)) ts) l1  --- clipDates :: TestTree-clipDates = testCase "clipDates" $-    let-        yad  = unlines $ map yearAndDay $-            tupleUp2 [1968,1969,1971] [-4,0,1,200,364,365,366,367,700]---        greg = unlines $ map gregorian $-            tupleUp3 [1968,1969,1971] [-20,-1,0,1,2,12,13,17] [-7,-1,0,1,2,27,28,29,30,31,32,40]--        iso  = unlines $ map iSOWeekDay $-            tupleUp3 [1968,1969,2004] [-20,-1,0,1,20,51,52,53,54] [-2,-1,0,1,4,6,7,8,9]--    in assertEqual "" clipDatesRef $-        concat [ "YearAndDay\n", yad, "Gregorian\n", greg, "ISOWeekDay\n", iso ]+clipDates =+    testCase "clipDates" $ let+        yad = unlines $ map yearAndDay $ tupleUp2 [1968, 1969, 1971] [-4, 0, 1, 200, 364, 365, 366, 367, 700]+        greg =+            unlines $+            map gregorian $+            tupleUp3 [1968, 1969, 1971] [-20, -1, 0, 1, 2, 12, 13, 17] [-7, -1, 0, 1, 2, 27, 28, 29, 30, 31, 32, 40]+        iso =+            unlines $+            map iSOWeekDay $+            tupleUp3 [1968, 1969, 2004] [-20, -1, 0, 1, 20, 51, 52, 53, 54] [-2, -1, 0, 1, 4, 6, 7, 8, 9]+        in assertEqual "" clipDatesRef $ concat ["YearAndDay\n", yad, "Gregorian\n", greg, "ISOWeekDay\n", iso]
test/main/Test/Calendar/ClipDatesRef.hs view
@@ -2,565 +2,566 @@  clipDatesRef :: String clipDatesRef =- unlines-  [ "YearAndDay"-  , "1968--4 = 1968-001"-  , "1968-0 = 1968-001"-  , "1968-1 = 1968-001"-  , "1968-200 = 1968-200"-  , "1968-364 = 1968-364"-  , "1968-365 = 1968-365"-  , "1968-366 = 1968-366"-  , "1968-367 = 1968-366"-  , "1968-700 = 1968-366"-  , "1969--4 = 1969-001"-  , "1969-0 = 1969-001"-  , "1969-1 = 1969-001"-  , "1969-200 = 1969-200"-  , "1969-364 = 1969-364"-  , "1969-365 = 1969-365"-  , "1969-366 = 1969-365"-  , "1969-367 = 1969-365"-  , "1969-700 = 1969-365"-  , "1971--4 = 1971-001"-  , "1971-0 = 1971-001"-  , "1971-1 = 1971-001"-  , "1971-200 = 1971-200"-  , "1971-364 = 1971-364"-  , "1971-365 = 1971-365"-  , "1971-366 = 1971-365"-  , "1971-367 = 1971-365"-  , "1971-700 = 1971-365"-  , "Gregorian"-  , "1968--20--7 = 1968-01-01"-  , "1968--20--1 = 1968-01-01"-  , "1968--20-0 = 1968-01-01"-  , "1968--20-1 = 1968-01-01"-  , "1968--20-2 = 1968-01-02"-  , "1968--20-27 = 1968-01-27"-  , "1968--20-28 = 1968-01-28"-  , "1968--20-29 = 1968-01-29"-  , "1968--20-30 = 1968-01-30"-  , "1968--20-31 = 1968-01-31"-  , "1968--20-32 = 1968-01-31"-  , "1968--20-40 = 1968-01-31"-  , "1968--1--7 = 1968-01-01"-  , "1968--1--1 = 1968-01-01"-  , "1968--1-0 = 1968-01-01"-  , "1968--1-1 = 1968-01-01"-  , "1968--1-2 = 1968-01-02"-  , "1968--1-27 = 1968-01-27"-  , "1968--1-28 = 1968-01-28"-  , "1968--1-29 = 1968-01-29"-  , "1968--1-30 = 1968-01-30"-  , "1968--1-31 = 1968-01-31"-  , "1968--1-32 = 1968-01-31"-  , "1968--1-40 = 1968-01-31"-  , "1968-0--7 = 1968-01-01"-  , "1968-0--1 = 1968-01-01"-  , "1968-0-0 = 1968-01-01"-  , "1968-0-1 = 1968-01-01"-  , "1968-0-2 = 1968-01-02"-  , "1968-0-27 = 1968-01-27"-  , "1968-0-28 = 1968-01-28"-  , "1968-0-29 = 1968-01-29"-  , "1968-0-30 = 1968-01-30"-  , "1968-0-31 = 1968-01-31"-  , "1968-0-32 = 1968-01-31"-  , "1968-0-40 = 1968-01-31"-  , "1968-1--7 = 1968-01-01"-  , "1968-1--1 = 1968-01-01"-  , "1968-1-0 = 1968-01-01"-  , "1968-1-1 = 1968-01-01"-  , "1968-1-2 = 1968-01-02"-  , "1968-1-27 = 1968-01-27"-  , "1968-1-28 = 1968-01-28"-  , "1968-1-29 = 1968-01-29"-  , "1968-1-30 = 1968-01-30"-  , "1968-1-31 = 1968-01-31"-  , "1968-1-32 = 1968-01-31"-  , "1968-1-40 = 1968-01-31"-  , "1968-2--7 = 1968-02-01"-  , "1968-2--1 = 1968-02-01"-  , "1968-2-0 = 1968-02-01"-  , "1968-2-1 = 1968-02-01"-  , "1968-2-2 = 1968-02-02"-  , "1968-2-27 = 1968-02-27"-  , "1968-2-28 = 1968-02-28"-  , "1968-2-29 = 1968-02-29"-  , "1968-2-30 = 1968-02-29"-  , "1968-2-31 = 1968-02-29"-  , "1968-2-32 = 1968-02-29"-  , "1968-2-40 = 1968-02-29"-  , "1968-12--7 = 1968-12-01"-  , "1968-12--1 = 1968-12-01"-  , "1968-12-0 = 1968-12-01"-  , "1968-12-1 = 1968-12-01"-  , "1968-12-2 = 1968-12-02"-  , "1968-12-27 = 1968-12-27"-  , "1968-12-28 = 1968-12-28"-  , "1968-12-29 = 1968-12-29"-  , "1968-12-30 = 1968-12-30"-  , "1968-12-31 = 1968-12-31"-  , "1968-12-32 = 1968-12-31"-  , "1968-12-40 = 1968-12-31"-  , "1968-13--7 = 1968-12-01"-  , "1968-13--1 = 1968-12-01"-  , "1968-13-0 = 1968-12-01"-  , "1968-13-1 = 1968-12-01"-  , "1968-13-2 = 1968-12-02"-  , "1968-13-27 = 1968-12-27"-  , "1968-13-28 = 1968-12-28"-  , "1968-13-29 = 1968-12-29"-  , "1968-13-30 = 1968-12-30"-  , "1968-13-31 = 1968-12-31"-  , "1968-13-32 = 1968-12-31"-  , "1968-13-40 = 1968-12-31"-  , "1968-17--7 = 1968-12-01"-  , "1968-17--1 = 1968-12-01"-  , "1968-17-0 = 1968-12-01"-  , "1968-17-1 = 1968-12-01"-  , "1968-17-2 = 1968-12-02"-  , "1968-17-27 = 1968-12-27"-  , "1968-17-28 = 1968-12-28"-  , "1968-17-29 = 1968-12-29"-  , "1968-17-30 = 1968-12-30"-  , "1968-17-31 = 1968-12-31"-  , "1968-17-32 = 1968-12-31"-  , "1968-17-40 = 1968-12-31"-  , "1969--20--7 = 1969-01-01"-  , "1969--20--1 = 1969-01-01"-  , "1969--20-0 = 1969-01-01"-  , "1969--20-1 = 1969-01-01"-  , "1969--20-2 = 1969-01-02"-  , "1969--20-27 = 1969-01-27"-  , "1969--20-28 = 1969-01-28"-  , "1969--20-29 = 1969-01-29"-  , "1969--20-30 = 1969-01-30"-  , "1969--20-31 = 1969-01-31"-  , "1969--20-32 = 1969-01-31"-  , "1969--20-40 = 1969-01-31"-  , "1969--1--7 = 1969-01-01"-  , "1969--1--1 = 1969-01-01"-  , "1969--1-0 = 1969-01-01"-  , "1969--1-1 = 1969-01-01"-  , "1969--1-2 = 1969-01-02"-  , "1969--1-27 = 1969-01-27"-  , "1969--1-28 = 1969-01-28"-  , "1969--1-29 = 1969-01-29"-  , "1969--1-30 = 1969-01-30"-  , "1969--1-31 = 1969-01-31"-  , "1969--1-32 = 1969-01-31"-  , "1969--1-40 = 1969-01-31"-  , "1969-0--7 = 1969-01-01"-  , "1969-0--1 = 1969-01-01"-  , "1969-0-0 = 1969-01-01"-  , "1969-0-1 = 1969-01-01"-  , "1969-0-2 = 1969-01-02"-  , "1969-0-27 = 1969-01-27"-  , "1969-0-28 = 1969-01-28"-  , "1969-0-29 = 1969-01-29"-  , "1969-0-30 = 1969-01-30"-  , "1969-0-31 = 1969-01-31"-  , "1969-0-32 = 1969-01-31"-  , "1969-0-40 = 1969-01-31"-  , "1969-1--7 = 1969-01-01"-  , "1969-1--1 = 1969-01-01"-  , "1969-1-0 = 1969-01-01"-  , "1969-1-1 = 1969-01-01"-  , "1969-1-2 = 1969-01-02"-  , "1969-1-27 = 1969-01-27"-  , "1969-1-28 = 1969-01-28"-  , "1969-1-29 = 1969-01-29"-  , "1969-1-30 = 1969-01-30"-  , "1969-1-31 = 1969-01-31"-  , "1969-1-32 = 1969-01-31"-  , "1969-1-40 = 1969-01-31"-  , "1969-2--7 = 1969-02-01"-  , "1969-2--1 = 1969-02-01"-  , "1969-2-0 = 1969-02-01"-  , "1969-2-1 = 1969-02-01"-  , "1969-2-2 = 1969-02-02"-  , "1969-2-27 = 1969-02-27"-  , "1969-2-28 = 1969-02-28"-  , "1969-2-29 = 1969-02-28"-  , "1969-2-30 = 1969-02-28"-  , "1969-2-31 = 1969-02-28"-  , "1969-2-32 = 1969-02-28"-  , "1969-2-40 = 1969-02-28"-  , "1969-12--7 = 1969-12-01"-  , "1969-12--1 = 1969-12-01"-  , "1969-12-0 = 1969-12-01"-  , "1969-12-1 = 1969-12-01"-  , "1969-12-2 = 1969-12-02"-  , "1969-12-27 = 1969-12-27"-  , "1969-12-28 = 1969-12-28"-  , "1969-12-29 = 1969-12-29"-  , "1969-12-30 = 1969-12-30"-  , "1969-12-31 = 1969-12-31"-  , "1969-12-32 = 1969-12-31"-  , "1969-12-40 = 1969-12-31"-  , "1969-13--7 = 1969-12-01"-  , "1969-13--1 = 1969-12-01"-  , "1969-13-0 = 1969-12-01"-  , "1969-13-1 = 1969-12-01"-  , "1969-13-2 = 1969-12-02"-  , "1969-13-27 = 1969-12-27"-  , "1969-13-28 = 1969-12-28"-  , "1969-13-29 = 1969-12-29"-  , "1969-13-30 = 1969-12-30"-  , "1969-13-31 = 1969-12-31"-  , "1969-13-32 = 1969-12-31"-  , "1969-13-40 = 1969-12-31"-  , "1969-17--7 = 1969-12-01"-  , "1969-17--1 = 1969-12-01"-  , "1969-17-0 = 1969-12-01"-  , "1969-17-1 = 1969-12-01"-  , "1969-17-2 = 1969-12-02"-  , "1969-17-27 = 1969-12-27"-  , "1969-17-28 = 1969-12-28"-  , "1969-17-29 = 1969-12-29"-  , "1969-17-30 = 1969-12-30"-  , "1969-17-31 = 1969-12-31"-  , "1969-17-32 = 1969-12-31"-  , "1969-17-40 = 1969-12-31"-  , "1971--20--7 = 1971-01-01"-  , "1971--20--1 = 1971-01-01"-  , "1971--20-0 = 1971-01-01"-  , "1971--20-1 = 1971-01-01"-  , "1971--20-2 = 1971-01-02"-  , "1971--20-27 = 1971-01-27"-  , "1971--20-28 = 1971-01-28"-  , "1971--20-29 = 1971-01-29"-  , "1971--20-30 = 1971-01-30"-  , "1971--20-31 = 1971-01-31"-  , "1971--20-32 = 1971-01-31"-  , "1971--20-40 = 1971-01-31"-  , "1971--1--7 = 1971-01-01"-  , "1971--1--1 = 1971-01-01"-  , "1971--1-0 = 1971-01-01"-  , "1971--1-1 = 1971-01-01"-  , "1971--1-2 = 1971-01-02"-  , "1971--1-27 = 1971-01-27"-  , "1971--1-28 = 1971-01-28"-  , "1971--1-29 = 1971-01-29"-  , "1971--1-30 = 1971-01-30"-  , "1971--1-31 = 1971-01-31"-  , "1971--1-32 = 1971-01-31"-  , "1971--1-40 = 1971-01-31"-  , "1971-0--7 = 1971-01-01"-  , "1971-0--1 = 1971-01-01"-  , "1971-0-0 = 1971-01-01"-  , "1971-0-1 = 1971-01-01"-  , "1971-0-2 = 1971-01-02"-  , "1971-0-27 = 1971-01-27"-  , "1971-0-28 = 1971-01-28"-  , "1971-0-29 = 1971-01-29"-  , "1971-0-30 = 1971-01-30"-  , "1971-0-31 = 1971-01-31"-  , "1971-0-32 = 1971-01-31"-  , "1971-0-40 = 1971-01-31"-  , "1971-1--7 = 1971-01-01"-  , "1971-1--1 = 1971-01-01"-  , "1971-1-0 = 1971-01-01"-  , "1971-1-1 = 1971-01-01"-  , "1971-1-2 = 1971-01-02"-  , "1971-1-27 = 1971-01-27"-  , "1971-1-28 = 1971-01-28"-  , "1971-1-29 = 1971-01-29"-  , "1971-1-30 = 1971-01-30"-  , "1971-1-31 = 1971-01-31"-  , "1971-1-32 = 1971-01-31"-  , "1971-1-40 = 1971-01-31"-  , "1971-2--7 = 1971-02-01"-  , "1971-2--1 = 1971-02-01"-  , "1971-2-0 = 1971-02-01"-  , "1971-2-1 = 1971-02-01"-  , "1971-2-2 = 1971-02-02"-  , "1971-2-27 = 1971-02-27"-  , "1971-2-28 = 1971-02-28"-  , "1971-2-29 = 1971-02-28"-  , "1971-2-30 = 1971-02-28"-  , "1971-2-31 = 1971-02-28"-  , "1971-2-32 = 1971-02-28"-  , "1971-2-40 = 1971-02-28"-  , "1971-12--7 = 1971-12-01"-  , "1971-12--1 = 1971-12-01"-  , "1971-12-0 = 1971-12-01"-  , "1971-12-1 = 1971-12-01"-  , "1971-12-2 = 1971-12-02"-  , "1971-12-27 = 1971-12-27"-  , "1971-12-28 = 1971-12-28"-  , "1971-12-29 = 1971-12-29"-  , "1971-12-30 = 1971-12-30"-  , "1971-12-31 = 1971-12-31"-  , "1971-12-32 = 1971-12-31"-  , "1971-12-40 = 1971-12-31"-  , "1971-13--7 = 1971-12-01"-  , "1971-13--1 = 1971-12-01"-  , "1971-13-0 = 1971-12-01"-  , "1971-13-1 = 1971-12-01"-  , "1971-13-2 = 1971-12-02"-  , "1971-13-27 = 1971-12-27"-  , "1971-13-28 = 1971-12-28"-  , "1971-13-29 = 1971-12-29"-  , "1971-13-30 = 1971-12-30"-  , "1971-13-31 = 1971-12-31"-  , "1971-13-32 = 1971-12-31"-  , "1971-13-40 = 1971-12-31"-  , "1971-17--7 = 1971-12-01"-  , "1971-17--1 = 1971-12-01"-  , "1971-17-0 = 1971-12-01"-  , "1971-17-1 = 1971-12-01"-  , "1971-17-2 = 1971-12-02"-  , "1971-17-27 = 1971-12-27"-  , "1971-17-28 = 1971-12-28"-  , "1971-17-29 = 1971-12-29"-  , "1971-17-30 = 1971-12-30"-  , "1971-17-31 = 1971-12-31"-  , "1971-17-32 = 1971-12-31"-  , "1971-17-40 = 1971-12-31"-  , "ISOWeekDay"-  , "1968-W-20--2 = 1968-W01-1"-  , "1968-W-20--1 = 1968-W01-1"-  , "1968-W-20-0 = 1968-W01-1"-  , "1968-W-20-1 = 1968-W01-1"-  , "1968-W-20-4 = 1968-W01-4"-  , "1968-W-20-6 = 1968-W01-6"-  , "1968-W-20-7 = 1968-W01-7"-  , "1968-W-20-8 = 1968-W01-7"-  , "1968-W-20-9 = 1968-W01-7"-  , "1968-W-1--2 = 1968-W01-1"-  , "1968-W-1--1 = 1968-W01-1"-  , "1968-W-1-0 = 1968-W01-1"-  , "1968-W-1-1 = 1968-W01-1"-  , "1968-W-1-4 = 1968-W01-4"-  , "1968-W-1-6 = 1968-W01-6"-  , "1968-W-1-7 = 1968-W01-7"-  , "1968-W-1-8 = 1968-W01-7"-  , "1968-W-1-9 = 1968-W01-7"-  , "1968-W0--2 = 1968-W01-1"-  , "1968-W0--1 = 1968-W01-1"-  , "1968-W0-0 = 1968-W01-1"-  , "1968-W0-1 = 1968-W01-1"-  , "1968-W0-4 = 1968-W01-4"-  , "1968-W0-6 = 1968-W01-6"-  , "1968-W0-7 = 1968-W01-7"-  , "1968-W0-8 = 1968-W01-7"-  , "1968-W0-9 = 1968-W01-7"-  , "1968-W1--2 = 1968-W01-1"-  , "1968-W1--1 = 1968-W01-1"-  , "1968-W1-0 = 1968-W01-1"-  , "1968-W1-1 = 1968-W01-1"-  , "1968-W1-4 = 1968-W01-4"-  , "1968-W1-6 = 1968-W01-6"-  , "1968-W1-7 = 1968-W01-7"-  , "1968-W1-8 = 1968-W01-7"-  , "1968-W1-9 = 1968-W01-7"-  , "1968-W20--2 = 1968-W20-1"-  , "1968-W20--1 = 1968-W20-1"-  , "1968-W20-0 = 1968-W20-1"-  , "1968-W20-1 = 1968-W20-1"-  , "1968-W20-4 = 1968-W20-4"-  , "1968-W20-6 = 1968-W20-6"-  , "1968-W20-7 = 1968-W20-7"-  , "1968-W20-8 = 1968-W20-7"-  , "1968-W20-9 = 1968-W20-7"-  , "1968-W51--2 = 1968-W51-1"-  , "1968-W51--1 = 1968-W51-1"-  , "1968-W51-0 = 1968-W51-1"-  , "1968-W51-1 = 1968-W51-1"-  , "1968-W51-4 = 1968-W51-4"-  , "1968-W51-6 = 1968-W51-6"-  , "1968-W51-7 = 1968-W51-7"-  , "1968-W51-8 = 1968-W51-7"-  , "1968-W51-9 = 1968-W51-7"-  , "1968-W52--2 = 1968-W52-1"-  , "1968-W52--1 = 1968-W52-1"-  , "1968-W52-0 = 1968-W52-1"-  , "1968-W52-1 = 1968-W52-1"-  , "1968-W52-4 = 1968-W52-4"-  , "1968-W52-6 = 1968-W52-6"-  , "1968-W52-7 = 1968-W52-7"-  , "1968-W52-8 = 1968-W52-7"-  , "1968-W52-9 = 1968-W52-7"-  , "1968-W53--2 = 1968-W52-1"-  , "1968-W53--1 = 1968-W52-1"-  , "1968-W53-0 = 1968-W52-1"-  , "1968-W53-1 = 1968-W52-1"-  , "1968-W53-4 = 1968-W52-4"-  , "1968-W53-6 = 1968-W52-6"-  , "1968-W53-7 = 1968-W52-7"-  , "1968-W53-8 = 1968-W52-7"-  , "1968-W53-9 = 1968-W52-7"-  , "1968-W54--2 = 1968-W52-1"-  , "1968-W54--1 = 1968-W52-1"-  , "1968-W54-0 = 1968-W52-1"-  , "1968-W54-1 = 1968-W52-1"-  , "1968-W54-4 = 1968-W52-4"-  , "1968-W54-6 = 1968-W52-6"-  , "1968-W54-7 = 1968-W52-7"-  , "1968-W54-8 = 1968-W52-7"-  , "1968-W54-9 = 1968-W52-7"-  , "1969-W-20--2 = 1969-W01-1"-  , "1969-W-20--1 = 1969-W01-1"-  , "1969-W-20-0 = 1969-W01-1"-  , "1969-W-20-1 = 1969-W01-1"-  , "1969-W-20-4 = 1969-W01-4"-  , "1969-W-20-6 = 1969-W01-6"-  , "1969-W-20-7 = 1969-W01-7"-  , "1969-W-20-8 = 1969-W01-7"-  , "1969-W-20-9 = 1969-W01-7"-  , "1969-W-1--2 = 1969-W01-1"-  , "1969-W-1--1 = 1969-W01-1"-  , "1969-W-1-0 = 1969-W01-1"-  , "1969-W-1-1 = 1969-W01-1"-  , "1969-W-1-4 = 1969-W01-4"-  , "1969-W-1-6 = 1969-W01-6"-  , "1969-W-1-7 = 1969-W01-7"-  , "1969-W-1-8 = 1969-W01-7"-  , "1969-W-1-9 = 1969-W01-7"-  , "1969-W0--2 = 1969-W01-1"-  , "1969-W0--1 = 1969-W01-1"-  , "1969-W0-0 = 1969-W01-1"-  , "1969-W0-1 = 1969-W01-1"-  , "1969-W0-4 = 1969-W01-4"-  , "1969-W0-6 = 1969-W01-6"-  , "1969-W0-7 = 1969-W01-7"-  , "1969-W0-8 = 1969-W01-7"-  , "1969-W0-9 = 1969-W01-7"-  , "1969-W1--2 = 1969-W01-1"-  , "1969-W1--1 = 1969-W01-1"-  , "1969-W1-0 = 1969-W01-1"-  , "1969-W1-1 = 1969-W01-1"-  , "1969-W1-4 = 1969-W01-4"-  , "1969-W1-6 = 1969-W01-6"-  , "1969-W1-7 = 1969-W01-7"-  , "1969-W1-8 = 1969-W01-7"-  , "1969-W1-9 = 1969-W01-7"-  , "1969-W20--2 = 1969-W20-1"-  , "1969-W20--1 = 1969-W20-1"-  , "1969-W20-0 = 1969-W20-1"-  , "1969-W20-1 = 1969-W20-1"-  , "1969-W20-4 = 1969-W20-4"-  , "1969-W20-6 = 1969-W20-6"-  , "1969-W20-7 = 1969-W20-7"-  , "1969-W20-8 = 1969-W20-7"-  , "1969-W20-9 = 1969-W20-7"-  , "1969-W51--2 = 1969-W51-1"-  , "1969-W51--1 = 1969-W51-1"-  , "1969-W51-0 = 1969-W51-1"-  , "1969-W51-1 = 1969-W51-1"-  , "1969-W51-4 = 1969-W51-4"-  , "1969-W51-6 = 1969-W51-6"-  , "1969-W51-7 = 1969-W51-7"-  , "1969-W51-8 = 1969-W51-7"-  , "1969-W51-9 = 1969-W51-7"-  , "1969-W52--2 = 1969-W52-1"-  , "1969-W52--1 = 1969-W52-1"-  , "1969-W52-0 = 1969-W52-1"-  , "1969-W52-1 = 1969-W52-1"-  , "1969-W52-4 = 1969-W52-4"-  , "1969-W52-6 = 1969-W52-6"-  , "1969-W52-7 = 1969-W52-7"-  , "1969-W52-8 = 1969-W52-7"-  , "1969-W52-9 = 1969-W52-7"-  , "1969-W53--2 = 1969-W52-1"-  , "1969-W53--1 = 1969-W52-1"-  , "1969-W53-0 = 1969-W52-1"-  , "1969-W53-1 = 1969-W52-1"-  , "1969-W53-4 = 1969-W52-4"-  , "1969-W53-6 = 1969-W52-6"-  , "1969-W53-7 = 1969-W52-7"-  , "1969-W53-8 = 1969-W52-7"-  , "1969-W53-9 = 1969-W52-7"-  , "1969-W54--2 = 1969-W52-1"-  , "1969-W54--1 = 1969-W52-1"-  , "1969-W54-0 = 1969-W52-1"-  , "1969-W54-1 = 1969-W52-1"-  , "1969-W54-4 = 1969-W52-4"-  , "1969-W54-6 = 1969-W52-6"-  , "1969-W54-7 = 1969-W52-7"-  , "1969-W54-8 = 1969-W52-7"-  , "1969-W54-9 = 1969-W52-7"-  , "2004-W-20--2 = 2004-W01-1"-  , "2004-W-20--1 = 2004-W01-1"-  , "2004-W-20-0 = 2004-W01-1"-  , "2004-W-20-1 = 2004-W01-1"-  , "2004-W-20-4 = 2004-W01-4"-  , "2004-W-20-6 = 2004-W01-6"-  , "2004-W-20-7 = 2004-W01-7"-  , "2004-W-20-8 = 2004-W01-7"-  , "2004-W-20-9 = 2004-W01-7"-  , "2004-W-1--2 = 2004-W01-1"-  , "2004-W-1--1 = 2004-W01-1"-  , "2004-W-1-0 = 2004-W01-1"-  , "2004-W-1-1 = 2004-W01-1"-  , "2004-W-1-4 = 2004-W01-4"-  , "2004-W-1-6 = 2004-W01-6"-  , "2004-W-1-7 = 2004-W01-7"-  , "2004-W-1-8 = 2004-W01-7"-  , "2004-W-1-9 = 2004-W01-7"-  , "2004-W0--2 = 2004-W01-1"-  , "2004-W0--1 = 2004-W01-1"-  , "2004-W0-0 = 2004-W01-1"-  , "2004-W0-1 = 2004-W01-1"-  , "2004-W0-4 = 2004-W01-4"-  , "2004-W0-6 = 2004-W01-6"-  , "2004-W0-7 = 2004-W01-7"-  , "2004-W0-8 = 2004-W01-7"-  , "2004-W0-9 = 2004-W01-7"-  , "2004-W1--2 = 2004-W01-1"-  , "2004-W1--1 = 2004-W01-1"-  , "2004-W1-0 = 2004-W01-1"-  , "2004-W1-1 = 2004-W01-1"-  , "2004-W1-4 = 2004-W01-4"-  , "2004-W1-6 = 2004-W01-6"-  , "2004-W1-7 = 2004-W01-7"-  , "2004-W1-8 = 2004-W01-7"-  , "2004-W1-9 = 2004-W01-7"-  , "2004-W20--2 = 2004-W20-1"-  , "2004-W20--1 = 2004-W20-1"-  , "2004-W20-0 = 2004-W20-1"-  , "2004-W20-1 = 2004-W20-1"-  , "2004-W20-4 = 2004-W20-4"-  , "2004-W20-6 = 2004-W20-6"-  , "2004-W20-7 = 2004-W20-7"-  , "2004-W20-8 = 2004-W20-7"-  , "2004-W20-9 = 2004-W20-7"-  , "2004-W51--2 = 2004-W51-1"-  , "2004-W51--1 = 2004-W51-1"-  , "2004-W51-0 = 2004-W51-1"-  , "2004-W51-1 = 2004-W51-1"-  , "2004-W51-4 = 2004-W51-4"-  , "2004-W51-6 = 2004-W51-6"-  , "2004-W51-7 = 2004-W51-7"-  , "2004-W51-8 = 2004-W51-7"-  , "2004-W51-9 = 2004-W51-7"-  , "2004-W52--2 = 2004-W52-1"-  , "2004-W52--1 = 2004-W52-1"-  , "2004-W52-0 = 2004-W52-1"-  , "2004-W52-1 = 2004-W52-1"-  , "2004-W52-4 = 2004-W52-4"-  , "2004-W52-6 = 2004-W52-6"-  , "2004-W52-7 = 2004-W52-7"-  , "2004-W52-8 = 2004-W52-7"-  , "2004-W52-9 = 2004-W52-7"-  , "2004-W53--2 = 2004-W53-1"-  , "2004-W53--1 = 2004-W53-1"-  , "2004-W53-0 = 2004-W53-1"-  , "2004-W53-1 = 2004-W53-1"-  , "2004-W53-4 = 2004-W53-4"-  , "2004-W53-6 = 2004-W53-6"-  , "2004-W53-7 = 2004-W53-7"-  , "2004-W53-8 = 2004-W53-7"-  , "2004-W53-9 = 2004-W53-7"-  , "2004-W54--2 = 2004-W53-1"-  , "2004-W54--1 = 2004-W53-1"-  , "2004-W54-0 = 2004-W53-1"-  , "2004-W54-1 = 2004-W53-1"-  , "2004-W54-4 = 2004-W53-4"-  , "2004-W54-6 = 2004-W53-6"-  , "2004-W54-7 = 2004-W53-7"-  , "2004-W54-8 = 2004-W53-7"-  , "2004-W54-9 = 2004-W53-7" ]+    unlines+        [ "YearAndDay"+        , "1968--4 = 1968-001"+        , "1968-0 = 1968-001"+        , "1968-1 = 1968-001"+        , "1968-200 = 1968-200"+        , "1968-364 = 1968-364"+        , "1968-365 = 1968-365"+        , "1968-366 = 1968-366"+        , "1968-367 = 1968-366"+        , "1968-700 = 1968-366"+        , "1969--4 = 1969-001"+        , "1969-0 = 1969-001"+        , "1969-1 = 1969-001"+        , "1969-200 = 1969-200"+        , "1969-364 = 1969-364"+        , "1969-365 = 1969-365"+        , "1969-366 = 1969-365"+        , "1969-367 = 1969-365"+        , "1969-700 = 1969-365"+        , "1971--4 = 1971-001"+        , "1971-0 = 1971-001"+        , "1971-1 = 1971-001"+        , "1971-200 = 1971-200"+        , "1971-364 = 1971-364"+        , "1971-365 = 1971-365"+        , "1971-366 = 1971-365"+        , "1971-367 = 1971-365"+        , "1971-700 = 1971-365"+        , "Gregorian"+        , "1968--20--7 = 1968-01-01"+        , "1968--20--1 = 1968-01-01"+        , "1968--20-0 = 1968-01-01"+        , "1968--20-1 = 1968-01-01"+        , "1968--20-2 = 1968-01-02"+        , "1968--20-27 = 1968-01-27"+        , "1968--20-28 = 1968-01-28"+        , "1968--20-29 = 1968-01-29"+        , "1968--20-30 = 1968-01-30"+        , "1968--20-31 = 1968-01-31"+        , "1968--20-32 = 1968-01-31"+        , "1968--20-40 = 1968-01-31"+        , "1968--1--7 = 1968-01-01"+        , "1968--1--1 = 1968-01-01"+        , "1968--1-0 = 1968-01-01"+        , "1968--1-1 = 1968-01-01"+        , "1968--1-2 = 1968-01-02"+        , "1968--1-27 = 1968-01-27"+        , "1968--1-28 = 1968-01-28"+        , "1968--1-29 = 1968-01-29"+        , "1968--1-30 = 1968-01-30"+        , "1968--1-31 = 1968-01-31"+        , "1968--1-32 = 1968-01-31"+        , "1968--1-40 = 1968-01-31"+        , "1968-0--7 = 1968-01-01"+        , "1968-0--1 = 1968-01-01"+        , "1968-0-0 = 1968-01-01"+        , "1968-0-1 = 1968-01-01"+        , "1968-0-2 = 1968-01-02"+        , "1968-0-27 = 1968-01-27"+        , "1968-0-28 = 1968-01-28"+        , "1968-0-29 = 1968-01-29"+        , "1968-0-30 = 1968-01-30"+        , "1968-0-31 = 1968-01-31"+        , "1968-0-32 = 1968-01-31"+        , "1968-0-40 = 1968-01-31"+        , "1968-1--7 = 1968-01-01"+        , "1968-1--1 = 1968-01-01"+        , "1968-1-0 = 1968-01-01"+        , "1968-1-1 = 1968-01-01"+        , "1968-1-2 = 1968-01-02"+        , "1968-1-27 = 1968-01-27"+        , "1968-1-28 = 1968-01-28"+        , "1968-1-29 = 1968-01-29"+        , "1968-1-30 = 1968-01-30"+        , "1968-1-31 = 1968-01-31"+        , "1968-1-32 = 1968-01-31"+        , "1968-1-40 = 1968-01-31"+        , "1968-2--7 = 1968-02-01"+        , "1968-2--1 = 1968-02-01"+        , "1968-2-0 = 1968-02-01"+        , "1968-2-1 = 1968-02-01"+        , "1968-2-2 = 1968-02-02"+        , "1968-2-27 = 1968-02-27"+        , "1968-2-28 = 1968-02-28"+        , "1968-2-29 = 1968-02-29"+        , "1968-2-30 = 1968-02-29"+        , "1968-2-31 = 1968-02-29"+        , "1968-2-32 = 1968-02-29"+        , "1968-2-40 = 1968-02-29"+        , "1968-12--7 = 1968-12-01"+        , "1968-12--1 = 1968-12-01"+        , "1968-12-0 = 1968-12-01"+        , "1968-12-1 = 1968-12-01"+        , "1968-12-2 = 1968-12-02"+        , "1968-12-27 = 1968-12-27"+        , "1968-12-28 = 1968-12-28"+        , "1968-12-29 = 1968-12-29"+        , "1968-12-30 = 1968-12-30"+        , "1968-12-31 = 1968-12-31"+        , "1968-12-32 = 1968-12-31"+        , "1968-12-40 = 1968-12-31"+        , "1968-13--7 = 1968-12-01"+        , "1968-13--1 = 1968-12-01"+        , "1968-13-0 = 1968-12-01"+        , "1968-13-1 = 1968-12-01"+        , "1968-13-2 = 1968-12-02"+        , "1968-13-27 = 1968-12-27"+        , "1968-13-28 = 1968-12-28"+        , "1968-13-29 = 1968-12-29"+        , "1968-13-30 = 1968-12-30"+        , "1968-13-31 = 1968-12-31"+        , "1968-13-32 = 1968-12-31"+        , "1968-13-40 = 1968-12-31"+        , "1968-17--7 = 1968-12-01"+        , "1968-17--1 = 1968-12-01"+        , "1968-17-0 = 1968-12-01"+        , "1968-17-1 = 1968-12-01"+        , "1968-17-2 = 1968-12-02"+        , "1968-17-27 = 1968-12-27"+        , "1968-17-28 = 1968-12-28"+        , "1968-17-29 = 1968-12-29"+        , "1968-17-30 = 1968-12-30"+        , "1968-17-31 = 1968-12-31"+        , "1968-17-32 = 1968-12-31"+        , "1968-17-40 = 1968-12-31"+        , "1969--20--7 = 1969-01-01"+        , "1969--20--1 = 1969-01-01"+        , "1969--20-0 = 1969-01-01"+        , "1969--20-1 = 1969-01-01"+        , "1969--20-2 = 1969-01-02"+        , "1969--20-27 = 1969-01-27"+        , "1969--20-28 = 1969-01-28"+        , "1969--20-29 = 1969-01-29"+        , "1969--20-30 = 1969-01-30"+        , "1969--20-31 = 1969-01-31"+        , "1969--20-32 = 1969-01-31"+        , "1969--20-40 = 1969-01-31"+        , "1969--1--7 = 1969-01-01"+        , "1969--1--1 = 1969-01-01"+        , "1969--1-0 = 1969-01-01"+        , "1969--1-1 = 1969-01-01"+        , "1969--1-2 = 1969-01-02"+        , "1969--1-27 = 1969-01-27"+        , "1969--1-28 = 1969-01-28"+        , "1969--1-29 = 1969-01-29"+        , "1969--1-30 = 1969-01-30"+        , "1969--1-31 = 1969-01-31"+        , "1969--1-32 = 1969-01-31"+        , "1969--1-40 = 1969-01-31"+        , "1969-0--7 = 1969-01-01"+        , "1969-0--1 = 1969-01-01"+        , "1969-0-0 = 1969-01-01"+        , "1969-0-1 = 1969-01-01"+        , "1969-0-2 = 1969-01-02"+        , "1969-0-27 = 1969-01-27"+        , "1969-0-28 = 1969-01-28"+        , "1969-0-29 = 1969-01-29"+        , "1969-0-30 = 1969-01-30"+        , "1969-0-31 = 1969-01-31"+        , "1969-0-32 = 1969-01-31"+        , "1969-0-40 = 1969-01-31"+        , "1969-1--7 = 1969-01-01"+        , "1969-1--1 = 1969-01-01"+        , "1969-1-0 = 1969-01-01"+        , "1969-1-1 = 1969-01-01"+        , "1969-1-2 = 1969-01-02"+        , "1969-1-27 = 1969-01-27"+        , "1969-1-28 = 1969-01-28"+        , "1969-1-29 = 1969-01-29"+        , "1969-1-30 = 1969-01-30"+        , "1969-1-31 = 1969-01-31"+        , "1969-1-32 = 1969-01-31"+        , "1969-1-40 = 1969-01-31"+        , "1969-2--7 = 1969-02-01"+        , "1969-2--1 = 1969-02-01"+        , "1969-2-0 = 1969-02-01"+        , "1969-2-1 = 1969-02-01"+        , "1969-2-2 = 1969-02-02"+        , "1969-2-27 = 1969-02-27"+        , "1969-2-28 = 1969-02-28"+        , "1969-2-29 = 1969-02-28"+        , "1969-2-30 = 1969-02-28"+        , "1969-2-31 = 1969-02-28"+        , "1969-2-32 = 1969-02-28"+        , "1969-2-40 = 1969-02-28"+        , "1969-12--7 = 1969-12-01"+        , "1969-12--1 = 1969-12-01"+        , "1969-12-0 = 1969-12-01"+        , "1969-12-1 = 1969-12-01"+        , "1969-12-2 = 1969-12-02"+        , "1969-12-27 = 1969-12-27"+        , "1969-12-28 = 1969-12-28"+        , "1969-12-29 = 1969-12-29"+        , "1969-12-30 = 1969-12-30"+        , "1969-12-31 = 1969-12-31"+        , "1969-12-32 = 1969-12-31"+        , "1969-12-40 = 1969-12-31"+        , "1969-13--7 = 1969-12-01"+        , "1969-13--1 = 1969-12-01"+        , "1969-13-0 = 1969-12-01"+        , "1969-13-1 = 1969-12-01"+        , "1969-13-2 = 1969-12-02"+        , "1969-13-27 = 1969-12-27"+        , "1969-13-28 = 1969-12-28"+        , "1969-13-29 = 1969-12-29"+        , "1969-13-30 = 1969-12-30"+        , "1969-13-31 = 1969-12-31"+        , "1969-13-32 = 1969-12-31"+        , "1969-13-40 = 1969-12-31"+        , "1969-17--7 = 1969-12-01"+        , "1969-17--1 = 1969-12-01"+        , "1969-17-0 = 1969-12-01"+        , "1969-17-1 = 1969-12-01"+        , "1969-17-2 = 1969-12-02"+        , "1969-17-27 = 1969-12-27"+        , "1969-17-28 = 1969-12-28"+        , "1969-17-29 = 1969-12-29"+        , "1969-17-30 = 1969-12-30"+        , "1969-17-31 = 1969-12-31"+        , "1969-17-32 = 1969-12-31"+        , "1969-17-40 = 1969-12-31"+        , "1971--20--7 = 1971-01-01"+        , "1971--20--1 = 1971-01-01"+        , "1971--20-0 = 1971-01-01"+        , "1971--20-1 = 1971-01-01"+        , "1971--20-2 = 1971-01-02"+        , "1971--20-27 = 1971-01-27"+        , "1971--20-28 = 1971-01-28"+        , "1971--20-29 = 1971-01-29"+        , "1971--20-30 = 1971-01-30"+        , "1971--20-31 = 1971-01-31"+        , "1971--20-32 = 1971-01-31"+        , "1971--20-40 = 1971-01-31"+        , "1971--1--7 = 1971-01-01"+        , "1971--1--1 = 1971-01-01"+        , "1971--1-0 = 1971-01-01"+        , "1971--1-1 = 1971-01-01"+        , "1971--1-2 = 1971-01-02"+        , "1971--1-27 = 1971-01-27"+        , "1971--1-28 = 1971-01-28"+        , "1971--1-29 = 1971-01-29"+        , "1971--1-30 = 1971-01-30"+        , "1971--1-31 = 1971-01-31"+        , "1971--1-32 = 1971-01-31"+        , "1971--1-40 = 1971-01-31"+        , "1971-0--7 = 1971-01-01"+        , "1971-0--1 = 1971-01-01"+        , "1971-0-0 = 1971-01-01"+        , "1971-0-1 = 1971-01-01"+        , "1971-0-2 = 1971-01-02"+        , "1971-0-27 = 1971-01-27"+        , "1971-0-28 = 1971-01-28"+        , "1971-0-29 = 1971-01-29"+        , "1971-0-30 = 1971-01-30"+        , "1971-0-31 = 1971-01-31"+        , "1971-0-32 = 1971-01-31"+        , "1971-0-40 = 1971-01-31"+        , "1971-1--7 = 1971-01-01"+        , "1971-1--1 = 1971-01-01"+        , "1971-1-0 = 1971-01-01"+        , "1971-1-1 = 1971-01-01"+        , "1971-1-2 = 1971-01-02"+        , "1971-1-27 = 1971-01-27"+        , "1971-1-28 = 1971-01-28"+        , "1971-1-29 = 1971-01-29"+        , "1971-1-30 = 1971-01-30"+        , "1971-1-31 = 1971-01-31"+        , "1971-1-32 = 1971-01-31"+        , "1971-1-40 = 1971-01-31"+        , "1971-2--7 = 1971-02-01"+        , "1971-2--1 = 1971-02-01"+        , "1971-2-0 = 1971-02-01"+        , "1971-2-1 = 1971-02-01"+        , "1971-2-2 = 1971-02-02"+        , "1971-2-27 = 1971-02-27"+        , "1971-2-28 = 1971-02-28"+        , "1971-2-29 = 1971-02-28"+        , "1971-2-30 = 1971-02-28"+        , "1971-2-31 = 1971-02-28"+        , "1971-2-32 = 1971-02-28"+        , "1971-2-40 = 1971-02-28"+        , "1971-12--7 = 1971-12-01"+        , "1971-12--1 = 1971-12-01"+        , "1971-12-0 = 1971-12-01"+        , "1971-12-1 = 1971-12-01"+        , "1971-12-2 = 1971-12-02"+        , "1971-12-27 = 1971-12-27"+        , "1971-12-28 = 1971-12-28"+        , "1971-12-29 = 1971-12-29"+        , "1971-12-30 = 1971-12-30"+        , "1971-12-31 = 1971-12-31"+        , "1971-12-32 = 1971-12-31"+        , "1971-12-40 = 1971-12-31"+        , "1971-13--7 = 1971-12-01"+        , "1971-13--1 = 1971-12-01"+        , "1971-13-0 = 1971-12-01"+        , "1971-13-1 = 1971-12-01"+        , "1971-13-2 = 1971-12-02"+        , "1971-13-27 = 1971-12-27"+        , "1971-13-28 = 1971-12-28"+        , "1971-13-29 = 1971-12-29"+        , "1971-13-30 = 1971-12-30"+        , "1971-13-31 = 1971-12-31"+        , "1971-13-32 = 1971-12-31"+        , "1971-13-40 = 1971-12-31"+        , "1971-17--7 = 1971-12-01"+        , "1971-17--1 = 1971-12-01"+        , "1971-17-0 = 1971-12-01"+        , "1971-17-1 = 1971-12-01"+        , "1971-17-2 = 1971-12-02"+        , "1971-17-27 = 1971-12-27"+        , "1971-17-28 = 1971-12-28"+        , "1971-17-29 = 1971-12-29"+        , "1971-17-30 = 1971-12-30"+        , "1971-17-31 = 1971-12-31"+        , "1971-17-32 = 1971-12-31"+        , "1971-17-40 = 1971-12-31"+        , "ISOWeekDay"+        , "1968-W-20--2 = 1968-W01-1"+        , "1968-W-20--1 = 1968-W01-1"+        , "1968-W-20-0 = 1968-W01-1"+        , "1968-W-20-1 = 1968-W01-1"+        , "1968-W-20-4 = 1968-W01-4"+        , "1968-W-20-6 = 1968-W01-6"+        , "1968-W-20-7 = 1968-W01-7"+        , "1968-W-20-8 = 1968-W01-7"+        , "1968-W-20-9 = 1968-W01-7"+        , "1968-W-1--2 = 1968-W01-1"+        , "1968-W-1--1 = 1968-W01-1"+        , "1968-W-1-0 = 1968-W01-1"+        , "1968-W-1-1 = 1968-W01-1"+        , "1968-W-1-4 = 1968-W01-4"+        , "1968-W-1-6 = 1968-W01-6"+        , "1968-W-1-7 = 1968-W01-7"+        , "1968-W-1-8 = 1968-W01-7"+        , "1968-W-1-9 = 1968-W01-7"+        , "1968-W0--2 = 1968-W01-1"+        , "1968-W0--1 = 1968-W01-1"+        , "1968-W0-0 = 1968-W01-1"+        , "1968-W0-1 = 1968-W01-1"+        , "1968-W0-4 = 1968-W01-4"+        , "1968-W0-6 = 1968-W01-6"+        , "1968-W0-7 = 1968-W01-7"+        , "1968-W0-8 = 1968-W01-7"+        , "1968-W0-9 = 1968-W01-7"+        , "1968-W1--2 = 1968-W01-1"+        , "1968-W1--1 = 1968-W01-1"+        , "1968-W1-0 = 1968-W01-1"+        , "1968-W1-1 = 1968-W01-1"+        , "1968-W1-4 = 1968-W01-4"+        , "1968-W1-6 = 1968-W01-6"+        , "1968-W1-7 = 1968-W01-7"+        , "1968-W1-8 = 1968-W01-7"+        , "1968-W1-9 = 1968-W01-7"+        , "1968-W20--2 = 1968-W20-1"+        , "1968-W20--1 = 1968-W20-1"+        , "1968-W20-0 = 1968-W20-1"+        , "1968-W20-1 = 1968-W20-1"+        , "1968-W20-4 = 1968-W20-4"+        , "1968-W20-6 = 1968-W20-6"+        , "1968-W20-7 = 1968-W20-7"+        , "1968-W20-8 = 1968-W20-7"+        , "1968-W20-9 = 1968-W20-7"+        , "1968-W51--2 = 1968-W51-1"+        , "1968-W51--1 = 1968-W51-1"+        , "1968-W51-0 = 1968-W51-1"+        , "1968-W51-1 = 1968-W51-1"+        , "1968-W51-4 = 1968-W51-4"+        , "1968-W51-6 = 1968-W51-6"+        , "1968-W51-7 = 1968-W51-7"+        , "1968-W51-8 = 1968-W51-7"+        , "1968-W51-9 = 1968-W51-7"+        , "1968-W52--2 = 1968-W52-1"+        , "1968-W52--1 = 1968-W52-1"+        , "1968-W52-0 = 1968-W52-1"+        , "1968-W52-1 = 1968-W52-1"+        , "1968-W52-4 = 1968-W52-4"+        , "1968-W52-6 = 1968-W52-6"+        , "1968-W52-7 = 1968-W52-7"+        , "1968-W52-8 = 1968-W52-7"+        , "1968-W52-9 = 1968-W52-7"+        , "1968-W53--2 = 1968-W52-1"+        , "1968-W53--1 = 1968-W52-1"+        , "1968-W53-0 = 1968-W52-1"+        , "1968-W53-1 = 1968-W52-1"+        , "1968-W53-4 = 1968-W52-4"+        , "1968-W53-6 = 1968-W52-6"+        , "1968-W53-7 = 1968-W52-7"+        , "1968-W53-8 = 1968-W52-7"+        , "1968-W53-9 = 1968-W52-7"+        , "1968-W54--2 = 1968-W52-1"+        , "1968-W54--1 = 1968-W52-1"+        , "1968-W54-0 = 1968-W52-1"+        , "1968-W54-1 = 1968-W52-1"+        , "1968-W54-4 = 1968-W52-4"+        , "1968-W54-6 = 1968-W52-6"+        , "1968-W54-7 = 1968-W52-7"+        , "1968-W54-8 = 1968-W52-7"+        , "1968-W54-9 = 1968-W52-7"+        , "1969-W-20--2 = 1969-W01-1"+        , "1969-W-20--1 = 1969-W01-1"+        , "1969-W-20-0 = 1969-W01-1"+        , "1969-W-20-1 = 1969-W01-1"+        , "1969-W-20-4 = 1969-W01-4"+        , "1969-W-20-6 = 1969-W01-6"+        , "1969-W-20-7 = 1969-W01-7"+        , "1969-W-20-8 = 1969-W01-7"+        , "1969-W-20-9 = 1969-W01-7"+        , "1969-W-1--2 = 1969-W01-1"+        , "1969-W-1--1 = 1969-W01-1"+        , "1969-W-1-0 = 1969-W01-1"+        , "1969-W-1-1 = 1969-W01-1"+        , "1969-W-1-4 = 1969-W01-4"+        , "1969-W-1-6 = 1969-W01-6"+        , "1969-W-1-7 = 1969-W01-7"+        , "1969-W-1-8 = 1969-W01-7"+        , "1969-W-1-9 = 1969-W01-7"+        , "1969-W0--2 = 1969-W01-1"+        , "1969-W0--1 = 1969-W01-1"+        , "1969-W0-0 = 1969-W01-1"+        , "1969-W0-1 = 1969-W01-1"+        , "1969-W0-4 = 1969-W01-4"+        , "1969-W0-6 = 1969-W01-6"+        , "1969-W0-7 = 1969-W01-7"+        , "1969-W0-8 = 1969-W01-7"+        , "1969-W0-9 = 1969-W01-7"+        , "1969-W1--2 = 1969-W01-1"+        , "1969-W1--1 = 1969-W01-1"+        , "1969-W1-0 = 1969-W01-1"+        , "1969-W1-1 = 1969-W01-1"+        , "1969-W1-4 = 1969-W01-4"+        , "1969-W1-6 = 1969-W01-6"+        , "1969-W1-7 = 1969-W01-7"+        , "1969-W1-8 = 1969-W01-7"+        , "1969-W1-9 = 1969-W01-7"+        , "1969-W20--2 = 1969-W20-1"+        , "1969-W20--1 = 1969-W20-1"+        , "1969-W20-0 = 1969-W20-1"+        , "1969-W20-1 = 1969-W20-1"+        , "1969-W20-4 = 1969-W20-4"+        , "1969-W20-6 = 1969-W20-6"+        , "1969-W20-7 = 1969-W20-7"+        , "1969-W20-8 = 1969-W20-7"+        , "1969-W20-9 = 1969-W20-7"+        , "1969-W51--2 = 1969-W51-1"+        , "1969-W51--1 = 1969-W51-1"+        , "1969-W51-0 = 1969-W51-1"+        , "1969-W51-1 = 1969-W51-1"+        , "1969-W51-4 = 1969-W51-4"+        , "1969-W51-6 = 1969-W51-6"+        , "1969-W51-7 = 1969-W51-7"+        , "1969-W51-8 = 1969-W51-7"+        , "1969-W51-9 = 1969-W51-7"+        , "1969-W52--2 = 1969-W52-1"+        , "1969-W52--1 = 1969-W52-1"+        , "1969-W52-0 = 1969-W52-1"+        , "1969-W52-1 = 1969-W52-1"+        , "1969-W52-4 = 1969-W52-4"+        , "1969-W52-6 = 1969-W52-6"+        , "1969-W52-7 = 1969-W52-7"+        , "1969-W52-8 = 1969-W52-7"+        , "1969-W52-9 = 1969-W52-7"+        , "1969-W53--2 = 1969-W52-1"+        , "1969-W53--1 = 1969-W52-1"+        , "1969-W53-0 = 1969-W52-1"+        , "1969-W53-1 = 1969-W52-1"+        , "1969-W53-4 = 1969-W52-4"+        , "1969-W53-6 = 1969-W52-6"+        , "1969-W53-7 = 1969-W52-7"+        , "1969-W53-8 = 1969-W52-7"+        , "1969-W53-9 = 1969-W52-7"+        , "1969-W54--2 = 1969-W52-1"+        , "1969-W54--1 = 1969-W52-1"+        , "1969-W54-0 = 1969-W52-1"+        , "1969-W54-1 = 1969-W52-1"+        , "1969-W54-4 = 1969-W52-4"+        , "1969-W54-6 = 1969-W52-6"+        , "1969-W54-7 = 1969-W52-7"+        , "1969-W54-8 = 1969-W52-7"+        , "1969-W54-9 = 1969-W52-7"+        , "2004-W-20--2 = 2004-W01-1"+        , "2004-W-20--1 = 2004-W01-1"+        , "2004-W-20-0 = 2004-W01-1"+        , "2004-W-20-1 = 2004-W01-1"+        , "2004-W-20-4 = 2004-W01-4"+        , "2004-W-20-6 = 2004-W01-6"+        , "2004-W-20-7 = 2004-W01-7"+        , "2004-W-20-8 = 2004-W01-7"+        , "2004-W-20-9 = 2004-W01-7"+        , "2004-W-1--2 = 2004-W01-1"+        , "2004-W-1--1 = 2004-W01-1"+        , "2004-W-1-0 = 2004-W01-1"+        , "2004-W-1-1 = 2004-W01-1"+        , "2004-W-1-4 = 2004-W01-4"+        , "2004-W-1-6 = 2004-W01-6"+        , "2004-W-1-7 = 2004-W01-7"+        , "2004-W-1-8 = 2004-W01-7"+        , "2004-W-1-9 = 2004-W01-7"+        , "2004-W0--2 = 2004-W01-1"+        , "2004-W0--1 = 2004-W01-1"+        , "2004-W0-0 = 2004-W01-1"+        , "2004-W0-1 = 2004-W01-1"+        , "2004-W0-4 = 2004-W01-4"+        , "2004-W0-6 = 2004-W01-6"+        , "2004-W0-7 = 2004-W01-7"+        , "2004-W0-8 = 2004-W01-7"+        , "2004-W0-9 = 2004-W01-7"+        , "2004-W1--2 = 2004-W01-1"+        , "2004-W1--1 = 2004-W01-1"+        , "2004-W1-0 = 2004-W01-1"+        , "2004-W1-1 = 2004-W01-1"+        , "2004-W1-4 = 2004-W01-4"+        , "2004-W1-6 = 2004-W01-6"+        , "2004-W1-7 = 2004-W01-7"+        , "2004-W1-8 = 2004-W01-7"+        , "2004-W1-9 = 2004-W01-7"+        , "2004-W20--2 = 2004-W20-1"+        , "2004-W20--1 = 2004-W20-1"+        , "2004-W20-0 = 2004-W20-1"+        , "2004-W20-1 = 2004-W20-1"+        , "2004-W20-4 = 2004-W20-4"+        , "2004-W20-6 = 2004-W20-6"+        , "2004-W20-7 = 2004-W20-7"+        , "2004-W20-8 = 2004-W20-7"+        , "2004-W20-9 = 2004-W20-7"+        , "2004-W51--2 = 2004-W51-1"+        , "2004-W51--1 = 2004-W51-1"+        , "2004-W51-0 = 2004-W51-1"+        , "2004-W51-1 = 2004-W51-1"+        , "2004-W51-4 = 2004-W51-4"+        , "2004-W51-6 = 2004-W51-6"+        , "2004-W51-7 = 2004-W51-7"+        , "2004-W51-8 = 2004-W51-7"+        , "2004-W51-9 = 2004-W51-7"+        , "2004-W52--2 = 2004-W52-1"+        , "2004-W52--1 = 2004-W52-1"+        , "2004-W52-0 = 2004-W52-1"+        , "2004-W52-1 = 2004-W52-1"+        , "2004-W52-4 = 2004-W52-4"+        , "2004-W52-6 = 2004-W52-6"+        , "2004-W52-7 = 2004-W52-7"+        , "2004-W52-8 = 2004-W52-7"+        , "2004-W52-9 = 2004-W52-7"+        , "2004-W53--2 = 2004-W53-1"+        , "2004-W53--1 = 2004-W53-1"+        , "2004-W53-0 = 2004-W53-1"+        , "2004-W53-1 = 2004-W53-1"+        , "2004-W53-4 = 2004-W53-4"+        , "2004-W53-6 = 2004-W53-6"+        , "2004-W53-7 = 2004-W53-7"+        , "2004-W53-8 = 2004-W53-7"+        , "2004-W53-9 = 2004-W53-7"+        , "2004-W54--2 = 2004-W53-1"+        , "2004-W54--1 = 2004-W53-1"+        , "2004-W54-0 = 2004-W53-1"+        , "2004-W54-1 = 2004-W53-1"+        , "2004-W54-4 = 2004-W53-4"+        , "2004-W54-6 = 2004-W53-6"+        , "2004-W54-7 = 2004-W53-7"+        , "2004-W54-8 = 2004-W53-7"+        , "2004-W54-9 = 2004-W53-7"+        ]
test/main/Test/Calendar/ConvertBack.hs view
@@ -1,41 +1,39 @@-module Test.Calendar.ConvertBack(convertBack) where+module Test.Calendar.ConvertBack+    ( convertBack+    ) where -import Data.Time.Calendar.OrdinalDate+import Data.Time.Calendar import Data.Time.Calendar.Julian+import Data.Time.Calendar.OrdinalDate import Data.Time.Calendar.WeekDate-import Data.Time.Calendar import Test.Tasty import Test.Tasty.HUnit  checkDay :: (Show t) => (Day -> t) -> (t -> Day) -> (t -> Maybe Day) -> Day -> String checkDay encodeDay decodeDay decodeDayValid day = let-    st    = encodeDay day-    day'  = decodeDay st+    st = encodeDay day+    day' = decodeDay st     mday' = decodeDayValid st--    a = if day /= day'-          then unwords [ show day, "-> "-                           , show st,  "-> "-                           , show day'-                           , "(diff", show (diffDays day' day) ++ ")" ]-          else ""--    b = if Just day /= mday'-          then unwords [show day, "->", show st, "->", show mday']-          else ""+    a =+        if day /= day'+            then unwords [show day, "-> ", show st, "-> ", show day', "(diff", show (diffDays day' day) ++ ")"]+            else ""+    b =+        if Just day /= mday'+            then unwords [show day, "->", show st, "->", show mday']+            else ""     in a ++ b  checkers :: [Day -> String]-checkers-  = [ checkDay toOrdinalDate (\(y,d) -> fromOrdinalDate y d) (\(y,d) -> fromOrdinalDateValid y d)-    , checkDay toWeekDate (\(y,w,d) -> fromWeekDate y w d) (\(y,w,d) -> fromWeekDateValid y w d)-    , checkDay toGregorian (\(y,m,d) -> fromGregorian y m d) (\(y,m,d) -> fromGregorianValid y m d)-    , checkDay toJulian (\(y,m,d) -> fromJulian y m d) (\(y,m,d) -> fromJulianValid y m d) ]+checkers =+    [ checkDay toOrdinalDate (\(y, d) -> fromOrdinalDate y d) (\(y, d) -> fromOrdinalDateValid y d)+    , checkDay toWeekDate (\(y, w, d) -> fromWeekDate y w d) (\(y, w, d) -> fromWeekDateValid y w d)+    , checkDay toGregorian (\(y, m, d) -> fromGregorian y m d) (\(y, m, d) -> fromGregorianValid y m d)+    , checkDay toJulian (\(y, m, d) -> fromJulian y m d) (\(y, m, d) -> fromJulianValid y m d)+    ]  days :: [Day]-days = [ModifiedJulianDay 50000 .. ModifiedJulianDay 50200] ++-    (fmap (\year -> (fromGregorian year 1 4)) [1980..2000])+days = [ModifiedJulianDay 50000 .. ModifiedJulianDay 50200] ++ (fmap (\year -> (fromGregorian year 1 4)) [1980 .. 2000])  convertBack :: TestTree-convertBack = testCase "convertBack" $-    assertEqual "" "" $ concatMap (\ch -> concatMap ch days) checkers+convertBack = testCase "convertBack" $ assertEqual "" "" $ concatMap (\ch -> concatMap ch days) checkers
test/main/Test/Calendar/Duration.hs view
@@ -24,7 +24,7 @@         ]  testClip :: (Integer, Int, Int) -> (Integer, Int, Int) -> (Integer, Integer) -> TestTree-testClip (y1,m1,d1) (y2,m2,d2) (em, ed) = let+testClip (y1, m1, d1) (y2, m2, d2) (em, ed) = let     day1 = fromGregorian y1 m1 d1     day2 = fromGregorian y2 m2 d2     expected = CalendarDiffDays em ed
test/main/Test/Calendar/Easter.hs view
@@ -1,15 +1,16 @@-module Test.Calendar.Easter(testEaster) where+module Test.Calendar.Easter+    ( testEaster+    ) where -import Data.Time.Calendar.Easter import Data.Time.Calendar+import Data.Time.Calendar.Easter import Data.Time.Format +import Test.Calendar.EasterRef import Test.Tasty import Test.Tasty.HUnit-import Test.Calendar.EasterRef  --- days :: [Day] days = [ModifiedJulianDay 53000 .. ModifiedJulianDay 53014] @@ -17,19 +18,21 @@ showWithWDay = formatTime defaultTimeLocale "%F %A"  testEaster :: TestTree-testEaster = testCase "testEaster" $ let-    ds = unlines $ map (\day ->-                   unwords [ showWithWDay day, "->"-                           , showWithWDay (sundayAfter day)]) days--    f y = unwords [ show y ++ ", Gregorian: moon,"-                          , show (gregorianPaschalMoon y) ++ ": Easter,"-                          , showWithWDay (gregorianEaster y)]-                  ++ "\n"--    g y = unwords [ show y ++ ", Orthodox : moon,"-                          , show (orthodoxPaschalMoon y) ++ ": Easter,"-                          , showWithWDay (orthodoxEaster y)]-                  ++ "\n"--    in assertEqual "" testEasterRef $ ds ++ concatMap (\y -> f y ++ g y) [2000..2020]+testEaster =+    testCase "testEaster" $ let+        ds = unlines $ map (\day -> unwords [showWithWDay day, "->", showWithWDay (sundayAfter day)]) days+        f y =+            unwords+                [ show y ++ ", Gregorian: moon,"+                , show (gregorianPaschalMoon y) ++ ": Easter,"+                , showWithWDay (gregorianEaster y)+                ] +++            "\n"+        g y =+            unwords+                [ show y ++ ", Orthodox : moon,"+                , show (orthodoxPaschalMoon y) ++ ": Easter,"+                , showWithWDay (orthodoxEaster y)+                ] +++            "\n"+        in assertEqual "" testEasterRef $ ds ++ concatMap (\y -> f y ++ g y) [2000 .. 2020]
test/main/Test/Calendar/EasterRef.hs view
@@ -2,61 +2,62 @@  testEasterRef :: String testEasterRef =- unlines-  [ "2003-12-27 Saturday -> 2003-12-28 Sunday"-  , "2003-12-28 Sunday -> 2004-01-04 Sunday"-  , "2003-12-29 Monday -> 2004-01-04 Sunday"-  , "2003-12-30 Tuesday -> 2004-01-04 Sunday"-  , "2003-12-31 Wednesday -> 2004-01-04 Sunday"-  , "2004-01-01 Thursday -> 2004-01-04 Sunday"-  , "2004-01-02 Friday -> 2004-01-04 Sunday"-  , "2004-01-03 Saturday -> 2004-01-04 Sunday"-  , "2004-01-04 Sunday -> 2004-01-11 Sunday"-  , "2004-01-05 Monday -> 2004-01-11 Sunday"-  , "2004-01-06 Tuesday -> 2004-01-11 Sunday"-  , "2004-01-07 Wednesday -> 2004-01-11 Sunday"-  , "2004-01-08 Thursday -> 2004-01-11 Sunday"-  , "2004-01-09 Friday -> 2004-01-11 Sunday"-  , "2004-01-10 Saturday -> 2004-01-11 Sunday"-  , "2000, Gregorian: moon, 2000-04-18: Easter, 2000-04-23 Sunday"-  , "2000, Orthodox : moon, 2000-04-23: Easter, 2000-04-30 Sunday"-  , "2001, Gregorian: moon, 2001-04-08: Easter, 2001-04-15 Sunday"-  , "2001, Orthodox : moon, 2001-04-12: Easter, 2001-04-15 Sunday"-  , "2002, Gregorian: moon, 2002-03-28: Easter, 2002-03-31 Sunday"-  , "2002, Orthodox : moon, 2002-05-01: Easter, 2002-05-05 Sunday"-  , "2003, Gregorian: moon, 2003-04-16: Easter, 2003-04-20 Sunday"-  , "2003, Orthodox : moon, 2003-04-20: Easter, 2003-04-27 Sunday"-  , "2004, Gregorian: moon, 2004-04-05: Easter, 2004-04-11 Sunday"-  , "2004, Orthodox : moon, 2004-04-09: Easter, 2004-04-11 Sunday"-  , "2005, Gregorian: moon, 2005-03-25: Easter, 2005-03-27 Sunday"-  , "2005, Orthodox : moon, 2005-04-28: Easter, 2005-05-01 Sunday"-  , "2006, Gregorian: moon, 2006-04-13: Easter, 2006-04-16 Sunday"-  , "2006, Orthodox : moon, 2006-04-17: Easter, 2006-04-23 Sunday"-  , "2007, Gregorian: moon, 2007-04-02: Easter, 2007-04-08 Sunday"-  , "2007, Orthodox : moon, 2007-04-06: Easter, 2007-04-08 Sunday"-  , "2008, Gregorian: moon, 2008-03-22: Easter, 2008-03-23 Sunday"-  , "2008, Orthodox : moon, 2008-04-25: Easter, 2008-04-27 Sunday"-  , "2009, Gregorian: moon, 2009-04-10: Easter, 2009-04-12 Sunday"-  , "2009, Orthodox : moon, 2009-04-14: Easter, 2009-04-19 Sunday"-  , "2010, Gregorian: moon, 2010-03-30: Easter, 2010-04-04 Sunday"-  , "2010, Orthodox : moon, 2010-04-03: Easter, 2010-04-04 Sunday"-  , "2011, Gregorian: moon, 2011-04-18: Easter, 2011-04-24 Sunday"-  , "2011, Orthodox : moon, 2011-04-22: Easter, 2011-04-24 Sunday"-  , "2012, Gregorian: moon, 2012-04-07: Easter, 2012-04-08 Sunday"-  , "2012, Orthodox : moon, 2012-04-11: Easter, 2012-04-15 Sunday"-  , "2013, Gregorian: moon, 2013-03-27: Easter, 2013-03-31 Sunday"-  , "2013, Orthodox : moon, 2013-04-30: Easter, 2013-05-05 Sunday"-  , "2014, Gregorian: moon, 2014-04-14: Easter, 2014-04-20 Sunday"-  , "2014, Orthodox : moon, 2014-04-18: Easter, 2014-04-20 Sunday"-  , "2015, Gregorian: moon, 2015-04-03: Easter, 2015-04-05 Sunday"-  , "2015, Orthodox : moon, 2015-04-07: Easter, 2015-04-12 Sunday"-  , "2016, Gregorian: moon, 2016-03-23: Easter, 2016-03-27 Sunday"-  , "2016, Orthodox : moon, 2016-04-26: Easter, 2016-05-01 Sunday"-  , "2017, Gregorian: moon, 2017-04-11: Easter, 2017-04-16 Sunday"-  , "2017, Orthodox : moon, 2017-04-15: Easter, 2017-04-16 Sunday"-  , "2018, Gregorian: moon, 2018-03-31: Easter, 2018-04-01 Sunday"-  , "2018, Orthodox : moon, 2018-04-04: Easter, 2018-04-08 Sunday"-  , "2019, Gregorian: moon, 2019-04-18: Easter, 2019-04-21 Sunday"-  , "2019, Orthodox : moon, 2019-04-23: Easter, 2019-04-28 Sunday"-  , "2020, Gregorian: moon, 2020-04-08: Easter, 2020-04-12 Sunday"-  , "2020, Orthodox : moon, 2020-04-12: Easter, 2020-04-19 Sunday" ]+    unlines+        [ "2003-12-27 Saturday -> 2003-12-28 Sunday"+        , "2003-12-28 Sunday -> 2004-01-04 Sunday"+        , "2003-12-29 Monday -> 2004-01-04 Sunday"+        , "2003-12-30 Tuesday -> 2004-01-04 Sunday"+        , "2003-12-31 Wednesday -> 2004-01-04 Sunday"+        , "2004-01-01 Thursday -> 2004-01-04 Sunday"+        , "2004-01-02 Friday -> 2004-01-04 Sunday"+        , "2004-01-03 Saturday -> 2004-01-04 Sunday"+        , "2004-01-04 Sunday -> 2004-01-11 Sunday"+        , "2004-01-05 Monday -> 2004-01-11 Sunday"+        , "2004-01-06 Tuesday -> 2004-01-11 Sunday"+        , "2004-01-07 Wednesday -> 2004-01-11 Sunday"+        , "2004-01-08 Thursday -> 2004-01-11 Sunday"+        , "2004-01-09 Friday -> 2004-01-11 Sunday"+        , "2004-01-10 Saturday -> 2004-01-11 Sunday"+        , "2000, Gregorian: moon, 2000-04-18: Easter, 2000-04-23 Sunday"+        , "2000, Orthodox : moon, 2000-04-23: Easter, 2000-04-30 Sunday"+        , "2001, Gregorian: moon, 2001-04-08: Easter, 2001-04-15 Sunday"+        , "2001, Orthodox : moon, 2001-04-12: Easter, 2001-04-15 Sunday"+        , "2002, Gregorian: moon, 2002-03-28: Easter, 2002-03-31 Sunday"+        , "2002, Orthodox : moon, 2002-05-01: Easter, 2002-05-05 Sunday"+        , "2003, Gregorian: moon, 2003-04-16: Easter, 2003-04-20 Sunday"+        , "2003, Orthodox : moon, 2003-04-20: Easter, 2003-04-27 Sunday"+        , "2004, Gregorian: moon, 2004-04-05: Easter, 2004-04-11 Sunday"+        , "2004, Orthodox : moon, 2004-04-09: Easter, 2004-04-11 Sunday"+        , "2005, Gregorian: moon, 2005-03-25: Easter, 2005-03-27 Sunday"+        , "2005, Orthodox : moon, 2005-04-28: Easter, 2005-05-01 Sunday"+        , "2006, Gregorian: moon, 2006-04-13: Easter, 2006-04-16 Sunday"+        , "2006, Orthodox : moon, 2006-04-17: Easter, 2006-04-23 Sunday"+        , "2007, Gregorian: moon, 2007-04-02: Easter, 2007-04-08 Sunday"+        , "2007, Orthodox : moon, 2007-04-06: Easter, 2007-04-08 Sunday"+        , "2008, Gregorian: moon, 2008-03-22: Easter, 2008-03-23 Sunday"+        , "2008, Orthodox : moon, 2008-04-25: Easter, 2008-04-27 Sunday"+        , "2009, Gregorian: moon, 2009-04-10: Easter, 2009-04-12 Sunday"+        , "2009, Orthodox : moon, 2009-04-14: Easter, 2009-04-19 Sunday"+        , "2010, Gregorian: moon, 2010-03-30: Easter, 2010-04-04 Sunday"+        , "2010, Orthodox : moon, 2010-04-03: Easter, 2010-04-04 Sunday"+        , "2011, Gregorian: moon, 2011-04-18: Easter, 2011-04-24 Sunday"+        , "2011, Orthodox : moon, 2011-04-22: Easter, 2011-04-24 Sunday"+        , "2012, Gregorian: moon, 2012-04-07: Easter, 2012-04-08 Sunday"+        , "2012, Orthodox : moon, 2012-04-11: Easter, 2012-04-15 Sunday"+        , "2013, Gregorian: moon, 2013-03-27: Easter, 2013-03-31 Sunday"+        , "2013, Orthodox : moon, 2013-04-30: Easter, 2013-05-05 Sunday"+        , "2014, Gregorian: moon, 2014-04-14: Easter, 2014-04-20 Sunday"+        , "2014, Orthodox : moon, 2014-04-18: Easter, 2014-04-20 Sunday"+        , "2015, Gregorian: moon, 2015-04-03: Easter, 2015-04-05 Sunday"+        , "2015, Orthodox : moon, 2015-04-07: Easter, 2015-04-12 Sunday"+        , "2016, Gregorian: moon, 2016-03-23: Easter, 2016-03-27 Sunday"+        , "2016, Orthodox : moon, 2016-04-26: Easter, 2016-05-01 Sunday"+        , "2017, Gregorian: moon, 2017-04-11: Easter, 2017-04-16 Sunday"+        , "2017, Orthodox : moon, 2017-04-15: Easter, 2017-04-16 Sunday"+        , "2018, Gregorian: moon, 2018-03-31: Easter, 2018-04-01 Sunday"+        , "2018, Orthodox : moon, 2018-04-04: Easter, 2018-04-08 Sunday"+        , "2019, Gregorian: moon, 2019-04-18: Easter, 2019-04-21 Sunday"+        , "2019, Orthodox : moon, 2019-04-23: Easter, 2019-04-28 Sunday"+        , "2020, Gregorian: moon, 2020-04-08: Easter, 2020-04-12 Sunday"+        , "2020, Orthodox : moon, 2020-04-12: Easter, 2020-04-19 Sunday"+        ]
test/main/Test/Calendar/LongWeekYears.hs view
@@ -1,21 +1,30 @@-module Test.Calendar.LongWeekYears(longWeekYears) where+module Test.Calendar.LongWeekYears+    ( longWeekYears+    ) where -import Data.Time.Calendar.WeekDate import Data.Time.Calendar+import Data.Time.Calendar.WeekDate+import Test.Calendar.LongWeekYearsRef import Test.Tasty import Test.Tasty.HUnit-import Test.Calendar.LongWeekYearsRef  longYear :: Integer -> Bool-longYear year = case toWeekDate (fromGregorian year 12 31) of-    (_,53,_) -> True-    _ -> False+longYear year =+    case toWeekDate (fromGregorian year 12 31) of+        (_, 53, _) -> True+        _ -> False  showLongYear :: Integer -> String-showLongYear year-  = unwords [ show year ++ ":"-            , (if isLeapYear year then "L" else " ") ++ (if longYear year then "*" else " ") ]+showLongYear year =+    unwords+        [ show year ++ ":"+        , (if isLeapYear year+               then "L"+               else " ") +++          (if longYear year+               then "*"+               else " ")+        ]  longWeekYears :: TestTree-longWeekYears = testCase "longWeekYears" $-    assertEqual "" longWeekYearsRef $ unlines $ map showLongYear [1901 .. 2050]+longWeekYears = testCase "longWeekYears" $ assertEqual "" longWeekYearsRef $ unlines $ map showLongYear [1901 .. 2050]
test/main/Test/Calendar/LongWeekYearsRef.hs view
@@ -2,154 +2,155 @@  longWeekYearsRef :: String longWeekYearsRef =- unlines-  [ "1901:   "-  , "1902:   "-  , "1903:  *"-  , "1904: L "-  , "1905:   "-  , "1906:   "-  , "1907:   "-  , "1908: L*"-  , "1909:   "-  , "1910:   "-  , "1911:   "-  , "1912: L "-  , "1913:   "-  , "1914:  *"-  , "1915:   "-  , "1916: L "-  , "1917:   "-  , "1918:   "-  , "1919:   "-  , "1920: L*"-  , "1921:   "-  , "1922:   "-  , "1923:   "-  , "1924: L "-  , "1925:  *"-  , "1926:   "-  , "1927:   "-  , "1928: L "-  , "1929:   "-  , "1930:   "-  , "1931:  *"-  , "1932: L "-  , "1933:   "-  , "1934:   "-  , "1935:   "-  , "1936: L*"-  , "1937:   "-  , "1938:   "-  , "1939:   "-  , "1940: L "-  , "1941:   "-  , "1942:  *"-  , "1943:   "-  , "1944: L "-  , "1945:   "-  , "1946:   "-  , "1947:   "-  , "1948: L*"-  , "1949:   "-  , "1950:   "-  , "1951:   "-  , "1952: L "-  , "1953:  *"-  , "1954:   "-  , "1955:   "-  , "1956: L "-  , "1957:   "-  , "1958:   "-  , "1959:  *"-  , "1960: L "-  , "1961:   "-  , "1962:   "-  , "1963:   "-  , "1964: L*"-  , "1965:   "-  , "1966:   "-  , "1967:   "-  , "1968: L "-  , "1969:   "-  , "1970:  *"-  , "1971:   "-  , "1972: L "-  , "1973:   "-  , "1974:   "-  , "1975:   "-  , "1976: L*"-  , "1977:   "-  , "1978:   "-  , "1979:   "-  , "1980: L "-  , "1981:  *"-  , "1982:   "-  , "1983:   "-  , "1984: L "-  , "1985:   "-  , "1986:   "-  , "1987:  *"-  , "1988: L "-  , "1989:   "-  , "1990:   "-  , "1991:   "-  , "1992: L*"-  , "1993:   "-  , "1994:   "-  , "1995:   "-  , "1996: L "-  , "1997:   "-  , "1998:  *"-  , "1999:   "-  , "2000: L "-  , "2001:   "-  , "2002:   "-  , "2003:   "-  , "2004: L*"-  , "2005:   "-  , "2006:   "-  , "2007:   "-  , "2008: L "-  , "2009:  *"-  , "2010:   "-  , "2011:   "-  , "2012: L "-  , "2013:   "-  , "2014:   "-  , "2015:  *"-  , "2016: L "-  , "2017:   "-  , "2018:   "-  , "2019:   "-  , "2020: L*"-  , "2021:   "-  , "2022:   "-  , "2023:   "-  , "2024: L "-  , "2025:   "-  , "2026:  *"-  , "2027:   "-  , "2028: L "-  , "2029:   "-  , "2030:   "-  , "2031:   "-  , "2032: L*"-  , "2033:   "-  , "2034:   "-  , "2035:   "-  , "2036: L "-  , "2037:  *"-  , "2038:   "-  , "2039:   "-  , "2040: L "-  , "2041:   "-  , "2042:   "-  , "2043:  *"-  , "2044: L "-  , "2045:   "-  , "2046:   "-  , "2047:   "-  , "2048: L*"-  , "2049:   "-  , "2050:   " ]+    unlines+        [ "1901:   "+        , "1902:   "+        , "1903:  *"+        , "1904: L "+        , "1905:   "+        , "1906:   "+        , "1907:   "+        , "1908: L*"+        , "1909:   "+        , "1910:   "+        , "1911:   "+        , "1912: L "+        , "1913:   "+        , "1914:  *"+        , "1915:   "+        , "1916: L "+        , "1917:   "+        , "1918:   "+        , "1919:   "+        , "1920: L*"+        , "1921:   "+        , "1922:   "+        , "1923:   "+        , "1924: L "+        , "1925:  *"+        , "1926:   "+        , "1927:   "+        , "1928: L "+        , "1929:   "+        , "1930:   "+        , "1931:  *"+        , "1932: L "+        , "1933:   "+        , "1934:   "+        , "1935:   "+        , "1936: L*"+        , "1937:   "+        , "1938:   "+        , "1939:   "+        , "1940: L "+        , "1941:   "+        , "1942:  *"+        , "1943:   "+        , "1944: L "+        , "1945:   "+        , "1946:   "+        , "1947:   "+        , "1948: L*"+        , "1949:   "+        , "1950:   "+        , "1951:   "+        , "1952: L "+        , "1953:  *"+        , "1954:   "+        , "1955:   "+        , "1956: L "+        , "1957:   "+        , "1958:   "+        , "1959:  *"+        , "1960: L "+        , "1961:   "+        , "1962:   "+        , "1963:   "+        , "1964: L*"+        , "1965:   "+        , "1966:   "+        , "1967:   "+        , "1968: L "+        , "1969:   "+        , "1970:  *"+        , "1971:   "+        , "1972: L "+        , "1973:   "+        , "1974:   "+        , "1975:   "+        , "1976: L*"+        , "1977:   "+        , "1978:   "+        , "1979:   "+        , "1980: L "+        , "1981:  *"+        , "1982:   "+        , "1983:   "+        , "1984: L "+        , "1985:   "+        , "1986:   "+        , "1987:  *"+        , "1988: L "+        , "1989:   "+        , "1990:   "+        , "1991:   "+        , "1992: L*"+        , "1993:   "+        , "1994:   "+        , "1995:   "+        , "1996: L "+        , "1997:   "+        , "1998:  *"+        , "1999:   "+        , "2000: L "+        , "2001:   "+        , "2002:   "+        , "2003:   "+        , "2004: L*"+        , "2005:   "+        , "2006:   "+        , "2007:   "+        , "2008: L "+        , "2009:  *"+        , "2010:   "+        , "2011:   "+        , "2012: L "+        , "2013:   "+        , "2014:   "+        , "2015:  *"+        , "2016: L "+        , "2017:   "+        , "2018:   "+        , "2019:   "+        , "2020: L*"+        , "2021:   "+        , "2022:   "+        , "2023:   "+        , "2024: L "+        , "2025:   "+        , "2026:  *"+        , "2027:   "+        , "2028: L "+        , "2029:   "+        , "2030:   "+        , "2031:   "+        , "2032: L*"+        , "2033:   "+        , "2034:   "+        , "2035:   "+        , "2036: L "+        , "2037:  *"+        , "2038:   "+        , "2039:   "+        , "2040: L "+        , "2041:   "+        , "2042:   "+        , "2043:  *"+        , "2044: L "+        , "2045:   "+        , "2046:   "+        , "2047:   "+        , "2048: L*"+        , "2049:   "+        , "2050:   "+        ]
test/main/Test/Calendar/MonthDay.hs view
@@ -1,23 +1,31 @@-module Test.Calendar.MonthDay(testMonthDay) where+module Test.Calendar.MonthDay+    ( testMonthDay+    ) where  import Data.Time.Calendar.MonthDay+import Test.Calendar.MonthDayRef import Test.Tasty import Test.Tasty.HUnit-import Test.Calendar.MonthDayRef -showCompare :: (Eq a,Show a) => a -> String -> a -> String-showCompare a1 b a2 | a1 == a2 = (show a1) ++ " == " ++ b+showCompare :: (Eq a, Show a) => a -> String -> a -> String+showCompare a1 b a2+    | a1 == a2 = (show a1) ++ " == " ++ b showCompare a1 b a2 = "DIFF: " ++ (show a1) ++ " -> " ++ b ++ " -> " ++ (show a2)  testMonthDay :: TestTree-testMonthDay = testCase "testMonthDay" $-    assertEqual "" testMonthDayRef $ concat $ map (\isL -> unlines (leap isL : yearDays isL)) [False,True]-    where-        leap isLeap = if isLeap then "Leap:" else "Regular:"-        yearDays isLeap =-            map (\yd -> let-                (m,d)  = dayOfYearToMonthAndDay isLeap yd-                yd'    = monthAndDayToDayOfYear isLeap m d-                mdtext = show m ++ "-" ++ show d-            in showCompare yd mdtext yd')-            [-2..369]+testMonthDay =+    testCase "testMonthDay" $+    assertEqual "" testMonthDayRef $ concat $ map (\isL -> unlines (leap isL : yearDays isL)) [False, True]+  where+    leap isLeap =+        if isLeap+            then "Leap:"+            else "Regular:"+    yearDays isLeap =+        map+            (\yd -> let+                 (m, d) = dayOfYearToMonthAndDay isLeap yd+                 yd' = monthAndDayToDayOfYear isLeap m d+                 mdtext = show m ++ "-" ++ show d+                 in showCompare yd mdtext yd')+            [-2 .. 369]
test/main/Test/Calendar/MonthDayRef.hs view
@@ -2,750 +2,751 @@  testMonthDayRef :: String testMonthDayRef =- unlines-  [ "Regular:"-  , "DIFF: -2 -> 1-1 -> 1"-  , "DIFF: -1 -> 1-1 -> 1"-  , "DIFF: 0 -> 1-1 -> 1"-  , "1 == 1-1"-  , "2 == 1-2"-  , "3 == 1-3"-  , "4 == 1-4"-  , "5 == 1-5"-  , "6 == 1-6"-  , "7 == 1-7"-  , "8 == 1-8"-  , "9 == 1-9"-  , "10 == 1-10"-  , "11 == 1-11"-  , "12 == 1-12"-  , "13 == 1-13"-  , "14 == 1-14"-  , "15 == 1-15"-  , "16 == 1-16"-  , "17 == 1-17"-  , "18 == 1-18"-  , "19 == 1-19"-  , "20 == 1-20"-  , "21 == 1-21"-  , "22 == 1-22"-  , "23 == 1-23"-  , "24 == 1-24"-  , "25 == 1-25"-  , "26 == 1-26"-  , "27 == 1-27"-  , "28 == 1-28"-  , "29 == 1-29"-  , "30 == 1-30"-  , "31 == 1-31"-  , "32 == 2-1"-  , "33 == 2-2"-  , "34 == 2-3"-  , "35 == 2-4"-  , "36 == 2-5"-  , "37 == 2-6"-  , "38 == 2-7"-  , "39 == 2-8"-  , "40 == 2-9"-  , "41 == 2-10"-  , "42 == 2-11"-  , "43 == 2-12"-  , "44 == 2-13"-  , "45 == 2-14"-  , "46 == 2-15"-  , "47 == 2-16"-  , "48 == 2-17"-  , "49 == 2-18"-  , "50 == 2-19"-  , "51 == 2-20"-  , "52 == 2-21"-  , "53 == 2-22"-  , "54 == 2-23"-  , "55 == 2-24"-  , "56 == 2-25"-  , "57 == 2-26"-  , "58 == 2-27"-  , "59 == 2-28"-  , "60 == 3-1"-  , "61 == 3-2"-  , "62 == 3-3"-  , "63 == 3-4"-  , "64 == 3-5"-  , "65 == 3-6"-  , "66 == 3-7"-  , "67 == 3-8"-  , "68 == 3-9"-  , "69 == 3-10"-  , "70 == 3-11"-  , "71 == 3-12"-  , "72 == 3-13"-  , "73 == 3-14"-  , "74 == 3-15"-  , "75 == 3-16"-  , "76 == 3-17"-  , "77 == 3-18"-  , "78 == 3-19"-  , "79 == 3-20"-  , "80 == 3-21"-  , "81 == 3-22"-  , "82 == 3-23"-  , "83 == 3-24"-  , "84 == 3-25"-  , "85 == 3-26"-  , "86 == 3-27"-  , "87 == 3-28"-  , "88 == 3-29"-  , "89 == 3-30"-  , "90 == 3-31"-  , "91 == 4-1"-  , "92 == 4-2"-  , "93 == 4-3"-  , "94 == 4-4"-  , "95 == 4-5"-  , "96 == 4-6"-  , "97 == 4-7"-  , "98 == 4-8"-  , "99 == 4-9"-  , "100 == 4-10"-  , "101 == 4-11"-  , "102 == 4-12"-  , "103 == 4-13"-  , "104 == 4-14"-  , "105 == 4-15"-  , "106 == 4-16"-  , "107 == 4-17"-  , "108 == 4-18"-  , "109 == 4-19"-  , "110 == 4-20"-  , "111 == 4-21"-  , "112 == 4-22"-  , "113 == 4-23"-  , "114 == 4-24"-  , "115 == 4-25"-  , "116 == 4-26"-  , "117 == 4-27"-  , "118 == 4-28"-  , "119 == 4-29"-  , "120 == 4-30"-  , "121 == 5-1"-  , "122 == 5-2"-  , "123 == 5-3"-  , "124 == 5-4"-  , "125 == 5-5"-  , "126 == 5-6"-  , "127 == 5-7"-  , "128 == 5-8"-  , "129 == 5-9"-  , "130 == 5-10"-  , "131 == 5-11"-  , "132 == 5-12"-  , "133 == 5-13"-  , "134 == 5-14"-  , "135 == 5-15"-  , "136 == 5-16"-  , "137 == 5-17"-  , "138 == 5-18"-  , "139 == 5-19"-  , "140 == 5-20"-  , "141 == 5-21"-  , "142 == 5-22"-  , "143 == 5-23"-  , "144 == 5-24"-  , "145 == 5-25"-  , "146 == 5-26"-  , "147 == 5-27"-  , "148 == 5-28"-  , "149 == 5-29"-  , "150 == 5-30"-  , "151 == 5-31"-  , "152 == 6-1"-  , "153 == 6-2"-  , "154 == 6-3"-  , "155 == 6-4"-  , "156 == 6-5"-  , "157 == 6-6"-  , "158 == 6-7"-  , "159 == 6-8"-  , "160 == 6-9"-  , "161 == 6-10"-  , "162 == 6-11"-  , "163 == 6-12"-  , "164 == 6-13"-  , "165 == 6-14"-  , "166 == 6-15"-  , "167 == 6-16"-  , "168 == 6-17"-  , "169 == 6-18"-  , "170 == 6-19"-  , "171 == 6-20"-  , "172 == 6-21"-  , "173 == 6-22"-  , "174 == 6-23"-  , "175 == 6-24"-  , "176 == 6-25"-  , "177 == 6-26"-  , "178 == 6-27"-  , "179 == 6-28"-  , "180 == 6-29"-  , "181 == 6-30"-  , "182 == 7-1"-  , "183 == 7-2"-  , "184 == 7-3"-  , "185 == 7-4"-  , "186 == 7-5"-  , "187 == 7-6"-  , "188 == 7-7"-  , "189 == 7-8"-  , "190 == 7-9"-  , "191 == 7-10"-  , "192 == 7-11"-  , "193 == 7-12"-  , "194 == 7-13"-  , "195 == 7-14"-  , "196 == 7-15"-  , "197 == 7-16"-  , "198 == 7-17"-  , "199 == 7-18"-  , "200 == 7-19"-  , "201 == 7-20"-  , "202 == 7-21"-  , "203 == 7-22"-  , "204 == 7-23"-  , "205 == 7-24"-  , "206 == 7-25"-  , "207 == 7-26"-  , "208 == 7-27"-  , "209 == 7-28"-  , "210 == 7-29"-  , "211 == 7-30"-  , "212 == 7-31"-  , "213 == 8-1"-  , "214 == 8-2"-  , "215 == 8-3"-  , "216 == 8-4"-  , "217 == 8-5"-  , "218 == 8-6"-  , "219 == 8-7"-  , "220 == 8-8"-  , "221 == 8-9"-  , "222 == 8-10"-  , "223 == 8-11"-  , "224 == 8-12"-  , "225 == 8-13"-  , "226 == 8-14"-  , "227 == 8-15"-  , "228 == 8-16"-  , "229 == 8-17"-  , "230 == 8-18"-  , "231 == 8-19"-  , "232 == 8-20"-  , "233 == 8-21"-  , "234 == 8-22"-  , "235 == 8-23"-  , "236 == 8-24"-  , "237 == 8-25"-  , "238 == 8-26"-  , "239 == 8-27"-  , "240 == 8-28"-  , "241 == 8-29"-  , "242 == 8-30"-  , "243 == 8-31"-  , "244 == 9-1"-  , "245 == 9-2"-  , "246 == 9-3"-  , "247 == 9-4"-  , "248 == 9-5"-  , "249 == 9-6"-  , "250 == 9-7"-  , "251 == 9-8"-  , "252 == 9-9"-  , "253 == 9-10"-  , "254 == 9-11"-  , "255 == 9-12"-  , "256 == 9-13"-  , "257 == 9-14"-  , "258 == 9-15"-  , "259 == 9-16"-  , "260 == 9-17"-  , "261 == 9-18"-  , "262 == 9-19"-  , "263 == 9-20"-  , "264 == 9-21"-  , "265 == 9-22"-  , "266 == 9-23"-  , "267 == 9-24"-  , "268 == 9-25"-  , "269 == 9-26"-  , "270 == 9-27"-  , "271 == 9-28"-  , "272 == 9-29"-  , "273 == 9-30"-  , "274 == 10-1"-  , "275 == 10-2"-  , "276 == 10-3"-  , "277 == 10-4"-  , "278 == 10-5"-  , "279 == 10-6"-  , "280 == 10-7"-  , "281 == 10-8"-  , "282 == 10-9"-  , "283 == 10-10"-  , "284 == 10-11"-  , "285 == 10-12"-  , "286 == 10-13"-  , "287 == 10-14"-  , "288 == 10-15"-  , "289 == 10-16"-  , "290 == 10-17"-  , "291 == 10-18"-  , "292 == 10-19"-  , "293 == 10-20"-  , "294 == 10-21"-  , "295 == 10-22"-  , "296 == 10-23"-  , "297 == 10-24"-  , "298 == 10-25"-  , "299 == 10-26"-  , "300 == 10-27"-  , "301 == 10-28"-  , "302 == 10-29"-  , "303 == 10-30"-  , "304 == 10-31"-  , "305 == 11-1"-  , "306 == 11-2"-  , "307 == 11-3"-  , "308 == 11-4"-  , "309 == 11-5"-  , "310 == 11-6"-  , "311 == 11-7"-  , "312 == 11-8"-  , "313 == 11-9"-  , "314 == 11-10"-  , "315 == 11-11"-  , "316 == 11-12"-  , "317 == 11-13"-  , "318 == 11-14"-  , "319 == 11-15"-  , "320 == 11-16"-  , "321 == 11-17"-  , "322 == 11-18"-  , "323 == 11-19"-  , "324 == 11-20"-  , "325 == 11-21"-  , "326 == 11-22"-  , "327 == 11-23"-  , "328 == 11-24"-  , "329 == 11-25"-  , "330 == 11-26"-  , "331 == 11-27"-  , "332 == 11-28"-  , "333 == 11-29"-  , "334 == 11-30"-  , "335 == 12-1"-  , "336 == 12-2"-  , "337 == 12-3"-  , "338 == 12-4"-  , "339 == 12-5"-  , "340 == 12-6"-  , "341 == 12-7"-  , "342 == 12-8"-  , "343 == 12-9"-  , "344 == 12-10"-  , "345 == 12-11"-  , "346 == 12-12"-  , "347 == 12-13"-  , "348 == 12-14"-  , "349 == 12-15"-  , "350 == 12-16"-  , "351 == 12-17"-  , "352 == 12-18"-  , "353 == 12-19"-  , "354 == 12-20"-  , "355 == 12-21"-  , "356 == 12-22"-  , "357 == 12-23"-  , "358 == 12-24"-  , "359 == 12-25"-  , "360 == 12-26"-  , "361 == 12-27"-  , "362 == 12-28"-  , "363 == 12-29"-  , "364 == 12-30"-  , "365 == 12-31"-  , "DIFF: 366 -> 12-31 -> 365"-  , "DIFF: 367 -> 12-31 -> 365"-  , "DIFF: 368 -> 12-31 -> 365"-  , "DIFF: 369 -> 12-31 -> 365"-  , "Leap:"-  , "DIFF: -2 -> 1-1 -> 1"-  , "DIFF: -1 -> 1-1 -> 1"-  , "DIFF: 0 -> 1-1 -> 1"-  , "1 == 1-1"-  , "2 == 1-2"-  , "3 == 1-3"-  , "4 == 1-4"-  , "5 == 1-5"-  , "6 == 1-6"-  , "7 == 1-7"-  , "8 == 1-8"-  , "9 == 1-9"-  , "10 == 1-10"-  , "11 == 1-11"-  , "12 == 1-12"-  , "13 == 1-13"-  , "14 == 1-14"-  , "15 == 1-15"-  , "16 == 1-16"-  , "17 == 1-17"-  , "18 == 1-18"-  , "19 == 1-19"-  , "20 == 1-20"-  , "21 == 1-21"-  , "22 == 1-22"-  , "23 == 1-23"-  , "24 == 1-24"-  , "25 == 1-25"-  , "26 == 1-26"-  , "27 == 1-27"-  , "28 == 1-28"-  , "29 == 1-29"-  , "30 == 1-30"-  , "31 == 1-31"-  , "32 == 2-1"-  , "33 == 2-2"-  , "34 == 2-3"-  , "35 == 2-4"-  , "36 == 2-5"-  , "37 == 2-6"-  , "38 == 2-7"-  , "39 == 2-8"-  , "40 == 2-9"-  , "41 == 2-10"-  , "42 == 2-11"-  , "43 == 2-12"-  , "44 == 2-13"-  , "45 == 2-14"-  , "46 == 2-15"-  , "47 == 2-16"-  , "48 == 2-17"-  , "49 == 2-18"-  , "50 == 2-19"-  , "51 == 2-20"-  , "52 == 2-21"-  , "53 == 2-22"-  , "54 == 2-23"-  , "55 == 2-24"-  , "56 == 2-25"-  , "57 == 2-26"-  , "58 == 2-27"-  , "59 == 2-28"-  , "60 == 2-29"-  , "61 == 3-1"-  , "62 == 3-2"-  , "63 == 3-3"-  , "64 == 3-4"-  , "65 == 3-5"-  , "66 == 3-6"-  , "67 == 3-7"-  , "68 == 3-8"-  , "69 == 3-9"-  , "70 == 3-10"-  , "71 == 3-11"-  , "72 == 3-12"-  , "73 == 3-13"-  , "74 == 3-14"-  , "75 == 3-15"-  , "76 == 3-16"-  , "77 == 3-17"-  , "78 == 3-18"-  , "79 == 3-19"-  , "80 == 3-20"-  , "81 == 3-21"-  , "82 == 3-22"-  , "83 == 3-23"-  , "84 == 3-24"-  , "85 == 3-25"-  , "86 == 3-26"-  , "87 == 3-27"-  , "88 == 3-28"-  , "89 == 3-29"-  , "90 == 3-30"-  , "91 == 3-31"-  , "92 == 4-1"-  , "93 == 4-2"-  , "94 == 4-3"-  , "95 == 4-4"-  , "96 == 4-5"-  , "97 == 4-6"-  , "98 == 4-7"-  , "99 == 4-8"-  , "100 == 4-9"-  , "101 == 4-10"-  , "102 == 4-11"-  , "103 == 4-12"-  , "104 == 4-13"-  , "105 == 4-14"-  , "106 == 4-15"-  , "107 == 4-16"-  , "108 == 4-17"-  , "109 == 4-18"-  , "110 == 4-19"-  , "111 == 4-20"-  , "112 == 4-21"-  , "113 == 4-22"-  , "114 == 4-23"-  , "115 == 4-24"-  , "116 == 4-25"-  , "117 == 4-26"-  , "118 == 4-27"-  , "119 == 4-28"-  , "120 == 4-29"-  , "121 == 4-30"-  , "122 == 5-1"-  , "123 == 5-2"-  , "124 == 5-3"-  , "125 == 5-4"-  , "126 == 5-5"-  , "127 == 5-6"-  , "128 == 5-7"-  , "129 == 5-8"-  , "130 == 5-9"-  , "131 == 5-10"-  , "132 == 5-11"-  , "133 == 5-12"-  , "134 == 5-13"-  , "135 == 5-14"-  , "136 == 5-15"-  , "137 == 5-16"-  , "138 == 5-17"-  , "139 == 5-18"-  , "140 == 5-19"-  , "141 == 5-20"-  , "142 == 5-21"-  , "143 == 5-22"-  , "144 == 5-23"-  , "145 == 5-24"-  , "146 == 5-25"-  , "147 == 5-26"-  , "148 == 5-27"-  , "149 == 5-28"-  , "150 == 5-29"-  , "151 == 5-30"-  , "152 == 5-31"-  , "153 == 6-1"-  , "154 == 6-2"-  , "155 == 6-3"-  , "156 == 6-4"-  , "157 == 6-5"-  , "158 == 6-6"-  , "159 == 6-7"-  , "160 == 6-8"-  , "161 == 6-9"-  , "162 == 6-10"-  , "163 == 6-11"-  , "164 == 6-12"-  , "165 == 6-13"-  , "166 == 6-14"-  , "167 == 6-15"-  , "168 == 6-16"-  , "169 == 6-17"-  , "170 == 6-18"-  , "171 == 6-19"-  , "172 == 6-20"-  , "173 == 6-21"-  , "174 == 6-22"-  , "175 == 6-23"-  , "176 == 6-24"-  , "177 == 6-25"-  , "178 == 6-26"-  , "179 == 6-27"-  , "180 == 6-28"-  , "181 == 6-29"-  , "182 == 6-30"-  , "183 == 7-1"-  , "184 == 7-2"-  , "185 == 7-3"-  , "186 == 7-4"-  , "187 == 7-5"-  , "188 == 7-6"-  , "189 == 7-7"-  , "190 == 7-8"-  , "191 == 7-9"-  , "192 == 7-10"-  , "193 == 7-11"-  , "194 == 7-12"-  , "195 == 7-13"-  , "196 == 7-14"-  , "197 == 7-15"-  , "198 == 7-16"-  , "199 == 7-17"-  , "200 == 7-18"-  , "201 == 7-19"-  , "202 == 7-20"-  , "203 == 7-21"-  , "204 == 7-22"-  , "205 == 7-23"-  , "206 == 7-24"-  , "207 == 7-25"-  , "208 == 7-26"-  , "209 == 7-27"-  , "210 == 7-28"-  , "211 == 7-29"-  , "212 == 7-30"-  , "213 == 7-31"-  , "214 == 8-1"-  , "215 == 8-2"-  , "216 == 8-3"-  , "217 == 8-4"-  , "218 == 8-5"-  , "219 == 8-6"-  , "220 == 8-7"-  , "221 == 8-8"-  , "222 == 8-9"-  , "223 == 8-10"-  , "224 == 8-11"-  , "225 == 8-12"-  , "226 == 8-13"-  , "227 == 8-14"-  , "228 == 8-15"-  , "229 == 8-16"-  , "230 == 8-17"-  , "231 == 8-18"-  , "232 == 8-19"-  , "233 == 8-20"-  , "234 == 8-21"-  , "235 == 8-22"-  , "236 == 8-23"-  , "237 == 8-24"-  , "238 == 8-25"-  , "239 == 8-26"-  , "240 == 8-27"-  , "241 == 8-28"-  , "242 == 8-29"-  , "243 == 8-30"-  , "244 == 8-31"-  , "245 == 9-1"-  , "246 == 9-2"-  , "247 == 9-3"-  , "248 == 9-4"-  , "249 == 9-5"-  , "250 == 9-6"-  , "251 == 9-7"-  , "252 == 9-8"-  , "253 == 9-9"-  , "254 == 9-10"-  , "255 == 9-11"-  , "256 == 9-12"-  , "257 == 9-13"-  , "258 == 9-14"-  , "259 == 9-15"-  , "260 == 9-16"-  , "261 == 9-17"-  , "262 == 9-18"-  , "263 == 9-19"-  , "264 == 9-20"-  , "265 == 9-21"-  , "266 == 9-22"-  , "267 == 9-23"-  , "268 == 9-24"-  , "269 == 9-25"-  , "270 == 9-26"-  , "271 == 9-27"-  , "272 == 9-28"-  , "273 == 9-29"-  , "274 == 9-30"-  , "275 == 10-1"-  , "276 == 10-2"-  , "277 == 10-3"-  , "278 == 10-4"-  , "279 == 10-5"-  , "280 == 10-6"-  , "281 == 10-7"-  , "282 == 10-8"-  , "283 == 10-9"-  , "284 == 10-10"-  , "285 == 10-11"-  , "286 == 10-12"-  , "287 == 10-13"-  , "288 == 10-14"-  , "289 == 10-15"-  , "290 == 10-16"-  , "291 == 10-17"-  , "292 == 10-18"-  , "293 == 10-19"-  , "294 == 10-20"-  , "295 == 10-21"-  , "296 == 10-22"-  , "297 == 10-23"-  , "298 == 10-24"-  , "299 == 10-25"-  , "300 == 10-26"-  , "301 == 10-27"-  , "302 == 10-28"-  , "303 == 10-29"-  , "304 == 10-30"-  , "305 == 10-31"-  , "306 == 11-1"-  , "307 == 11-2"-  , "308 == 11-3"-  , "309 == 11-4"-  , "310 == 11-5"-  , "311 == 11-6"-  , "312 == 11-7"-  , "313 == 11-8"-  , "314 == 11-9"-  , "315 == 11-10"-  , "316 == 11-11"-  , "317 == 11-12"-  , "318 == 11-13"-  , "319 == 11-14"-  , "320 == 11-15"-  , "321 == 11-16"-  , "322 == 11-17"-  , "323 == 11-18"-  , "324 == 11-19"-  , "325 == 11-20"-  , "326 == 11-21"-  , "327 == 11-22"-  , "328 == 11-23"-  , "329 == 11-24"-  , "330 == 11-25"-  , "331 == 11-26"-  , "332 == 11-27"-  , "333 == 11-28"-  , "334 == 11-29"-  , "335 == 11-30"-  , "336 == 12-1"-  , "337 == 12-2"-  , "338 == 12-3"-  , "339 == 12-4"-  , "340 == 12-5"-  , "341 == 12-6"-  , "342 == 12-7"-  , "343 == 12-8"-  , "344 == 12-9"-  , "345 == 12-10"-  , "346 == 12-11"-  , "347 == 12-12"-  , "348 == 12-13"-  , "349 == 12-14"-  , "350 == 12-15"-  , "351 == 12-16"-  , "352 == 12-17"-  , "353 == 12-18"-  , "354 == 12-19"-  , "355 == 12-20"-  , "356 == 12-21"-  , "357 == 12-22"-  , "358 == 12-23"-  , "359 == 12-24"-  , "360 == 12-25"-  , "361 == 12-26"-  , "362 == 12-27"-  , "363 == 12-28"-  , "364 == 12-29"-  , "365 == 12-30"-  , "366 == 12-31"-  , "DIFF: 367 -> 12-31 -> 366"-  , "DIFF: 368 -> 12-31 -> 366"-  , "DIFF: 369 -> 12-31 -> 366" ]+    unlines+        [ "Regular:"+        , "DIFF: -2 -> 1-1 -> 1"+        , "DIFF: -1 -> 1-1 -> 1"+        , "DIFF: 0 -> 1-1 -> 1"+        , "1 == 1-1"+        , "2 == 1-2"+        , "3 == 1-3"+        , "4 == 1-4"+        , "5 == 1-5"+        , "6 == 1-6"+        , "7 == 1-7"+        , "8 == 1-8"+        , "9 == 1-9"+        , "10 == 1-10"+        , "11 == 1-11"+        , "12 == 1-12"+        , "13 == 1-13"+        , "14 == 1-14"+        , "15 == 1-15"+        , "16 == 1-16"+        , "17 == 1-17"+        , "18 == 1-18"+        , "19 == 1-19"+        , "20 == 1-20"+        , "21 == 1-21"+        , "22 == 1-22"+        , "23 == 1-23"+        , "24 == 1-24"+        , "25 == 1-25"+        , "26 == 1-26"+        , "27 == 1-27"+        , "28 == 1-28"+        , "29 == 1-29"+        , "30 == 1-30"+        , "31 == 1-31"+        , "32 == 2-1"+        , "33 == 2-2"+        , "34 == 2-3"+        , "35 == 2-4"+        , "36 == 2-5"+        , "37 == 2-6"+        , "38 == 2-7"+        , "39 == 2-8"+        , "40 == 2-9"+        , "41 == 2-10"+        , "42 == 2-11"+        , "43 == 2-12"+        , "44 == 2-13"+        , "45 == 2-14"+        , "46 == 2-15"+        , "47 == 2-16"+        , "48 == 2-17"+        , "49 == 2-18"+        , "50 == 2-19"+        , "51 == 2-20"+        , "52 == 2-21"+        , "53 == 2-22"+        , "54 == 2-23"+        , "55 == 2-24"+        , "56 == 2-25"+        , "57 == 2-26"+        , "58 == 2-27"+        , "59 == 2-28"+        , "60 == 3-1"+        , "61 == 3-2"+        , "62 == 3-3"+        , "63 == 3-4"+        , "64 == 3-5"+        , "65 == 3-6"+        , "66 == 3-7"+        , "67 == 3-8"+        , "68 == 3-9"+        , "69 == 3-10"+        , "70 == 3-11"+        , "71 == 3-12"+        , "72 == 3-13"+        , "73 == 3-14"+        , "74 == 3-15"+        , "75 == 3-16"+        , "76 == 3-17"+        , "77 == 3-18"+        , "78 == 3-19"+        , "79 == 3-20"+        , "80 == 3-21"+        , "81 == 3-22"+        , "82 == 3-23"+        , "83 == 3-24"+        , "84 == 3-25"+        , "85 == 3-26"+        , "86 == 3-27"+        , "87 == 3-28"+        , "88 == 3-29"+        , "89 == 3-30"+        , "90 == 3-31"+        , "91 == 4-1"+        , "92 == 4-2"+        , "93 == 4-3"+        , "94 == 4-4"+        , "95 == 4-5"+        , "96 == 4-6"+        , "97 == 4-7"+        , "98 == 4-8"+        , "99 == 4-9"+        , "100 == 4-10"+        , "101 == 4-11"+        , "102 == 4-12"+        , "103 == 4-13"+        , "104 == 4-14"+        , "105 == 4-15"+        , "106 == 4-16"+        , "107 == 4-17"+        , "108 == 4-18"+        , "109 == 4-19"+        , "110 == 4-20"+        , "111 == 4-21"+        , "112 == 4-22"+        , "113 == 4-23"+        , "114 == 4-24"+        , "115 == 4-25"+        , "116 == 4-26"+        , "117 == 4-27"+        , "118 == 4-28"+        , "119 == 4-29"+        , "120 == 4-30"+        , "121 == 5-1"+        , "122 == 5-2"+        , "123 == 5-3"+        , "124 == 5-4"+        , "125 == 5-5"+        , "126 == 5-6"+        , "127 == 5-7"+        , "128 == 5-8"+        , "129 == 5-9"+        , "130 == 5-10"+        , "131 == 5-11"+        , "132 == 5-12"+        , "133 == 5-13"+        , "134 == 5-14"+        , "135 == 5-15"+        , "136 == 5-16"+        , "137 == 5-17"+        , "138 == 5-18"+        , "139 == 5-19"+        , "140 == 5-20"+        , "141 == 5-21"+        , "142 == 5-22"+        , "143 == 5-23"+        , "144 == 5-24"+        , "145 == 5-25"+        , "146 == 5-26"+        , "147 == 5-27"+        , "148 == 5-28"+        , "149 == 5-29"+        , "150 == 5-30"+        , "151 == 5-31"+        , "152 == 6-1"+        , "153 == 6-2"+        , "154 == 6-3"+        , "155 == 6-4"+        , "156 == 6-5"+        , "157 == 6-6"+        , "158 == 6-7"+        , "159 == 6-8"+        , "160 == 6-9"+        , "161 == 6-10"+        , "162 == 6-11"+        , "163 == 6-12"+        , "164 == 6-13"+        , "165 == 6-14"+        , "166 == 6-15"+        , "167 == 6-16"+        , "168 == 6-17"+        , "169 == 6-18"+        , "170 == 6-19"+        , "171 == 6-20"+        , "172 == 6-21"+        , "173 == 6-22"+        , "174 == 6-23"+        , "175 == 6-24"+        , "176 == 6-25"+        , "177 == 6-26"+        , "178 == 6-27"+        , "179 == 6-28"+        , "180 == 6-29"+        , "181 == 6-30"+        , "182 == 7-1"+        , "183 == 7-2"+        , "184 == 7-3"+        , "185 == 7-4"+        , "186 == 7-5"+        , "187 == 7-6"+        , "188 == 7-7"+        , "189 == 7-8"+        , "190 == 7-9"+        , "191 == 7-10"+        , "192 == 7-11"+        , "193 == 7-12"+        , "194 == 7-13"+        , "195 == 7-14"+        , "196 == 7-15"+        , "197 == 7-16"+        , "198 == 7-17"+        , "199 == 7-18"+        , "200 == 7-19"+        , "201 == 7-20"+        , "202 == 7-21"+        , "203 == 7-22"+        , "204 == 7-23"+        , "205 == 7-24"+        , "206 == 7-25"+        , "207 == 7-26"+        , "208 == 7-27"+        , "209 == 7-28"+        , "210 == 7-29"+        , "211 == 7-30"+        , "212 == 7-31"+        , "213 == 8-1"+        , "214 == 8-2"+        , "215 == 8-3"+        , "216 == 8-4"+        , "217 == 8-5"+        , "218 == 8-6"+        , "219 == 8-7"+        , "220 == 8-8"+        , "221 == 8-9"+        , "222 == 8-10"+        , "223 == 8-11"+        , "224 == 8-12"+        , "225 == 8-13"+        , "226 == 8-14"+        , "227 == 8-15"+        , "228 == 8-16"+        , "229 == 8-17"+        , "230 == 8-18"+        , "231 == 8-19"+        , "232 == 8-20"+        , "233 == 8-21"+        , "234 == 8-22"+        , "235 == 8-23"+        , "236 == 8-24"+        , "237 == 8-25"+        , "238 == 8-26"+        , "239 == 8-27"+        , "240 == 8-28"+        , "241 == 8-29"+        , "242 == 8-30"+        , "243 == 8-31"+        , "244 == 9-1"+        , "245 == 9-2"+        , "246 == 9-3"+        , "247 == 9-4"+        , "248 == 9-5"+        , "249 == 9-6"+        , "250 == 9-7"+        , "251 == 9-8"+        , "252 == 9-9"+        , "253 == 9-10"+        , "254 == 9-11"+        , "255 == 9-12"+        , "256 == 9-13"+        , "257 == 9-14"+        , "258 == 9-15"+        , "259 == 9-16"+        , "260 == 9-17"+        , "261 == 9-18"+        , "262 == 9-19"+        , "263 == 9-20"+        , "264 == 9-21"+        , "265 == 9-22"+        , "266 == 9-23"+        , "267 == 9-24"+        , "268 == 9-25"+        , "269 == 9-26"+        , "270 == 9-27"+        , "271 == 9-28"+        , "272 == 9-29"+        , "273 == 9-30"+        , "274 == 10-1"+        , "275 == 10-2"+        , "276 == 10-3"+        , "277 == 10-4"+        , "278 == 10-5"+        , "279 == 10-6"+        , "280 == 10-7"+        , "281 == 10-8"+        , "282 == 10-9"+        , "283 == 10-10"+        , "284 == 10-11"+        , "285 == 10-12"+        , "286 == 10-13"+        , "287 == 10-14"+        , "288 == 10-15"+        , "289 == 10-16"+        , "290 == 10-17"+        , "291 == 10-18"+        , "292 == 10-19"+        , "293 == 10-20"+        , "294 == 10-21"+        , "295 == 10-22"+        , "296 == 10-23"+        , "297 == 10-24"+        , "298 == 10-25"+        , "299 == 10-26"+        , "300 == 10-27"+        , "301 == 10-28"+        , "302 == 10-29"+        , "303 == 10-30"+        , "304 == 10-31"+        , "305 == 11-1"+        , "306 == 11-2"+        , "307 == 11-3"+        , "308 == 11-4"+        , "309 == 11-5"+        , "310 == 11-6"+        , "311 == 11-7"+        , "312 == 11-8"+        , "313 == 11-9"+        , "314 == 11-10"+        , "315 == 11-11"+        , "316 == 11-12"+        , "317 == 11-13"+        , "318 == 11-14"+        , "319 == 11-15"+        , "320 == 11-16"+        , "321 == 11-17"+        , "322 == 11-18"+        , "323 == 11-19"+        , "324 == 11-20"+        , "325 == 11-21"+        , "326 == 11-22"+        , "327 == 11-23"+        , "328 == 11-24"+        , "329 == 11-25"+        , "330 == 11-26"+        , "331 == 11-27"+        , "332 == 11-28"+        , "333 == 11-29"+        , "334 == 11-30"+        , "335 == 12-1"+        , "336 == 12-2"+        , "337 == 12-3"+        , "338 == 12-4"+        , "339 == 12-5"+        , "340 == 12-6"+        , "341 == 12-7"+        , "342 == 12-8"+        , "343 == 12-9"+        , "344 == 12-10"+        , "345 == 12-11"+        , "346 == 12-12"+        , "347 == 12-13"+        , "348 == 12-14"+        , "349 == 12-15"+        , "350 == 12-16"+        , "351 == 12-17"+        , "352 == 12-18"+        , "353 == 12-19"+        , "354 == 12-20"+        , "355 == 12-21"+        , "356 == 12-22"+        , "357 == 12-23"+        , "358 == 12-24"+        , "359 == 12-25"+        , "360 == 12-26"+        , "361 == 12-27"+        , "362 == 12-28"+        , "363 == 12-29"+        , "364 == 12-30"+        , "365 == 12-31"+        , "DIFF: 366 -> 12-31 -> 365"+        , "DIFF: 367 -> 12-31 -> 365"+        , "DIFF: 368 -> 12-31 -> 365"+        , "DIFF: 369 -> 12-31 -> 365"+        , "Leap:"+        , "DIFF: -2 -> 1-1 -> 1"+        , "DIFF: -1 -> 1-1 -> 1"+        , "DIFF: 0 -> 1-1 -> 1"+        , "1 == 1-1"+        , "2 == 1-2"+        , "3 == 1-3"+        , "4 == 1-4"+        , "5 == 1-5"+        , "6 == 1-6"+        , "7 == 1-7"+        , "8 == 1-8"+        , "9 == 1-9"+        , "10 == 1-10"+        , "11 == 1-11"+        , "12 == 1-12"+        , "13 == 1-13"+        , "14 == 1-14"+        , "15 == 1-15"+        , "16 == 1-16"+        , "17 == 1-17"+        , "18 == 1-18"+        , "19 == 1-19"+        , "20 == 1-20"+        , "21 == 1-21"+        , "22 == 1-22"+        , "23 == 1-23"+        , "24 == 1-24"+        , "25 == 1-25"+        , "26 == 1-26"+        , "27 == 1-27"+        , "28 == 1-28"+        , "29 == 1-29"+        , "30 == 1-30"+        , "31 == 1-31"+        , "32 == 2-1"+        , "33 == 2-2"+        , "34 == 2-3"+        , "35 == 2-4"+        , "36 == 2-5"+        , "37 == 2-6"+        , "38 == 2-7"+        , "39 == 2-8"+        , "40 == 2-9"+        , "41 == 2-10"+        , "42 == 2-11"+        , "43 == 2-12"+        , "44 == 2-13"+        , "45 == 2-14"+        , "46 == 2-15"+        , "47 == 2-16"+        , "48 == 2-17"+        , "49 == 2-18"+        , "50 == 2-19"+        , "51 == 2-20"+        , "52 == 2-21"+        , "53 == 2-22"+        , "54 == 2-23"+        , "55 == 2-24"+        , "56 == 2-25"+        , "57 == 2-26"+        , "58 == 2-27"+        , "59 == 2-28"+        , "60 == 2-29"+        , "61 == 3-1"+        , "62 == 3-2"+        , "63 == 3-3"+        , "64 == 3-4"+        , "65 == 3-5"+        , "66 == 3-6"+        , "67 == 3-7"+        , "68 == 3-8"+        , "69 == 3-9"+        , "70 == 3-10"+        , "71 == 3-11"+        , "72 == 3-12"+        , "73 == 3-13"+        , "74 == 3-14"+        , "75 == 3-15"+        , "76 == 3-16"+        , "77 == 3-17"+        , "78 == 3-18"+        , "79 == 3-19"+        , "80 == 3-20"+        , "81 == 3-21"+        , "82 == 3-22"+        , "83 == 3-23"+        , "84 == 3-24"+        , "85 == 3-25"+        , "86 == 3-26"+        , "87 == 3-27"+        , "88 == 3-28"+        , "89 == 3-29"+        , "90 == 3-30"+        , "91 == 3-31"+        , "92 == 4-1"+        , "93 == 4-2"+        , "94 == 4-3"+        , "95 == 4-4"+        , "96 == 4-5"+        , "97 == 4-6"+        , "98 == 4-7"+        , "99 == 4-8"+        , "100 == 4-9"+        , "101 == 4-10"+        , "102 == 4-11"+        , "103 == 4-12"+        , "104 == 4-13"+        , "105 == 4-14"+        , "106 == 4-15"+        , "107 == 4-16"+        , "108 == 4-17"+        , "109 == 4-18"+        , "110 == 4-19"+        , "111 == 4-20"+        , "112 == 4-21"+        , "113 == 4-22"+        , "114 == 4-23"+        , "115 == 4-24"+        , "116 == 4-25"+        , "117 == 4-26"+        , "118 == 4-27"+        , "119 == 4-28"+        , "120 == 4-29"+        , "121 == 4-30"+        , "122 == 5-1"+        , "123 == 5-2"+        , "124 == 5-3"+        , "125 == 5-4"+        , "126 == 5-5"+        , "127 == 5-6"+        , "128 == 5-7"+        , "129 == 5-8"+        , "130 == 5-9"+        , "131 == 5-10"+        , "132 == 5-11"+        , "133 == 5-12"+        , "134 == 5-13"+        , "135 == 5-14"+        , "136 == 5-15"+        , "137 == 5-16"+        , "138 == 5-17"+        , "139 == 5-18"+        , "140 == 5-19"+        , "141 == 5-20"+        , "142 == 5-21"+        , "143 == 5-22"+        , "144 == 5-23"+        , "145 == 5-24"+        , "146 == 5-25"+        , "147 == 5-26"+        , "148 == 5-27"+        , "149 == 5-28"+        , "150 == 5-29"+        , "151 == 5-30"+        , "152 == 5-31"+        , "153 == 6-1"+        , "154 == 6-2"+        , "155 == 6-3"+        , "156 == 6-4"+        , "157 == 6-5"+        , "158 == 6-6"+        , "159 == 6-7"+        , "160 == 6-8"+        , "161 == 6-9"+        , "162 == 6-10"+        , "163 == 6-11"+        , "164 == 6-12"+        , "165 == 6-13"+        , "166 == 6-14"+        , "167 == 6-15"+        , "168 == 6-16"+        , "169 == 6-17"+        , "170 == 6-18"+        , "171 == 6-19"+        , "172 == 6-20"+        , "173 == 6-21"+        , "174 == 6-22"+        , "175 == 6-23"+        , "176 == 6-24"+        , "177 == 6-25"+        , "178 == 6-26"+        , "179 == 6-27"+        , "180 == 6-28"+        , "181 == 6-29"+        , "182 == 6-30"+        , "183 == 7-1"+        , "184 == 7-2"+        , "185 == 7-3"+        , "186 == 7-4"+        , "187 == 7-5"+        , "188 == 7-6"+        , "189 == 7-7"+        , "190 == 7-8"+        , "191 == 7-9"+        , "192 == 7-10"+        , "193 == 7-11"+        , "194 == 7-12"+        , "195 == 7-13"+        , "196 == 7-14"+        , "197 == 7-15"+        , "198 == 7-16"+        , "199 == 7-17"+        , "200 == 7-18"+        , "201 == 7-19"+        , "202 == 7-20"+        , "203 == 7-21"+        , "204 == 7-22"+        , "205 == 7-23"+        , "206 == 7-24"+        , "207 == 7-25"+        , "208 == 7-26"+        , "209 == 7-27"+        , "210 == 7-28"+        , "211 == 7-29"+        , "212 == 7-30"+        , "213 == 7-31"+        , "214 == 8-1"+        , "215 == 8-2"+        , "216 == 8-3"+        , "217 == 8-4"+        , "218 == 8-5"+        , "219 == 8-6"+        , "220 == 8-7"+        , "221 == 8-8"+        , "222 == 8-9"+        , "223 == 8-10"+        , "224 == 8-11"+        , "225 == 8-12"+        , "226 == 8-13"+        , "227 == 8-14"+        , "228 == 8-15"+        , "229 == 8-16"+        , "230 == 8-17"+        , "231 == 8-18"+        , "232 == 8-19"+        , "233 == 8-20"+        , "234 == 8-21"+        , "235 == 8-22"+        , "236 == 8-23"+        , "237 == 8-24"+        , "238 == 8-25"+        , "239 == 8-26"+        , "240 == 8-27"+        , "241 == 8-28"+        , "242 == 8-29"+        , "243 == 8-30"+        , "244 == 8-31"+        , "245 == 9-1"+        , "246 == 9-2"+        , "247 == 9-3"+        , "248 == 9-4"+        , "249 == 9-5"+        , "250 == 9-6"+        , "251 == 9-7"+        , "252 == 9-8"+        , "253 == 9-9"+        , "254 == 9-10"+        , "255 == 9-11"+        , "256 == 9-12"+        , "257 == 9-13"+        , "258 == 9-14"+        , "259 == 9-15"+        , "260 == 9-16"+        , "261 == 9-17"+        , "262 == 9-18"+        , "263 == 9-19"+        , "264 == 9-20"+        , "265 == 9-21"+        , "266 == 9-22"+        , "267 == 9-23"+        , "268 == 9-24"+        , "269 == 9-25"+        , "270 == 9-26"+        , "271 == 9-27"+        , "272 == 9-28"+        , "273 == 9-29"+        , "274 == 9-30"+        , "275 == 10-1"+        , "276 == 10-2"+        , "277 == 10-3"+        , "278 == 10-4"+        , "279 == 10-5"+        , "280 == 10-6"+        , "281 == 10-7"+        , "282 == 10-8"+        , "283 == 10-9"+        , "284 == 10-10"+        , "285 == 10-11"+        , "286 == 10-12"+        , "287 == 10-13"+        , "288 == 10-14"+        , "289 == 10-15"+        , "290 == 10-16"+        , "291 == 10-17"+        , "292 == 10-18"+        , "293 == 10-19"+        , "294 == 10-20"+        , "295 == 10-21"+        , "296 == 10-22"+        , "297 == 10-23"+        , "298 == 10-24"+        , "299 == 10-25"+        , "300 == 10-26"+        , "301 == 10-27"+        , "302 == 10-28"+        , "303 == 10-29"+        , "304 == 10-30"+        , "305 == 10-31"+        , "306 == 11-1"+        , "307 == 11-2"+        , "308 == 11-3"+        , "309 == 11-4"+        , "310 == 11-5"+        , "311 == 11-6"+        , "312 == 11-7"+        , "313 == 11-8"+        , "314 == 11-9"+        , "315 == 11-10"+        , "316 == 11-11"+        , "317 == 11-12"+        , "318 == 11-13"+        , "319 == 11-14"+        , "320 == 11-15"+        , "321 == 11-16"+        , "322 == 11-17"+        , "323 == 11-18"+        , "324 == 11-19"+        , "325 == 11-20"+        , "326 == 11-21"+        , "327 == 11-22"+        , "328 == 11-23"+        , "329 == 11-24"+        , "330 == 11-25"+        , "331 == 11-26"+        , "332 == 11-27"+        , "333 == 11-28"+        , "334 == 11-29"+        , "335 == 11-30"+        , "336 == 12-1"+        , "337 == 12-2"+        , "338 == 12-3"+        , "339 == 12-4"+        , "340 == 12-5"+        , "341 == 12-6"+        , "342 == 12-7"+        , "343 == 12-8"+        , "344 == 12-9"+        , "345 == 12-10"+        , "346 == 12-11"+        , "347 == 12-12"+        , "348 == 12-13"+        , "349 == 12-14"+        , "350 == 12-15"+        , "351 == 12-16"+        , "352 == 12-17"+        , "353 == 12-18"+        , "354 == 12-19"+        , "355 == 12-20"+        , "356 == 12-21"+        , "357 == 12-22"+        , "358 == 12-23"+        , "359 == 12-24"+        , "360 == 12-25"+        , "361 == 12-26"+        , "362 == 12-27"+        , "363 == 12-28"+        , "364 == 12-29"+        , "365 == 12-30"+        , "366 == 12-31"+        , "DIFF: 367 -> 12-31 -> 366"+        , "DIFF: 368 -> 12-31 -> 366"+        , "DIFF: 369 -> 12-31 -> 366"+        ]
test/main/Test/Calendar/Valid.hs view
@@ -1,95 +1,152 @@-module Test.Calendar.Valid(testValid) where+module Test.Calendar.Valid+    ( testValid+    ) where  import Data.Time+import Data.Time.Calendar.Julian import Data.Time.Calendar.OrdinalDate import Data.Time.Calendar.WeekDate-import Data.Time.Calendar.Julian+import Test.QuickCheck.Property import Test.Tasty import Test.Tasty.QuickCheck hiding (reason)-import Test.QuickCheck.Property --validResult :: (Eq c,Show c,Eq t,Show t) =>-    (s -> c) -> Bool -> (t -> c) -> (c -> t) -> (c -> Maybe t) -> s -> Result+validResult :: (Eq c, Show c, Eq t, Show t) => (s -> c) -> Bool -> (t -> c) -> (c -> t) -> (c -> Maybe t) -> s -> Result validResult sc valid toComponents fromComponents fromComponentsValid s = let     c = sc s     mt = fromComponentsValid c     t' = fromComponents c     c' = toComponents t'-    in if valid then-        case mt of-            Nothing -> rejected-            Just t -> if t' /= t-                then failed {reason = "'fromValid' gives " ++ show t ++ ", but 'from' gives " ++ show t'}-                else if c' /= c-                then failed {reason = "found valid, but converts " ++ show c ++ " -> " ++ show t' ++ " -> " ++ show c'}-                else succeeded-        else case mt of-            Nothing -> if c' /= c-                then succeeded-                else failed {reason = show c ++ " found invalid, but converts with " ++ show t'}-            Just _ -> rejected+    in if valid+           then case mt of+                    Nothing -> rejected+                    Just t ->+                        if t' /= t+                            then failed {reason = "'fromValid' gives " ++ show t ++ ", but 'from' gives " ++ show t'}+                            else if c' /= c+                                     then failed+                                              { reason =+                                                    "found valid, but converts " +++                                                    show c ++ " -> " ++ show t' ++ " -> " ++ show c'+                                              }+                                     else succeeded+           else case mt of+                    Nothing ->+                        if c' /= c+                            then succeeded+                            else failed {reason = show c ++ " found invalid, but converts with " ++ show t'}+                    Just _ -> rejected -validTest :: (Arbitrary s,Show s,Eq c,Show c,Eq t,Show t) =>-    String -> (s -> c) -> (t -> c) -> (c -> t) -> (c -> Maybe t) -> TestTree-validTest name sc toComponents fromComponents fromComponentsValid = testGroup name-    [-    testProperty "valid" $ property $ validResult sc True toComponents fromComponents fromComponentsValid,-    testProperty "invalid" $ property $ validResult sc False toComponents fromComponents fromComponentsValid-    ]+validTest ::+       (Arbitrary s, Show s, Eq c, Show c, Eq t, Show t)+    => String+    -> (s -> c)+    -> (t -> c)+    -> (c -> t)+    -> (c -> Maybe t)+    -> TestTree+validTest name sc toComponents fromComponents fromComponentsValid =+    testGroup+        name+        [ testProperty "valid" $ property $ validResult sc True toComponents fromComponents fromComponentsValid+        , testProperty "invalid" $ property $ validResult sc False toComponents fromComponents fromComponentsValid+        ] -toSundayStartWeek :: Day -> (Integer,Int,Int)+toSundayStartWeek :: Day -> (Integer, Int, Int) toSundayStartWeek day = let-    (y,_) = toOrdinalDate day-    (w,d) = sundayStartWeek day-    in (y,w,d)+    (y, _) = toOrdinalDate day+    (w, d) = sundayStartWeek day+    in (y, w, d) -toMondayStartWeek :: Day -> (Integer,Int,Int)+toMondayStartWeek :: Day -> (Integer, Int, Int) toMondayStartWeek day = let-    (y,_) = toOrdinalDate day-    (w,d) = mondayStartWeek day-    in (y,w,d)+    (y, _) = toOrdinalDate day+    (w, d) = mondayStartWeek day+    in (y, w, d) -newtype Year = MkYear Integer deriving (Eq,Show)+newtype Year =+    MkYear Integer+    deriving (Eq, Show)+ instance Arbitrary Year where-    arbitrary = fmap MkYear $ choose (-1000,3000)+    arbitrary = fmap MkYear $ choose (-1000, 3000) -newtype YearMonth = MkYearMonth Int deriving (Eq,Show)+newtype YearMonth =+    MkYearMonth Int+    deriving (Eq, Show)+ instance Arbitrary YearMonth where-    arbitrary = fmap MkYearMonth $ choose (-5,17)+    arbitrary = fmap MkYearMonth $ choose (-5, 17) -newtype MonthDay = MkMonthDay Int deriving (Eq,Show)+newtype MonthDay =+    MkMonthDay Int+    deriving (Eq, Show)+ instance Arbitrary MonthDay where-    arbitrary = fmap MkMonthDay $ choose (-5,35)+    arbitrary = fmap MkMonthDay $ choose (-5, 35) -newtype YearDay = MkYearDay Int deriving (Eq,Show)+newtype YearDay =+    MkYearDay Int+    deriving (Eq, Show)+ instance Arbitrary YearDay where-    arbitrary = fmap MkYearDay $ choose (-20,400)+    arbitrary = fmap MkYearDay $ choose (-20, 400) -newtype YearWeek = MkYearWeek Int deriving (Eq,Show)+newtype YearWeek =+    MkYearWeek Int+    deriving (Eq, Show)+ instance Arbitrary YearWeek where-    arbitrary = fmap MkYearWeek $ choose (-5,60)+    arbitrary = fmap MkYearWeek $ choose (-5, 60) -newtype WeekDay = MkWeekDay Int deriving (Eq,Show)+newtype WeekDay =+    MkWeekDay Int+    deriving (Eq, Show)+ instance Arbitrary WeekDay where-    arbitrary = fmap MkWeekDay $ choose (-5,15)+    arbitrary = fmap MkWeekDay $ choose (-5, 15) -fromYMD :: (Year,YearMonth,MonthDay) -> (Integer,Int,Int)-fromYMD (MkYear y,MkYearMonth ym,MkMonthDay md) = (y,ym,md)+fromYMD :: (Year, YearMonth, MonthDay) -> (Integer, Int, Int)+fromYMD (MkYear y, MkYearMonth ym, MkMonthDay md) = (y, ym, md) -fromYD :: (Year,YearDay) -> (Integer,Int)-fromYD (MkYear y,MkYearDay yd) = (y,yd)+fromYD :: (Year, YearDay) -> (Integer, Int)+fromYD (MkYear y, MkYearDay yd) = (y, yd) -fromYWD :: (Year,YearWeek,WeekDay) -> (Integer,Int,Int)-fromYWD (MkYear y,MkYearWeek yw,MkWeekDay wd) = (y,yw,wd)+fromYWD :: (Year, YearWeek, WeekDay) -> (Integer, Int, Int)+fromYWD (MkYear y, MkYearWeek yw, MkWeekDay wd) = (y, yw, wd)  testValid :: TestTree-testValid = testGroup "testValid"-    [-    validTest "Gregorian" fromYMD toGregorian (\(y,m,d) -> fromGregorian y m d) (\(y,m,d) -> fromGregorianValid y m d),-    validTest "OrdinalDate" fromYD toOrdinalDate (\(y,d) -> fromOrdinalDate y d) (\(y,d) -> fromOrdinalDateValid y d),-    validTest "WeekDate" fromYWD toWeekDate (\(y,w,d) -> fromWeekDate y w d) (\(y,w,d) -> fromWeekDateValid y w d),-    validTest "SundayStartWeek" fromYWD toSundayStartWeek (\(y,w,d) -> fromSundayStartWeek y w d) (\(y,w,d) -> fromSundayStartWeekValid y w d),-    validTest "MondayStartWeek" fromYWD toMondayStartWeek (\(y,w,d) -> fromMondayStartWeek y w d) (\(y,w,d) -> fromMondayStartWeekValid y w d),-    validTest "Julian" fromYMD toJulian (\(y,m,d) -> fromJulian y m d) (\(y,m,d) -> fromJulianValid y m d)-    ]+testValid =+    testGroup+        "testValid"+        [ validTest+              "Gregorian"+              fromYMD+              toGregorian+              (\(y, m, d) -> fromGregorian y m d)+              (\(y, m, d) -> fromGregorianValid y m d)+        , validTest+              "OrdinalDate"+              fromYD+              toOrdinalDate+              (\(y, d) -> fromOrdinalDate y d)+              (\(y, d) -> fromOrdinalDateValid y d)+        , validTest+              "WeekDate"+              fromYWD+              toWeekDate+              (\(y, w, d) -> fromWeekDate y w d)+              (\(y, w, d) -> fromWeekDateValid y w d)+        , validTest+              "SundayStartWeek"+              fromYWD+              toSundayStartWeek+              (\(y, w, d) -> fromSundayStartWeek y w d)+              (\(y, w, d) -> fromSundayStartWeekValid y w d)+        , validTest+              "MondayStartWeek"+              fromYWD+              toMondayStartWeek+              (\(y, w, d) -> fromMondayStartWeek y w d)+              (\(y, w, d) -> fromMondayStartWeekValid y w d)+        , validTest "Julian" fromYMD toJulian (\(y, m, d) -> fromJulian y m d) (\(y, m, d) -> fromJulianValid y m d)+        ]
test/main/Test/Clock/Conversion.hs view
@@ -1,25 +1,25 @@-module Test.Clock.Conversion(testClockConversion) where+module Test.Clock.Conversion+    ( testClockConversion+    ) where  import Data.Time.Clock import Data.Time.Clock.System import Test.Tasty import Test.Tasty.HUnit --testClockConversion :: TestTree;-testClockConversion = testGroup "clock conversion" $ let-    testPair :: (SystemTime,UTCTime) -> TestTree-    testPair (st,ut) = testGroup (show ut) $-        [-            testCase "systemToUTCTime" $ assertEqual (show ut) ut $ systemToUTCTime st,-            testCase "utcToSystemTime" $ assertEqual (show ut) st $ utcToSystemTime ut-        ]-    in-    [-        testPair (MkSystemTime 0 0,UTCTime systemEpochDay 0),-        testPair (MkSystemTime 86399 0,UTCTime systemEpochDay 86399),-        testPair (MkSystemTime 86399 999999999,UTCTime systemEpochDay 86399.999999999),-        testPair (MkSystemTime 86399 1000000000,UTCTime systemEpochDay 86400),-        testPair (MkSystemTime 86399 1999999999,UTCTime systemEpochDay 86400.999999999),-        testPair (MkSystemTime 86400 0,UTCTime (succ systemEpochDay) 0)-    ]+testClockConversion :: TestTree+testClockConversion =+    testGroup "clock conversion" $ let+        testPair :: (SystemTime, UTCTime) -> TestTree+        testPair (st, ut) =+            testGroup (show ut) $+            [ testCase "systemToUTCTime" $ assertEqual (show ut) ut $ systemToUTCTime st+            , testCase "utcToSystemTime" $ assertEqual (show ut) st $ utcToSystemTime ut+            ]+        in [ testPair (MkSystemTime 0 0, UTCTime systemEpochDay 0)+           , testPair (MkSystemTime 86399 0, UTCTime systemEpochDay 86399)+           , testPair (MkSystemTime 86399 999999999, UTCTime systemEpochDay 86399.999999999)+           , testPair (MkSystemTime 86399 1000000000, UTCTime systemEpochDay 86400)+           , testPair (MkSystemTime 86399 1999999999, UTCTime systemEpochDay 86400.999999999)+           , testPair (MkSystemTime 86400 0, UTCTime (succ systemEpochDay) 0)+           ]
test/main/Test/Clock/Resolution.hs view
@@ -1,4 +1,6 @@-module Test.Clock.Resolution(testResolutions) where+module Test.Clock.Resolution+    ( testResolutions+    ) where  import Control.Concurrent import Data.Fixed@@ -12,7 +14,7 @@ repeatN n ma = do     a <- ma     aa <- repeatN (n - 1) ma-    return $ a:aa+    return $ a : aa  gcd' :: Real a => a -> a -> a gcd' a 0 = a@@ -21,32 +23,41 @@ gcdAll :: Real a => [a] -> a gcdAll = foldr gcd' 0 -testResolution :: (Show dt,Real dt) => String -> (at -> at -> dt) -> (dt,IO at) -> TestTree-testResolution name timeDiff (res,getTime) = testCase name $ do-    t0 <- getTime-    times0 <- repeatN 100 $ do-        threadDelay 0-        getTime-    times1 <- repeatN 100 $ do -- 100us-        threadDelay 1 -- 1us-        getTime-    times2 <- repeatN 100 $ do -- 1ms-        threadDelay 10 -- 10us-        getTime-    times3 <- repeatN 100 $ do -- 10ms-        threadDelay 100 -- 100us-        getTime-    times4 <- repeatN 100 $ do -- 100ms-        threadDelay 1000 -- 1ms-        getTime-    let times = fmap (\t -> timeDiff t t0) $ times0 ++ times1 ++ times2 ++ times3 ++ times4-    assertEqual "resolution" res $ gcdAll times+testResolution :: (Show dt, Real dt) => String -> (at -> at -> dt) -> (dt, IO at) -> TestTree+testResolution name timeDiff (res, getTime) =+    testCase name $ do+        t0 <- getTime+        times0 <-+            repeatN 100 $ do+                threadDelay 0+                getTime+        times1 <-+            repeatN 100 $ -- 100us+             do+                threadDelay 1 -- 1us+                getTime+        times2 <-+            repeatN 100 $ -- 1ms+             do+                threadDelay 10 -- 10us+                getTime+        times3 <-+            repeatN 100 $ -- 10ms+             do+                threadDelay 100 -- 100us+                getTime+        times4 <-+            repeatN 100 $ -- 100ms+             do+                threadDelay 1000 -- 1ms+                getTime+        let times = fmap (\t -> timeDiff t t0) $ times0 ++ times1 ++ times2 ++ times3 ++ times4+        assertEqual "resolution" res $ gcdAll times  testResolutions :: TestTree-testResolutions = testGroup "resolution" $-    [-    testResolution "getCurrentTime" diffUTCTime (realToFrac getTime_resolution,getCurrentTime)-    ]-    ++ case taiClock of+testResolutions =+    testGroup "resolution" $+    [testResolution "getCurrentTime" diffUTCTime (realToFrac getTime_resolution, getCurrentTime)] +++    case taiClock of         Just clock -> [testResolution "taiClock" diffAbsoluteTime clock]         Nothing -> []
test/main/Test/Clock/TAI.hs view
@@ -1,4 +1,6 @@-module Test.Clock.TAI(testTAI) where+module Test.Clock.TAI+    ( testTAI+    ) where  import Data.Time import Data.Time.Clock.TAI@@ -6,57 +8,51 @@ import Test.Tasty.HUnit import Test.TestUtil - sampleLeapSecondMap :: LeapSecondMap-sampleLeapSecondMap d | d < fromGregorian 1972 1 1 = Nothing-sampleLeapSecondMap d | d < fromGregorian 1972 7 1 = Just 10-sampleLeapSecondMap d | d < fromGregorian 1975 1 1 = Just 11+sampleLeapSecondMap d+    | d < fromGregorian 1972 1 1 = Nothing+sampleLeapSecondMap d+    | d < fromGregorian 1972 7 1 = Just 10+sampleLeapSecondMap d+    | d < fromGregorian 1975 1 1 = Just 11 sampleLeapSecondMap _ = Nothing -testTAI :: TestTree;-testTAI = testGroup "leap second transition" $ let-    dayA = fromGregorian 1972 6 30-    dayB = fromGregorian 1972 7 1--    utcTime1 = UTCTime dayA 86399-    utcTime2 = UTCTime dayA 86400-    utcTime3 = UTCTime dayB 0--    mAbsTime1 = utcToTAITime sampleLeapSecondMap utcTime1-    mAbsTime2 = utcToTAITime sampleLeapSecondMap utcTime2-    mAbsTime3 = utcToTAITime sampleLeapSecondMap utcTime3-    in-    [-        testCase "mapping" $ do-            assertEqual "dayA" (Just 10) $ sampleLeapSecondMap dayA-            assertEqual "dayB" (Just 11) $ sampleLeapSecondMap dayB-        ,-        testCase "day length" $ do-            assertEqual "dayA" (Just 86401) $ utcDayLength sampleLeapSecondMap dayA-            assertEqual "dayB" (Just 86400) $ utcDayLength sampleLeapSecondMap dayB-        ,-        testCase "differences" $ do-            absTime1 <- assertJust mAbsTime1-            absTime2 <- assertJust mAbsTime2-            absTime3 <- assertJust mAbsTime3-            assertEqual "absTime2 - absTime1" 1 $ diffAbsoluteTime absTime2 absTime1-            assertEqual "absTime3 - absTime2" 1 $ diffAbsoluteTime absTime3 absTime2-        ,-        testGroup "round-trip"-        [-            testCase "1" $ do-                absTime <- assertJust mAbsTime1-                utcTime <- assertJust $ taiToUTCTime sampleLeapSecondMap absTime-                assertEqual "round-trip" utcTime1 utcTime-            ,-            testCase "2" $ do-                absTime <- assertJust mAbsTime2-                utcTime <- assertJust $ taiToUTCTime sampleLeapSecondMap absTime-                assertEqual "round-trip" utcTime2 utcTime-            ,-            testCase "3" $ do-                absTime <- assertJust mAbsTime3-                utcTime <- assertJust $ taiToUTCTime sampleLeapSecondMap absTime-                assertEqual "round-trip" utcTime3 utcTime-        ]-    ]+testTAI :: TestTree+testTAI =+    testGroup "leap second transition" $ let+        dayA = fromGregorian 1972 6 30+        dayB = fromGregorian 1972 7 1+        utcTime1 = UTCTime dayA 86399+        utcTime2 = UTCTime dayA 86400+        utcTime3 = UTCTime dayB 0+        mAbsTime1 = utcToTAITime sampleLeapSecondMap utcTime1+        mAbsTime2 = utcToTAITime sampleLeapSecondMap utcTime2+        mAbsTime3 = utcToTAITime sampleLeapSecondMap utcTime3+        in [ testCase "mapping" $ do+                 assertEqual "dayA" (Just 10) $ sampleLeapSecondMap dayA+                 assertEqual "dayB" (Just 11) $ sampleLeapSecondMap dayB+           , testCase "day length" $ do+                 assertEqual "dayA" (Just 86401) $ utcDayLength sampleLeapSecondMap dayA+                 assertEqual "dayB" (Just 86400) $ utcDayLength sampleLeapSecondMap dayB+           , testCase "differences" $ do+                 absTime1 <- assertJust mAbsTime1+                 absTime2 <- assertJust mAbsTime2+                 absTime3 <- assertJust mAbsTime3+                 assertEqual "absTime2 - absTime1" 1 $ diffAbsoluteTime absTime2 absTime1+                 assertEqual "absTime3 - absTime2" 1 $ diffAbsoluteTime absTime3 absTime2+           , testGroup+                 "round-trip"+                 [ testCase "1" $ do+                       absTime <- assertJust mAbsTime1+                       utcTime <- assertJust $ taiToUTCTime sampleLeapSecondMap absTime+                       assertEqual "round-trip" utcTime1 utcTime+                 , testCase "2" $ do+                       absTime <- assertJust mAbsTime2+                       utcTime <- assertJust $ taiToUTCTime sampleLeapSecondMap absTime+                       assertEqual "round-trip" utcTime2 utcTime+                 , testCase "3" $ do+                       absTime <- assertJust mAbsTime3+                       utcTime <- assertJust $ taiToUTCTime sampleLeapSecondMap absTime+                       assertEqual "round-trip" utcTime3 utcTime+                 ]+           ]
+ test/main/Test/Format/Compile.hs view
@@ -0,0 +1,16 @@+-- Tests succeed if module compiles+{-# LANGUAGE GeneralizedNewtypeDeriving #-}++module Test.Format.Compile+    (+    ) where++import Data.Time++newtype WrappedUTCTime =+    MkWrappedUTCTime UTCTime+    deriving (FormatTime, ParseTime)++newtype Wrapped t =+    MkWrapped t+    deriving (FormatTime, ParseTime)
test/main/Test/Format/Format.hs view
@@ -1,12 +1,13 @@-module Test.Format.Format(testFormat) where+module Test.Format.Format+    ( testFormat+    ) where -import Data.Time import Data.Proxy+import Data.Time import Test.Tasty import Test.Tasty.HUnit import Test.TestUtil - -- as found in http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html -- plus FgGklz -- f not supported@@ -20,29 +21,35 @@ modifiers = "_-0^"  widths :: [String]-widths = ["","1","2","9","12"]+widths = ["", "1", "2", "9", "12"]  formats :: [String]-formats =  ["%G-W%V-%u","%U-%w","%W-%u"] ++ (fmap (\char -> '%':[char]) chars)- ++ (concat $ fmap (\char -> concat $ fmap (\width -> fmap (\modifier -> "%" ++ [modifier] ++ width ++ [char]) modifiers) widths) chars)+formats =+    ["%G-W%V-%u", "%U-%w", "%W-%u"] +++    (fmap (\char -> '%' : [char]) chars) +++    (concat $+     fmap+         (\char -> concat $ fmap (\width -> fmap (\modifier -> "%" ++ [modifier] ++ width ++ [char]) modifiers) widths)+         chars)  somestrings :: [String] somestrings = ["", " ", "-", "\n"] -compareExpected :: (Eq t,Show t,ParseTime t) => String -> String -> String -> proxy t -> TestTree-compareExpected testname fmt str proxy = testCase testname $ do-    let-        found :: ParseTime t => proxy t -> Maybe t-        found _ = parseTimeM False defaultTimeLocale fmt str-    assertEqual "" Nothing $ found proxy+compareExpected :: (Eq t, Show t, ParseTime t) => String -> String -> String -> Proxy t -> TestTree+compareExpected testname fmt str proxy =+    testCase testname $ do+        let+            found :: ParseTime t => Proxy t -> Maybe t+            found _ = parseTimeM False defaultTimeLocale fmt str+        assertEqual "" Nothing $ found proxy  checkParse :: String -> String -> [TestTree]-checkParse fmt str = [-    compareExpected "Day" fmt str (Proxy :: Proxy Day),-    compareExpected "TimeOfDay" fmt str (Proxy :: Proxy TimeOfDay),-    compareExpected "LocalTime" fmt str (Proxy :: Proxy LocalTime),-    compareExpected "TimeZone" fmt str (Proxy :: Proxy TimeZone),-    compareExpected "UTCTime" fmt str (Proxy :: Proxy UTCTime)+checkParse fmt str =+    [ compareExpected "Day" fmt str (Proxy :: Proxy Day)+    , compareExpected "TimeOfDay" fmt str (Proxy :: Proxy TimeOfDay)+    , compareExpected "LocalTime" fmt str (Proxy :: Proxy LocalTime)+    , compareExpected "TimeZone" fmt str (Proxy :: Proxy TimeZone)+    , compareExpected "UTCTime" fmt str (Proxy :: Proxy UTCTime)     ]  testCheckParse :: TestTree@@ -52,107 +59,143 @@ days = [(fromGregorian 2018 1 5) .. (fromGregorian 2018 1 26)]  testDayOfWeek :: TestTree-testDayOfWeek  = testGroup "DayOfWeek" $ tgroup "uwaA" $ \fmt -> tgroup days $ \day -> let-    dayFormat = formatTime defaultTimeLocale ['%',fmt] day-    dowFormat = formatTime defaultTimeLocale ['%',fmt] $ dayOfWeek day-    in assertEqual "" dayFormat dowFormat+testDayOfWeek =+    testGroup "DayOfWeek" $+    tgroup "uwaA" $ \fmt ->+        tgroup days $ \day -> let+            dayFormat = formatTime defaultTimeLocale ['%', fmt] day+            dowFormat = formatTime defaultTimeLocale ['%', fmt] $ dayOfWeek day+            in assertEqual "" dayFormat dowFormat  testZone :: String -> String -> Int -> TestTree-testZone fmt expected minutes = testCase (show fmt) $ assertEqual "" expected $ formatTime defaultTimeLocale fmt $ TimeZone minutes False ""+testZone fmt expected minutes =+    testCase (show fmt) $ assertEqual "" expected $ formatTime defaultTimeLocale fmt $ TimeZone minutes False ""  testZonePair :: String -> String -> Int -> TestTree-testZonePair mods expected minutes = testGroup (show mods ++ " " ++ show minutes)-    [-        testZone ("%" ++ mods ++ "z") expected minutes,-        testZone ("%" ++ mods ++ "Z") expected minutes-    ]+testZonePair mods expected minutes =+    testGroup+        (show mods ++ " " ++ show minutes)+        [testZone ("%" ++ mods ++ "z") expected minutes, testZone ("%" ++ mods ++ "Z") expected minutes]  testTimeZone :: TestTree-testTimeZone = testGroup "TimeZone"-    [-    testZonePair "" "+0000" 0,-    testZonePair "E" "+00:00" 0,-    testZonePair "" "+0500" 300,-    testZonePair "E" "+05:00" 300,-    testZonePair "3" "+0500" 300,-    testZonePair "4E" "+05:00" 300,-    testZonePair "4" "+0500" 300,-    testZonePair "5E" "+05:00" 300,-    testZonePair "5" "+00500" 300,-    testZonePair "6E" "+005:00" 300,-    testZonePair "" "-0700" (-420),-    testZonePair "E" "-07:00" (-420),-    testZonePair "" "+1015" 615,-    testZonePair "E" "+10:15" 615,-    testZonePair "3" "+1015" 615,-    testZonePair "4E" "+10:15" 615,-    testZonePair "4" "+1015" 615,-    testZonePair "5E" "+10:15" 615,-    testZonePair "5" "+01015" 615,-    testZonePair "6E" "+010:15" 615,-    testZonePair "" "-1130" (-690),-    testZonePair "E" "-11:30" (-690)-    ]+testTimeZone =+    testGroup+        "TimeZone"+        [ testZonePair "" "+0000" 0+        , testZonePair "E" "+00:00" 0+        , testZonePair "" "+0500" 300+        , testZonePair "E" "+05:00" 300+        , testZonePair "3" "+0500" 300+        , testZonePair "4E" "+05:00" 300+        , testZonePair "4" "+0500" 300+        , testZonePair "5E" "+05:00" 300+        , testZonePair "5" "+00500" 300+        , testZonePair "6E" "+005:00" 300+        , testZonePair "" "-0700" (-420)+        , testZonePair "E" "-07:00" (-420)+        , testZonePair "" "+1015" 615+        , testZonePair "E" "+10:15" 615+        , testZonePair "3" "+1015" 615+        , testZonePair "4E" "+10:15" 615+        , testZonePair "4" "+1015" 615+        , testZonePair "5E" "+10:15" 615+        , testZonePair "5" "+01015" 615+        , testZonePair "6E" "+010:15" 615+        , testZonePair "" "-1130" (-690)+        , testZonePair "E" "-11:30" (-690)+        ]  testAFormat :: FormatTime t => String -> String -> t -> TestTree testAFormat fmt expected t = testCase fmt $ assertEqual "" expected $ formatTime defaultTimeLocale fmt t  testNominalDiffTime :: TestTree-testNominalDiffTime = testGroup "NominalDiffTime"-    [-        testAFormat "%ww%Dd%Hh%Mm%ESs" "3w2d2h22m8.21s" $ (fromRational $ 23 * 86400 + 8528.21 :: NominalDiffTime),-        testAFormat "%dd %hh %mm %ss %Ess" "0d 0h 0m 0s 0.74s" $ (fromRational $ 0.74 :: NominalDiffTime),-        testAFormat "%dd %hh %mm %ss %Ess" "0d 0h 0m 0s -0.74s" $ (fromRational $ negate $ 0.74 :: NominalDiffTime),-        testAFormat "%dd %hh %mm %ss %Ess %0Ess" "23d 554h 33262m 1995728s 1995728.21s 1995728.210000000000s" $ (fromRational $ 23 * 86400 + 8528.21 :: NominalDiffTime),-        testAFormat "%ww%Dd%Hh%Mm%Ss" "-3w-2d-2h-22m-8s" $ (fromRational $ negate $ 23 * 86400 + 8528.21 :: NominalDiffTime),-        testAFormat "%ww%Dd%Hh%Mm%ESs" "-3w-2d-2h-22m-8.21s" $ (fromRational $ negate $ 23 * 86400 + 8528.21 :: NominalDiffTime),-        testAFormat "%ww%Dd%Hh%Mm%Ss" "-3w-2d-2h-22m0s" $ (fromRational $ negate $ 23 * 86400 + 8520.21 :: NominalDiffTime),-        testAFormat "%ww%Dd%Hh%Mm%ESs" "-3w-2d-2h-22m-0.21s" $ (fromRational $ negate $ 23 * 86400 + 8520.21 :: NominalDiffTime),-        testAFormat "%dd %hh %mm %Ess" "-23d -554h -33262m -1995728.21s" $ (fromRational $ negate $ 23 * 86400 + 8528.21 :: NominalDiffTime)-    ]+testNominalDiffTime =+    testGroup+        "NominalDiffTime"+        [ testAFormat "%ww%Dd%Hh%Mm%ESs" "3w2d2h22m8.21s" $ (fromRational $ 23 * 86400 + 8528.21 :: NominalDiffTime)+        , testAFormat "%dd %hh %mm %ss %Ess" "0d 0h 0m 0s 0.74s" $ (fromRational $ 0.74 :: NominalDiffTime)+        , testAFormat "%dd %hh %mm %ss %Ess" "0d 0h 0m 0s -0.74s" $ (fromRational $ negate $ 0.74 :: NominalDiffTime)+        , testAFormat "%dd %hh %mm %ss %Ess %0Ess" "23d 554h 33262m 1995728s 1995728.21s 1995728.210000000000s" $+          (fromRational $ 23 * 86400 + 8528.21 :: NominalDiffTime)+        , testAFormat "%ww%Dd%Hh%Mm%Ss" "-3w-2d-2h-22m-8s" $+          (fromRational $ negate $ 23 * 86400 + 8528.21 :: NominalDiffTime)+        , testAFormat "%ww%Dd%Hh%Mm%ESs" "-3w-2d-2h-22m-8.21s" $+          (fromRational $ negate $ 23 * 86400 + 8528.21 :: NominalDiffTime)+        , testAFormat "%ww%Dd%Hh%Mm%Ss" "-3w-2d-2h-22m0s" $+          (fromRational $ negate $ 23 * 86400 + 8520.21 :: NominalDiffTime)+        , testAFormat "%ww%Dd%Hh%Mm%ESs" "-3w-2d-2h-22m-0.21s" $+          (fromRational $ negate $ 23 * 86400 + 8520.21 :: NominalDiffTime)+        , testAFormat "%dd %hh %mm %Ess" "-23d -554h -33262m -1995728.21s" $+          (fromRational $ negate $ 23 * 86400 + 8528.21 :: NominalDiffTime)+        , testAFormat "%3Es" "1.200" (1.2 :: NominalDiffTime)+        , testAFormat "%3ES" "01.200" (1.2 :: NominalDiffTime)+        , testAFormat "%3ES" "01.200" (61.2 :: NominalDiffTime)+        , testAFormat "%3Es" "1.245" (1.24582 :: NominalDiffTime)+        , testAFormat "%3ES" "01.245" (1.24582 :: NominalDiffTime)+        , testAFormat "%3ES" "01.245" (61.24582 :: NominalDiffTime)+        ]  testDiffTime :: TestTree-testDiffTime = testGroup "DiffTime"-    [-        testAFormat "%ww%Dd%Hh%Mm%ESs" "3w2d2h22m8.21s" $ (fromRational $ 23 * 86400 + 8528.21 :: DiffTime),-        testAFormat "%dd %hh %mm %ss %Ess" "0d 0h 0m 0s 0.74s" $ (fromRational $ 0.74 :: DiffTime),-        testAFormat "%dd %hh %mm %ss %Ess" "0d 0h 0m 0s -0.74s" $ (fromRational $ negate $ 0.74 :: DiffTime),-        testAFormat "%dd %hh %mm %ss %Ess %0Ess" "23d 554h 33262m 1995728s 1995728.21s 1995728.210000000000s" $ (fromRational $ 23 * 86400 + 8528.21 :: DiffTime),-        testAFormat "%ww%Dd%Hh%Mm%Ss" "-3w-2d-2h-22m-8s" $ (fromRational $ negate $ 23 * 86400 + 8528.21 :: DiffTime),-        testAFormat "%ww%Dd%Hh%Mm%ESs" "-3w-2d-2h-22m-8.21s" $ (fromRational $ negate $ 23 * 86400 + 8528.21 :: DiffTime),-        testAFormat "%ww%Dd%Hh%Mm%Ss" "-3w-2d-2h-22m0s" $ (fromRational $ negate $ 23 * 86400 + 8520.21 :: DiffTime),-        testAFormat "%ww%Dd%Hh%Mm%ESs" "-3w-2d-2h-22m-0.21s" $ (fromRational $ negate $ 23 * 86400 + 8520.21 :: DiffTime),-        testAFormat "%dd %hh %mm %Ess" "-23d -554h -33262m -1995728.21s" $ (fromRational $ negate $ 23 * 86400 + 8528.21 :: DiffTime)-    ]+testDiffTime =+    testGroup+        "DiffTime"+        [ testAFormat "%ww%Dd%Hh%Mm%ESs" "3w2d2h22m8.21s" $ (fromRational $ 23 * 86400 + 8528.21 :: DiffTime)+        , testAFormat "%dd %hh %mm %ss %Ess" "0d 0h 0m 0s 0.74s" $ (fromRational $ 0.74 :: DiffTime)+        , testAFormat "%dd %hh %mm %ss %Ess" "0d 0h 0m 0s -0.74s" $ (fromRational $ negate $ 0.74 :: DiffTime)+        , testAFormat "%dd %hh %mm %ss %Ess %0Ess" "23d 554h 33262m 1995728s 1995728.21s 1995728.210000000000s" $+          (fromRational $ 23 * 86400 + 8528.21 :: DiffTime)+        , testAFormat "%ww%Dd%Hh%Mm%Ss" "-3w-2d-2h-22m-8s" $ (fromRational $ negate $ 23 * 86400 + 8528.21 :: DiffTime)+        , testAFormat "%ww%Dd%Hh%Mm%ESs" "-3w-2d-2h-22m-8.21s" $+          (fromRational $ negate $ 23 * 86400 + 8528.21 :: DiffTime)+        , testAFormat "%ww%Dd%Hh%Mm%Ss" "-3w-2d-2h-22m0s" $ (fromRational $ negate $ 23 * 86400 + 8520.21 :: DiffTime)+        , testAFormat "%ww%Dd%Hh%Mm%ESs" "-3w-2d-2h-22m-0.21s" $+          (fromRational $ negate $ 23 * 86400 + 8520.21 :: DiffTime)+        , testAFormat "%dd %hh %mm %Ess" "-23d -554h -33262m -1995728.21s" $+          (fromRational $ negate $ 23 * 86400 + 8528.21 :: DiffTime)+        , testAFormat "%3Es" "1.200" (1.2 :: DiffTime)+        , testAFormat "%3ES" "01.200" (1.2 :: DiffTime)+        , testAFormat "%3ES" "01.200" (61.2 :: DiffTime)+        , testAFormat "%3Es" "1.245" (1.24582 :: DiffTime)+        , testAFormat "%3ES" "01.245" (1.24582 :: DiffTime)+        , testAFormat "%3ES" "01.245" (61.24582 :: DiffTime)+        ]  testCalenderDiffDays :: TestTree-testCalenderDiffDays = testGroup "CalenderDiffDays"-    [-        testAFormat "%yy%Bm%ww%Dd" "5y4m3w2d" $ CalendarDiffDays 64 23,-        testAFormat "%bm %dd" "64m 23d" $ CalendarDiffDays 64 23,-        testAFormat "%yy%Bm%ww%Dd" "-5y-4m-3w-2d" $ CalendarDiffDays (-64) (-23),-        testAFormat "%bm %dd" "-64m -23d" $ CalendarDiffDays (-64) (-23)-    ]+testCalenderDiffDays =+    testGroup+        "CalenderDiffDays"+        [ testAFormat "%yy%Bm%ww%Dd" "5y4m3w2d" $ CalendarDiffDays 64 23+        , testAFormat "%bm %dd" "64m 23d" $ CalendarDiffDays 64 23+        , testAFormat "%yy%Bm%ww%Dd" "-5y-4m-3w-2d" $ CalendarDiffDays (-64) (-23)+        , testAFormat "%bm %dd" "-64m -23d" $ CalendarDiffDays (-64) (-23)+        ]  testCalenderDiffTime :: TestTree-testCalenderDiffTime = testGroup "CalenderDiffTime"-    [-        testAFormat "%yy%Bm%ww%Dd%Hh%Mm%Ss" "5y4m3w2d2h22m8s" $ CalendarDiffTime 64 $ 23 * 86400 + 8528.21,-        testAFormat "%yy%Bm%ww%Dd%Hh%Mm%ESs" "5y4m3w2d2h22m8.21s" $ CalendarDiffTime 64 $ 23 * 86400 + 8528.21,-        testAFormat "%yy%Bm%ww%Dd%Hh%Mm%0ESs" "5y4m3w2d2h22m08.210000000000s" $ CalendarDiffTime 64 $ 23 * 86400 + 8528.21,-        testAFormat "%bm %dd %hh %mm %Ess" "64m 23d 554h 33262m 1995728.21s" $ CalendarDiffTime 64 $ 23 * 86400 + 8528.21,-        testAFormat "%yy%Bm%ww%Dd%Hh%Mm%Ss" "-5y-4m-3w-2d-2h-22m-8s" $ CalendarDiffTime (-64) $ negate $ 23 * 86400 + 8528.21,-        testAFormat "%yy%Bm%ww%Dd%Hh%Mm%ESs" "-5y-4m-3w-2d-2h-22m-8.21s" $ CalendarDiffTime (-64) $ negate $ 23 * 86400 + 8528.21,-        testAFormat "%bm %dd %hh %mm %Ess" "-64m -23d -554h -33262m -1995728.21s" $ CalendarDiffTime (-64) $ negate $ 23 * 86400 + 8528.21-    ]+testCalenderDiffTime =+    testGroup+        "CalenderDiffTime"+        [ testAFormat "%yy%Bm%ww%Dd%Hh%Mm%Ss" "5y4m3w2d2h22m8s" $ CalendarDiffTime 64 $ 23 * 86400 + 8528.21+        , testAFormat "%yy%Bm%ww%Dd%Hh%Mm%ESs" "5y4m3w2d2h22m8.21s" $ CalendarDiffTime 64 $ 23 * 86400 + 8528.21+        , testAFormat "%yy%Bm%ww%Dd%Hh%Mm%0ESs" "5y4m3w2d2h22m08.210000000000s" $+          CalendarDiffTime 64 $ 23 * 86400 + 8528.21+        , testAFormat "%bm %dd %hh %mm %Ess" "64m 23d 554h 33262m 1995728.21s" $+          CalendarDiffTime 64 $ 23 * 86400 + 8528.21+        , testAFormat "%yy%Bm%ww%Dd%Hh%Mm%Ss" "-5y-4m-3w-2d-2h-22m-8s" $+          CalendarDiffTime (-64) $ negate $ 23 * 86400 + 8528.21+        , testAFormat "%yy%Bm%ww%Dd%Hh%Mm%ESs" "-5y-4m-3w-2d-2h-22m-8.21s" $+          CalendarDiffTime (-64) $ negate $ 23 * 86400 + 8528.21+        , testAFormat "%bm %dd %hh %mm %Ess" "-64m -23d -554h -33262m -1995728.21s" $+          CalendarDiffTime (-64) $ negate $ 23 * 86400 + 8528.21+        ]  testFormat :: TestTree-testFormat = testGroup "testFormat" $ [-    testCheckParse,-    testDayOfWeek,-    testTimeZone,-    testNominalDiffTime,-    testDiffTime,-    testCalenderDiffDays,-    testCalenderDiffTime+testFormat =+    testGroup "testFormat" $+    [ testCheckParse+    , testDayOfWeek+    , testTimeZone+    , testNominalDiffTime+    , testDiffTime+    , testCalenderDiffDays+    , testCalenderDiffTime     ]
test/main/Test/Format/ISO8601.hs view
@@ -1,47 +1,49 @@ {-# OPTIONS -fno-warn-orphans #-}-module Test.Format.ISO8601(testISO8601) where +module Test.Format.ISO8601+    ( testISO8601+    ) where+ import Data.Ratio import Data.Time import Data.Time.Format.ISO8601+import Test.Arbitrary () import Test.QuickCheck.Property import Test.Tasty import Test.Tasty.HUnit import Test.Tasty.QuickCheck hiding (reason) import Test.TestUtil-import Test.Arbitrary() - deriving instance Eq ZonedTime -readShowProperty :: (Eq a,Show a) => Format a -> a -> Property-readShowProperty fmt val = case formatShowM fmt val of-    Nothing -> property Discard-    Just str -> let-        found = formatParseM fmt str-        expected = Just val-        in property $ if expected == found then succeeded else-            failed {reason = show str ++ ": expected " ++ (show expected) ++ ", found " ++ (show found)}+readShowProperty :: (Eq a, Show a) => Format a -> a -> Property+readShowProperty fmt val =+    case formatShowM fmt val of+        Nothing -> property Discard+        Just str -> let+            found = formatParseM fmt str+            expected = Just val+            in property $+               if expected == found+                   then succeeded+                   else failed {reason = show str ++ ": expected " ++ (show expected) ++ ", found " ++ (show found)}  readBoth :: NameTest t => (FormatExtension -> t) -> [TestTree]-readBoth fmts =-    [-        nameTest "extended" $ fmts ExtendedFormat,-        nameTest "basic" $ fmts BasicFormat-    ]+readBoth fmts = [nameTest "extended" $ fmts ExtendedFormat, nameTest "basic" $ fmts BasicFormat] -readShowProperties :: (Eq a,Show a,Arbitrary a) => (FormatExtension -> Format a) -> [TestTree]+readShowProperties :: (Eq a, Show a, Arbitrary a) => (FormatExtension -> Format a) -> [TestTree] readShowProperties fmts = readBoth $ \fe -> readShowProperty $ fmts fe -newtype Durational t = MkDurational t+newtype Durational t =+    MkDurational t  instance Show t => Show (Durational t) where     show (MkDurational t) = show t  instance Arbitrary (Durational CalendarDiffDays) where     arbitrary = do-        mm <- choose (-10000,10000)-        dd <- choose (-40,40)+        mm <- choose (-10000, 10000)+        dd <- choose (-40, 40)         return $ MkDurational $ CalendarDiffDays mm dd  instance Arbitrary (Durational CalendarDiffTime) where@@ -49,242 +51,196 @@         limit = 40 * 86400         picofactor = 10 ^ (12 :: Int)         in do-            mm <- choose (-10000,10000)-            ss <- choose (negate limit * picofactor, limit * picofactor)-            return $ MkDurational $ CalendarDiffTime mm $ fromRational $ ss % picofactor+               mm <- choose (-10000, 10000)+               ss <- choose (negate limit * picofactor, limit * picofactor)+               return $ MkDurational $ CalendarDiffTime mm $ fromRational $ ss % picofactor  testReadShowFormat :: TestTree-testReadShowFormat = nameTest "read-show format"-    [-        nameTest "calendarFormat" $ readShowProperties $ calendarFormat,-        nameTest "yearMonthFormat" $ readShowProperty $ yearMonthFormat,-        nameTest "yearFormat" $ readShowProperty $ yearFormat,-        nameTest "centuryFormat" $ readShowProperty $ centuryFormat,-        nameTest "expandedCalendarFormat" $ readShowProperties $ expandedCalendarFormat 6,-        nameTest "expandedYearMonthFormat" $ readShowProperty $ expandedYearMonthFormat 6,-        nameTest "expandedYearFormat" $ readShowProperty $ expandedYearFormat 6,-        nameTest "expandedCenturyFormat" $ readShowProperty $ expandedCenturyFormat 4,-        nameTest "ordinalDateFormat" $ readShowProperties $ ordinalDateFormat,-        nameTest "expandedOrdinalDateFormat" $ readShowProperties $ expandedOrdinalDateFormat 6,-        nameTest "weekDateFormat" $ readShowProperties $ weekDateFormat,-        nameTest "yearWeekFormat" $ readShowProperties $ yearWeekFormat,-        nameTest "expandedWeekDateFormat" $ readShowProperties $ expandedWeekDateFormat 6,-        nameTest "expandedYearWeekFormat" $ readShowProperties $ expandedYearWeekFormat 6,-        nameTest "timeOfDayFormat" $ readShowProperties $ timeOfDayFormat,-        nameTest "hourMinuteFormat" $ readShowProperties $ hourMinuteFormat,-        nameTest "hourFormat" $ readShowProperty $ hourFormat,-        nameTest "withTimeDesignator" $ readShowProperties $ \fe -> withTimeDesignator $ timeOfDayFormat fe,-        nameTest "withUTCDesignator" $ readShowProperties $ \fe -> withUTCDesignator $ timeOfDayFormat fe,-        nameTest "timeOffsetFormat" $ readShowProperties $ timeOffsetFormat,-        nameTest "timeOfDayAndOffsetFormat" $ readShowProperties $ timeOfDayAndOffsetFormat,-        nameTest "localTimeFormat" $ readShowProperties $ \fe -> localTimeFormat (calendarFormat fe) (timeOfDayFormat fe),-        nameTest "zonedTimeFormat" $ readShowProperties $ \fe -> zonedTimeFormat (calendarFormat fe) (timeOfDayFormat fe) fe,-        nameTest "utcTimeFormat" $ readShowProperties $ \fe -> utcTimeFormat (calendarFormat fe) (timeOfDayFormat fe),-        nameTest "dayAndTimeFormat" $ readShowProperties $ \fe -> dayAndTimeFormat (calendarFormat fe) (timeOfDayFormat fe),-        nameTest "timeAndOffsetFormat" $ readShowProperties $ \fe -> timeAndOffsetFormat (timeOfDayFormat fe) fe,-        nameTest "durationDaysFormat" $ readShowProperty $ durationDaysFormat,-        nameTest "durationTimeFormat" $ readShowProperty $ durationTimeFormat,-        nameTest "alternativeDurationDaysFormat" $ readBoth $ \fe (MkDurational t) -> readShowProperty (alternativeDurationDaysFormat fe) t,-        nameTest "alternativeDurationTimeFormat" $ readBoth $ \fe (MkDurational t) -> readShowProperty (alternativeDurationTimeFormat fe) t,-        nameTest "intervalFormat" $ readShowProperties $ \fe -> intervalFormat (localTimeFormat (calendarFormat fe) (timeOfDayFormat fe)) durationTimeFormat,-        nameTest "recurringIntervalFormat" $ readShowProperties $ \fe -> recurringIntervalFormat (localTimeFormat (calendarFormat fe) (timeOfDayFormat fe)) durationTimeFormat-    ]+testReadShowFormat =+    nameTest+        "read-show format"+        [ nameTest "calendarFormat" $ readShowProperties $ calendarFormat+        , nameTest "yearMonthFormat" $ readShowProperty $ yearMonthFormat+        , nameTest "yearFormat" $ readShowProperty $ yearFormat+        , nameTest "centuryFormat" $ readShowProperty $ centuryFormat+        , nameTest "expandedCalendarFormat" $ readShowProperties $ expandedCalendarFormat 6+        , nameTest "expandedYearMonthFormat" $ readShowProperty $ expandedYearMonthFormat 6+        , nameTest "expandedYearFormat" $ readShowProperty $ expandedYearFormat 6+        , nameTest "expandedCenturyFormat" $ readShowProperty $ expandedCenturyFormat 4+        , nameTest "ordinalDateFormat" $ readShowProperties $ ordinalDateFormat+        , nameTest "expandedOrdinalDateFormat" $ readShowProperties $ expandedOrdinalDateFormat 6+        , nameTest "weekDateFormat" $ readShowProperties $ weekDateFormat+        , nameTest "yearWeekFormat" $ readShowProperties $ yearWeekFormat+        , nameTest "expandedWeekDateFormat" $ readShowProperties $ expandedWeekDateFormat 6+        , nameTest "expandedYearWeekFormat" $ readShowProperties $ expandedYearWeekFormat 6+        , nameTest "timeOfDayFormat" $ readShowProperties $ timeOfDayFormat+        , nameTest "hourMinuteFormat" $ readShowProperties $ hourMinuteFormat+        , nameTest "hourFormat" $ readShowProperty $ hourFormat+        , nameTest "withTimeDesignator" $ readShowProperties $ \fe -> withTimeDesignator $ timeOfDayFormat fe+        , nameTest "withUTCDesignator" $ readShowProperties $ \fe -> withUTCDesignator $ timeOfDayFormat fe+        , nameTest "timeOffsetFormat" $ readShowProperties $ timeOffsetFormat+        , nameTest "timeOfDayAndOffsetFormat" $ readShowProperties $ timeOfDayAndOffsetFormat+        , nameTest "localTimeFormat" $+          readShowProperties $ \fe -> localTimeFormat (calendarFormat fe) (timeOfDayFormat fe)+        , nameTest "zonedTimeFormat" $+          readShowProperties $ \fe -> zonedTimeFormat (calendarFormat fe) (timeOfDayFormat fe) fe+        , nameTest "utcTimeFormat" $ readShowProperties $ \fe -> utcTimeFormat (calendarFormat fe) (timeOfDayFormat fe)+        , nameTest "dayAndTimeFormat" $+          readShowProperties $ \fe -> dayAndTimeFormat (calendarFormat fe) (timeOfDayFormat fe)+        , nameTest "timeAndOffsetFormat" $ readShowProperties $ \fe -> timeAndOffsetFormat (timeOfDayFormat fe) fe+        , nameTest "durationDaysFormat" $ readShowProperty $ durationDaysFormat+        , nameTest "durationTimeFormat" $ readShowProperty $ durationTimeFormat+        , nameTest "alternativeDurationDaysFormat" $+          readBoth $ \fe (MkDurational t) -> readShowProperty (alternativeDurationDaysFormat fe) t+        , nameTest "alternativeDurationTimeFormat" $+          readBoth $ \fe (MkDurational t) -> readShowProperty (alternativeDurationTimeFormat fe) t+        , nameTest "intervalFormat" $+          readShowProperties $ \fe ->+              intervalFormat (localTimeFormat (calendarFormat fe) (timeOfDayFormat fe)) durationTimeFormat+        , nameTest "recurringIntervalFormat" $+          readShowProperties $ \fe ->+              recurringIntervalFormat (localTimeFormat (calendarFormat fe) (timeOfDayFormat fe)) durationTimeFormat+        ]  testShowFormat :: String -> Format t -> String -> t -> TestTree-testShowFormat name fmt str t = nameTest (name ++ ": " ++ str) $-    assertEqual "" (Just str) $ formatShowM fmt t+testShowFormat name fmt str t = nameTest (name ++ ": " ++ str) $ assertEqual "" (Just str) $ formatShowM fmt t  testShowFormats :: TestTree-testShowFormats = nameTest "show format"-    [-        testShowFormat "durationDaysFormat" durationDaysFormat "P0D" $ CalendarDiffDays 0 0,-        testShowFormat "durationDaysFormat" durationDaysFormat "P4Y" $ CalendarDiffDays 48 0,-        testShowFormat "durationDaysFormat" durationDaysFormat "P7M" $ CalendarDiffDays 7 0,-        testShowFormat "durationDaysFormat" durationDaysFormat "P5D" $ CalendarDiffDays 0 5,-        testShowFormat "durationDaysFormat" durationDaysFormat "P2Y3M81D" $ CalendarDiffDays 27 81,-        testShowFormat "durationTimeFormat" durationTimeFormat "P0D" $ CalendarDiffTime 0 0,-        testShowFormat "durationTimeFormat" durationTimeFormat "P4Y" $ CalendarDiffTime 48 0,-        testShowFormat "durationTimeFormat" durationTimeFormat "P7M" $ CalendarDiffTime 7 0,-        testShowFormat "durationTimeFormat" durationTimeFormat "P5D" $ CalendarDiffTime 0 $ 5 * nominalDay,-        testShowFormat "durationTimeFormat" durationTimeFormat "P2Y3M81D" $ CalendarDiffTime 27 $ 81 * nominalDay,-        testShowFormat "durationTimeFormat" durationTimeFormat "PT2H" $ CalendarDiffTime 0 $ 7200,-        testShowFormat "durationTimeFormat" durationTimeFormat "PT3M" $ CalendarDiffTime 0 $ 180,-        testShowFormat "durationTimeFormat" durationTimeFormat "PT12S" $ CalendarDiffTime 0 $ 12,-        testShowFormat "durationTimeFormat" durationTimeFormat "PT1M18.77634S" $ CalendarDiffTime 0 $ 78.77634,-        testShowFormat "durationTimeFormat" durationTimeFormat "PT2H1M18.77634S" $ CalendarDiffTime 0 $ 7278.77634,-        testShowFormat "durationTimeFormat" durationTimeFormat "P5DT2H1M18.77634S" $ CalendarDiffTime 0 $ 5 * nominalDay + 7278.77634,-        testShowFormat "durationTimeFormat" durationTimeFormat "P7Y10M5DT2H1M18.77634S" $ CalendarDiffTime 94 $ 5 * nominalDay + 7278.77634,-        testShowFormat "durationTimeFormat" durationTimeFormat "P7Y10MT2H1M18.77634S" $ CalendarDiffTime 94 $ 7278.77634,-        testShowFormat "durationTimeFormat" durationTimeFormat "P8YT2H1M18.77634S" $ CalendarDiffTime 96 $ 7278.77634,-        testShowFormat "alternativeDurationDaysFormat" (alternativeDurationDaysFormat ExtendedFormat) "P0001-00-00" $ CalendarDiffDays 12 0,-        testShowFormat "alternativeDurationDaysFormat" (alternativeDurationDaysFormat ExtendedFormat) "P0002-03-29" $ CalendarDiffDays 27 29,-        testShowFormat "alternativeDurationDaysFormat" (alternativeDurationDaysFormat ExtendedFormat) "P0561-08-29" $ CalendarDiffDays (561 * 12 + 8) 29,-        testShowFormat "alternativeDurationTimeFormat" (alternativeDurationTimeFormat ExtendedFormat) "P0000-00-01T00:00:00" $ CalendarDiffTime 0 86400,-        testShowFormat "alternativeDurationTimeFormat" (alternativeDurationTimeFormat ExtendedFormat) "P0007-10-05T02:01:18.77634" $ CalendarDiffTime 94 $ 5 * nominalDay + 7278.77634,-        testShowFormat "alternativeDurationTimeFormat" (alternativeDurationTimeFormat ExtendedFormat) "P4271-10-05T02:01:18.77634" $ CalendarDiffTime (12 * 4271 + 10) $ 5 * nominalDay + 7278.77634,-        testShowFormat "centuryFormat" centuryFormat "02" 2,-        testShowFormat "centuryFormat" centuryFormat "21" 21,-        testShowFormat "intervalFormat etc."-            (intervalFormat (localTimeFormat (calendarFormat ExtendedFormat) (timeOfDayFormat ExtendedFormat)) durationTimeFormat)-            "2015-06-13T21:13:56/P1Y2M7DT5H33M2.34S"-            (LocalTime (fromGregorian 2015 6 13) (TimeOfDay 21 13 56),CalendarDiffTime 14 $ 7 * nominalDay + 5 * 3600 + 33 * 60 + 2.34),-        testShowFormat "recurringIntervalFormat etc."-            (recurringIntervalFormat (localTimeFormat (calendarFormat ExtendedFormat) (timeOfDayFormat ExtendedFormat)) durationTimeFormat)-            "R74/2015-06-13T21:13:56/P1Y2M7DT5H33M2.34S"-            (74,LocalTime (fromGregorian 2015 6 13) (TimeOfDay 21 13 56),CalendarDiffTime 14 $ 7 * nominalDay + 5 * 3600 + 33 * 60 + 2.34),-        testShowFormat "recurringIntervalFormat etc."-            (recurringIntervalFormat (calendarFormat ExtendedFormat) durationDaysFormat)-            "R74/2015-06-13/P1Y2M7D"-            (74,fromGregorian 2015 6 13,CalendarDiffDays 14 7),-        testShowFormat "timeOffsetFormat"-            iso8601Format-            "-06:30"-            (minutesToTimeZone (-390)),-        testShowFormat "timeOffsetFormat"-            iso8601Format-            "+00:00"-            (minutesToTimeZone 0),-        testShowFormat "timeOffsetFormat"-            (timeOffsetFormat BasicFormat)-            "+0000"-            (minutesToTimeZone 0),-        testShowFormat "timeOffsetFormat"-            iso8601Format-            "+00:10"-            (minutesToTimeZone 10),-        testShowFormat "timeOffsetFormat"-            iso8601Format-            "-00:10"-            (minutesToTimeZone (-10)),-        testShowFormat "timeOffsetFormat"-            iso8601Format-            "+01:35"-            (minutesToTimeZone 95),-        testShowFormat "timeOffsetFormat"-            iso8601Format-            "-01:35"-            (minutesToTimeZone (-95)),-        testShowFormat "timeOffsetFormat"-            (timeOffsetFormat BasicFormat)-            "+0135"-            (minutesToTimeZone 95),-        testShowFormat "timeOffsetFormat"-            (timeOffsetFormat BasicFormat)-            "-0135"-            (minutesToTimeZone (-95)),-        testShowFormat "timeOffsetFormat"-            (timeOffsetFormat BasicFormat)-            "-1100"-            (minutesToTimeZone $ negate $ 11 * 60),-        testShowFormat "timeOffsetFormat"-            (timeOffsetFormat BasicFormat)-            "+1015"-            (minutesToTimeZone $ 615),-        testShowFormat "zonedTimeFormat"-            iso8601Format-            "2024-07-06T08:45:56.553-06:30"-            (ZonedTime (LocalTime (fromGregorian 2024 07 06) (TimeOfDay 8 45 56.553)) (minutesToTimeZone (-390))),-        testShowFormat "zonedTimeFormat"-            iso8601Format-            "2024-07-06T08:45:56.553+06:30"-            (ZonedTime (LocalTime (fromGregorian 2024 07 06) (TimeOfDay 8 45 56.553)) (minutesToTimeZone 390)),-        testShowFormat "utcTimeFormat"-            iso8601Format-            "2024-07-06T08:45:56.553Z"-            (UTCTime (fromGregorian 2024 07 06) (timeOfDayToTime $ TimeOfDay 8 45 56.553)),-        testShowFormat "utcTimeFormat"-            iso8601Format-            "2028-12-31T23:59:60.9Z"-            (UTCTime (fromGregorian 2028 12 31) (timeOfDayToTime $ TimeOfDay 23 59 60.9)),-        testShowFormat "weekDateFormat"-            (weekDateFormat ExtendedFormat)-            "1994-W52-7"-            (fromGregorian 1995 1 1),-        testShowFormat "weekDateFormat"-            (weekDateFormat ExtendedFormat)-            "1995-W01-1"-            (fromGregorian 1995 1 2),-        testShowFormat "weekDateFormat"-            (weekDateFormat ExtendedFormat)-            "1996-W52-7"-            (fromGregorian 1996 12 29),-        testShowFormat "weekDateFormat"-            (weekDateFormat ExtendedFormat)-            "1997-W01-2"-            (fromGregorian 1996 12 31),-        testShowFormat "weekDateFormat"-            (weekDateFormat ExtendedFormat)-            "1997-W01-3"-            (fromGregorian 1997 1 1),-        testShowFormat "weekDateFormat"-            (weekDateFormat ExtendedFormat)-            "1974-W32-6"-            (fromGregorian 1974 8 10),-        testShowFormat "weekDateFormat"-            (weekDateFormat BasicFormat)-            "1974W326"-            (fromGregorian 1974 8 10),-        testShowFormat "weekDateFormat"-            (weekDateFormat ExtendedFormat)-            "1995-W05-6"-            (fromGregorian 1995 2 4),-        testShowFormat "weekDateFormat"-            (weekDateFormat BasicFormat)-            "1995W056"-            (fromGregorian 1995 2 4),-        testShowFormat "weekDateFormat"-            (expandedWeekDateFormat 6 ExtendedFormat)-            "+001995-W05-6"-            (fromGregorian 1995 2 4),-        testShowFormat "weekDateFormat"-            (expandedWeekDateFormat 6 BasicFormat)-            "+001995W056"-            (fromGregorian 1995 2 4),-        testShowFormat "ordinalDateFormat"-            (ordinalDateFormat ExtendedFormat)-            "1846-235"-            (fromGregorian 1846 8 23),-        testShowFormat "ordinalDateFormat"-            (ordinalDateFormat BasicFormat)-            "1844236"-            (fromGregorian 1844 8 23),-        testShowFormat "ordinalDateFormat"-            (expandedOrdinalDateFormat 5 ExtendedFormat)-            "+01846-235"-            (fromGregorian 1846 8 23),-        testShowFormat "hourMinuteFormat"-            (hourMinuteFormat ExtendedFormat)-            "13:17.25"-            (TimeOfDay 13 17 15),-        testShowFormat "hourMinuteFormat"-            (hourMinuteFormat ExtendedFormat)-            "01:12.4"-            (TimeOfDay 1 12 24),-        testShowFormat "hourMinuteFormat"-            (hourMinuteFormat BasicFormat)-            "1317.25"-            (TimeOfDay 13 17 15),-        testShowFormat "hourMinuteFormat"-            (hourMinuteFormat BasicFormat)-            "0112.4"-            (TimeOfDay 1 12 24),-        testShowFormat "hourFormat"-            hourFormat-            "22"-            (TimeOfDay 22 0 0),-        testShowFormat "hourFormat"-            hourFormat-            "06"-            (TimeOfDay 6 0 0),-        testShowFormat "hourFormat"-            hourFormat-            "18.9475"-            (TimeOfDay 18 56 51)-    ]+testShowFormats =+    nameTest+        "show format"+        [ testShowFormat "durationDaysFormat" durationDaysFormat "P0D" $ CalendarDiffDays 0 0+        , testShowFormat "durationDaysFormat" durationDaysFormat "P4Y" $ CalendarDiffDays 48 0+        , testShowFormat "durationDaysFormat" durationDaysFormat "P7M" $ CalendarDiffDays 7 0+        , testShowFormat "durationDaysFormat" durationDaysFormat "P5D" $ CalendarDiffDays 0 5+        , testShowFormat "durationDaysFormat" durationDaysFormat "P2Y3M81D" $ CalendarDiffDays 27 81+        , testShowFormat "durationTimeFormat" durationTimeFormat "P0D" $ CalendarDiffTime 0 0+        , testShowFormat "durationTimeFormat" durationTimeFormat "P4Y" $ CalendarDiffTime 48 0+        , testShowFormat "durationTimeFormat" durationTimeFormat "P7M" $ CalendarDiffTime 7 0+        , testShowFormat "durationTimeFormat" durationTimeFormat "P5D" $ CalendarDiffTime 0 $ 5 * nominalDay+        , testShowFormat "durationTimeFormat" durationTimeFormat "P2Y3M81D" $ CalendarDiffTime 27 $ 81 * nominalDay+        , testShowFormat "durationTimeFormat" durationTimeFormat "PT2H" $ CalendarDiffTime 0 $ 7200+        , testShowFormat "durationTimeFormat" durationTimeFormat "PT3M" $ CalendarDiffTime 0 $ 180+        , testShowFormat "durationTimeFormat" durationTimeFormat "PT12S" $ CalendarDiffTime 0 $ 12+        , testShowFormat "durationTimeFormat" durationTimeFormat "PT1M18.77634S" $ CalendarDiffTime 0 $ 78.77634+        , testShowFormat "durationTimeFormat" durationTimeFormat "PT2H1M18.77634S" $ CalendarDiffTime 0 $ 7278.77634+        , testShowFormat "durationTimeFormat" durationTimeFormat "P5DT2H1M18.77634S" $+          CalendarDiffTime 0 $ 5 * nominalDay + 7278.77634+        , testShowFormat "durationTimeFormat" durationTimeFormat "P7Y10M5DT2H1M18.77634S" $+          CalendarDiffTime 94 $ 5 * nominalDay + 7278.77634+        , testShowFormat "durationTimeFormat" durationTimeFormat "P7Y10MT2H1M18.77634S" $+          CalendarDiffTime 94 $ 7278.77634+        , testShowFormat "durationTimeFormat" durationTimeFormat "P8YT2H1M18.77634S" $ CalendarDiffTime 96 $ 7278.77634+        , testShowFormat "alternativeDurationDaysFormat" (alternativeDurationDaysFormat ExtendedFormat) "P0001-00-00" $+          CalendarDiffDays 12 0+        , testShowFormat "alternativeDurationDaysFormat" (alternativeDurationDaysFormat ExtendedFormat) "P0002-03-29" $+          CalendarDiffDays 27 29+        , testShowFormat "alternativeDurationDaysFormat" (alternativeDurationDaysFormat ExtendedFormat) "P0561-08-29" $+          CalendarDiffDays (561 * 12 + 8) 29+        , testShowFormat+              "alternativeDurationTimeFormat"+              (alternativeDurationTimeFormat ExtendedFormat)+              "P0000-00-01T00:00:00" $+          CalendarDiffTime 0 86400+        , testShowFormat+              "alternativeDurationTimeFormat"+              (alternativeDurationTimeFormat ExtendedFormat)+              "P0007-10-05T02:01:18.77634" $+          CalendarDiffTime 94 $ 5 * nominalDay + 7278.77634+        , testShowFormat+              "alternativeDurationTimeFormat"+              (alternativeDurationTimeFormat ExtendedFormat)+              "P4271-10-05T02:01:18.77634" $+          CalendarDiffTime (12 * 4271 + 10) $ 5 * nominalDay + 7278.77634+        , testShowFormat "centuryFormat" centuryFormat "02" 2+        , testShowFormat "centuryFormat" centuryFormat "21" 21+        , testShowFormat+              "intervalFormat etc."+              (intervalFormat+                   (localTimeFormat (calendarFormat ExtendedFormat) (timeOfDayFormat ExtendedFormat))+                   durationTimeFormat)+              "2015-06-13T21:13:56/P1Y2M7DT5H33M2.34S"+              ( LocalTime (fromGregorian 2015 6 13) (TimeOfDay 21 13 56)+              , CalendarDiffTime 14 $ 7 * nominalDay + 5 * 3600 + 33 * 60 + 2.34)+        , testShowFormat+              "recurringIntervalFormat etc."+              (recurringIntervalFormat+                   (localTimeFormat (calendarFormat ExtendedFormat) (timeOfDayFormat ExtendedFormat))+                   durationTimeFormat)+              "R74/2015-06-13T21:13:56/P1Y2M7DT5H33M2.34S"+              ( 74+              , LocalTime (fromGregorian 2015 6 13) (TimeOfDay 21 13 56)+              , CalendarDiffTime 14 $ 7 * nominalDay + 5 * 3600 + 33 * 60 + 2.34)+        , testShowFormat+              "recurringIntervalFormat etc."+              (recurringIntervalFormat (calendarFormat ExtendedFormat) durationDaysFormat)+              "R74/2015-06-13/P1Y2M7D"+              (74, fromGregorian 2015 6 13, CalendarDiffDays 14 7)+        , testShowFormat "timeOffsetFormat" iso8601Format "-06:30" (minutesToTimeZone (-390))+        , testShowFormat "timeOffsetFormat" iso8601Format "+00:00" (minutesToTimeZone 0)+        , testShowFormat "timeOffsetFormat" (timeOffsetFormat BasicFormat) "+0000" (minutesToTimeZone 0)+        , testShowFormat "timeOffsetFormat" iso8601Format "+00:10" (minutesToTimeZone 10)+        , testShowFormat "timeOffsetFormat" iso8601Format "-00:10" (minutesToTimeZone (-10))+        , testShowFormat "timeOffsetFormat" iso8601Format "+01:35" (minutesToTimeZone 95)+        , testShowFormat "timeOffsetFormat" iso8601Format "-01:35" (minutesToTimeZone (-95))+        , testShowFormat "timeOffsetFormat" (timeOffsetFormat BasicFormat) "+0135" (minutesToTimeZone 95)+        , testShowFormat "timeOffsetFormat" (timeOffsetFormat BasicFormat) "-0135" (minutesToTimeZone (-95))+        , testShowFormat+              "timeOffsetFormat"+              (timeOffsetFormat BasicFormat)+              "-1100"+              (minutesToTimeZone $ negate $ 11 * 60)+        , testShowFormat "timeOffsetFormat" (timeOffsetFormat BasicFormat) "+1015" (minutesToTimeZone $ 615)+        , testShowFormat+              "zonedTimeFormat"+              iso8601Format+              "2024-07-06T08:45:56.553-06:30"+              (ZonedTime (LocalTime (fromGregorian 2024 07 06) (TimeOfDay 8 45 56.553)) (minutesToTimeZone (-390)))+        , testShowFormat+              "zonedTimeFormat"+              iso8601Format+              "2024-07-06T08:45:56.553+06:30"+              (ZonedTime (LocalTime (fromGregorian 2024 07 06) (TimeOfDay 8 45 56.553)) (minutesToTimeZone 390))+        , testShowFormat+              "utcTimeFormat"+              iso8601Format+              "2024-07-06T08:45:56.553Z"+              (UTCTime (fromGregorian 2024 07 06) (timeOfDayToTime $ TimeOfDay 8 45 56.553))+        , testShowFormat+              "utcTimeFormat"+              iso8601Format+              "2028-12-31T23:59:60.9Z"+              (UTCTime (fromGregorian 2028 12 31) (timeOfDayToTime $ TimeOfDay 23 59 60.9))+        , testShowFormat "weekDateFormat" (weekDateFormat ExtendedFormat) "1994-W52-7" (fromGregorian 1995 1 1)+        , testShowFormat "weekDateFormat" (weekDateFormat ExtendedFormat) "1995-W01-1" (fromGregorian 1995 1 2)+        , testShowFormat "weekDateFormat" (weekDateFormat ExtendedFormat) "1996-W52-7" (fromGregorian 1996 12 29)+        , testShowFormat "weekDateFormat" (weekDateFormat ExtendedFormat) "1997-W01-2" (fromGregorian 1996 12 31)+        , testShowFormat "weekDateFormat" (weekDateFormat ExtendedFormat) "1997-W01-3" (fromGregorian 1997 1 1)+        , testShowFormat "weekDateFormat" (weekDateFormat ExtendedFormat) "1974-W32-6" (fromGregorian 1974 8 10)+        , testShowFormat "weekDateFormat" (weekDateFormat BasicFormat) "1974W326" (fromGregorian 1974 8 10)+        , testShowFormat "weekDateFormat" (weekDateFormat ExtendedFormat) "1995-W05-6" (fromGregorian 1995 2 4)+        , testShowFormat "weekDateFormat" (weekDateFormat BasicFormat) "1995W056" (fromGregorian 1995 2 4)+        , testShowFormat+              "weekDateFormat"+              (expandedWeekDateFormat 6 ExtendedFormat)+              "+001995-W05-6"+              (fromGregorian 1995 2 4)+        , testShowFormat "weekDateFormat" (expandedWeekDateFormat 6 BasicFormat) "+001995W056" (fromGregorian 1995 2 4)+        , testShowFormat "ordinalDateFormat" (ordinalDateFormat ExtendedFormat) "1846-235" (fromGregorian 1846 8 23)+        , testShowFormat "ordinalDateFormat" (ordinalDateFormat BasicFormat) "1844236" (fromGregorian 1844 8 23)+        , testShowFormat+              "ordinalDateFormat"+              (expandedOrdinalDateFormat 5 ExtendedFormat)+              "+01846-235"+              (fromGregorian 1846 8 23)+        , testShowFormat "hourMinuteFormat" (hourMinuteFormat ExtendedFormat) "13:17.25" (TimeOfDay 13 17 15)+        , testShowFormat "hourMinuteFormat" (hourMinuteFormat ExtendedFormat) "01:12.4" (TimeOfDay 1 12 24)+        , testShowFormat "hourMinuteFormat" (hourMinuteFormat BasicFormat) "1317.25" (TimeOfDay 13 17 15)+        , testShowFormat "hourMinuteFormat" (hourMinuteFormat BasicFormat) "0112.4" (TimeOfDay 1 12 24)+        , testShowFormat "hourFormat" hourFormat "22" (TimeOfDay 22 0 0)+        , testShowFormat "hourFormat" hourFormat "06" (TimeOfDay 6 0 0)+        , testShowFormat "hourFormat" hourFormat "18.9475" (TimeOfDay 18 56 51)+        ]  testISO8601 :: TestTree-testISO8601 = nameTest "ISO8601"-    [-        testShowFormats,-        testReadShowFormat-    ]+testISO8601 = nameTest "ISO8601" [testShowFormats, testReadShowFormat]
test/main/Test/Format/ParseTime.hs view
@@ -1,33 +1,123 @@ {-# OPTIONS -fno-warn-orphans #-}-module Test.Format.ParseTime(testParseTime,test_parse_format) where +module Test.Format.ParseTime+    ( testParseTime+    , test_parse_format+    ) where++#if MIN_VERSION_base(4,11,0)+#else+import Data.Semigroup hiding (option)+#endif import Control.Monad import Data.Char-import Text.Read+import Data.Maybe+import Data.Proxy import Data.Time import Data.Time.Calendar.OrdinalDate import Data.Time.Calendar.WeekDate+import Test.Arbitrary () import Test.QuickCheck.Property import Test.Tasty import Test.Tasty.HUnit import Test.Tasty.QuickCheck hiding (reason) import Test.TestUtil-import Test.Arbitrary()+import Text.Read +format :: FormatTime t => String -> t -> String+format f t = formatTime defaultTimeLocale f t +parse :: ParseTime t => Bool -> String -> String -> Maybe t+parse sp f t = parseTimeM sp defaultTimeLocale f t++data FormatOnly++data ParseAndFormat++data FormatCode pf t = MkFormatCode+    { fcModifier :: String+    , fcWidth :: Maybe Int+    , fcAlt :: Bool+    , fcSpecifier :: Char+    }++instance Show (FormatCode pf t) where+    show (MkFormatCode m w a s) = let+        ms = m+        ws = fromMaybe "" $ fmap show w+        as =+            if a+                then "E"+                else ""+        ss = [s]+        in '%' : (ms <> ws <> as <> ss)++formatCode :: FormatTime t => FormatCode pf t -> t -> String+formatCode fc = format $ show fc++parseCode :: ParseTime t => FormatCode ParseAndFormat t -> String -> Maybe t+parseCode fc = parse False $ show fc++class HasFormatCodes t where+    allFormatCodes :: Proxy t -> [(Bool, Char)]++minCodeWidth :: Char -> Int+minCodeWidth _ = 0++fcShrink :: FormatCode pf t -> [FormatCode pf t]+fcShrink fc = let+    fc1 =+        case fcWidth fc of+            Nothing -> []+            Just w+                | w > (minCodeWidth $ fcSpecifier fc) -> [fc {fcWidth = Nothing}, fc {fcWidth = Just $ w - 1}]+            Just _ -> [fc {fcWidth = Nothing}]+    fc2 =+        case fcAlt fc of+            False -> []+            True -> [fc {fcAlt = False}]+    fc3 =+        case fcModifier fc of+            "" -> []+            _ -> [fc {fcModifier = ""}]+    in fc1 ++ fc2 ++ fc3++instance HasFormatCodes t => Arbitrary (FormatCode FormatOnly t) where+    arbitrary = do+        m <- oneof [return "", oneof $ fmap return ["", "-", "_", "0", "^", "#"]]+        (a, s) <- oneof $ fmap return $ allFormatCodes (Proxy :: Proxy t)+        w <-+            case minCodeWidth s of+                0 -> return Nothing+                mw -> oneof [return Nothing, fmap Just $ choose (mw, 15)]+        return $ MkFormatCode m w a s+    shrink = fcShrink++instance HasFormatCodes t => Arbitrary (FormatCode ParseAndFormat t) where+    arbitrary = do+        (a, s) <- oneof $ fmap return $ allFormatCodes (Proxy :: Proxy t)+        m <-+            case s of+                'Z' -> return ""+                'z' -> return ""+                _ -> oneof [return "", oneof $ fmap return ["", "-", "_", "0"]]+        return $ MkFormatCode m Nothing a s+    shrink = fcShrink+ testParseTime :: TestTree-testParseTime = testGroup "testParseTime"-    [-    readOtherTypesTest,-    readTests,-    simpleFormatTests,-    extests,-    particularParseTests,-    badParseTests,-    defaultTimeZoneTests,-    militaryTimeZoneTests,-    propertyTests-    ]+testParseTime =+    testGroup+        "testParseTime"+        [ readOtherTypesTest+        , readTests+        , simpleFormatTests+        , extests+        , particularParseTests+        , badParseTests+        , defaultTimeZoneTests+        , militaryTimeZoneTests+        , propertyTests+        ]  yearDays :: Integer -> [Day] yearDays y = [(fromGregorian y 1 1) .. (fromGregorian y 12 31)]@@ -36,62 +126,74 @@ makeExhaustiveTest name cases f = testGroup name (fmap f cases)  extests :: TestTree-extests = testGroup "exhaustive" ([-    makeExhaustiveTest "parse %y" [0..99] parseYY,-    makeExhaustiveTest "parse %-C %y 1900s" [0,1,50,99] (parseCYY 19),-    makeExhaustiveTest "parse %-C %y 2000s" [0,1,50,99] (parseCYY 20),-    makeExhaustiveTest "parse %-C %y 1400s" [0,1,50,99] (parseCYY 14),-    makeExhaustiveTest "parse %C %y 0700s" [0,1,50,99] (parseCYY2 7),-    makeExhaustiveTest "parse %-C %y 700s" [0,1,50,99] (parseCYY 7),-    makeExhaustiveTest "parse %-C %y 10000s" [0,1,50,99] (parseCYY 100),-    makeExhaustiveTest "parse %-C centuries" [20..100] (parseCentury " "),-    makeExhaustiveTest "parse %-C century X" [1,10,20,100] (parseCentury "X"),-    makeExhaustiveTest "parse %-C century 2sp" [1,10,20,100] (parseCentury "  "),-    makeExhaustiveTest "parse %-C century 5sp" [1,10,20,100] (parseCentury "     ")-    ] ++-    (concat $ fmap-    (\y -> [-    (makeExhaustiveTest "parse %Y%m%d" (yearDays y) parseYMD),-    (makeExhaustiveTest "parse %Y %m %d" (yearDays y) parseYearDayD),-    (makeExhaustiveTest "parse %Y %-m %e" (yearDays y) parseYearDayE)-    ]) [1,4,20,753,2000,2011,10001]))+extests =+    testGroup+        "exhaustive"+        ([ makeExhaustiveTest "parse %y" [0 .. 99] parseYY+         , makeExhaustiveTest "parse %-C %y 1900s" [0, 1, 50, 99] (parseCYY 19)+         , makeExhaustiveTest "parse %-C %y 2000s" [0, 1, 50, 99] (parseCYY 20)+         , makeExhaustiveTest "parse %-C %y 1400s" [0, 1, 50, 99] (parseCYY 14)+         , makeExhaustiveTest "parse %C %y 0700s" [0, 1, 50, 99] (parseCYY2 7)+         , makeExhaustiveTest "parse %-C %y 700s" [0, 1, 50, 99] (parseCYY 7)+         , makeExhaustiveTest "parse %-C %y -700s" [0, 1, 50, 99] (parseCYY (-7))+         , makeExhaustiveTest "parse %-C %y -70000s" [0, 1, 50, 99] (parseCYY (-70000))+         , makeExhaustiveTest "parse %-C %y 10000s" [0, 1, 50, 99] (parseCYY 100)+         , makeExhaustiveTest "parse %-C centuries" [20 .. 100] (parseCentury " ")+         , makeExhaustiveTest "parse %-C century X" [1, 10, 20, 100] (parseCentury "X")+         , makeExhaustiveTest "parse %-C century 2sp" [1, 10, 20, 100] (parseCentury "  ")+         , makeExhaustiveTest "parse %-C century 5sp" [1, 10, 20, 100] (parseCentury "     ")+         ] +++         (concat $+          fmap+              (\y ->+                   [ (makeExhaustiveTest "parse %Y%m%d" (yearDays y) parseYMD)+                   , (makeExhaustiveTest "parse %Y %m %d" (yearDays y) parseYearDayD)+                   , (makeExhaustiveTest "parse %Y %-m %e" (yearDays y) parseYearDayE)+                   ])+              [1, 4, 20, 753, 2000, 2011, 10001, (-1166)])) -readTest :: (Eq a,Show a,Read a) => [(a,String)] -> String -> TestTree+readTest :: (Eq a, Show a, Read a) => [(a, String)] -> String -> TestTree readTest expected target = let     found = reads target     result = assertEqual "" expected found     name = show target     in Test.Tasty.HUnit.testCase name result -readTestsParensSpaces :: forall a. (Eq a,Show a,Read a) => a -> String -> TestTree-readTestsParensSpaces expected target = testGroup target-    [-    readTest [(expected,"")] $ target,-    readTest [(expected,"")] $ "("++target++")",-    readTest [(expected,"")] $ " ("++target++")",-    readTest [(expected," ")] $ " ( "++target++" ) ",-    readTest [(expected," ")] $ " (( "++target++" )) ",-    readTest ([] :: [(a,String)]) $ "("++target,-    readTest [(expected,")")] $ ""++target++")",-    readTest [(expected,"")] $ "(("++target++"))",-    readTest [(expected," ")] $ "  (   (     "++target++"   )  ) "-    ] where+readTestsParensSpaces ::+       forall a. (Eq a, Show a, Read a)+    => a+    -> String+    -> TestTree+readTestsParensSpaces expected target =+    testGroup+        target+        [ readTest [(expected, "")] $ target+        , readTest [(expected, "")] $ "(" ++ target ++ ")"+        , readTest [(expected, "")] $ " (" ++ target ++ ")"+        , readTest [(expected, " ")] $ " ( " ++ target ++ " ) "+        , readTest [(expected, " ")] $ " (( " ++ target ++ " )) "+        , readTest ([] :: [(a, String)]) $ "(" ++ target+        , readTest [(expected, ")")] $ "" ++ target ++ ")"+        , readTest [(expected, "")] $ "((" ++ target ++ "))"+        , readTest [(expected, " ")] $ "  (   (     " ++ target ++ "   )  ) "+        ]+  where + readOtherTypesTest :: TestTree-readOtherTypesTest = testGroup "read other types"-    [-    readTestsParensSpaces (3 :: Integer) "3",-    readTestsParensSpaces "a" "\"a\""-    ]+readOtherTypesTest =+    testGroup "read other types" [readTestsParensSpaces (3 :: Integer) "3", readTestsParensSpaces "a" "\"a\""]  readTests :: TestTree-readTests = testGroup "read times"-    [-    readTestsParensSpaces testDay "1912-07-08",+readTests =+    testGroup+        "read times"+        [ readTestsParensSpaces testDay "1912-07-08"     --readTestsParensSpaces testDay "1912-7-8",-    readTestsParensSpaces testTimeOfDay "08:04:02"+        , readTestsParensSpaces testTimeOfDay "08:04:02"     --,readTestsParensSpaces testTimeOfDay "8:4:2"-    ] where+        ]+  where     testDay = fromGregorian 1912 7 8     testTimeOfDay = TimeOfDay 8 4 2 @@ -99,30 +201,32 @@ epoch = LocalTime (fromGregorian 1970 0 0) midnight  simpleFormatTests :: TestTree-simpleFormatTests = testGroup "simple"-    [-    readsTest [(epoch,"")] "" "",-    readsTest [(epoch," ")] "" " ",-    readsTest [(epoch,"")] " " " ",-    readsTest [(epoch,"")] " " "  ",-    readsTest [(epoch,"")] "%k" "0",-    readsTest [(epoch,"")] "%k" " 0",-    readsTest [(epoch,"")] "%m" "01",-    readsTest [(epoch," ")] "%m" "01 ",-    readsTest [(epoch," ")] " %m" " 01 ",-    readsTest [(epoch,"")] " %m" " 01",+simpleFormatTests =+    testGroup+        "simple"+        [ readsTest [(epoch, "")] "" ""+        , readsTest [(epoch, " ")] "" " "+        , readsTest [(epoch, "")] " " " "+        , readsTest [(epoch, "")] " " "  "+        , readsTest [(epoch, "")] "%k" "0"+        , readsTest [(epoch, "")] "%k" " 0"+        , readsTest [(epoch, "")] "%m" "01"+        , readsTest [(epoch, " ")] "%m" "01 "+        , readsTest [(epoch, " ")] " %m" " 01 "+        , readsTest [(epoch, "")] " %m" " 01"     -- https://ghc.haskell.org/trac/ghc/ticket/9150-    readsTest [(epoch,"")] " %M" " 00",-    readsTest [(epoch,"")] "%M " "00 ",-    readsTest [(epoch,"")] "%Q" "",-    readsTest [(epoch," ")] "%Q" " ",-    readsTest [(epoch,"X")] "%Q" "X",-    readsTest [(epoch," X")] "%Q" " X",-    readsTest [(epoch,"")] "%Q " " ",-    readsTest [(epoch,"")] "%Q X" " X",-    readsTest [(epoch,"")] "%QX" "X"-    ] where-    readsTest :: (Show a, Eq a, ParseTime a) => [(a,String)] -> String -> String -> TestTree+        , readsTest [(epoch, "")] " %M" " 00"+        , readsTest [(epoch, "")] "%M " "00 "+        , readsTest [(epoch, "")] "%Q" ""+        , readsTest [(epoch, " ")] "%Q" " "+        , readsTest [(epoch, "X")] "%Q" "X"+        , readsTest [(epoch, " X")] "%Q" " X"+        , readsTest [(epoch, "")] "%Q " " "+        , readsTest [(epoch, "")] "%Q X" " X"+        , readsTest [(epoch, "")] "%QX" "X"+        ]+  where+    readsTest :: (Show a, Eq a, ParseTime a) => [(a, String)] -> String -> String -> TestTree     readsTest expected formatStr target = let         found = readSTime False defaultTimeLocale formatStr target         result = assertEqual "" expected found@@ -130,55 +234,58 @@         in Test.Tasty.HUnit.testCase name result  spacingTests :: (Show t, Eq t, ParseTime t) => t -> String -> String -> TestTree-spacingTests expected formatStr target = testGroup "particular"-    [-        parseTest False (Just expected) formatStr target,-        parseTest True (Just expected) formatStr target,-        parseTest False (Just expected) (formatStr ++ " ") (target ++ " "),-        parseTest True (Just expected) (formatStr ++ " ") (target ++ " "),-        parseTest False (Just expected) (" " ++ formatStr) (" " ++ target),-        parseTest True (Just expected) (" " ++ formatStr) (" " ++ target),-        parseTest True (Just expected) ("" ++ formatStr) (" " ++ target),-        parseTest True (Just expected) (" " ++ formatStr) ("  " ++ target)-    ]+spacingTests expected formatStr target =+    testGroup+        "particular"+        [ parseTest False (Just expected) formatStr target+        , parseTest True (Just expected) formatStr target+        , parseTest False (Just expected) (formatStr ++ " ") (target ++ " ")+        , parseTest True (Just expected) (formatStr ++ " ") (target ++ " ")+        , parseTest False (Just expected) (" " ++ formatStr) (" " ++ target)+        , parseTest True (Just expected) (" " ++ formatStr) (" " ++ target)+        , parseTest True (Just expected) ("" ++ formatStr) (" " ++ target)+        , parseTest True (Just expected) (" " ++ formatStr) ("  " ++ target)+        ]  particularParseTests :: TestTree-particularParseTests = testGroup "particular"-    [-        spacingTests epoch "%Q" "",-        spacingTests epoch "%Q" ".0",-        spacingTests epoch "%k" " 0",-        spacingTests epoch "%M" "00",-        spacingTests epoch "%m" "01",-        spacingTests (TimeZone 120 False "") "%z" "+0200",-        spacingTests (TimeZone 120 False "") "%Z" "+0200",-        spacingTests (TimeZone (-480) False "PST") "%Z" "PST"-    ]+particularParseTests =+    testGroup+        "particular"+        [ spacingTests epoch "%Q" ""+        , spacingTests epoch "%Q" ".0"+        , spacingTests epoch "%k" " 0"+        , spacingTests epoch "%M" "00"+        , spacingTests epoch "%m" "01"+        , spacingTests (TimeZone 120 False "") "%z" "+0200"+        , spacingTests (TimeZone 120 False "") "%Z" "+0200"+        , spacingTests (TimeZone (-480) False "PST") "%Z" "PST"+        ]  badParseTests :: TestTree-badParseTests = testGroup "bad"-    [-        parseTest False (Nothing :: Maybe Day) "%Y" ""-    ]+badParseTests = testGroup "bad" [parseTest False (Nothing :: Maybe Day) "%Y" ""]  parseYMD :: Day -> TestTree-parseYMD day = case toGregorian day of-    (y,m,d) -> parseTest False (Just day) "%Y%m%d" ((show y) ++ (show2 m) ++ (show2 d))+parseYMD day =+    case toGregorian day of+        (y, m, d) -> parseTest False (Just day) "%Y%m%d" ((show y) ++ (show2 m) ++ (show2 d))  parseYearDayD :: Day -> TestTree-parseYearDayD day = case toGregorian day of-    (y,m,d) -> parseTest False (Just day) "%Y %m %d" ((show y) ++ " " ++ (show2 m) ++ " " ++ (show2 d))+parseYearDayD day =+    case toGregorian day of+        (y, m, d) -> parseTest False (Just day) "%Y %m %d" ((show y) ++ " " ++ (show2 m) ++ " " ++ (show2 d))  parseYearDayE :: Day -> TestTree-parseYearDayE day = case toGregorian day of-    (y,m,d) -> parseTest False (Just day) "%Y %-m %e" ((show y) ++ " " ++ (show m) ++ " " ++ (show d))+parseYearDayE day =+    case toGregorian day of+        (y, m, d) -> parseTest False (Just day) "%Y %-m %e" ((show y) ++ " " ++ (show m) ++ " " ++ (show d))  -- | 1969 - 2068 expectedYear :: Integer -> Integer-expectedYear i | i >= 69 = 1900 + i+expectedYear i+    | i >= 69 = 1900 + i expectedYear i = 2000 + i -show2 :: (Show n,Integral n) => n -> String+show2 :: (Show n, Integral n) => n -> String show2 i = (show (div i 10)) ++ (show (mod i 10))  parseYY :: Integer -> TestTree@@ -191,27 +298,36 @@ parseCYY2 c i = parseTest False (Just (fromGregorian ((c * 100) + i) 1 1)) "%C %y" ((show2 c) ++ " " ++ (show2 i))  parseCentury :: String -> Integer -> TestTree-parseCentury int c = parseTest False (Just (fromGregorian (c * 100) 1 1)) ("%-C" ++ int ++ "%y") ((show c) ++ int ++ "00")+parseCentury int c =+    parseTest False (Just (fromGregorian (c * 100) 1 1)) ("%-C" ++ int ++ "%y") ((show c) ++ int ++ "00")  parseTest :: (Show t, Eq t, ParseTime t) => Bool -> Maybe t -> String -> String -> TestTree parseTest sp expected formatStr target = let     found = parse sp formatStr target     result = assertEqual "" expected found-    name = (show formatStr) ++ " of " ++ (show target) ++ (if sp then " allowing spaces" else "")+    name =+        (show formatStr) +++        " of " +++        (show target) +++        (if sp+             then " allowing spaces"+             else "")     in Test.Tasty.HUnit.testCase name result+ {- readsTest :: forall t. (Show t, Eq t, ParseTime t) => Maybe t -> String -> String -> TestTree readsTest (Just e) = readsTest' [(e,"")] readsTest Nothing = readsTest' ([] :: [(t,String)]) -}- enumAdd :: (Enum a) => Int -> a -> a enumAdd i a = toEnum (i + fromEnum a)  getMilZoneLetter :: Int -> Char getMilZoneLetter 0 = 'Z'-getMilZoneLetter h | h < 0 = enumAdd (negate h) 'M'-getMilZoneLetter h | h < 10 = enumAdd (h - 1) 'A'+getMilZoneLetter h+    | h < 0 = enumAdd (negate h) 'M'+getMilZoneLetter h+    | h < 10 = enumAdd (h - 1) 'A' getMilZoneLetter h = enumAdd (h - 10) 'K'  getMilZone :: Int -> TimeZone@@ -226,46 +342,43 @@ militaryTimeZoneTests :: TestTree militaryTimeZoneTests = testGroup "military time zones" (fmap (testParseTimeZone . getMilZone) [-12 .. 12]) --parse :: ParseTime t => Bool -> String -> String -> Maybe t-parse sp f t = parseTimeM sp defaultTimeLocale f t--format :: (FormatTime t) => String -> t -> String-format f t = formatTime defaultTimeLocale f t- -- missing from the time package instance Eq ZonedTime where     ZonedTime t1 tz1 == ZonedTime t2 tz2 = t1 == t2 && tz1 == tz2 -compareResult' :: (Eq a,Show a) => String -> a -> a -> Result+compareResult' :: (Eq a, Show a) => String -> a -> a -> Result compareResult' extra expected found     | expected == found = succeeded     | otherwise = failed {reason = "expected " ++ (show expected) ++ ", found " ++ (show found) ++ extra} -compareResult :: (Eq a,Show a) => a -> a -> Result+compareResult :: (Eq a, Show a) => a -> a -> Result compareResult = compareResult' "" -compareParse :: forall a. (Eq a,Show a,ParseTime a) => a -> String -> String -> Result+compareParse ::+       forall a. (Eq a, Show a, ParseTime a)+    => a+    -> String+    -> String+    -> Result compareParse expected fmt text = compareResult' (", parsing " ++ (show text)) (Just expected) (parse False fmt text)  -- -- * tests for debugging failing cases ----test_parse_format :: (FormatTime t,ParseTime t,Show t) => String -> t -> (String,String,Maybe t)-test_parse_format f t = let s = format f t in (show t, s, parse False f s `asTypeOf` Just t)+test_parse_format :: (FormatTime t, ParseTime t, Show t) => String -> t -> (String, String, Maybe t)+test_parse_format f t = let+    s = format f t+    in (show t, s, parse False f s `asTypeOf` Just t)  -- -- * show and read --- prop_read_show :: (Read a, Show a, Eq a) => a -> Result prop_read_show t = compareResult (Just t) (readMaybe (show t))  -- -- * special show functions --- prop_parse_showWeekDate :: Day -> Result prop_parse_showWeekDate d = compareParse d "%G-W%V-%u" (showWeekDate d) @@ -278,66 +391,108 @@ -- -- * fromMondayStartWeek and fromSundayStartWeek --- prop_fromMondayStartWeek :: Day -> Result-prop_fromMondayStartWeek d =-    let (w,wd)  = mondayStartWeek d-        (y,_,_) = toGregorian d-     in compareResult d (fromMondayStartWeek y w wd)+prop_fromMondayStartWeek d = let+    (w, wd) = mondayStartWeek d+    (y, _, _) = toGregorian d+    in compareResult d (fromMondayStartWeek y w wd)  prop_fromSundayStartWeek :: Day -> Result-prop_fromSundayStartWeek d =-    let (w,wd)  = sundayStartWeek d-        (y,_,_) = toGregorian d-     in compareResult d (fromSundayStartWeek y w wd)------- * format and parse---+prop_fromSundayStartWeek d = let+    (w, wd) = sundayStartWeek d+    (y, _, _) = toGregorian d+    in compareResult d (fromSundayStartWeek y w wd) +-- t == parse (format t) prop_parse_format :: (Eq t, FormatTime t, ParseTime t, Show t) => FormatString t -> t -> Result prop_parse_format (FormatString f) t = compareParse t f (format f t) --- Verify case-insensitivity with upper case.+-- t == parse (upper (format t)) prop_parse_format_upper :: (Eq t, FormatTime t, ParseTime t, Show t) => FormatString t -> t -> Result prop_parse_format_upper (FormatString f) t = compareParse t f (map toUpper $ format f t) --- Verify case-insensitivity with lower case.+-- t == parse (lower (format t)) prop_parse_format_lower :: (Eq t, FormatTime t, ParseTime t, Show t) => FormatString t -> t -> Result prop_parse_format_lower (FormatString f) t = compareParse t f (map toLower $ format f t) -prop_format_parse_format :: (FormatTime t, ParseTime t) => FormatString t -> t -> Result-prop_format_parse_format (FormatString f) t = compareResult-    (Just (format f t))-    (fmap (format f) (parse False f (format f t) `asTypeOf` Just t))+-- Default time is 1970-01-01 00:00:00 +0000 (which was a Thursday)+in1970 :: Char -> String -> Bool+in1970 'j' "366" = False -- 1970 was not a leap year+in1970 'U' "53" = False -- last day of 1970 was Sunday-start-week 52+in1970 'W' "53" = False -- last day of 1970 was Monday-start-week 52+in1970 _ _ = True +-- format t == format (parse (format t))+prop_format_parse_format ::+       forall t. (FormatTime t, ParseTime t)+    => Proxy t+    -> FormatCode ParseAndFormat t+    -> t+    -> Result+prop_format_parse_format _ fc v = let+    s1 = formatCode fc v+    ms1 =+        if in1970 (fcSpecifier fc) s1+            then Just s1+            else Nothing+    mv2 :: Maybe t+    mv2 = parseCode fc s1+    ms2 = fmap (formatCode fc) mv2+    in compareResult ms1 ms2++instance HasFormatCodes Day where+    allFormatCodes _ = [(False, s) | s <- "DFxYyCBbhmdejfVUW"]++instance HasFormatCodes TimeOfDay where+    allFormatCodes _ = [(False, s) | s <- "RTXrPpHkIlMSqQ"]++instance HasFormatCodes LocalTime where+    allFormatCodes _ = allFormatCodes (Proxy :: Proxy Day) ++ allFormatCodes (Proxy :: Proxy TimeOfDay)++instance HasFormatCodes TimeZone where+    allFormatCodes _ = [(a, s) | a <- [False, True], s <- "zZ"]++instance HasFormatCodes ZonedTime where+    allFormatCodes _ =+        [(False, s) | s <- "cs"] +++        allFormatCodes (Proxy :: Proxy LocalTime) ++ allFormatCodes (Proxy :: Proxy TimeZone)++instance HasFormatCodes UTCTime where+    allFormatCodes _ = [(False, s) | s <- "cs"] ++ allFormatCodes (Proxy :: Proxy LocalTime)++instance HasFormatCodes UniversalTime where+    allFormatCodes _ = allFormatCodes (Proxy :: Proxy LocalTime)+ -- -- * crashes in parse ----newtype Input = Input String+newtype Input =+    Input String  instance Show Input where     show (Input s) = s  instance Arbitrary Input where     arbitrary = liftM Input $ list cs-      where cs = elements (['0'..'9'] ++ ['-',' ','/'] ++ ['a'..'z'] ++ ['A' .. 'Z'])-            list g = sized (\n -> choose (0,n) >>= \l -> replicateM l g)+      where+        cs = elements (['0' .. '9'] ++ ['-', ' ', '/'] ++ ['a' .. 'z'] ++ ['A' .. 'Z'])+        list g = sized (\n -> choose (0, n) >>= \l -> replicateM l g)+ instance CoArbitrary Input where     coarbitrary (Input s) = coarbitrary (sum (map ord s))  prop_no_crash_bad_input :: (Eq t, ParseTime t) => FormatString t -> Input -> Property-prop_no_crash_bad_input fs@(FormatString f) (Input s) = property $+prop_no_crash_bad_input fs@(FormatString f) (Input s) =+    property $     case parse False f s of-      Nothing -> True-      Just t  -> t == t `asTypeOf` formatType fs+        Nothing -> True+        Just t -> t == t `asTypeOf` formatType fs  -- -- ----newtype FormatString a = FormatString String+newtype FormatString a =+    FormatString String  formatType :: FormatString t -> t formatType _ = undefined@@ -346,179 +501,264 @@     show (FormatString f) = show f  typedTests :: (forall t. (Eq t, FormatTime t, ParseTime t, Show t) => FormatString t -> t -> Result) -> [TestTree]-typedTests prop = [-    nameTest "Day" $ tgroup dayFormats prop,-    nameTest "TimeOfDay" $ tgroup timeOfDayFormats prop,-    nameTest "LocalTime" $ tgroup localTimeFormats prop,-    nameTest "TimeZone" $ tgroup timeZoneFormats prop,-    nameTest "ZonedTime" $ tgroup zonedTimeFormats prop,-    nameTest "ZonedTime" $ tgroup zonedTimeAlmostFormats $ \fmt t -> (todSec $ localTimeOfDay $ zonedTimeToLocalTime t) < 60 ==> prop fmt t,-    nameTest "UTCTime" $ tgroup utcTimeAlmostFormats $ \fmt t -> utctDayTime t < 86400 ==> prop fmt t,-    nameTest "UniversalTime" $ tgroup universalTimeFormats prop,-    nameTest "CalendarDiffDays" $ tgroup calendarDiffDaysFormats prop,-    nameTest "CalenderDiffTime" $ tgroup calendarDiffTimeFormats prop,-    nameTest "DiffTime" $ tgroup diffTimeFormats prop,-    nameTest "NominalDiffTime" $ tgroup nominalDiffTimeFormats prop+typedTests prop =+    [ nameTest "Day" $ tgroup dayFormats prop+    , nameTest "TimeOfDay" $ tgroup timeOfDayFormats prop+    , nameTest "LocalTime" $ tgroup localTimeFormats prop+    , nameTest "TimeZone" $ tgroup timeZoneFormats prop+    , nameTest "ZonedTime" $ tgroup zonedTimeFormats prop+    , nameTest "ZonedTime" $+      tgroup zonedTimeAlmostFormats $ \fmt t -> (todSec $ localTimeOfDay $ zonedTimeToLocalTime t) < 60 ==> prop fmt t+    , nameTest "UTCTime" $ tgroup utcTimeAlmostFormats $ \fmt t -> utctDayTime t < 86400 ==> prop fmt t+    , nameTest "UniversalTime" $ tgroup universalTimeFormats prop+    , nameTest "CalendarDiffDays" $ tgroup calendarDiffDaysFormats prop+    , nameTest "CalenderDiffTime" $ tgroup calendarDiffTimeFormats prop+    , nameTest "DiffTime" $ tgroup diffTimeFormats prop+    , nameTest "NominalDiffTime" $ tgroup nominalDiffTimeFormats prop     ] -formatParseFormatTests :: TestTree-formatParseFormatTests = nameTest "format_parse_format" [-    nameTest "Day" $ tgroup partialDayFormats prop_format_parse_format,-    nameTest "TimeOfDay" $ tgroup partialTimeOfDayFormats prop_format_parse_format,-    nameTest "LocalTime" $ tgroup partialLocalTimeFormats prop_format_parse_format,-    nameTest "ZonedTime" $ tgroup partialZonedTimeFormats prop_format_parse_format,-    nameTest "UTCTime" $ tgroup partialUTCTimeFormats prop_format_parse_format,-    nameTest "UniversalTime" $ tgroup partialUniversalTimeFormats prop_format_parse_format+allTypes ::+       (forall t. (Eq t, Show t, Arbitrary t, FormatTime t, ParseTime t, HasFormatCodes t) => String -> Proxy t -> r)+    -> [r]+allTypes f =+    [ f "Day" (Proxy :: Proxy Day)+    , f "TimeOfDay" (Proxy :: Proxy TimeOfDay)+    , f "LocalTime" (Proxy :: Proxy LocalTime)+    , f "TimeZone" (Proxy :: Proxy TimeZone)+    , f "ZonedTime" (Proxy :: Proxy ZonedTime)+    , f "UTCTime" (Proxy :: Proxy UTCTime)+    , f "UniversalTime" (Proxy :: Proxy UniversalTime)     ] +parseEmptyTest ::+       forall t. ParseTime t+    => Proxy t+    -> Assertion+parseEmptyTest _ =+    case parse False "" "" :: Maybe t of+        Just _ -> return ()+        Nothing -> assertFailure "failed"++parseEmptyTests :: TestTree+parseEmptyTests = nameTest "parse empty" $ allTypes $ \name p -> nameTest name $ parseEmptyTest p++formatParseFormatTests :: TestTree+formatParseFormatTests =+    localOption (QuickCheckTests 50000) $+    nameTest "format_parse_format" $ allTypes $ \name p -> nameTest name $ prop_format_parse_format p+ badInputTests :: TestTree-badInputTests = nameTest "no_crash_bad_input" [-    nameTest "Day" $ tgroup (dayFormats ++ partialDayFormats ++ failingPartialDayFormats) prop_no_crash_bad_input,-    nameTest "TimeOfDay" $ tgroup (timeOfDayFormats ++ partialTimeOfDayFormats) prop_no_crash_bad_input,-    nameTest "LocalTime" $ tgroup (localTimeFormats ++ partialLocalTimeFormats) prop_no_crash_bad_input,-    nameTest "TimeZone" $ tgroup (timeZoneFormats) prop_no_crash_bad_input,-    nameTest "ZonedTime" $ tgroup (zonedTimeFormats ++ zonedTimeAlmostFormats ++ partialZonedTimeFormats) prop_no_crash_bad_input,-    nameTest "UTCTime" $ tgroup (utcTimeAlmostFormats ++ partialUTCTimeFormats) prop_no_crash_bad_input,-    nameTest "UniversalTime" $ tgroup (universalTimeFormats ++ partialUniversalTimeFormats) prop_no_crash_bad_input-    ]+badInputTests =+    nameTest+        "no_crash_bad_input"+        [ nameTest "Day" $ tgroup (dayFormats ++ partialDayFormats ++ failingPartialDayFormats) prop_no_crash_bad_input+        , nameTest "TimeOfDay" $ tgroup (timeOfDayFormats ++ partialTimeOfDayFormats) prop_no_crash_bad_input+        , nameTest "LocalTime" $ tgroup (localTimeFormats ++ partialLocalTimeFormats) prop_no_crash_bad_input+        , nameTest "TimeZone" $ tgroup (timeZoneFormats) prop_no_crash_bad_input+        , nameTest "ZonedTime" $+          tgroup (zonedTimeFormats ++ zonedTimeAlmostFormats ++ partialZonedTimeFormats) prop_no_crash_bad_input+        , nameTest "UTCTime" $ tgroup (utcTimeAlmostFormats ++ partialUTCTimeFormats) prop_no_crash_bad_input+        , nameTest "UniversalTime" $+          tgroup (universalTimeFormats ++ partialUniversalTimeFormats) prop_no_crash_bad_input+        ]  readShowTests :: TestTree-readShowTests = nameTest "read_show" [-    nameTest "Day" (prop_read_show :: Day -> Result),-    nameTest "TimeOfDay" (prop_read_show :: TimeOfDay -> Result),-    nameTest "LocalTime" (prop_read_show :: LocalTime -> Result),-    nameTest "TimeZone" (prop_read_show :: TimeZone -> Result),-    nameTest "ZonedTime" (prop_read_show :: ZonedTime -> Result),-    nameTest "UTCTime" (prop_read_show :: UTCTime -> Result),-    nameTest "UniversalTime" (prop_read_show :: UniversalTime -> Result)+readShowTests =+    nameTest+        "read_show"+        [ nameTest "Day" (prop_read_show :: Day -> Result)+        , nameTest "TimeOfDay" (prop_read_show :: TimeOfDay -> Result)+        , nameTest "LocalTime" (prop_read_show :: LocalTime -> Result)+        , nameTest "TimeZone" (prop_read_show :: TimeZone -> Result)+        , nameTest "ZonedTime" (prop_read_show :: ZonedTime -> Result)+        , nameTest "UTCTime" (prop_read_show :: UTCTime -> Result)+        , nameTest "UniversalTime" (prop_read_show :: UniversalTime -> Result)     --nameTest "CalendarDiffDays" (prop_read_show :: CalendarDiffDays -> Result),     --nameTest "CalendarDiffTime" (prop_read_show :: CalendarDiffTime -> Result)-    ]+        ]  parseShowTests :: TestTree-parseShowTests = nameTest "parse_show" [-    nameTest "showWeekDate" prop_parse_showWeekDate,-    nameTest "showGregorian" prop_parse_showGregorian,-    nameTest "showOrdinalDate" prop_parse_showOrdinalDate-    ]+parseShowTests =+    nameTest+        "parse_show"+        [ nameTest "showWeekDate" prop_parse_showWeekDate+        , nameTest "showGregorian" prop_parse_showGregorian+        , nameTest "showOrdinalDate" prop_parse_showOrdinalDate+        ]  propertyTests :: TestTree-propertyTests = nameTest "properties" [-    readShowTests,-    parseShowTests,-    nameTest "fromMondayStartWeek" prop_fromMondayStartWeek,-    nameTest "fromSundayStartWeek" prop_fromSundayStartWeek,-    nameTest "parse_format" $ typedTests prop_parse_format,-    nameTest "parse_format_lower" $ typedTests prop_parse_format_lower,-    nameTest "parse_format_upper" $ typedTests prop_parse_format_upper,-    formatParseFormatTests,-    badInputTests-    ]+propertyTests =+    localOption (QuickCheckTests 2000) $+    nameTest+        "properties"+        [ readShowTests+        , parseShowTests+        , nameTest "fromMondayStartWeek" prop_fromMondayStartWeek+        , nameTest "fromSundayStartWeek" prop_fromSundayStartWeek+        , nameTest "parse_format" $ typedTests prop_parse_format+        , nameTest "parse_format_lower" $ typedTests prop_parse_format_lower+        , nameTest "parse_format_upper" $ typedTests prop_parse_format_upper+        , parseEmptyTests+        , formatParseFormatTests+        , badInputTests+        ]  dayFormats :: [FormatString Day]-dayFormats = map FormatString-    [+dayFormats =+    map FormatString      -- numeric year, month, day-     "%Y-%m-%d","%Y%m%d","%C%y%m%d","%Y %m %e","%m/%d/%Y","%d/%m/%Y","%Y/%d/%m","%D %C","%F",+        [ "%Y-%m-%d"+        , "%Y%m%d"+        , "%C%y%m%d"+        , "%Y %m %e"+        , "%m/%d/%Y"+        , "%d/%m/%Y"+        , "%Y/%d/%m"+        , "%D %C"+        , "%F"      -- month names-     "%Y-%B-%d","%Y-%b-%d","%Y-%h-%d",+        , "%Y-%B-%d"+        , "%Y-%b-%d"+        , "%Y-%h-%d"      -- ordinal dates-     "%Y-%j",+        , "%Y-%j"      -- ISO week dates-     "%G-%V-%u","%G-%V-%a","%G-%V-%A","%G-%V-%w", "%A week %V, %G", "day %V, week %A, %G",-     "%G-W%V-%u",-     "%f%g-%V-%u","%f%g-%V-%a","%f%g-%V-%A","%f%g-%V-%w", "%A week %V, %f%g", "day %V, week %A, %f%g",-     "%f%g-W%V-%u",+        , "%G-%V-%u"+        , "%G-%V-%a"+        , "%G-%V-%A"+        , "%G-%V-%w"+        , "%A week %V, %G"+        , "day %V, week %A, %G"+        , "%G-W%V-%u"+        , "%f%g-%V-%u"+        , "%f%g-%V-%a"+        , "%f%g-%V-%A"+        , "%f%g-%V-%w"+        , "%A week %V, %f%g"+        , "day %V, week %A, %f%g"+        , "%f%g-W%V-%u"      -- monday and sunday week dates-     "%Y-w%U-%A", "%Y-w%W-%A", "%Y-%A-w%U", "%Y-%A-w%W", "%A week %U, %Y", "%A week %W, %Y"-    ]+        , "%Y-w%U-%A"+        , "%Y-w%W-%A"+        , "%Y-%A-w%U"+        , "%Y-%A-w%W"+        , "%A week %U, %Y"+        , "%A week %W, %Y"+        ]  timeOfDayFormats :: [FormatString TimeOfDay]-timeOfDayFormats = map FormatString-    [+timeOfDayFormats =+    map FormatString      -- 24 h formats-     "%H:%M:%S.%q","%k:%M:%S.%q","%H%M%S.%q","%T.%q","%X.%q","%R:%S.%q",-     "%H:%M:%S%Q","%k:%M:%S%Q","%H%M%S%Q","%T%Q","%X%Q","%R:%S%Q",+        [ "%H:%M:%S.%q"+        , "%k:%M:%S.%q"+        , "%H%M%S.%q"+        , "%T.%q"+        , "%X.%q"+        , "%R:%S.%q"+        , "%H:%M:%S%Q"+        , "%k:%M:%S%Q"+        , "%H%M%S%Q"+        , "%T%Q"+        , "%X%Q"+        , "%R:%S%Q"      -- 12 h formats-     "%I:%M:%S.%q %p","%I:%M:%S.%q %P","%l:%M:%S.%q %p","%r %q",-     "%I:%M:%S%Q %p","%I:%M:%S%Q %P","%l:%M:%S%Q %p","%r %Q"-    ]+        , "%I:%M:%S.%q %p"+        , "%I:%M:%S.%q %P"+        , "%l:%M:%S.%q %p"+        , "%r %q"+        , "%I:%M:%S%Q %p"+        , "%I:%M:%S%Q %P"+        , "%l:%M:%S%Q %p"+        , "%r %Q"+        ]  localTimeFormats :: [FormatString LocalTime]-localTimeFormats = map FormatString [{-"%Q","%Q ","%QX"-}]+localTimeFormats = map FormatString [] {-"%Q","%Q ","%QX"-}  timeZoneFormats :: [FormatString TimeZone]-timeZoneFormats = map FormatString ["%z","%z%Z","%Z%z","%Z"]+timeZoneFormats = map FormatString ["%z", "%z%Z", "%Z%z", "%Z", "%Ez", "%EZ"]  zonedTimeFormats :: [FormatString ZonedTime]-zonedTimeFormats = map FormatString-  ["%a, %d %b %Y %H:%M:%S.%q %z", "%a, %d %b %Y %H:%M:%S%Q %z",-   "%a, %d %b %Y %H:%M:%S.%q %Z", "%a, %d %b %Y %H:%M:%S%Q %Z"]+zonedTimeFormats =+    map FormatString+        [ "%a, %d %b %Y %H:%M:%S.%q %z"+        , "%a, %d %b %Y %H:%M:%S%Q %z"+        , "%a, %d %b %Y %H:%M:%S.%q %Z"+        , "%a, %d %b %Y %H:%M:%S%Q %Z"+        ]  zonedTimeAlmostFormats :: [FormatString ZonedTime]-zonedTimeAlmostFormats = map FormatString  ["%s.%q %z", "%s%Q %z", "%s.%q %Z", "%s%Q %Z"]+zonedTimeAlmostFormats = map FormatString ["%s.%q %z", "%s%Q %z", "%s.%q %Z", "%s%Q %Z"]  utcTimeAlmostFormats :: [FormatString UTCTime]-utcTimeAlmostFormats = map FormatString  ["%s.%q","%s%Q"]+utcTimeAlmostFormats = map FormatString ["%s.%q", "%s%Q"]  universalTimeFormats :: [FormatString UniversalTime] universalTimeFormats = map FormatString []  calendarDiffDaysFormats :: [FormatString CalendarDiffDays]-calendarDiffDaysFormats = map FormatString ["%yy%Bm%ww%Dd","%yy%Bm%dd","%bm%ww%Dd","%bm%dd"]+calendarDiffDaysFormats = map FormatString ["%yy%Bm%ww%Dd", "%yy%Bm%dd", "%bm%ww%Dd", "%bm%dd"]  calendarDiffTimeFormats :: [FormatString CalendarDiffTime]-calendarDiffTimeFormats = map FormatString ["%yy%Bm%ww%Dd%Hh%Mm%ESs","%bm%ww%Dd%Hh%Mm%ESs","%bm%dd%Hh%Mm%ESs","%bm%hh%Mm%ESs","%bm%mm%ESs","%bm%mm%0ESs","%bm%Ess","%bm%0Ess"]+calendarDiffTimeFormats =+    map FormatString+        [ "%yy%Bm%ww%Dd%Hh%Mm%ESs"+        , "%bm%ww%Dd%Hh%Mm%ESs"+        , "%bm%dd%Hh%Mm%ESs"+        , "%bm%hh%Mm%ESs"+        , "%bm%mm%ESs"+        , "%bm%mm%0ESs"+        , "%bm%Ess"+        , "%bm%0Ess"+        ]  diffTimeFormats :: [FormatString DiffTime]-diffTimeFormats = map FormatString ["%ww%Dd%Hh%Mm%ESs","%dd%Hh%Mm%ESs","%hh%Mm%ESs","%mm%ESs","%mm%0ESs","%Ess","%0Ess"]+diffTimeFormats =+    map FormatString ["%ww%Dd%Hh%Mm%ESs", "%dd%Hh%Mm%ESs", "%hh%Mm%ESs", "%mm%ESs", "%mm%0ESs", "%Ess", "%0Ess"]  nominalDiffTimeFormats :: [FormatString NominalDiffTime]-nominalDiffTimeFormats = map FormatString ["%ww%Dd%Hh%Mm%ESs","%dd%Hh%Mm%ESs","%hh%Mm%ESs","%mm%ESs","%mm%0ESs","%Ess","%0Ess"]+nominalDiffTimeFormats =+    map FormatString ["%ww%Dd%Hh%Mm%ESs", "%dd%Hh%Mm%ESs", "%hh%Mm%ESs", "%mm%ESs", "%mm%0ESs", "%Ess", "%0Ess"]  -- -- * Formats that do not include all the information --- partialDayFormats :: [FormatString Day]-partialDayFormats = map FormatString-    [ ]+partialDayFormats = map FormatString []  partialTimeOfDayFormats :: [FormatString TimeOfDay]-partialTimeOfDayFormats = map FormatString-    [ ]+partialTimeOfDayFormats = map FormatString ["%H", "%M", "%S", "%H:%M"]  partialLocalTimeFormats :: [FormatString LocalTime]-partialLocalTimeFormats = map FormatString-    [ ]+partialLocalTimeFormats = map FormatString []  partialZonedTimeFormats :: [FormatString ZonedTime]-partialZonedTimeFormats = map FormatString-    [+partialZonedTimeFormats =+    map FormatString      -- %s does not include second decimals-     "%s %z",+        [ "%s %z"      -- %S does not include second decimals-     "%c", "%a, %d %b %Y %H:%M:%S %Z"-    ]+        , "%c"+        , "%a, %d %b %Y %H:%M:%S %Z"+        ]  partialUTCTimeFormats :: [FormatString UTCTime]-partialUTCTimeFormats = map FormatString-    [+partialUTCTimeFormats =+    map FormatString      -- %s does not include second decimals-     "%s",+        [ "%s"      -- %c does not include second decimals-     "%c"-    ]+        , "%c"+        ]  partialUniversalTimeFormats :: [FormatString UniversalTime]-partialUniversalTimeFormats = map FormatString-    [ ]+partialUniversalTimeFormats = map FormatString []  failingPartialDayFormats :: [FormatString Day]-failingPartialDayFormats = map FormatString-    [ -- ISO week dates with two digit year.+failingPartialDayFormats =+    map FormatString+      -- ISO week dates with two digit year.       -- This can fail in the beginning or the end of a year where       -- the ISO week date year does not match the gregorian year.-     "%g-%V-%u","%g-%V-%a","%g-%V-%A","%g-%V-%w", "%A week %V, %g", "day %V, week %A, %g",-     "%g-W%V-%u"-    ]+        ["%g-%V-%u", "%g-%V-%a", "%g-%V-%A", "%g-%V-%w", "%A week %V, %g", "day %V, week %A, %g", "%g-W%V-%u"]
test/main/Test/LocalTime/CalendarDiffTime.hs view
@@ -5,14 +5,13 @@ --import Data.Time.LocalTime import Test.Arbitrary () import Test.Tasty---import Test.Tasty.QuickCheck hiding (reason) +--import Test.Tasty.QuickCheck hiding (reason) --testReadShow :: TestTree --testReadShow = testProperty "read . show" $ \(t :: CalendarDiffTime) -> read (show t) == t- testCalendarDiffTime :: TestTree testCalendarDiffTime =     testGroup         "CalendarDiffTime"-        [ --testReadShow-        ]+          --testReadShow+        []
test/main/Test/LocalTime/Time.hs view
@@ -1,67 +1,60 @@-module Test.LocalTime.Time(testTime) where+module Test.LocalTime.Time+    ( testTime+    ) where +import Data.Time import Data.Time.Calendar.OrdinalDate import Data.Time.Calendar.WeekDate-import Data.Time+import Test.LocalTime.TimeRef import Test.Tasty import Test.Tasty.HUnit-import Test.LocalTime.TimeRef  showCal :: Integer -> String-showCal mjd-  = let date    = ModifiedJulianDay mjd-        (y,m,d) = toGregorian date-        date' = fromGregorian y m d-    in concat [ show mjd ++ "="-                 ++ showGregorian date ++ "="-                 ++ showOrdinalDate date ++ "="-                 ++ showWeekDate date-                 ++ "\n"--               , if date == date'-                   then ""-                   else "=" ++ (show $ toModifiedJulianDay date') ++ "!" ]+showCal mjd = let+    date = ModifiedJulianDay mjd+    (y, m, d) = toGregorian date+    date' = fromGregorian y m d+    in concat+           [ show mjd ++ "=" ++ showGregorian date ++ "=" ++ showOrdinalDate date ++ "=" ++ showWeekDate date ++ "\n"+           , if date == date'+                 then ""+                 else "=" ++ (show $ toModifiedJulianDay date') ++ "!"+           ]  testCal :: String-testCal-  = concat+testCal =+    concat         -- days around 1 BCE/1 CE-      [ concatMap showCal [-678950 .. -678930]-+        [ concatMap showCal [-678950 .. -678930]         -- days around 1000 CE-      , concatMap showCal [-313710 .. -313690]-+        , concatMap showCal [-313710 .. -313690]         -- days around MJD zero-      , concatMap showCal [-30..30]-      , showCal 40000-      , showCal 50000-+        , concatMap showCal [-30 .. 30]+        , showCal 40000+        , showCal 50000         -- 1900 not a leap year-      , showCal 15078-      , showCal 15079-+        , showCal 15078+        , showCal 15079         -- 1980 is a leap year-      , showCal 44297-      , showCal 44298-      , showCal 44299-+        , showCal 44297+        , showCal 44298+        , showCal 44299         -- 1990 not a leap year-      , showCal 47950-      , showCal 47951-+        , showCal 47950+        , showCal 47951         -- 2000 is a leap year-      , showCal 51602-      , showCal 51603-      , showCal 51604-+        , showCal 51602+        , showCal 51603+        , showCal 51604         -- years 2000 and 2001, plus some slop-      , concatMap showCal [51540..52280] ]+        , concatMap showCal [51540 .. 52280]+        ]  showUTCTime :: UTCTime -> String-showUTCTime (UTCTime d t) =  show (toModifiedJulianDay d) ++ "," ++ show t+showUTCTime (UTCTime d t) = show (toModifiedJulianDay d) ++ "," ++ show t  myzone :: TimeZone-myzone = hoursToTimeZone (- 8)+myzone = hoursToTimeZone (-8)  leapSec1998Cal :: LocalTime leapSec1998Cal = LocalTime (fromGregorian 1998 12 31) (TimeOfDay 23 59 60.5)@@ -70,14 +63,10 @@ leapSec1998 = localTimeToUTC utc leapSec1998Cal  testUTC :: String-testUTC-  = let lsMineCal = utcToLocalTime myzone leapSec1998-        lsMine = localTimeToUTC myzone lsMineCal-    in unlines [ showCal 51178-           , show leapSec1998Cal-           , showUTCTime leapSec1998-           , show lsMineCal-           , showUTCTime lsMine ]+testUTC = let+    lsMineCal = utcToLocalTime myzone leapSec1998+    lsMine = localTimeToUTC myzone lsMineCal+    in unlines [showCal 51178, show leapSec1998Cal, showUTCTime leapSec1998, show lsMineCal, showUTCTime lsMine]  neglong :: Rational neglong = -120@@ -86,24 +75,28 @@ poslong = 120  testUT1 :: String-testUT1-  = unlines [ show $ ut1ToLocalTime 0 $ ModJulianDate 51604.0-            , show $ ut1ToLocalTime 0 $ ModJulianDate 51604.5-            , show $ ut1ToLocalTime neglong $ ModJulianDate 51604.0-            , show $ ut1ToLocalTime neglong $ ModJulianDate 51604.5-            , show $ ut1ToLocalTime poslong $ ModJulianDate 51604.0-            , show $ ut1ToLocalTime poslong $ ModJulianDate 51604.5 ]+testUT1 =+    unlines+        [ show $ ut1ToLocalTime 0 $ ModJulianDate 51604.0+        , show $ ut1ToLocalTime 0 $ ModJulianDate 51604.5+        , show $ ut1ToLocalTime neglong $ ModJulianDate 51604.0+        , show $ ut1ToLocalTime neglong $ ModJulianDate 51604.5+        , show $ ut1ToLocalTime poslong $ ModJulianDate 51604.0+        , show $ ut1ToLocalTime poslong $ ModJulianDate 51604.5+        ]  testTimeOfDayToDayFraction :: String-testTimeOfDayToDayFraction-  = let f = dayFractionToTimeOfDay . timeOfDayToDayFraction-    in unlines [ show $ f $ TimeOfDay 12 34 56.789-               , show $ f $ TimeOfDay 12 34 56.789123-               , show $ f $ TimeOfDay 12 34 56.789123456-               , show $ f $ TimeOfDay 12 34 56.789123456789-               , show $ f $ TimeOfDay minBound 0 0-               ]+testTimeOfDayToDayFraction = let+    f = dayFractionToTimeOfDay . timeOfDayToDayFraction+    in unlines+           [ show $ f $ TimeOfDay 12 34 56.789+           , show $ f $ TimeOfDay 12 34 56.789123+           , show $ f $ TimeOfDay 12 34 56.789123456+           , show $ f $ TimeOfDay 12 34 56.789123456789+           , show $ f $ TimeOfDay minBound 0 0+           ]  testTime :: TestTree-testTime = testCase "testTime" $+testTime =+    testCase "testTime" $     assertEqual "times" testTimeRef $ unlines [testCal, testUTC, testUT1, testTimeOfDayToDayFraction]
test/main/Test/LocalTime/TimeRef.hs view
@@ -4,887 +4,892 @@  is64Bit :: Bool is64Bit =-    if toInteger (maxBound :: Int) == toInteger (maxBound :: Int32) then False else-    if toInteger (maxBound :: Int) == toInteger (maxBound :: Int64) then True else-    error "unrecognised Int size"--testTimeRef :: String-testTimeRef =-  unlines [-  "-678950=-0001-12-23=-0001-357=-0001-W51-4"-  ,"-678949=-0001-12-24=-0001-358=-0001-W51-5"-  ,"-678948=-0001-12-25=-0001-359=-0001-W51-6"-  ,"-678947=-0001-12-26=-0001-360=-0001-W51-7"-  ,"-678946=-0001-12-27=-0001-361=-0001-W52-1"-  ,"-678945=-0001-12-28=-0001-362=-0001-W52-2"-  ,"-678944=-0001-12-29=-0001-363=-0001-W52-3"-  ,"-678943=-0001-12-30=-0001-364=-0001-W52-4"-  ,"-678942=-0001-12-31=-0001-365=-0001-W52-5"-  ,"-678941=0000-01-01=0000-001=-0001-W52-6"-  ,"-678940=0000-01-02=0000-002=-0001-W52-7"-  ,"-678939=0000-01-03=0000-003=0000-W01-1"-  ,"-678938=0000-01-04=0000-004=0000-W01-2"-  ,"-678937=0000-01-05=0000-005=0000-W01-3"-  ,"-678936=0000-01-06=0000-006=0000-W01-4"-  ,"-678935=0000-01-07=0000-007=0000-W01-5"-  ,"-678934=0000-01-08=0000-008=0000-W01-6"-  ,"-678933=0000-01-09=0000-009=0000-W01-7"-  ,"-678932=0000-01-10=0000-010=0000-W02-1"-  ,"-678931=0000-01-11=0000-011=0000-W02-2"-  ,"-678930=0000-01-12=0000-012=0000-W02-3"-  ,"-313710=0999-12-20=0999-354=0999-W51-5"-  ,"-313709=0999-12-21=0999-355=0999-W51-6"-  ,"-313708=0999-12-22=0999-356=0999-W51-7"-  ,"-313707=0999-12-23=0999-357=0999-W52-1"-  ,"-313706=0999-12-24=0999-358=0999-W52-2"-  ,"-313705=0999-12-25=0999-359=0999-W52-3"-  ,"-313704=0999-12-26=0999-360=0999-W52-4"-  ,"-313703=0999-12-27=0999-361=0999-W52-5"-  ,"-313702=0999-12-28=0999-362=0999-W52-6"-  ,"-313701=0999-12-29=0999-363=0999-W52-7"-  ,"-313700=0999-12-30=0999-364=1000-W01-1"-  ,"-313699=0999-12-31=0999-365=1000-W01-2"-  ,"-313698=1000-01-01=1000-001=1000-W01-3"-  ,"-313697=1000-01-02=1000-002=1000-W01-4"-  ,"-313696=1000-01-03=1000-003=1000-W01-5"-  ,"-313695=1000-01-04=1000-004=1000-W01-6"-  ,"-313694=1000-01-05=1000-005=1000-W01-7"-  ,"-313693=1000-01-06=1000-006=1000-W02-1"-  ,"-313692=1000-01-07=1000-007=1000-W02-2"-  ,"-313691=1000-01-08=1000-008=1000-W02-3"-  ,"-313690=1000-01-09=1000-009=1000-W02-4"-  ,"-30=1858-10-18=1858-291=1858-W42-1"-  ,"-29=1858-10-19=1858-292=1858-W42-2"-  ,"-28=1858-10-20=1858-293=1858-W42-3"-  ,"-27=1858-10-21=1858-294=1858-W42-4"-  ,"-26=1858-10-22=1858-295=1858-W42-5"-  ,"-25=1858-10-23=1858-296=1858-W42-6"-  ,"-24=1858-10-24=1858-297=1858-W42-7"-  ,"-23=1858-10-25=1858-298=1858-W43-1"-  ,"-22=1858-10-26=1858-299=1858-W43-2"-  ,"-21=1858-10-27=1858-300=1858-W43-3"-  ,"-20=1858-10-28=1858-301=1858-W43-4"-  ,"-19=1858-10-29=1858-302=1858-W43-5"-  ,"-18=1858-10-30=1858-303=1858-W43-6"-  ,"-17=1858-10-31=1858-304=1858-W43-7"-  ,"-16=1858-11-01=1858-305=1858-W44-1"-  ,"-15=1858-11-02=1858-306=1858-W44-2"-  ,"-14=1858-11-03=1858-307=1858-W44-3"-  ,"-13=1858-11-04=1858-308=1858-W44-4"-  ,"-12=1858-11-05=1858-309=1858-W44-5"-  ,"-11=1858-11-06=1858-310=1858-W44-6"-  ,"-10=1858-11-07=1858-311=1858-W44-7"-  ,"-9=1858-11-08=1858-312=1858-W45-1"-  ,"-8=1858-11-09=1858-313=1858-W45-2"-  ,"-7=1858-11-10=1858-314=1858-W45-3"-  ,"-6=1858-11-11=1858-315=1858-W45-4"-  ,"-5=1858-11-12=1858-316=1858-W45-5"-  ,"-4=1858-11-13=1858-317=1858-W45-6"-  ,"-3=1858-11-14=1858-318=1858-W45-7"-  ,"-2=1858-11-15=1858-319=1858-W46-1"-  ,"-1=1858-11-16=1858-320=1858-W46-2"-  ,"0=1858-11-17=1858-321=1858-W46-3"-  ,"1=1858-11-18=1858-322=1858-W46-4"-  ,"2=1858-11-19=1858-323=1858-W46-5"-  ,"3=1858-11-20=1858-324=1858-W46-6"-  ,"4=1858-11-21=1858-325=1858-W46-7"-  ,"5=1858-11-22=1858-326=1858-W47-1"-  ,"6=1858-11-23=1858-327=1858-W47-2"-  ,"7=1858-11-24=1858-328=1858-W47-3"-  ,"8=1858-11-25=1858-329=1858-W47-4"-  ,"9=1858-11-26=1858-330=1858-W47-5"-  ,"10=1858-11-27=1858-331=1858-W47-6"-  ,"11=1858-11-28=1858-332=1858-W47-7"-  ,"12=1858-11-29=1858-333=1858-W48-1"-  ,"13=1858-11-30=1858-334=1858-W48-2"-  ,"14=1858-12-01=1858-335=1858-W48-3"-  ,"15=1858-12-02=1858-336=1858-W48-4"-  ,"16=1858-12-03=1858-337=1858-W48-5"-  ,"17=1858-12-04=1858-338=1858-W48-6"-  ,"18=1858-12-05=1858-339=1858-W48-7"-  ,"19=1858-12-06=1858-340=1858-W49-1"-  ,"20=1858-12-07=1858-341=1858-W49-2"-  ,"21=1858-12-08=1858-342=1858-W49-3"-  ,"22=1858-12-09=1858-343=1858-W49-4"-  ,"23=1858-12-10=1858-344=1858-W49-5"-  ,"24=1858-12-11=1858-345=1858-W49-6"-  ,"25=1858-12-12=1858-346=1858-W49-7"-  ,"26=1858-12-13=1858-347=1858-W50-1"-  ,"27=1858-12-14=1858-348=1858-W50-2"-  ,"28=1858-12-15=1858-349=1858-W50-3"-  ,"29=1858-12-16=1858-350=1858-W50-4"-  ,"30=1858-12-17=1858-351=1858-W50-5"-  ,"40000=1968-05-24=1968-145=1968-W21-5"-  ,"50000=1995-10-10=1995-283=1995-W41-2"-  ,"15078=1900-02-28=1900-059=1900-W09-3"-  ,"15079=1900-03-01=1900-060=1900-W09-4"-  ,"44297=1980-02-28=1980-059=1980-W09-4"-  ,"44298=1980-02-29=1980-060=1980-W09-5"-  ,"44299=1980-03-01=1980-061=1980-W09-6"-  ,"47950=1990-02-28=1990-059=1990-W09-3"-  ,"47951=1990-03-01=1990-060=1990-W09-4"-  ,"51602=2000-02-28=2000-059=2000-W09-1"-  ,"51603=2000-02-29=2000-060=2000-W09-2"-  ,"51604=2000-03-01=2000-061=2000-W09-3"-  ,"51540=1999-12-28=1999-362=1999-W52-2"-  ,"51541=1999-12-29=1999-363=1999-W52-3"-  ,"51542=1999-12-30=1999-364=1999-W52-4"-  ,"51543=1999-12-31=1999-365=1999-W52-5"-  ,"51544=2000-01-01=2000-001=1999-W52-6"-  ,"51545=2000-01-02=2000-002=1999-W52-7"-  ,"51546=2000-01-03=2000-003=2000-W01-1"-  ,"51547=2000-01-04=2000-004=2000-W01-2"-  ,"51548=2000-01-05=2000-005=2000-W01-3"-  ,"51549=2000-01-06=2000-006=2000-W01-4"-  ,"51550=2000-01-07=2000-007=2000-W01-5"-  ,"51551=2000-01-08=2000-008=2000-W01-6"-  ,"51552=2000-01-09=2000-009=2000-W01-7"-  ,"51553=2000-01-10=2000-010=2000-W02-1"-  ,"51554=2000-01-11=2000-011=2000-W02-2"-  ,"51555=2000-01-12=2000-012=2000-W02-3"-  ,"51556=2000-01-13=2000-013=2000-W02-4"-  ,"51557=2000-01-14=2000-014=2000-W02-5"-  ,"51558=2000-01-15=2000-015=2000-W02-6"-  ,"51559=2000-01-16=2000-016=2000-W02-7"-  ,"51560=2000-01-17=2000-017=2000-W03-1"-  ,"51561=2000-01-18=2000-018=2000-W03-2"-  ,"51562=2000-01-19=2000-019=2000-W03-3"-  ,"51563=2000-01-20=2000-020=2000-W03-4"-  ,"51564=2000-01-21=2000-021=2000-W03-5"-  ,"51565=2000-01-22=2000-022=2000-W03-6"-  ,"51566=2000-01-23=2000-023=2000-W03-7"-  ,"51567=2000-01-24=2000-024=2000-W04-1"-  ,"51568=2000-01-25=2000-025=2000-W04-2"-  ,"51569=2000-01-26=2000-026=2000-W04-3"-  ,"51570=2000-01-27=2000-027=2000-W04-4"-  ,"51571=2000-01-28=2000-028=2000-W04-5"-  ,"51572=2000-01-29=2000-029=2000-W04-6"-  ,"51573=2000-01-30=2000-030=2000-W04-7"-  ,"51574=2000-01-31=2000-031=2000-W05-1"-  ,"51575=2000-02-01=2000-032=2000-W05-2"-  ,"51576=2000-02-02=2000-033=2000-W05-3"-  ,"51577=2000-02-03=2000-034=2000-W05-4"-  ,"51578=2000-02-04=2000-035=2000-W05-5"-  ,"51579=2000-02-05=2000-036=2000-W05-6"-  ,"51580=2000-02-06=2000-037=2000-W05-7"-  ,"51581=2000-02-07=2000-038=2000-W06-1"-  ,"51582=2000-02-08=2000-039=2000-W06-2"-  ,"51583=2000-02-09=2000-040=2000-W06-3"-  ,"51584=2000-02-10=2000-041=2000-W06-4"-  ,"51585=2000-02-11=2000-042=2000-W06-5"-  ,"51586=2000-02-12=2000-043=2000-W06-6"-  ,"51587=2000-02-13=2000-044=2000-W06-7"-  ,"51588=2000-02-14=2000-045=2000-W07-1"-  ,"51589=2000-02-15=2000-046=2000-W07-2"-  ,"51590=2000-02-16=2000-047=2000-W07-3"-  ,"51591=2000-02-17=2000-048=2000-W07-4"-  ,"51592=2000-02-18=2000-049=2000-W07-5"-  ,"51593=2000-02-19=2000-050=2000-W07-6"-  ,"51594=2000-02-20=2000-051=2000-W07-7"-  ,"51595=2000-02-21=2000-052=2000-W08-1"-  ,"51596=2000-02-22=2000-053=2000-W08-2"-  ,"51597=2000-02-23=2000-054=2000-W08-3"-  ,"51598=2000-02-24=2000-055=2000-W08-4"-  ,"51599=2000-02-25=2000-056=2000-W08-5"-  ,"51600=2000-02-26=2000-057=2000-W08-6"-  ,"51601=2000-02-27=2000-058=2000-W08-7"-  ,"51602=2000-02-28=2000-059=2000-W09-1"-  ,"51603=2000-02-29=2000-060=2000-W09-2"-  ,"51604=2000-03-01=2000-061=2000-W09-3"-  ,"51605=2000-03-02=2000-062=2000-W09-4"-  ,"51606=2000-03-03=2000-063=2000-W09-5"-  ,"51607=2000-03-04=2000-064=2000-W09-6"-  ,"51608=2000-03-05=2000-065=2000-W09-7"-  ,"51609=2000-03-06=2000-066=2000-W10-1"-  ,"51610=2000-03-07=2000-067=2000-W10-2"-  ,"51611=2000-03-08=2000-068=2000-W10-3"-  ,"51612=2000-03-09=2000-069=2000-W10-4"-  ,"51613=2000-03-10=2000-070=2000-W10-5"-  ,"51614=2000-03-11=2000-071=2000-W10-6"-  ,"51615=2000-03-12=2000-072=2000-W10-7"-  ,"51616=2000-03-13=2000-073=2000-W11-1"-  ,"51617=2000-03-14=2000-074=2000-W11-2"-  ,"51618=2000-03-15=2000-075=2000-W11-3"-  ,"51619=2000-03-16=2000-076=2000-W11-4"-  ,"51620=2000-03-17=2000-077=2000-W11-5"-  ,"51621=2000-03-18=2000-078=2000-W11-6"-  ,"51622=2000-03-19=2000-079=2000-W11-7"-  ,"51623=2000-03-20=2000-080=2000-W12-1"-  ,"51624=2000-03-21=2000-081=2000-W12-2"-  ,"51625=2000-03-22=2000-082=2000-W12-3"-  ,"51626=2000-03-23=2000-083=2000-W12-4"-  ,"51627=2000-03-24=2000-084=2000-W12-5"-  ,"51628=2000-03-25=2000-085=2000-W12-6"-  ,"51629=2000-03-26=2000-086=2000-W12-7"-  ,"51630=2000-03-27=2000-087=2000-W13-1"-  ,"51631=2000-03-28=2000-088=2000-W13-2"-  ,"51632=2000-03-29=2000-089=2000-W13-3"-  ,"51633=2000-03-30=2000-090=2000-W13-4"-  ,"51634=2000-03-31=2000-091=2000-W13-5"-  ,"51635=2000-04-01=2000-092=2000-W13-6"-  ,"51636=2000-04-02=2000-093=2000-W13-7"-  ,"51637=2000-04-03=2000-094=2000-W14-1"-  ,"51638=2000-04-04=2000-095=2000-W14-2"-  ,"51639=2000-04-05=2000-096=2000-W14-3"-  ,"51640=2000-04-06=2000-097=2000-W14-4"-  ,"51641=2000-04-07=2000-098=2000-W14-5"-  ,"51642=2000-04-08=2000-099=2000-W14-6"-  ,"51643=2000-04-09=2000-100=2000-W14-7"-  ,"51644=2000-04-10=2000-101=2000-W15-1"-  ,"51645=2000-04-11=2000-102=2000-W15-2"-  ,"51646=2000-04-12=2000-103=2000-W15-3"-  ,"51647=2000-04-13=2000-104=2000-W15-4"-  ,"51648=2000-04-14=2000-105=2000-W15-5"-  ,"51649=2000-04-15=2000-106=2000-W15-6"-  ,"51650=2000-04-16=2000-107=2000-W15-7"-  ,"51651=2000-04-17=2000-108=2000-W16-1"-  ,"51652=2000-04-18=2000-109=2000-W16-2"-  ,"51653=2000-04-19=2000-110=2000-W16-3"-  ,"51654=2000-04-20=2000-111=2000-W16-4"-  ,"51655=2000-04-21=2000-112=2000-W16-5"-  ,"51656=2000-04-22=2000-113=2000-W16-6"-  ,"51657=2000-04-23=2000-114=2000-W16-7"-  ,"51658=2000-04-24=2000-115=2000-W17-1"-  ,"51659=2000-04-25=2000-116=2000-W17-2"-  ,"51660=2000-04-26=2000-117=2000-W17-3"-  ,"51661=2000-04-27=2000-118=2000-W17-4"-  ,"51662=2000-04-28=2000-119=2000-W17-5"-  ,"51663=2000-04-29=2000-120=2000-W17-6"-  ,"51664=2000-04-30=2000-121=2000-W17-7"-  ,"51665=2000-05-01=2000-122=2000-W18-1"-  ,"51666=2000-05-02=2000-123=2000-W18-2"-  ,"51667=2000-05-03=2000-124=2000-W18-3"-  ,"51668=2000-05-04=2000-125=2000-W18-4"-  ,"51669=2000-05-05=2000-126=2000-W18-5"-  ,"51670=2000-05-06=2000-127=2000-W18-6"-  ,"51671=2000-05-07=2000-128=2000-W18-7"-  ,"51672=2000-05-08=2000-129=2000-W19-1"-  ,"51673=2000-05-09=2000-130=2000-W19-2"-  ,"51674=2000-05-10=2000-131=2000-W19-3"-  ,"51675=2000-05-11=2000-132=2000-W19-4"-  ,"51676=2000-05-12=2000-133=2000-W19-5"-  ,"51677=2000-05-13=2000-134=2000-W19-6"-  ,"51678=2000-05-14=2000-135=2000-W19-7"-  ,"51679=2000-05-15=2000-136=2000-W20-1"-  ,"51680=2000-05-16=2000-137=2000-W20-2"-  ,"51681=2000-05-17=2000-138=2000-W20-3"-  ,"51682=2000-05-18=2000-139=2000-W20-4"-  ,"51683=2000-05-19=2000-140=2000-W20-5"-  ,"51684=2000-05-20=2000-141=2000-W20-6"-  ,"51685=2000-05-21=2000-142=2000-W20-7"-  ,"51686=2000-05-22=2000-143=2000-W21-1"-  ,"51687=2000-05-23=2000-144=2000-W21-2"-  ,"51688=2000-05-24=2000-145=2000-W21-3"-  ,"51689=2000-05-25=2000-146=2000-W21-4"-  ,"51690=2000-05-26=2000-147=2000-W21-5"-  ,"51691=2000-05-27=2000-148=2000-W21-6"-  ,"51692=2000-05-28=2000-149=2000-W21-7"-  ,"51693=2000-05-29=2000-150=2000-W22-1"-  ,"51694=2000-05-30=2000-151=2000-W22-2"-  ,"51695=2000-05-31=2000-152=2000-W22-3"-  ,"51696=2000-06-01=2000-153=2000-W22-4"-  ,"51697=2000-06-02=2000-154=2000-W22-5"-  ,"51698=2000-06-03=2000-155=2000-W22-6"-  ,"51699=2000-06-04=2000-156=2000-W22-7"-  ,"51700=2000-06-05=2000-157=2000-W23-1"-  ,"51701=2000-06-06=2000-158=2000-W23-2"-  ,"51702=2000-06-07=2000-159=2000-W23-3"-  ,"51703=2000-06-08=2000-160=2000-W23-4"-  ,"51704=2000-06-09=2000-161=2000-W23-5"-  ,"51705=2000-06-10=2000-162=2000-W23-6"-  ,"51706=2000-06-11=2000-163=2000-W23-7"-  ,"51707=2000-06-12=2000-164=2000-W24-1"-  ,"51708=2000-06-13=2000-165=2000-W24-2"-  ,"51709=2000-06-14=2000-166=2000-W24-3"-  ,"51710=2000-06-15=2000-167=2000-W24-4"-  ,"51711=2000-06-16=2000-168=2000-W24-5"-  ,"51712=2000-06-17=2000-169=2000-W24-6"-  ,"51713=2000-06-18=2000-170=2000-W24-7"-  ,"51714=2000-06-19=2000-171=2000-W25-1"-  ,"51715=2000-06-20=2000-172=2000-W25-2"-  ,"51716=2000-06-21=2000-173=2000-W25-3"-  ,"51717=2000-06-22=2000-174=2000-W25-4"-  ,"51718=2000-06-23=2000-175=2000-W25-5"-  ,"51719=2000-06-24=2000-176=2000-W25-6"-  ,"51720=2000-06-25=2000-177=2000-W25-7"-  ,"51721=2000-06-26=2000-178=2000-W26-1"-  ,"51722=2000-06-27=2000-179=2000-W26-2"-  ,"51723=2000-06-28=2000-180=2000-W26-3"-  ,"51724=2000-06-29=2000-181=2000-W26-4"-  ,"51725=2000-06-30=2000-182=2000-W26-5"-  ,"51726=2000-07-01=2000-183=2000-W26-6"-  ,"51727=2000-07-02=2000-184=2000-W26-7"-  ,"51728=2000-07-03=2000-185=2000-W27-1"-  ,"51729=2000-07-04=2000-186=2000-W27-2"-  ,"51730=2000-07-05=2000-187=2000-W27-3"-  ,"51731=2000-07-06=2000-188=2000-W27-4"-  ,"51732=2000-07-07=2000-189=2000-W27-5"-  ,"51733=2000-07-08=2000-190=2000-W27-6"-  ,"51734=2000-07-09=2000-191=2000-W27-7"-  ,"51735=2000-07-10=2000-192=2000-W28-1"-  ,"51736=2000-07-11=2000-193=2000-W28-2"-  ,"51737=2000-07-12=2000-194=2000-W28-3"-  ,"51738=2000-07-13=2000-195=2000-W28-4"-  ,"51739=2000-07-14=2000-196=2000-W28-5"-  ,"51740=2000-07-15=2000-197=2000-W28-6"-  ,"51741=2000-07-16=2000-198=2000-W28-7"-  ,"51742=2000-07-17=2000-199=2000-W29-1"-  ,"51743=2000-07-18=2000-200=2000-W29-2"-  ,"51744=2000-07-19=2000-201=2000-W29-3"-  ,"51745=2000-07-20=2000-202=2000-W29-4"-  ,"51746=2000-07-21=2000-203=2000-W29-5"-  ,"51747=2000-07-22=2000-204=2000-W29-6"-  ,"51748=2000-07-23=2000-205=2000-W29-7"-  ,"51749=2000-07-24=2000-206=2000-W30-1"-  ,"51750=2000-07-25=2000-207=2000-W30-2"-  ,"51751=2000-07-26=2000-208=2000-W30-3"-  ,"51752=2000-07-27=2000-209=2000-W30-4"-  ,"51753=2000-07-28=2000-210=2000-W30-5"-  ,"51754=2000-07-29=2000-211=2000-W30-6"-  ,"51755=2000-07-30=2000-212=2000-W30-7"-  ,"51756=2000-07-31=2000-213=2000-W31-1"-  ,"51757=2000-08-01=2000-214=2000-W31-2"-  ,"51758=2000-08-02=2000-215=2000-W31-3"-  ,"51759=2000-08-03=2000-216=2000-W31-4"-  ,"51760=2000-08-04=2000-217=2000-W31-5"-  ,"51761=2000-08-05=2000-218=2000-W31-6"-  ,"51762=2000-08-06=2000-219=2000-W31-7"-  ,"51763=2000-08-07=2000-220=2000-W32-1"-  ,"51764=2000-08-08=2000-221=2000-W32-2"-  ,"51765=2000-08-09=2000-222=2000-W32-3"-  ,"51766=2000-08-10=2000-223=2000-W32-4"-  ,"51767=2000-08-11=2000-224=2000-W32-5"-  ,"51768=2000-08-12=2000-225=2000-W32-6"-  ,"51769=2000-08-13=2000-226=2000-W32-7"-  ,"51770=2000-08-14=2000-227=2000-W33-1"-  ,"51771=2000-08-15=2000-228=2000-W33-2"-  ,"51772=2000-08-16=2000-229=2000-W33-3"-  ,"51773=2000-08-17=2000-230=2000-W33-4"-  ,"51774=2000-08-18=2000-231=2000-W33-5"-  ,"51775=2000-08-19=2000-232=2000-W33-6"-  ,"51776=2000-08-20=2000-233=2000-W33-7"-  ,"51777=2000-08-21=2000-234=2000-W34-1"-  ,"51778=2000-08-22=2000-235=2000-W34-2"-  ,"51779=2000-08-23=2000-236=2000-W34-3"-  ,"51780=2000-08-24=2000-237=2000-W34-4"-  ,"51781=2000-08-25=2000-238=2000-W34-5"-  ,"51782=2000-08-26=2000-239=2000-W34-6"-  ,"51783=2000-08-27=2000-240=2000-W34-7"-  ,"51784=2000-08-28=2000-241=2000-W35-1"-  ,"51785=2000-08-29=2000-242=2000-W35-2"-  ,"51786=2000-08-30=2000-243=2000-W35-3"-  ,"51787=2000-08-31=2000-244=2000-W35-4"-  ,"51788=2000-09-01=2000-245=2000-W35-5"-  ,"51789=2000-09-02=2000-246=2000-W35-6"-  ,"51790=2000-09-03=2000-247=2000-W35-7"-  ,"51791=2000-09-04=2000-248=2000-W36-1"-  ,"51792=2000-09-05=2000-249=2000-W36-2"-  ,"51793=2000-09-06=2000-250=2000-W36-3"-  ,"51794=2000-09-07=2000-251=2000-W36-4"-  ,"51795=2000-09-08=2000-252=2000-W36-5"-  ,"51796=2000-09-09=2000-253=2000-W36-6"-  ,"51797=2000-09-10=2000-254=2000-W36-7"-  ,"51798=2000-09-11=2000-255=2000-W37-1"-  ,"51799=2000-09-12=2000-256=2000-W37-2"-  ,"51800=2000-09-13=2000-257=2000-W37-3"-  ,"51801=2000-09-14=2000-258=2000-W37-4"-  ,"51802=2000-09-15=2000-259=2000-W37-5"-  ,"51803=2000-09-16=2000-260=2000-W37-6"-  ,"51804=2000-09-17=2000-261=2000-W37-7"-  ,"51805=2000-09-18=2000-262=2000-W38-1"-  ,"51806=2000-09-19=2000-263=2000-W38-2"-  ,"51807=2000-09-20=2000-264=2000-W38-3"-  ,"51808=2000-09-21=2000-265=2000-W38-4"-  ,"51809=2000-09-22=2000-266=2000-W38-5"-  ,"51810=2000-09-23=2000-267=2000-W38-6"-  ,"51811=2000-09-24=2000-268=2000-W38-7"-  ,"51812=2000-09-25=2000-269=2000-W39-1"-  ,"51813=2000-09-26=2000-270=2000-W39-2"-  ,"51814=2000-09-27=2000-271=2000-W39-3"-  ,"51815=2000-09-28=2000-272=2000-W39-4"-  ,"51816=2000-09-29=2000-273=2000-W39-5"-  ,"51817=2000-09-30=2000-274=2000-W39-6"-  ,"51818=2000-10-01=2000-275=2000-W39-7"-  ,"51819=2000-10-02=2000-276=2000-W40-1"-  ,"51820=2000-10-03=2000-277=2000-W40-2"-  ,"51821=2000-10-04=2000-278=2000-W40-3"-  ,"51822=2000-10-05=2000-279=2000-W40-4"-  ,"51823=2000-10-06=2000-280=2000-W40-5"-  ,"51824=2000-10-07=2000-281=2000-W40-6"-  ,"51825=2000-10-08=2000-282=2000-W40-7"-  ,"51826=2000-10-09=2000-283=2000-W41-1"-  ,"51827=2000-10-10=2000-284=2000-W41-2"-  ,"51828=2000-10-11=2000-285=2000-W41-3"-  ,"51829=2000-10-12=2000-286=2000-W41-4"-  ,"51830=2000-10-13=2000-287=2000-W41-5"-  ,"51831=2000-10-14=2000-288=2000-W41-6"-  ,"51832=2000-10-15=2000-289=2000-W41-7"-  ,"51833=2000-10-16=2000-290=2000-W42-1"-  ,"51834=2000-10-17=2000-291=2000-W42-2"-  ,"51835=2000-10-18=2000-292=2000-W42-3"-  ,"51836=2000-10-19=2000-293=2000-W42-4"-  ,"51837=2000-10-20=2000-294=2000-W42-5"-  ,"51838=2000-10-21=2000-295=2000-W42-6"-  ,"51839=2000-10-22=2000-296=2000-W42-7"-  ,"51840=2000-10-23=2000-297=2000-W43-1"-  ,"51841=2000-10-24=2000-298=2000-W43-2"-  ,"51842=2000-10-25=2000-299=2000-W43-3"-  ,"51843=2000-10-26=2000-300=2000-W43-4"-  ,"51844=2000-10-27=2000-301=2000-W43-5"-  ,"51845=2000-10-28=2000-302=2000-W43-6"-  ,"51846=2000-10-29=2000-303=2000-W43-7"-  ,"51847=2000-10-30=2000-304=2000-W44-1"-  ,"51848=2000-10-31=2000-305=2000-W44-2"-  ,"51849=2000-11-01=2000-306=2000-W44-3"-  ,"51850=2000-11-02=2000-307=2000-W44-4"-  ,"51851=2000-11-03=2000-308=2000-W44-5"-  ,"51852=2000-11-04=2000-309=2000-W44-6"-  ,"51853=2000-11-05=2000-310=2000-W44-7"-  ,"51854=2000-11-06=2000-311=2000-W45-1"-  ,"51855=2000-11-07=2000-312=2000-W45-2"-  ,"51856=2000-11-08=2000-313=2000-W45-3"-  ,"51857=2000-11-09=2000-314=2000-W45-4"-  ,"51858=2000-11-10=2000-315=2000-W45-5"-  ,"51859=2000-11-11=2000-316=2000-W45-6"-  ,"51860=2000-11-12=2000-317=2000-W45-7"-  ,"51861=2000-11-13=2000-318=2000-W46-1"-  ,"51862=2000-11-14=2000-319=2000-W46-2"-  ,"51863=2000-11-15=2000-320=2000-W46-3"-  ,"51864=2000-11-16=2000-321=2000-W46-4"-  ,"51865=2000-11-17=2000-322=2000-W46-5"-  ,"51866=2000-11-18=2000-323=2000-W46-6"-  ,"51867=2000-11-19=2000-324=2000-W46-7"-  ,"51868=2000-11-20=2000-325=2000-W47-1"-  ,"51869=2000-11-21=2000-326=2000-W47-2"-  ,"51870=2000-11-22=2000-327=2000-W47-3"-  ,"51871=2000-11-23=2000-328=2000-W47-4"-  ,"51872=2000-11-24=2000-329=2000-W47-5"-  ,"51873=2000-11-25=2000-330=2000-W47-6"-  ,"51874=2000-11-26=2000-331=2000-W47-7"-  ,"51875=2000-11-27=2000-332=2000-W48-1"-  ,"51876=2000-11-28=2000-333=2000-W48-2"-  ,"51877=2000-11-29=2000-334=2000-W48-3"-  ,"51878=2000-11-30=2000-335=2000-W48-4"-  ,"51879=2000-12-01=2000-336=2000-W48-5"-  ,"51880=2000-12-02=2000-337=2000-W48-6"-  ,"51881=2000-12-03=2000-338=2000-W48-7"-  ,"51882=2000-12-04=2000-339=2000-W49-1"-  ,"51883=2000-12-05=2000-340=2000-W49-2"-  ,"51884=2000-12-06=2000-341=2000-W49-3"-  ,"51885=2000-12-07=2000-342=2000-W49-4"-  ,"51886=2000-12-08=2000-343=2000-W49-5"-  ,"51887=2000-12-09=2000-344=2000-W49-6"-  ,"51888=2000-12-10=2000-345=2000-W49-7"-  ,"51889=2000-12-11=2000-346=2000-W50-1"-  ,"51890=2000-12-12=2000-347=2000-W50-2"-  ,"51891=2000-12-13=2000-348=2000-W50-3"-  ,"51892=2000-12-14=2000-349=2000-W50-4"-  ,"51893=2000-12-15=2000-350=2000-W50-5"-  ,"51894=2000-12-16=2000-351=2000-W50-6"-  ,"51895=2000-12-17=2000-352=2000-W50-7"-  ,"51896=2000-12-18=2000-353=2000-W51-1"-  ,"51897=2000-12-19=2000-354=2000-W51-2"-  ,"51898=2000-12-20=2000-355=2000-W51-3"-  ,"51899=2000-12-21=2000-356=2000-W51-4"-  ,"51900=2000-12-22=2000-357=2000-W51-5"-  ,"51901=2000-12-23=2000-358=2000-W51-6"-  ,"51902=2000-12-24=2000-359=2000-W51-7"-  ,"51903=2000-12-25=2000-360=2000-W52-1"-  ,"51904=2000-12-26=2000-361=2000-W52-2"-  ,"51905=2000-12-27=2000-362=2000-W52-3"-  ,"51906=2000-12-28=2000-363=2000-W52-4"-  ,"51907=2000-12-29=2000-364=2000-W52-5"-  ,"51908=2000-12-30=2000-365=2000-W52-6"-  ,"51909=2000-12-31=2000-366=2000-W52-7"-  ,"51910=2001-01-01=2001-001=2001-W01-1"-  ,"51911=2001-01-02=2001-002=2001-W01-2"-  ,"51912=2001-01-03=2001-003=2001-W01-3"-  ,"51913=2001-01-04=2001-004=2001-W01-4"-  ,"51914=2001-01-05=2001-005=2001-W01-5"-  ,"51915=2001-01-06=2001-006=2001-W01-6"-  ,"51916=2001-01-07=2001-007=2001-W01-7"-  ,"51917=2001-01-08=2001-008=2001-W02-1"-  ,"51918=2001-01-09=2001-009=2001-W02-2"-  ,"51919=2001-01-10=2001-010=2001-W02-3"-  ,"51920=2001-01-11=2001-011=2001-W02-4"-  ,"51921=2001-01-12=2001-012=2001-W02-5"-  ,"51922=2001-01-13=2001-013=2001-W02-6"-  ,"51923=2001-01-14=2001-014=2001-W02-7"-  ,"51924=2001-01-15=2001-015=2001-W03-1"-  ,"51925=2001-01-16=2001-016=2001-W03-2"-  ,"51926=2001-01-17=2001-017=2001-W03-3"-  ,"51927=2001-01-18=2001-018=2001-W03-4"-  ,"51928=2001-01-19=2001-019=2001-W03-5"-  ,"51929=2001-01-20=2001-020=2001-W03-6"-  ,"51930=2001-01-21=2001-021=2001-W03-7"-  ,"51931=2001-01-22=2001-022=2001-W04-1"-  ,"51932=2001-01-23=2001-023=2001-W04-2"-  ,"51933=2001-01-24=2001-024=2001-W04-3"-  ,"51934=2001-01-25=2001-025=2001-W04-4"-  ,"51935=2001-01-26=2001-026=2001-W04-5"-  ,"51936=2001-01-27=2001-027=2001-W04-6"-  ,"51937=2001-01-28=2001-028=2001-W04-7"-  ,"51938=2001-01-29=2001-029=2001-W05-1"-  ,"51939=2001-01-30=2001-030=2001-W05-2"-  ,"51940=2001-01-31=2001-031=2001-W05-3"-  ,"51941=2001-02-01=2001-032=2001-W05-4"-  ,"51942=2001-02-02=2001-033=2001-W05-5"-  ,"51943=2001-02-03=2001-034=2001-W05-6"-  ,"51944=2001-02-04=2001-035=2001-W05-7"-  ,"51945=2001-02-05=2001-036=2001-W06-1"-  ,"51946=2001-02-06=2001-037=2001-W06-2"-  ,"51947=2001-02-07=2001-038=2001-W06-3"-  ,"51948=2001-02-08=2001-039=2001-W06-4"-  ,"51949=2001-02-09=2001-040=2001-W06-5"-  ,"51950=2001-02-10=2001-041=2001-W06-6"-  ,"51951=2001-02-11=2001-042=2001-W06-7"-  ,"51952=2001-02-12=2001-043=2001-W07-1"-  ,"51953=2001-02-13=2001-044=2001-W07-2"-  ,"51954=2001-02-14=2001-045=2001-W07-3"-  ,"51955=2001-02-15=2001-046=2001-W07-4"-  ,"51956=2001-02-16=2001-047=2001-W07-5"-  ,"51957=2001-02-17=2001-048=2001-W07-6"-  ,"51958=2001-02-18=2001-049=2001-W07-7"-  ,"51959=2001-02-19=2001-050=2001-W08-1"-  ,"51960=2001-02-20=2001-051=2001-W08-2"-  ,"51961=2001-02-21=2001-052=2001-W08-3"-  ,"51962=2001-02-22=2001-053=2001-W08-4"-  ,"51963=2001-02-23=2001-054=2001-W08-5"-  ,"51964=2001-02-24=2001-055=2001-W08-6"-  ,"51965=2001-02-25=2001-056=2001-W08-7"-  ,"51966=2001-02-26=2001-057=2001-W09-1"-  ,"51967=2001-02-27=2001-058=2001-W09-2"-  ,"51968=2001-02-28=2001-059=2001-W09-3"-  ,"51969=2001-03-01=2001-060=2001-W09-4"-  ,"51970=2001-03-02=2001-061=2001-W09-5"-  ,"51971=2001-03-03=2001-062=2001-W09-6"-  ,"51972=2001-03-04=2001-063=2001-W09-7"-  ,"51973=2001-03-05=2001-064=2001-W10-1"-  ,"51974=2001-03-06=2001-065=2001-W10-2"-  ,"51975=2001-03-07=2001-066=2001-W10-3"-  ,"51976=2001-03-08=2001-067=2001-W10-4"-  ,"51977=2001-03-09=2001-068=2001-W10-5"-  ,"51978=2001-03-10=2001-069=2001-W10-6"-  ,"51979=2001-03-11=2001-070=2001-W10-7"-  ,"51980=2001-03-12=2001-071=2001-W11-1"-  ,"51981=2001-03-13=2001-072=2001-W11-2"-  ,"51982=2001-03-14=2001-073=2001-W11-3"-  ,"51983=2001-03-15=2001-074=2001-W11-4"-  ,"51984=2001-03-16=2001-075=2001-W11-5"-  ,"51985=2001-03-17=2001-076=2001-W11-6"-  ,"51986=2001-03-18=2001-077=2001-W11-7"-  ,"51987=2001-03-19=2001-078=2001-W12-1"-  ,"51988=2001-03-20=2001-079=2001-W12-2"-  ,"51989=2001-03-21=2001-080=2001-W12-3"-  ,"51990=2001-03-22=2001-081=2001-W12-4"-  ,"51991=2001-03-23=2001-082=2001-W12-5"-  ,"51992=2001-03-24=2001-083=2001-W12-6"-  ,"51993=2001-03-25=2001-084=2001-W12-7"-  ,"51994=2001-03-26=2001-085=2001-W13-1"-  ,"51995=2001-03-27=2001-086=2001-W13-2"-  ,"51996=2001-03-28=2001-087=2001-W13-3"-  ,"51997=2001-03-29=2001-088=2001-W13-4"-  ,"51998=2001-03-30=2001-089=2001-W13-5"-  ,"51999=2001-03-31=2001-090=2001-W13-6"-  ,"52000=2001-04-01=2001-091=2001-W13-7"-  ,"52001=2001-04-02=2001-092=2001-W14-1"-  ,"52002=2001-04-03=2001-093=2001-W14-2"-  ,"52003=2001-04-04=2001-094=2001-W14-3"-  ,"52004=2001-04-05=2001-095=2001-W14-4"-  ,"52005=2001-04-06=2001-096=2001-W14-5"-  ,"52006=2001-04-07=2001-097=2001-W14-6"-  ,"52007=2001-04-08=2001-098=2001-W14-7"-  ,"52008=2001-04-09=2001-099=2001-W15-1"-  ,"52009=2001-04-10=2001-100=2001-W15-2"-  ,"52010=2001-04-11=2001-101=2001-W15-3"-  ,"52011=2001-04-12=2001-102=2001-W15-4"-  ,"52012=2001-04-13=2001-103=2001-W15-5"-  ,"52013=2001-04-14=2001-104=2001-W15-6"-  ,"52014=2001-04-15=2001-105=2001-W15-7"-  ,"52015=2001-04-16=2001-106=2001-W16-1"-  ,"52016=2001-04-17=2001-107=2001-W16-2"-  ,"52017=2001-04-18=2001-108=2001-W16-3"-  ,"52018=2001-04-19=2001-109=2001-W16-4"-  ,"52019=2001-04-20=2001-110=2001-W16-5"-  ,"52020=2001-04-21=2001-111=2001-W16-6"-  ,"52021=2001-04-22=2001-112=2001-W16-7"-  ,"52022=2001-04-23=2001-113=2001-W17-1"-  ,"52023=2001-04-24=2001-114=2001-W17-2"-  ,"52024=2001-04-25=2001-115=2001-W17-3"-  ,"52025=2001-04-26=2001-116=2001-W17-4"-  ,"52026=2001-04-27=2001-117=2001-W17-5"-  ,"52027=2001-04-28=2001-118=2001-W17-6"-  ,"52028=2001-04-29=2001-119=2001-W17-7"-  ,"52029=2001-04-30=2001-120=2001-W18-1"-  ,"52030=2001-05-01=2001-121=2001-W18-2"-  ,"52031=2001-05-02=2001-122=2001-W18-3"-  ,"52032=2001-05-03=2001-123=2001-W18-4"-  ,"52033=2001-05-04=2001-124=2001-W18-5"-  ,"52034=2001-05-05=2001-125=2001-W18-6"-  ,"52035=2001-05-06=2001-126=2001-W18-7"-  ,"52036=2001-05-07=2001-127=2001-W19-1"-  ,"52037=2001-05-08=2001-128=2001-W19-2"-  ,"52038=2001-05-09=2001-129=2001-W19-3"-  ,"52039=2001-05-10=2001-130=2001-W19-4"-  ,"52040=2001-05-11=2001-131=2001-W19-5"-  ,"52041=2001-05-12=2001-132=2001-W19-6"-  ,"52042=2001-05-13=2001-133=2001-W19-7"-  ,"52043=2001-05-14=2001-134=2001-W20-1"-  ,"52044=2001-05-15=2001-135=2001-W20-2"-  ,"52045=2001-05-16=2001-136=2001-W20-3"-  ,"52046=2001-05-17=2001-137=2001-W20-4"-  ,"52047=2001-05-18=2001-138=2001-W20-5"-  ,"52048=2001-05-19=2001-139=2001-W20-6"-  ,"52049=2001-05-20=2001-140=2001-W20-7"-  ,"52050=2001-05-21=2001-141=2001-W21-1"-  ,"52051=2001-05-22=2001-142=2001-W21-2"-  ,"52052=2001-05-23=2001-143=2001-W21-3"-  ,"52053=2001-05-24=2001-144=2001-W21-4"-  ,"52054=2001-05-25=2001-145=2001-W21-5"-  ,"52055=2001-05-26=2001-146=2001-W21-6"-  ,"52056=2001-05-27=2001-147=2001-W21-7"-  ,"52057=2001-05-28=2001-148=2001-W22-1"-  ,"52058=2001-05-29=2001-149=2001-W22-2"-  ,"52059=2001-05-30=2001-150=2001-W22-3"-  ,"52060=2001-05-31=2001-151=2001-W22-4"-  ,"52061=2001-06-01=2001-152=2001-W22-5"-  ,"52062=2001-06-02=2001-153=2001-W22-6"-  ,"52063=2001-06-03=2001-154=2001-W22-7"-  ,"52064=2001-06-04=2001-155=2001-W23-1"-  ,"52065=2001-06-05=2001-156=2001-W23-2"-  ,"52066=2001-06-06=2001-157=2001-W23-3"-  ,"52067=2001-06-07=2001-158=2001-W23-4"-  ,"52068=2001-06-08=2001-159=2001-W23-5"-  ,"52069=2001-06-09=2001-160=2001-W23-6"-  ,"52070=2001-06-10=2001-161=2001-W23-7"-  ,"52071=2001-06-11=2001-162=2001-W24-1"-  ,"52072=2001-06-12=2001-163=2001-W24-2"-  ,"52073=2001-06-13=2001-164=2001-W24-3"-  ,"52074=2001-06-14=2001-165=2001-W24-4"-  ,"52075=2001-06-15=2001-166=2001-W24-5"-  ,"52076=2001-06-16=2001-167=2001-W24-6"-  ,"52077=2001-06-17=2001-168=2001-W24-7"-  ,"52078=2001-06-18=2001-169=2001-W25-1"-  ,"52079=2001-06-19=2001-170=2001-W25-2"-  ,"52080=2001-06-20=2001-171=2001-W25-3"-  ,"52081=2001-06-21=2001-172=2001-W25-4"-  ,"52082=2001-06-22=2001-173=2001-W25-5"-  ,"52083=2001-06-23=2001-174=2001-W25-6"-  ,"52084=2001-06-24=2001-175=2001-W25-7"-  ,"52085=2001-06-25=2001-176=2001-W26-1"-  ,"52086=2001-06-26=2001-177=2001-W26-2"-  ,"52087=2001-06-27=2001-178=2001-W26-3"-  ,"52088=2001-06-28=2001-179=2001-W26-4"-  ,"52089=2001-06-29=2001-180=2001-W26-5"-  ,"52090=2001-06-30=2001-181=2001-W26-6"-  ,"52091=2001-07-01=2001-182=2001-W26-7"-  ,"52092=2001-07-02=2001-183=2001-W27-1"-  ,"52093=2001-07-03=2001-184=2001-W27-2"-  ,"52094=2001-07-04=2001-185=2001-W27-3"-  ,"52095=2001-07-05=2001-186=2001-W27-4"-  ,"52096=2001-07-06=2001-187=2001-W27-5"-  ,"52097=2001-07-07=2001-188=2001-W27-6"-  ,"52098=2001-07-08=2001-189=2001-W27-7"-  ,"52099=2001-07-09=2001-190=2001-W28-1"-  ,"52100=2001-07-10=2001-191=2001-W28-2"-  ,"52101=2001-07-11=2001-192=2001-W28-3"-  ,"52102=2001-07-12=2001-193=2001-W28-4"-  ,"52103=2001-07-13=2001-194=2001-W28-5"-  ,"52104=2001-07-14=2001-195=2001-W28-6"-  ,"52105=2001-07-15=2001-196=2001-W28-7"-  ,"52106=2001-07-16=2001-197=2001-W29-1"-  ,"52107=2001-07-17=2001-198=2001-W29-2"-  ,"52108=2001-07-18=2001-199=2001-W29-3"-  ,"52109=2001-07-19=2001-200=2001-W29-4"-  ,"52110=2001-07-20=2001-201=2001-W29-5"-  ,"52111=2001-07-21=2001-202=2001-W29-6"-  ,"52112=2001-07-22=2001-203=2001-W29-7"-  ,"52113=2001-07-23=2001-204=2001-W30-1"-  ,"52114=2001-07-24=2001-205=2001-W30-2"-  ,"52115=2001-07-25=2001-206=2001-W30-3"-  ,"52116=2001-07-26=2001-207=2001-W30-4"-  ,"52117=2001-07-27=2001-208=2001-W30-5"-  ,"52118=2001-07-28=2001-209=2001-W30-6"-  ,"52119=2001-07-29=2001-210=2001-W30-7"-  ,"52120=2001-07-30=2001-211=2001-W31-1"-  ,"52121=2001-07-31=2001-212=2001-W31-2"-  ,"52122=2001-08-01=2001-213=2001-W31-3"-  ,"52123=2001-08-02=2001-214=2001-W31-4"-  ,"52124=2001-08-03=2001-215=2001-W31-5"-  ,"52125=2001-08-04=2001-216=2001-W31-6"-  ,"52126=2001-08-05=2001-217=2001-W31-7"-  ,"52127=2001-08-06=2001-218=2001-W32-1"-  ,"52128=2001-08-07=2001-219=2001-W32-2"-  ,"52129=2001-08-08=2001-220=2001-W32-3"-  ,"52130=2001-08-09=2001-221=2001-W32-4"-  ,"52131=2001-08-10=2001-222=2001-W32-5"-  ,"52132=2001-08-11=2001-223=2001-W32-6"-  ,"52133=2001-08-12=2001-224=2001-W32-7"-  ,"52134=2001-08-13=2001-225=2001-W33-1"-  ,"52135=2001-08-14=2001-226=2001-W33-2"-  ,"52136=2001-08-15=2001-227=2001-W33-3"-  ,"52137=2001-08-16=2001-228=2001-W33-4"-  ,"52138=2001-08-17=2001-229=2001-W33-5"-  ,"52139=2001-08-18=2001-230=2001-W33-6"-  ,"52140=2001-08-19=2001-231=2001-W33-7"-  ,"52141=2001-08-20=2001-232=2001-W34-1"-  ,"52142=2001-08-21=2001-233=2001-W34-2"-  ,"52143=2001-08-22=2001-234=2001-W34-3"-  ,"52144=2001-08-23=2001-235=2001-W34-4"-  ,"52145=2001-08-24=2001-236=2001-W34-5"-  ,"52146=2001-08-25=2001-237=2001-W34-6"-  ,"52147=2001-08-26=2001-238=2001-W34-7"-  ,"52148=2001-08-27=2001-239=2001-W35-1"-  ,"52149=2001-08-28=2001-240=2001-W35-2"-  ,"52150=2001-08-29=2001-241=2001-W35-3"-  ,"52151=2001-08-30=2001-242=2001-W35-4"-  ,"52152=2001-08-31=2001-243=2001-W35-5"-  ,"52153=2001-09-01=2001-244=2001-W35-6"-  ,"52154=2001-09-02=2001-245=2001-W35-7"-  ,"52155=2001-09-03=2001-246=2001-W36-1"-  ,"52156=2001-09-04=2001-247=2001-W36-2"-  ,"52157=2001-09-05=2001-248=2001-W36-3"-  ,"52158=2001-09-06=2001-249=2001-W36-4"-  ,"52159=2001-09-07=2001-250=2001-W36-5"-  ,"52160=2001-09-08=2001-251=2001-W36-6"-  ,"52161=2001-09-09=2001-252=2001-W36-7"-  ,"52162=2001-09-10=2001-253=2001-W37-1"-  ,"52163=2001-09-11=2001-254=2001-W37-2"-  ,"52164=2001-09-12=2001-255=2001-W37-3"-  ,"52165=2001-09-13=2001-256=2001-W37-4"-  ,"52166=2001-09-14=2001-257=2001-W37-5"-  ,"52167=2001-09-15=2001-258=2001-W37-6"-  ,"52168=2001-09-16=2001-259=2001-W37-7"-  ,"52169=2001-09-17=2001-260=2001-W38-1"-  ,"52170=2001-09-18=2001-261=2001-W38-2"-  ,"52171=2001-09-19=2001-262=2001-W38-3"-  ,"52172=2001-09-20=2001-263=2001-W38-4"-  ,"52173=2001-09-21=2001-264=2001-W38-5"-  ,"52174=2001-09-22=2001-265=2001-W38-6"-  ,"52175=2001-09-23=2001-266=2001-W38-7"-  ,"52176=2001-09-24=2001-267=2001-W39-1"-  ,"52177=2001-09-25=2001-268=2001-W39-2"-  ,"52178=2001-09-26=2001-269=2001-W39-3"-  ,"52179=2001-09-27=2001-270=2001-W39-4"-  ,"52180=2001-09-28=2001-271=2001-W39-5"-  ,"52181=2001-09-29=2001-272=2001-W39-6"-  ,"52182=2001-09-30=2001-273=2001-W39-7"-  ,"52183=2001-10-01=2001-274=2001-W40-1"-  ,"52184=2001-10-02=2001-275=2001-W40-2"-  ,"52185=2001-10-03=2001-276=2001-W40-3"-  ,"52186=2001-10-04=2001-277=2001-W40-4"-  ,"52187=2001-10-05=2001-278=2001-W40-5"-  ,"52188=2001-10-06=2001-279=2001-W40-6"-  ,"52189=2001-10-07=2001-280=2001-W40-7"-  ,"52190=2001-10-08=2001-281=2001-W41-1"-  ,"52191=2001-10-09=2001-282=2001-W41-2"-  ,"52192=2001-10-10=2001-283=2001-W41-3"-  ,"52193=2001-10-11=2001-284=2001-W41-4"-  ,"52194=2001-10-12=2001-285=2001-W41-5"-  ,"52195=2001-10-13=2001-286=2001-W41-6"-  ,"52196=2001-10-14=2001-287=2001-W41-7"-  ,"52197=2001-10-15=2001-288=2001-W42-1"-  ,"52198=2001-10-16=2001-289=2001-W42-2"-  ,"52199=2001-10-17=2001-290=2001-W42-3"-  ,"52200=2001-10-18=2001-291=2001-W42-4"-  ,"52201=2001-10-19=2001-292=2001-W42-5"-  ,"52202=2001-10-20=2001-293=2001-W42-6"-  ,"52203=2001-10-21=2001-294=2001-W42-7"-  ,"52204=2001-10-22=2001-295=2001-W43-1"-  ,"52205=2001-10-23=2001-296=2001-W43-2"-  ,"52206=2001-10-24=2001-297=2001-W43-3"-  ,"52207=2001-10-25=2001-298=2001-W43-4"-  ,"52208=2001-10-26=2001-299=2001-W43-5"-  ,"52209=2001-10-27=2001-300=2001-W43-6"-  ,"52210=2001-10-28=2001-301=2001-W43-7"-  ,"52211=2001-10-29=2001-302=2001-W44-1"-  ,"52212=2001-10-30=2001-303=2001-W44-2"-  ,"52213=2001-10-31=2001-304=2001-W44-3"-  ,"52214=2001-11-01=2001-305=2001-W44-4"-  ,"52215=2001-11-02=2001-306=2001-W44-5"-  ,"52216=2001-11-03=2001-307=2001-W44-6"-  ,"52217=2001-11-04=2001-308=2001-W44-7"-  ,"52218=2001-11-05=2001-309=2001-W45-1"-  ,"52219=2001-11-06=2001-310=2001-W45-2"-  ,"52220=2001-11-07=2001-311=2001-W45-3"-  ,"52221=2001-11-08=2001-312=2001-W45-4"-  ,"52222=2001-11-09=2001-313=2001-W45-5"-  ,"52223=2001-11-10=2001-314=2001-W45-6"-  ,"52224=2001-11-11=2001-315=2001-W45-7"-  ,"52225=2001-11-12=2001-316=2001-W46-1"-  ,"52226=2001-11-13=2001-317=2001-W46-2"-  ,"52227=2001-11-14=2001-318=2001-W46-3"-  ,"52228=2001-11-15=2001-319=2001-W46-4"-  ,"52229=2001-11-16=2001-320=2001-W46-5"-  ,"52230=2001-11-17=2001-321=2001-W46-6"-  ,"52231=2001-11-18=2001-322=2001-W46-7"-  ,"52232=2001-11-19=2001-323=2001-W47-1"-  ,"52233=2001-11-20=2001-324=2001-W47-2"-  ,"52234=2001-11-21=2001-325=2001-W47-3"-  ,"52235=2001-11-22=2001-326=2001-W47-4"-  ,"52236=2001-11-23=2001-327=2001-W47-5"-  ,"52237=2001-11-24=2001-328=2001-W47-6"-  ,"52238=2001-11-25=2001-329=2001-W47-7"-  ,"52239=2001-11-26=2001-330=2001-W48-1"-  ,"52240=2001-11-27=2001-331=2001-W48-2"-  ,"52241=2001-11-28=2001-332=2001-W48-3"-  ,"52242=2001-11-29=2001-333=2001-W48-4"-  ,"52243=2001-11-30=2001-334=2001-W48-5"-  ,"52244=2001-12-01=2001-335=2001-W48-6"-  ,"52245=2001-12-02=2001-336=2001-W48-7"-  ,"52246=2001-12-03=2001-337=2001-W49-1"-  ,"52247=2001-12-04=2001-338=2001-W49-2"-  ,"52248=2001-12-05=2001-339=2001-W49-3"-  ,"52249=2001-12-06=2001-340=2001-W49-4"-  ,"52250=2001-12-07=2001-341=2001-W49-5"-  ,"52251=2001-12-08=2001-342=2001-W49-6"-  ,"52252=2001-12-09=2001-343=2001-W49-7"-  ,"52253=2001-12-10=2001-344=2001-W50-1"-  ,"52254=2001-12-11=2001-345=2001-W50-2"-  ,"52255=2001-12-12=2001-346=2001-W50-3"-  ,"52256=2001-12-13=2001-347=2001-W50-4"-  ,"52257=2001-12-14=2001-348=2001-W50-5"-  ,"52258=2001-12-15=2001-349=2001-W50-6"-  ,"52259=2001-12-16=2001-350=2001-W50-7"-  ,"52260=2001-12-17=2001-351=2001-W51-1"-  ,"52261=2001-12-18=2001-352=2001-W51-2"-  ,"52262=2001-12-19=2001-353=2001-W51-3"-  ,"52263=2001-12-20=2001-354=2001-W51-4"-  ,"52264=2001-12-21=2001-355=2001-W51-5"-  ,"52265=2001-12-22=2001-356=2001-W51-6"-  ,"52266=2001-12-23=2001-357=2001-W51-7"-  ,"52267=2001-12-24=2001-358=2001-W52-1"-  ,"52268=2001-12-25=2001-359=2001-W52-2"-  ,"52269=2001-12-26=2001-360=2001-W52-3"-  ,"52270=2001-12-27=2001-361=2001-W52-4"-  ,"52271=2001-12-28=2001-362=2001-W52-5"-  ,"52272=2001-12-29=2001-363=2001-W52-6"-  ,"52273=2001-12-30=2001-364=2001-W52-7"-  ,"52274=2001-12-31=2001-365=2002-W01-1"-  ,"52275=2002-01-01=2002-001=2002-W01-2"-  ,"52276=2002-01-02=2002-002=2002-W01-3"-  ,"52277=2002-01-03=2002-003=2002-W01-4"-  ,"52278=2002-01-04=2002-004=2002-W01-5"-  ,"52279=2002-01-05=2002-005=2002-W01-6"-  ,"52280=2002-01-06=2002-006=2002-W01-7"-  ,""-  ,"51178=1998-12-31=1998-365=1998-W53-4"-  ,""-  ,"1998-12-31 23:59:60.5"-  ,"51178,86400.5s"-  ,"1998-12-31 15:59:60.5"-  ,"51178,86400.5s"-  ,""-  ,"2000-03-01 00:00:00"-  ,"2000-03-01 12:00:00"-  ,"2000-02-29 16:00:00"-  ,"2000-03-01 04:00:00"-  ,"2000-03-01 08:00:00"-  ,"2000-03-01 20:00:00"-  ,""-  ,"12:34:56.789"-  ,"12:34:56.789123"-  ,"12:34:56.789123456"-  ,"12:34:56.789123456789"-  ,if is64Bit then "-9223372036854775808:00:00" else "-2147483648:00:00"-  ,"" ]+    if toInteger (maxBound :: Int) == toInteger (maxBound :: Int32)+        then False+        else if toInteger (maxBound :: Int) == toInteger (maxBound :: Int64)+                 then True+                 else error "unrecognised Int size"++testTimeRef :: String+testTimeRef =+    unlines+        [ "-678950=-0001-12-23=-0001-357=-0001-W51-4"+        , "-678949=-0001-12-24=-0001-358=-0001-W51-5"+        , "-678948=-0001-12-25=-0001-359=-0001-W51-6"+        , "-678947=-0001-12-26=-0001-360=-0001-W51-7"+        , "-678946=-0001-12-27=-0001-361=-0001-W52-1"+        , "-678945=-0001-12-28=-0001-362=-0001-W52-2"+        , "-678944=-0001-12-29=-0001-363=-0001-W52-3"+        , "-678943=-0001-12-30=-0001-364=-0001-W52-4"+        , "-678942=-0001-12-31=-0001-365=-0001-W52-5"+        , "-678941=0000-01-01=0000-001=-0001-W52-6"+        , "-678940=0000-01-02=0000-002=-0001-W52-7"+        , "-678939=0000-01-03=0000-003=0000-W01-1"+        , "-678938=0000-01-04=0000-004=0000-W01-2"+        , "-678937=0000-01-05=0000-005=0000-W01-3"+        , "-678936=0000-01-06=0000-006=0000-W01-4"+        , "-678935=0000-01-07=0000-007=0000-W01-5"+        , "-678934=0000-01-08=0000-008=0000-W01-6"+        , "-678933=0000-01-09=0000-009=0000-W01-7"+        , "-678932=0000-01-10=0000-010=0000-W02-1"+        , "-678931=0000-01-11=0000-011=0000-W02-2"+        , "-678930=0000-01-12=0000-012=0000-W02-3"+        , "-313710=0999-12-20=0999-354=0999-W51-5"+        , "-313709=0999-12-21=0999-355=0999-W51-6"+        , "-313708=0999-12-22=0999-356=0999-W51-7"+        , "-313707=0999-12-23=0999-357=0999-W52-1"+        , "-313706=0999-12-24=0999-358=0999-W52-2"+        , "-313705=0999-12-25=0999-359=0999-W52-3"+        , "-313704=0999-12-26=0999-360=0999-W52-4"+        , "-313703=0999-12-27=0999-361=0999-W52-5"+        , "-313702=0999-12-28=0999-362=0999-W52-6"+        , "-313701=0999-12-29=0999-363=0999-W52-7"+        , "-313700=0999-12-30=0999-364=1000-W01-1"+        , "-313699=0999-12-31=0999-365=1000-W01-2"+        , "-313698=1000-01-01=1000-001=1000-W01-3"+        , "-313697=1000-01-02=1000-002=1000-W01-4"+        , "-313696=1000-01-03=1000-003=1000-W01-5"+        , "-313695=1000-01-04=1000-004=1000-W01-6"+        , "-313694=1000-01-05=1000-005=1000-W01-7"+        , "-313693=1000-01-06=1000-006=1000-W02-1"+        , "-313692=1000-01-07=1000-007=1000-W02-2"+        , "-313691=1000-01-08=1000-008=1000-W02-3"+        , "-313690=1000-01-09=1000-009=1000-W02-4"+        , "-30=1858-10-18=1858-291=1858-W42-1"+        , "-29=1858-10-19=1858-292=1858-W42-2"+        , "-28=1858-10-20=1858-293=1858-W42-3"+        , "-27=1858-10-21=1858-294=1858-W42-4"+        , "-26=1858-10-22=1858-295=1858-W42-5"+        , "-25=1858-10-23=1858-296=1858-W42-6"+        , "-24=1858-10-24=1858-297=1858-W42-7"+        , "-23=1858-10-25=1858-298=1858-W43-1"+        , "-22=1858-10-26=1858-299=1858-W43-2"+        , "-21=1858-10-27=1858-300=1858-W43-3"+        , "-20=1858-10-28=1858-301=1858-W43-4"+        , "-19=1858-10-29=1858-302=1858-W43-5"+        , "-18=1858-10-30=1858-303=1858-W43-6"+        , "-17=1858-10-31=1858-304=1858-W43-7"+        , "-16=1858-11-01=1858-305=1858-W44-1"+        , "-15=1858-11-02=1858-306=1858-W44-2"+        , "-14=1858-11-03=1858-307=1858-W44-3"+        , "-13=1858-11-04=1858-308=1858-W44-4"+        , "-12=1858-11-05=1858-309=1858-W44-5"+        , "-11=1858-11-06=1858-310=1858-W44-6"+        , "-10=1858-11-07=1858-311=1858-W44-7"+        , "-9=1858-11-08=1858-312=1858-W45-1"+        , "-8=1858-11-09=1858-313=1858-W45-2"+        , "-7=1858-11-10=1858-314=1858-W45-3"+        , "-6=1858-11-11=1858-315=1858-W45-4"+        , "-5=1858-11-12=1858-316=1858-W45-5"+        , "-4=1858-11-13=1858-317=1858-W45-6"+        , "-3=1858-11-14=1858-318=1858-W45-7"+        , "-2=1858-11-15=1858-319=1858-W46-1"+        , "-1=1858-11-16=1858-320=1858-W46-2"+        , "0=1858-11-17=1858-321=1858-W46-3"+        , "1=1858-11-18=1858-322=1858-W46-4"+        , "2=1858-11-19=1858-323=1858-W46-5"+        , "3=1858-11-20=1858-324=1858-W46-6"+        , "4=1858-11-21=1858-325=1858-W46-7"+        , "5=1858-11-22=1858-326=1858-W47-1"+        , "6=1858-11-23=1858-327=1858-W47-2"+        , "7=1858-11-24=1858-328=1858-W47-3"+        , "8=1858-11-25=1858-329=1858-W47-4"+        , "9=1858-11-26=1858-330=1858-W47-5"+        , "10=1858-11-27=1858-331=1858-W47-6"+        , "11=1858-11-28=1858-332=1858-W47-7"+        , "12=1858-11-29=1858-333=1858-W48-1"+        , "13=1858-11-30=1858-334=1858-W48-2"+        , "14=1858-12-01=1858-335=1858-W48-3"+        , "15=1858-12-02=1858-336=1858-W48-4"+        , "16=1858-12-03=1858-337=1858-W48-5"+        , "17=1858-12-04=1858-338=1858-W48-6"+        , "18=1858-12-05=1858-339=1858-W48-7"+        , "19=1858-12-06=1858-340=1858-W49-1"+        , "20=1858-12-07=1858-341=1858-W49-2"+        , "21=1858-12-08=1858-342=1858-W49-3"+        , "22=1858-12-09=1858-343=1858-W49-4"+        , "23=1858-12-10=1858-344=1858-W49-5"+        , "24=1858-12-11=1858-345=1858-W49-6"+        , "25=1858-12-12=1858-346=1858-W49-7"+        , "26=1858-12-13=1858-347=1858-W50-1"+        , "27=1858-12-14=1858-348=1858-W50-2"+        , "28=1858-12-15=1858-349=1858-W50-3"+        , "29=1858-12-16=1858-350=1858-W50-4"+        , "30=1858-12-17=1858-351=1858-W50-5"+        , "40000=1968-05-24=1968-145=1968-W21-5"+        , "50000=1995-10-10=1995-283=1995-W41-2"+        , "15078=1900-02-28=1900-059=1900-W09-3"+        , "15079=1900-03-01=1900-060=1900-W09-4"+        , "44297=1980-02-28=1980-059=1980-W09-4"+        , "44298=1980-02-29=1980-060=1980-W09-5"+        , "44299=1980-03-01=1980-061=1980-W09-6"+        , "47950=1990-02-28=1990-059=1990-W09-3"+        , "47951=1990-03-01=1990-060=1990-W09-4"+        , "51602=2000-02-28=2000-059=2000-W09-1"+        , "51603=2000-02-29=2000-060=2000-W09-2"+        , "51604=2000-03-01=2000-061=2000-W09-3"+        , "51540=1999-12-28=1999-362=1999-W52-2"+        , "51541=1999-12-29=1999-363=1999-W52-3"+        , "51542=1999-12-30=1999-364=1999-W52-4"+        , "51543=1999-12-31=1999-365=1999-W52-5"+        , "51544=2000-01-01=2000-001=1999-W52-6"+        , "51545=2000-01-02=2000-002=1999-W52-7"+        , "51546=2000-01-03=2000-003=2000-W01-1"+        , "51547=2000-01-04=2000-004=2000-W01-2"+        , "51548=2000-01-05=2000-005=2000-W01-3"+        , "51549=2000-01-06=2000-006=2000-W01-4"+        , "51550=2000-01-07=2000-007=2000-W01-5"+        , "51551=2000-01-08=2000-008=2000-W01-6"+        , "51552=2000-01-09=2000-009=2000-W01-7"+        , "51553=2000-01-10=2000-010=2000-W02-1"+        , "51554=2000-01-11=2000-011=2000-W02-2"+        , "51555=2000-01-12=2000-012=2000-W02-3"+        , "51556=2000-01-13=2000-013=2000-W02-4"+        , "51557=2000-01-14=2000-014=2000-W02-5"+        , "51558=2000-01-15=2000-015=2000-W02-6"+        , "51559=2000-01-16=2000-016=2000-W02-7"+        , "51560=2000-01-17=2000-017=2000-W03-1"+        , "51561=2000-01-18=2000-018=2000-W03-2"+        , "51562=2000-01-19=2000-019=2000-W03-3"+        , "51563=2000-01-20=2000-020=2000-W03-4"+        , "51564=2000-01-21=2000-021=2000-W03-5"+        , "51565=2000-01-22=2000-022=2000-W03-6"+        , "51566=2000-01-23=2000-023=2000-W03-7"+        , "51567=2000-01-24=2000-024=2000-W04-1"+        , "51568=2000-01-25=2000-025=2000-W04-2"+        , "51569=2000-01-26=2000-026=2000-W04-3"+        , "51570=2000-01-27=2000-027=2000-W04-4"+        , "51571=2000-01-28=2000-028=2000-W04-5"+        , "51572=2000-01-29=2000-029=2000-W04-6"+        , "51573=2000-01-30=2000-030=2000-W04-7"+        , "51574=2000-01-31=2000-031=2000-W05-1"+        , "51575=2000-02-01=2000-032=2000-W05-2"+        , "51576=2000-02-02=2000-033=2000-W05-3"+        , "51577=2000-02-03=2000-034=2000-W05-4"+        , "51578=2000-02-04=2000-035=2000-W05-5"+        , "51579=2000-02-05=2000-036=2000-W05-6"+        , "51580=2000-02-06=2000-037=2000-W05-7"+        , "51581=2000-02-07=2000-038=2000-W06-1"+        , "51582=2000-02-08=2000-039=2000-W06-2"+        , "51583=2000-02-09=2000-040=2000-W06-3"+        , "51584=2000-02-10=2000-041=2000-W06-4"+        , "51585=2000-02-11=2000-042=2000-W06-5"+        , "51586=2000-02-12=2000-043=2000-W06-6"+        , "51587=2000-02-13=2000-044=2000-W06-7"+        , "51588=2000-02-14=2000-045=2000-W07-1"+        , "51589=2000-02-15=2000-046=2000-W07-2"+        , "51590=2000-02-16=2000-047=2000-W07-3"+        , "51591=2000-02-17=2000-048=2000-W07-4"+        , "51592=2000-02-18=2000-049=2000-W07-5"+        , "51593=2000-02-19=2000-050=2000-W07-6"+        , "51594=2000-02-20=2000-051=2000-W07-7"+        , "51595=2000-02-21=2000-052=2000-W08-1"+        , "51596=2000-02-22=2000-053=2000-W08-2"+        , "51597=2000-02-23=2000-054=2000-W08-3"+        , "51598=2000-02-24=2000-055=2000-W08-4"+        , "51599=2000-02-25=2000-056=2000-W08-5"+        , "51600=2000-02-26=2000-057=2000-W08-6"+        , "51601=2000-02-27=2000-058=2000-W08-7"+        , "51602=2000-02-28=2000-059=2000-W09-1"+        , "51603=2000-02-29=2000-060=2000-W09-2"+        , "51604=2000-03-01=2000-061=2000-W09-3"+        , "51605=2000-03-02=2000-062=2000-W09-4"+        , "51606=2000-03-03=2000-063=2000-W09-5"+        , "51607=2000-03-04=2000-064=2000-W09-6"+        , "51608=2000-03-05=2000-065=2000-W09-7"+        , "51609=2000-03-06=2000-066=2000-W10-1"+        , "51610=2000-03-07=2000-067=2000-W10-2"+        , "51611=2000-03-08=2000-068=2000-W10-3"+        , "51612=2000-03-09=2000-069=2000-W10-4"+        , "51613=2000-03-10=2000-070=2000-W10-5"+        , "51614=2000-03-11=2000-071=2000-W10-6"+        , "51615=2000-03-12=2000-072=2000-W10-7"+        , "51616=2000-03-13=2000-073=2000-W11-1"+        , "51617=2000-03-14=2000-074=2000-W11-2"+        , "51618=2000-03-15=2000-075=2000-W11-3"+        , "51619=2000-03-16=2000-076=2000-W11-4"+        , "51620=2000-03-17=2000-077=2000-W11-5"+        , "51621=2000-03-18=2000-078=2000-W11-6"+        , "51622=2000-03-19=2000-079=2000-W11-7"+        , "51623=2000-03-20=2000-080=2000-W12-1"+        , "51624=2000-03-21=2000-081=2000-W12-2"+        , "51625=2000-03-22=2000-082=2000-W12-3"+        , "51626=2000-03-23=2000-083=2000-W12-4"+        , "51627=2000-03-24=2000-084=2000-W12-5"+        , "51628=2000-03-25=2000-085=2000-W12-6"+        , "51629=2000-03-26=2000-086=2000-W12-7"+        , "51630=2000-03-27=2000-087=2000-W13-1"+        , "51631=2000-03-28=2000-088=2000-W13-2"+        , "51632=2000-03-29=2000-089=2000-W13-3"+        , "51633=2000-03-30=2000-090=2000-W13-4"+        , "51634=2000-03-31=2000-091=2000-W13-5"+        , "51635=2000-04-01=2000-092=2000-W13-6"+        , "51636=2000-04-02=2000-093=2000-W13-7"+        , "51637=2000-04-03=2000-094=2000-W14-1"+        , "51638=2000-04-04=2000-095=2000-W14-2"+        , "51639=2000-04-05=2000-096=2000-W14-3"+        , "51640=2000-04-06=2000-097=2000-W14-4"+        , "51641=2000-04-07=2000-098=2000-W14-5"+        , "51642=2000-04-08=2000-099=2000-W14-6"+        , "51643=2000-04-09=2000-100=2000-W14-7"+        , "51644=2000-04-10=2000-101=2000-W15-1"+        , "51645=2000-04-11=2000-102=2000-W15-2"+        , "51646=2000-04-12=2000-103=2000-W15-3"+        , "51647=2000-04-13=2000-104=2000-W15-4"+        , "51648=2000-04-14=2000-105=2000-W15-5"+        , "51649=2000-04-15=2000-106=2000-W15-6"+        , "51650=2000-04-16=2000-107=2000-W15-7"+        , "51651=2000-04-17=2000-108=2000-W16-1"+        , "51652=2000-04-18=2000-109=2000-W16-2"+        , "51653=2000-04-19=2000-110=2000-W16-3"+        , "51654=2000-04-20=2000-111=2000-W16-4"+        , "51655=2000-04-21=2000-112=2000-W16-5"+        , "51656=2000-04-22=2000-113=2000-W16-6"+        , "51657=2000-04-23=2000-114=2000-W16-7"+        , "51658=2000-04-24=2000-115=2000-W17-1"+        , "51659=2000-04-25=2000-116=2000-W17-2"+        , "51660=2000-04-26=2000-117=2000-W17-3"+        , "51661=2000-04-27=2000-118=2000-W17-4"+        , "51662=2000-04-28=2000-119=2000-W17-5"+        , "51663=2000-04-29=2000-120=2000-W17-6"+        , "51664=2000-04-30=2000-121=2000-W17-7"+        , "51665=2000-05-01=2000-122=2000-W18-1"+        , "51666=2000-05-02=2000-123=2000-W18-2"+        , "51667=2000-05-03=2000-124=2000-W18-3"+        , "51668=2000-05-04=2000-125=2000-W18-4"+        , "51669=2000-05-05=2000-126=2000-W18-5"+        , "51670=2000-05-06=2000-127=2000-W18-6"+        , "51671=2000-05-07=2000-128=2000-W18-7"+        , "51672=2000-05-08=2000-129=2000-W19-1"+        , "51673=2000-05-09=2000-130=2000-W19-2"+        , "51674=2000-05-10=2000-131=2000-W19-3"+        , "51675=2000-05-11=2000-132=2000-W19-4"+        , "51676=2000-05-12=2000-133=2000-W19-5"+        , "51677=2000-05-13=2000-134=2000-W19-6"+        , "51678=2000-05-14=2000-135=2000-W19-7"+        , "51679=2000-05-15=2000-136=2000-W20-1"+        , "51680=2000-05-16=2000-137=2000-W20-2"+        , "51681=2000-05-17=2000-138=2000-W20-3"+        , "51682=2000-05-18=2000-139=2000-W20-4"+        , "51683=2000-05-19=2000-140=2000-W20-5"+        , "51684=2000-05-20=2000-141=2000-W20-6"+        , "51685=2000-05-21=2000-142=2000-W20-7"+        , "51686=2000-05-22=2000-143=2000-W21-1"+        , "51687=2000-05-23=2000-144=2000-W21-2"+        , "51688=2000-05-24=2000-145=2000-W21-3"+        , "51689=2000-05-25=2000-146=2000-W21-4"+        , "51690=2000-05-26=2000-147=2000-W21-5"+        , "51691=2000-05-27=2000-148=2000-W21-6"+        , "51692=2000-05-28=2000-149=2000-W21-7"+        , "51693=2000-05-29=2000-150=2000-W22-1"+        , "51694=2000-05-30=2000-151=2000-W22-2"+        , "51695=2000-05-31=2000-152=2000-W22-3"+        , "51696=2000-06-01=2000-153=2000-W22-4"+        , "51697=2000-06-02=2000-154=2000-W22-5"+        , "51698=2000-06-03=2000-155=2000-W22-6"+        , "51699=2000-06-04=2000-156=2000-W22-7"+        , "51700=2000-06-05=2000-157=2000-W23-1"+        , "51701=2000-06-06=2000-158=2000-W23-2"+        , "51702=2000-06-07=2000-159=2000-W23-3"+        , "51703=2000-06-08=2000-160=2000-W23-4"+        , "51704=2000-06-09=2000-161=2000-W23-5"+        , "51705=2000-06-10=2000-162=2000-W23-6"+        , "51706=2000-06-11=2000-163=2000-W23-7"+        , "51707=2000-06-12=2000-164=2000-W24-1"+        , "51708=2000-06-13=2000-165=2000-W24-2"+        , "51709=2000-06-14=2000-166=2000-W24-3"+        , "51710=2000-06-15=2000-167=2000-W24-4"+        , "51711=2000-06-16=2000-168=2000-W24-5"+        , "51712=2000-06-17=2000-169=2000-W24-6"+        , "51713=2000-06-18=2000-170=2000-W24-7"+        , "51714=2000-06-19=2000-171=2000-W25-1"+        , "51715=2000-06-20=2000-172=2000-W25-2"+        , "51716=2000-06-21=2000-173=2000-W25-3"+        , "51717=2000-06-22=2000-174=2000-W25-4"+        , "51718=2000-06-23=2000-175=2000-W25-5"+        , "51719=2000-06-24=2000-176=2000-W25-6"+        , "51720=2000-06-25=2000-177=2000-W25-7"+        , "51721=2000-06-26=2000-178=2000-W26-1"+        , "51722=2000-06-27=2000-179=2000-W26-2"+        , "51723=2000-06-28=2000-180=2000-W26-3"+        , "51724=2000-06-29=2000-181=2000-W26-4"+        , "51725=2000-06-30=2000-182=2000-W26-5"+        , "51726=2000-07-01=2000-183=2000-W26-6"+        , "51727=2000-07-02=2000-184=2000-W26-7"+        , "51728=2000-07-03=2000-185=2000-W27-1"+        , "51729=2000-07-04=2000-186=2000-W27-2"+        , "51730=2000-07-05=2000-187=2000-W27-3"+        , "51731=2000-07-06=2000-188=2000-W27-4"+        , "51732=2000-07-07=2000-189=2000-W27-5"+        , "51733=2000-07-08=2000-190=2000-W27-6"+        , "51734=2000-07-09=2000-191=2000-W27-7"+        , "51735=2000-07-10=2000-192=2000-W28-1"+        , "51736=2000-07-11=2000-193=2000-W28-2"+        , "51737=2000-07-12=2000-194=2000-W28-3"+        , "51738=2000-07-13=2000-195=2000-W28-4"+        , "51739=2000-07-14=2000-196=2000-W28-5"+        , "51740=2000-07-15=2000-197=2000-W28-6"+        , "51741=2000-07-16=2000-198=2000-W28-7"+        , "51742=2000-07-17=2000-199=2000-W29-1"+        , "51743=2000-07-18=2000-200=2000-W29-2"+        , "51744=2000-07-19=2000-201=2000-W29-3"+        , "51745=2000-07-20=2000-202=2000-W29-4"+        , "51746=2000-07-21=2000-203=2000-W29-5"+        , "51747=2000-07-22=2000-204=2000-W29-6"+        , "51748=2000-07-23=2000-205=2000-W29-7"+        , "51749=2000-07-24=2000-206=2000-W30-1"+        , "51750=2000-07-25=2000-207=2000-W30-2"+        , "51751=2000-07-26=2000-208=2000-W30-3"+        , "51752=2000-07-27=2000-209=2000-W30-4"+        , "51753=2000-07-28=2000-210=2000-W30-5"+        , "51754=2000-07-29=2000-211=2000-W30-6"+        , "51755=2000-07-30=2000-212=2000-W30-7"+        , "51756=2000-07-31=2000-213=2000-W31-1"+        , "51757=2000-08-01=2000-214=2000-W31-2"+        , "51758=2000-08-02=2000-215=2000-W31-3"+        , "51759=2000-08-03=2000-216=2000-W31-4"+        , "51760=2000-08-04=2000-217=2000-W31-5"+        , "51761=2000-08-05=2000-218=2000-W31-6"+        , "51762=2000-08-06=2000-219=2000-W31-7"+        , "51763=2000-08-07=2000-220=2000-W32-1"+        , "51764=2000-08-08=2000-221=2000-W32-2"+        , "51765=2000-08-09=2000-222=2000-W32-3"+        , "51766=2000-08-10=2000-223=2000-W32-4"+        , "51767=2000-08-11=2000-224=2000-W32-5"+        , "51768=2000-08-12=2000-225=2000-W32-6"+        , "51769=2000-08-13=2000-226=2000-W32-7"+        , "51770=2000-08-14=2000-227=2000-W33-1"+        , "51771=2000-08-15=2000-228=2000-W33-2"+        , "51772=2000-08-16=2000-229=2000-W33-3"+        , "51773=2000-08-17=2000-230=2000-W33-4"+        , "51774=2000-08-18=2000-231=2000-W33-5"+        , "51775=2000-08-19=2000-232=2000-W33-6"+        , "51776=2000-08-20=2000-233=2000-W33-7"+        , "51777=2000-08-21=2000-234=2000-W34-1"+        , "51778=2000-08-22=2000-235=2000-W34-2"+        , "51779=2000-08-23=2000-236=2000-W34-3"+        , "51780=2000-08-24=2000-237=2000-W34-4"+        , "51781=2000-08-25=2000-238=2000-W34-5"+        , "51782=2000-08-26=2000-239=2000-W34-6"+        , "51783=2000-08-27=2000-240=2000-W34-7"+        , "51784=2000-08-28=2000-241=2000-W35-1"+        , "51785=2000-08-29=2000-242=2000-W35-2"+        , "51786=2000-08-30=2000-243=2000-W35-3"+        , "51787=2000-08-31=2000-244=2000-W35-4"+        , "51788=2000-09-01=2000-245=2000-W35-5"+        , "51789=2000-09-02=2000-246=2000-W35-6"+        , "51790=2000-09-03=2000-247=2000-W35-7"+        , "51791=2000-09-04=2000-248=2000-W36-1"+        , "51792=2000-09-05=2000-249=2000-W36-2"+        , "51793=2000-09-06=2000-250=2000-W36-3"+        , "51794=2000-09-07=2000-251=2000-W36-4"+        , "51795=2000-09-08=2000-252=2000-W36-5"+        , "51796=2000-09-09=2000-253=2000-W36-6"+        , "51797=2000-09-10=2000-254=2000-W36-7"+        , "51798=2000-09-11=2000-255=2000-W37-1"+        , "51799=2000-09-12=2000-256=2000-W37-2"+        , "51800=2000-09-13=2000-257=2000-W37-3"+        , "51801=2000-09-14=2000-258=2000-W37-4"+        , "51802=2000-09-15=2000-259=2000-W37-5"+        , "51803=2000-09-16=2000-260=2000-W37-6"+        , "51804=2000-09-17=2000-261=2000-W37-7"+        , "51805=2000-09-18=2000-262=2000-W38-1"+        , "51806=2000-09-19=2000-263=2000-W38-2"+        , "51807=2000-09-20=2000-264=2000-W38-3"+        , "51808=2000-09-21=2000-265=2000-W38-4"+        , "51809=2000-09-22=2000-266=2000-W38-5"+        , "51810=2000-09-23=2000-267=2000-W38-6"+        , "51811=2000-09-24=2000-268=2000-W38-7"+        , "51812=2000-09-25=2000-269=2000-W39-1"+        , "51813=2000-09-26=2000-270=2000-W39-2"+        , "51814=2000-09-27=2000-271=2000-W39-3"+        , "51815=2000-09-28=2000-272=2000-W39-4"+        , "51816=2000-09-29=2000-273=2000-W39-5"+        , "51817=2000-09-30=2000-274=2000-W39-6"+        , "51818=2000-10-01=2000-275=2000-W39-7"+        , "51819=2000-10-02=2000-276=2000-W40-1"+        , "51820=2000-10-03=2000-277=2000-W40-2"+        , "51821=2000-10-04=2000-278=2000-W40-3"+        , "51822=2000-10-05=2000-279=2000-W40-4"+        , "51823=2000-10-06=2000-280=2000-W40-5"+        , "51824=2000-10-07=2000-281=2000-W40-6"+        , "51825=2000-10-08=2000-282=2000-W40-7"+        , "51826=2000-10-09=2000-283=2000-W41-1"+        , "51827=2000-10-10=2000-284=2000-W41-2"+        , "51828=2000-10-11=2000-285=2000-W41-3"+        , "51829=2000-10-12=2000-286=2000-W41-4"+        , "51830=2000-10-13=2000-287=2000-W41-5"+        , "51831=2000-10-14=2000-288=2000-W41-6"+        , "51832=2000-10-15=2000-289=2000-W41-7"+        , "51833=2000-10-16=2000-290=2000-W42-1"+        , "51834=2000-10-17=2000-291=2000-W42-2"+        , "51835=2000-10-18=2000-292=2000-W42-3"+        , "51836=2000-10-19=2000-293=2000-W42-4"+        , "51837=2000-10-20=2000-294=2000-W42-5"+        , "51838=2000-10-21=2000-295=2000-W42-6"+        , "51839=2000-10-22=2000-296=2000-W42-7"+        , "51840=2000-10-23=2000-297=2000-W43-1"+        , "51841=2000-10-24=2000-298=2000-W43-2"+        , "51842=2000-10-25=2000-299=2000-W43-3"+        , "51843=2000-10-26=2000-300=2000-W43-4"+        , "51844=2000-10-27=2000-301=2000-W43-5"+        , "51845=2000-10-28=2000-302=2000-W43-6"+        , "51846=2000-10-29=2000-303=2000-W43-7"+        , "51847=2000-10-30=2000-304=2000-W44-1"+        , "51848=2000-10-31=2000-305=2000-W44-2"+        , "51849=2000-11-01=2000-306=2000-W44-3"+        , "51850=2000-11-02=2000-307=2000-W44-4"+        , "51851=2000-11-03=2000-308=2000-W44-5"+        , "51852=2000-11-04=2000-309=2000-W44-6"+        , "51853=2000-11-05=2000-310=2000-W44-7"+        , "51854=2000-11-06=2000-311=2000-W45-1"+        , "51855=2000-11-07=2000-312=2000-W45-2"+        , "51856=2000-11-08=2000-313=2000-W45-3"+        , "51857=2000-11-09=2000-314=2000-W45-4"+        , "51858=2000-11-10=2000-315=2000-W45-5"+        , "51859=2000-11-11=2000-316=2000-W45-6"+        , "51860=2000-11-12=2000-317=2000-W45-7"+        , "51861=2000-11-13=2000-318=2000-W46-1"+        , "51862=2000-11-14=2000-319=2000-W46-2"+        , "51863=2000-11-15=2000-320=2000-W46-3"+        , "51864=2000-11-16=2000-321=2000-W46-4"+        , "51865=2000-11-17=2000-322=2000-W46-5"+        , "51866=2000-11-18=2000-323=2000-W46-6"+        , "51867=2000-11-19=2000-324=2000-W46-7"+        , "51868=2000-11-20=2000-325=2000-W47-1"+        , "51869=2000-11-21=2000-326=2000-W47-2"+        , "51870=2000-11-22=2000-327=2000-W47-3"+        , "51871=2000-11-23=2000-328=2000-W47-4"+        , "51872=2000-11-24=2000-329=2000-W47-5"+        , "51873=2000-11-25=2000-330=2000-W47-6"+        , "51874=2000-11-26=2000-331=2000-W47-7"+        , "51875=2000-11-27=2000-332=2000-W48-1"+        , "51876=2000-11-28=2000-333=2000-W48-2"+        , "51877=2000-11-29=2000-334=2000-W48-3"+        , "51878=2000-11-30=2000-335=2000-W48-4"+        , "51879=2000-12-01=2000-336=2000-W48-5"+        , "51880=2000-12-02=2000-337=2000-W48-6"+        , "51881=2000-12-03=2000-338=2000-W48-7"+        , "51882=2000-12-04=2000-339=2000-W49-1"+        , "51883=2000-12-05=2000-340=2000-W49-2"+        , "51884=2000-12-06=2000-341=2000-W49-3"+        , "51885=2000-12-07=2000-342=2000-W49-4"+        , "51886=2000-12-08=2000-343=2000-W49-5"+        , "51887=2000-12-09=2000-344=2000-W49-6"+        , "51888=2000-12-10=2000-345=2000-W49-7"+        , "51889=2000-12-11=2000-346=2000-W50-1"+        , "51890=2000-12-12=2000-347=2000-W50-2"+        , "51891=2000-12-13=2000-348=2000-W50-3"+        , "51892=2000-12-14=2000-349=2000-W50-4"+        , "51893=2000-12-15=2000-350=2000-W50-5"+        , "51894=2000-12-16=2000-351=2000-W50-6"+        , "51895=2000-12-17=2000-352=2000-W50-7"+        , "51896=2000-12-18=2000-353=2000-W51-1"+        , "51897=2000-12-19=2000-354=2000-W51-2"+        , "51898=2000-12-20=2000-355=2000-W51-3"+        , "51899=2000-12-21=2000-356=2000-W51-4"+        , "51900=2000-12-22=2000-357=2000-W51-5"+        , "51901=2000-12-23=2000-358=2000-W51-6"+        , "51902=2000-12-24=2000-359=2000-W51-7"+        , "51903=2000-12-25=2000-360=2000-W52-1"+        , "51904=2000-12-26=2000-361=2000-W52-2"+        , "51905=2000-12-27=2000-362=2000-W52-3"+        , "51906=2000-12-28=2000-363=2000-W52-4"+        , "51907=2000-12-29=2000-364=2000-W52-5"+        , "51908=2000-12-30=2000-365=2000-W52-6"+        , "51909=2000-12-31=2000-366=2000-W52-7"+        , "51910=2001-01-01=2001-001=2001-W01-1"+        , "51911=2001-01-02=2001-002=2001-W01-2"+        , "51912=2001-01-03=2001-003=2001-W01-3"+        , "51913=2001-01-04=2001-004=2001-W01-4"+        , "51914=2001-01-05=2001-005=2001-W01-5"+        , "51915=2001-01-06=2001-006=2001-W01-6"+        , "51916=2001-01-07=2001-007=2001-W01-7"+        , "51917=2001-01-08=2001-008=2001-W02-1"+        , "51918=2001-01-09=2001-009=2001-W02-2"+        , "51919=2001-01-10=2001-010=2001-W02-3"+        , "51920=2001-01-11=2001-011=2001-W02-4"+        , "51921=2001-01-12=2001-012=2001-W02-5"+        , "51922=2001-01-13=2001-013=2001-W02-6"+        , "51923=2001-01-14=2001-014=2001-W02-7"+        , "51924=2001-01-15=2001-015=2001-W03-1"+        , "51925=2001-01-16=2001-016=2001-W03-2"+        , "51926=2001-01-17=2001-017=2001-W03-3"+        , "51927=2001-01-18=2001-018=2001-W03-4"+        , "51928=2001-01-19=2001-019=2001-W03-5"+        , "51929=2001-01-20=2001-020=2001-W03-6"+        , "51930=2001-01-21=2001-021=2001-W03-7"+        , "51931=2001-01-22=2001-022=2001-W04-1"+        , "51932=2001-01-23=2001-023=2001-W04-2"+        , "51933=2001-01-24=2001-024=2001-W04-3"+        , "51934=2001-01-25=2001-025=2001-W04-4"+        , "51935=2001-01-26=2001-026=2001-W04-5"+        , "51936=2001-01-27=2001-027=2001-W04-6"+        , "51937=2001-01-28=2001-028=2001-W04-7"+        , "51938=2001-01-29=2001-029=2001-W05-1"+        , "51939=2001-01-30=2001-030=2001-W05-2"+        , "51940=2001-01-31=2001-031=2001-W05-3"+        , "51941=2001-02-01=2001-032=2001-W05-4"+        , "51942=2001-02-02=2001-033=2001-W05-5"+        , "51943=2001-02-03=2001-034=2001-W05-6"+        , "51944=2001-02-04=2001-035=2001-W05-7"+        , "51945=2001-02-05=2001-036=2001-W06-1"+        , "51946=2001-02-06=2001-037=2001-W06-2"+        , "51947=2001-02-07=2001-038=2001-W06-3"+        , "51948=2001-02-08=2001-039=2001-W06-4"+        , "51949=2001-02-09=2001-040=2001-W06-5"+        , "51950=2001-02-10=2001-041=2001-W06-6"+        , "51951=2001-02-11=2001-042=2001-W06-7"+        , "51952=2001-02-12=2001-043=2001-W07-1"+        , "51953=2001-02-13=2001-044=2001-W07-2"+        , "51954=2001-02-14=2001-045=2001-W07-3"+        , "51955=2001-02-15=2001-046=2001-W07-4"+        , "51956=2001-02-16=2001-047=2001-W07-5"+        , "51957=2001-02-17=2001-048=2001-W07-6"+        , "51958=2001-02-18=2001-049=2001-W07-7"+        , "51959=2001-02-19=2001-050=2001-W08-1"+        , "51960=2001-02-20=2001-051=2001-W08-2"+        , "51961=2001-02-21=2001-052=2001-W08-3"+        , "51962=2001-02-22=2001-053=2001-W08-4"+        , "51963=2001-02-23=2001-054=2001-W08-5"+        , "51964=2001-02-24=2001-055=2001-W08-6"+        , "51965=2001-02-25=2001-056=2001-W08-7"+        , "51966=2001-02-26=2001-057=2001-W09-1"+        , "51967=2001-02-27=2001-058=2001-W09-2"+        , "51968=2001-02-28=2001-059=2001-W09-3"+        , "51969=2001-03-01=2001-060=2001-W09-4"+        , "51970=2001-03-02=2001-061=2001-W09-5"+        , "51971=2001-03-03=2001-062=2001-W09-6"+        , "51972=2001-03-04=2001-063=2001-W09-7"+        , "51973=2001-03-05=2001-064=2001-W10-1"+        , "51974=2001-03-06=2001-065=2001-W10-2"+        , "51975=2001-03-07=2001-066=2001-W10-3"+        , "51976=2001-03-08=2001-067=2001-W10-4"+        , "51977=2001-03-09=2001-068=2001-W10-5"+        , "51978=2001-03-10=2001-069=2001-W10-6"+        , "51979=2001-03-11=2001-070=2001-W10-7"+        , "51980=2001-03-12=2001-071=2001-W11-1"+        , "51981=2001-03-13=2001-072=2001-W11-2"+        , "51982=2001-03-14=2001-073=2001-W11-3"+        , "51983=2001-03-15=2001-074=2001-W11-4"+        , "51984=2001-03-16=2001-075=2001-W11-5"+        , "51985=2001-03-17=2001-076=2001-W11-6"+        , "51986=2001-03-18=2001-077=2001-W11-7"+        , "51987=2001-03-19=2001-078=2001-W12-1"+        , "51988=2001-03-20=2001-079=2001-W12-2"+        , "51989=2001-03-21=2001-080=2001-W12-3"+        , "51990=2001-03-22=2001-081=2001-W12-4"+        , "51991=2001-03-23=2001-082=2001-W12-5"+        , "51992=2001-03-24=2001-083=2001-W12-6"+        , "51993=2001-03-25=2001-084=2001-W12-7"+        , "51994=2001-03-26=2001-085=2001-W13-1"+        , "51995=2001-03-27=2001-086=2001-W13-2"+        , "51996=2001-03-28=2001-087=2001-W13-3"+        , "51997=2001-03-29=2001-088=2001-W13-4"+        , "51998=2001-03-30=2001-089=2001-W13-5"+        , "51999=2001-03-31=2001-090=2001-W13-6"+        , "52000=2001-04-01=2001-091=2001-W13-7"+        , "52001=2001-04-02=2001-092=2001-W14-1"+        , "52002=2001-04-03=2001-093=2001-W14-2"+        , "52003=2001-04-04=2001-094=2001-W14-3"+        , "52004=2001-04-05=2001-095=2001-W14-4"+        , "52005=2001-04-06=2001-096=2001-W14-5"+        , "52006=2001-04-07=2001-097=2001-W14-6"+        , "52007=2001-04-08=2001-098=2001-W14-7"+        , "52008=2001-04-09=2001-099=2001-W15-1"+        , "52009=2001-04-10=2001-100=2001-W15-2"+        , "52010=2001-04-11=2001-101=2001-W15-3"+        , "52011=2001-04-12=2001-102=2001-W15-4"+        , "52012=2001-04-13=2001-103=2001-W15-5"+        , "52013=2001-04-14=2001-104=2001-W15-6"+        , "52014=2001-04-15=2001-105=2001-W15-7"+        , "52015=2001-04-16=2001-106=2001-W16-1"+        , "52016=2001-04-17=2001-107=2001-W16-2"+        , "52017=2001-04-18=2001-108=2001-W16-3"+        , "52018=2001-04-19=2001-109=2001-W16-4"+        , "52019=2001-04-20=2001-110=2001-W16-5"+        , "52020=2001-04-21=2001-111=2001-W16-6"+        , "52021=2001-04-22=2001-112=2001-W16-7"+        , "52022=2001-04-23=2001-113=2001-W17-1"+        , "52023=2001-04-24=2001-114=2001-W17-2"+        , "52024=2001-04-25=2001-115=2001-W17-3"+        , "52025=2001-04-26=2001-116=2001-W17-4"+        , "52026=2001-04-27=2001-117=2001-W17-5"+        , "52027=2001-04-28=2001-118=2001-W17-6"+        , "52028=2001-04-29=2001-119=2001-W17-7"+        , "52029=2001-04-30=2001-120=2001-W18-1"+        , "52030=2001-05-01=2001-121=2001-W18-2"+        , "52031=2001-05-02=2001-122=2001-W18-3"+        , "52032=2001-05-03=2001-123=2001-W18-4"+        , "52033=2001-05-04=2001-124=2001-W18-5"+        , "52034=2001-05-05=2001-125=2001-W18-6"+        , "52035=2001-05-06=2001-126=2001-W18-7"+        , "52036=2001-05-07=2001-127=2001-W19-1"+        , "52037=2001-05-08=2001-128=2001-W19-2"+        , "52038=2001-05-09=2001-129=2001-W19-3"+        , "52039=2001-05-10=2001-130=2001-W19-4"+        , "52040=2001-05-11=2001-131=2001-W19-5"+        , "52041=2001-05-12=2001-132=2001-W19-6"+        , "52042=2001-05-13=2001-133=2001-W19-7"+        , "52043=2001-05-14=2001-134=2001-W20-1"+        , "52044=2001-05-15=2001-135=2001-W20-2"+        , "52045=2001-05-16=2001-136=2001-W20-3"+        , "52046=2001-05-17=2001-137=2001-W20-4"+        , "52047=2001-05-18=2001-138=2001-W20-5"+        , "52048=2001-05-19=2001-139=2001-W20-6"+        , "52049=2001-05-20=2001-140=2001-W20-7"+        , "52050=2001-05-21=2001-141=2001-W21-1"+        , "52051=2001-05-22=2001-142=2001-W21-2"+        , "52052=2001-05-23=2001-143=2001-W21-3"+        , "52053=2001-05-24=2001-144=2001-W21-4"+        , "52054=2001-05-25=2001-145=2001-W21-5"+        , "52055=2001-05-26=2001-146=2001-W21-6"+        , "52056=2001-05-27=2001-147=2001-W21-7"+        , "52057=2001-05-28=2001-148=2001-W22-1"+        , "52058=2001-05-29=2001-149=2001-W22-2"+        , "52059=2001-05-30=2001-150=2001-W22-3"+        , "52060=2001-05-31=2001-151=2001-W22-4"+        , "52061=2001-06-01=2001-152=2001-W22-5"+        , "52062=2001-06-02=2001-153=2001-W22-6"+        , "52063=2001-06-03=2001-154=2001-W22-7"+        , "52064=2001-06-04=2001-155=2001-W23-1"+        , "52065=2001-06-05=2001-156=2001-W23-2"+        , "52066=2001-06-06=2001-157=2001-W23-3"+        , "52067=2001-06-07=2001-158=2001-W23-4"+        , "52068=2001-06-08=2001-159=2001-W23-5"+        , "52069=2001-06-09=2001-160=2001-W23-6"+        , "52070=2001-06-10=2001-161=2001-W23-7"+        , "52071=2001-06-11=2001-162=2001-W24-1"+        , "52072=2001-06-12=2001-163=2001-W24-2"+        , "52073=2001-06-13=2001-164=2001-W24-3"+        , "52074=2001-06-14=2001-165=2001-W24-4"+        , "52075=2001-06-15=2001-166=2001-W24-5"+        , "52076=2001-06-16=2001-167=2001-W24-6"+        , "52077=2001-06-17=2001-168=2001-W24-7"+        , "52078=2001-06-18=2001-169=2001-W25-1"+        , "52079=2001-06-19=2001-170=2001-W25-2"+        , "52080=2001-06-20=2001-171=2001-W25-3"+        , "52081=2001-06-21=2001-172=2001-W25-4"+        , "52082=2001-06-22=2001-173=2001-W25-5"+        , "52083=2001-06-23=2001-174=2001-W25-6"+        , "52084=2001-06-24=2001-175=2001-W25-7"+        , "52085=2001-06-25=2001-176=2001-W26-1"+        , "52086=2001-06-26=2001-177=2001-W26-2"+        , "52087=2001-06-27=2001-178=2001-W26-3"+        , "52088=2001-06-28=2001-179=2001-W26-4"+        , "52089=2001-06-29=2001-180=2001-W26-5"+        , "52090=2001-06-30=2001-181=2001-W26-6"+        , "52091=2001-07-01=2001-182=2001-W26-7"+        , "52092=2001-07-02=2001-183=2001-W27-1"+        , "52093=2001-07-03=2001-184=2001-W27-2"+        , "52094=2001-07-04=2001-185=2001-W27-3"+        , "52095=2001-07-05=2001-186=2001-W27-4"+        , "52096=2001-07-06=2001-187=2001-W27-5"+        , "52097=2001-07-07=2001-188=2001-W27-6"+        , "52098=2001-07-08=2001-189=2001-W27-7"+        , "52099=2001-07-09=2001-190=2001-W28-1"+        , "52100=2001-07-10=2001-191=2001-W28-2"+        , "52101=2001-07-11=2001-192=2001-W28-3"+        , "52102=2001-07-12=2001-193=2001-W28-4"+        , "52103=2001-07-13=2001-194=2001-W28-5"+        , "52104=2001-07-14=2001-195=2001-W28-6"+        , "52105=2001-07-15=2001-196=2001-W28-7"+        , "52106=2001-07-16=2001-197=2001-W29-1"+        , "52107=2001-07-17=2001-198=2001-W29-2"+        , "52108=2001-07-18=2001-199=2001-W29-3"+        , "52109=2001-07-19=2001-200=2001-W29-4"+        , "52110=2001-07-20=2001-201=2001-W29-5"+        , "52111=2001-07-21=2001-202=2001-W29-6"+        , "52112=2001-07-22=2001-203=2001-W29-7"+        , "52113=2001-07-23=2001-204=2001-W30-1"+        , "52114=2001-07-24=2001-205=2001-W30-2"+        , "52115=2001-07-25=2001-206=2001-W30-3"+        , "52116=2001-07-26=2001-207=2001-W30-4"+        , "52117=2001-07-27=2001-208=2001-W30-5"+        , "52118=2001-07-28=2001-209=2001-W30-6"+        , "52119=2001-07-29=2001-210=2001-W30-7"+        , "52120=2001-07-30=2001-211=2001-W31-1"+        , "52121=2001-07-31=2001-212=2001-W31-2"+        , "52122=2001-08-01=2001-213=2001-W31-3"+        , "52123=2001-08-02=2001-214=2001-W31-4"+        , "52124=2001-08-03=2001-215=2001-W31-5"+        , "52125=2001-08-04=2001-216=2001-W31-6"+        , "52126=2001-08-05=2001-217=2001-W31-7"+        , "52127=2001-08-06=2001-218=2001-W32-1"+        , "52128=2001-08-07=2001-219=2001-W32-2"+        , "52129=2001-08-08=2001-220=2001-W32-3"+        , "52130=2001-08-09=2001-221=2001-W32-4"+        , "52131=2001-08-10=2001-222=2001-W32-5"+        , "52132=2001-08-11=2001-223=2001-W32-6"+        , "52133=2001-08-12=2001-224=2001-W32-7"+        , "52134=2001-08-13=2001-225=2001-W33-1"+        , "52135=2001-08-14=2001-226=2001-W33-2"+        , "52136=2001-08-15=2001-227=2001-W33-3"+        , "52137=2001-08-16=2001-228=2001-W33-4"+        , "52138=2001-08-17=2001-229=2001-W33-5"+        , "52139=2001-08-18=2001-230=2001-W33-6"+        , "52140=2001-08-19=2001-231=2001-W33-7"+        , "52141=2001-08-20=2001-232=2001-W34-1"+        , "52142=2001-08-21=2001-233=2001-W34-2"+        , "52143=2001-08-22=2001-234=2001-W34-3"+        , "52144=2001-08-23=2001-235=2001-W34-4"+        , "52145=2001-08-24=2001-236=2001-W34-5"+        , "52146=2001-08-25=2001-237=2001-W34-6"+        , "52147=2001-08-26=2001-238=2001-W34-7"+        , "52148=2001-08-27=2001-239=2001-W35-1"+        , "52149=2001-08-28=2001-240=2001-W35-2"+        , "52150=2001-08-29=2001-241=2001-W35-3"+        , "52151=2001-08-30=2001-242=2001-W35-4"+        , "52152=2001-08-31=2001-243=2001-W35-5"+        , "52153=2001-09-01=2001-244=2001-W35-6"+        , "52154=2001-09-02=2001-245=2001-W35-7"+        , "52155=2001-09-03=2001-246=2001-W36-1"+        , "52156=2001-09-04=2001-247=2001-W36-2"+        , "52157=2001-09-05=2001-248=2001-W36-3"+        , "52158=2001-09-06=2001-249=2001-W36-4"+        , "52159=2001-09-07=2001-250=2001-W36-5"+        , "52160=2001-09-08=2001-251=2001-W36-6"+        , "52161=2001-09-09=2001-252=2001-W36-7"+        , "52162=2001-09-10=2001-253=2001-W37-1"+        , "52163=2001-09-11=2001-254=2001-W37-2"+        , "52164=2001-09-12=2001-255=2001-W37-3"+        , "52165=2001-09-13=2001-256=2001-W37-4"+        , "52166=2001-09-14=2001-257=2001-W37-5"+        , "52167=2001-09-15=2001-258=2001-W37-6"+        , "52168=2001-09-16=2001-259=2001-W37-7"+        , "52169=2001-09-17=2001-260=2001-W38-1"+        , "52170=2001-09-18=2001-261=2001-W38-2"+        , "52171=2001-09-19=2001-262=2001-W38-3"+        , "52172=2001-09-20=2001-263=2001-W38-4"+        , "52173=2001-09-21=2001-264=2001-W38-5"+        , "52174=2001-09-22=2001-265=2001-W38-6"+        , "52175=2001-09-23=2001-266=2001-W38-7"+        , "52176=2001-09-24=2001-267=2001-W39-1"+        , "52177=2001-09-25=2001-268=2001-W39-2"+        , "52178=2001-09-26=2001-269=2001-W39-3"+        , "52179=2001-09-27=2001-270=2001-W39-4"+        , "52180=2001-09-28=2001-271=2001-W39-5"+        , "52181=2001-09-29=2001-272=2001-W39-6"+        , "52182=2001-09-30=2001-273=2001-W39-7"+        , "52183=2001-10-01=2001-274=2001-W40-1"+        , "52184=2001-10-02=2001-275=2001-W40-2"+        , "52185=2001-10-03=2001-276=2001-W40-3"+        , "52186=2001-10-04=2001-277=2001-W40-4"+        , "52187=2001-10-05=2001-278=2001-W40-5"+        , "52188=2001-10-06=2001-279=2001-W40-6"+        , "52189=2001-10-07=2001-280=2001-W40-7"+        , "52190=2001-10-08=2001-281=2001-W41-1"+        , "52191=2001-10-09=2001-282=2001-W41-2"+        , "52192=2001-10-10=2001-283=2001-W41-3"+        , "52193=2001-10-11=2001-284=2001-W41-4"+        , "52194=2001-10-12=2001-285=2001-W41-5"+        , "52195=2001-10-13=2001-286=2001-W41-6"+        , "52196=2001-10-14=2001-287=2001-W41-7"+        , "52197=2001-10-15=2001-288=2001-W42-1"+        , "52198=2001-10-16=2001-289=2001-W42-2"+        , "52199=2001-10-17=2001-290=2001-W42-3"+        , "52200=2001-10-18=2001-291=2001-W42-4"+        , "52201=2001-10-19=2001-292=2001-W42-5"+        , "52202=2001-10-20=2001-293=2001-W42-6"+        , "52203=2001-10-21=2001-294=2001-W42-7"+        , "52204=2001-10-22=2001-295=2001-W43-1"+        , "52205=2001-10-23=2001-296=2001-W43-2"+        , "52206=2001-10-24=2001-297=2001-W43-3"+        , "52207=2001-10-25=2001-298=2001-W43-4"+        , "52208=2001-10-26=2001-299=2001-W43-5"+        , "52209=2001-10-27=2001-300=2001-W43-6"+        , "52210=2001-10-28=2001-301=2001-W43-7"+        , "52211=2001-10-29=2001-302=2001-W44-1"+        , "52212=2001-10-30=2001-303=2001-W44-2"+        , "52213=2001-10-31=2001-304=2001-W44-3"+        , "52214=2001-11-01=2001-305=2001-W44-4"+        , "52215=2001-11-02=2001-306=2001-W44-5"+        , "52216=2001-11-03=2001-307=2001-W44-6"+        , "52217=2001-11-04=2001-308=2001-W44-7"+        , "52218=2001-11-05=2001-309=2001-W45-1"+        , "52219=2001-11-06=2001-310=2001-W45-2"+        , "52220=2001-11-07=2001-311=2001-W45-3"+        , "52221=2001-11-08=2001-312=2001-W45-4"+        , "52222=2001-11-09=2001-313=2001-W45-5"+        , "52223=2001-11-10=2001-314=2001-W45-6"+        , "52224=2001-11-11=2001-315=2001-W45-7"+        , "52225=2001-11-12=2001-316=2001-W46-1"+        , "52226=2001-11-13=2001-317=2001-W46-2"+        , "52227=2001-11-14=2001-318=2001-W46-3"+        , "52228=2001-11-15=2001-319=2001-W46-4"+        , "52229=2001-11-16=2001-320=2001-W46-5"+        , "52230=2001-11-17=2001-321=2001-W46-6"+        , "52231=2001-11-18=2001-322=2001-W46-7"+        , "52232=2001-11-19=2001-323=2001-W47-1"+        , "52233=2001-11-20=2001-324=2001-W47-2"+        , "52234=2001-11-21=2001-325=2001-W47-3"+        , "52235=2001-11-22=2001-326=2001-W47-4"+        , "52236=2001-11-23=2001-327=2001-W47-5"+        , "52237=2001-11-24=2001-328=2001-W47-6"+        , "52238=2001-11-25=2001-329=2001-W47-7"+        , "52239=2001-11-26=2001-330=2001-W48-1"+        , "52240=2001-11-27=2001-331=2001-W48-2"+        , "52241=2001-11-28=2001-332=2001-W48-3"+        , "52242=2001-11-29=2001-333=2001-W48-4"+        , "52243=2001-11-30=2001-334=2001-W48-5"+        , "52244=2001-12-01=2001-335=2001-W48-6"+        , "52245=2001-12-02=2001-336=2001-W48-7"+        , "52246=2001-12-03=2001-337=2001-W49-1"+        , "52247=2001-12-04=2001-338=2001-W49-2"+        , "52248=2001-12-05=2001-339=2001-W49-3"+        , "52249=2001-12-06=2001-340=2001-W49-4"+        , "52250=2001-12-07=2001-341=2001-W49-5"+        , "52251=2001-12-08=2001-342=2001-W49-6"+        , "52252=2001-12-09=2001-343=2001-W49-7"+        , "52253=2001-12-10=2001-344=2001-W50-1"+        , "52254=2001-12-11=2001-345=2001-W50-2"+        , "52255=2001-12-12=2001-346=2001-W50-3"+        , "52256=2001-12-13=2001-347=2001-W50-4"+        , "52257=2001-12-14=2001-348=2001-W50-5"+        , "52258=2001-12-15=2001-349=2001-W50-6"+        , "52259=2001-12-16=2001-350=2001-W50-7"+        , "52260=2001-12-17=2001-351=2001-W51-1"+        , "52261=2001-12-18=2001-352=2001-W51-2"+        , "52262=2001-12-19=2001-353=2001-W51-3"+        , "52263=2001-12-20=2001-354=2001-W51-4"+        , "52264=2001-12-21=2001-355=2001-W51-5"+        , "52265=2001-12-22=2001-356=2001-W51-6"+        , "52266=2001-12-23=2001-357=2001-W51-7"+        , "52267=2001-12-24=2001-358=2001-W52-1"+        , "52268=2001-12-25=2001-359=2001-W52-2"+        , "52269=2001-12-26=2001-360=2001-W52-3"+        , "52270=2001-12-27=2001-361=2001-W52-4"+        , "52271=2001-12-28=2001-362=2001-W52-5"+        , "52272=2001-12-29=2001-363=2001-W52-6"+        , "52273=2001-12-30=2001-364=2001-W52-7"+        , "52274=2001-12-31=2001-365=2002-W01-1"+        , "52275=2002-01-01=2002-001=2002-W01-2"+        , "52276=2002-01-02=2002-002=2002-W01-3"+        , "52277=2002-01-03=2002-003=2002-W01-4"+        , "52278=2002-01-04=2002-004=2002-W01-5"+        , "52279=2002-01-05=2002-005=2002-W01-6"+        , "52280=2002-01-06=2002-006=2002-W01-7"+        , ""+        , "51178=1998-12-31=1998-365=1998-W53-4"+        , ""+        , "1998-12-31 23:59:60.5"+        , "51178,86400.5s"+        , "1998-12-31 15:59:60.5"+        , "51178,86400.5s"+        , ""+        , "2000-03-01 00:00:00"+        , "2000-03-01 12:00:00"+        , "2000-02-29 16:00:00"+        , "2000-03-01 04:00:00"+        , "2000-03-01 08:00:00"+        , "2000-03-01 20:00:00"+        , ""+        , "12:34:56.789"+        , "12:34:56.789123"+        , "12:34:56.789123456"+        , "12:34:56.789123456789"+        , if is64Bit+              then "-9223372036854775808:00:00"+              else "-2147483648:00:00"+        , ""+        ]
test/main/Test/TestUtil.hs view
@@ -29,8 +29,8 @@ instance NameTest Result where     nameTest name = nameTest name . property -instance (Arbitrary a,Show a,Testable b) => NameTest (a -> b) where+instance (Arbitrary a, Show a, Testable b) => NameTest (a -> b) where     nameTest name = nameTest name . property -tgroup :: (Show a,NameTest t) => [a] -> (a -> t) -> [TestTree]+tgroup :: (Show a, NameTest t) => [a] -> (a -> t) -> [TestTree] tgroup aa f = fmap (\a -> nameTest (show a) $ f a) aa
+ test/main/Test/Types.hs view
@@ -0,0 +1,26 @@+module Test.Types(CheckInstances) where++import Data.Data+import Data.Time+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++instance CheckInstances UTCTime+instance CheckInstances NominalDiffTime++instance CheckInstances Day+instance CheckInstances DayOfWeek+instance CheckInstances TimeOfDay+instance CheckInstances LocalTime+instance CheckInstances TimeZone+instance CheckDataInstances ZonedTime+instance CheckInstances CalendarDiffDays+instance CheckInstances CalendarDiffTime++instance CheckInstances SystemTime++instance CheckInstances AbsoluteTime+instance CheckInstances UniversalTime
test/unix/Main.hs view
@@ -1,19 +1,11 @@ module Main where -import Test.Tasty import Test.Format.Format import Test.LocalTime.TimeZone-+import Test.Tasty  tests :: TestTree-tests = testGroup "Time" [-    testGroup "Format" [-        testFormat-        ],-    testGroup "LocalTime" [-        testTimeZone-        ]-    ]+tests = testGroup "Time" [testGroup "Format" [testFormat], testGroup "LocalTime" [testTimeZone]]  main :: IO () main = defaultMain tests
test/unix/Test/Format/Format.hs view
@@ -1,12 +1,16 @@ {-# OPTIONS -fno-warn-orphans #-}-module Test.Format.Format(testFormat) where -import Data.Time-import Data.Time.Clock.POSIX+module Test.Format.Format+    ( testFormat+    ) where+ import Data.Char import Data.Fixed as F+import Data.Time+import Data.Time.Clock.POSIX import Foreign import Foreign.C+import System.IO.Unsafe import System.Random import Test.QuickCheck hiding (Result) import Test.QuickCheck.Property@@ -14,7 +18,6 @@ import Test.Tasty.HUnit import Test.Tasty.QuickCheck import Test.TestUtil-import System.IO.Unsafe  {-     size_t format_time (@@ -22,50 +25,69 @@     const char *format,     int isdst,int gmtoff,time_t t); -}--foreign import ccall unsafe "FormatStuff.h format_time" format_time :: CString -> CSize -> CString -> CInt -> CInt -> CString -> CTime -> IO CSize+foreign import ccall unsafe "FormatStuff.h format_time" format_time+    :: CString ->+  CSize -> CString -> CInt -> CInt -> CString -> CTime -> IO CSize  withBuffer :: Int -> (CString -> IO CSize) -> IO String-withBuffer n f = withArray (replicate n 0) (\buffer -> do-            len <- f buffer-            peekCStringLen (buffer,fromIntegral len)-        )+withBuffer n f =+    withArray+        (replicate n 0)+        (\buffer -> do+             len <- f buffer+             peekCStringLen (buffer, fromIntegral len))  unixFormatTime :: String -> TimeZone -> UTCTime -> String-unixFormatTime fmt zone time = unsafePerformIO $ withCString fmt (\pfmt -> withCString (timeZoneName zone) (\pzonename ->-        withBuffer 100 (\buffer -> format_time buffer 100 pfmt-                (if timeZoneSummerOnly zone then 1 else 0)-                (fromIntegral (timeZoneMinutes zone * 60))-                pzonename-                (fromInteger (floor (utcTimeToPOSIXSeconds time)))-            )-        ))+unixFormatTime fmt zone time =+    unsafePerformIO $+    withCString+        fmt+        (\pfmt ->+             withCString+                 (timeZoneName zone)+                 (\pzonename ->+                      withBuffer+                          100+                          (\buffer ->+                               format_time+                                   buffer+                                   100+                                   pfmt+                                   (if timeZoneSummerOnly zone+                                        then 1+                                        else 0)+                                   (fromIntegral (timeZoneMinutes zone * 60))+                                   pzonename+                                   (fromInteger (floor (utcTimeToPOSIXSeconds time))))))  locale :: TimeLocale locale = defaultTimeLocale {dateTimeFmt = "%a %b %e %H:%M:%S %Y"}  instance Random (F.Fixed res) where-    randomR (MkFixed lo,MkFixed hi) oldgen = let-        (v,newgen) = randomR (lo,hi) oldgen-        in (MkFixed v,newgen)+    randomR (MkFixed lo, MkFixed hi) oldgen = let+        (v, newgen) = randomR (lo, hi) oldgen+        in (MkFixed v, newgen)     random oldgen = let-        (v,newgen) = random oldgen-        in (MkFixed v,newgen)+        (v, newgen) = random oldgen+        in (MkFixed v, newgen)  instance Arbitrary TimeZone where     arbitrary = do-        mins <- choose (-2000,2000)+        mins <- choose (-2000, 2000)         dst <- arbitrary         hasName <- arbitrary         let-            name = if hasName then "ZONE" else ""+            name =+                if hasName+                    then "ZONE"+                    else ""         return $ TimeZone mins dst name  instance Arbitrary TimeOfDay where     arbitrary = do-        h <- choose (0,23)-        m <- choose (0,59)-        s <- choose (0,59.999999999999) -- don't allow leap-seconds+        h <- choose (0, 23)+        m <- choose (0, 59)+        s <- choose (0, 59.999999999999) -- don't allow leap-seconds         return $ TimeOfDay h m s  -- | The size of 'CTime' is platform-dependent.@@ -77,19 +99,20 @@  instance Arbitrary UTCTime where     arbitrary = do-        day <- choose (-25000,75000)+        day <- choose (-25000, 75000)         time <- arbitrary         let             -- verify that the created time can fit in the local CTime             localT = LocalTime (ModifiedJulianDay day) time             utcT = localTimeToUTC utc localT             secondsInteger = floor (utcTimeToPOSIXSeconds utcT)-        if secondsFitInCTime (secondsInteger + 2*86400) && secondsFitInCTime (secondsInteger - 2*86400) -- two days slop each way-          then return utcT-          else arbitrary+        if secondsFitInCTime (secondsInteger + 2 * 86400) && secondsFitInCTime (secondsInteger - 2 * 86400) -- two days slop each way+            then return utcT+            else arbitrary  padN :: Int -> Char -> String -> String-padN n _ s | n <= (length s) = s+padN n _ s+    | n <= (length s) = s padN n c s = (replicate (n - length s) c) ++ s  unixWorkarounds :: String -> String -> String@@ -101,14 +124,17 @@ unixWorkarounds "%0G" s = padN 4 '0' s unixWorkarounds "%_f" s = padN 2 ' ' s unixWorkarounds "%0f" s = padN 2 '0' s-unixWorkarounds fmt s | elem 'z' fmt = dropWhile isPadChar s where+unixWorkarounds fmt s+    | elem 'z' fmt = dropWhile isPadChar s+  where     isPadChar ' ' = True     isPadChar '0' = True     isPadChar _ = False unixWorkarounds _ s = s  compareFormat :: (String -> String) -> String -> TimeZone -> UTCTime -> Result-compareFormat _modUnix fmt zone _time | last fmt == 'Z' && timeZoneName zone == "" = rejected+compareFormat _modUnix fmt zone _time+    | last fmt == 'Z' && timeZoneName zone == "" = rejected compareFormat modUnix fmt zone time = let     ctime = utcToZonedTime zone time     haskellText = formatTime locale fmt ctime@@ -126,95 +152,98 @@  -- as found in "man strftime" on a glibc system. '#' is different, though modifiers :: [String]-modifiers = ["","_","-","0","^"]+modifiers = ["", "_", "-", "0", "^"]  widths :: [String]-widths = ["","1","2","9","12"]+widths = ["", "1", "2", "9", "12"]  formats :: [String]-formats =  ["%G-W%V-%u","%U-%w","%W-%u"]- ++ (do-    char <- chars-    width <- widths-    modifier <- modifiers-    return $ "%" ++ modifier ++ width ++ [char]-    )+formats =+    ["%G-W%V-%u", "%U-%w", "%W-%u"] +++    (do+         char <- chars+         width <- widths+         modifier <- modifiers+         return $ "%" ++ modifier ++ width ++ [char])  hashformats :: [String] hashformats = do     char <- chars-    return $ "%#"++[char]+    return $ "%#" ++ [char]  testCompareFormat :: [TestTree]-testCompareFormat = tgroup formats $ \fmt -> do-    time <- arbitrary-    zone <- arbitrary-    return $ compareFormat id fmt zone time+testCompareFormat =+    tgroup formats $ \fmt -> do+        time <- arbitrary+        zone <- arbitrary+        return $ compareFormat id fmt zone time  testCompareHashFormat :: [TestTree]-testCompareHashFormat = tgroup hashformats $ \fmt -> do-    time <- arbitrary-    zone <- arbitrary-    return $ compareFormat (fmap toLower) fmt zone time+testCompareHashFormat =+    tgroup hashformats $ \fmt -> do+        time <- arbitrary+        zone <- arbitrary+        return $ compareFormat (fmap toLower) fmt zone time  formatUnitTest :: String -> Pico -> String -> TestTree-formatUnitTest fmt sec expected = nameTest (show fmt) $ let-    tod = TimeOfDay 0 0 (1 + sec)-    found = formatTime locale fmt tod-    in assertEqual "" expected found+formatUnitTest fmt sec expected =+    nameTest (show fmt) $ let+        tod = TimeOfDay 0 0 (1 + sec)+        found = formatTime locale fmt tod+        in assertEqual "" expected found  testQs :: [TestTree]-testQs = [-    formatUnitTest "%q" 0 "000000000000",-    formatUnitTest "%q" 0.37 "370000000000",-    formatUnitTest "%0q" 0 "000000000000",-    formatUnitTest "%0q" 0.37 "370000000000",-    formatUnitTest "%_q" 0 "            ",-    formatUnitTest "%_q" 0.37 "37          ",-    formatUnitTest "%-q" 0 "",-    formatUnitTest "%-q" 0.37 "37",-    formatUnitTest "%1q" 0 "0",-    formatUnitTest "%1q" 0.37 "3",-    formatUnitTest "%01q" 0 "0",-    formatUnitTest "%01q" 0.37 "3",-    formatUnitTest "%_1q" 0 " ",-    formatUnitTest "%_1q" 0.37 "3",-    formatUnitTest "%-1q" 0 " ",-    formatUnitTest "%-1q" 0.37 "3",-    formatUnitTest "%5q" 0 "00000",-    formatUnitTest "%5q" 0.37 "37000",-    formatUnitTest "%05q" 0 "00000",-    formatUnitTest "%05q" 0.37 "37000",-    formatUnitTest "%_5q" 0 "     ",-    formatUnitTest "%_5q" 0.37 "37   ",-    formatUnitTest "%-5q" 0 "     ",-    formatUnitTest "%-5q" 0.37 "37   ",--    formatUnitTest "%Q" 0 "",-    formatUnitTest "%Q" 0.37 ".37",-    formatUnitTest "%0Q" 0 ".000000000000",-    formatUnitTest "%0Q" 0.37 ".370000000000",-    formatUnitTest "%_Q" 0 ".            ",-    formatUnitTest "%_Q" 0.37 ".37          ",-    formatUnitTest "%-Q" 0 "",-    formatUnitTest "%-Q" 0.37 ".37",-    formatUnitTest "%1Q" 0 ".0",-    formatUnitTest "%1Q" 0.37 ".3",-    formatUnitTest "%01Q" 0 ".0",-    formatUnitTest "%01Q" 0.37 ".3",-    formatUnitTest "%_1Q" 0 ". ",-    formatUnitTest "%_1Q" 0.37 ".3",-    formatUnitTest "%-1Q" 0 ". ",-    formatUnitTest "%-1Q" 0.37 ".3",-    formatUnitTest "%5Q" 0 ".00000",-    formatUnitTest "%5Q" 0.37 ".37000",-    formatUnitTest "%05Q" 0 ".00000",-    formatUnitTest "%05Q" 0.37 ".37000",-    formatUnitTest "%_5Q" 0 ".     ",-    formatUnitTest "%_5Q" 0.37 ".37   ",-    formatUnitTest "%-5Q" 0 ".     ",-    formatUnitTest "%-5Q" 0.37 ".37   "+testQs =+    [ formatUnitTest "%q" 0 "000000000000"+    , formatUnitTest "%q" 0.37 "370000000000"+    , formatUnitTest "%0q" 0 "000000000000"+    , formatUnitTest "%0q" 0.37 "370000000000"+    , formatUnitTest "%_q" 0 "            "+    , formatUnitTest "%_q" 0.37 "37          "+    , formatUnitTest "%-q" 0 ""+    , formatUnitTest "%-q" 0.37 "37"+    , formatUnitTest "%1q" 0 "0"+    , formatUnitTest "%1q" 0.37 "3"+    , formatUnitTest "%01q" 0 "0"+    , formatUnitTest "%01q" 0.37 "3"+    , formatUnitTest "%_1q" 0 " "+    , formatUnitTest "%_1q" 0.37 "3"+    , formatUnitTest "%-1q" 0 " "+    , formatUnitTest "%-1q" 0.37 "3"+    , formatUnitTest "%5q" 0 "00000"+    , formatUnitTest "%5q" 0.37 "37000"+    , formatUnitTest "%05q" 0 "00000"+    , formatUnitTest "%05q" 0.37 "37000"+    , formatUnitTest "%_5q" 0 "     "+    , formatUnitTest "%_5q" 0.37 "37   "+    , formatUnitTest "%-5q" 0 "     "+    , formatUnitTest "%-5q" 0.37 "37   "+    , formatUnitTest "%Q" 0 ""+    , formatUnitTest "%Q" 0.37 ".37"+    , formatUnitTest "%0Q" 0 ".000000000000"+    , formatUnitTest "%0Q" 0.37 ".370000000000"+    , formatUnitTest "%_Q" 0 ".            "+    , formatUnitTest "%_Q" 0.37 ".37          "+    , formatUnitTest "%-Q" 0 ""+    , formatUnitTest "%-Q" 0.37 ".37"+    , formatUnitTest "%1Q" 0 ".0"+    , formatUnitTest "%1Q" 0.37 ".3"+    , formatUnitTest "%01Q" 0 ".0"+    , formatUnitTest "%01Q" 0.37 ".3"+    , formatUnitTest "%_1Q" 0 ". "+    , formatUnitTest "%_1Q" 0.37 ".3"+    , formatUnitTest "%-1Q" 0 ". "+    , formatUnitTest "%-1Q" 0.37 ".3"+    , formatUnitTest "%5Q" 0 ".00000"+    , formatUnitTest "%5Q" 0.37 ".37000"+    , formatUnitTest "%05Q" 0 ".00000"+    , formatUnitTest "%05Q" 0.37 ".37000"+    , formatUnitTest "%_5Q" 0 ".     "+    , formatUnitTest "%_5Q" 0.37 ".37   "+    , formatUnitTest "%-5Q" 0 ".     "+    , formatUnitTest "%-5Q" 0.37 ".37   "     ]  testFormat :: TestTree-testFormat = localOption (QuickCheckTests 10000) $ testGroup "testFormat" $ testCompareFormat ++ testCompareHashFormat ++ testQs+testFormat =+    localOption (QuickCheckTests 10000) $ testGroup "testFormat" $ testCompareFormat ++ testCompareHashFormat ++ testQs
test/unix/Test/LocalTime/TimeZone.hs view
@@ -1,4 +1,6 @@-module Test.LocalTime.TimeZone(testTimeZone) where+module Test.LocalTime.TimeZone+    ( testTimeZone+    ) where  import Data.Time import System.Posix.Env (putEnv)@@ -6,10 +8,11 @@ import Test.Tasty.HUnit  testTimeZone :: TestTree-testTimeZone = testCase "getTimeZone respects TZ env var" $ do-    let epoch = UTCTime (ModifiedJulianDay 57000) 0-    putEnv "TZ=UTC+0"-    zone1 <- getTimeZone epoch-    putEnv "TZ=EST+5"-    zone2 <- getTimeZone epoch-    assertBool "zone not changed" $ zone1 /= zone2+testTimeZone =+    testCase "getTimeZone respects TZ env var" $ do+        let epoch = UTCTime (ModifiedJulianDay 57000) 0+        putEnv "TZ=UTC+0"+        zone1 <- getTimeZone epoch+        putEnv "TZ=EST+5"+        zone2 <- getTimeZone epoch+        assertBool "zone not changed" $ zone1 /= zone2
test/unix/Test/TestUtil.hs view
@@ -29,16 +29,17 @@ instance NameTest Result where     nameTest name = nameTest name . property -instance (Arbitrary a,Show a,Testable b) => NameTest (a -> b) where+instance (Arbitrary a, Show a, Testable b) => NameTest (a -> b) where     nameTest name = nameTest name . property  instance (Testable a) => NameTest (Gen a) where     nameTest name = nameTest name . property -tgroup :: (Show a,NameTest t) => [a] -> (a -> t) -> [TestTree]+tgroup :: (Show a, NameTest t) => [a] -> (a -> t) -> [TestTree] tgroup aa f = fmap (\a -> nameTest (show a) $ f a) aa -assertEqualQC :: (Show a,Eq a) => String -> a -> a -> Result-assertEqualQC _name expected found | expected == found = succeeded-assertEqualQC "" expected found = failed{reason="expected "++show expected++", found "++show found}-assertEqualQC name expected found = failed{reason=name++": expected "++show expected++", found "++show found}+assertEqualQC :: (Show a, Eq a) => String -> a -> a -> Result+assertEqualQC _name expected found+    | expected == found = succeeded+assertEqualQC "" expected found = failed {reason = "expected " ++ show expected ++ ", found " ++ show found}+assertEqualQC name expected found = failed {reason = name ++ ": expected " ++ show expected ++ ", found " ++ show found}
time.cabal view
@@ -1,5 +1,5 @@ name:           time-version:        1.9.3+version:        1.10 stability:      stable license:        BSD3 license-file:   LICENSE@@ -12,7 +12,7 @@ category:       Time build-type:     Configure cabal-version:  >=1.10-tested-with:    GHC == 8.0.1, GHC == 7.10.3, GHC == 7.8.4+tested-with:    GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5 x-follows-version-policy:  extra-source-files:@@ -45,7 +45,7 @@     ghc-options: -Wall -fwarn-tabs     c-sources: lib/cbits/HsTime.c     build-depends:-        base >= 4.7 && < 5,+        base >= 4.9 && < 5,         deepseq >= 1.1     if os(windows)         build-depends: Win32@@ -139,6 +139,7 @@         tasty-quickcheck     main-is: Main.hs     other-modules:+        Test.Types         Test.TestUtil         Test.Arbitrary         Test.Calendar.AddDays@@ -160,6 +161,7 @@         Test.Clock.Conversion         Test.Clock.Resolution         Test.Clock.TAI+        Test.Format.Compile         Test.Format.Format         Test.Format.ParseTime         Test.Format.ISO8601