module Attoparsec.Time.Pure where import Attoparsec.Time.Prelude import qualified Data.ByteString as A {-# INLINE timeZone #-} timeZone :: Bool -> Int -> Int -> TimeZone timeZone :: Bool -> Int -> Int -> TimeZone timeZone Bool positive Int hour Int minute = Int -> TimeZone minutesToTimeZone forall a b. (a -> b) -> a -> b $ forall a. a -> a -> Bool -> a bool forall a. Num a => a -> a negate forall {k} (cat :: k -> k -> *) (a :: k). Category cat => cat a a id Bool positive forall a b. (a -> b) -> a -> b $ Int hour forall a. Num a => a -> a -> a * Int 60 forall a. Num a => a -> a -> a + Int minute {-# INLINE day #-} day :: Int -> Int -> Int -> Day day :: Int -> Int -> Int -> Day day Int y Int m Int d = Year -> Int -> Int -> Day fromGregorian (forall a b. (Integral a, Num b) => a -> b fromIntegral Int y) Int m Int d {-# INLINE timeOfDay #-} timeOfDay :: Int -> Int -> Pico -> TimeOfDay timeOfDay :: Int -> Int -> Pico -> TimeOfDay timeOfDay = Int -> Int -> Pico -> TimeOfDay TimeOfDay {-# INLINE zonedTime #-} zonedTime :: Day -> TimeOfDay -> TimeZone -> ZonedTime zonedTime :: Day -> TimeOfDay -> TimeZone -> ZonedTime zonedTime Day day TimeOfDay tod TimeZone tz = LocalTime -> TimeZone -> ZonedTime ZonedTime (Day -> TimeOfDay -> LocalTime LocalTime Day day TimeOfDay tod) TimeZone tz {-# INLINE utcTimeFromDayAndTimeOfDay #-} utcTimeFromDayAndTimeOfDay :: Day -> TimeOfDay -> TimeZone -> UTCTime utcTimeFromDayAndTimeOfDay :: Day -> TimeOfDay -> TimeZone -> UTCTime utcTimeFromDayAndTimeOfDay Day day TimeOfDay tod TimeZone tz = ZonedTime -> UTCTime zonedTimeToUTC (Day -> TimeOfDay -> TimeZone -> ZonedTime zonedTime Day day TimeOfDay tod TimeZone tz) {-# INLINE utcTimeFromComponents #-} utcTimeFromComponents :: Int -> Int -> Int -> Int -> Int -> Int -> Int -> TimeZone -> UTCTime utcTimeFromComponents :: Int -> Int -> Int -> Int -> Int -> Int -> Int -> TimeZone -> UTCTime utcTimeFromComponents Int year Int month Int day Int hour Int minute Int second Int millisecond TimeZone timeZone = forall a. HasCallStack => a undefined {-# INLINE decimalFromBytes #-} decimalFromBytes :: (Integral decimal) => A.ByteString -> decimal decimalFromBytes :: forall decimal. Integral decimal => ByteString -> decimal decimalFromBytes = forall a. (a -> Word8 -> a) -> a -> ByteString -> a A.foldl' forall {a} {a}. (Integral a, Num a) => a -> a -> a step decimal 0 where step :: a -> a -> a step a a a b = a a forall a. Num a => a -> a -> a * a 10 forall a. Num a => a -> a -> a + forall a b. (Integral a, Num b) => a -> b fromIntegral a b forall a. Num a => a -> a -> a - a 48 {-# INLINE word8IsAsciiDigit #-} word8IsAsciiDigit :: Word8 -> Bool word8IsAsciiDigit :: Word8 -> Bool word8IsAsciiDigit Word8 w = Word8 w forall a. Num a => a -> a -> a - Word8 48 forall a. Ord a => a -> a -> Bool <= Word8 9 {-# INLINE word8IsAsciiAlpha #-} word8IsAsciiAlpha :: Word8 -> Bool word8IsAsciiAlpha :: Word8 -> Bool word8IsAsciiAlpha Word8 x = (Word8 x forall a. Num a => a -> a -> a - Word8 97 forall a. Ord a => a -> a -> Bool <= Word8 25) Bool -> Bool -> Bool || (Word8 x forall a. Num a => a -> a -> a - Word8 65 forall a. Ord a => a -> a -> Bool <= Word8 25)