attoparsec-iso8601 1.0.0.0 → 1.0.1.0
raw patch · 3 files changed
+37/−15 lines, 3 filesdep ~attoparsecdep ~base-compatPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: attoparsec, base-compat
API changes (from Hackage documentation)
Files
Data/Attoparsec/Time.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE BangPatterns #-}+{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE ScopedTypeVariables #-}- -- | -- Module: Data.Aeson.Parser.Time -- Copyright: (c) 2015-2016 Bryan O'Sullivan@@ -21,7 +21,6 @@ , zonedTime ) where -import Prelude () import Prelude.Compat import Control.Applicative ((<|>))@@ -42,9 +41,9 @@ day :: Parser Day day = do absOrNeg <- negate <$ char '-' <|> id <$ char '+' <|> pure id- y <- decimal <* char '-'- m <- twoDigits <* char '-'- d <- twoDigits+ y <- (decimal <* char '-') <|> fail "date must be of form [+,-]YYYY-MM-DD"+ m <- (twoDigits <* char '-') <|> fail "date must be of form [+,-]YYYY-MM-DD"+ d <- twoDigits <|> fail "date must be of form [+,-]YYYY-MM-DD" maybe (fail "invalid date") return (fromGregorianValid (absOrNeg y) m d) -- | Parse a two-digit integer (e.g. day of month, hour).
Data/Attoparsec/Time/Internal.hs view
@@ -1,5 +1,5 @@ {-# LANGUAGE CPP #-}-+{-# LANGUAGE NoImplicitPrelude #-} -- | -- Module: Data.Aeson.Internal.Time -- Copyright: (c) 2015-2016 Bryan O'Sullivan@@ -17,17 +17,37 @@ , toTimeOfDay64 ) where -import Prelude () import Prelude.Compat import Data.Int (Int64) import Data.Time import Unsafe.Coerce (unsafeCoerce) +#if MIN_VERSION_time(1,6,0)++import Data.Time.Clock (diffTimeToPicoseconds)++#endif+ #if MIN_VERSION_base(4,7,0) import Data.Fixed (Pico, Fixed(MkFixed)) +#else++import Data.Fixed (Pico)++#endif++#if !MIN_VERSION_time(1,6,0)++diffTimeToPicoseconds :: DiffTime -> Integer+diffTimeToPicoseconds = unsafeCoerce++#endif++#if MIN_VERSION_base(4,7,0)+ toPico :: Integer -> Pico toPico = MkFixed @@ -36,8 +56,6 @@ #else -import Data.Fixed (Pico)- toPico :: Integer -> Pico toPico = unsafeCoerce @@ -51,11 +69,16 @@ {-# UNPACK #-} !Int {-# UNPACK #-} !Int64 +posixDayLength :: DiffTime+posixDayLength = 86400+ diffTimeOfDay64 :: DiffTime -> TimeOfDay64-diffTimeOfDay64 t = TOD (fromIntegral h) (fromIntegral m) s- where (h,mp) = fromIntegral pico `quotRem` 3600000000000000- (m,s) = mp `quotRem` 60000000000000- pico = unsafeCoerce t :: Integer+diffTimeOfDay64 t+ | t >= posixDayLength = TOD 23 59 (60000000000000 + pico (t - posixDayLength))+ | otherwise = TOD (fromIntegral h) (fromIntegral m) s+ where (h,mp) = pico t `quotRem` 3600000000000000+ (m,s) = mp `quotRem` 60000000000000+ pico = fromIntegral . diffTimeToPicoseconds toTimeOfDay64 :: TimeOfDay -> TimeOfDay64 toTimeOfDay64 (TimeOfDay h m s) = TOD h m (fromIntegral (fromPico s))
attoparsec-iso8601.cabal view
@@ -1,5 +1,5 @@ name: attoparsec-iso8601-version: 1.0.0.0+version: 1.0.1.0 synopsis: Parsing of ISO 8601 dates, originally from aeson. description: Parsing of ISO 8601 dates, originally from aeson. license: BSD3@@ -37,7 +37,7 @@ build-depends: attoparsec >= 0.13.0.1, base >= 4.5 && < 5,- base-compat >= 0.9.1 && < 0.10,+ base-compat >= 0.9.1 && < 0.11, text >= 1.1.1.0, time >= 1.1.1.4