time 1.8.0.3 → 1.8.0.4
raw patch · 11 files changed
+47/−16 lines, 11 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- changelog.md +4/−0
- configure.ac +1/−1
- lib/Data/Time/Calendar/Private.hs +16/−7
- lib/Data/Time/Format.hs +1/−1
- lib/Data/Time/Format/Parse.hs +7/−0
- test/main/Test/Format/ParseTime.hs +3/−3
- test/main/Test/LocalTime/Time.hs +3/−1
- test/main/Test/LocalTime/TimeRef.hs +9/−0
- test/main/Test/TestUtil.hs +1/−1
- test/unix/Test/TestUtil.hs +1/−1
- time.cabal +1/−1
changelog.md view
@@ -1,5 +1,9 @@ # Change Log +## [1.8.0.4]+- Fix "show minBound" bug+- haddock: example for parseTimeM+ ## [1.8.0.3] - Add "Quick start" documentation
configure.ac view
@@ -1,4 +1,4 @@-AC_INIT([Haskell time package], [1.8.0.3], [ashley@semantic.org], [time])+AC_INIT([Haskell time package], [1.8.0.4], [ashley@semantic.org], [time]) # Safety check: Ensure that we are in the correct source directory. AC_CONFIG_SRCDIR([lib/include/HsTime.h])
lib/Data/Time/Calendar/Private.hs view
@@ -9,22 +9,31 @@ showPadded NoPad s = s showPadded (Pad i c) s = replicate (i - length s) c ++ s -showPaddedNum :: (Num t,Ord t,Show t) => PadOption -> t -> String-showPaddedNum NoPad i = show i-showPaddedNum pad i | i < 0 = '-':(showPaddedNum pad (negate i))-showPaddedNum pad i = showPadded pad $ show i+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 = 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 = showPadded pad $ show i+ show2Fixed :: Pico -> String show2Fixed x | x < 10 = '0':(showFixed True x) show2Fixed x = showFixed True x -show2 :: (Num t,Ord t,Show t) => t -> String+show2 :: (ShowPadded t) => t -> String show2 = showPaddedNum $ Pad 2 '0' -show3 :: (Num t,Ord t,Show t) => t -> String+show3 :: (ShowPadded t) => t -> String show3 = showPaddedNum $ Pad 3 '0' -show4 :: (Num t,Ord t,Show t) => t -> String+show4 :: (ShowPadded t) => t -> String show4 = showPaddedNum $ Pad 4 '0' mod100 :: (Integral i) => i -> i
lib/Data/Time/Format.hs view
@@ -52,7 +52,7 @@ padString :: (TimeLocale -> t -> String) -> (TimeLocale -> Maybe NumericPadOption -> Maybe Int -> t -> String) padString ff = padGeneral False False 1 ' ' $ \locale pado -> showPadded pado . ff locale -padNum :: (Show i,Ord i,Num i) => Bool -> Int -> Char -> (t -> i) -> (TimeLocale -> Maybe NumericPadOption -> Maybe Int -> t -> String)+padNum :: (ShowPadded i) => Bool -> Int -> Char -> (t -> i) -> (TimeLocale -> Maybe NumericPadOption -> Maybe Int -> t -> String) padNum fdef idef cdef ff = padGeneral False fdef idef cdef $ \_ pado -> showPaddedNum pado . ff -- <http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html>
lib/Data/Time/Format/Parse.hs view
@@ -92,6 +92,13 @@ -- -- [@%0f@] accepts exactly two digits. --+-- For example, to parse a date in YYYY-MM-DD format, while allowing the month+-- and date to have optional leading zeros (notice the @-@ modifier used for @%m@+-- and @%d@):+--+-- > Prelude Data.Time> parseTimeM True defaultTimeLocale "%Y-%-m-%-d" "2010-3-04" :: Maybe Day+-- > Just 2010-03-04+-- parseTimeM :: (Monad m,ParseTime t) => Bool -- ^ Accept leading and trailing whitespace? -> TimeLocale -- ^ Time locale.
test/main/Test/Format/ParseTime.hs view
@@ -61,7 +61,7 @@ found = reads target result = assertEqual "" expected found name = show target- in testCase name result+ in Test.Tasty.HUnit.testCase name result readTestsParensSpaces :: forall a. (Eq a,Show a,Read a) => a -> String -> TestTree readTestsParensSpaces expected target = testGroup target@@ -127,7 +127,7 @@ found = readSTime False defaultTimeLocale formatStr target result = assertEqual "" expected found name = (show formatStr) ++ " of " ++ (show target)- in testCase name result+ in Test.Tasty.HUnit.testCase name result spacingTests :: (Show t, Eq t, ParseTime t) => t -> String -> String -> TestTree spacingTests expected formatStr target = testGroup "particular"@@ -198,7 +198,7 @@ found = parse sp formatStr target result = assertEqual "" expected found name = (show formatStr) ++ " of " ++ (show target) ++ (if sp then " allowing spaces" else "")- in testCase name result+ 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,"")]
test/main/Test/LocalTime/Time.hs view
@@ -100,7 +100,9 @@ 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 12 34 56.789123456789+ , show $ f $ TimeOfDay minBound 0 0+ ] testTime :: TestTree testTime = testCase "testTime" $
test/main/Test/LocalTime/TimeRef.hs view
@@ -1,5 +1,13 @@ module Test.LocalTime.TimeRef where +import Data.Int++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 [@@ -878,4 +886,5 @@ ,"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
@@ -21,7 +21,7 @@ nameTest = testGroup instance NameTest Assertion where- nameTest = testCase+ nameTest = Test.Tasty.HUnit.testCase instance NameTest Property where nameTest = testProperty
test/unix/Test/TestUtil.hs view
@@ -21,7 +21,7 @@ nameTest = testGroup instance NameTest Assertion where- nameTest = testCase+ nameTest = Test.Tasty.HUnit.testCase instance NameTest Property where nameTest = testProperty
time.cabal view
@@ -1,5 +1,5 @@ name: time-version: 1.8.0.3+version: 1.8.0.4 stability: stable license: BSD3 license-file: LICENSE