{-# LANGUAGE CPP #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE ViewPatterns #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
#if __GLASGOW_HASKELL__ >= 810
{-# OPTIONS_GHC -Wno-unused-record-wildcards #-}
#endif
#include "thyme.h"
module Data.Thyme.Format
(
FormatTime (..)
, formatTime
, ParseTime (..)
, parseTime
, readTime
, readsTime
, TimeParse (..)
, timeParser
, TimeLocale (..)
, defaultTimeLocale
) 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
#if MIN_VERSION_time(1,5,0)
import Data.Time.Format (TimeLocale (..), defaultTimeLocale)
#else
import System.Locale
#endif
class FormatTime t where
showsTime
:: TimeLocale
-> t
-> (Char -> ShowS)
-> Char
-> ShowS
{-# INLINEABLE formatTime #-}
formatTime :: (FormatTime t)
=> TimeLocale
-> String
-> t
-> String
formatTime :: forall t. FormatTime t => TimeLocale -> String -> t -> String
formatTime l :: TimeLocale
l@TimeLocale {String
[(String, String)]
[TimeZone]
(String, String)
amPm :: TimeLocale -> (String, String)
dateFmt :: TimeLocale -> String
dateTimeFmt :: TimeLocale -> String
knownTimeZones :: TimeLocale -> [TimeZone]
months :: TimeLocale -> [(String, String)]
time12Fmt :: TimeLocale -> String
timeFmt :: TimeLocale -> String
wDays :: TimeLocale -> [(String, String)]
knownTimeZones :: [TimeZone]
time12Fmt :: String
timeFmt :: String
dateFmt :: String
dateTimeFmt :: String
amPm :: (String, String)
months :: [(String, String)]
wDays :: [(String, String)]
..} String
spec t
t = String -> String -> String
go String
spec String
"" where
format :: Char -> String -> String
format = forall t.
FormatTime t =>
TimeLocale
-> t -> (Char -> String -> String) -> Char -> String -> String
showsTime TimeLocale
l t
t (\ Char
c String
s -> Char
'%' forall a. a -> [a] -> [a]
: Char
c forall a. a -> [a] -> [a]
: String
s)
go :: String -> String -> String
go String
s = case String
s of
Char
'%' : Char
c : String
rest -> case Char
c of
Char
'c' -> String -> String -> String
go (String
dateTimeFmt forall a. [a] -> [a] -> [a]
++ String
rest)
Char
'r' -> String -> String -> String
go (String
time12Fmt forall a. [a] -> [a] -> [a]
++ String
rest)
Char
'X' -> String -> String -> String
go (String
timeFmt forall a. [a] -> [a] -> [a]
++ String
rest)
Char
'x' -> String -> String -> String
go (String
dateFmt forall a. [a] -> [a] -> [a]
++ String
rest)
Char
'-' -> String -> String -> String
go (Char
'%' forall a. a -> [a] -> [a]
: String
rest)
Char
'_' -> String -> String -> String
go (Char
'%' forall a. a -> [a] -> [a]
: String
rest)
Char
'0' -> String -> String -> String
go (Char
'%' forall a. a -> [a] -> [a]
: String
rest)
Char
'^' -> String -> String -> String
go (Char
'%' forall a. a -> [a] -> [a]
: String
rest)
Char
'#' -> String -> String -> String
go (Char
'%' forall a. a -> [a] -> [a]
: String
rest)
Char
'%' -> (:) Char
'%' forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> String -> String
go String
rest
Char
_ -> Char -> String -> String
format Char
c forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> String -> String
go String
rest
Char
c : String
rest -> (:) Char
c forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> String -> String
go String
rest
[] -> forall a. a -> a
id
{-# INLINE showsY #-}
showsY :: Year -> ShowS
#if BUG_FOR_BUG
showsY :: Int -> String -> String
showsY = forall a. Show a => a -> String -> String
shows
#else
showsY = showsYear
#endif
instance FormatTime TimeOfDay where
{-# INLINEABLE showsTime #-}
showsTime :: TimeLocale
-> TimeOfDay
-> (Char -> String -> String)
-> Char
-> String
-> String
showsTime TimeLocale{String
[(String, String)]
[TimeZone]
(String, String)
knownTimeZones :: [TimeZone]
time12Fmt :: String
timeFmt :: String
dateFmt :: String
dateTimeFmt :: String
amPm :: (String, String)
months :: [(String, String)]
wDays :: [(String, String)]
amPm :: TimeLocale -> (String, String)
dateFmt :: TimeLocale -> String
dateTimeFmt :: TimeLocale -> String
knownTimeZones :: TimeLocale -> [TimeZone]
months :: TimeLocale -> [(String, String)]
time12Fmt :: TimeLocale -> String
timeFmt :: TimeLocale -> String
wDays :: TimeLocale -> [(String, String)]
..} (TimeOfDay Int
h Int
m (DiffTime Micro
s)) = \ Char -> String -> String
def Char
c -> case Char
c of
Char
'R' -> Int -> String -> String
shows02 Int
h forall b c a. (b -> c) -> (a -> b) -> a -> c
. (:) Char
':' forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> String -> String
shows02 Int
m
Char
'T' -> Int -> String -> String
shows02 Int
h forall b c a. (b -> c) -> (a -> b) -> a -> c
. (:) Char
':' forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> String -> String
shows02 Int
m forall b c a. (b -> c) -> (a -> b) -> a -> c
. (:) Char
':' forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> String -> String
shows02 Int
si
Char
'P' -> forall a. [a] -> [a] -> [a]
(++) forall a b. (a -> b) -> a -> b
$ Char -> Char
toLower forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> if Int
h forall a. Ord a => a -> a -> Bool
< Int
12 then forall a b. (a, b) -> a
fst (String, String)
amPm else forall a b. (a, b) -> b
snd (String, String)
amPm
Char
'p' -> forall a. [a] -> [a] -> [a]
(++) forall a b. (a -> b) -> a -> b
$ if Int
h forall a. Ord a => a -> a -> Bool
< Int
12 then forall a b. (a, b) -> a
fst (String, String)
amPm else forall a b. (a, b) -> b
snd (String, String)
amPm
Char
'H' -> Int -> String -> String
shows02 Int
h
Char
'I' -> Int -> String -> String
shows02 forall a b. (a -> b) -> a -> b
$ Int
1 forall a. Num a => a -> a -> a
+ forall a. Integral a => a -> a -> a
mod (Int
h forall a. Num a => a -> a -> a
- Int
1) Int
12
Char
'k' -> Int -> String -> String
shows_2 Int
h
Char
'l' -> Int -> String -> String
shows_2 forall a b. (a -> b) -> a -> b
$ Int
1 forall a. Num a => a -> a -> a
+ forall a. Integral a => a -> a -> a
mod (Int
h forall a. Num a => a -> a -> a
- Int
1) Int
12
Char
'M' -> Int -> String -> String
shows02 Int
m
Char
'S' -> Int -> String -> String
shows02 Int
si
Char
'q' -> Int64 -> String -> String
fills06 Int64
su forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> String -> String
shows Int64
su forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. [a] -> [a] -> [a]
(++) String
"000000"
Char
'v' -> Int64 -> String -> String
fills06 Int64
su forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> String -> String
shows Int64
su
Char
'Q' -> if Int64
su forall a. Eq a => a -> a -> Bool
== Int64
0 then forall a. a -> a
id else (:) Char
'.' forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int64 -> String -> String
fills06 Int64
su forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int64 -> String -> String
drops0 Int64
su
Char
_ -> Char -> String -> String
def Char
c
where (forall a b. (Integral a, Num b) => a -> b
fromIntegral -> Int
si, Micro Int64
su) = Micro -> Micro -> (Int64, Micro)
microQuotRem Micro
s (Int64 -> Micro
Micro Int64
1000000)
instance FormatTime YearMonthDay where
{-# INLINEABLE showsTime #-}
showsTime :: TimeLocale
-> YearMonthDay
-> (Char -> String -> String)
-> Char
-> String
-> String
showsTime TimeLocale {String
[(String, String)]
[TimeZone]
(String, String)
knownTimeZones :: [TimeZone]
time12Fmt :: String
timeFmt :: String
dateFmt :: String
dateTimeFmt :: String
amPm :: (String, String)
months :: [(String, String)]
wDays :: [(String, String)]
amPm :: TimeLocale -> (String, String)
dateFmt :: TimeLocale -> String
dateTimeFmt :: TimeLocale -> String
knownTimeZones :: TimeLocale -> [TimeZone]
months :: TimeLocale -> [(String, String)]
time12Fmt :: TimeLocale -> String
timeFmt :: TimeLocale -> String
wDays :: TimeLocale -> [(String, String)]
..} (YearMonthDay Int
y Int
m Int
d) = \ Char -> String -> String
def Char
c -> case Char
c of
Char
'D' -> Int -> String -> String
shows02 Int
m forall b c a. (b -> c) -> (a -> b) -> a -> c
. (:) Char
'/' forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> String -> String
shows02 Int
d forall b c a. (b -> c) -> (a -> b) -> a -> c
. (:) Char
'/' forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> String -> String
shows02 (forall a. Integral a => a -> a -> a
mod Int
y Int
100)
Char
'F' -> Int -> String -> String
showsY Int
y forall b c a. (b -> c) -> (a -> b) -> a -> c
. (:) Char
'-' forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> String -> String
shows02 Int
m forall b c a. (b -> c) -> (a -> b) -> a -> c
. (:) Char
'-' forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> String -> String
shows02 Int
d
Char
'Y' -> Int -> String -> String
showsY Int
y
Char
'y' -> Int -> String -> String
shows02 (forall a. Integral a => a -> a -> a
mod Int
y Int
100)
Char
'C' -> Int -> String -> String
shows02 (forall a. Integral a => a -> a -> a
div Int
y Int
100)
Char
'B' -> forall a. [a] -> [a] -> [a]
(++) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> a
fst forall a b. (a -> b) -> a -> b
$ [(String, String)]
months forall a. [a] -> Int -> a
!! (Int
m forall a. Num a => a -> a -> a
- Int
1)
Char
'b' -> forall a. [a] -> [a] -> [a]
(++) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> b
snd forall a b. (a -> b) -> a -> b
$ [(String, String)]
months forall a. [a] -> Int -> a
!! (Int
m forall a. Num a => a -> a -> a
- Int
1)
Char
'h' -> forall a. [a] -> [a] -> [a]
(++) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> b
snd forall a b. (a -> b) -> a -> b
$ [(String, String)]
months forall a. [a] -> Int -> a
!! (Int
m forall a. Num a => a -> a -> a
- Int
1)
Char
'm' -> Int -> String -> String
shows02 Int
m
Char
'd' -> Int -> String -> String
shows02 Int
d
Char
'e' -> Int -> String -> String
shows_2 Int
d
Char
_ -> Char -> String -> String
def Char
c
instance FormatTime MonthDay where
{-# INLINEABLE showsTime #-}
showsTime :: TimeLocale
-> MonthDay
-> (Char -> String -> String)
-> Char
-> String
-> String
showsTime TimeLocale {String
[(String, String)]
[TimeZone]
(String, String)
knownTimeZones :: [TimeZone]
time12Fmt :: String
timeFmt :: String
dateFmt :: String
dateTimeFmt :: String
amPm :: (String, String)
months :: [(String, String)]
wDays :: [(String, String)]
amPm :: TimeLocale -> (String, String)
dateFmt :: TimeLocale -> String
dateTimeFmt :: TimeLocale -> String
knownTimeZones :: TimeLocale -> [TimeZone]
months :: TimeLocale -> [(String, String)]
time12Fmt :: TimeLocale -> String
timeFmt :: TimeLocale -> String
wDays :: TimeLocale -> [(String, String)]
..} (MonthDay Int
m Int
d) = \ Char -> String -> String
def Char
c -> case Char
c of
Char
'B' -> forall a. [a] -> [a] -> [a]
(++) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> a
fst forall a b. (a -> b) -> a -> b
$ [(String, String)]
months forall a. [a] -> Int -> a
!! (Int
m forall a. Num a => a -> a -> a
- Int
1)
Char
'b' -> forall a. [a] -> [a] -> [a]
(++) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> b
snd forall a b. (a -> b) -> a -> b
$ [(String, String)]
months forall a. [a] -> Int -> a
!! (Int
m forall a. Num a => a -> a -> a
- Int
1)
Char
'h' -> forall a. [a] -> [a] -> [a]
(++) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> b
snd forall a b. (a -> b) -> a -> b
$ [(String, String)]
months forall a. [a] -> Int -> a
!! (Int
m forall a. Num a => a -> a -> a
- Int
1)
Char
'm' -> Int -> String -> String
shows02 Int
m
Char
'd' -> Int -> String -> String
shows02 Int
d
Char
'e' -> Int -> String -> String
shows_2 Int
d
Char
_ -> Char -> String -> String
def Char
c
instance FormatTime OrdinalDate where
{-# INLINEABLE showsTime #-}
showsTime :: TimeLocale
-> OrdinalDate
-> (Char -> String -> String)
-> Char
-> String
-> String
showsTime TimeLocale {String
[(String, String)]
[TimeZone]
(String, String)
knownTimeZones :: [TimeZone]
time12Fmt :: String
timeFmt :: String
dateFmt :: String
dateTimeFmt :: String
amPm :: (String, String)
months :: [(String, String)]
wDays :: [(String, String)]
amPm :: TimeLocale -> (String, String)
dateFmt :: TimeLocale -> String
dateTimeFmt :: TimeLocale -> String
knownTimeZones :: TimeLocale -> [TimeZone]
months :: TimeLocale -> [(String, String)]
time12Fmt :: TimeLocale -> String
timeFmt :: TimeLocale -> String
wDays :: TimeLocale -> [(String, String)]
..} (OrdinalDate Int
y Int
d) = \ Char -> String -> String
def Char
c -> case Char
c of
Char
'Y' -> Int -> String -> String
showsY Int
y
Char
'y' -> Int -> String -> String
shows02 (forall a. Integral a => a -> a -> a
mod Int
y Int
100)
Char
'C' -> Int -> String -> String
shows02 (forall a. Integral a => a -> a -> a
div Int
y Int
100)
Char
'j' -> Int -> String -> String
shows03 Int
d
Char
_ -> Char -> String -> String
def Char
c
instance FormatTime WeekDate where
{-# INLINEABLE showsTime #-}
showsTime :: TimeLocale
-> WeekDate
-> (Char -> String -> String)
-> Char
-> String
-> String
showsTime TimeLocale {String
[(String, String)]
[TimeZone]
(String, String)
knownTimeZones :: [TimeZone]
time12Fmt :: String
timeFmt :: String
dateFmt :: String
dateTimeFmt :: String
amPm :: (String, String)
months :: [(String, String)]
wDays :: [(String, String)]
amPm :: TimeLocale -> (String, String)
dateFmt :: TimeLocale -> String
dateTimeFmt :: TimeLocale -> String
knownTimeZones :: TimeLocale -> [TimeZone]
months :: TimeLocale -> [(String, String)]
time12Fmt :: TimeLocale -> String
timeFmt :: TimeLocale -> String
wDays :: TimeLocale -> [(String, String)]
..} (WeekDate Int
y Int
w Int
d) = \ Char -> String -> String
def Char
c -> case Char
c of
Char
'G' -> Int -> String -> String
showsY Int
y
Char
'g' -> Int -> String -> String
shows02 (forall a. Integral a => a -> a -> a
mod Int
y Int
100)
Char
'f' -> Int -> String -> String
shows02 (forall a. Integral a => a -> a -> a
div Int
y Int
100)
Char
'V' -> Int -> String -> String
shows02 Int
w
Char
'u' -> forall a. Show a => a -> String -> String
shows forall a b. (a -> b) -> a -> b
$ if Int
d forall a. Eq a => a -> a -> Bool
== Int
0 then Int
7 else Int
d
Char
'w' -> forall a. Show a => a -> String -> String
shows forall a b. (a -> b) -> a -> b
$ if Int
d forall a. Eq a => a -> a -> Bool
== Int
7 then Int
0 else Int
d
Char
'A' -> forall a. [a] -> [a] -> [a]
(++) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> a
fst forall a b. (a -> b) -> a -> b
$ [(String, String)]
wDays forall a. [a] -> Int -> a
!! forall a. Integral a => a -> a -> a
mod Int
d Int
7
Char
'a' -> forall a. [a] -> [a] -> [a]
(++) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> b
snd forall a b. (a -> b) -> a -> b
$ [(String, String)]
wDays forall a. [a] -> Int -> a
!! forall a. Integral a => a -> a -> a
mod Int
d Int
7
Char
_ -> Char -> String -> String
def Char
c
instance FormatTime SundayWeek where
{-# INLINEABLE showsTime #-}
showsTime :: TimeLocale
-> SundayWeek
-> (Char -> String -> String)
-> Char
-> String
-> String
showsTime TimeLocale {String
[(String, String)]
[TimeZone]
(String, String)
knownTimeZones :: [TimeZone]
time12Fmt :: String
timeFmt :: String
dateFmt :: String
dateTimeFmt :: String
amPm :: (String, String)
months :: [(String, String)]
wDays :: [(String, String)]
amPm :: TimeLocale -> (String, String)
dateFmt :: TimeLocale -> String
dateTimeFmt :: TimeLocale -> String
knownTimeZones :: TimeLocale -> [TimeZone]
months :: TimeLocale -> [(String, String)]
time12Fmt :: TimeLocale -> String
timeFmt :: TimeLocale -> String
wDays :: TimeLocale -> [(String, String)]
..} (SundayWeek Int
y Int
w Int
d) = \ Char -> String -> String
def Char
c -> case Char
c of
Char
'Y' -> Int -> String -> String
showsY Int
y
Char
'y' -> Int -> String -> String
shows02 (forall a. Integral a => a -> a -> a
mod Int
y Int
100)
Char
'C' -> Int -> String -> String
shows02 (forall a. Integral a => a -> a -> a
div Int
y Int
100)
Char
'U' -> Int -> String -> String
shows02 Int
w
Char
'u' -> forall a. Show a => a -> String -> String
shows forall a b. (a -> b) -> a -> b
$ if Int
d forall a. Eq a => a -> a -> Bool
== Int
0 then Int
7 else Int
d
Char
'w' -> forall a. Show a => a -> String -> String
shows forall a b. (a -> b) -> a -> b
$ if Int
d forall a. Eq a => a -> a -> Bool
== Int
7 then Int
0 else Int
d
Char
'A' -> forall a. [a] -> [a] -> [a]
(++) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> a
fst forall a b. (a -> b) -> a -> b
$ [(String, String)]
wDays forall a. [a] -> Int -> a
!! forall a. Integral a => a -> a -> a
mod Int
d Int
7
Char
'a' -> forall a. [a] -> [a] -> [a]
(++) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> b
snd forall a b. (a -> b) -> a -> b
$ [(String, String)]
wDays forall a. [a] -> Int -> a
!! forall a. Integral a => a -> a -> a
mod Int
d Int
7
Char
_ -> Char -> String -> String
def Char
c
instance FormatTime MondayWeek where
{-# INLINEABLE showsTime #-}
showsTime :: TimeLocale
-> MondayWeek
-> (Char -> String -> String)
-> Char
-> String
-> String
showsTime TimeLocale {String
[(String, String)]
[TimeZone]
(String, String)
knownTimeZones :: [TimeZone]
time12Fmt :: String
timeFmt :: String
dateFmt :: String
dateTimeFmt :: String
amPm :: (String, String)
months :: [(String, String)]
wDays :: [(String, String)]
amPm :: TimeLocale -> (String, String)
dateFmt :: TimeLocale -> String
dateTimeFmt :: TimeLocale -> String
knownTimeZones :: TimeLocale -> [TimeZone]
months :: TimeLocale -> [(String, String)]
time12Fmt :: TimeLocale -> String
timeFmt :: TimeLocale -> String
wDays :: TimeLocale -> [(String, String)]
..} (MondayWeek Int
y Int
w Int
d) = \ Char -> String -> String
def Char
c -> case Char
c of
Char
'Y' -> Int -> String -> String
showsY Int
y
Char
'y' -> Int -> String -> String
shows02 (forall a. Integral a => a -> a -> a
mod Int
y Int
100)
Char
'C' -> Int -> String -> String
shows02 (forall a. Integral a => a -> a -> a
div Int
y Int
100)
Char
'W' -> Int -> String -> String
shows02 Int
w
Char
'u' -> forall a. Show a => a -> String -> String
shows forall a b. (a -> b) -> a -> b
$ if Int
d forall a. Eq a => a -> a -> Bool
== Int
0 then Int
7 else Int
d
Char
'w' -> forall a. Show a => a -> String -> String
shows forall a b. (a -> b) -> a -> b
$ if Int
d forall a. Eq a => a -> a -> Bool
== Int
7 then Int
0 else Int
d
Char
'A' -> forall a. [a] -> [a] -> [a]
(++) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> a
fst forall a b. (a -> b) -> a -> b
$ [(String, String)]
wDays forall a. [a] -> Int -> a
!! forall a. Integral a => a -> a -> a
mod Int
d Int
7
Char
'a' -> forall a. [a] -> [a] -> [a]
(++) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> b
snd forall a b. (a -> b) -> a -> b
$ [(String, String)]
wDays forall a. [a] -> Int -> a
!! forall a. Integral a => a -> a -> a
mod Int
d Int
7
Char
_ -> Char -> String -> String
def Char
c
instance FormatTime LocalTime where
{-# INLINEABLE showsTime #-}
showsTime :: TimeLocale
-> LocalTime
-> (Char -> String -> String)
-> Char
-> String
-> String
showsTime TimeLocale
l (LocalTime Day
day TimeOfDay
tod) = forall t.
FormatTime t =>
TimeLocale
-> t -> (Char -> String -> String) -> Char -> String -> String
showsTime TimeLocale
l Day
day forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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 TimeLocale
l d :: Day
d@(forall a s. Getting a s a -> s -> a
view Iso' Day OrdinalDate
ordinalDate -> OrdinalDate
ordinal)
= forall t.
FormatTime t =>
TimeLocale
-> t -> (Char -> String -> String) -> Char -> String -> String
showsTime TimeLocale
l OrdinalDate
ordinal
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall t.
FormatTime t =>
TimeLocale
-> t -> (Char -> String -> String) -> Char -> String -> String
showsTime TimeLocale
l (OrdinalDate
ordinal forall s a. s -> Getting a s a -> a
^. Iso' OrdinalDate YearMonthDay
yearMonthDay)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall t.
FormatTime t =>
TimeLocale
-> t -> (Char -> String -> String) -> Char -> String -> String
showsTime TimeLocale
l (OrdinalDate -> Day -> WeekDate
toWeekOrdinal OrdinalDate
ordinal Day
d)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall t.
FormatTime t =>
TimeLocale
-> t -> (Char -> String -> String) -> Char -> String -> String
showsTime TimeLocale
l (OrdinalDate -> Day -> SundayWeek
toSundayOrdinal OrdinalDate
ordinal Day
d)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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 TimeLocale
_ tz :: TimeZone
tz@(TimeZone Int
_ Bool
_ String
name) = \ Char -> String -> String
def Char
c -> case Char
c of
Char
'z' -> forall a. [a] -> [a] -> [a]
(++) (TimeZone -> String
timeZoneOffsetString TimeZone
tz)
Char
'N' -> forall a. [a] -> [a] -> [a]
(++) (TimeZone -> String
timeZoneOffsetStringColon TimeZone
tz)
Char
'Z' -> forall a. [a] -> [a] -> [a]
(++) (if forall (t :: * -> *) a. Foldable t => t a -> Bool
null String
name then TimeZone -> String
timeZoneOffsetString TimeZone
tz else String
name)
Char
_ -> Char -> String -> String
def Char
c
instance FormatTime ZonedTime where
{-# INLINEABLE showsTime #-}
showsTime :: TimeLocale
-> ZonedTime
-> (Char -> String -> String)
-> Char
-> String
-> String
showsTime TimeLocale
l (ZonedTime LocalTime
lt TimeZone
tz) = forall t.
FormatTime t =>
TimeLocale
-> t -> (Char -> String -> String) -> Char -> String -> String
showsTime TimeLocale
l LocalTime
lt forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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 TimeLocale
l UTCTime
t = \ Char -> String -> String
def Char
c -> case Char
c of
Char
's' -> forall a. Show a => a -> String -> String
shows forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> a
fst forall a b. (a -> b) -> a -> b
$ Micro -> Micro -> (Int64, Micro)
qr Micro
s (Int64 -> Micro
Micro Int64
1000000)
Char
_ -> forall t.
FormatTime t =>
TimeLocale
-> t -> (Char -> String -> String) -> Char -> String -> String
showsTime TimeLocale
l ((TimeZone
utc, UTCTime
t) forall s a. s -> Getting a s a -> a
^. Iso' (TimeZone, UTCTime) ZonedTime
zonedTime) Char -> String -> String
def Char
c
where
NominalDiffTime Micro
s = UTCTime
t forall s a. s -> Getting a s a -> a
^. Iso' UTCTime POSIXTime
posixTime
#if BUG_FOR_BUG
qr :: Micro -> Micro -> (Int64, Micro)
qr = Micro -> Micro -> (Int64, Micro)
microDivMod
#else
qr = microQuotRem
#endif
instance FormatTime UniversalTime where
{-# INLINEABLE showsTime #-}
showsTime :: TimeLocale
-> UniversalTime
-> (Char -> String -> String)
-> Char
-> String
-> String
showsTime TimeLocale
l UniversalTime
t = forall t.
FormatTime t =>
TimeLocale
-> t -> (Char -> String -> String) -> Char -> String -> String
showsTime TimeLocale
l forall a b. (a -> b) -> a -> b
$ LocalTime -> TimeZone -> ZonedTime
ZonedTime LocalTime
lt TimeZone
utc {timeZoneName :: String
timeZoneName = String
"UT1"} where
lt :: LocalTime
lt = UniversalTime
t forall s a. s -> Getting a s a -> a
^. Rational -> Iso' UniversalTime LocalTime
ut1LocalTime Rational
0
instance FormatTime AbsoluteTime where
{-# INLINEABLE showsTime #-}
showsTime :: TimeLocale
-> AbsoluteTime
-> (Char -> String -> String)
-> Char
-> String
-> String
showsTime TimeLocale
l AbsoluteTime
t = forall t.
FormatTime t =>
TimeLocale
-> t -> (Char -> String -> String) -> Char -> String -> String
showsTime TimeLocale
l forall a b. (a -> b) -> a -> b
$ LocalTime -> TimeZone -> ZonedTime
ZonedTime LocalTime
lt TimeZone
utc {timeZoneName :: String
timeZoneName = String
"TAI"} where
lt :: LocalTime
lt = AbsoluteTime
t forall s a. s -> Getting a s a -> a
^. forall s t a b. AnIso s t a b -> Iso b a t s
from (TAIUTCMap -> Iso' UTCTime AbsoluteTime
absoluteTime TAIUTCMap
tum) forall b c a. (b -> c) -> (a -> b) -> a -> c
. TimeZone -> Iso' UTCTime LocalTime
utcLocalTime TimeZone
utc
tum :: TAIUTCMap
tum = Map UTCTime TAIUTCRow -> Map AbsoluteTime TAIUTCRow -> TAIUTCMap
TAIUTCMap forall a. Monoid a => a
mempty forall a. Monoid a => a
mempty
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]
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
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
, 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
, TimeParse -> Int
tpHour :: {-# UNPACK #-}!Hour
, TimeParse -> Int
tpMinute :: {-# UNPACK #-}!Minute
, TimeParse -> Int
tpSecond :: {-# UNPACK #-}!Int
, TimeParse -> DiffTime
tpSecFrac :: {-# UNPACK #-}!DiffTime
, TimeParse -> POSIXTime
tpPOSIXTime :: {-# UNPACK #-}!POSIXTime
, TimeParse -> TimeZone
tpTimeZone :: !TimeZone
} deriving (Int -> TimeParse -> String -> String
[TimeParse] -> String -> String
TimeParse -> String
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)
LENS(TimeParse,tpMonth,Month)
LENS(TimeParse,tpWeekOfYear,WeekOfYear)
LENS(TimeParse,tpDayOfMonth,DayOfMonth)
LENS(TimeParse,tpDayOfWeek,DayOfWeek)
LENS(TimeParse,tpDayOfYear,DayOfYear)
LENS(TimeParse,tpFlags,Int)
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 (forall a. Enum a => a -> Int
fromEnum -> Int
f) = Lens' TimeParse Int
_tpFlags forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens
(forall a. Bits a => a -> Int -> Bool
`testBit` Int
f) (\ Int
n Bool
b -> (if Bool
b then forall a. Bits a => a -> Int -> a
setBit else forall a. Bits a => a -> Int -> a
clearBit) Int
n Int
f)
{-# INLINEABLE timeParser #-}
timeParser
:: TimeLocale
-> String
-> Parser TimeParse
timeParser :: TimeLocale -> String -> Parser TimeParse
timeParser TimeLocale {String
[(String, String)]
[TimeZone]
(String, String)
knownTimeZones :: [TimeZone]
time12Fmt :: String
timeFmt :: String
dateFmt :: String
dateTimeFmt :: String
amPm :: (String, String)
months :: [(String, String)]
wDays :: [(String, String)]
amPm :: TimeLocale -> (String, String)
dateFmt :: TimeLocale -> String
dateTimeFmt :: TimeLocale -> String
knownTimeZones :: TimeLocale -> [TimeZone]
months :: TimeLocale -> [(String, String)]
time12Fmt :: TimeLocale -> String
timeFmt :: TimeLocale -> String
wDays :: TimeLocale -> [(String, String)]
..} = forall a b c. (a -> b -> c) -> b -> a -> c
flip forall (m :: * -> *) s a. Monad m => StateT s m a -> s -> m s
execStateT TimeParse
unixEpoch forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> StateT TimeParse (Parser ByteString) ()
go where
go :: String -> StateT TimeParse Parser ()
go :: String -> StateT TimeParse (Parser ByteString) ()
go String
spec = case String
spec of
Char
'%' : Char
cspec : String
rspec -> case Char
cspec of
Char
'c' -> String -> StateT TimeParse (Parser ByteString) ()
go (String
dateTimeFmt forall a. [a] -> [a] -> [a]
++ String
rspec)
Char
'r' -> String -> StateT TimeParse (Parser ByteString) ()
go (String
time12Fmt forall a. [a] -> [a] -> [a]
++ String
rspec)
Char
'X' -> String -> StateT TimeParse (Parser ByteString) ()
go (String
timeFmt forall a. [a] -> [a] -> [a]
++ String
rspec)
Char
'x' -> String -> StateT TimeParse (Parser ByteString) ()
go (String
dateFmt forall a. [a] -> [a] -> [a]
++ String
rspec)
Char
'R' -> String -> StateT TimeParse (Parser ByteString) ()
go (String
"%H:%M" forall a. [a] -> [a] -> [a]
++ String
rspec)
Char
'T' -> String -> StateT TimeParse (Parser ByteString) ()
go (String
"%H:%M:%S" forall a. [a] -> [a] -> [a]
++ String
rspec)
Char
'D' -> String -> StateT TimeParse (Parser ByteString) ()
go (String
"%m/%d/%y" forall a. [a] -> [a] -> [a]
++ String
rspec)
Char
'F' -> String -> StateT TimeParse (Parser ByteString) ()
go (String
"%Y-%m-%d" forall a. [a] -> [a] -> [a]
++ String
rspec)
Char
'P' -> StateT TimeParse (Parser ByteString) ()
dayHalf
Char
'p' -> StateT TimeParse (Parser ByteString) ()
dayHalf
Char
'H' -> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Int -> Parser Int
dec0 Int
2) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Int -> StateT TimeParse (Parser ByteString) ()
setHour24
Char
'I' -> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Int -> Parser Int
dec0 Int
2) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Int -> StateT TimeParse (Parser ByteString) ()
setHour12
Char
'k' -> (forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Int -> Parser Int
dec_ Int
2) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Int -> StateT TimeParse (Parser ByteString) ()
setHour24)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Int -> Parser Int
dec_ Int
1) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Int -> StateT TimeParse (Parser ByteString) ()
setHour24)
Char
'l' -> (forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Int -> Parser Int
dec_ Int
2) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Int -> StateT TimeParse (Parser ByteString) ()
setHour12)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Int -> Parser Int
dec_ Int
1) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Int -> StateT TimeParse (Parser ByteString) ()
setHour12)
Char
'M' -> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Int -> Parser Int
dec0 Int
2) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
assign Lens' TimeParse Int
_tpMinute forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> String -> StateT TimeParse (Parser ByteString) ()
go String
rspec
Char
'S' -> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Int -> Parser Int
dec0 Int
2) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
assign Lens' TimeParse Int
_tpSecond forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> String -> StateT TimeParse (Parser ByteString) ()
go String
rspec
Char
'q' -> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Parser Micro
micro forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
assign Lens' TimeParse DiffTime
_tpSecFrac forall b c a. (b -> c) -> (a -> b) -> a -> c
. Micro -> DiffTime
DiffTime forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> String -> StateT TimeParse (Parser ByteString) ()
go String
rspec
Char
'v' -> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Parser Micro
micro forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
assign Lens' TimeParse DiffTime
_tpSecFrac forall b c a. (b -> c) -> (a -> b) -> a -> c
. Micro -> DiffTime
DiffTime forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> String -> StateT TimeParse (Parser ByteString) ()
go String
rspec
Char
'Q' -> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift ((Char -> Parser Char
P.char Char
'.' forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Micro -> DiffTime
DiffTime forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Micro
micro) forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> forall (m :: * -> *) a. Monad m => a -> m a
return forall v. AdditiveGroup v => v
zeroV)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
assign Lens' TimeParse DiffTime
_tpSecFrac forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> String -> StateT TimeParse (Parser ByteString) ()
go String
rspec
Char
'Y' -> StateT TimeParse (Parser ByteString) ()
fullYear
Char
'y' -> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Int -> Parser Int
dec0 Int
2) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Int -> StateT TimeParse (Parser ByteString) ()
setCenturyYear
Char
'C' -> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Int -> Parser Int
dec0 Int
2) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Int -> StateT TimeParse (Parser ByteString) ()
setCentury
Char
'B' -> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift ([String] -> Parser Int
indexOfCI forall a b. (a -> b) -> a -> b
$ forall a b. (a, b) -> a
fst forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [(String, String)]
months) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Int -> StateT TimeParse (Parser ByteString) ()
setMonth forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Enum a => a -> a
succ
Char
'b' -> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift ([String] -> Parser Int
indexOfCI forall a b. (a -> b) -> a -> b
$ forall a b. (a, b) -> b
snd forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [(String, String)]
months) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Int -> StateT TimeParse (Parser ByteString) ()
setMonth forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Enum a => a -> a
succ
Char
'h' -> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift ([String] -> Parser Int
indexOfCI forall a b. (a -> b) -> a -> b
$ forall a b. (a, b) -> b
snd forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [(String, String)]
months) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Int -> StateT TimeParse (Parser ByteString) ()
setMonth forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Enum a => a -> a
succ
Char
'm' -> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Int -> Parser Int
dec0 Int
2) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Int -> StateT TimeParse (Parser ByteString) ()
setMonth
Char
'd' -> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Int -> Parser Int
dec0 Int
2) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Int -> StateT TimeParse (Parser ByteString) ()
setDayOfMonth
Char
'e' -> (forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Int -> Parser Int
dec_ Int
2) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Int -> StateT TimeParse (Parser ByteString) ()
setDayOfMonth)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Int -> Parser Int
dec_ Int
1) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Int -> StateT TimeParse (Parser ByteString) ()
setDayOfMonth)
Char
'j' -> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Int -> Parser Int
dec0 Int
3) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
assign Lens' TimeParse Int
_tpDayOfYear
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> TimeFlag -> Lens' TimeParse Bool
flag TimeFlag
IsOrdinalDate forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
.= Bool
True forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> String -> StateT TimeParse (Parser ByteString) ()
go String
rspec
Char
'G' -> TimeFlag -> Lens' TimeParse Bool
flag TimeFlag
IsWeekDate forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
.= Bool
True forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> StateT TimeParse (Parser ByteString) ()
fullYear
Char
'g' -> TimeFlag -> Lens' TimeParse Bool
flag TimeFlag
IsWeekDate forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
.= Bool
True forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Int -> Parser Int
dec0 Int
2) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Int -> StateT TimeParse (Parser ByteString) ()
setCenturyYear
Char
'f' -> TimeFlag -> Lens' TimeParse Bool
flag TimeFlag
IsWeekDate forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
.= Bool
True forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Int -> Parser Int
dec0 Int
2) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Int -> StateT TimeParse (Parser ByteString) ()
setCentury
Char
'V' -> TimeFlag -> Lens' TimeParse Bool
flag TimeFlag
IsWeekDate forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
.= Bool
True forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Int -> Parser Int
dec0 Int
2) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Int -> StateT TimeParse (Parser ByteString) ()
setWeekOfYear
Char
'U' -> TimeFlag -> Lens' TimeParse Bool
flag TimeFlag
IsSundayWeek forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
.= Bool
True forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Int -> Parser Int
dec0 Int
2) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Int -> StateT TimeParse (Parser ByteString) ()
setWeekOfYear
Char
'W' -> TimeFlag -> Lens' TimeParse Bool
flag TimeFlag
IsMondayWeek forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
.= Bool
True forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Int -> Parser Int
dec0 Int
2) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Int -> StateT TimeParse (Parser ByteString) ()
setWeekOfYear
Char
'w' -> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Int -> Parser Int
dec0 Int
1) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Int -> StateT TimeParse (Parser ByteString) ()
setDayOfWeek
Char
'u' -> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Int -> Parser Int
dec0 Int
1) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Int -> StateT TimeParse (Parser ByteString) ()
setDayOfWeek
Char
'A' -> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift ([String] -> Parser Int
indexOfCI forall a b. (a -> b) -> a -> b
$ forall a b. (a, b) -> a
fst forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [(String, String)]
wDays) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Int -> StateT TimeParse (Parser ByteString) ()
setDayOfWeek
Char
'a' -> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift ([String] -> Parser Int
indexOfCI forall a b. (a -> b) -> a -> b
$ forall a b. (a, b) -> b
snd forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [(String, String)]
wDays) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Int -> StateT TimeParse (Parser ByteString) ()
setDayOfWeek
Char
'z' -> do StateT TimeParse (Parser ByteString) ()
tzOffset; String -> StateT TimeParse (Parser ByteString) ()
go String
rspec
Char
'N' -> do StateT TimeParse (Parser ByteString) ()
tzOffset; String -> StateT TimeParse (Parser ByteString) ()
go String
rspec
Char
'Z' -> do StateT TimeParse (Parser ByteString) ()
tzOffset forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> StateT TimeParse (Parser ByteString) ()
tzName; String -> StateT TimeParse (Parser ByteString) ()
go String
rspec
Char
's' -> do
Int64
s <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (forall n. Integral n => Parser n -> Parser n
negative forall a. Integral a => Parser a
P.decimal)
Lens' TimeParse POSIXTime
_tpPOSIXTime forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
.= forall n t. (Real n, TimeDiff t) => n -> t
fromSeconds (Int64
s :: Int64)
TimeFlag -> Lens' TimeParse Bool
flag TimeFlag
IsPOSIXTime forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
.= Bool
True
String -> StateT TimeParse (Parser ByteString) ()
go String
rspec
Char
'-' -> String -> StateT TimeParse (Parser ByteString) ()
go (Char
'%' forall a. a -> [a] -> [a]
: String
rspec)
Char
'_' -> String -> StateT TimeParse (Parser ByteString) ()
go (Char
'%' forall a. a -> [a] -> [a]
: String
rspec)
Char
'0' -> String -> StateT TimeParse (Parser ByteString) ()
go (Char
'%' forall a. a -> [a] -> [a]
: String
rspec)
Char
'%' -> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Char -> Parser Char
P.char Char
'%') forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> String -> StateT TimeParse (Parser ByteString) ()
go String
rspec
Char
_ -> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadFail m => String -> m a
fail forall a b. (a -> b) -> a -> b
$ String
"Unknown format character: " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show Char
cspec
where
dayHalf :: StateT TimeParse (Parser ByteString) ()
dayHalf = do
Bool
pm <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ Bool
False forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ String -> Parser ()
stringCI (forall a b. (a, b) -> a
fst (String, String)
amPm)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Bool
True forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ String -> Parser ()
stringCI (forall a b. (a, b) -> b
snd (String, String)
amPm)
TimeFlag -> Lens' TimeParse Bool
flag TimeFlag
PostMeridiem forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
.= Bool
pm
TimeFlag -> Lens' TimeParse Bool
flag TimeFlag
TwelveHour forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
.= Bool
True
String -> StateT TimeParse (Parser ByteString) ()
go String
rspec
fullYear :: StateT TimeParse (Parser ByteString) ()
fullYear = Parser Int -> StateT TimeParse (Parser ByteString) ()
year (forall n. Integral n => Parser n -> Parser n
negative forall a. Integral a => Parser a
P.decimal) forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Int -> StateT TimeParse (Parser ByteString) ()
year (Int -> Parser Int
dec0 Int
4) where
year :: Parser Int -> StateT TimeParse (Parser ByteString) ()
year Parser Int
p = do
(Int
c, Int
y) <- (forall a. Integral a => a -> a -> (a, a)
`divMod` Int
100) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Parser Int
p
TimeFlag -> Lens' TimeParse Bool
flag TimeFlag
HasCentury forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
.= Bool
True
Lens' TimeParse Int
_tpCentury forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
.= Int
c
Lens' TimeParse Int
_tpCenturyYear forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
.= Int
y
String -> StateT TimeParse (Parser ByteString) ()
go String
rspec
setHour12 :: Int -> StateT TimeParse (Parser ByteString) ()
setHour12 Int
h = do
TimeFlag -> Lens' TimeParse Bool
flag TimeFlag
TwelveHour forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
.= Bool
True
Lens' TimeParse Int
_tpHour forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
.= Int
h
String -> StateT TimeParse (Parser ByteString) ()
go String
rspec
setHour24 :: Int -> StateT TimeParse (Parser ByteString) ()
setHour24 Int
h = do
TimeFlag -> Lens' TimeParse Bool
flag TimeFlag
TwelveHour forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
.= Bool
False
Lens' TimeParse Int
_tpHour forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
.= Int
h
String -> StateT TimeParse (Parser ByteString) ()
go String
rspec
setCenturyYear :: Int -> StateT TimeParse (Parser ByteString) ()
setCenturyYear Int
y = do Lens' TimeParse Int
_tpCenturyYear forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
.= Int
y; String -> StateT TimeParse (Parser ByteString) ()
go String
rspec
setCentury :: Int -> StateT TimeParse (Parser ByteString) ()
setCentury Int
c = do
Lens' TimeParse Int
_tpCentury forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
.= Int
c
TimeFlag -> Lens' TimeParse Bool
flag TimeFlag
HasCentury forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
.= Bool
True
String -> StateT TimeParse (Parser ByteString) ()
go String
rspec
setMonth :: Int -> StateT TimeParse (Parser ByteString) ()
setMonth Int
m = do
TimeFlag -> Lens' TimeParse Bool
flag TimeFlag
IsGregorian forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
.= Bool
True
Lens' TimeParse Int
_tpMonth forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
.= Int
m
String -> StateT TimeParse (Parser ByteString) ()
go String
rspec
setDayOfMonth :: Int -> StateT TimeParse (Parser ByteString) ()
setDayOfMonth Int
d = do
TimeFlag -> Lens' TimeParse Bool
flag TimeFlag
IsGregorian forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
.= Bool
True
Lens' TimeParse Int
_tpDayOfMonth forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
.= Int
d
String -> StateT TimeParse (Parser ByteString) ()
go String
rspec
setWeekOfYear :: Int -> StateT TimeParse (Parser ByteString) ()
setWeekOfYear Int
w = do Lens' TimeParse Int
_tpWeekOfYear forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
.= Int
w; String -> StateT TimeParse (Parser ByteString) ()
go String
rspec
setDayOfWeek :: Int -> StateT TimeParse (Parser ByteString) ()
setDayOfWeek Int
d = do Lens' TimeParse Int
_tpDayOfWeek forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
.= Int
d; String -> StateT TimeParse (Parser ByteString) ()
go String
rspec
tzOffset :: StateT TimeParse (Parser ByteString) ()
tzOffset = do
Int -> Int
s <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (forall a. a -> a
id forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Char -> Parser Char
P.char Char
'+' forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> forall a. Num a => a -> a
negate forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Char -> Parser Char
P.char Char
'-')
Int
h <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Int -> Parser Int
dec0 Int
2)
() forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Char -> Parser Char
P.char Char
':') forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> forall (f :: * -> *) a. Applicative f => a -> f a
pure ()
Int
m <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Int -> Parser Int
dec0 Int
2)
Lens' TimeParse TimeZone
_tpTimeZone forall b c a. (b -> c) -> (a -> b) -> a -> c
. Lens' TimeZone Int
_timeZoneMinutes forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
.= Int -> Int
s (Int
h forall a. Num a => a -> a -> a
* Int
60 forall a. Num a => a -> a -> a
+ Int
m)
tzName :: StateT TimeParse (Parser ByteString) ()
tzName = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift Parser TimeZone
timeZoneParser forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall s (m :: * -> *) a b.
MonadState s m =>
Setter s s a b -> b -> m ()
assign Lens' TimeParse TimeZone
_tpTimeZone
Char
c : String
rspec | Char -> Bool
P.isSpace Char
c ->
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift ((Char -> Bool) -> Parser ByteString
P.takeWhile Char -> Bool
P.isSpace) forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> String -> StateT TimeParse (Parser ByteString) ()
go (forall a. (a -> Bool) -> [a] -> [a]
dropWhile Char -> Bool
P.isSpace String
rspec)
Char
c : String
rspec | Char -> Bool
isAscii Char
c -> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Char -> Parser Char
P.char Char
c) forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> String -> StateT TimeParse (Parser ByteString) ()
go String
rspec
Char
c : String
rspec -> forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (Char -> Parser ()
charU8 Char
c) forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> String -> StateT TimeParse (Parser ByteString) ()
go String
rspec
String
"" -> forall (m :: * -> *) a. Monad m => a -> m a
return ()
{-# INLINE micro #-}
micro :: Parser Micro
micro :: Parser Micro
micro = do
Int64
us10 <- forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either forall (m :: * -> *) a. MonadFail m => String -> m a
fail forall (m :: * -> *) a. Monad m => a -> m a
return forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Parser a -> ByteString -> Either String a
P.parseOnly forall a. Integral a => Parser a
P.decimal forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> ByteString -> ByteString
S.take Int
7
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ByteString -> ByteString -> ByteString
`S.append` String -> ByteString
S.pack String
"000000") forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< (Char -> Bool) -> Parser ByteString
P.takeWhile1 Char -> Bool
P.isDigit
forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ Int64 -> Micro
Micro (forall a. Integral a => a -> a -> a
div (Int64
us10 forall a. Num a => a -> a -> a
+ Int64
5) Int64
10)
{-# INLINE unixEpoch #-}
unixEpoch :: TimeParse
unixEpoch :: TimeParse
unixEpoch = TimeParse {Int
DiffTime
POSIXTime
TimeZone
tpTimeZone :: TimeZone
tpPOSIXTime :: POSIXTime
tpSecFrac :: DiffTime
tpSecond :: Int
tpMinute :: Int
tpHour :: Int
tpFlags :: Int
tpDayOfWeek :: Int
tpDayOfMonth :: Int
tpDayOfYear :: Int
tpWeekOfYear :: Int
tpMonth :: Int
tpCenturyYear :: Int
tpCentury :: Int
tpTimeZone :: TimeZone
tpPOSIXTime :: POSIXTime
tpSecFrac :: DiffTime
tpSecond :: Int
tpMinute :: Int
tpHour :: Int
tpFlags :: Int
tpDayOfWeek :: Int
tpDayOfYear :: Int
tpDayOfMonth :: Int
tpWeekOfYear :: Int
tpMonth :: Int
tpCenturyYear :: Int
tpCentury :: Int
..} where
tpCentury :: Int
tpCentury = Int
19
tpCenturyYear :: Int
tpCenturyYear = Int
70
tpMonth :: Int
tpMonth = Int
1
tpWeekOfYear :: Int
tpWeekOfYear = Int
1
tpDayOfYear :: Int
tpDayOfYear = Int
1
tpDayOfMonth :: Int
tpDayOfMonth = Int
1
tpDayOfWeek :: Int
tpDayOfWeek = Int
4
tpFlags :: Int
tpFlags = Int
0
tpHour :: Int
tpHour = Int
0
tpMinute :: Int
tpMinute = Int
0
tpSecond :: Int
tpSecond = Int
0
tpSecFrac :: DiffTime
tpSecFrac = forall v. AdditiveGroup v => v
zeroV
tpPOSIXTime :: POSIXTime
tpPOSIXTime = forall v. AdditiveGroup v => v
zeroV
tpTimeZone :: TimeZone
tpTimeZone = TimeZone
utc
{-# INLINEABLE parseTime #-}
parseTime :: (ParseTime t)
=> TimeLocale
-> String
-> String
-> Maybe t
parseTime :: forall t. ParseTime t => TimeLocale -> String -> String -> Maybe t
parseTime TimeLocale
l String
spec = forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either (forall a b. a -> b -> a
const forall a. Maybe a
Nothing) forall a. a -> Maybe a
Just
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Parser a -> ByteString -> Either String a
P.parseOnly Parser ByteString t
parser forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> ByteString
utf8String where
parser :: Parser ByteString t
parser = forall t. ParseTime t => TimeParse -> t
buildTime forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Parser ()
P.skipSpace forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> TimeLocale -> String -> Parser TimeParse
timeParser TimeLocale
l String
spec
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser ()
P.skipSpace forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* forall t. Chunk t => Parser t ()
P.endOfInput
{-# INLINEABLE readTime #-}
readTime :: (ParseTime t)
=> TimeLocale
-> String
-> String
-> t
readTime :: forall t. ParseTime t => TimeLocale -> String -> String -> t
readTime TimeLocale
l String
spec = forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either forall a. HasCallStack => String -> a
error forall a. a -> a
id forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Parser a -> ByteString -> Either String a
P.parseOnly Parser ByteString t
parser forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> ByteString
utf8String where
parser :: Parser ByteString t
parser = forall t. ParseTime t => TimeParse -> t
buildTime forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Parser ()
P.skipSpace forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> TimeLocale -> String -> Parser TimeParse
timeParser TimeLocale
l String
spec
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser ()
P.skipSpace forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* forall t. Chunk t => Parser t ()
P.endOfInput
{-# INLINEABLE readsTime #-}
readsTime :: (ParseTime t)
=> TimeLocale
-> String
-> ReadS t
readsTime :: forall t. ParseTime t => TimeLocale -> String -> ReadS t
readsTime TimeLocale
l String
spec = forall a. Parser a -> ReadS a
parserToReadS forall a b. (a -> b) -> a -> b
$
forall t. ParseTime t => TimeParse -> t
buildTime forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Parser ()
P.skipSpace 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 Int
_ = forall a. Bool -> ReadS a -> ReadS a
readParen Bool
False forall a b. (a -> b) -> a -> b
$
forall t. ParseTime t => TimeLocale -> String -> ReadS t
readsTime TimeLocale
defaultTimeLocale String
"%Y-%m-%d"
instance Read TimeOfDay where
{-# INLINEABLE readsPrec #-}
readsPrec :: Int -> ReadS TimeOfDay
readsPrec Int
_ = forall a. Bool -> ReadS a -> ReadS a
readParen Bool
False forall a b. (a -> b) -> a -> b
$
forall t. ParseTime t => TimeLocale -> String -> ReadS t
readsTime TimeLocale
defaultTimeLocale String
"%H:%M:%S%Q"
instance Read LocalTime where
{-# INLINEABLE readsPrec #-}
readsPrec :: Int -> ReadS LocalTime
readsPrec Int
_ = forall a. Bool -> ReadS a -> ReadS a
readParen Bool
False forall a b. (a -> b) -> a -> b
$
forall t. ParseTime t => TimeLocale -> String -> ReadS t
readsTime TimeLocale
defaultTimeLocale String
"%Y-%m-%d %H:%M:%S%Q"
instance Read ZonedTime where
{-# INLINEABLE readsPrec #-}
readsPrec :: Int -> ReadS ZonedTime
readsPrec Int
_ = forall a. Bool -> ReadS a -> ReadS a
readParen Bool
False forall a b. (a -> b) -> a -> b
$
forall t. ParseTime t => TimeLocale -> String -> ReadS t
readsTime TimeLocale
defaultTimeLocale String
"%Y-%m-%d %H:%M:%S%Q %Z"
instance Read UTCTime where
{-# INLINEABLE readsPrec #-}
readsPrec :: Int -> ReadS UTCTime
readsPrec Int
_ = forall a. Bool -> ReadS a -> ReadS a
readParen Bool
False forall a b. (a -> b) -> a -> b
$
forall t. ParseTime t => TimeLocale -> String -> ReadS t
readsTime TimeLocale
defaultTimeLocale String
"%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
DiffTime
POSIXTime
TimeZone
tpTimeZone :: TimeZone
tpPOSIXTime :: POSIXTime
tpSecFrac :: DiffTime
tpSecond :: Int
tpMinute :: Int
tpHour :: Int
tpFlags :: Int
tpDayOfWeek :: Int
tpDayOfYear :: Int
tpDayOfMonth :: Int
tpWeekOfYear :: Int
tpMonth :: Int
tpCenturyYear :: Int
tpCentury :: Int
tpTimeZone :: TimeParse -> TimeZone
tpPOSIXTime :: TimeParse -> POSIXTime
tpSecFrac :: TimeParse -> DiffTime
tpSecond :: TimeParse -> Int
tpMinute :: TimeParse -> Int
tpHour :: TimeParse -> Int
tpFlags :: TimeParse -> Int
tpDayOfWeek :: TimeParse -> Int
tpDayOfYear :: TimeParse -> Int
tpDayOfMonth :: TimeParse -> Int
tpWeekOfYear :: TimeParse -> Int
tpMonth :: TimeParse -> Int
tpCenturyYear :: TimeParse -> Int
tpCentury :: TimeParse -> Int
..} = Int -> Int -> DiffTime -> TimeOfDay
TimeOfDay Int
h Int
tpMinute
(forall n t. (Real n, TimeDiff t) => n -> t
fromSeconds Int
tpSecond forall v. AdditiveGroup v => v -> v -> v
^+^ DiffTime
tpSecFrac) where
h :: Int
h = case TimeParse
tp forall s a. s -> Getting a s a -> a
^. TimeFlag -> Lens' TimeParse Bool
flag TimeFlag
TwelveHour of
Bool
False -> Int
tpHour
Bool
True -> case TimeParse
tp forall s a. s -> Getting a s a -> a
^. TimeFlag -> Lens' TimeParse Bool
flag TimeFlag
PostMeridiem of
Bool
False -> forall a. Integral a => a -> a -> a
mod Int
tpHour Int
12
Bool
True -> if Int
tpHour forall a. Ord a => a -> a -> Bool
< Int
12 then Int
tpHour forall a. Num a => a -> a -> a
+ Int
12 else Int
tpHour
{-# INLINE tpYear #-}
tpYear :: TimeParse -> Year
tpYear :: TimeParse -> Int
tpYear tp :: TimeParse
tp@TimeParse {Int
DiffTime
POSIXTime
TimeZone
tpTimeZone :: TimeZone
tpPOSIXTime :: POSIXTime
tpSecFrac :: DiffTime
tpSecond :: Int
tpMinute :: Int
tpHour :: Int
tpFlags :: Int
tpDayOfWeek :: Int
tpDayOfYear :: Int
tpDayOfMonth :: Int
tpWeekOfYear :: Int
tpMonth :: Int
tpCenturyYear :: Int
tpCentury :: Int
tpTimeZone :: TimeParse -> TimeZone
tpPOSIXTime :: TimeParse -> POSIXTime
tpSecFrac :: TimeParse -> DiffTime
tpSecond :: TimeParse -> Int
tpMinute :: TimeParse -> Int
tpHour :: TimeParse -> Int
tpFlags :: TimeParse -> Int
tpDayOfWeek :: TimeParse -> Int
tpDayOfYear :: TimeParse -> Int
tpDayOfMonth :: TimeParse -> Int
tpWeekOfYear :: TimeParse -> Int
tpMonth :: TimeParse -> Int
tpCenturyYear :: TimeParse -> Int
tpCentury :: TimeParse -> Int
..} = Int
tpCenturyYear forall a. Num a => a -> a -> a
+ Int
100 forall a. Num a => a -> a -> a
* if TimeParse
tp forall s a. s -> Getting a s a -> a
^. TimeFlag -> Lens' TimeParse Bool
flag TimeFlag
HasCentury
then Int
tpCentury else if Int
tpCenturyYear forall a. Ord a => a -> a -> Bool
< Int
69 then Int
20 else Int
19
instance ParseTime YearMonthDay where
{-# INLINE buildTime #-}
buildTime :: TimeParse -> YearMonthDay
buildTime tp :: TimeParse
tp@TimeParse {Int
DiffTime
POSIXTime
TimeZone
tpTimeZone :: TimeZone
tpPOSIXTime :: POSIXTime
tpSecFrac :: DiffTime
tpSecond :: Int
tpMinute :: Int
tpHour :: Int
tpFlags :: Int
tpDayOfWeek :: Int
tpDayOfYear :: Int
tpDayOfMonth :: Int
tpWeekOfYear :: Int
tpMonth :: Int
tpCenturyYear :: Int
tpCentury :: Int
tpTimeZone :: TimeParse -> TimeZone
tpPOSIXTime :: TimeParse -> POSIXTime
tpSecFrac :: TimeParse -> DiffTime
tpSecond :: TimeParse -> Int
tpMinute :: TimeParse -> Int
tpHour :: TimeParse -> Int
tpFlags :: TimeParse -> Int
tpDayOfWeek :: TimeParse -> Int
tpDayOfYear :: TimeParse -> Int
tpDayOfMonth :: TimeParse -> Int
tpWeekOfYear :: TimeParse -> Int
tpMonth :: TimeParse -> Int
tpCenturyYear :: TimeParse -> Int
tpCentury :: TimeParse -> Int
..} = 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
DiffTime
POSIXTime
TimeZone
tpTimeZone :: TimeZone
tpPOSIXTime :: POSIXTime
tpSecFrac :: DiffTime
tpSecond :: Int
tpMinute :: Int
tpHour :: Int
tpFlags :: Int
tpDayOfWeek :: Int
tpDayOfYear :: Int
tpDayOfMonth :: Int
tpWeekOfYear :: Int
tpMonth :: Int
tpCenturyYear :: Int
tpCentury :: Int
tpTimeZone :: TimeParse -> TimeZone
tpPOSIXTime :: TimeParse -> POSIXTime
tpSecFrac :: TimeParse -> DiffTime
tpSecond :: TimeParse -> Int
tpMinute :: TimeParse -> Int
tpHour :: TimeParse -> Int
tpFlags :: TimeParse -> Int
tpDayOfWeek :: TimeParse -> Int
tpDayOfYear :: TimeParse -> Int
tpDayOfMonth :: TimeParse -> Int
tpWeekOfYear :: TimeParse -> Int
tpMonth :: TimeParse -> Int
tpCenturyYear :: TimeParse -> Int
tpCentury :: TimeParse -> Int
..} = Int -> Int -> MonthDay
MonthDay Int
tpMonth Int
tpDayOfMonth
instance ParseTime OrdinalDate where
{-# INLINE buildTime #-}
buildTime :: TimeParse -> OrdinalDate
buildTime tp :: TimeParse
tp@TimeParse {Int
DiffTime
POSIXTime
TimeZone
tpTimeZone :: TimeZone
tpPOSIXTime :: POSIXTime
tpSecFrac :: DiffTime
tpSecond :: Int
tpMinute :: Int
tpHour :: Int
tpFlags :: Int
tpDayOfWeek :: Int
tpDayOfYear :: Int
tpDayOfMonth :: Int
tpWeekOfYear :: Int
tpMonth :: Int
tpCenturyYear :: Int
tpCentury :: Int
tpTimeZone :: TimeParse -> TimeZone
tpPOSIXTime :: TimeParse -> POSIXTime
tpSecFrac :: TimeParse -> DiffTime
tpSecond :: TimeParse -> Int
tpMinute :: TimeParse -> Int
tpHour :: TimeParse -> Int
tpFlags :: TimeParse -> Int
tpDayOfWeek :: TimeParse -> Int
tpDayOfYear :: TimeParse -> Int
tpDayOfMonth :: TimeParse -> Int
tpWeekOfYear :: TimeParse -> Int
tpMonth :: TimeParse -> Int
tpCenturyYear :: TimeParse -> Int
tpCentury :: TimeParse -> Int
..} = 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
DiffTime
POSIXTime
TimeZone
tpTimeZone :: TimeZone
tpPOSIXTime :: POSIXTime
tpSecFrac :: DiffTime
tpSecond :: Int
tpMinute :: Int
tpHour :: Int
tpFlags :: Int
tpDayOfWeek :: Int
tpDayOfYear :: Int
tpDayOfMonth :: Int
tpWeekOfYear :: Int
tpMonth :: Int
tpCenturyYear :: Int
tpCentury :: Int
tpTimeZone :: TimeParse -> TimeZone
tpPOSIXTime :: TimeParse -> POSIXTime
tpSecFrac :: TimeParse -> DiffTime
tpSecond :: TimeParse -> Int
tpMinute :: TimeParse -> Int
tpHour :: TimeParse -> Int
tpFlags :: TimeParse -> Int
tpDayOfWeek :: TimeParse -> Int
tpDayOfYear :: TimeParse -> Int
tpDayOfMonth :: TimeParse -> Int
tpWeekOfYear :: TimeParse -> Int
tpMonth :: TimeParse -> Int
tpCenturyYear :: TimeParse -> Int
tpCentury :: TimeParse -> Int
..} = Int -> Int -> Int -> WeekDate
WeekDate (TimeParse -> Int
tpYear TimeParse
tp) Int
tpWeekOfYear
(if Int
tpDayOfWeek forall a. Eq a => a -> a -> Bool
== Int
0 then Int
7 else Int
tpDayOfWeek)
instance ParseTime SundayWeek where
{-# INLINE buildTime #-}
buildTime :: TimeParse -> SundayWeek
buildTime tp :: TimeParse
tp@TimeParse {Int
DiffTime
POSIXTime
TimeZone
tpTimeZone :: TimeZone
tpPOSIXTime :: POSIXTime
tpSecFrac :: DiffTime
tpSecond :: Int
tpMinute :: Int
tpHour :: Int
tpFlags :: Int
tpDayOfWeek :: Int
tpDayOfYear :: Int
tpDayOfMonth :: Int
tpWeekOfYear :: Int
tpMonth :: Int
tpCenturyYear :: Int
tpCentury :: Int
tpTimeZone :: TimeParse -> TimeZone
tpPOSIXTime :: TimeParse -> POSIXTime
tpSecFrac :: TimeParse -> DiffTime
tpSecond :: TimeParse -> Int
tpMinute :: TimeParse -> Int
tpHour :: TimeParse -> Int
tpFlags :: TimeParse -> Int
tpDayOfWeek :: TimeParse -> Int
tpDayOfYear :: TimeParse -> Int
tpDayOfMonth :: TimeParse -> Int
tpWeekOfYear :: TimeParse -> Int
tpMonth :: TimeParse -> Int
tpCenturyYear :: TimeParse -> Int
tpCentury :: TimeParse -> Int
..} = Int -> Int -> Int -> SundayWeek
SundayWeek (TimeParse -> Int
tpYear TimeParse
tp) Int
tpWeekOfYear
(if Int
tpDayOfWeek forall a. Eq a => a -> a -> Bool
== Int
7 then Int
0 else Int
tpDayOfWeek)
instance ParseTime MondayWeek where
{-# INLINE buildTime #-}
buildTime :: TimeParse -> MondayWeek
buildTime tp :: TimeParse
tp@TimeParse {Int
DiffTime
POSIXTime
TimeZone
tpTimeZone :: TimeZone
tpPOSIXTime :: POSIXTime
tpSecFrac :: DiffTime
tpSecond :: Int
tpMinute :: Int
tpHour :: Int
tpFlags :: Int
tpDayOfWeek :: Int
tpDayOfYear :: Int
tpDayOfMonth :: Int
tpWeekOfYear :: Int
tpMonth :: Int
tpCenturyYear :: Int
tpCentury :: Int
tpTimeZone :: TimeParse -> TimeZone
tpPOSIXTime :: TimeParse -> POSIXTime
tpSecFrac :: TimeParse -> DiffTime
tpSecond :: TimeParse -> Int
tpMinute :: TimeParse -> Int
tpHour :: TimeParse -> Int
tpFlags :: TimeParse -> Int
tpDayOfWeek :: TimeParse -> Int
tpDayOfYear :: TimeParse -> Int
tpDayOfMonth :: TimeParse -> Int
tpWeekOfYear :: TimeParse -> Int
tpMonth :: TimeParse -> Int
tpCenturyYear :: TimeParse -> Int
tpCentury :: TimeParse -> Int
..} = Int -> Int -> Int -> MondayWeek
MondayWeek (TimeParse -> Int
tpYear TimeParse
tp) Int
tpWeekOfYear
(if Int
tpDayOfWeek forall a. Eq a => a -> a -> Bool
== Int
0 then Int
7 else Int
tpDayOfWeek)
instance ParseTime LocalTime where
{-# INLINE buildTime #-}
buildTime :: TimeParse -> LocalTime
buildTime = Day -> TimeOfDay -> LocalTime
LocalTime forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. ParseTime t => TimeParse -> t
buildTime forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. ParseTime t => TimeParse -> t
buildTime
instance ParseTime Day where
{-# INLINE buildTime #-}
buildTime :: TimeParse -> Day
buildTime TimeParse
tp
| TimeParse
tp forall s a. s -> Getting a s a -> a
^. TimeFlag -> Lens' TimeParse Bool
flag TimeFlag
IsOrdinalDate = Iso' Day OrdinalDate
ordinalDate forall s t a b. AReview s t a b -> b -> t
# forall t. ParseTime t => TimeParse -> t
buildTime TimeParse
tp
| TimeParse
tp forall s a. s -> Getting a s a -> a
^. TimeFlag -> Lens' TimeParse Bool
flag TimeFlag
IsGregorian = Iso' Day YearMonthDay
gregorian forall s t a b. AReview s t a b -> b -> t
# forall t. ParseTime t => TimeParse -> t
buildTime TimeParse
tp
| TimeParse
tp forall s a. s -> Getting a s a -> a
^. TimeFlag -> Lens' TimeParse Bool
flag TimeFlag
IsWeekDate = Iso' Day WeekDate
weekDate forall s t a b. AReview s t a b -> b -> t
# forall t. ParseTime t => TimeParse -> t
buildTime TimeParse
tp
| TimeParse
tp forall s a. s -> Getting a s a -> a
^. TimeFlag -> Lens' TimeParse Bool
flag TimeFlag
IsSundayWeek = Iso' Day SundayWeek
sundayWeek forall s t a b. AReview s t a b -> b -> t
# forall t. ParseTime t => TimeParse -> t
buildTime TimeParse
tp
| TimeParse
tp forall s a. s -> Getting a s a -> a
^. TimeFlag -> Lens' TimeParse Bool
flag TimeFlag
IsMondayWeek = Iso' Day MondayWeek
mondayWeek forall s t a b. AReview s t a b -> b -> t
# forall t. ParseTime t => TimeParse -> t
buildTime TimeParse
tp
| Bool
otherwise = Iso' Day OrdinalDate
ordinalDate forall s t a b. AReview s t a b -> b -> t
# forall t. ParseTime t => TimeParse -> t
buildTime TimeParse
tp
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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. ParseTime t => TimeParse -> t
buildTime forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. ParseTime t => TimeParse -> t
buildTime
instance ParseTime UTCTime where
{-# INLINE buildTime #-}
buildTime :: TimeParse -> UTCTime
buildTime tp :: TimeParse
tp@TimeParse {Int
DiffTime
POSIXTime
TimeZone
tpTimeZone :: TimeZone
tpPOSIXTime :: POSIXTime
tpSecFrac :: DiffTime
tpSecond :: Int
tpMinute :: Int
tpHour :: Int
tpFlags :: Int
tpDayOfWeek :: Int
tpDayOfYear :: Int
tpDayOfMonth :: Int
tpWeekOfYear :: Int
tpMonth :: Int
tpCenturyYear :: Int
tpCentury :: Int
tpTimeZone :: TimeParse -> TimeZone
tpPOSIXTime :: TimeParse -> POSIXTime
tpSecFrac :: TimeParse -> DiffTime
tpSecond :: TimeParse -> Int
tpMinute :: TimeParse -> Int
tpHour :: TimeParse -> Int
tpFlags :: TimeParse -> Int
tpDayOfWeek :: TimeParse -> Int
tpDayOfYear :: TimeParse -> Int
tpDayOfMonth :: TimeParse -> Int
tpWeekOfYear :: TimeParse -> Int
tpMonth :: TimeParse -> Int
tpCenturyYear :: TimeParse -> Int
tpCentury :: TimeParse -> Int
..} = if TimeParse
tp forall s a. s -> Getting a s a -> a
^. TimeFlag -> Lens' TimeParse Bool
flag TimeFlag
IsPOSIXTime
then Iso' UTCTime POSIXTime
posixTime forall s t a b. AReview s t a b -> b -> t
# POSIXTime
tpPOSIXTime
else forall a b. (a, b) -> b
snd forall a b. (a -> b) -> a -> b
$ forall t. ParseTime t => TimeParse -> t
buildTime TimeParse
tp forall s a. s -> Getting a s a -> a
^. forall s t a b. AnIso s t a b -> Iso b a t s
from Iso' (TimeZone, UTCTime) ZonedTime
zonedTime
instance ParseTime UniversalTime where
{-# INLINE buildTime #-}
buildTime :: TimeParse -> UniversalTime
buildTime (forall t. ParseTime t => TimeParse -> t
buildTime -> UTCRep POSIXTime
t) = POSIXTime -> UniversalTime
UniversalRep POSIXTime
t
instance ParseTime AbsoluteTime where
{-# INLINE buildTime #-}
buildTime :: TimeParse -> AbsoluteTime
buildTime TimeParse
tp = forall t. ParseTime t => TimeParse -> t
buildTime TimeParse
tp forall s a. s -> Getting a s a -> a
^. TAIUTCMap -> Iso' UTCTime AbsoluteTime
absoluteTime (Map UTCTime TAIUTCRow -> Map AbsoluteTime TAIUTCRow -> TAIUTCMap
TAIUTCMap forall a. Monoid a => a
mempty forall a. Monoid a => a
mempty)
timeZoneParser :: Parser TimeZone
timeZoneParser :: Parser TimeZone
timeZoneParser = String -> Int -> Bool -> Parser TimeZone
zone String
"TAI" Int
0 Bool
False forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"UT1" Int
0 Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"ZULU" (forall a. Num a => a -> a -> a
($+) Int
00 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"Z" (forall a. Num a => a -> a -> a
($+) Int
00 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"YST" (forall a. Num a => a -> a -> a
($-) Int
09 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"YDT" (forall a. Num a => a -> a -> a
($-) Int
08 Int
00) Bool
True
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"WST" (forall a. Num a => a -> a -> a
($+) Int
08 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"WETDST" (forall a. Num a => a -> a -> a
($+) Int
01 Int
00) Bool
True
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"WET" (forall a. Num a => a -> a -> a
($+) Int
00 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"WDT" (forall a. Num a => a -> a -> a
($+) Int
09 Int
00) Bool
True
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"WAT" (forall a. Num a => a -> a -> a
($-) Int
01 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"WAST" (forall a. Num a => a -> a -> a
($+) Int
07 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"WADT" (forall a. Num a => a -> a -> a
($+) Int
08 Int
00) Bool
True
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"UTC" (forall a. Num a => a -> a -> a
($+) Int
00 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"UT" (forall a. Num a => a -> a -> a
($+) Int
00 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"TFT" (forall a. Num a => a -> a -> a
($+) Int
05 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"SWT" (forall a. Num a => a -> a -> a
($+) Int
01 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"SST" (forall a. Num a => a -> a -> a
($+) Int
02 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"SET" (forall a. Num a => a -> a -> a
($+) Int
01 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"SCT" (forall a. Num a => a -> a -> a
($+) Int
04 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"SAST" (forall a. Num a => a -> a -> a
($+) Int
09 Int
30) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"SADT" (forall a. Num a => a -> a -> a
($+) Int
10 Int
30) Bool
True
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"RET" (forall a. Num a => a -> a -> a
($+) Int
04 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"PST" (forall a. Num a => a -> a -> a
($-) Int
08 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"PDT" (forall a. Num a => a -> a -> a
($-) Int
07 Int
00) Bool
True
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"NZT" (forall a. Num a => a -> a -> a
($+) Int
12 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"NZST" (forall a. Num a => a -> a -> a
($+) Int
12 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"NZDT" (forall a. Num a => a -> a -> a
($+) Int
13 Int
00) Bool
True
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"NT" (forall a. Num a => a -> a -> a
($-) Int
11 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"NST" (forall a. Num a => a -> a -> a
($-) Int
03 Int
30) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"NOR" (forall a. Num a => a -> a -> a
($+) Int
01 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"NFT" (forall a. Num a => a -> a -> a
($-) Int
03 Int
30) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"NDT" (forall a. Num a => a -> a -> a
($-) Int
02 Int
30) Bool
True
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"MVT" (forall a. Num a => a -> a -> a
($+) Int
05 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"MUT" (forall a. Num a => a -> a -> a
($+) Int
04 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"MT" (forall a. Num a => a -> a -> a
($+) Int
08 Int
30) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"MST" (forall a. Num a => a -> a -> a
($-) Int
07 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"MMT" (forall a. Num a => a -> a -> a
($+) Int
06 Int
30) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"MHT" (forall a. Num a => a -> a -> a
($+) Int
09 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"MEZ" (forall a. Num a => a -> a -> a
($+) Int
01 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"MEWT" (forall a. Num a => a -> a -> a
($+) Int
01 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"METDST" (forall a. Num a => a -> a -> a
($+) Int
02 Int
00) Bool
True
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"MET" (forall a. Num a => a -> a -> a
($+) Int
01 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"MEST" (forall a. Num a => a -> a -> a
($+) Int
02 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"MDT" (forall a. Num a => a -> a -> a
($-) Int
06 Int
00) Bool
True
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"MAWT" (forall a. Num a => a -> a -> a
($+) Int
06 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"MART" (forall a. Num a => a -> a -> a
($-) Int
09 Int
30) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"LIGT" (forall a. Num a => a -> a -> a
($+) Int
10 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"KST" (forall a. Num a => a -> a -> a
($+) Int
09 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"JT" (forall a. Num a => a -> a -> a
($+) Int
07 Int
30) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"JST" (forall a. Num a => a -> a -> a
($+) Int
09 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"IT" (forall a. Num a => a -> a -> a
($+) Int
03 Int
30) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"IST" (forall a. Num a => a -> a -> a
($+) Int
02 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"IRT" (forall a. Num a => a -> a -> a
($+) Int
03 Int
30) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"IOT" (forall a. Num a => a -> a -> a
($+) Int
05 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"IDLW" (forall a. Num a => a -> a -> a
($-) Int
12 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"IDLE" (forall a. Num a => a -> a -> a
($+) Int
12 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"HST" (forall a. Num a => a -> a -> a
($-) Int
10 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"HMT" (forall a. Num a => a -> a -> a
($+) Int
03 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"HDT" (forall a. Num a => a -> a -> a
($-) Int
09 Int
00) Bool
True
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"GST" (forall a. Num a => a -> a -> a
($+) Int
10 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"GMT" (forall a. Num a => a -> a -> a
($+) Int
00 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"FWT" (forall a. Num a => a -> a -> a
($+) Int
02 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"FST" (forall a. Num a => a -> a -> a
($+) Int
01 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"FNT" (forall a. Num a => a -> a -> a
($-) Int
02 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"FNST" (forall a. Num a => a -> a -> a
($-) Int
01 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"EST" (forall a. Num a => a -> a -> a
($-) Int
05 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"EETDST" (forall a. Num a => a -> a -> a
($+) Int
03 Int
00) Bool
True
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"EET" (forall a. Num a => a -> a -> a
($+) Int
02 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"EDT" (forall a. Num a => a -> a -> a
($-) Int
04 Int
00) Bool
True
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"EAT" (forall a. Num a => a -> a -> a
($+) Int
03 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"EAST" (forall a. Num a => a -> a -> a
($+) Int
10 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"EAST" (forall a. Num a => a -> a -> a
($+) Int
04 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"DNT" (forall a. Num a => a -> a -> a
($+) Int
01 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"CXT" (forall a. Num a => a -> a -> a
($+) Int
07 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"CST" (forall a. Num a => a -> a -> a
($-) Int
06 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"CETDST" (forall a. Num a => a -> a -> a
($+) Int
02 Int
00) Bool
True
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"CET" (forall a. Num a => a -> a -> a
($+) Int
01 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"CEST" (forall a. Num a => a -> a -> a
($+) Int
02 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"CDT" (forall a. Num a => a -> a -> a
($-) Int
05 Int
00) Bool
True
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"CCT" (forall a. Num a => a -> a -> a
($+) Int
08 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"CAT" (forall a. Num a => a -> a -> a
($-) Int
10 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"CAST" (forall a. Num a => a -> a -> a
($+) Int
09 Int
30) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"CADT" (forall a. Num a => a -> a -> a
($+) Int
10 Int
30) Bool
True
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"BT" (forall a. Num a => a -> a -> a
($+) Int
03 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"BST" (forall a. Num a => a -> a -> a
($+) Int
01 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"BRT" (forall a. Num a => a -> a -> a
($-) Int
03 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"BRST" (forall a. Num a => a -> a -> a
($-) Int
02 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"BDST" (forall a. Num a => a -> a -> a
($+) Int
02 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"AWT" (forall a. Num a => a -> a -> a
($-) Int
03 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"AWST" (forall a. Num a => a -> a -> a
($+) Int
08 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"AWSST" (forall a. Num a => a -> a -> a
($+) Int
09 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"AST" (forall a. Num a => a -> a -> a
($-) Int
04 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"ALMT" (forall a. Num a => a -> a -> a
($+) Int
06 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"ALMST" (forall a. Num a => a -> a -> a
($+) Int
07 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"AKST" (forall a. Num a => a -> a -> a
($-) Int
09 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"AKDT" (forall a. Num a => a -> a -> a
($-) Int
08 Int
00) Bool
True
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"AHST" (forall a. Num a => a -> a -> a
($-) Int
10 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"AFT" (forall a. Num a => a -> a -> a
($+) Int
04 Int
30) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"AEST" (forall a. Num a => a -> a -> a
($+) Int
10 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"AESST" (forall a. Num a => a -> a -> a
($+) Int
11 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"ADT" (forall a. Num a => a -> a -> a
($-) Int
03 Int
00) Bool
True
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"ACT" (forall a. Num a => a -> a -> a
($-) Int
05 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"ACST" (forall a. Num a => a -> a -> a
($-) Int
04 Int
00) Bool
False
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Int -> Bool -> Parser TimeZone
zone String
"ACSST" (forall a. Num a => a -> a -> a
($+) Int
10 Int
30) Bool
False
where
zone :: String -> Int -> Bool -> Parser TimeZone
zone String
name Int
offset Bool
dst = Int -> Bool -> String -> TimeZone
TimeZone Int
offset Bool
dst String
name forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ ByteString -> Parser ByteString
P.string (String -> ByteString
S.pack String
name)
$+ :: a -> a -> a
($+) a
h a
m = a
h forall a. Num a => a -> a -> a
* a
60 forall a. Num a => a -> a -> a
+ a
m
$- :: a -> a -> a
($-) a
h a
m = forall a. Num a => a -> a
negate (a
h forall a. Num a => a -> a -> a
* a
60 forall a. Num a => a -> a -> a
+ a
m)