{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE ImportQualifiedPost #-}
{-# OPTIONS_HADDOCK hide #-}
module Core.Data.Format where
import Data.Hourglass qualified as H
( TimeFormat (..)
, TimeFormatElem (..)
, TimeFormatString (..)
)
data ISO8601_Precise = ISO8601_Precise
instance H.TimeFormat ISO8601_Precise where
toFormat :: ISO8601_Precise -> TimeFormatString
toFormat ISO8601_Precise
_ =
[TimeFormatElem] -> TimeFormatString
H.TimeFormatString
[ TimeFormatElem
H.Format_Year
, Char -> TimeFormatElem
H.Format_Text Char
'-'
, TimeFormatElem
H.Format_Month2
, Char -> TimeFormatElem
H.Format_Text Char
'-'
, TimeFormatElem
H.Format_Day2
, Char -> TimeFormatElem
H.Format_Text Char
'T'
, TimeFormatElem
H.Format_Hour
, Char -> TimeFormatElem
H.Format_Text Char
':'
, TimeFormatElem
H.Format_Minute
, Char -> TimeFormatElem
H.Format_Text Char
':'
, TimeFormatElem
H.Format_Second
, Char -> TimeFormatElem
H.Format_Text Char
'.'
, Int -> TimeFormatElem
H.Format_Precision Int
9
, Char -> TimeFormatElem
H.Format_Text Char
'Z'
]
data ISO8601_Seconds = ISO8601_Seconds
instance H.TimeFormat ISO8601_Seconds where
toFormat :: ISO8601_Seconds -> TimeFormatString
toFormat ISO8601_Seconds
_ =
[TimeFormatElem] -> TimeFormatString
H.TimeFormatString
[ TimeFormatElem
H.Format_Year
, Char -> TimeFormatElem
H.Format_Text Char
'-'
, TimeFormatElem
H.Format_Month2
, Char -> TimeFormatElem
H.Format_Text Char
'-'
, TimeFormatElem
H.Format_Day2
, Char -> TimeFormatElem
H.Format_Text Char
'T'
, TimeFormatElem
H.Format_Hour
, Char -> TimeFormatElem
H.Format_Text Char
':'
, TimeFormatElem
H.Format_Minute
, Char -> TimeFormatElem
H.Format_Text Char
':'
, TimeFormatElem
H.Format_Second
, Char -> TimeFormatElem
H.Format_Text Char
'Z'
]
data Posix_Precise = Posix_Precise
instance H.TimeFormat Posix_Precise where
toFormat :: Posix_Precise -> TimeFormatString
toFormat Posix_Precise
_ =
[TimeFormatElem] -> TimeFormatString
H.TimeFormatString
[ TimeFormatElem
H.Format_UnixSecond
, Char -> TimeFormatElem
H.Format_Text Char
'.'
, TimeFormatElem
H.Format_MilliSecond
, TimeFormatElem
H.Format_MicroSecond
, TimeFormatElem
H.Format_NanoSecond
]
data Posix_Micro = Posix_Micro
instance H.TimeFormat Posix_Micro where
toFormat :: Posix_Micro -> TimeFormatString
toFormat Posix_Micro
_ =
[TimeFormatElem] -> TimeFormatString
H.TimeFormatString
[ TimeFormatElem
H.Format_UnixSecond
, Char -> TimeFormatElem
H.Format_Text Char
'.'
, TimeFormatElem
H.Format_MilliSecond
, TimeFormatElem
H.Format_MicroSecond
]
data Posix_Milli = Posix_Milli
instance H.TimeFormat Posix_Milli where
toFormat :: Posix_Milli -> TimeFormatString
toFormat Posix_Milli
_ =
[TimeFormatElem] -> TimeFormatString
H.TimeFormatString
[ TimeFormatElem
H.Format_UnixSecond
, Char -> TimeFormatElem
H.Format_Text Char
'.'
, TimeFormatElem
H.Format_MilliSecond
]
data Posix_Seconds = Posix_Seconds
instance H.TimeFormat Posix_Seconds where
toFormat :: Posix_Seconds -> TimeFormatString
toFormat Posix_Seconds
_ =
[TimeFormatElem] -> TimeFormatString
H.TimeFormatString
[ TimeFormatElem
H.Format_UnixSecond
]