-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A performant time library -- -- Performance-oriented time library for haskell. The main differences -- between this and "time" are that this library: -- -- @package chronos @version 1.0.3 module Chronos -- | Get the current time from the system clock. now :: IO Time -- | Gets the current Day. This does not take the user's time zone -- into account. today :: IO Day -- | Gets the Day of tomorrow. tomorrow :: IO Day -- | Gets the Day of yesterday. yesterday :: IO Day -- | The Unix epoch, that is 1970-01-01 00:00:00. epoch :: Time -- | Measures the time it takes to run an action and evaluate its result to -- WHNF. This measurement uses a monotonic clock instead of the standard -- system clock. stopwatch :: IO a -> IO (Timespan, a) -- | Measures the time it takes to run an action. The result is discarded. -- This measurement uses a monotonic clock instead of the standard system -- clock. stopwatch_ :: IO a -> IO Timespan -- | Variant of stopwatch that accepts a clock type. Users need to -- import System.Clock from the clock package in order -- to provide the clock type. stopwatchWith :: Clock -> IO a -> IO (Timespan, a) -- | Variant of stopwatch_ that accepts a clock type. stopwatchWith_ :: Clock -> IO a -> IO Timespan -- | Construct a Datetime from year, month, day, hour, minute, -- second: -- --
--   >>> datetimeFromYmdhms 2014 2 26 17 58 52
--   foobar
--   
datetimeFromYmdhms :: Int -> Int -> Int -> Int -> Int -> Int -> Datetime timeFromYmdhms :: Int -> Int -> Int -> Int -> Int -> Int -> Time -- | Convert Time to Datetime. timeToDatetime :: Time -> Datetime -- | Convert Datetime to Time. datetimeToTime :: Datetime -> Time -- | Convert Time to OffsetDatetime by providing an -- Offset. timeToOffsetDatetime :: Offset -> Time -> OffsetDatetime -- | Convert OffsetDatetime to Time. offsetDatetimeToTime :: OffsetDatetime -> Time -- | Convert Time to Day. This function is lossy; -- consequently, it does not roundtrip with dayToTimeMidnight. timeToDayTruncate :: Time -> Day -- | Convert midnight of the given Day to Time. dayToTimeMidnight :: Day -> Time -- | Convert Day to a Date. dayToDate :: Day -> Date -- | Convert Date to a Day. dateToDay :: Date -> Day dayToOrdinalDate :: Day -> OrdinalDate ordinalDateToDay :: OrdinalDate -> Day monthDateToDayOfYear :: Bool -> MonthDate -> DayOfYear dayOfYearToMonthDay :: Bool -> DayOfYear -> MonthDate second :: Timespan minute :: Timespan hour :: Timespan day :: Timespan week :: Timespan buildDayOfWeekMatch :: a -> a -> a -> a -> a -> a -> a -> DayOfWeekMatch a buildMonthMatch :: a -> a -> a -> a -> a -> a -> a -> a -> a -> a -> a -> a -> MonthMatch a caseMonth :: MonthMatch a -> Month -> a w3c :: DatetimeFormat slash :: DatetimeFormat hyphen :: DatetimeFormat compact :: DatetimeFormat january :: Month february :: Month march :: Month april :: Month may :: Month june :: Month july :: Month august :: Month september :: Month october :: Month november :: Month december :: Month sunday :: DayOfWeek monday :: DayOfWeek tuesday :: DayOfWeek wednesday :: DayOfWeek thursday :: DayOfWeek friday :: DayOfWeek saturday :: DayOfWeek daysInMonth :: Bool -> Month -> Int isLeapYear :: Year -> Bool observedOffsets :: Vector Offset -- | This could be written much more efficiently since we know the exact -- size the resulting Text will be. builder_Ymd :: Maybe Char -> Date -> Builder builder_Dmy :: Maybe Char -> Date -> Builder builder_HMS :: SubsecondPrecision -> Maybe Char -> TimeOfDay -> Builder parser_Ymd :: Maybe Char -> Parser Date parser_Mdy :: Maybe Char -> Parser Date parser_Dmy :: Maybe Char -> Parser Date builderUtf8_Ymd :: Maybe Char -> Date -> Builder parserUtf8_Ymd :: Maybe Char -> Parser Date builder_IMS_p :: MeridiemLocale Text -> SubsecondPrecision -> Maybe Char -> TimeOfDay -> Builder builder_IMSp :: MeridiemLocale Text -> SubsecondPrecision -> Maybe Char -> TimeOfDay -> Builder parser_HMS :: Maybe Char -> Parser TimeOfDay -- | Parses text that is formatted as either of the following: -- -- -- -- That is, the seconds and subseconds part is optional. If it is not -- provided, it is assumed to be zero. This format shows up in Google -- Chrome's datetime-local inputs. parser_HMS_opt_S :: Maybe Char -> Parser TimeOfDay builderUtf8_HMS :: SubsecondPrecision -> Maybe Char -> TimeOfDay -> Builder builderUtf8_IMS_p :: MeridiemLocale ByteString -> SubsecondPrecision -> Maybe Char -> TimeOfDay -> Builder builderUtf8_IMSp :: MeridiemLocale ByteString -> SubsecondPrecision -> Maybe Char -> TimeOfDay -> Builder parserUtf8_HMS :: Maybe Char -> Parser TimeOfDay -- | Parses text that is formatted as either of the following: -- -- -- -- That is, the seconds and subseconds part is optional. If it is not -- provided, it is assumed to be zero. This format shows up in Google -- Chrome's datetime-local inputs. parserUtf8_HMS_opt_S :: Maybe Char -> Parser TimeOfDay builder_DmyHMS :: SubsecondPrecision -> DatetimeFormat -> Datetime -> Builder builder_DmyIMSp :: MeridiemLocale Text -> SubsecondPrecision -> DatetimeFormat -> Datetime -> Builder builder_DmyIMS_p :: MeridiemLocale Text -> SubsecondPrecision -> DatetimeFormat -> Datetime -> Builder -- | This could be written much more efficiently since we know the exact -- size the resulting Text will be. builder_YmdHMS :: SubsecondPrecision -> DatetimeFormat -> Datetime -> Builder builder_YmdIMSp :: MeridiemLocale Text -> SubsecondPrecision -> DatetimeFormat -> Datetime -> Builder builder_YmdIMS_p :: MeridiemLocale Text -> SubsecondPrecision -> DatetimeFormat -> Datetime -> Builder builderW3C :: Datetime -> Builder encode_DmyHMS :: SubsecondPrecision -> DatetimeFormat -> Datetime -> Text encode_DmyIMS_p :: MeridiemLocale Text -> SubsecondPrecision -> DatetimeFormat -> Datetime -> Text encode_YmdHMS :: SubsecondPrecision -> DatetimeFormat -> Datetime -> Text encode_YmdIMS_p :: MeridiemLocale Text -> SubsecondPrecision -> DatetimeFormat -> Datetime -> Text parser_DmyHMS :: DatetimeFormat -> Parser Datetime parser_YmdHMS :: DatetimeFormat -> Parser Datetime parser_YmdHMS_opt_S :: DatetimeFormat -> Parser Datetime parser_DmyHMS_opt_S :: DatetimeFormat -> Parser Datetime decode_DmyHMS :: DatetimeFormat -> Text -> Maybe Datetime decode_YmdHMS :: DatetimeFormat -> Text -> Maybe Datetime decode_YmdHMS_opt_S :: DatetimeFormat -> Text -> Maybe Datetime decode_DmyHMS_opt_S :: DatetimeFormat -> Text -> Maybe Datetime encodeUtf8_YmdHMS :: SubsecondPrecision -> DatetimeFormat -> Datetime -> ByteString encodeUtf8_YmdIMS_p :: MeridiemLocale ByteString -> SubsecondPrecision -> DatetimeFormat -> Datetime -> ByteString builderUtf8_YmdHMS :: SubsecondPrecision -> DatetimeFormat -> Datetime -> Builder builderUtf8_YmdIMSp :: MeridiemLocale ByteString -> SubsecondPrecision -> DatetimeFormat -> Datetime -> Builder builderUtf8_YmdIMS_p :: MeridiemLocale ByteString -> SubsecondPrecision -> DatetimeFormat -> Datetime -> Builder builderUtf8W3C :: Datetime -> Builder decodeUtf8_YmdHMS :: DatetimeFormat -> ByteString -> Maybe Datetime decodeUtf8_YmdHMS_opt_S :: DatetimeFormat -> ByteString -> Maybe Datetime parserUtf8_YmdHMS :: DatetimeFormat -> Parser Datetime parserUtf8_YmdHMS_opt_S :: DatetimeFormat -> Parser Datetime encode_YmdHMSz :: OffsetFormat -> SubsecondPrecision -> DatetimeFormat -> OffsetDatetime -> Text encode_DmyHMSz :: OffsetFormat -> SubsecondPrecision -> DatetimeFormat -> OffsetDatetime -> Text builder_YmdHMSz :: OffsetFormat -> SubsecondPrecision -> DatetimeFormat -> OffsetDatetime -> Builder builder_DmyHMSz :: OffsetFormat -> SubsecondPrecision -> DatetimeFormat -> OffsetDatetime -> Builder parser_YmdHMSz :: OffsetFormat -> DatetimeFormat -> Parser OffsetDatetime parser_DmyHMSz :: OffsetFormat -> DatetimeFormat -> Parser OffsetDatetime builder_YmdIMS_p_z :: OffsetFormat -> MeridiemLocale Text -> SubsecondPrecision -> DatetimeFormat -> OffsetDatetime -> Builder builder_DmyIMS_p_z :: OffsetFormat -> MeridiemLocale Text -> SubsecondPrecision -> DatetimeFormat -> OffsetDatetime -> Builder builderW3Cz :: OffsetDatetime -> Builder builderUtf8_YmdHMSz :: OffsetFormat -> SubsecondPrecision -> DatetimeFormat -> OffsetDatetime -> Builder parserUtf8_YmdHMSz :: OffsetFormat -> DatetimeFormat -> Parser OffsetDatetime builderUtf8_YmdIMS_p_z :: OffsetFormat -> MeridiemLocale ByteString -> SubsecondPrecision -> DatetimeFormat -> OffsetDatetime -> Builder builderUtf8W3Cz :: OffsetDatetime -> Builder encodeOffset :: OffsetFormat -> Offset -> Text builderOffset :: OffsetFormat -> Offset -> Builder decodeOffset :: OffsetFormat -> Text -> Maybe Offset parserOffset :: OffsetFormat -> Parser Offset encodeOffsetUtf8 :: OffsetFormat -> Offset -> ByteString builderOffsetUtf8 :: OffsetFormat -> Offset -> Builder decodeOffsetUtf8 :: OffsetFormat -> ByteString -> Maybe Offset parserOffsetUtf8 :: OffsetFormat -> Parser Offset encodeTimespan :: SubsecondPrecision -> Timespan -> Text builderTimespan :: SubsecondPrecision -> Timespan -> Builder encodeTimespanUtf8 :: SubsecondPrecision -> Timespan -> ByteString builderTimespanUtf8 :: SubsecondPrecision -> Timespan -> Builder -- | A day represented as the modified Julian date, the number of days -- since midnight on November 17, 1858. newtype Day Day :: Int -> Day [getDay] :: Day -> Int -- | The day of the week. newtype DayOfWeek DayOfWeek :: Int -> DayOfWeek [getDayOfWeek] :: DayOfWeek -> Int -- | The day of the month. newtype DayOfMonth DayOfMonth :: Int -> DayOfMonth [getDayOfMonth] :: DayOfMonth -> Int -- | The day of the year. newtype DayOfYear DayOfYear :: Int -> DayOfYear [getDayOfYear] :: DayOfYear -> Int -- | The month of the year. newtype Month Month :: Int -> Month [getMonth] :: Month -> Int -- | The number of years elapsed since the beginning of the Common Era. newtype Year Year :: Int -> Year [getYear] :: Year -> Int newtype Offset Offset :: Int -> Offset [getOffset] :: Offset -> Int -- | POSIX time with nanosecond resolution. newtype Time Time :: Int64 -> Time [getTime] :: Time -> Int64 newtype DayOfWeekMatch a DayOfWeekMatch :: Vector a -> DayOfWeekMatch a [getDayOfWeekMatch] :: DayOfWeekMatch a -> Vector a newtype MonthMatch a MonthMatch :: Vector a -> MonthMatch a [getMonthMatch] :: MonthMatch a -> Vector a newtype UnboxedMonthMatch a UnboxedMonthMatch :: Vector a -> UnboxedMonthMatch a [getUnboxedMonthMatch] :: UnboxedMonthMatch a -> Vector a -- | A timespan. This is represented internally as a number of nanoseconds. newtype Timespan Timespan :: Int64 -> Timespan [getTimespan] :: Timespan -> Int64 -- | The precision used when encoding seconds to a human-readable format. data SubsecondPrecision -- | Rounds to second, millisecond, microsecond, or nanosecond SubsecondPrecisionAuto :: SubsecondPrecision -- | Specify number of places after decimal SubsecondPrecisionFixed :: {-# UNPACK #-} !Int -> SubsecondPrecision -- | A date as represented by the Gregorian calendar. data Date Date :: {-# UNPACK #-} !Year -> {-# UNPACK #-} !Month -> {-# UNPACK #-} !DayOfMonth -> Date [dateYear] :: Date -> {-# UNPACK #-} !Year [dateMonth] :: Date -> {-# UNPACK #-} !Month [dateDay] :: Date -> {-# UNPACK #-} !DayOfMonth -- | The year and number of days elapsed since the beginning it began. data OrdinalDate OrdinalDate :: {-# UNPACK #-} !Year -> {-# UNPACK #-} !DayOfYear -> OrdinalDate [ordinalDateYear] :: OrdinalDate -> {-# UNPACK #-} !Year [ordinalDateDayOfYear] :: OrdinalDate -> {-# UNPACK #-} !DayOfYear -- | A month and the day of the month. This does not actually represent a -- specific date, since this recurs every year. data MonthDate MonthDate :: {-# UNPACK #-} !Month -> {-# UNPACK #-} !DayOfMonth -> MonthDate [monthDateMonth] :: MonthDate -> {-# UNPACK #-} !Month [monthDateDay] :: MonthDate -> {-# UNPACK #-} !DayOfMonth -- | A date as represented by the Gregorian calendar and a time of day. data Datetime Datetime :: {-# UNPACK #-} !Date -> {-# UNPACK #-} !TimeOfDay -> Datetime [datetimeDate] :: Datetime -> {-# UNPACK #-} !Date [datetimeTime] :: Datetime -> {-# UNPACK #-} !TimeOfDay data OffsetDatetime OffsetDatetime :: {-# UNPACK #-} !Datetime -> {-# UNPACK #-} !Offset -> OffsetDatetime [offsetDatetimeDatetime] :: OffsetDatetime -> {-# UNPACK #-} !Datetime [offsetDatetimeOffset] :: OffsetDatetime -> {-# UNPACK #-} !Offset -- | A time of day with nanosecond resolution. data TimeOfDay TimeOfDay :: {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int64 -> TimeOfDay [timeOfDayHour] :: TimeOfDay -> {-# UNPACK #-} !Int [timeOfDayMinute] :: TimeOfDay -> {-# UNPACK #-} !Int [timeOfDayNanoseconds] :: TimeOfDay -> {-# UNPACK #-} !Int64 data DatetimeFormat DatetimeFormat :: !(Maybe Char) -> !(Maybe Char) -> !(Maybe Char) -> DatetimeFormat -- | Separator in the date [datetimeFormatDateSeparator] :: DatetimeFormat -> !(Maybe Char) -- | Separator between date and time [datetimeFormatSeparator] :: DatetimeFormat -> !(Maybe Char) -- | Separator in the time [datetimeFormatTimeSeparator] :: DatetimeFormat -> !(Maybe Char) -- | Formatting settings for a timezone offset. data OffsetFormat -- | %z (e.g., -0400) OffsetFormatColonOff :: OffsetFormat -- | %:z (e.g., -04:00) OffsetFormatColonOn :: OffsetFormat -- | %::z (e.g., -04:00:00) OffsetFormatSecondsPrecision :: OffsetFormat -- | %:::z (e.g., -04, +05:30) OffsetFormatColonAuto :: OffsetFormat -- | Locale-specific formatting for weekdays and months. The type variable -- will likely be instantiated to Text or ByteString. data DatetimeLocale a DatetimeLocale :: !(DayOfWeekMatch a) -> !(DayOfWeekMatch a) -> !(MonthMatch a) -> !(MonthMatch a) -> DatetimeLocale a -- | full weekdays starting with Sunday, 7 elements [datetimeLocaleDaysOfWeekFull] :: DatetimeLocale a -> !(DayOfWeekMatch a) -- | abbreviated weekdays starting with Sunday, 7 elements [datetimeLocaleDaysOfWeekAbbreviated] :: DatetimeLocale a -> !(DayOfWeekMatch a) -- | full months starting with January, 12 elements [datetimeLocaleMonthsFull] :: DatetimeLocale a -> !(MonthMatch a) -- | abbreviated months starting with January, 12 elements [datetimeLocaleMonthsAbbreviated] :: DatetimeLocale a -> !(MonthMatch a) -- | Locale-specific formatting for AM and PM. data MeridiemLocale a MeridiemLocale :: !a -> !a -> MeridiemLocale a [meridiemLocaleAm] :: MeridiemLocale a -> !a [meridiemLocalePm] :: MeridiemLocale a -> !a instance GHC.Classes.Ord a => GHC.Classes.Ord (Chronos.MeridiemLocale a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Chronos.MeridiemLocale a) instance GHC.Show.Show a => GHC.Show.Show (Chronos.MeridiemLocale a) instance GHC.Read.Read a => GHC.Read.Read (Chronos.MeridiemLocale a) instance GHC.Generics.Generic Chronos.OffsetFormat instance GHC.Enum.Bounded Chronos.OffsetFormat instance GHC.Enum.Enum Chronos.OffsetFormat instance GHC.Classes.Ord Chronos.OffsetFormat instance GHC.Classes.Eq Chronos.OffsetFormat instance GHC.Read.Read Chronos.OffsetFormat instance GHC.Show.Show Chronos.OffsetFormat instance GHC.Classes.Ord Chronos.DatetimeFormat instance GHC.Classes.Eq Chronos.DatetimeFormat instance GHC.Read.Read Chronos.DatetimeFormat instance GHC.Show.Show Chronos.DatetimeFormat instance GHC.Classes.Ord Chronos.OffsetDatetime instance GHC.Classes.Eq Chronos.OffsetDatetime instance GHC.Read.Read Chronos.OffsetDatetime instance GHC.Show.Show Chronos.OffsetDatetime instance GHC.Classes.Ord Chronos.Datetime instance GHC.Classes.Eq Chronos.Datetime instance GHC.Read.Read Chronos.Datetime instance GHC.Show.Show Chronos.Datetime instance GHC.Classes.Ord Chronos.TimeOfDay instance GHC.Classes.Eq Chronos.TimeOfDay instance GHC.Read.Read Chronos.TimeOfDay instance GHC.Show.Show Chronos.TimeOfDay instance GHC.Classes.Ord Chronos.MonthDate instance GHC.Classes.Eq Chronos.MonthDate instance GHC.Read.Read Chronos.MonthDate instance GHC.Show.Show Chronos.MonthDate instance GHC.Classes.Ord Chronos.OrdinalDate instance GHC.Classes.Eq Chronos.OrdinalDate instance GHC.Read.Read Chronos.OrdinalDate instance GHC.Show.Show Chronos.OrdinalDate instance GHC.Classes.Ord Chronos.Date instance GHC.Classes.Eq Chronos.Date instance GHC.Read.Read Chronos.Date instance GHC.Show.Show Chronos.Date instance Torsor.Additive Chronos.Timespan instance Data.Aeson.Types.FromJSON.FromJSON Chronos.Timespan instance Data.Aeson.Types.ToJSON.ToJSON Chronos.Timespan instance GHC.Classes.Ord Chronos.Timespan instance GHC.Classes.Eq Chronos.Timespan instance GHC.Read.Read Chronos.Timespan instance GHC.Show.Show Chronos.Timespan instance Data.Primitive.Types.Prim Chronos.Time instance Foreign.Storable.Storable Chronos.Time instance GHC.Read.Read Chronos.Time instance GHC.Show.Show Chronos.Time instance GHC.Classes.Ord Chronos.Time instance GHC.Classes.Eq Chronos.Time instance Data.Hashable.Class.Hashable Chronos.Time instance Data.Aeson.Types.ToJSON.ToJSON Chronos.Time instance Data.Aeson.Types.FromJSON.FromJSON Chronos.Time instance GHC.Enum.Enum Chronos.Offset instance GHC.Classes.Ord Chronos.Offset instance GHC.Classes.Eq Chronos.Offset instance GHC.Read.Read Chronos.Offset instance GHC.Show.Show Chronos.Offset instance GHC.Classes.Ord Chronos.Year instance GHC.Classes.Eq Chronos.Year instance GHC.Read.Read Chronos.Year instance GHC.Show.Show Chronos.Year instance Data.Primitive.Types.Prim Chronos.Month instance GHC.Classes.Ord Chronos.Month instance GHC.Classes.Eq Chronos.Month instance GHC.Read.Read Chronos.Month instance GHC.Show.Show Chronos.Month instance Data.Primitive.Types.Prim Chronos.DayOfYear instance GHC.Classes.Ord Chronos.DayOfYear instance GHC.Classes.Eq Chronos.DayOfYear instance GHC.Read.Read Chronos.DayOfYear instance GHC.Show.Show Chronos.DayOfYear instance GHC.Enum.Enum Chronos.DayOfMonth instance Data.Primitive.Types.Prim Chronos.DayOfMonth instance GHC.Classes.Ord Chronos.DayOfMonth instance GHC.Classes.Eq Chronos.DayOfMonth instance GHC.Read.Read Chronos.DayOfMonth instance GHC.Show.Show Chronos.DayOfMonth instance Data.Hashable.Class.Hashable Chronos.DayOfWeek instance GHC.Classes.Ord Chronos.DayOfWeek instance GHC.Classes.Eq Chronos.DayOfWeek instance GHC.Read.Read Chronos.DayOfWeek instance GHC.Show.Show Chronos.DayOfWeek instance Data.Primitive.Types.Prim Chronos.Day instance Foreign.Storable.Storable Chronos.Day instance Data.Aeson.Types.FromJSON.FromJSON Chronos.Day instance Data.Aeson.Types.ToJSON.ToJSON Chronos.Day instance GHC.Enum.Enum Chronos.Day instance Data.Hashable.Class.Hashable Chronos.Day instance GHC.Classes.Ord Chronos.Day instance GHC.Classes.Eq Chronos.Day instance GHC.Read.Read Chronos.Day instance GHC.Show.Show Chronos.Day instance Data.Aeson.Types.ToJSON.ToJSON Chronos.Offset instance Data.Aeson.Types.ToJSON.ToJSONKey Chronos.Offset instance Data.Aeson.Types.ToJSON.ToJSON Chronos.Datetime instance Torsor.Torsor Chronos.OrdinalDate GHC.Types.Int instance GHC.Enum.Enum Chronos.OrdinalDate instance Torsor.Torsor Chronos.Date GHC.Types.Int instance GHC.Enum.Enum Chronos.Date instance Data.Semigroup.Semigroup Chronos.Timespan instance GHC.Base.Monoid Chronos.Timespan instance Torsor.Torsor Chronos.Time Chronos.Timespan instance Torsor.Scaling Chronos.Timespan GHC.Int.Int64 instance Torsor.Torsor Chronos.Offset GHC.Types.Int instance Data.Aeson.Types.FromJSON.FromJSON Chronos.Offset instance Data.Aeson.Types.FromJSON.FromJSONKey Chronos.Offset instance GHC.Enum.Enum Chronos.Month instance GHC.Enum.Bounded Chronos.Month instance Data.Vector.Unboxed.Base.Unbox Chronos.Month instance Data.Vector.Generic.Mutable.Base.MVector Data.Vector.Unboxed.Base.MVector Chronos.Month instance Data.Vector.Generic.Base.Vector Data.Vector.Unboxed.Base.Vector Chronos.Month instance Data.Vector.Unboxed.Base.Unbox Chronos.DayOfMonth instance Data.Vector.Generic.Mutable.Base.MVector Data.Vector.Unboxed.Base.MVector Chronos.DayOfMonth instance Data.Vector.Generic.Base.Vector Data.Vector.Unboxed.Base.Vector Chronos.DayOfMonth instance Torsor.Torsor Chronos.Day GHC.Types.Int -- | Data types for representing different date and time-related -- information. -- -- Internally, the types Int and Int64 are used to -- represent everything. These are used even when negative values are not -- appropriate and even if a smaller fixed-size integer could hold the -- information. The only cases when Int64 is used are when it is -- neccessary to represent values with numbers 2^29 or higher. -- These are typically fields that represent nanoseconds. -- -- Unlike the types in the venerable time library, the types -- here do not allow the user to work with all dates. Since this library -- uses fixed-precision integral values instead of Integer, all of -- the usual problems with overflow should be considered. Notably, -- PosixTime and TaiTime can only be used to represent -- time between the years 1680 and 2260. All other types in this library -- correctly represent time a million years before or after 1970. -- -- The vector unbox instances, not yet available, will store data in a -- reasonably compact manner. For example, the instance for Day -- has three unboxed vectors: Int for the year, Int8 for -- the month, and Int8 for the day. This only causes corruption -- of data if the user is trying to use out-of-bounds values for the -- month and the day. Users are advised to not use the data types -- provided here to model non-existent times. module Chronos.Types -- | A day represented as the modified Julian date, the number of days -- since midnight on November 17, 1858. newtype Day Day :: Int -> Day [getDay] :: Day -> Int -- | The day of the week. newtype DayOfWeek DayOfWeek :: Int -> DayOfWeek [getDayOfWeek] :: DayOfWeek -> Int -- | The day of the month. newtype DayOfMonth DayOfMonth :: Int -> DayOfMonth [getDayOfMonth] :: DayOfMonth -> Int -- | The day of the year. newtype DayOfYear DayOfYear :: Int -> DayOfYear [getDayOfYear] :: DayOfYear -> Int -- | The month of the year. newtype Month Month :: Int -> Month [getMonth] :: Month -> Int -- | The number of years elapsed since the beginning of the Common Era. newtype Year Year :: Int -> Year [getYear] :: Year -> Int newtype Offset Offset :: Int -> Offset [getOffset] :: Offset -> Int -- | POSIX time with nanosecond resolution. newtype Time Time :: Int64 -> Time [getTime] :: Time -> Int64 newtype DayOfWeekMatch a DayOfWeekMatch :: Vector a -> DayOfWeekMatch a [getDayOfWeekMatch] :: DayOfWeekMatch a -> Vector a newtype MonthMatch a MonthMatch :: Vector a -> MonthMatch a [getMonthMatch] :: MonthMatch a -> Vector a newtype UnboxedMonthMatch a UnboxedMonthMatch :: Vector a -> UnboxedMonthMatch a [getUnboxedMonthMatch] :: UnboxedMonthMatch a -> Vector a -- | A timespan. This is represented internally as a number of nanoseconds. newtype Timespan Timespan :: Int64 -> Timespan [getTimespan] :: Timespan -> Int64 -- | The precision used when encoding seconds to a human-readable format. data SubsecondPrecision -- | Rounds to second, millisecond, microsecond, or nanosecond SubsecondPrecisionAuto :: SubsecondPrecision -- | Specify number of places after decimal SubsecondPrecisionFixed :: {-# UNPACK #-} !Int -> SubsecondPrecision -- | A date as represented by the Gregorian calendar. data Date Date :: {-# UNPACK #-} !Year -> {-# UNPACK #-} !Month -> {-# UNPACK #-} !DayOfMonth -> Date [dateYear] :: Date -> {-# UNPACK #-} !Year [dateMonth] :: Date -> {-# UNPACK #-} !Month [dateDay] :: Date -> {-# UNPACK #-} !DayOfMonth -- | The year and number of days elapsed since the beginning it began. data OrdinalDate OrdinalDate :: {-# UNPACK #-} !Year -> {-# UNPACK #-} !DayOfYear -> OrdinalDate [ordinalDateYear] :: OrdinalDate -> {-# UNPACK #-} !Year [ordinalDateDayOfYear] :: OrdinalDate -> {-# UNPACK #-} !DayOfYear -- | A month and the day of the month. This does not actually represent a -- specific date, since this recurs every year. data MonthDate MonthDate :: {-# UNPACK #-} !Month -> {-# UNPACK #-} !DayOfMonth -> MonthDate [monthDateMonth] :: MonthDate -> {-# UNPACK #-} !Month [monthDateDay] :: MonthDate -> {-# UNPACK #-} !DayOfMonth -- | A date as represented by the Gregorian calendar and a time of day. data Datetime Datetime :: {-# UNPACK #-} !Date -> {-# UNPACK #-} !TimeOfDay -> Datetime [datetimeDate] :: Datetime -> {-# UNPACK #-} !Date [datetimeTime] :: Datetime -> {-# UNPACK #-} !TimeOfDay data OffsetDatetime OffsetDatetime :: {-# UNPACK #-} !Datetime -> {-# UNPACK #-} !Offset -> OffsetDatetime [offsetDatetimeDatetime] :: OffsetDatetime -> {-# UNPACK #-} !Datetime [offsetDatetimeOffset] :: OffsetDatetime -> {-# UNPACK #-} !Offset -- | A time of day with nanosecond resolution. data TimeOfDay TimeOfDay :: {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int64 -> TimeOfDay [timeOfDayHour] :: TimeOfDay -> {-# UNPACK #-} !Int [timeOfDayMinute] :: TimeOfDay -> {-# UNPACK #-} !Int [timeOfDayNanoseconds] :: TimeOfDay -> {-# UNPACK #-} !Int64 data DatetimeFormat DatetimeFormat :: !(Maybe Char) -> !(Maybe Char) -> !(Maybe Char) -> DatetimeFormat -- | Separator in the date [datetimeFormatDateSeparator] :: DatetimeFormat -> !(Maybe Char) -- | Separator between date and time [datetimeFormatSeparator] :: DatetimeFormat -> !(Maybe Char) -- | Separator in the time [datetimeFormatTimeSeparator] :: DatetimeFormat -> !(Maybe Char) -- | Formatting settings for a timezone offset. data OffsetFormat -- | %z (e.g., -0400) OffsetFormatColonOff :: OffsetFormat -- | %:z (e.g., -04:00) OffsetFormatColonOn :: OffsetFormat -- | %::z (e.g., -04:00:00) OffsetFormatSecondsPrecision :: OffsetFormat -- | %:::z (e.g., -04, +05:30) OffsetFormatColonAuto :: OffsetFormat -- | Locale-specific formatting for weekdays and months. The type variable -- will likely be instantiated to Text or ByteString. data DatetimeLocale a DatetimeLocale :: !(DayOfWeekMatch a) -> !(DayOfWeekMatch a) -> !(MonthMatch a) -> !(MonthMatch a) -> DatetimeLocale a -- | full weekdays starting with Sunday, 7 elements [datetimeLocaleDaysOfWeekFull] :: DatetimeLocale a -> !(DayOfWeekMatch a) -- | abbreviated weekdays starting with Sunday, 7 elements [datetimeLocaleDaysOfWeekAbbreviated] :: DatetimeLocale a -> !(DayOfWeekMatch a) -- | full months starting with January, 12 elements [datetimeLocaleMonthsFull] :: DatetimeLocale a -> !(MonthMatch a) -- | abbreviated months starting with January, 12 elements [datetimeLocaleMonthsAbbreviated] :: DatetimeLocale a -> !(MonthMatch a) -- | Locale-specific formatting for AM and PM. data MeridiemLocale a MeridiemLocale :: !a -> !a -> MeridiemLocale a [meridiemLocaleAm] :: MeridiemLocale a -> !a [meridiemLocalePm] :: MeridiemLocale a -> !a module Chronos.Locale.English lower :: MeridiemLocale Text upper :: MeridiemLocale Text lowerDots :: MeridiemLocale Text upperDots :: MeridiemLocale Text abbreviated :: MonthMatch Text unabbreviated :: MonthMatch Text