    {-# LANGUAGE CPP #-}
    {-# LANGUAGE RankNTypes #-}
    {-# LANGUAGE RecordWildCards #-}
    {-# LANGUAGE StandaloneDeriving #-}
    {-# LANGUAGE ViewPatterns #-}
    {-# OPTIONS_GHC -fno-warn-orphans #-}
    #include "thyme.h"

    module Data.Thyme.Format
        ( FormatTime (..)
        , formatTime
        , ParseTime (..)
        , parseTime
        , readTime
        , readsTime
        , TimeParse (..)
        , timeParser
        ) where

    import Prelude
    import Control.Applicative
    #if SHOW_INTERNAL
    import Control.Arrow
    #endif
    import Control.Lens
    import Control.Monad.Trans
    import Control.Monad.State.Strict
    import Data.Attoparsec.ByteString.Char8 (Parser)
    import qualified Data.Attoparsec.ByteString.Char8 as P
    import Data.Bits
    import qualified Data.ByteString.Char8 as S
    import Data.Char
    import Data.Int
    import Data.Thyme.Internal.Micro
    import Data.Thyme.Calendar
    import Data.Thyme.Calendar.Internal
    import Data.Thyme.Clock.Internal
    import Data.Thyme.Clock.POSIX
    import Data.Thyme.Clock.TAI
    import Data.Thyme.Format.Internal
    import Data.Thyme.LocalTime
    import Data.VectorSpace
    import System.Locale

    class FormatTime t where
        showsTime :: TimeLocale -> t -> (Char -> ShowS) -> Char -> ShowS

    {-# INLINEABLE formatTime #-}
    formatTime :: (FormatTime t) => TimeLocale -> String -> t -> String
    formatTime :: TimeLocale -> String -> t -> String
    formatTime l :: TimeLocale
    l@TimeLocale {..} spec :: String
    spec t :: t
    t = String -> String -> String
    go String
    spec "" where
        -- leave unrecognised codes as they are
        format :: Char -> String -> String
    format = TimeLocale
    -> t -> (Char -> String -> String) -> Char -> String -> String
    forall t.
    FormatTime t =>
    TimeLocale
    -> t -> (Char -> String -> String) -> Char -> String -> String
    showsTime TimeLocale
    l t
    t (\ c :: Char
    c s :: String
    s -> '%' Char -> String -> String
    forall a. a -> [a] -> [a]
    : Char
    c Char -> String -> String
    forall a. a -> [a] -> [a]
    : String
    s)
        go :: String -> String -> String
    go s :: String
    s = case String
    s of
            '%' : c :: Char
    c : rest :: String
    rest -> case Char
    c of
                -- aggregate
                'c' -> String -> String -> String
    go (String
    dateTimeFmt String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    rest)
                'r' -> String -> String -> String
    go (String
    time12Fmt String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    rest)
                'X' -> String -> String -> String
    go (String
    timeFmt String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    rest)
                'x' -> String -> String -> String
    go (String
    dateFmt String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    rest)
                -- modifier (whatever)
                '-' -> String -> String -> String
    go ('%' Char -> String -> String
    forall a. a -> [a] -> [a]
    : String
    rest)
                '_' -> String -> String -> String
    go ('%' Char -> String -> String
    forall a. a -> [a] -> [a]
    : String
    rest)
                '0' -> String -> String -> String
    go ('%' Char -> String -> String
    forall a. a -> [a] -> [a]
    : String
    rest)
                '^' -> String -> String -> String
    go ('%' Char -> String -> String
    forall a. a -> [a] -> [a]
    : String
    rest)
                '#' -> String -> String -> String
    go ('%' Char -> String -> String
    forall a. a -> [a] -> [a]
    : String
    rest)
                -- escape (why would anyone need %t and %n?)
                '%' -> (:) '%' (String -> String) -> (String -> String) -> String -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> String -> String
    go String
    rest
                -- default
                _ -> Char -> String -> String
    format Char
    c (String -> String) -> (String -> String) -> String -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> String -> String
    go String
    rest
            c :: Char
    c : rest :: String
    rest -> (:) Char
    c (String -> String) -> (String -> String) -> String -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> String -> String
    go String
    rest
            [] -> String -> String
    forall a. a -> a
    id

    {-# INLINE showsY #-}
    showsY :: Year -> ShowS
    #if BUG_FOR_BUG
    showsY :: Int -> String -> String
    showsY = Int -> String -> String
    forall a. Show a => a -> String -> String
    shows
    #else
    -- ISO 8601 says minimum of 4 digits, even for first millennium.
    showsY = showsYear
    #endif

    instance FormatTime TimeOfDay where
        {-# INLINEABLE showsTime #-}
        showsTime :: TimeLocale
    -> TimeOfDay
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    showsTime TimeLocale {..} (TimeOfDay h :: Int
    h m :: Int
    m (DiffTime s :: Micro
    s)) = \ def :: Char -> String -> String
    def c :: Char
    c -> case Char
    c of
            -- aggregate
            'R' -> Int -> String -> String
    shows02 Int
    h (String -> String) -> (String -> String) -> String -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (:) ':' (String -> String) -> (String -> String) -> String -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> String -> String
    shows02 Int
    m
            'T' -> Int -> String -> String
    shows02 Int
    h (String -> String) -> (String -> String) -> String -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (:) ':' (String -> String) -> (String -> String) -> String -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> String -> String
    shows02 Int
    m (String -> String) -> (String -> String) -> String -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (:) ':' (String -> String) -> (String -> String) -> String -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> String -> String
    shows02 Int
    si
            -- AM/PM
            'P' -> String -> String -> String
    forall a. [a] -> [a] -> [a]
    (++) (String -> String -> String) -> String -> String -> String
    forall a b. (a -> b) -> a -> b
    $ Char -> Char
    toLower (Char -> Char) -> String -> String
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> if Int
    h Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    < 12 then (String, String) -> String
    forall a b. (a, b) -> a
    fst (String, String)
    amPm else (String, String) -> String
    forall a b. (a, b) -> b
    snd (String, String)
    amPm
            'p' -> String -> String -> String
    forall a. [a] -> [a] -> [a]
    (++) (String -> String -> String) -> String -> String -> String
    forall a b. (a -> b) -> a -> b
    $ if Int
    h Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    < 12 then (String, String) -> String
    forall a b. (a, b) -> a
    fst (String, String)
    amPm else (String, String) -> String
    forall a b. (a, b) -> b
    snd (String, String)
    amPm
            -- Hour
            'H' -> Int -> String -> String
    shows02 Int
    h
            'I' -> Int -> String -> String
    shows02 (Int -> String -> String) -> Int -> String -> String
    forall a b. (a -> b) -> a -> b
    $ 1 Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int -> Int -> Int
    forall a. Integral a => a -> a -> a
    mod (Int
    h Int -> Int -> Int
    forall a. Num a => a -> a -> a
    - 1) 12
            'k' -> Int -> String -> String
    shows_2 Int
    h
            'l' -> Int -> String -> String
    shows_2 (Int -> String -> String) -> Int -> String -> String
    forall a b. (a -> b) -> a -> b
    $ 1 Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int -> Int -> Int
    forall a. Integral a => a -> a -> a
    mod (Int
    h Int -> Int -> Int
    forall a. Num a => a -> a -> a
    - 1) 12
            -- Minute
            'M' -> Int -> String -> String
    shows02 Int
    m
            -- Second
            'S' -> Int -> String -> String
    shows02 Int
    si
            'q' -> Int64 -> String -> String
    fills06 Int64
    su (String -> String) -> (String -> String) -> String -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int64 -> String -> String
    forall a. Show a => a -> String -> String
    shows Int64
    su (String -> String) -> (String -> String) -> String -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> String -> String
    forall a. [a] -> [a] -> [a]
    (++) "000000"
            'Q' -> if Int64
    su Int64 -> Int64 -> Bool
    forall a. Eq a => a -> a -> Bool
    == 0 then String -> String
    forall a. a -> a
    id else (:) '.' (String -> String) -> (String -> String) -> String -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int64 -> String -> String
    fills06 Int64
    su (String -> String) -> (String -> String) -> String -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int64 -> String -> String
    drops0 Int64
    su
            -- default
            _ -> Char -> String -> String
    def Char
    c
            where (Int64 -> Int
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral -> Int
    si, Micro su :: Int64
    su) = Micro -> Micro -> (Int64, Micro)
    microQuotRem Micro
    s (Int64 -> Micro
    Micro 1000000)

    instance FormatTime YearMonthDay where
        {-# INLINEABLE showsTime #-}
        showsTime :: TimeLocale
    -> YearMonthDay
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    showsTime TimeLocale {..} (YearMonthDay y :: Int
    y m :: Int
    m d :: Int
    d) = \ def :: Char -> String -> String
    def c :: Char
    c -> case Char
    c of
            -- aggregate
            'D' -> Int -> String -> String
    shows02 Int
    m (String -> String) -> (String -> String) -> String -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (:) '/' (String -> String) -> (String -> String) -> String -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> String -> String
    shows02 Int
    d (String -> String) -> (String -> String) -> String -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (:) '/' (String -> String) -> (String -> String) -> String -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> String -> String
    shows02 (Int -> Int -> Int
    forall a. Integral a => a -> a -> a
    mod Int
    y 100)
            'F' -> Int -> String -> String
    showsY Int
    y (String -> String) -> (String -> String) -> String -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (:) '-' (String -> String) -> (String -> String) -> String -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> String -> String
    shows02 Int
    m (String -> String) -> (String -> String) -> String -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (:) '-' (String -> String) -> (String -> String) -> String -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> String -> String
    shows02 Int
    d
            -- Year
            'Y' -> Int -> String -> String
    showsY Int
    y
            'y' -> Int -> String -> String
    shows02 (Int -> Int -> Int
    forall a. Integral a => a -> a -> a
    mod Int
    y 100)
            'C' -> Int -> String -> String
    shows02 (Int -> Int -> Int
    forall a. Integral a => a -> a -> a
    div Int
    y 100)
            -- Month
            'B' -> String -> String -> String
    forall a. [a] -> [a] -> [a]
    (++) (String -> String -> String)
    -> ((String, String) -> String)
    -> (String, String)
    -> String
    -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (String, String) -> String
    forall a b. (a, b) -> a
    fst ((String, String) -> String -> String)
    -> (String, String) -> String -> String
    forall a b. (a -> b) -> a -> b
    $ [(String, String)]
    months [(String, String)] -> Int -> (String, String)
    forall a. [a] -> Int -> a
    !! (Int
    m Int -> Int -> Int
    forall a. Num a => a -> a -> a
    - 1)
            'b' -> String -> String -> String
    forall a. [a] -> [a] -> [a]
    (++) (String -> String -> String)
    -> ((String, String) -> String)
    -> (String, String)
    -> String
    -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (String, String) -> String
    forall a b. (a, b) -> b
    snd ((String, String) -> String -> String)
    -> (String, String) -> String -> String
    forall a b. (a -> b) -> a -> b
    $ [(String, String)]
    months [(String, String)] -> Int -> (String, String)
    forall a. [a] -> Int -> a
    !! (Int
    m Int -> Int -> Int
    forall a. Num a => a -> a -> a
    - 1)
            'h' -> String -> String -> String
    forall a. [a] -> [a] -> [a]
    (++) (String -> String -> String)
    -> ((String, String) -> String)
    -> (String, String)
    -> String
    -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (String, String) -> String
    forall a b. (a, b) -> b
    snd ((String, String) -> String -> String)
    -> (String, String) -> String -> String
    forall a b. (a -> b) -> a -> b
    $ [(String, String)]
    months [(String, String)] -> Int -> (String, String)
    forall a. [a] -> Int -> a
    !! (Int
    m Int -> Int -> Int
    forall a. Num a => a -> a -> a
    - 1)
            'm' -> Int -> String -> String
    shows02 Int
    m
            -- DayOfMonth
            'd' -> Int -> String -> String
    shows02 Int
    d
            'e' -> Int -> String -> String
    shows_2 Int
    d
            -- default
            _ -> Char -> String -> String
    def Char
    c

    instance FormatTime MonthDay where
        {-# INLINEABLE showsTime #-}
        showsTime :: TimeLocale
    -> MonthDay
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    showsTime TimeLocale {..} (MonthDay m :: Int
    m d :: Int
    d) = \ def :: Char -> String -> String
    def c :: Char
    c -> case Char
    c of
            -- Month
            'B' -> String -> String -> String
    forall a. [a] -> [a] -> [a]
    (++) (String -> String -> String)
    -> ((String, String) -> String)
    -> (String, String)
    -> String
    -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (String, String) -> String
    forall a b. (a, b) -> a
    fst ((String, String) -> String -> String)
    -> (String, String) -> String -> String
    forall a b. (a -> b) -> a -> b
    $ [(String, String)]
    months [(String, String)] -> Int -> (String, String)
    forall a. [a] -> Int -> a
    !! (Int
    m Int -> Int -> Int
    forall a. Num a => a -> a -> a
    - 1)
            'b' -> String -> String -> String
    forall a. [a] -> [a] -> [a]
    (++) (String -> String -> String)
    -> ((String, String) -> String)
    -> (String, String)
    -> String
    -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (String, String) -> String
    forall a b. (a, b) -> b
    snd ((String, String) -> String -> String)
    -> (String, String) -> String -> String
    forall a b. (a -> b) -> a -> b
    $ [(String, String)]
    months [(String, String)] -> Int -> (String, String)
    forall a. [a] -> Int -> a
    !! (Int
    m Int -> Int -> Int
    forall a. Num a => a -> a -> a
    - 1)
            'h' -> String -> String -> String
    forall a. [a] -> [a] -> [a]
    (++) (String -> String -> String)
    -> ((String, String) -> String)
    -> (String, String)
    -> String
    -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (String, String) -> String
    forall a b. (a, b) -> b
    snd ((String, String) -> String -> String)
    -> (String, String) -> String -> String
    forall a b. (a -> b) -> a -> b
    $ [(String, String)]
    months [(String, String)] -> Int -> (String, String)
    forall a. [a] -> Int -> a
    !! (Int
    m Int -> Int -> Int
    forall a. Num a => a -> a -> a
    - 1)
            'm' -> Int -> String -> String
    shows02 Int
    m
            -- DayOfMonth
            'd' -> Int -> String -> String
    shows02 Int
    d
            'e' -> Int -> String -> String
    shows_2 Int
    d
            -- default
            _ -> Char -> String -> String
    def Char
    c

    instance FormatTime OrdinalDate where
        {-# INLINEABLE showsTime #-}
        showsTime :: TimeLocale
    -> OrdinalDate
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    showsTime TimeLocale {..} (OrdinalDate y :: Int
    y d :: Int
    d) = \ def :: Char -> String -> String
    def c :: Char
    c -> case Char
    c of
            -- Year
            'Y' -> Int -> String -> String
    showsY Int
    y
            'y' -> Int -> String -> String
    shows02 (Int -> Int -> Int
    forall a. Integral a => a -> a -> a
    mod Int
    y 100)
            'C' -> Int -> String -> String
    shows02 (Int -> Int -> Int
    forall a. Integral a => a -> a -> a
    div Int
    y 100)
            -- DayOfYear
            'j' -> Int -> String -> String
    shows03 Int
    d
            -- default
            _ -> Char -> String -> String
    def Char
    c

    instance FormatTime WeekDate where
        {-# INLINEABLE showsTime #-}
        showsTime :: TimeLocale
    -> WeekDate
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    showsTime TimeLocale {..} (WeekDate y :: Int
    y w :: Int
    w d :: Int
    d) = \ def :: Char -> String -> String
    def c :: Char
    c -> case Char
    c of
            -- Year
            'G' -> Int -> String -> String
    showsY Int
    y
            'g' -> Int -> String -> String
    shows02 (Int -> Int -> Int
    forall a. Integral a => a -> a -> a
    mod Int
    y 100)
            'f' -> Int -> String -> String
    shows02 (Int -> Int -> Int
    forall a. Integral a => a -> a -> a
    div Int
    y 100)
            -- WeekOfYear
            'V' -> Int -> String -> String
    shows02 Int
    w
            -- DayOfWeek
            'u' -> Int -> String -> String
    forall a. Show a => a -> String -> String
    shows (Int -> String -> String) -> Int -> String -> String
    forall a b. (a -> b) -> a -> b
    $ if Int
    d Int -> Int -> Bool
    forall a. Eq a => a -> a -> Bool
    == 0 then 7 else Int
    d
            'w' -> Int -> String -> String
    forall a. Show a => a -> String -> String
    shows (Int -> String -> String) -> Int -> String -> String
    forall a b. (a -> b) -> a -> b
    $ if Int
    d Int -> Int -> Bool
    forall a. Eq a => a -> a -> Bool
    == 7 then 0 else Int
    d
            'A' -> String -> String -> String
    forall a. [a] -> [a] -> [a]
    (++) (String -> String -> String)
    -> ((String, String) -> String)
    -> (String, String)
    -> String
    -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (String, String) -> String
    forall a b. (a, b) -> a
    fst ((String, String) -> String -> String)
    -> (String, String) -> String -> String
    forall a b. (a -> b) -> a -> b
    $ [(String, String)]
    wDays [(String, String)] -> Int -> (String, String)
    forall a. [a] -> Int -> a
    !! Int -> Int -> Int
    forall a. Integral a => a -> a -> a
    mod Int
    d 7
            'a' -> String -> String -> String
    forall a. [a] -> [a] -> [a]
    (++) (String -> String -> String)
    -> ((String, String) -> String)
    -> (String, String)
    -> String
    -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (String, String) -> String
    forall a b. (a, b) -> b
    snd ((String, String) -> String -> String)
    -> (String, String) -> String -> String
    forall a b. (a -> b) -> a -> b
    $ [(String, String)]
    wDays [(String, String)] -> Int -> (String, String)
    forall a. [a] -> Int -> a
    !! Int -> Int -> Int
    forall a. Integral a => a -> a -> a
    mod Int
    d 7
            -- default
            _ -> Char -> String -> String
    def Char
    c

    instance FormatTime SundayWeek where
        {-# INLINEABLE showsTime #-}
        showsTime :: TimeLocale
    -> SundayWeek
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    showsTime TimeLocale {..} (SundayWeek y :: Int
    y w :: Int
    w d :: Int
    d) = \ def :: Char -> String -> String
    def c :: Char
    c -> case Char
    c of
            -- Year
            'Y' -> Int -> String -> String
    showsY Int
    y
            'y' -> Int -> String -> String
    shows02 (Int -> Int -> Int
    forall a. Integral a => a -> a -> a
    mod Int
    y 100)
            'C' -> Int -> String -> String
    shows02 (Int -> Int -> Int
    forall a. Integral a => a -> a -> a
    div Int
    y 100)
            -- WeekOfYear
            'U' -> Int -> String -> String
    shows02 Int
    w
            -- DayOfWeek
            'u' -> Int -> String -> String
    forall a. Show a => a -> String -> String
    shows (Int -> String -> String) -> Int -> String -> String
    forall a b. (a -> b) -> a -> b
    $ if Int
    d Int -> Int -> Bool
    forall a. Eq a => a -> a -> Bool
    == 0 then 7 else Int
    d
            'w' -> Int -> String -> String
    forall a. Show a => a -> String -> String
    shows (Int -> String -> String) -> Int -> String -> String
    forall a b. (a -> b) -> a -> b
    $ if Int
    d Int -> Int -> Bool
    forall a. Eq a => a -> a -> Bool
    == 7 then 0 else Int
    d
            'A' -> String -> String -> String
    forall a. [a] -> [a] -> [a]
    (++) (String -> String -> String)
    -> ((String, String) -> String)
    -> (String, String)
    -> String
    -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (String, String) -> String
    forall a b. (a, b) -> a
    fst ((String, String) -> String -> String)
    -> (String, String) -> String -> String
    forall a b. (a -> b) -> a -> b
    $ [(String, String)]
    wDays [(String, String)] -> Int -> (String, String)
    forall a. [a] -> Int -> a
    !! Int -> Int -> Int
    forall a. Integral a => a -> a -> a
    mod Int
    d 7
            'a' -> String -> String -> String
    forall a. [a] -> [a] -> [a]
    (++) (String -> String -> String)
    -> ((String, String) -> String)
    -> (String, String)
    -> String
    -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (String, String) -> String
    forall a b. (a, b) -> b
    snd ((String, String) -> String -> String)
    -> (String, String) -> String -> String
    forall a b. (a -> b) -> a -> b
    $ [(String, String)]
    wDays [(String, String)] -> Int -> (String, String)
    forall a. [a] -> Int -> a
    !! Int -> Int -> Int
    forall a. Integral a => a -> a -> a
    mod Int
    d 7
            -- default
            _ -> Char -> String -> String
    def Char
    c

    instance FormatTime MondayWeek where
        {-# INLINEABLE showsTime #-}
        showsTime :: TimeLocale
    -> MondayWeek
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    showsTime TimeLocale {..} (MondayWeek y :: Int
    y w :: Int
    w d :: Int
    d) = \ def :: Char -> String -> String
    def c :: Char
    c -> case Char
    c of
            -- Year
            'Y' -> Int -> String -> String
    showsY Int
    y
            'y' -> Int -> String -> String
    shows02 (Int -> Int -> Int
    forall a. Integral a => a -> a -> a
    mod Int
    y 100)
            'C' -> Int -> String -> String
    shows02 (Int -> Int -> Int
    forall a. Integral a => a -> a -> a
    div Int
    y 100)
            -- WeekOfYear
            'W' -> Int -> String -> String
    shows02 Int
    w
            -- DayOfWeek
            'u' -> Int -> String -> String
    forall a. Show a => a -> String -> String
    shows (Int -> String -> String) -> Int -> String -> String
    forall a b. (a -> b) -> a -> b
    $ if Int
    d Int -> Int -> Bool
    forall a. Eq a => a -> a -> Bool
    == 0 then 7 else Int
    d
            'w' -> Int -> String -> String
    forall a. Show a => a -> String -> String
    shows (Int -> String -> String) -> Int -> String -> String
    forall a b. (a -> b) -> a -> b
    $ if Int
    d Int -> Int -> Bool
    forall a. Eq a => a -> a -> Bool
    == 7 then 0 else Int
    d
            'A' -> String -> String -> String
    forall a. [a] -> [a] -> [a]
    (++) (String -> String -> String)
    -> ((String, String) -> String)
    -> (String, String)
    -> String
    -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (String, String) -> String
    forall a b. (a, b) -> a
    fst ((String, String) -> String -> String)
    -> (String, String) -> String -> String
    forall a b. (a -> b) -> a -> b
    $ [(String, String)]
    wDays [(String, String)] -> Int -> (String, String)
    forall a. [a] -> Int -> a
    !! Int -> Int -> Int
    forall a. Integral a => a -> a -> a
    mod Int
    d 7
            'a' -> String -> String -> String
    forall a. [a] -> [a] -> [a]
    (++) (String -> String -> String)
    -> ((String, String) -> String)
    -> (String, String)
    -> String
    -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (String, String) -> String
    forall a b. (a, b) -> b
    snd ((String, String) -> String -> String)
    -> (String, String) -> String -> String
    forall a b. (a -> b) -> a -> b
    $ [(String, String)]
    wDays [(String, String)] -> Int -> (String, String)
    forall a. [a] -> Int -> a
    !! Int -> Int -> Int
    forall a. Integral a => a -> a -> a
    mod Int
    d 7
            -- default
            _ -> Char -> String -> String
    def Char
    c

    instance FormatTime LocalTime where
        {-# INLINEABLE showsTime #-}
        showsTime :: TimeLocale
    -> LocalTime
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    showsTime l :: TimeLocale
    l (LocalTime day :: Day
    day tod :: TimeOfDay
    tod) = TimeLocale
    -> Day -> (Char -> String -> String) -> Char -> String -> String
    forall t.
    FormatTime t =>
    TimeLocale
    -> t -> (Char -> String -> String) -> Char -> String -> String
    showsTime TimeLocale
    l Day
    day ((Char -> String -> String) -> Char -> String -> String)
    -> ((Char -> String -> String) -> Char -> String -> String)
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . TimeLocale
    -> TimeOfDay
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    forall t.
    FormatTime t =>
    TimeLocale
    -> t -> (Char -> String -> String) -> Char -> String -> String
    showsTime TimeLocale
    l TimeOfDay
    tod

    instance FormatTime Day where
        {-# INLINEABLE showsTime #-}
        showsTime :: TimeLocale
    -> Day -> (Char -> String -> String) -> Char -> String -> String
    showsTime l :: TimeLocale
    l d :: Day
    d@(Getting OrdinalDate Day OrdinalDate -> Day -> OrdinalDate
    forall a s. Getting a s a -> s -> a
    view Getting OrdinalDate Day OrdinalDate
    Iso' Day OrdinalDate
    ordinalDate -> OrdinalDate
    ordinal)
            = TimeLocale
    -> OrdinalDate
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    forall t.
    FormatTime t =>
    TimeLocale
    -> t -> (Char -> String -> String) -> Char -> String -> String
    showsTime TimeLocale
    l OrdinalDate
    ordinal
            ((Char -> String -> String) -> Char -> String -> String)
    -> ((Char -> String -> String) -> Char -> String -> String)
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . TimeLocale
    -> YearMonthDay
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    forall t.
    FormatTime t =>
    TimeLocale
    -> t -> (Char -> String -> String) -> Char -> String -> String
    showsTime TimeLocale
    l (OrdinalDate
    ordinal OrdinalDate
    -> Getting YearMonthDay OrdinalDate YearMonthDay -> YearMonthDay
    forall s a. s -> Getting a s a -> a
    ^. Getting YearMonthDay OrdinalDate YearMonthDay
    Iso' OrdinalDate YearMonthDay
    yearMonthDay)
            ((Char -> String -> String) -> Char -> String -> String)
    -> ((Char -> String -> String) -> Char -> String -> String)
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . TimeLocale
    -> WeekDate
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    forall t.
    FormatTime t =>
    TimeLocale
    -> t -> (Char -> String -> String) -> Char -> String -> String
    showsTime TimeLocale
    l (OrdinalDate -> Day -> WeekDate
    toWeekOrdinal OrdinalDate
    ordinal Day
    d)
            ((Char -> String -> String) -> Char -> String -> String)
    -> ((Char -> String -> String) -> Char -> String -> String)
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . TimeLocale
    -> SundayWeek
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    forall t.
    FormatTime t =>
    TimeLocale
    -> t -> (Char -> String -> String) -> Char -> String -> String
    showsTime TimeLocale
    l (OrdinalDate -> Day -> SundayWeek
    toSundayOrdinal OrdinalDate
    ordinal Day
    d)
            ((Char -> String -> String) -> Char -> String -> String)
    -> ((Char -> String -> String) -> Char -> String -> String)
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . TimeLocale
    -> MondayWeek
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    forall t.
    FormatTime t =>
    TimeLocale
    -> t -> (Char -> String -> String) -> Char -> String -> String
    showsTime TimeLocale
    l (OrdinalDate -> Day -> MondayWeek
    toMondayOrdinal OrdinalDate
    ordinal Day
    d)

    instance FormatTime TimeZone where
        {-# INLINEABLE showsTime #-}
        showsTime :: TimeLocale
    -> TimeZone
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    showsTime _ tz :: TimeZone
    tz@(TimeZone _ _ name :: String
    name) = \ def :: Char -> String -> String
    def c :: Char
    c -> case Char
    c of
            'z' -> String -> String -> String
    forall a. [a] -> [a] -> [a]
    (++) (TimeZone -> String
    timeZoneOffsetString TimeZone
    tz)
            'Z' -> String -> String -> String
    forall a. [a] -> [a] -> [a]
    (++) (if String -> Bool
    forall (t :: * -> *) a. Foldable t => t a -> Bool
    null String
    name then TimeZone -> String
    timeZoneOffsetString TimeZone
    tz else String
    name)
            _ -> Char -> String -> String
    def Char
    c

    instance FormatTime ZonedTime where
        {-# INLINEABLE showsTime #-}
        showsTime :: TimeLocale
    -> ZonedTime
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    showsTime l :: TimeLocale
    l (ZonedTime lt :: LocalTime
    lt tz :: TimeZone
    tz) = TimeLocale
    -> LocalTime
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    forall t.
    FormatTime t =>
    TimeLocale
    -> t -> (Char -> String -> String) -> Char -> String -> String
    showsTime TimeLocale
    l LocalTime
    lt ((Char -> String -> String) -> Char -> String -> String)
    -> ((Char -> String -> String) -> Char -> String -> String)
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . TimeLocale
    -> TimeZone
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    forall t.
    FormatTime t =>
    TimeLocale
    -> t -> (Char -> String -> String) -> Char -> String -> String
    showsTime TimeLocale
    l TimeZone
    tz

    instance FormatTime UTCTime where
        {-# INLINEABLE showsTime #-}
        showsTime :: TimeLocale
    -> UTCTime
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    showsTime l :: TimeLocale
    l t :: UTCTime
    t = \ def :: Char -> String -> String
    def c :: Char
    c -> case Char
    c of
            's' -> Int64 -> String -> String
    forall a. Show a => a -> String -> String
    shows (Int64 -> String -> String)
    -> ((Int64, Micro) -> Int64) -> (Int64, Micro) -> String -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Int64, Micro) -> Int64
    forall a b. (a, b) -> a
    fst ((Int64, Micro) -> String -> String)
    -> (Int64, Micro) -> String -> String
    forall a b. (a -> b) -> a -> b
    $ Micro -> Micro -> (Int64, Micro)
    qr Micro
    s (Int64 -> Micro
    Micro 1000000)
            _ -> TimeLocale
    -> ZonedTime
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    forall t.
    FormatTime t =>
    TimeLocale
    -> t -> (Char -> String -> String) -> Char -> String -> String
    showsTime TimeLocale
    l ((TimeZone
    utc, UTCTime
    t) (TimeZone, UTCTime)
    -> Getting ZonedTime (TimeZone, UTCTime) ZonedTime -> ZonedTime
    forall s a. s -> Getting a s a -> a
    ^. Getting ZonedTime (TimeZone, UTCTime) ZonedTime
    Iso' (TimeZone, UTCTime) ZonedTime
    zonedTime) Char -> String -> String
    def Char
    c
          where
            NominalDiffTime s :: Micro
    s = UTCTime
    t UTCTime
    -> Getting NominalDiffTime UTCTime NominalDiffTime
    -> NominalDiffTime
    forall s a. s -> Getting a s a -> a
    ^. Getting NominalDiffTime UTCTime NominalDiffTime
    Iso' UTCTime NominalDiffTime
    posixTime
    #if BUG_FOR_BUG
            qr :: Micro -> Micro -> (Int64, Micro)
    qr = Micro -> Micro -> (Int64, Micro)
    microDivMod -- rounds down
    #else
            qr = microQuotRem -- rounds to 0
    #endif

    instance FormatTime UniversalTime where
        {-# INLINEABLE showsTime #-}
        showsTime :: TimeLocale
    -> UniversalTime
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    showsTime l :: TimeLocale
    l t :: UniversalTime
    t = TimeLocale
    -> ZonedTime
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    forall t.
    FormatTime t =>
    TimeLocale
    -> t -> (Char -> String -> String) -> Char -> String -> String
    showsTime TimeLocale
    l (ZonedTime
     -> (Char -> String -> String) -> Char -> String -> String)
    -> ZonedTime
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    forall a b. (a -> b) -> a -> b
    $ LocalTime -> TimeZone -> ZonedTime
    ZonedTime LocalTime
    lt TimeZone
    utc {timeZoneName :: String
    timeZoneName = "UT1"} where
            lt :: LocalTime
    lt = UniversalTime
    t UniversalTime
    -> Getting LocalTime UniversalTime LocalTime -> LocalTime
    forall s a. s -> Getting a s a -> a
    ^. Rational -> Iso' UniversalTime LocalTime
    ut1LocalTime 0

    instance FormatTime AbsoluteTime where
        {-# INLINEABLE showsTime #-}
        showsTime :: TimeLocale
    -> AbsoluteTime
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    showsTime l :: TimeLocale
    l t :: AbsoluteTime
    t = TimeLocale
    -> ZonedTime
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    forall t.
    FormatTime t =>
    TimeLocale
    -> t -> (Char -> String -> String) -> Char -> String -> String
    showsTime TimeLocale
    l (ZonedTime
     -> (Char -> String -> String) -> Char -> String -> String)
    -> ZonedTime
    -> (Char -> String -> String)
    -> Char
    -> String
    -> String
    forall a b. (a -> b) -> a -> b
    $ LocalTime -> TimeZone -> ZonedTime
    ZonedTime LocalTime
    lt TimeZone
    utc {timeZoneName :: String
    timeZoneName = "TAI"} where
            lt :: LocalTime
    lt = AbsoluteTime
    t AbsoluteTime
    -> Getting LocalTime AbsoluteTime LocalTime -> LocalTime
    forall s a. s -> Getting a s a -> a
    ^. AnIso UTCTime UTCTime AbsoluteTime AbsoluteTime
    -> Iso AbsoluteTime AbsoluteTime UTCTime UTCTime
    forall s t a b. AnIso s t a b -> Iso b a t s
    from (LeapSecondTable -> AnIso UTCTime UTCTime AbsoluteTime AbsoluteTime
    LeapSecondTable -> Iso' UTCTime AbsoluteTime
    absoluteTime (LeapSecondTable
     -> AnIso UTCTime UTCTime AbsoluteTime AbsoluteTime)
    -> LeapSecondTable
    -> AnIso UTCTime UTCTime AbsoluteTime AbsoluteTime
    forall a b. (a -> b) -> a -> b
    $ DiffTime -> LeapSecondTable
    forall a b. a -> b -> a
    const DiffTime
    forall v. AdditiveGroup v => v
    zeroV) Overloaded
      (->) (Const LocalTime) AbsoluteTime AbsoluteTime UTCTime UTCTime
    -> ((LocalTime -> Const LocalTime LocalTime)
        -> UTCTime -> Const LocalTime UTCTime)
    -> Getting LocalTime AbsoluteTime LocalTime
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . TimeZone -> Iso' UTCTime LocalTime
    utcLocalTime TimeZone
    utc

    ------------------------------------------------------------------------

    data TimeFlag
        = PostMeridiem
        | TwelveHour
        | HasCentury
        | IsPOSIXTime
        | IsOrdinalDate
        | IsGregorian
        | IsWeekDate
        | IsSundayWeek
        | IsMondayWeek
        deriving (Int -> TimeFlag
    TimeFlag -> Int
    TimeFlag -> [TimeFlag]
    TimeFlag -> TimeFlag
    TimeFlag -> TimeFlag -> [TimeFlag]
    TimeFlag -> TimeFlag -> TimeFlag -> [TimeFlag]
    (TimeFlag -> TimeFlag)
    -> (TimeFlag -> TimeFlag)
    -> (Int -> TimeFlag)
    -> (TimeFlag -> Int)
    -> (TimeFlag -> [TimeFlag])
    -> (TimeFlag -> TimeFlag -> [TimeFlag])
    -> (TimeFlag -> TimeFlag -> [TimeFlag])
    -> (TimeFlag -> TimeFlag -> TimeFlag -> [TimeFlag])
    -> Enum TimeFlag
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    enumFromThenTo :: TimeFlag -> TimeFlag -> TimeFlag -> [TimeFlag]
    $cenumFromThenTo :: TimeFlag -> TimeFlag -> TimeFlag -> [TimeFlag]
    enumFromTo :: TimeFlag -> TimeFlag -> [TimeFlag]
    $cenumFromTo :: TimeFlag -> TimeFlag -> [TimeFlag]
    enumFromThen :: TimeFlag -> TimeFlag -> [TimeFlag]
    $cenumFromThen :: TimeFlag -> TimeFlag -> [TimeFlag]
    enumFrom :: TimeFlag -> [TimeFlag]
    $cenumFrom :: TimeFlag -> [TimeFlag]
    fromEnum :: TimeFlag -> Int
    $cfromEnum :: TimeFlag -> Int
    toEnum :: Int -> TimeFlag
    $ctoEnum :: Int -> TimeFlag
    pred :: TimeFlag -> TimeFlag
    $cpred :: TimeFlag -> TimeFlag
    succ :: TimeFlag -> TimeFlag
    $csucc :: TimeFlag -> TimeFlag
    Enum, Int -> TimeFlag -> String -> String
    [TimeFlag] -> String -> String
    TimeFlag -> String
    (Int -> TimeFlag -> String -> String)
    -> (TimeFlag -> String)
    -> ([TimeFlag] -> String -> String)
    -> Show TimeFlag
    forall a.
    (Int -> a -> String -> String)
    -> (a -> String) -> ([a] -> String -> String) -> Show a
    showList :: [TimeFlag] -> String -> String
    $cshowList :: [TimeFlag] -> String -> String
    show :: TimeFlag -> String
    $cshow :: TimeFlag -> String
    showsPrec :: Int -> TimeFlag -> String -> String
    $cshowsPrec :: Int -> TimeFlag -> String -> String
    Show)

    data TimeParse = TimeParse
        { TimeParse -> Int
    tpCentury :: {-# UNPACK #-}!Int
        , TimeParse -> Int
    tpCenturyYear :: {-# UNPACK #-}!Int{-YearOfCentury-}
        , TimeParse -> Int
    tpMonth :: {-# UNPACK #-}!Month
        , TimeParse -> Int
    tpWeekOfYear :: {-# UNPACK #-}!WeekOfYear
        , TimeParse -> Int
    tpDayOfMonth :: {-# UNPACK #-}!DayOfMonth
        , TimeParse -> Int
    tpDayOfYear :: {-# UNPACK #-}!DayOfYear
        , TimeParse -> Int
    tpDayOfWeek :: {-# UNPACK #-}!DayOfWeek
        , TimeParse -> Int
    tpFlags :: {-# UNPACK #-}!Int{-BitSet TimeFlag-}
        , TimeParse -> Int
    tpHour :: {-# UNPACK #-}!Hour
        , TimeParse -> Int
    tpMinute :: {-# UNPACK #-}!Minute
        , TimeParse -> Int
    tpSecond :: {-# UNPACK #-}!Int
        , TimeParse -> DiffTime
    tpSecFrac :: {-# UNPACK #-}!DiffTime
        , TimeParse -> NominalDiffTime
    tpPOSIXTime :: {-# UNPACK #-}!POSIXTime
        , TimeParse -> TimeZone
    tpTimeZone :: !TimeZone
        } deriving (Int -> TimeParse -> String -> String
    [TimeParse] -> String -> String
    TimeParse -> String
    (Int -> TimeParse -> String -> String)
    -> (TimeParse -> String)
    -> ([TimeParse] -> String -> String)
    -> Show TimeParse
    forall a.
    (Int -> a -> String -> String)
    -> (a -> String) -> ([a] -> String -> String) -> Show a
    showList :: [TimeParse] -> String -> String
    $cshowList :: [TimeParse] -> String -> String
    show :: TimeParse -> String
    $cshow :: TimeParse -> String
    showsPrec :: Int -> TimeParse -> String -> String
    $cshowsPrec :: Int -> TimeParse -> String -> String
    Show)

    LENS(TimeParse,tpCentury,Int)
    LENS(TimeParse,tpCenturyYear,Int{-YearOfCentury-})
    LENS(TimeParse,tpMonth,Month)
    LENS(TimeParse,tpWeekOfYear,WeekOfYear)
    LENS(TimeParse,tpDayOfMonth,DayOfMonth)
    LENS(TimeParse,tpDayOfWeek,DayOfWeek)
    LENS(TimeParse,tpDayOfYear,DayOfYear)
    LENS(TimeParse,tpFlags,Int{-BitSet TimeFlag-})
    LENS(TimeParse,tpHour,Hour)
    LENS(TimeParse,tpMinute,Minute)
    LENS(TimeParse,tpSecond,Int)
    LENS(TimeParse,tpSecFrac,DiffTime)
    LENS(TimeParse,tpPOSIXTime,POSIXTime)
    LENS(TimeParse,tpTimeZone,TimeZone)

    {-# INLINE flag #-}
    flag :: TimeFlag -> Lens' TimeParse Bool
    flag :: TimeFlag -> Lens' TimeParse Bool
    flag (TimeFlag -> Int
    forall a. Enum a => a -> Int
    fromEnum -> Int
    f) = Overloaded (->) f TimeParse TimeParse Int Int
    Lens TimeParse TimeParse Int Int
    _tpFlags Overloaded (->) f TimeParse TimeParse Int Int
    -> ((Bool -> f Bool) -> Int -> f Int)
    -> (Bool -> f Bool)
    -> TimeParse
    -> f TimeParse
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Int -> Bool) -> (Int -> Bool -> Int) -> Lens Int Int Bool Bool
    forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
    lens
        (Int -> Int -> Bool
    forall a. Bits a => a -> Int -> Bool
    `testBit` Int
    f) (\ n :: Int
    n b :: Bool
    b -> (if Bool
    b then Int -> Int -> Int
    forall a. Bits a => a -> Int -> a
    setBit else Int -> Int -> Int
    forall a. Bits a => a -> Int -> a
    clearBit) Int
    n Int
    f)

    -- | Time 'Parser' for UTF-8 encoded 'ByteString's.
    --
    -- Attoparsec easily beats any 'String' parser out there, but we do have to
    -- be careful to convert the input to UTF-8 'ByteString's.
    {-# INLINEABLE timeParser #-}
    timeParser :: TimeLocale -> String -> Parser TimeParse
    timeParser :: TimeLocale -> String -> Parser TimeParse
    timeParser TimeLocale {..} = (StateT TimeParse Parser () -> TimeParse -> Parser TimeParse)
    -> TimeParse -> StateT TimeParse Parser () -> Parser TimeParse
    forall a b c. (a -> b -> c) -> b -> a -> c
    flip StateT TimeParse Parser () -> TimeParse -> Parser TimeParse
    forall (m :: * -> *) s a. Monad m => StateT s m a -> s -> m s
    execStateT TimeParse
    unixEpoch (StateT TimeParse Parser () -> Parser TimeParse)
    -> (String -> StateT TimeParse Parser ())
    -> String
    -> Parser TimeParse
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> StateT TimeParse Parser ()
    go where

        go :: String -> StateT TimeParse Parser ()
        go :: String -> StateT TimeParse Parser ()
    go spec :: String
    spec = case String
    spec of
            '%' : cspec :: Char
    cspec : rspec :: String
    rspec -> case Char
    cspec of
                -- aggregate
                'c' -> String -> StateT TimeParse Parser ()
    go (String
    dateTimeFmt String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    rspec)
                'r' -> String -> StateT TimeParse Parser ()
    go (String
    time12Fmt String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    rspec)
                'X' -> String -> StateT TimeParse Parser ()
    go (String
    timeFmt String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    rspec)
                'x' -> String -> StateT TimeParse Parser ()
    go (String
    dateFmt String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    rspec)
                'R' -> String -> StateT TimeParse Parser ()
    go ("%H:%M" String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    rspec)
                'T' -> String -> StateT TimeParse Parser ()
    go ("%H:%M:%S" String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    rspec)
                'D' -> String -> StateT TimeParse Parser ()
    go ("%m/%d/%y" String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    rspec)
                'F' -> String -> StateT TimeParse Parser ()
    go ("%Y-%m-%d" String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    rspec)
                -- AM/PM
                'P' -> StateT TimeParse Parser ()
    dayHalf
                'p' -> StateT TimeParse Parser ()
    dayHalf
                -- Hour
                'H' -> Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Int -> Parser ByteString Int
    dec0 2) StateT TimeParse Parser Int
    -> (Int -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Int -> StateT TimeParse Parser ()
    setHour24
                'I' -> Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Int -> Parser ByteString Int
    dec0 2) StateT TimeParse Parser Int
    -> (Int -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Int -> StateT TimeParse Parser ()
    setHour12
                'k' -> (Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Int -> Parser ByteString Int
    dec_ 2) StateT TimeParse Parser Int
    -> (Int -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Int -> StateT TimeParse Parser ()
    setHour24)
                    StateT TimeParse Parser ()
    -> StateT TimeParse Parser () -> StateT TimeParse Parser ()
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> (Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Int -> Parser ByteString Int
    dec_ 1) StateT TimeParse Parser Int
    -> (Int -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Int -> StateT TimeParse Parser ()
    setHour24)
                'l' -> (Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Int -> Parser ByteString Int
    dec_ 2) StateT TimeParse Parser Int
    -> (Int -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Int -> StateT TimeParse Parser ()
    setHour12)
                    StateT TimeParse Parser ()
    -> StateT TimeParse Parser () -> StateT TimeParse Parser ()
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> (Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Int -> Parser ByteString Int
    dec_ 1) StateT TimeParse Parser Int
    -> (Int -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Int -> StateT TimeParse Parser ()
    setHour12)
                -- Minute
                'M' -> Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Int -> Parser ByteString Int
    dec0 2) StateT TimeParse Parser Int
    -> (Int -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Setter TimeParse TimeParse Int Int
    -> Int -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    assign Setter TimeParse TimeParse Int Int
    Lens TimeParse TimeParse Int Int
    _tpMinute StateT TimeParse Parser ()
    -> StateT TimeParse Parser () -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> String -> StateT TimeParse Parser ()
    go String
    rspec
                -- Second
                'S' -> Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Int -> Parser ByteString Int
    dec0 2) StateT TimeParse Parser Int
    -> (Int -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Setter TimeParse TimeParse Int Int
    -> Int -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    assign Setter TimeParse TimeParse Int Int
    Lens TimeParse TimeParse Int Int
    _tpSecond StateT TimeParse Parser ()
    -> StateT TimeParse Parser () -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> String -> StateT TimeParse Parser ()
    go String
    rspec
                'q' -> Parser ByteString Micro -> StateT TimeParse Parser Micro
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift Parser ByteString Micro
    micro StateT TimeParse Parser Micro
    -> (Micro -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Setter TimeParse TimeParse DiffTime DiffTime
    -> DiffTime -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    assign Setter TimeParse TimeParse DiffTime DiffTime
    Lens TimeParse TimeParse DiffTime DiffTime
    _tpSecFrac (DiffTime -> StateT TimeParse Parser ())
    -> (Micro -> DiffTime) -> Micro -> StateT TimeParse Parser ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Micro -> DiffTime
    DiffTime StateT TimeParse Parser ()
    -> StateT TimeParse Parser () -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> String -> StateT TimeParse Parser ()
    go String
    rspec
                'Q' -> Parser ByteString DiffTime -> StateT TimeParse Parser DiffTime
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift ((Char -> Parser Char
    P.char '.' Parser Char
    -> Parser ByteString DiffTime -> Parser ByteString DiffTime
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> Micro -> DiffTime
    DiffTime (Micro -> DiffTime)
    -> Parser ByteString Micro -> Parser ByteString DiffTime
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Parser ByteString Micro
    micro) Parser ByteString DiffTime
    -> Parser ByteString DiffTime -> Parser ByteString DiffTime
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> DiffTime -> Parser ByteString DiffTime
    forall (m :: * -> *) a. Monad m => a -> m a
    return DiffTime
    forall v. AdditiveGroup v => v
    zeroV)
                    StateT TimeParse Parser DiffTime
    -> (DiffTime -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Setter TimeParse TimeParse DiffTime DiffTime
    -> DiffTime -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    assign Setter TimeParse TimeParse DiffTime DiffTime
    Lens TimeParse TimeParse DiffTime DiffTime
    _tpSecFrac StateT TimeParse Parser ()
    -> StateT TimeParse Parser () -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> String -> StateT TimeParse Parser ()
    go String
    rspec

                -- Year
                'Y' -> StateT TimeParse Parser ()
    fullYear
                'y' -> Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Int -> Parser ByteString Int
    dec0 2) StateT TimeParse Parser Int
    -> (Int -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Int -> StateT TimeParse Parser ()
    setCenturyYear
                'C' -> Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Int -> Parser ByteString Int
    dec0 2) StateT TimeParse Parser Int
    -> (Int -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Int -> StateT TimeParse Parser ()
    setCentury
                -- Month
                'B' -> Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift ([String] -> Parser ByteString Int
    indexOfCI ([String] -> Parser ByteString Int)
    -> [String] -> Parser ByteString Int
    forall a b. (a -> b) -> a -> b
    $ (String, String) -> String
    forall a b. (a, b) -> a
    fst ((String, String) -> String) -> [(String, String)] -> [String]
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> [(String, String)]
    months) StateT TimeParse Parser Int
    -> (Int -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Int -> StateT TimeParse Parser ()
    setMonth (Int -> StateT TimeParse Parser ())
    -> (Int -> Int) -> Int -> StateT TimeParse Parser ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> Int
    forall a. Enum a => a -> a
    succ
                'b' -> Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift ([String] -> Parser ByteString Int
    indexOfCI ([String] -> Parser ByteString Int)
    -> [String] -> Parser ByteString Int
    forall a b. (a -> b) -> a -> b
    $ (String, String) -> String
    forall a b. (a, b) -> b
    snd ((String, String) -> String) -> [(String, String)] -> [String]
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> [(String, String)]
    months) StateT TimeParse Parser Int
    -> (Int -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Int -> StateT TimeParse Parser ()
    setMonth (Int -> StateT TimeParse Parser ())
    -> (Int -> Int) -> Int -> StateT TimeParse Parser ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> Int
    forall a. Enum a => a -> a
    succ
                'h' -> Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift ([String] -> Parser ByteString Int
    indexOfCI ([String] -> Parser ByteString Int)
    -> [String] -> Parser ByteString Int
    forall a b. (a -> b) -> a -> b
    $ (String, String) -> String
    forall a b. (a, b) -> b
    snd ((String, String) -> String) -> [(String, String)] -> [String]
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> [(String, String)]
    months) StateT TimeParse Parser Int
    -> (Int -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Int -> StateT TimeParse Parser ()
    setMonth (Int -> StateT TimeParse Parser ())
    -> (Int -> Int) -> Int -> StateT TimeParse Parser ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> Int
    forall a. Enum a => a -> a
    succ
                'm' -> Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Int -> Parser ByteString Int
    dec0 2) StateT TimeParse Parser Int
    -> (Int -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Int -> StateT TimeParse Parser ()
    setMonth
                -- DayOfMonth
                'd' -> Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Int -> Parser ByteString Int
    dec0 2) StateT TimeParse Parser Int
    -> (Int -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Int -> StateT TimeParse Parser ()
    setDayOfMonth
                'e' -> (Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Int -> Parser ByteString Int
    dec_ 2) StateT TimeParse Parser Int
    -> (Int -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Int -> StateT TimeParse Parser ()
    setDayOfMonth)
                    StateT TimeParse Parser ()
    -> StateT TimeParse Parser () -> StateT TimeParse Parser ()
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> (Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Int -> Parser ByteString Int
    dec_ 1) StateT TimeParse Parser Int
    -> (Int -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Int -> StateT TimeParse Parser ()
    setDayOfMonth)
                -- DayOfYear
                'j' -> Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Int -> Parser ByteString Int
    dec0 3) StateT TimeParse Parser Int
    -> (Int -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Setter TimeParse TimeParse Int Int
    -> Int -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    assign Setter TimeParse TimeParse Int Int
    Lens TimeParse TimeParse Int Int
    _tpDayOfYear
                    StateT TimeParse Parser ()
    -> StateT TimeParse Parser () -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> TimeFlag -> Lens' TimeParse Bool
    flag TimeFlag
    IsOrdinalDate Overloaded (->) Identity TimeParse TimeParse Bool Bool
    -> Bool -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    .= Bool
    True StateT TimeParse Parser ()
    -> StateT TimeParse Parser () -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> String -> StateT TimeParse Parser ()
    go String
    rspec

                -- Year (WeekDate)
                -- FIXME: problematic if input contains both %Y and %G
                'G' -> TimeFlag -> Lens' TimeParse Bool
    flag TimeFlag
    IsWeekDate Overloaded (->) Identity TimeParse TimeParse Bool Bool
    -> Bool -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    .= Bool
    True StateT TimeParse Parser ()
    -> StateT TimeParse Parser () -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> StateT TimeParse Parser ()
    fullYear
                'g' -> TimeFlag -> Lens' TimeParse Bool
    flag TimeFlag
    IsWeekDate Overloaded (->) Identity TimeParse TimeParse Bool Bool
    -> Bool -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    .= Bool
    True StateT TimeParse Parser ()
    -> StateT TimeParse Parser Int -> StateT TimeParse Parser Int
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Int -> Parser ByteString Int
    dec0 2) StateT TimeParse Parser Int
    -> (Int -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Int -> StateT TimeParse Parser ()
    setCenturyYear
                'f' -> TimeFlag -> Lens' TimeParse Bool
    flag TimeFlag
    IsWeekDate Overloaded (->) Identity TimeParse TimeParse Bool Bool
    -> Bool -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    .= Bool
    True StateT TimeParse Parser ()
    -> StateT TimeParse Parser Int -> StateT TimeParse Parser Int
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Int -> Parser ByteString Int
    dec0 2) StateT TimeParse Parser Int
    -> (Int -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Int -> StateT TimeParse Parser ()
    setCentury
                -- WeekOfYear
                -- FIXME: problematic if more than one of the following
                'V' -> TimeFlag -> Lens' TimeParse Bool
    flag TimeFlag
    IsWeekDate Overloaded (->) Identity TimeParse TimeParse Bool Bool
    -> Bool -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    .= Bool
    True StateT TimeParse Parser ()
    -> StateT TimeParse Parser Int -> StateT TimeParse Parser Int
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Int -> Parser ByteString Int
    dec0 2) StateT TimeParse Parser Int
    -> (Int -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Int -> StateT TimeParse Parser ()
    setWeekOfYear
                'U' -> TimeFlag -> Lens' TimeParse Bool
    flag TimeFlag
    IsSundayWeek Overloaded (->) Identity TimeParse TimeParse Bool Bool
    -> Bool -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    .= Bool
    True StateT TimeParse Parser ()
    -> StateT TimeParse Parser Int -> StateT TimeParse Parser Int
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Int -> Parser ByteString Int
    dec0 2) StateT TimeParse Parser Int
    -> (Int -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Int -> StateT TimeParse Parser ()
    setWeekOfYear
                'W' -> TimeFlag -> Lens' TimeParse Bool
    flag TimeFlag
    IsMondayWeek Overloaded (->) Identity TimeParse TimeParse Bool Bool
    -> Bool -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    .= Bool
    True StateT TimeParse Parser ()
    -> StateT TimeParse Parser Int -> StateT TimeParse Parser Int
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Int -> Parser ByteString Int
    dec0 2) StateT TimeParse Parser Int
    -> (Int -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Int -> StateT TimeParse Parser ()
    setWeekOfYear
                -- DayOfWeek
                'w' -> Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Int -> Parser ByteString Int
    dec0 1) StateT TimeParse Parser Int
    -> (Int -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Int -> StateT TimeParse Parser ()
    setDayOfWeek
                'u' -> Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Int -> Parser ByteString Int
    dec0 1) StateT TimeParse Parser Int
    -> (Int -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Int -> StateT TimeParse Parser ()
    setDayOfWeek
                'A' -> Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift ([String] -> Parser ByteString Int
    indexOfCI ([String] -> Parser ByteString Int)
    -> [String] -> Parser ByteString Int
    forall a b. (a -> b) -> a -> b
    $ (String, String) -> String
    forall a b. (a, b) -> a
    fst ((String, String) -> String) -> [(String, String)] -> [String]
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> [(String, String)]
    wDays) StateT TimeParse Parser Int
    -> (Int -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Int -> StateT TimeParse Parser ()
    setDayOfWeek
                'a' -> Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift ([String] -> Parser ByteString Int
    indexOfCI ([String] -> Parser ByteString Int)
    -> [String] -> Parser ByteString Int
    forall a b. (a -> b) -> a -> b
    $ (String, String) -> String
    forall a b. (a, b) -> b
    snd ((String, String) -> String) -> [(String, String)] -> [String]
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> [(String, String)]
    wDays) StateT TimeParse Parser Int
    -> (Int -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Int -> StateT TimeParse Parser ()
    setDayOfWeek

                -- TimeZone
                'z' -> do StateT TimeParse Parser ()
    tzOffset; String -> StateT TimeParse Parser ()
    go String
    rspec
                'Z' -> do StateT TimeParse Parser ()
    tzOffset StateT TimeParse Parser ()
    -> StateT TimeParse Parser () -> StateT TimeParse Parser ()
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> StateT TimeParse Parser ()
    tzName; String -> StateT TimeParse Parser ()
    go String
    rspec
                -- UTCTime
                's' -> do
                    Int64
    s <- Parser ByteString Int64 -> StateT TimeParse Parser Int64
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Parser ByteString Int64 -> Parser ByteString Int64
    forall n. Integral n => Parser n -> Parser n
    negative Parser ByteString Int64
    forall a. Integral a => Parser a
    P.decimal)
                    Overloaded
      (->) Identity TimeParse TimeParse NominalDiffTime NominalDiffTime
    Lens TimeParse TimeParse NominalDiffTime NominalDiffTime
    _tpPOSIXTime Overloaded
      (->) Identity TimeParse TimeParse NominalDiffTime NominalDiffTime
    -> NominalDiffTime -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    .= Int64 -> NominalDiffTime
    forall n t. (Real n, TimeDiff t) => n -> t
    fromSeconds (Int64
    s :: Int64)
                    TimeFlag -> Lens' TimeParse Bool
    flag TimeFlag
    IsPOSIXTime Overloaded (->) Identity TimeParse TimeParse Bool Bool
    -> Bool -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    .= Bool
    True
                    String -> StateT TimeParse Parser ()
    go String
    rspec

                -- modifier (whatever)
                '-' -> String -> StateT TimeParse Parser ()
    go ('%' Char -> String -> String
    forall a. a -> [a] -> [a]
    : String
    rspec)
                '_' -> String -> StateT TimeParse Parser ()
    go ('%' Char -> String -> String
    forall a. a -> [a] -> [a]
    : String
    rspec)
                '0' -> String -> StateT TimeParse Parser ()
    go ('%' Char -> String -> String
    forall a. a -> [a] -> [a]
    : String
    rspec)
                -- escape (why would anyone need %t and %n?)
                '%' -> Parser Char -> StateT TimeParse Parser Char
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Char -> Parser Char
    P.char '%') StateT TimeParse Parser Char
    -> StateT TimeParse Parser () -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> String -> StateT TimeParse Parser ()
    go String
    rspec
                _ -> Parser () -> StateT TimeParse Parser ()
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Parser () -> StateT TimeParse Parser ())
    -> (String -> Parser ()) -> String -> StateT TimeParse Parser ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> Parser ()
    forall (m :: * -> *) a. MonadFail m => String -> m a
    fail (String -> StateT TimeParse Parser ())
    -> String -> StateT TimeParse Parser ()
    forall a b. (a -> b) -> a -> b
    $ "Unknown format character: " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ Char -> String
    forall a. Show a => a -> String
    show Char
    cspec

              where
                dayHalf :: StateT TimeParse Parser ()
    dayHalf = do
                    Bool
    pm <- Parser ByteString Bool -> StateT TimeParse Parser Bool
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Parser ByteString Bool -> StateT TimeParse Parser Bool)
    -> Parser ByteString Bool -> StateT TimeParse Parser Bool
    forall a b. (a -> b) -> a -> b
    $ Bool
    False Bool -> Parser () -> Parser ByteString Bool
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ String -> Parser ()
    stringCI ((String, String) -> String
    forall a b. (a, b) -> a
    fst (String, String)
    amPm)
                        Parser ByteString Bool
    -> Parser ByteString Bool -> Parser ByteString Bool
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> Bool
    True Bool -> Parser () -> Parser ByteString Bool
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ String -> Parser ()
    stringCI ((String, String) -> String
    forall a b. (a, b) -> b
    snd (String, String)
    amPm)
                    TimeFlag -> Lens' TimeParse Bool
    flag TimeFlag
    PostMeridiem Overloaded (->) Identity TimeParse TimeParse Bool Bool
    -> Bool -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    .= Bool
    pm
                    TimeFlag -> Lens' TimeParse Bool
    flag TimeFlag
    TwelveHour Overloaded (->) Identity TimeParse TimeParse Bool Bool
    -> Bool -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    .= Bool
    True
                    String -> StateT TimeParse Parser ()
    go String
    rspec
                -- NOTE: if a greedy parse fails or causes a later failure,
                -- then backtrack and only accept 4-digit years; see #5.
                fullYear :: StateT TimeParse Parser ()
    fullYear = Parser ByteString Int -> StateT TimeParse Parser ()
    year (Parser ByteString Int -> Parser ByteString Int
    forall n. Integral n => Parser n -> Parser n
    negative Parser ByteString Int
    forall a. Integral a => Parser a
    P.decimal) StateT TimeParse Parser ()
    -> StateT TimeParse Parser () -> StateT TimeParse Parser ()
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> Parser ByteString Int -> StateT TimeParse Parser ()
    year (Int -> Parser ByteString Int
    dec0 4) where
                    year :: Parser ByteString Int -> StateT TimeParse Parser ()
    year p :: Parser ByteString Int
    p = do
                        (c :: Int
    c, y :: Int
    y) <- (Int -> Int -> (Int, Int)
    forall a. Integral a => a -> a -> (a, a)
    `divMod` 100) (Int -> (Int, Int))
    -> StateT TimeParse Parser Int
    -> StateT TimeParse Parser (Int, Int)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift Parser ByteString Int
    p
                        TimeFlag -> Lens' TimeParse Bool
    flag TimeFlag
    HasCentury Overloaded (->) Identity TimeParse TimeParse Bool Bool
    -> Bool -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    .= Bool
    True
                        Setter TimeParse TimeParse Int Int
    Lens TimeParse TimeParse Int Int
    _tpCentury Setter TimeParse TimeParse Int Int
    -> Int -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    .= Int
    c
                        Setter TimeParse TimeParse Int Int
    Lens TimeParse TimeParse Int Int
    _tpCenturyYear Setter TimeParse TimeParse Int Int
    -> Int -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    .= Int
    y
                        String -> StateT TimeParse Parser ()
    go String
    rspec
                setHour12 :: Int -> StateT TimeParse Parser ()
    setHour12 h :: Int
    h = do
                    TimeFlag -> Lens' TimeParse Bool
    flag TimeFlag
    TwelveHour Overloaded (->) Identity TimeParse TimeParse Bool Bool
    -> Bool -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    .= Bool
    True
                    Setter TimeParse TimeParse Int Int
    Lens TimeParse TimeParse Int Int
    _tpHour Setter TimeParse TimeParse Int Int
    -> Int -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    .= Int
    h
                    String -> StateT TimeParse Parser ()
    go String
    rspec
                setHour24 :: Int -> StateT TimeParse Parser ()
    setHour24 h :: Int
    h = do
                    TimeFlag -> Lens' TimeParse Bool
    flag TimeFlag
    TwelveHour Overloaded (->) Identity TimeParse TimeParse Bool Bool
    -> Bool -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    .= Bool
    False
                    Setter TimeParse TimeParse Int Int
    Lens TimeParse TimeParse Int Int
    _tpHour Setter TimeParse TimeParse Int Int
    -> Int -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    .= Int
    h
                    String -> StateT TimeParse Parser ()
    go String
    rspec
                setCenturyYear :: Int -> StateT TimeParse Parser ()
    setCenturyYear y :: Int
    y = do Setter TimeParse TimeParse Int Int
    Lens TimeParse TimeParse Int Int
    _tpCenturyYear Setter TimeParse TimeParse Int Int
    -> Int -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    .= Int
    y; String -> StateT TimeParse Parser ()
    go String
    rspec
                setCentury :: Int -> StateT TimeParse Parser ()
    setCentury c :: Int
    c = do
                    Setter TimeParse TimeParse Int Int
    Lens TimeParse TimeParse Int Int
    _tpCentury Setter TimeParse TimeParse Int Int
    -> Int -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    .= Int
    c
                    TimeFlag -> Lens' TimeParse Bool
    flag TimeFlag
    HasCentury Overloaded (->) Identity TimeParse TimeParse Bool Bool
    -> Bool -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    .= Bool
    True
                    String -> StateT TimeParse Parser ()
    go String
    rspec
                setMonth :: Int -> StateT TimeParse Parser ()
    setMonth m :: Int
    m = do
                    TimeFlag -> Lens' TimeParse Bool
    flag TimeFlag
    IsGregorian Overloaded (->) Identity TimeParse TimeParse Bool Bool
    -> Bool -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    .= Bool
    True
                    Setter TimeParse TimeParse Int Int
    Lens TimeParse TimeParse Int Int
    _tpMonth Setter TimeParse TimeParse Int Int
    -> Int -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    .= Int
    m
                    String -> StateT TimeParse Parser ()
    go String
    rspec
                setDayOfMonth :: Int -> StateT TimeParse Parser ()
    setDayOfMonth d :: Int
    d = do
                    TimeFlag -> Lens' TimeParse Bool
    flag TimeFlag
    IsGregorian Overloaded (->) Identity TimeParse TimeParse Bool Bool
    -> Bool -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    .= Bool
    True
                    Setter TimeParse TimeParse Int Int
    Lens TimeParse TimeParse Int Int
    _tpDayOfMonth Setter TimeParse TimeParse Int Int
    -> Int -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    .= Int
    d
                    String -> StateT TimeParse Parser ()
    go String
    rspec
                setWeekOfYear :: Int -> StateT TimeParse Parser ()
    setWeekOfYear w :: Int
    w = do Setter TimeParse TimeParse Int Int
    Lens TimeParse TimeParse Int Int
    _tpWeekOfYear Setter TimeParse TimeParse Int Int
    -> Int -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    .= Int
    w; String -> StateT TimeParse Parser ()
    go String
    rspec
                setDayOfWeek :: Int -> StateT TimeParse Parser ()
    setDayOfWeek d :: Int
    d = do Setter TimeParse TimeParse Int Int
    Lens TimeParse TimeParse Int Int
    _tpDayOfWeek Setter TimeParse TimeParse Int Int
    -> Int -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    .= Int
    d; String -> StateT TimeParse Parser ()
    go String
    rspec
                tzOffset :: StateT TimeParse Parser ()
    tzOffset = do
                    Int -> Int
    s <- Parser ByteString (Int -> Int)
    -> StateT TimeParse Parser (Int -> Int)
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Int -> Int
    forall a. a -> a
    id (Int -> Int) -> Parser Char -> Parser ByteString (Int -> Int)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ Char -> Parser Char
    P.char '+' Parser ByteString (Int -> Int)
    -> Parser ByteString (Int -> Int) -> Parser ByteString (Int -> Int)
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> Int -> Int
    forall a. Num a => a -> a
    negate (Int -> Int) -> Parser Char -> Parser ByteString (Int -> Int)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ Char -> Parser Char
    P.char '-')
                    Int
    h <- Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Int -> Parser ByteString Int
    dec0 2)
                    () () -> StateT TimeParse Parser Char -> StateT TimeParse Parser ()
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ Parser Char -> StateT TimeParse Parser Char
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Char -> Parser Char
    P.char ':') StateT TimeParse Parser ()
    -> StateT TimeParse Parser () -> StateT TimeParse Parser ()
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> () -> StateT TimeParse Parser ()
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure ()
                    Int
    m <- Parser ByteString Int -> StateT TimeParse Parser Int
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Int -> Parser ByteString Int
    dec0 2)
                    Overloaded (->) Identity TimeParse TimeParse TimeZone TimeZone
    Lens TimeParse TimeParse TimeZone TimeZone
    _tpTimeZone Overloaded (->) Identity TimeParse TimeParse TimeZone TimeZone
    -> ((Int -> Identity Int) -> TimeZone -> Identity TimeZone)
    -> Setter TimeParse TimeParse Int Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Int -> Identity Int) -> TimeZone -> Identity TimeZone
    Lens' TimeZone Int
    _timeZoneMinutes Setter TimeParse TimeParse Int Int
    -> Int -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    .= Int -> Int
    s (Int
    h Int -> Int -> Int
    forall a. Num a => a -> a -> a
    * 60 Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    m)
                tzName :: StateT TimeParse Parser ()
    tzName = Parser ByteString TimeZone -> StateT TimeParse Parser TimeZone
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift Parser ByteString TimeZone
    timeZoneParser StateT TimeParse Parser TimeZone
    -> (TimeZone -> StateT TimeParse Parser ())
    -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Overloaded (->) Identity TimeParse TimeParse TimeZone TimeZone
    -> TimeZone -> StateT TimeParse Parser ()
    forall s (m :: * -> *) a b.
    MonadState s m =>
    Setter s s a b -> b -> m ()
    assign Overloaded (->) Identity TimeParse TimeParse TimeZone TimeZone
    Lens TimeParse TimeParse TimeZone TimeZone
    _tpTimeZone

            c :: Char
    c : rspec :: String
    rspec | Char -> Bool
    P.isSpace Char
    c ->
                Parser ByteString ByteString -> StateT TimeParse Parser ByteString
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift ((Char -> Bool) -> Parser ByteString ByteString
    P.takeWhile Char -> Bool
    P.isSpace) StateT TimeParse Parser ByteString
    -> StateT TimeParse Parser () -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> String -> StateT TimeParse Parser ()
    go ((Char -> Bool) -> String -> String
    forall a. (a -> Bool) -> [a] -> [a]
    dropWhile Char -> Bool
    P.isSpace String
    rspec)
            c :: Char
    c : rspec :: String
    rspec | Char -> Bool
    isAscii Char
    c -> Parser Char -> StateT TimeParse Parser Char
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Char -> Parser Char
    P.char Char
    c) StateT TimeParse Parser Char
    -> StateT TimeParse Parser () -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> String -> StateT TimeParse Parser ()
    go String
    rspec
            c :: Char
    c : rspec :: String
    rspec -> Parser () -> StateT TimeParse Parser ()
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Char -> Parser ()
    charU8 Char
    c) StateT TimeParse Parser ()
    -> StateT TimeParse Parser () -> StateT TimeParse Parser ()
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> String -> StateT TimeParse Parser ()
    go String
    rspec
            "" -> () -> StateT TimeParse Parser ()
    forall (m :: * -> *) a. Monad m => a -> m a
    return ()

        {-# INLINE micro #-}
        micro :: Parser Micro
        micro :: Parser ByteString Micro
    micro = do
            Int64
    us10 <- (String -> Parser ByteString Int64)
    -> (Int64 -> Parser ByteString Int64)
    -> Either String Int64
    -> Parser ByteString Int64
    forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
    either String -> Parser ByteString Int64
    forall (m :: * -> *) a. MonadFail m => String -> m a
    fail Int64 -> Parser ByteString Int64
    forall (m :: * -> *) a. Monad m => a -> m a
    return (Either String Int64 -> Parser ByteString Int64)
    -> (ByteString -> Either String Int64)
    -> ByteString
    -> Parser ByteString Int64
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Parser ByteString Int64 -> ByteString -> Either String Int64
    forall a. Parser a -> ByteString -> Either String a
    P.parseOnly Parser ByteString Int64
    forall a. Integral a => Parser a
    P.decimal (ByteString -> Either String Int64)
    -> (ByteString -> ByteString) -> ByteString -> Either String Int64
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> ByteString -> ByteString
    S.take 7
                (ByteString -> ByteString)
    -> (ByteString -> ByteString) -> ByteString -> ByteString
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (ByteString -> ByteString -> ByteString
    `S.append` String -> ByteString
    S.pack "000000") (ByteString -> Parser ByteString Int64)
    -> Parser ByteString ByteString -> Parser ByteString Int64
    forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
    =<< (Char -> Bool) -> Parser ByteString ByteString
    P.takeWhile1 Char -> Bool
    P.isDigit
            Micro -> Parser ByteString Micro
    forall (m :: * -> *) a. Monad m => a -> m a
    return (Micro -> Parser ByteString Micro)
    -> Micro -> Parser ByteString Micro
    forall a b. (a -> b) -> a -> b
    $ Int64 -> Micro
    Micro (Int64 -> Int64 -> Int64
    forall a. Integral a => a -> a -> a
    div (Int64
    us10 Int64 -> Int64 -> Int64
    forall a. Num a => a -> a -> a
    + 5) 10)

        {-# INLINE unixEpoch #-}
        unixEpoch :: TimeParse
        unixEpoch :: TimeParse
    unixEpoch = $WTimeParse :: Int
    -> Int
    -> Int
    -> Int
    -> Int
    -> Int
    -> Int
    -> Int
    -> Int
    -> Int
    -> Int
    -> DiffTime
    -> NominalDiffTime
    -> TimeZone
    -> TimeParse
    TimeParse {..} where
            tpCentury :: Int
    tpCentury = 19
            tpCenturyYear :: Int
    tpCenturyYear = 70
            tpMonth :: Int
    tpMonth = 1
            tpWeekOfYear :: Int
    tpWeekOfYear = 1
            tpDayOfYear :: Int
    tpDayOfYear = 1
            tpDayOfMonth :: Int
    tpDayOfMonth = 1
            tpDayOfWeek :: Int
    tpDayOfWeek = 4
            tpFlags :: Int
    tpFlags = 0
            tpHour :: Int
    tpHour = 0
            tpMinute :: Int
    tpMinute = 0
            tpSecond :: Int
    tpSecond = 0
            tpSecFrac :: DiffTime
    tpSecFrac = DiffTime
    forall v. AdditiveGroup v => v
    zeroV
            tpPOSIXTime :: NominalDiffTime
    tpPOSIXTime = NominalDiffTime
    forall v. AdditiveGroup v => v
    zeroV
            tpTimeZone :: TimeZone
    tpTimeZone = TimeZone
    utc

    {-# INLINEABLE parseTime #-}
    parseTime :: (ParseTime t) => TimeLocale -> String -> String -> Maybe t
    parseTime :: TimeLocale -> String -> String -> Maybe t
    parseTime l :: TimeLocale
    l spec :: String
    spec = (String -> Maybe t) -> (t -> Maybe t) -> Either String t -> Maybe t
    forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
    either (Maybe t -> String -> Maybe t
    forall a b. a -> b -> a
    const Maybe t
    forall a. Maybe a
    Nothing) t -> Maybe t
    forall a. a -> Maybe a
    Just
            (Either String t -> Maybe t)
    -> (String -> Either String t) -> String -> Maybe t
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Parser t -> ByteString -> Either String t
    forall a. Parser a -> ByteString -> Either String a
    P.parseOnly Parser t
    parser (ByteString -> Either String t)
    -> (String -> ByteString) -> String -> Either String t
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> ByteString
    utf8String where
        parser :: Parser t
    parser = TimeParse -> t
    forall t. ParseTime t => TimeParse -> t
    buildTime (TimeParse -> t) -> Parser () -> Parser ByteString (TimeParse -> t)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ Parser ()
    P.skipSpace Parser ByteString (TimeParse -> t) -> Parser TimeParse -> Parser t
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> TimeLocale -> String -> Parser TimeParse
    timeParser TimeLocale
    l String
    spec
            Parser t -> Parser () -> Parser t
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* Parser ()
    P.skipSpace Parser t -> Parser () -> Parser t
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* Parser ()
    forall t. Chunk t => Parser t ()
    P.endOfInput

    {-# INLINEABLE readTime #-}
    readTime :: (ParseTime t) => TimeLocale -> String -> String -> t
    readTime :: TimeLocale -> String -> String -> t
    readTime l :: TimeLocale
    l spec :: String
    spec = (String -> t) -> (t -> t) -> Either String t -> t
    forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
    either String -> t
    forall a. HasCallStack => String -> a
    error t -> t
    forall a. a -> a
    id (Either String t -> t)
    -> (String -> Either String t) -> String -> t
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Parser t -> ByteString -> Either String t
    forall a. Parser a -> ByteString -> Either String a
    P.parseOnly Parser t
    parser (ByteString -> Either String t)
    -> (String -> ByteString) -> String -> Either String t
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> ByteString
    utf8String where
        parser :: Parser t
    parser = TimeParse -> t
    forall t. ParseTime t => TimeParse -> t
    buildTime (TimeParse -> t) -> Parser () -> Parser ByteString (TimeParse -> t)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ Parser ()
    P.skipSpace Parser ByteString (TimeParse -> t) -> Parser TimeParse -> Parser t
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> TimeLocale -> String -> Parser TimeParse
    timeParser TimeLocale
    l String
    spec
            Parser t -> Parser () -> Parser t
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* Parser ()
    P.skipSpace Parser t -> Parser () -> Parser t
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* Parser ()
    forall t. Chunk t => Parser t ()
    P.endOfInput

    {-# INLINEABLE readsTime #-}
    readsTime :: (ParseTime t) => TimeLocale -> String -> ReadS t
    readsTime :: TimeLocale -> String -> ReadS t
    readsTime l :: TimeLocale
    l spec :: String
    spec = Parser t -> ReadS t
    forall a. Parser a -> ReadS a
    parserToReadS (Parser t -> ReadS t) -> Parser t -> ReadS t
    forall a b. (a -> b) -> a -> b
    $
        TimeParse -> t
    forall t. ParseTime t => TimeParse -> t
    buildTime (TimeParse -> t) -> Parser () -> Parser ByteString (TimeParse -> t)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ Parser ()
    P.skipSpace Parser ByteString (TimeParse -> t) -> Parser TimeParse -> Parser t
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> TimeLocale -> String -> Parser TimeParse
    timeParser TimeLocale
    l String
    spec

    ------------------------------------------------------------------------

    deriving instance Read UTCView
    #if SHOW_INTERNAL
    deriving instance Read Day
    deriving instance Read TimeOfDay
    deriving instance Read LocalTime
    deriving instance Read ZonedTime
    deriving instance Read TimeZone
    instance Read UTCTime where
        {-# INLINE readsPrec #-}
        readsPrec n = fmap (first $ review utcTime) . readsPrec n
    #else
    instance Read Day where
        {-# INLINEABLE readsPrec #-}
        readsPrec :: Int -> ReadS Day
    readsPrec _ = Bool -> ReadS Day -> ReadS Day
    forall a. Bool -> ReadS a -> ReadS a
    readParen Bool
    False (ReadS Day -> ReadS Day) -> ReadS Day -> ReadS Day
    forall a b. (a -> b) -> a -> b
    $
            TimeLocale -> String -> ReadS Day
    forall t. ParseTime t => TimeLocale -> String -> ReadS t
    readsTime TimeLocale
    defaultTimeLocale "%Y-%m-%d"

    instance Read TimeOfDay where
        {-# INLINEABLE readsPrec #-}
        readsPrec :: Int -> ReadS TimeOfDay
    readsPrec _ = Bool -> ReadS TimeOfDay -> ReadS TimeOfDay
    forall a. Bool -> ReadS a -> ReadS a
    readParen Bool
    False (ReadS TimeOfDay -> ReadS TimeOfDay)
    -> ReadS TimeOfDay -> ReadS TimeOfDay
    forall a b. (a -> b) -> a -> b
    $
            TimeLocale -> String -> ReadS TimeOfDay
    forall t. ParseTime t => TimeLocale -> String -> ReadS t
    readsTime TimeLocale
    defaultTimeLocale "%H:%M:%S%Q"

    instance Read LocalTime where
        {-# INLINEABLE readsPrec #-}
        readsPrec :: Int -> ReadS LocalTime
    readsPrec _ = Bool -> ReadS LocalTime -> ReadS LocalTime
    forall a. Bool -> ReadS a -> ReadS a
    readParen Bool
    False (ReadS LocalTime -> ReadS LocalTime)
    -> ReadS LocalTime -> ReadS LocalTime
    forall a b. (a -> b) -> a -> b
    $
            TimeLocale -> String -> ReadS LocalTime
    forall t. ParseTime t => TimeLocale -> String -> ReadS t
    readsTime TimeLocale
    defaultTimeLocale "%Y-%m-%d %H:%M:%S%Q"

    instance Read ZonedTime where
        {-# INLINEABLE readsPrec #-}
        readsPrec :: Int -> ReadS ZonedTime
    readsPrec _ = Bool -> ReadS ZonedTime -> ReadS ZonedTime
    forall a. Bool -> ReadS a -> ReadS a
    readParen Bool
    False (ReadS ZonedTime -> ReadS ZonedTime)
    -> ReadS ZonedTime -> ReadS ZonedTime
    forall a b. (a -> b) -> a -> b
    $
            TimeLocale -> String -> ReadS ZonedTime
    forall t. ParseTime t => TimeLocale -> String -> ReadS t
    readsTime TimeLocale
    defaultTimeLocale "%Y-%m-%d %H:%M:%S%Q %Z"

    instance Read UTCTime where
        {-# INLINEABLE readsPrec #-}
        readsPrec :: Int -> ReadS UTCTime
    readsPrec _ = Bool -> ReadS UTCTime -> ReadS UTCTime
    forall a. Bool -> ReadS a -> ReadS a
    readParen Bool
    False (ReadS UTCTime -> ReadS UTCTime) -> ReadS UTCTime -> ReadS UTCTime
    forall a b. (a -> b) -> a -> b
    $
            TimeLocale -> String -> ReadS UTCTime
    forall t. ParseTime t => TimeLocale -> String -> ReadS t
    readsTime TimeLocale
    defaultTimeLocale "%Y-%m-%d %H:%M:%S%Q %Z"
    #endif

    ------------------------------------------------------------------------

    class ParseTime t where
        buildTime :: TimeParse -> t

    instance ParseTime TimeOfDay where
        {-# INLINE buildTime #-}
        buildTime :: TimeParse -> TimeOfDay
    buildTime tp :: TimeParse
    tp@TimeParse {..} = Int -> Int -> DiffTime -> TimeOfDay
    TimeOfDay Int
    h Int
    tpMinute
                (Int -> DiffTime
    forall n t. (Real n, TimeDiff t) => n -> t
    fromSeconds Int
    tpSecond DiffTime -> DiffTime -> DiffTime
    forall v. AdditiveGroup v => v -> v -> v
    ^+^ DiffTime
    tpSecFrac) where
            h :: Int
    h = case TimeParse
    tp TimeParse -> Getting Bool TimeParse Bool -> Bool
    forall s a. s -> Getting a s a -> a
    ^. TimeFlag -> Lens' TimeParse Bool
    flag TimeFlag
    TwelveHour of
                False -> Int
    tpHour
                True -> case TimeParse
    tp TimeParse -> Getting Bool TimeParse Bool -> Bool
    forall s a. s -> Getting a s a -> a
    ^. TimeFlag -> Lens' TimeParse Bool
    flag TimeFlag
    PostMeridiem of
                    False -> Int -> Int -> Int
    forall a. Integral a => a -> a -> a
    mod Int
    tpHour 12
                    True -> if Int
    tpHour Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    < 12 then Int
    tpHour Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + 12 else Int
    tpHour

    {-# INLINE tpYear #-}
    tpYear :: TimeParse -> Year
    tpYear :: TimeParse -> Int
    tpYear tp :: TimeParse
    tp@TimeParse {..} = Int
    tpCenturyYear Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + 100 Int -> Int -> Int
    forall a. Num a => a -> a -> a
    * if TimeParse
    tp TimeParse -> Getting Bool TimeParse Bool -> Bool
    forall s a. s -> Getting a s a -> a
    ^. TimeFlag -> Lens' TimeParse Bool
    flag TimeFlag
    HasCentury
        then Int
    tpCentury else if Int
    tpCenturyYear Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    < 69 then 20 else 19

    instance ParseTime YearMonthDay where
        {-# INLINE buildTime #-}
        buildTime :: TimeParse -> YearMonthDay
    buildTime tp :: TimeParse
    tp@TimeParse {..} = Int -> Int -> Int -> YearMonthDay
    YearMonthDay (TimeParse -> Int
    tpYear TimeParse
    tp) Int
    tpMonth Int
    tpDayOfMonth

    instance ParseTime MonthDay where
        {-# INLINE buildTime #-}
        buildTime :: TimeParse -> MonthDay
    buildTime TimeParse {..} = Int -> Int -> MonthDay
    MonthDay Int
    tpMonth Int
    tpDayOfMonth

    instance ParseTime OrdinalDate where
        {-# INLINE buildTime #-}
        buildTime :: TimeParse -> OrdinalDate
    buildTime tp :: TimeParse
    tp@TimeParse {..} = Int -> Int -> OrdinalDate
    OrdinalDate (TimeParse -> Int
    tpYear TimeParse
    tp) Int
    tpDayOfYear

    instance ParseTime WeekDate where
        {-# INLINE buildTime #-}
        buildTime :: TimeParse -> WeekDate
    buildTime tp :: TimeParse
    tp@TimeParse {..} = Int -> Int -> Int -> WeekDate
    WeekDate (TimeParse -> Int
    tpYear TimeParse
    tp) Int
    tpWeekOfYear
            (if Int
    tpDayOfWeek Int -> Int -> Bool
    forall a. Eq a => a -> a -> Bool
    == 0 then 7 else Int
    tpDayOfWeek)

    instance ParseTime SundayWeek where
        {-# INLINE buildTime #-}
        buildTime :: TimeParse -> SundayWeek
    buildTime tp :: TimeParse
    tp@TimeParse {..} = Int -> Int -> Int -> SundayWeek
    SundayWeek (TimeParse -> Int
    tpYear TimeParse
    tp) Int
    tpWeekOfYear
            (if Int
    tpDayOfWeek Int -> Int -> Bool
    forall a. Eq a => a -> a -> Bool
    == 7 then 0 else Int
    tpDayOfWeek)

    instance ParseTime MondayWeek where
        {-# INLINE buildTime #-}
        buildTime :: TimeParse -> MondayWeek
    buildTime tp :: TimeParse
    tp@TimeParse {..} = Int -> Int -> Int -> MondayWeek
    MondayWeek (TimeParse -> Int
    tpYear TimeParse
    tp) Int
    tpWeekOfYear
            (if Int
    tpDayOfWeek Int -> Int -> Bool
    forall a. Eq a => a -> a -> Bool
    == 0 then 7 else Int
    tpDayOfWeek)

    instance ParseTime LocalTime where
        {-# INLINE buildTime #-}
        buildTime :: TimeParse -> LocalTime
    buildTime = Day -> TimeOfDay -> LocalTime
    LocalTime (Day -> TimeOfDay -> LocalTime)
    -> (TimeParse -> Day) -> TimeParse -> TimeOfDay -> LocalTime
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> TimeParse -> Day
    forall t. ParseTime t => TimeParse -> t
    buildTime (TimeParse -> TimeOfDay -> LocalTime)
    -> (TimeParse -> TimeOfDay) -> TimeParse -> LocalTime
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> TimeParse -> TimeOfDay
    forall t. ParseTime t => TimeParse -> t
    buildTime

    instance ParseTime Day where
        {-# INLINE buildTime #-}
        buildTime :: TimeParse -> Day
    buildTime tp :: TimeParse
    tp@TimeParse {..}
            | TimeParse
    tp TimeParse -> Getting Bool TimeParse Bool -> Bool
    forall s a. s -> Getting a s a -> a
    ^. TimeFlag -> Lens' TimeParse Bool
    flag TimeFlag
    IsOrdinalDate = Overloaded Reviewed Identity Day Day OrdinalDate OrdinalDate
    Iso' Day OrdinalDate
    ordinalDate Overloaded Reviewed Identity Day Day OrdinalDate OrdinalDate
    -> OrdinalDate -> Day
    forall s t a b. AReview s t a b -> b -> t
    # TimeParse -> OrdinalDate
    forall t. ParseTime t => TimeParse -> t
    buildTime TimeParse
    tp
            | TimeParse
    tp TimeParse -> Getting Bool TimeParse Bool -> Bool
    forall s a. s -> Getting a s a -> a
    ^. TimeFlag -> Lens' TimeParse Bool
    flag TimeFlag
    IsGregorian = Overloaded Reviewed Identity Day Day YearMonthDay YearMonthDay
    Iso' Day YearMonthDay
    gregorian Overloaded Reviewed Identity Day Day YearMonthDay YearMonthDay
    -> YearMonthDay -> Day
    forall s t a b. AReview s t a b -> b -> t
    # TimeParse -> YearMonthDay
    forall t. ParseTime t => TimeParse -> t
    buildTime TimeParse
    tp
            | TimeParse
    tp TimeParse -> Getting Bool TimeParse Bool -> Bool
    forall s a. s -> Getting a s a -> a
    ^. TimeFlag -> Lens' TimeParse Bool
    flag TimeFlag
    IsWeekDate = Overloaded Reviewed Identity Day Day WeekDate WeekDate
    Iso' Day WeekDate
    weekDate Overloaded Reviewed Identity Day Day WeekDate WeekDate
    -> WeekDate -> Day
    forall s t a b. AReview s t a b -> b -> t
    # TimeParse -> WeekDate
    forall t. ParseTime t => TimeParse -> t
    buildTime TimeParse
    tp
            | TimeParse
    tp TimeParse -> Getting Bool TimeParse Bool -> Bool
    forall s a. s -> Getting a s a -> a
    ^. TimeFlag -> Lens' TimeParse Bool
    flag TimeFlag
    IsSundayWeek = Overloaded Reviewed Identity Day Day SundayWeek SundayWeek
    Iso' Day SundayWeek
    sundayWeek Overloaded Reviewed Identity Day Day SundayWeek SundayWeek
    -> SundayWeek -> Day
    forall s t a b. AReview s t a b -> b -> t
    # TimeParse -> SundayWeek
    forall t. ParseTime t => TimeParse -> t
    buildTime TimeParse
    tp
            | TimeParse
    tp TimeParse -> Getting Bool TimeParse Bool -> Bool
    forall s a. s -> Getting a s a -> a
    ^. TimeFlag -> Lens' TimeParse Bool
    flag TimeFlag
    IsMondayWeek = Overloaded Reviewed Identity Day Day MondayWeek MondayWeek
    Iso' Day MondayWeek
    mondayWeek Overloaded Reviewed Identity Day Day MondayWeek MondayWeek
    -> MondayWeek -> Day
    forall s t a b. AReview s t a b -> b -> t
    # TimeParse -> MondayWeek
    forall t. ParseTime t => TimeParse -> t
    buildTime TimeParse
    tp
            | Bool
    otherwise = Overloaded Reviewed Identity Day Day OrdinalDate OrdinalDate
    Iso' Day OrdinalDate
    ordinalDate Overloaded Reviewed Identity Day Day OrdinalDate OrdinalDate
    -> OrdinalDate -> Day
    forall s t a b. AReview s t a b -> b -> t
    # TimeParse -> OrdinalDate
    forall t. ParseTime t => TimeParse -> t
    buildTime TimeParse
    tp
            -- TODO: Better conflict handling when multiple flags are set?

    instance ParseTime TimeZone where
        {-# INLINE buildTime #-}
        buildTime :: TimeParse -> TimeZone
    buildTime = TimeParse -> TimeZone
    tpTimeZone

    instance ParseTime ZonedTime where
        {-# INLINE buildTime #-}
        buildTime :: TimeParse -> ZonedTime
    buildTime = LocalTime -> TimeZone -> ZonedTime
    ZonedTime (LocalTime -> TimeZone -> ZonedTime)
    -> (TimeParse -> LocalTime) -> TimeParse -> TimeZone -> ZonedTime
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> TimeParse -> LocalTime
    forall t. ParseTime t => TimeParse -> t
    buildTime (TimeParse -> TimeZone -> ZonedTime)
    -> (TimeParse -> TimeZone) -> TimeParse -> ZonedTime
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> TimeParse -> TimeZone
    forall t. ParseTime t => TimeParse -> t
    buildTime

    instance ParseTime UTCTime where
        {-# INLINE buildTime #-}
        buildTime :: TimeParse -> UTCTime
    buildTime tp :: TimeParse
    tp@TimeParse {..} = if TimeParse
    tp TimeParse -> Getting Bool TimeParse Bool -> Bool
    forall s a. s -> Getting a s a -> a
    ^. TimeFlag -> Lens' TimeParse Bool
    flag TimeFlag
    IsPOSIXTime
            then Overloaded
      Reviewed Identity UTCTime UTCTime NominalDiffTime NominalDiffTime
    Iso' UTCTime NominalDiffTime
    posixTime Overloaded
      Reviewed Identity UTCTime UTCTime NominalDiffTime NominalDiffTime
    -> NominalDiffTime -> UTCTime
    forall s t a b. AReview s t a b -> b -> t
    # NominalDiffTime
    tpPOSIXTime
            else (TimeZone, UTCTime) -> UTCTime
    forall a b. (a, b) -> b
    snd ((TimeZone, UTCTime) -> UTCTime) -> (TimeZone, UTCTime) -> UTCTime
    forall a b. (a -> b) -> a -> b
    $ TimeParse -> ZonedTime
    forall t. ParseTime t => TimeParse -> t
    buildTime TimeParse
    tp ZonedTime
    -> Getting (TimeZone, UTCTime) ZonedTime (TimeZone, UTCTime)
    -> (TimeZone, UTCTime)
    forall s a. s -> Getting a s a -> a
    ^. AnIso (TimeZone, UTCTime) (TimeZone, UTCTime) ZonedTime ZonedTime
    -> Iso ZonedTime ZonedTime (TimeZone, UTCTime) (TimeZone, UTCTime)
    forall s t a b. AnIso s t a b -> Iso b a t s
    from AnIso (TimeZone, UTCTime) (TimeZone, UTCTime) ZonedTime ZonedTime
    Iso' (TimeZone, UTCTime) ZonedTime
    zonedTime

    instance ParseTime UniversalTime where
        {-# INLINE buildTime #-}
        buildTime :: TimeParse -> UniversalTime
    buildTime (TimeParse -> UTCTime
    forall t. ParseTime t => TimeParse -> t
    buildTime -> UTCRep t :: NominalDiffTime
    t) = NominalDiffTime -> UniversalTime
    UniversalRep NominalDiffTime
    t

    instance ParseTime AbsoluteTime where
        {-# INLINE buildTime #-}
        buildTime :: TimeParse -> AbsoluteTime
    buildTime tp :: TimeParse
    tp = TimeParse -> UTCTime
    forall t. ParseTime t => TimeParse -> t
    buildTime TimeParse
    tp UTCTime
    -> Getting AbsoluteTime UTCTime AbsoluteTime -> AbsoluteTime
    forall s a. s -> Getting a s a -> a
    ^. LeapSecondTable -> Iso' UTCTime AbsoluteTime
    absoluteTime (DiffTime -> LeapSecondTable
    forall a b. a -> b -> a
    const DiffTime
    forall v. AdditiveGroup v => v
    zeroV)

    ------------------------------------------------------------------------

    -- Dubiously pilfered from time-1.4.0.2
    -- s/^.*-- \(.*\)\n.*\("[A-Z]\+"\).*"\([+-]\)\([0-9]\{2\}\):\([0-9]\{2\}\)", \(True\|False\).*$/    <|> zone \2 (($\3) \4 \5) \6 -- \1/
    -- followed by !sort -r , because some names are prefixes of others.
    timeZoneParser :: Parser TimeZone
    timeZoneParser :: Parser ByteString TimeZone
    timeZoneParser = String -> Int -> Bool -> Parser ByteString TimeZone
    zone "TAI" 0 Bool
    False Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "UT1" 0 Bool
    False

        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "ZULU" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 00 00) Bool
    False --  Same as UTC
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "Z" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 00 00) Bool
    False --  Same as UTC
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "YST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 09 00) Bool
    False -- Yukon Standard Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "YDT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 08 00) Bool
    True -- Yukon Daylight-Saving Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "WST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 08 00) Bool
    False -- West Australian Standard Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "WETDST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 01 00) Bool
    True -- Western European Daylight-Saving Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "WET" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 00 00) Bool
    False --  Western European Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "WDT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 09 00) Bool
    True -- West Australian Daylight-Saving Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "WAT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 01 00) Bool
    False -- West Africa Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "WAST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 07 00) Bool
    False -- West Australian Standard Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "WADT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 08 00) Bool
    True -- West Australian Daylight-Saving Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "UTC" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 00 00) Bool
    False --  Universal Coordinated Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "UT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 00 00) Bool
    False --  Universal Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "TFT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 05 00) Bool
    False -- Kerguelen Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "SWT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 01 00) Bool
    False -- Swedish Winter Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "SST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 02 00) Bool
    False -- Swedish Summer Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "SET" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 01 00) Bool
    False -- Seychelles Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "SCT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 04 00) Bool
    False -- Mahe Island Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "SAST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 09 30) Bool
    False -- South Australia Standard Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "SADT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 10 30) Bool
    True -- South Australian Daylight-Saving Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "RET" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 04 00) Bool
    False -- Reunion Island Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "PST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 08 00) Bool
    False -- Pacific Standard Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "PDT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 07 00) Bool
    True -- Pacific Daylight-Saving Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "NZT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 12 00) Bool
    False -- New Zealand Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "NZST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 12 00) Bool
    False -- New Zealand Standard Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "NZDT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 13 00) Bool
    True -- New Zealand Daylight-Saving Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "NT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 11 00) Bool
    False -- Nome Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "NST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 03 30) Bool
    False -- Newfoundland Standard Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "NOR" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 01 00) Bool
    False -- Norway Standard Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "NFT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 03 30) Bool
    False -- Newfoundland Standard Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "NDT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 02 30) Bool
    True -- Newfoundland Daylight-Saving Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "MVT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 05 00) Bool
    False -- Maldives Island Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "MUT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 04 00) Bool
    False -- Mauritius Island Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "MT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 08 30) Bool
    False -- Moluccas Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "MST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 07 00) Bool
    False -- Mountain Standard Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "MMT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 06 30) Bool
    False -- Myanmar Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "MHT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 09 00) Bool
    False -- Kwajalein Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "MEZ" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 01 00) Bool
    False -- Mitteleuropaeische Zeit
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "MEWT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 01 00) Bool
    False -- Middle European Winter Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "METDST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 02 00) Bool
    True -- Middle Europe Daylight-Saving Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "MET" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 01 00) Bool
    False -- Middle European Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "MEST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 02 00) Bool
    False -- Middle European Summer Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "MDT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 06 00) Bool
    True -- Mountain Daylight-Saving Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "MAWT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 06 00) Bool
    False -- Mawson (Antarctica) Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "MART" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 09 30) Bool
    False -- Marquesas Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "LIGT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 10 00) Bool
    False -- Melbourne, Australia
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "KST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 09 00) Bool
    False -- Korea Standard Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "JT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 07 30) Bool
    False -- Java Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "JST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 09 00) Bool
    False -- Japan Standard Time, Russia zone 8
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "IT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 03 30) Bool
    False -- Iran Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "IST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 02 00) Bool
    False -- Israel Standard Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "IRT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 03 30) Bool
    False -- Iran Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "IOT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 05 00) Bool
    False -- Indian Chagos Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "IDLW" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 12 00) Bool
    False -- International Date Line, West
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "IDLE" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 12 00) Bool
    False -- International Date Line, East
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "HST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 10 00) Bool
    False -- Hawaii Standard Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "HMT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 03 00) Bool
    False -- Hellas Mediterranean Time (?)
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "HDT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 09 00) Bool
    True -- Hawaii/Alaska Daylight-Saving Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "GST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 10 00) Bool
    False -- Guam Standard Time, Russia zone 9
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "GMT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 00 00) Bool
    False --  Greenwich Mean Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "FWT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 02 00) Bool
    False -- French Winter Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "FST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 01 00) Bool
    False -- French Summer Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "FNT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 02 00) Bool
    False -- Fernando de Noronha Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "FNST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 01 00) Bool
    False -- Fernando de Noronha Summer Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "EST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 05 00) Bool
    False -- Eastern Standard Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "EETDST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 03 00) Bool
    True -- Eastern Europe Daylight-Saving Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "EET" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 02 00) Bool
    False -- Eastern European Time, Russia zone 1
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "EDT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 04 00) Bool
    True -- Eastern Daylight-Saving Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "EAT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 03 00) Bool
    False -- Antananarivo, Comoro Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "EAST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 10 00) Bool
    False -- East Australian Standard Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "EAST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 04 00) Bool
    False -- Antananarivo Summer Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "DNT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 01 00) Bool
    False -- Dansk Normal Tid
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "CXT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 07 00) Bool
    False -- Christmas (Island) Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "CST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 06 00) Bool
    False -- Central Standard Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "CETDST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 02 00) Bool
    True -- Central European Daylight-Saving Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "CET" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 01 00) Bool
    False -- Central European Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "CEST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 02 00) Bool
    False -- Central European Summer Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "CDT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 05 00) Bool
    True -- Central Daylight-Saving Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "CCT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 08 00) Bool
    False -- China Coastal Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "CAT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 10 00) Bool
    False -- Central Alaska Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "CAST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 09 30) Bool
    False -- Central Australia Standard Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "CADT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 10 30) Bool
    True -- Central Australia Daylight-Saving Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "BT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 03 00) Bool
    False -- Baghdad Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "BST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 01 00) Bool
    False -- British Summer Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "BRT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 03 00) Bool
    False -- Brasilia Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "BRST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 02 00) Bool
    False -- Brasilia Summer Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "BDST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 02 00) Bool
    False -- British Double Summer Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "AWT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 03 00) Bool
    False -- (unknown)
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "AWST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 08 00) Bool
    False -- Australia Western Standard Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "AWSST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 09 00) Bool
    False -- Australia Western Summer Standard Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "AST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 04 00) Bool
    False -- Atlantic Standard Time (Canada)
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "ALMT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 06 00) Bool
    False -- Almaty Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "ALMST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 07 00) Bool
    False -- Almaty Summer Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "AKST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 09 00) Bool
    False -- Alaska Standard Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "AKDT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 08 00) Bool
    True -- Alaska Daylight-Saving Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "AHST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 10 00) Bool
    False -- Alaska/Hawaii Standard Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "AFT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 04 30) Bool
    False -- Afghanistan Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "AEST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 10 00) Bool
    False -- Australia Eastern Standard Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "AESST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 11 00) Bool
    False -- Australia Eastern Summer Standard Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "ADT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 03 00) Bool
    True -- Atlantic Daylight-Saving Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "ACT" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 05 00) Bool
    False -- Atlantic/Porto Acre Standard Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "ACST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($-) 04 00) Bool
    False -- Atlantic/Porto Acre Summer Time
        Parser ByteString TimeZone
    -> Parser ByteString TimeZone -> Parser ByteString TimeZone
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> String -> Int -> Bool -> Parser ByteString TimeZone
    zone "ACSST" (Int -> Int -> Int
    forall a. Num a => a -> a -> a
    ($+) 10 30) Bool
    False -- Central Australia Summer Standard Time

      where
        zone :: String -> Int -> Bool -> Parser ByteString TimeZone
    zone name :: String
    name offset :: Int
    offset dst :: Bool
    dst = Int -> Bool -> String -> TimeZone
    TimeZone Int
    offset Bool
    dst String
    name TimeZone
    -> Parser ByteString ByteString -> Parser ByteString TimeZone
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ ByteString -> Parser ByteString ByteString
    P.string (String -> ByteString
    S.pack String
    name)
        $+ :: a -> a -> a
    ($+) h :: a
    h m :: a
    m = a
    h a -> a -> a
    forall a. Num a => a -> a -> a
    * 60 a -> a -> a
    forall a. Num a => a -> a -> a
    + a
    m
        $- :: a -> a -> a
    ($-) h :: a
    h m :: a
    m = a -> a
    forall a. Num a => a -> a
    negate (a
    h a -> a -> a
    forall a. Num a => a -> a -> a
    * 60 a -> a -> a
    forall a. Num a => a -> a -> a
    + a
    m)