utc 0.2.0.0 → 0.2.0.1
raw patch · 4 files changed
+49/−49 lines, 4 filesdep ~attoparsecdep ~basedep ~bytestring
Dependency ranges changed: attoparsec, base, bytestring, clock, exceptions, text
Files
- Data/UTC/Internal.hs +8/−8
- Data/UTC/Type/DateTime.hs +21/−21
- Data/UTC/Type/Local.hs +12/−12
- utc.cabal +8/−8
Data/UTC/Internal.hs view
@@ -167,8 +167,8 @@ = (y `mod` 4 == 0) && ((y `mod` 400 == 0) || (y `mod` 100 /= 0)) fixedDecimal :: Integer -> Integer -> String-fixedDecimal digits i- = f digits i []+fixedDecimal digits j+ = f digits j [] where f n i accum | n <= 0 = accum | otherwise = f (n - 1) (i `div` 10)@@ -180,13 +180,13 @@ decimalFraction limit r = '.':(df limit r) where- df limit 0+ df _ 0 = "" df 0 _ = "..."- df limit r- = ch:(df (limit - 1) r')+ df limit' r'+ = ch:(df (limit' - 1) s) where- r10 = r * 10- ch = toEnum $ fromIntegral $ 48 + (truncate $ r10) `mod` 10- r' = r10 - (truncate r10 % 1)+ r10 = r' * 10+ ch = toEnum $ fromIntegral $ 48 + (truncate $ r10) `mod` (10 :: Integer)+ s = r10 - (truncate r10 % 1)
Data/UTC/Type/DateTime.hs view
@@ -119,23 +119,23 @@ = day $ fromMaybe undefined $ addSecondFractions o t setYear h (Local o@Nothing t)- = Local o <$> setYear h t+ = setYear h t >>= return . Local o setYear h (Local o@(Just 0) t)- = Local o <$> setYear h t+ = setYear h t >>= return . Local o setYear h (Local o@(Just i) t)- = Local o <$> ( addSecondFractions i t >>= setYear h >>= addSecondFractions (negate i) )+ = addSecondFractions i t >>= setYear h >>= addSecondFractions (negate i) >>= return . Local o setMonth h (Local o@Nothing t)- = Local o <$> setMonth h t+ = setMonth h t >>= return . Local o setMonth h (Local o@(Just 0) t)- = Local o <$> setMonth h t+ = setMonth h t >>= return . Local o setMonth h (Local o@(Just i) t)- = Local o <$> ( addSecondFractions i t >>= setMonth h >>= addSecondFractions (negate i) )+ = addSecondFractions i t >>= setMonth h >>= addSecondFractions (negate i) >>= return . Local o setDay h (Local o@Nothing t)- = Local o <$> setDay h t+ = setDay h t >>= return . Local o setDay h (Local o@(Just 0) t)- = Local o <$> setDay h t+ = setDay h t >>= return . Local o setDay h (Local o@(Just i) t)- = Local o <$> ( addSecondFractions i t >>= setDay h >>= addSecondFractions (negate i) )+ = addSecondFractions i t >>= setDay h >>= addSecondFractions (negate i) >>= return . Local o -- assumption: addSecondFractions for DateTime is always successful instance IsTime (Local DateTime) where@@ -168,29 +168,29 @@ = secondFraction $ fromMaybe undefined $ addSecondFractions o t setHour h (Local o@Nothing t)- = Local o <$> setHour h t+ = setHour h t >>= return . Local o setHour h (Local o@(Just 0) t)- = Local o <$> setHour h t+ = setHour h t >>= return . Local o setHour h (Local o@(Just i) t)- = Local o <$> ( addSecondFractions i t >>= setHour h >>= addSecondFractions (negate i) )+ = addSecondFractions i t >>= setHour h >>= addSecondFractions (negate i) >>= return . Local o setMinute h (Local o@Nothing t)- = Local o <$> setMinute h t+ = setMinute h t >>= return . Local o setMinute h (Local o@(Just 0) t)- = Local o <$> setMinute h t+ = setMinute h t >>= return . Local o setMinute h (Local o@(Just i) t)- = Local o <$> ( addSecondFractions i t >>= setMinute h >>= addSecondFractions (negate i) )+ = addSecondFractions i t >>= setMinute h >>= addSecondFractions (negate i) >>= return . Local o setSecond h (Local o@Nothing t)- = Local o <$> setSecond h t+ = setSecond h t >>= return . Local o setSecond h (Local o@(Just 0) t)- = Local o <$> setSecond h t+ = setSecond h t >>= return . Local o setSecond h (Local o@(Just i) t)- = Local o <$> ( addSecondFractions i t >>= setSecond h >>= addSecondFractions (negate i) )+ = addSecondFractions i t >>= setSecond h >>= addSecondFractions (negate i) >>= return . Local o setSecondFraction h (Local o@Nothing t)- = Local o <$> setSecondFraction h t+ = setSecondFraction h t >>= return . Local o setSecondFraction h (Local o@(Just 0) t)- = Local o <$> setSecondFraction h t+ = setSecondFraction h t >>= return . Local o setSecondFraction h (Local o@(Just i) t)- = Local o <$> ( addSecondFractions i t >>= setSecondFraction h >>= addSecondFractions (negate i) )+ = addSecondFractions i t >>= setSecondFraction h >>= addSecondFractions (negate i) >>= return . Local o -- This one is necessary to override, because the overflow should -- ripple into the date part.
Data/UTC/Type/Local.hs view
@@ -77,26 +77,26 @@ = secondFraction $ fromMaybe undefined $ addSecondFractions o t setHour h (Local o@Nothing t)- = Local o <$> setHour h t+ = setHour h t >>= return . Local o setHour h (Local o@(Just 0) t)- = Local o <$> setHour h t+ = setHour h t >>= return . Local o setHour h (Local o@(Just i) t)- = Local o <$> ( addSecondFractions i t >>= setHour h >>= addSecondFractions (negate i) )+ = addSecondFractions i t >>= setHour h >>= addSecondFractions (negate i) >>= return . Local o setMinute h (Local o@Nothing t)- = Local o <$> setMinute h t+ = setMinute h t >>= return . Local o setMinute h (Local o@(Just 0) t)- = Local o <$> setMinute h t+ = setMinute h t >>= return . Local o setMinute h (Local o@(Just i) t)- = Local o <$> ( addSecondFractions i t >>= setMinute h >>= addSecondFractions (negate i) )+ = addSecondFractions i t >>= setMinute h >>= addSecondFractions (negate i) >>= return . Local o setSecond h (Local o@Nothing t)- = Local o <$> setSecond h t+ = setSecond h t >>= return . Local o setSecond h (Local o@(Just 0) t)- = Local o <$> setSecond h t+ = setSecond h t >>= return . Local o setSecond h (Local o@(Just i) t)- = Local o <$> ( addSecondFractions i t >>= setSecond h >>= addSecondFractions (negate i) )+ = addSecondFractions i t >>= setSecond h >>= addSecondFractions (negate i) >>= return . Local o setSecondFraction h (Local o@Nothing t)- = Local o <$> setSecondFraction h t+ = setSecondFraction h t >>= return . Local o setSecondFraction h (Local o@(Just 0) t)- = Local o <$> setSecondFraction h t+ = setSecondFraction h t >>= return . Local o setSecondFraction h (Local o@(Just i) t)- = Local o <$> ( addSecondFractions i t >>= setSecondFraction h >>= addSecondFractions (negate i) )+ = addSecondFractions i t >>= setSecondFraction h >>= addSecondFractions (negate i) >>= return . Local o
utc.cabal view
@@ -1,5 +1,5 @@ name: utc-version: 0.2.0.0+version: 0.2.0.1 stability: experimental synopsis: A pragmatic time and date library. description: This library aims to supply you with common@@ -15,7 +15,7 @@ specific or maybe more efficient time and date types. Implement the interfaces and get all the parsing and rendering functions for free! .- Bug reports or (even better) tests are welcome.+ Bug reports or (even better) tests are appreciated. license: MIT license-file: LICENSE author: Lars Petersen@@ -28,12 +28,12 @@ cabal-version: >=1.10 Library- build-depends: base < 5- , text- , bytestring >= 0.10.4.0- , attoparsec- , clock >= 0.3 && < 0.5- , exceptions >= 0.4+ build-depends: base >= 4.7 && < 5+ , bytestring >= 0.10.4.0 && < 1+ , text >= 1.0 && < 2+ , attoparsec >= 0.12 && < 1+ , clock >= 0.3 && < 1+ , exceptions >= 0.4 && < 1 ghc-options: -Wall hs-source-dirs: . default-language: Haskell98