chronos-1.0.7: A performant time library

Safe HaskellNone
LanguageHaskell2010

Chronos

Contents

Description

Chronos is a performance-oriented time library for Haskell, with a straightforward API. The main differences between this and the time library are:

  • Chronos uses machine integers where possible. This means that time-related arithmetic should be faster, with the drawback that the types are incapable of representing times that are very far in the future or the past (because Chronos provides nanosecond, rather than picosecond, resolution). For most users, this is not a hindrance.
  • Chronos provides 'ToJSON'/'FromJSON' instances for serialisation.
  • Chronos provides Unbox instances for working with unboxed vectors.
  • Chronos provides Prim instances for working with byte arrays/primitive arrays.
  • Chronos uses normal non-overloaded haskell functions for encoding and decoding time. It provides attoparsec parsers for both Text and ByteString. Additionally, Chronos provides functions for encoding time to Text or ByteString. The http://hackage.haskell.org/package/time time> library accomplishes these with the Data.Time.Format module, which uses UNIX-style datetime format strings. The approach taken by Chronos is faster and catches more mistakes at compile time, at the cost of being less expressive.
Synopsis

Functions

Current

now :: IO Time #

Get the current time from the system clock.

today :: IO Day #

Gets the current Day. This does not take the user's time zone into account.

tomorrow :: IO Day #

Gets the Day of tomorrow.

yesterday :: IO Day #

Gets the Day of yesterday.

epoch :: Time #

The Unix epoch, that is 1970-01-01 00:00:00.

Duration

stopwatch :: IO a -> IO (Timespan, a) #

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 #

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.

stopwatchWith :: Clock -> IO a -> IO (Timespan, a) #

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 #

Variant of stopwatch_ that accepts a clock type.

Construction

datetimeFromYmdhms #

Arguments

:: Int

Year

-> Int

Month

-> Int

Day

-> Int

Hour

-> Int

Minute

-> Int

Second

-> Datetime 

Construct a Datetime from year, month, day, hour, minute, second:

>>> datetimeFromYmdhms 2014 2 26 17 58 52
Datetime {datetimeDate = Date {dateYear = Year {getYear = 2014}, dateMonth = Month {getMonth = 1}, dateDay = DayOfMonth {getDayOfMonth = 26}}, datetimeTime = TimeOfDay {timeOfDayHour = 17, timeOfDayMinute = 58, timeOfDayNanoseconds = 52000000000}}

timeFromYmdhms #

Arguments

:: Int

Year

-> Int

Month

-> Int

Day

-> Int

Hour

-> Int

Minute

-> Int

Second

-> Time 

Construct a Time from year, month, day, hour, minute, second:

>>> timeFromYmdhms 2014 2 26 17 58 52
Time {getTime = 1393437532000000000}

Conversion

timeToDatetime :: Time -> Datetime #

Convert Time to Datetime.

\(t :: Time) -> (datetimeToTime (timeToDatetime t)) == t

datetimeToTime :: Datetime -> Time #

Convert Datetime to Time.

\(d :: Datetime) -> timeToDatetime (datetimeToTime d) == d

timeToDayTruncate :: Time -> Day #

Convert Time to Day. This function is lossy; consequently, it does not roundtrip with dayToTimeMidnight.

dayToTimeMidnight :: Day -> Time #

Convert midnight of the given Day to Time.

dayToDate :: Day -> Date #

Convert Day to a Date.

\(d :: Day) -> dateToDay (dayToDate d) == d

dateToDay :: Date -> Day #

Convert a Date to a Day.

\(d :: Date) -> dayToDate (dateToDay d) == d

monthDateToDayOfYear #

Arguments

:: Bool

Is it a leap year?

-> MonthDate 
-> DayOfYear 

Convert a MonthDate to a DayOfYear.

dayOfYearToMonthDay #

Arguments

:: Bool

Is it a leap year?

-> DayOfYear 
-> MonthDate 

Convert a DayOfYear to a MonthDate.

Build Timespan

second :: Timespan #

A Timespan representing a single second.

minute :: Timespan #

A Timespan representing a single minute.

hour :: Timespan #

A Timespan representing a single hour.

day :: Timespan #

A Timespan representing a single day.

week :: Timespan #

A Timespan representing a single week.

Matching

buildDayOfWeekMatch :: a -> a -> a -> a -> a -> a -> a -> DayOfWeekMatch a #

Build a DayOfWeekMatch from seven (7) values.

buildMonthMatch :: a -> a -> a -> a -> a -> a -> a -> a -> a -> a -> a -> a -> MonthMatch a #

Build a MonthMatch from twelve (12) values.

buildUnboxedMonthMatch :: Unbox a => a -> a -> a -> a -> a -> a -> a -> a -> a -> a -> a -> a -> UnboxedMonthMatch a #

Build an UnboxedMonthMatch from twelve (12) values.

caseMonth :: MonthMatch a -> Month -> a #

Match a Month against a MonthMatch.

Format

The formats provided is this module are language-agnostic. To find meridiem formats and month formats, look in a language-specific module.

w3c :: DatetimeFormat #

The W3C DatetimeFormat.

>>> encode_YmdHMS SubsecondPrecisionAuto w3c (timeToDatetime (timeFromYmdhms 2014 2 26 17 58 52))
"2014-02-26T17:58:52"
\(s :: SubsecondPrecision) (dt :: Datetime) -> isJust (decode_YmdHMS w3c (encode_YmdHMS s w3c dt))

slash :: DatetimeFormat #

A DatetimeFormat that separates the members of the Date by slashes.

>>> encode_YmdHMS SubsecondPrecisionAuto slash (timeToDatetime (timeFromYmdhms 2014 2 26 17 58 52))
"2014/02/26 17:58:52"
\(s :: SubsecondPrecision) (dt :: Datetime) -> isJust (decode_YmdHMS slash (encode_YmdHMS s slash dt))

hyphen :: DatetimeFormat #

A DatetimeFormat that separates the members of the Date by hyphens.

>>> encode_YmdHMS SubsecondPrecisionAuto hyphen (timeToDatetime (timeFromYmdhms 2014 2 26 17 58 52))
"2014-02-26 17:58:52"
\(s :: SubsecondPrecision) (dt :: Datetime) -> isJust (decode_YmdHMS hyphen (encode_YmdHMS s hyphen dt))

compact :: DatetimeFormat #

A DatetimeFormat with no separators, except for a T between the Date and Time.

>>> encode_YmdHMS SubsecondPrecisionAuto compact (timeToDatetime (timeFromYmdhms 2014 2 26 17 58 52))
"20140226T175852"
\(s :: SubsecondPrecision) (dt :: Datetime) -> isJust (decode_YmdHMS compact (encode_YmdHMS s compact dt))

Months

january :: Month #

The Month of January.

february :: Month #

The Month of February.

march :: Month #

The Month of March.

april :: Month #

The Month of April.

may :: Month #

The Month of May.

june :: Month #

The Month of June.

july :: Month #

The Month of July.

august :: Month #

The Month of August.

september :: Month #

The Month of September.

october :: Month #

The Month of October.

november :: Month #

The Month of November.

december :: Month #

The Month of December.

Days of Week

sunday :: DayOfWeek #

The DayOfWeek Sunday.

monday :: DayOfWeek #

The DayOfWeek Monday.

tuesday :: DayOfWeek #

The DayOfWeek Tuesday.

wednesday :: DayOfWeek #

The DayOfWeek Wednesday.

thursday :: DayOfWeek #

The DayOfWeek Thursday.

friday :: DayOfWeek #

The DayOfWeek Friday.

saturday :: DayOfWeek #

The DayOfWeek Saturday.

Utility

daysInMonth #

Arguments

:: Bool

Is this a leap year?

-> Month

Month of year

-> Int 

Return the number of days in a given month.

isLeapYear :: Year -> Bool #

Is the Year a leap year?

>>> isLeapYear (Year 1996)
True
>>> isLeapYear (Year 2019)
False

Textual Conversion

Date

Text

builder_Ymd :: Maybe Char -> Date -> Builder #

Given a Date and a separator, construct a Text Builder corresponding to Year/Month/Day encoding.

builder_Dmy :: Maybe Char -> Date -> Builder #

Given a Date and a separator, construct a Text Builder corresponding to a Day/Month/Year encoding.

builder_HMS :: SubsecondPrecision -> Maybe Char -> TimeOfDay -> Builder #

Given a SubsecondPrecision and a separator, construct a Text Builder corresponding to an Hour/Minute/Second encoding.

parser_Ymd :: Maybe Char -> Parser Date #

Parse a Year/Month/Day-encoded Date that uses the given separator.

parser_Mdy :: Maybe Char -> Parser Date #

Parse a Month/Day/Year-encoded Date that uses the given separator.

parser_Dmy :: Maybe Char -> Parser Date #

Parse a Day/Month/Year-encoded Date that uses the given separator.

UTF-8 ByteString

builderUtf8_Ymd :: Maybe Char -> Date -> Builder #

Given a Date and a separator, construct a ByteString Builder corresponding to a Day/Month/Year encoding.

parserUtf8_Ymd :: Maybe Char -> Parser Date #

Parse a Year/Month/Day-encoded Date that uses the given separator.

Time of Day

Text

builder_IMS_p :: MeridiemLocale Text -> SubsecondPrecision -> Maybe Char -> TimeOfDay -> Builder #

Given a MeridiemLocale, a SubsecondPrecision, and a separator, construct a Text Builder according to an IMS encoding.

This differs from builder_IMSp in that their is a space between the seconds and locale.

builder_IMSp :: MeridiemLocale Text -> SubsecondPrecision -> Maybe Char -> TimeOfDay -> Builder #

Given a MeridiemLocale, a SubsecondPrecision, and a separator, construct a Text Builder according to an IMS encoding.

parser_HMS :: Maybe Char -> Parser TimeOfDay #

Parse an Hour/Minute/Second-encoded TimeOfDay that uses the given separator.

parser_HMS_opt_S :: Maybe Char -> Parser TimeOfDay #

Parses text that is formatted as either of the following:

  • %H:%M
  • %H:%M:%S

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.

UTF-8 ByteString

builderUtf8_HMS :: SubsecondPrecision -> Maybe Char -> TimeOfDay -> Builder #

Given a SubsecondPrecision and a separator, construct a ByteString Builder corresponding to an Hour/Month/Second encoding of the given TimeOfDay.

builderUtf8_IMS_p :: MeridiemLocale ByteString -> SubsecondPrecision -> Maybe Char -> TimeOfDay -> Builder #

Given a MeridiemLocale, a SubsecondPrecision, and a separator, construct a ByteString Builder corresponding to an IMS encoding of the given TimeOfDay. This differs from builderUtf8_IMSp in that there is a space between the seconds and locale.

builderUtf8_IMSp :: MeridiemLocale ByteString -> SubsecondPrecision -> Maybe Char -> TimeOfDay -> Builder #

Given a MeridiemLocale, a SubsecondPrecision, and a separator, construct a ByteString Builder corresponding to an IMS encoding of the given TimeOfDay.

parserUtf8_HMS :: Maybe Char -> Parser TimeOfDay #

Parse an Hour/Minute/Second-encoded TimeOfDay that uses the given separator.

parserUtf8_HMS_opt_S :: Maybe Char -> Parser TimeOfDay #

Parses text that is formatted as either of the following:

  • %H:%M
  • %H:%M:%S

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.

zeptoUtf8_HMS :: Maybe Char -> Parser TimeOfDay #

Parse a TimeOfDay that was encoded using the given separator.

Datetime

Text

builder_DmyHMS :: SubsecondPrecision -> DatetimeFormat -> Datetime -> Builder #

Given a SubsecondPrecision and a DatetimeFormat, construct a Text Builder corresponding to a Day/Month/Year,Hour/Minute/Second encoding of the given Datetime.

builder_DmyIMSp :: MeridiemLocale Text -> SubsecondPrecision -> DatetimeFormat -> Datetime -> Builder #

Given a MeridiemLocale, a SubsecondPrecision, and a DatetimeFormat, construct a Text Builder corresponding to a Day/Month/Year,IMS encoding of the given Datetime.

builder_DmyIMS_p :: MeridiemLocale Text -> SubsecondPrecision -> DatetimeFormat -> Datetime -> Builder #

Given a MeridiemLocale, a SubsecondPrecision, and a DatetimeFormat, construct a Text Builder corresponding to a Day/Month/Year,IMS encoding of the given Datetime. This differs from builder_DmyIMSp in that it adds a space between the locale and seconds.

builder_YmdHMS :: SubsecondPrecision -> DatetimeFormat -> Datetime -> Builder #

Given a SubsecondPrecision and a DatetimeFormat, construct a Text Builder corresponding to a Year/Month/Day,Hour/Minute/Second encoding of the given Datetime.

builder_YmdIMSp :: MeridiemLocale Text -> SubsecondPrecision -> DatetimeFormat -> Datetime -> Builder #

Given a MeridiemLocale, a SubsecondPrecision, and a DatetimeFormat, construct a Text Builder that corresponds to a Year/Month/Day,IMS encoding of the given Datetime.

builder_YmdIMS_p :: MeridiemLocale Text -> SubsecondPrecision -> DatetimeFormat -> Datetime -> Builder #

Given a MeridiemLocale, a SubsecondPrecision, and a DatetimeFormat, construct a Text Builder that corresponds to a Year/Month/Day,IMS encoding of the given Datetime. This inserts a space between the locale and seconds.

builderW3C :: Datetime -> Builder #

Construct a Text Builder corresponding to the W3C encoding of the given Datetime.

encode_DmyHMS :: SubsecondPrecision -> DatetimeFormat -> Datetime -> Text #

Given a SubsecondPrecision and DatetimeFormat, construct Text that corresponds to a Day/Month/Year,Hour/Minute/Second encoding of the given Datetime.

encode_DmyIMS_p :: MeridiemLocale Text -> SubsecondPrecision -> DatetimeFormat -> Datetime -> Text #

Given a MeridiemLocale, a SubsecondPrecision, and a DatetimeFormat, construct Text that corresponds to a Day/Month/Year,IMS encoding of the given Datetime. This inserts a space between the locale and seconds.

encode_YmdHMS :: SubsecondPrecision -> DatetimeFormat -> Datetime -> Text #

Given a SubsecondPrecision and DatetimeFormat, construct Text that corresponds to a Year/Month/Day,Hour/Minute/Second encoding of the given Datetime.

encode_YmdIMS_p :: MeridiemLocale Text -> SubsecondPrecision -> DatetimeFormat -> Datetime -> Text #

Given a MeridiemLocale, a SubsecondPrecision, and a DatetimeFormat, construct Text that corresponds to a Year/Month/Day,IMS encoding of the given Datetime. This inserts a space between the locale and seconds.

parser_DmyHMS :: DatetimeFormat -> Parser Datetime #

Parse a Day/Month/Year,Hour/Minute/Second-encoded Datetime that was encoded with the given DatetimeFormat.

parser_YmdHMS :: DatetimeFormat -> Parser Datetime #

Parses a Year/Month/Day,Hour/Minute/Second-encoded Datetime that was encoded using the given DatetimeFormat.

parser_YmdHMS_opt_S :: DatetimeFormat -> Parser Datetime #

Parses text that is formatted as either of the following:

  • %H:%M
  • %H:%M:%S

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_DmyHMS_opt_S :: DatetimeFormat -> Parser Datetime #

Parses text that is formatted as either of the following:

  • %H:%M
  • %H:%M:%S

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.

decode_DmyHMS :: DatetimeFormat -> Text -> Maybe Datetime #

Decode a Day/Month/Year,Hour/Minute/Second-encoded Datetime from Text that was encoded with the given DatetimeFormat.

decode_YmdHMS :: DatetimeFormat -> Text -> Maybe Datetime #

Decode a Year/Month/Day,Hour/Minute/Second-encoded Datetime from Text that was encoded with the given DatetimeFormat.

decode_YmdHMS_opt_S :: DatetimeFormat -> Text -> Maybe Datetime #

Parses text that is formatted as either of the following:

  • %H:%M
  • %H:%M:%S

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.

decode_DmyHMS_opt_S :: DatetimeFormat -> Text -> Maybe Datetime #

Parses text that is formatted as either of the following:

  • %H:%M
  • %H:%M:%S

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.

UTF-8 ByteString

encodeUtf8_YmdHMS :: SubsecondPrecision -> DatetimeFormat -> Datetime -> ByteString #

Given a SubsecondPrecision and a DatetimeFormat, construct a ByteString corresponding to a Year/Month/Day,Hour/Minute/Second encoding of the given Datetime.

encodeUtf8_YmdIMS_p :: MeridiemLocale ByteString -> SubsecondPrecision -> DatetimeFormat -> Datetime -> ByteString #

Given a MeridiemLocale, a SubsecondPrecision, and a DatetimeFormat, construct a ByteString corresponding to a Year/Month/Day,IMS encoding of the given Datetime. This inserts a space between the locale and seconds.

builderUtf8_YmdHMS :: SubsecondPrecision -> DatetimeFormat -> Datetime -> Builder #

Given a SubsecondPrecision and a DatetimeFormat, construct a ByteString Builder corresponding to a Year/Month/Day,Hour/Minute/Second encoding of the given Datetime.

builderUtf8_YmdIMSp :: MeridiemLocale ByteString -> SubsecondPrecision -> DatetimeFormat -> Datetime -> Builder #

Given a SubsecondPrecision and a DatetimeFormat, construct a ByteString Builder corresponding to a Year/Month/Day,IMS encoding of the given Datetime.

builderUtf8_YmdIMS_p :: MeridiemLocale ByteString -> SubsecondPrecision -> DatetimeFormat -> Datetime -> Builder #

Given a SubsecondPrecision and a DatetimeFormat, construct a ByteString Builder corresponding to a Year/Month/Day,IMS encoding of the given Datetime. This inserts a space between the locale and seconds.

builderUtf8W3C :: Datetime -> Builder #

Construct a ByteString Builder corresponding to a W3C encoding of the given Datetime.

decodeUtf8_YmdHMS :: DatetimeFormat -> ByteString -> Maybe Datetime #

Decode a Year/Month/Day,Hour/Minute/Second-encoded Datetime from a ByteString.

decodeUtf8_YmdHMS_opt_S :: DatetimeFormat -> ByteString -> Maybe Datetime #

Parses text that is formatted as either of the following:

  • %H:%M
  • %H:%M:%S

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_YmdHMS :: DatetimeFormat -> Parser Datetime #

Parse a Year/Month/Day,Hour/Minute/Second-encoded Datetime that was encoded using the given DatetimeFormat.

parserUtf8_YmdHMS_opt_S :: DatetimeFormat -> Parser Datetime #

Parses text that is formatted as either of the following:

  • %H:%M
  • %H:%M:%S

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.

zeptoUtf8_YmdHMS :: DatetimeFormat -> Parser Datetime #

Parse a Datetime that was encoded using the given DatetimeFormat.

Offset Datetime

Text

encode_YmdHMSz :: OffsetFormat -> SubsecondPrecision -> DatetimeFormat -> OffsetDatetime -> Text #

Given an OffsetFormat, a SubsecondPrecision, and a DatetimeFormat, construct Text corresponding to the Year/Month/Day,Hour/Minute/Second-encoding of the given OffsetDatetime.

encode_DmyHMSz :: OffsetFormat -> SubsecondPrecision -> DatetimeFormat -> OffsetDatetime -> Text #

Given an OffsetFormat, a SubsecondPrecision, and a DatetimeFormat, construct Text corresponding to the Day/Month/Year,Hour/Minute/Second encoding of the given OffsetDatetime.

builder_YmdHMSz :: OffsetFormat -> SubsecondPrecision -> DatetimeFormat -> OffsetDatetime -> Builder #

Given an OffsetFormat, a SubsecondPrecision, and a DatetimeFormat, construct a Text Builder corresponding to a Year/Month/Day,Hour/Minute/Second encoding of the given OffsetDatetime.

builder_DmyHMSz :: OffsetFormat -> SubsecondPrecision -> DatetimeFormat -> OffsetDatetime -> Builder #

Given an OffsetFormat, a SubsecondPrecision, and a DatetimeFormat, construct a Text Builder corresponding to the Day/Month/Year,Hour/Minute/Second-encoding of the given OffsetDatetime.

parser_YmdHMSz :: OffsetFormat -> DatetimeFormat -> Parser OffsetDatetime #

Parse a Year/Month/Day,Hour/Minute/Second-encoded OffsetDatetime that was encoded using the given OffsetFormat and DatetimeFormat.

parser_DmyHMSz :: OffsetFormat -> DatetimeFormat -> Parser OffsetDatetime #

Parse a Day/Month/Year,Hour/Minute/Second-encoded OffsetDatetime that was encoded using the given OffsetFormat and DatetimeFormat.

builder_YmdIMS_p_z :: OffsetFormat -> MeridiemLocale Text -> SubsecondPrecision -> DatetimeFormat -> OffsetDatetime -> Builder #

Given an OffsetFormat, a MeridiemLocale, a SubsecondPrecision, and DatetimeFormat, construct a Text Builder corresponding to a Year/Month/Day,IMS-encoding of the given OffsetDatetime.

builder_DmyIMS_p_z :: OffsetFormat -> MeridiemLocale Text -> SubsecondPrecision -> DatetimeFormat -> OffsetDatetime -> Builder #

Given an OffsetFormat, a MeridiemLocale, a SubsecondPrecision, and a DatetimeFormat, construct a Text Builder corresponding to the Day/Month/Year,IMS encoding of the given OffsetDatetime.

builderW3Cz :: OffsetDatetime -> Builder #

Construct a Text Builder corresponding to the w3c-formatting of the given OffsetDatetime.

UTF-8 ByteString

builderUtf8_YmdHMSz :: OffsetFormat -> SubsecondPrecision -> DatetimeFormat -> OffsetDatetime -> Builder #

Given an OffsetFormat, a SubsecondPrecision, and a DatetimeFormat, construct a ByteString Builder corresponding to the Year/Month/Day,Hour/Minute/Second encoding of the given OffsetDatetime.

parserUtf8_YmdHMSz :: OffsetFormat -> DatetimeFormat -> Parser OffsetDatetime #

Parse a Year/Month/Day,Hour/Minute/Second-encoded OffsetDatetime that was encoded using the given OffsetFormat and DatetimeFormat.

builderUtf8_YmdIMS_p_z :: OffsetFormat -> MeridiemLocale ByteString -> SubsecondPrecision -> DatetimeFormat -> OffsetDatetime -> Builder #

Given an OffsetFormat, a 'MeridiemLocale, a SubsecondPrecision, and a DatetimeFormat, construct a ByteString Builder corresponding to a Year/Month/Day,IMS-encoded OffsetDatetime.

builderUtf8W3Cz :: OffsetDatetime -> Builder #

Construct a ByteString Builder corresponding to the W3C encoding of the given Datetime.

Offset

Text

encodeOffset :: OffsetFormat -> Offset -> Text #

Encode an Offset to Text using the given OffsetFormat.

builderOffset :: OffsetFormat -> Offset -> Builder #

Construct a Builder corresponding to the given Offset encoded using the given OffsetFormat.

decodeOffset :: OffsetFormat -> Text -> Maybe Offset #

Decode an Offset from Text that was encoded using the given OffsetFormat.

parserOffset :: OffsetFormat -> Parser Offset #

Parse an Offset that was encoded using the given OffsetFormat.

UTF-8 ByteString

encodeOffsetUtf8 :: OffsetFormat -> Offset -> ByteString #

Encode an Offset as a ByteString using the given OffsetFormat.

builderOffsetUtf8 :: OffsetFormat -> Offset -> Builder #

Construct a ByteString Builder corresponding to the encoding of an Offset using the given OffsetFormat.

decodeOffsetUtf8 :: OffsetFormat -> ByteString -> Maybe Offset #

Decode an Offset from a ByteString that was encoded using the given OffsetFormat.

parserOffsetUtf8 :: OffsetFormat -> Parser Offset #

Parse an Offset that was encoded using the given OffsetFormat.

Timespan

Text

encodeTimespan :: SubsecondPrecision -> Timespan -> Text #

Encode a Timespan as Text using the given SubsecondPrecision.

builderTimespan :: SubsecondPrecision -> Timespan -> Builder #

Construct a Text Builder corresponding to an encoding of the given Timespan using the given SubsecondPrecision.

UTF-8 ByteString

encodeTimespanUtf8 :: SubsecondPrecision -> Timespan -> ByteString #

Given a SubsecondPrecision, construct a ByteString corresponding to an encoding of the given Timespan.

builderTimespanUtf8 :: SubsecondPrecision -> Timespan -> Builder #

Given a SubsecondPrecision, construct a ByteString Builder corresponding to an encoding of the given Timespan.

TimeInterval

within :: Time -> TimeInterval -> Bool #

Is the given Time within the TimeInterval?

timeIntervalToTimespan :: TimeInterval -> Timespan #

Convert a TimeInterval to a Timespan. This is equivalent to width.

whole :: TimeInterval #

The TimeInterval that covers the entire range of Times that Chronos supports.

\(t :: Time) -> within t whole

singleton :: Time -> TimeInterval #

The singleton (degenerate) TimeInterval.

lowerBound :: TimeInterval -> Time #

Get the lower bound of the TimeInterval.

upperBound :: TimeInterval -> Time #

Get the upper bound of the TimeInterval.

width :: TimeInterval -> Timespan #

The width of the TimeInterval. This is equivalent to timeIntervalToTimespan.

timeIntervalBuilder :: Time -> Time -> TimeInterval #

A smart constructor for TimeInterval. In general, you should prefer using this over the TimeInterval constructor, since it maintains the invariant that lowerBound interval <= upperBound interval.

(...) :: Time -> Time -> TimeInterval infix 3 #

Types

newtype Day #

A day represented as the modified Julian date, the number of days since midnight on November 17, 1858.

Constructors

Day 

Fields

Instances
Enum Day # 
Instance details

Defined in Chronos

Methods

succ :: Day -> Day

pred :: Day -> Day

toEnum :: Int -> Day

fromEnum :: Day -> Int

enumFrom :: Day -> [Day]

enumFromThen :: Day -> Day -> [Day]

enumFromTo :: Day -> Day -> [Day]

enumFromThenTo :: Day -> Day -> Day -> [Day]

Eq Day # 
Instance details

Defined in Chronos

Methods

(==) :: Day -> Day -> Bool

(/=) :: Day -> Day -> Bool

Ord Day # 
Instance details

Defined in Chronos

Methods

compare :: Day -> Day -> Ordering

(<) :: Day -> Day -> Bool

(<=) :: Day -> Day -> Bool

(>) :: Day -> Day -> Bool

(>=) :: Day -> Day -> Bool

max :: Day -> Day -> Day

min :: Day -> Day -> Day

Read Day # 
Instance details

Defined in Chronos

Methods

readsPrec :: Int -> ReadS Day #

readList :: ReadS [Day] #

readPrec :: ReadPrec Day #

readListPrec :: ReadPrec [Day] #

Show Day # 
Instance details

Defined in Chronos

Methods

showsPrec :: Int -> Day -> ShowS

show :: Day -> String

showList :: [Day] -> ShowS

Hashable Day # 
Instance details

Defined in Chronos

Methods

hashWithSalt :: Int -> Day -> Int #

hash :: Day -> Int #

ToJSON Day # 
Instance details

Defined in Chronos

FromJSON Day # 
Instance details

Defined in Chronos

Storable Day # 
Instance details

Defined in Chronos

Methods

sizeOf :: Day -> Int

alignment :: Day -> Int

peekElemOff :: Ptr Day -> Int -> IO Day

pokeElemOff :: Ptr Day -> Int -> Day -> IO ()

peekByteOff :: Ptr b -> Int -> IO Day

pokeByteOff :: Ptr b -> Int -> Day -> IO ()

peek :: Ptr Day -> IO Day

poke :: Ptr Day -> Day -> IO ()

Prim Day # 
Instance details

Defined in Chronos

Methods

sizeOf# :: Day -> Int# #

alignment# :: Day -> Int# #

indexByteArray# :: ByteArray# -> Int# -> Day #

readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (#State# s, Day#) #

writeByteArray# :: MutableByteArray# s -> Int# -> Day -> State# s -> State# s #

setByteArray# :: MutableByteArray# s -> Int# -> Int# -> Day -> State# s -> State# s #

indexOffAddr# :: Addr# -> Int# -> Day #

readOffAddr# :: Addr# -> Int# -> State# s -> (#State# s, Day#) #

writeOffAddr# :: Addr# -> Int# -> Day -> State# s -> State# s #

setOffAddr# :: Addr# -> Int# -> Int# -> Day -> State# s -> State# s #

Torsor Day Int # 
Instance details

Defined in Chronos

Methods

add :: Int -> Day -> Day #

difference :: Day -> Day -> Int #

newtype DayOfWeek #

The day of the week.

Constructors

DayOfWeek 

Fields

Instances
Eq DayOfWeek # 
Instance details

Defined in Chronos

Methods

(==) :: DayOfWeek -> DayOfWeek -> Bool

(/=) :: DayOfWeek -> DayOfWeek -> Bool

Ord DayOfWeek # 
Instance details

Defined in Chronos

Methods

compare :: DayOfWeek -> DayOfWeek -> Ordering

(<) :: DayOfWeek -> DayOfWeek -> Bool

(<=) :: DayOfWeek -> DayOfWeek -> Bool

(>) :: DayOfWeek -> DayOfWeek -> Bool

(>=) :: DayOfWeek -> DayOfWeek -> Bool

max :: DayOfWeek -> DayOfWeek -> DayOfWeek

min :: DayOfWeek -> DayOfWeek -> DayOfWeek

Read DayOfWeek # 
Instance details

Defined in Chronos

Methods

readsPrec :: Int -> ReadS DayOfWeek #

readList :: ReadS [DayOfWeek] #

readPrec :: ReadPrec DayOfWeek #

readListPrec :: ReadPrec [DayOfWeek] #

Show DayOfWeek # 
Instance details

Defined in Chronos

Methods

showsPrec :: Int -> DayOfWeek -> ShowS

show :: DayOfWeek -> String

showList :: [DayOfWeek] -> ShowS

Hashable DayOfWeek # 
Instance details

Defined in Chronos

Methods

hashWithSalt :: Int -> DayOfWeek -> Int #

hash :: DayOfWeek -> Int #

newtype DayOfMonth #

The day of the month.

Constructors

DayOfMonth 

Fields

Instances
Enum DayOfMonth # 
Instance details

Defined in Chronos

Eq DayOfMonth # 
Instance details

Defined in Chronos

Methods

(==) :: DayOfMonth -> DayOfMonth -> Bool

(/=) :: DayOfMonth -> DayOfMonth -> Bool

Ord DayOfMonth # 
Instance details

Defined in Chronos

Read DayOfMonth # 
Instance details

Defined in Chronos

Show DayOfMonth # 
Instance details

Defined in Chronos

Methods

showsPrec :: Int -> DayOfMonth -> ShowS

show :: DayOfMonth -> String

showList :: [DayOfMonth] -> ShowS

Prim DayOfMonth # 
Instance details

Defined in Chronos

Methods

sizeOf# :: DayOfMonth -> Int# #

alignment# :: DayOfMonth -> Int# #

indexByteArray# :: ByteArray# -> Int# -> DayOfMonth #

readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (#State# s, DayOfMonth#) #

writeByteArray# :: MutableByteArray# s -> Int# -> DayOfMonth -> State# s -> State# s #

setByteArray# :: MutableByteArray# s -> Int# -> Int# -> DayOfMonth -> State# s -> State# s #

indexOffAddr# :: Addr# -> Int# -> DayOfMonth #

readOffAddr# :: Addr# -> Int# -> State# s -> (#State# s, DayOfMonth#) #

writeOffAddr# :: Addr# -> Int# -> DayOfMonth -> State# s -> State# s #

setOffAddr# :: Addr# -> Int# -> Int# -> DayOfMonth -> State# s -> State# s #

Unbox DayOfMonth # 
Instance details

Defined in Chronos

Vector Vector DayOfMonth # 
Instance details

Defined in Chronos

MVector MVector DayOfMonth # 
Instance details

Defined in Chronos

newtype Vector DayOfMonth # 
Instance details

Defined in Chronos

newtype MVector s DayOfMonth # 
Instance details

Defined in Chronos

newtype DayOfYear #

The day of the year.

Constructors

DayOfYear 

Fields

Instances
Eq DayOfYear # 
Instance details

Defined in Chronos

Methods

(==) :: DayOfYear -> DayOfYear -> Bool

(/=) :: DayOfYear -> DayOfYear -> Bool

Ord DayOfYear # 
Instance details

Defined in Chronos

Methods

compare :: DayOfYear -> DayOfYear -> Ordering

(<) :: DayOfYear -> DayOfYear -> Bool

(<=) :: DayOfYear -> DayOfYear -> Bool

(>) :: DayOfYear -> DayOfYear -> Bool

(>=) :: DayOfYear -> DayOfYear -> Bool

max :: DayOfYear -> DayOfYear -> DayOfYear

min :: DayOfYear -> DayOfYear -> DayOfYear

Read DayOfYear # 
Instance details

Defined in Chronos

Methods

readsPrec :: Int -> ReadS DayOfYear #

readList :: ReadS [DayOfYear] #

readPrec :: ReadPrec DayOfYear #

readListPrec :: ReadPrec [DayOfYear] #

Show DayOfYear # 
Instance details

Defined in Chronos

Methods

showsPrec :: Int -> DayOfYear -> ShowS

show :: DayOfYear -> String

showList :: [DayOfYear] -> ShowS

Prim DayOfYear # 
Instance details

Defined in Chronos

Methods

sizeOf# :: DayOfYear -> Int# #

alignment# :: DayOfYear -> Int# #

indexByteArray# :: ByteArray# -> Int# -> DayOfYear #

readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (#State# s, DayOfYear#) #

writeByteArray# :: MutableByteArray# s -> Int# -> DayOfYear -> State# s -> State# s #

setByteArray# :: MutableByteArray# s -> Int# -> Int# -> DayOfYear -> State# s -> State# s #

indexOffAddr# :: Addr# -> Int# -> DayOfYear #

readOffAddr# :: Addr# -> Int# -> State# s -> (#State# s, DayOfYear#) #

writeOffAddr# :: Addr# -> Int# -> DayOfYear -> State# s -> State# s #

setOffAddr# :: Addr# -> Int# -> Int# -> DayOfYear -> State# s -> State# s #

newtype Month #

The month of the year.

Constructors

Month 

Fields

Instances
Bounded Month #

Month starts at 0 and ends at 11 (January to December)

Instance details

Defined in Chronos

Enum Month # 
Instance details

Defined in Chronos

Eq Month # 
Instance details

Defined in Chronos

Methods

(==) :: Month -> Month -> Bool

(/=) :: Month -> Month -> Bool

Ord Month # 
Instance details

Defined in Chronos

Methods

compare :: Month -> Month -> Ordering

(<) :: Month -> Month -> Bool

(<=) :: Month -> Month -> Bool

(>) :: Month -> Month -> Bool

(>=) :: Month -> Month -> Bool

max :: Month -> Month -> Month

min :: Month -> Month -> Month

Read Month # 
Instance details

Defined in Chronos

Methods

readsPrec :: Int -> ReadS Month #

readList :: ReadS [Month] #

readPrec :: ReadPrec Month #

readListPrec :: ReadPrec [Month] #

Show Month # 
Instance details

Defined in Chronos

Methods

showsPrec :: Int -> Month -> ShowS

show :: Month -> String

showList :: [Month] -> ShowS

Prim Month # 
Instance details

Defined in Chronos

Methods

sizeOf# :: Month -> Int# #

alignment# :: Month -> Int# #

indexByteArray# :: ByteArray# -> Int# -> Month #

readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (#State# s, Month#) #

writeByteArray# :: MutableByteArray# s -> Int# -> Month -> State# s -> State# s #

setByteArray# :: MutableByteArray# s -> Int# -> Int# -> Month -> State# s -> State# s #

indexOffAddr# :: Addr# -> Int# -> Month #

readOffAddr# :: Addr# -> Int# -> State# s -> (#State# s, Month#) #

writeOffAddr# :: Addr# -> Int# -> Month -> State# s -> State# s #

setOffAddr# :: Addr# -> Int# -> Int# -> Month -> State# s -> State# s #

Unbox Month # 
Instance details

Defined in Chronos

Vector Vector Month # 
Instance details

Defined in Chronos

MVector MVector Month # 
Instance details

Defined in Chronos

newtype Vector Month # 
Instance details

Defined in Chronos

newtype MVector s Month # 
Instance details

Defined in Chronos

newtype Year #

The number of years elapsed since the beginning of the Common Era.

Constructors

Year 

Fields

Instances
Eq Year # 
Instance details

Defined in Chronos

Methods

(==) :: Year -> Year -> Bool

(/=) :: Year -> Year -> Bool

Ord Year # 
Instance details

Defined in Chronos

Methods

compare :: Year -> Year -> Ordering

(<) :: Year -> Year -> Bool

(<=) :: Year -> Year -> Bool

(>) :: Year -> Year -> Bool

(>=) :: Year -> Year -> Bool

max :: Year -> Year -> Year

min :: Year -> Year -> Year

Read Year # 
Instance details

Defined in Chronos

Methods

readsPrec :: Int -> ReadS Year #

readList :: ReadS [Year] #

readPrec :: ReadPrec Year #

readListPrec :: ReadPrec [Year] #

Show Year # 
Instance details

Defined in Chronos

Methods

showsPrec :: Int -> Year -> ShowS

show :: Year -> String

showList :: [Year] -> ShowS

newtype Offset #

Constructors

Offset 

Fields

Instances
Enum Offset # 
Instance details

Defined in Chronos

Eq Offset # 
Instance details

Defined in Chronos

Methods

(==) :: Offset -> Offset -> Bool

(/=) :: Offset -> Offset -> Bool

Ord Offset # 
Instance details

Defined in Chronos

Methods

compare :: Offset -> Offset -> Ordering

(<) :: Offset -> Offset -> Bool

(<=) :: Offset -> Offset -> Bool

(>) :: Offset -> Offset -> Bool

(>=) :: Offset -> Offset -> Bool

max :: Offset -> Offset -> Offset

min :: Offset -> Offset -> Offset

Read Offset # 
Instance details

Defined in Chronos

Methods

readsPrec :: Int -> ReadS Offset #

readList :: ReadS [Offset] #

readPrec :: ReadPrec Offset #

readListPrec :: ReadPrec [Offset] #

Show Offset # 
Instance details

Defined in Chronos

Methods

showsPrec :: Int -> Offset -> ShowS

show :: Offset -> String

showList :: [Offset] -> ShowS

ToJSON Offset # 
Instance details

Defined in Chronos

ToJSONKey Offset # 
Instance details

Defined in Chronos

FromJSON Offset # 
Instance details

Defined in Chronos

FromJSONKey Offset # 
Instance details

Defined in Chronos

Torsor Offset Int # 
Instance details

Defined in Chronos

Methods

add :: Int -> Offset -> Offset #

difference :: Offset -> Offset -> Int #

newtype Time #

POSIX time with nanosecond resolution.

Constructors

Time 

Fields

Instances
Bounded Time # 
Instance details

Defined in Chronos

Eq Time # 
Instance details

Defined in Chronos

Methods

(==) :: Time -> Time -> Bool

(/=) :: Time -> Time -> Bool

Ord Time # 
Instance details

Defined in Chronos

Methods

compare :: Time -> Time -> Ordering

(<) :: Time -> Time -> Bool

(<=) :: Time -> Time -> Bool

(>) :: Time -> Time -> Bool

(>=) :: Time -> Time -> Bool

max :: Time -> Time -> Time

min :: Time -> Time -> Time

Read Time # 
Instance details

Defined in Chronos

Methods

readsPrec :: Int -> ReadS Time #

readList :: ReadS [Time] #

readPrec :: ReadPrec Time #

readListPrec :: ReadPrec [Time] #

Show Time # 
Instance details

Defined in Chronos

Methods

showsPrec :: Int -> Time -> ShowS

show :: Time -> String

showList :: [Time] -> ShowS

Hashable Time # 
Instance details

Defined in Chronos

Methods

hashWithSalt :: Int -> Time -> Int #

hash :: Time -> Int #

ToJSON Time # 
Instance details

Defined in Chronos

FromJSON Time # 
Instance details

Defined in Chronos

Storable Time # 
Instance details

Defined in Chronos

Methods

sizeOf :: Time -> Int

alignment :: Time -> Int

peekElemOff :: Ptr Time -> Int -> IO Time

pokeElemOff :: Ptr Time -> Int -> Time -> IO ()

peekByteOff :: Ptr b -> Int -> IO Time

pokeByteOff :: Ptr b -> Int -> Time -> IO ()

peek :: Ptr Time -> IO Time

poke :: Ptr Time -> Time -> IO ()

Prim Time # 
Instance details

Defined in Chronos

Methods

sizeOf# :: Time -> Int# #

alignment# :: Time -> Int# #

indexByteArray# :: ByteArray# -> Int# -> Time #

readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (#State# s, Time#) #

writeByteArray# :: MutableByteArray# s -> Int# -> Time -> State# s -> State# s #

setByteArray# :: MutableByteArray# s -> Int# -> Int# -> Time -> State# s -> State# s #

indexOffAddr# :: Addr# -> Int# -> Time #

readOffAddr# :: Addr# -> Int# -> State# s -> (#State# s, Time#) #

writeOffAddr# :: Addr# -> Int# -> Time -> State# s -> State# s #

setOffAddr# :: Addr# -> Int# -> Int# -> Time -> State# s -> State# s #

Torsor Time Timespan # 
Instance details

Defined in Chronos

Methods

add :: Timespan -> Time -> Time #

difference :: Time -> Time -> Timespan #

newtype DayOfWeekMatch a #

Match a DayOfWeek. By match, we mean that a DayOfWeekMatch is a mapping from the integer value of a DayOfWeek to some value of type a. You should construct a DayOfWeekMatch with buildDayOfWeekMatch, and match it using caseDayOfWeek.

Constructors

DayOfWeekMatch 

newtype MonthMatch a #

Match a Month. By match, we mean that a MonthMatch is a mapping from the integer value of a Month to some value of type a. You should construct a MonthMatch with buildMonthMatch, and match it using caseMonth.

Constructors

MonthMatch 

Fields

newtype UnboxedMonthMatch a #

Like MonthMatch, but the matched value can have an instance of Unbox.

newtype Timespan #

A timespan. This is represented internally as a number of nanoseconds.

Constructors

Timespan 

Fields

Instances
Eq Timespan # 
Instance details

Defined in Chronos

Methods

(==) :: Timespan -> Timespan -> Bool

(/=) :: Timespan -> Timespan -> Bool

Ord Timespan # 
Instance details

Defined in Chronos

Methods

compare :: Timespan -> Timespan -> Ordering

(<) :: Timespan -> Timespan -> Bool

(<=) :: Timespan -> Timespan -> Bool

(>) :: Timespan -> Timespan -> Bool

(>=) :: Timespan -> Timespan -> Bool

max :: Timespan -> Timespan -> Timespan

min :: Timespan -> Timespan -> Timespan

Read Timespan # 
Instance details

Defined in Chronos

Methods

readsPrec :: Int -> ReadS Timespan #

readList :: ReadS [Timespan] #

readPrec :: ReadPrec Timespan #

readListPrec :: ReadPrec [Timespan] #

Show Timespan # 
Instance details

Defined in Chronos

Methods

showsPrec :: Int -> Timespan -> ShowS

show :: Timespan -> String

showList :: [Timespan] -> ShowS

Semigroup Timespan # 
Instance details

Defined in Chronos

Methods

(<>) :: Timespan -> Timespan -> Timespan #

sconcat :: NonEmpty Timespan -> Timespan #

stimes :: Integral b => b -> Timespan -> Timespan #

Monoid Timespan # 
Instance details

Defined in Chronos

ToJSON Timespan # 
Instance details

Defined in Chronos

FromJSON Timespan # 
Instance details

Defined in Chronos

Additive Timespan # 
Instance details

Defined in Chronos

Torsor Time Timespan # 
Instance details

Defined in Chronos

Methods

add :: Timespan -> Time -> Time #

difference :: Time -> Time -> Timespan #

Scaling Timespan Int64 # 
Instance details

Defined in Chronos

Methods

scale :: Int64 -> Timespan -> Timespan #

data SubsecondPrecision #

The precision used when encoding seconds to a human-readable format.

Constructors

SubsecondPrecisionAuto

Rounds to second, millisecond, microsecond, or nanosecond

SubsecondPrecisionFixed !Int

Specify number of places after decimal

data Date #

A date as represented by the Gregorian calendar.

Constructors

Date 
Instances
Enum Date # 
Instance details

Defined in Chronos

Methods

succ :: Date -> Date

pred :: Date -> Date

toEnum :: Int -> Date

fromEnum :: Date -> Int

enumFrom :: Date -> [Date]

enumFromThen :: Date -> Date -> [Date]

enumFromTo :: Date -> Date -> [Date]

enumFromThenTo :: Date -> Date -> Date -> [Date]

Eq Date # 
Instance details

Defined in Chronos

Methods

(==) :: Date -> Date -> Bool

(/=) :: Date -> Date -> Bool

Ord Date # 
Instance details

Defined in Chronos

Methods

compare :: Date -> Date -> Ordering

(<) :: Date -> Date -> Bool

(<=) :: Date -> Date -> Bool

(>) :: Date -> Date -> Bool

(>=) :: Date -> Date -> Bool

max :: Date -> Date -> Date

min :: Date -> Date -> Date

Read Date # 
Instance details

Defined in Chronos

Methods

readsPrec :: Int -> ReadS Date #

readList :: ReadS [Date] #

readPrec :: ReadPrec Date #

readListPrec :: ReadPrec [Date] #

Show Date # 
Instance details

Defined in Chronos

Methods

showsPrec :: Int -> Date -> ShowS

show :: Date -> String

showList :: [Date] -> ShowS

Torsor Date Int # 
Instance details

Defined in Chronos

Methods

add :: Int -> Date -> Date #

difference :: Date -> Date -> Int #

data OrdinalDate #

An OrdinalDate is a Year and the number of days elapsed since the Year began.

Instances
Enum OrdinalDate # 
Instance details

Defined in Chronos

Eq OrdinalDate # 
Instance details

Defined in Chronos

Methods

(==) :: OrdinalDate -> OrdinalDate -> Bool

(/=) :: OrdinalDate -> OrdinalDate -> Bool

Ord OrdinalDate # 
Instance details

Defined in Chronos

Read OrdinalDate # 
Instance details

Defined in Chronos

Show OrdinalDate # 
Instance details

Defined in Chronos

Methods

showsPrec :: Int -> OrdinalDate -> ShowS

show :: OrdinalDate -> String

showList :: [OrdinalDate] -> ShowS

Torsor OrdinalDate Int # 
Instance details

Defined in Chronos

data MonthDate #

A month and the day of the month. This does not actually represent a specific date, since this recurs every year.

Constructors

MonthDate 
Instances
Eq MonthDate # 
Instance details

Defined in Chronos

Methods

(==) :: MonthDate -> MonthDate -> Bool

(/=) :: MonthDate -> MonthDate -> Bool

Ord MonthDate # 
Instance details

Defined in Chronos

Methods

compare :: MonthDate -> MonthDate -> Ordering

(<) :: MonthDate -> MonthDate -> Bool

(<=) :: MonthDate -> MonthDate -> Bool

(>) :: MonthDate -> MonthDate -> Bool

(>=) :: MonthDate -> MonthDate -> Bool

max :: MonthDate -> MonthDate -> MonthDate

min :: MonthDate -> MonthDate -> MonthDate

Read MonthDate # 
Instance details

Defined in Chronos

Methods

readsPrec :: Int -> ReadS MonthDate #

readList :: ReadS [MonthDate] #

readPrec :: ReadPrec MonthDate #

readListPrec :: ReadPrec [MonthDate] #

Show MonthDate # 
Instance details

Defined in Chronos

Methods

showsPrec :: Int -> MonthDate -> ShowS

show :: MonthDate -> String

showList :: [MonthDate] -> ShowS

data Datetime #

A Date as represented by the Gregorian calendar and a TimeOfDay.

Constructors

Datetime 
Instances
Eq Datetime # 
Instance details

Defined in Chronos

Methods

(==) :: Datetime -> Datetime -> Bool

(/=) :: Datetime -> Datetime -> Bool

Ord Datetime # 
Instance details

Defined in Chronos

Methods

compare :: Datetime -> Datetime -> Ordering

(<) :: Datetime -> Datetime -> Bool

(<=) :: Datetime -> Datetime -> Bool

(>) :: Datetime -> Datetime -> Bool

(>=) :: Datetime -> Datetime -> Bool

max :: Datetime -> Datetime -> Datetime

min :: Datetime -> Datetime -> Datetime

Read Datetime # 
Instance details

Defined in Chronos

Methods

readsPrec :: Int -> ReadS Datetime #

readList :: ReadS [Datetime] #

readPrec :: ReadPrec Datetime #

readListPrec :: ReadPrec [Datetime] #

Show Datetime # 
Instance details

Defined in Chronos

Methods

showsPrec :: Int -> Datetime -> ShowS

show :: Datetime -> String

showList :: [Datetime] -> ShowS

ToJSON Datetime # 
Instance details

Defined in Chronos

data OffsetDatetime #

A Datetime with a time zone Offset.

Instances
Eq OffsetDatetime # 
Instance details

Defined in Chronos

Ord OffsetDatetime # 
Instance details

Defined in Chronos

Read OffsetDatetime # 
Instance details

Defined in Chronos

Show OffsetDatetime # 
Instance details

Defined in Chronos

Methods

showsPrec :: Int -> OffsetDatetime -> ShowS

show :: OffsetDatetime -> String

showList :: [OffsetDatetime] -> ShowS

data TimeOfDay #

A time of day with nanosecond resolution.

Constructors

TimeOfDay 

Fields

Instances
Eq TimeOfDay # 
Instance details

Defined in Chronos

Methods

(==) :: TimeOfDay -> TimeOfDay -> Bool

(/=) :: TimeOfDay -> TimeOfDay -> Bool

Ord TimeOfDay # 
Instance details

Defined in Chronos

Methods

compare :: TimeOfDay -> TimeOfDay -> Ordering

(<) :: TimeOfDay -> TimeOfDay -> Bool

(<=) :: TimeOfDay -> TimeOfDay -> Bool

(>) :: TimeOfDay -> TimeOfDay -> Bool

(>=) :: TimeOfDay -> TimeOfDay -> Bool

max :: TimeOfDay -> TimeOfDay -> TimeOfDay

min :: TimeOfDay -> TimeOfDay -> TimeOfDay

Read TimeOfDay # 
Instance details

Defined in Chronos

Methods

readsPrec :: Int -> ReadS TimeOfDay #

readList :: ReadS [TimeOfDay] #

readPrec :: ReadPrec TimeOfDay #

readListPrec :: ReadPrec [TimeOfDay] #

Show TimeOfDay # 
Instance details

Defined in Chronos

Methods

showsPrec :: Int -> TimeOfDay -> ShowS

show :: TimeOfDay -> String

showList :: [TimeOfDay] -> ShowS

data DatetimeFormat #

The format of a Datetime. In particular this provides separators for parts of the Datetime and nothing else.

Constructors

DatetimeFormat 

Fields

Instances
Eq DatetimeFormat # 
Instance details

Defined in Chronos

Ord DatetimeFormat # 
Instance details

Defined in Chronos

Read DatetimeFormat # 
Instance details

Defined in Chronos

Show DatetimeFormat # 
Instance details

Defined in Chronos

Methods

showsPrec :: Int -> DatetimeFormat -> ShowS

show :: DatetimeFormat -> String

showList :: [DatetimeFormat] -> ShowS

data OffsetFormat #

Formatting settings for a timezone offset.

Constructors

OffsetFormatColonOff

%z (e.g., -0400)

OffsetFormatColonOn

%:z (e.g., -04:00)

OffsetFormatSecondsPrecision

%::z (e.g., -04:00:00)

OffsetFormatColonAuto

%:::z (e.g., -04, +05:30)

Instances
Bounded OffsetFormat # 
Instance details

Defined in Chronos

Enum OffsetFormat # 
Instance details

Defined in Chronos

Eq OffsetFormat # 
Instance details

Defined in Chronos

Methods

(==) :: OffsetFormat -> OffsetFormat -> Bool

(/=) :: OffsetFormat -> OffsetFormat -> Bool

Ord OffsetFormat # 
Instance details

Defined in Chronos

Read OffsetFormat # 
Instance details

Defined in Chronos

Show OffsetFormat # 
Instance details

Defined in Chronos

Methods

showsPrec :: Int -> OffsetFormat -> ShowS

show :: OffsetFormat -> String

showList :: [OffsetFormat] -> ShowS

Generic OffsetFormat # 
Instance details

Defined in Chronos

Associated Types

type Rep OffsetFormat :: Type -> Type

type Rep OffsetFormat # 
Instance details

Defined in Chronos

type Rep OffsetFormat = D1 (MetaData "OffsetFormat" "Chronos" "chronos-1.0.7-BhVazY2rKvdBfduunCFQXE" False) ((C1 (MetaCons "OffsetFormatColonOff" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "OffsetFormatColonOn" PrefixI False) (U1 :: Type -> Type)) :+: (C1 (MetaCons "OffsetFormatSecondsPrecision" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "OffsetFormatColonAuto" PrefixI False) (U1 :: Type -> Type)))

data DatetimeLocale a #

Locale-specific formatting for weekdays and months. The type variable will likely be instantiated to Text or ByteString.

Constructors

DatetimeLocale 

Fields

data MeridiemLocale a #

Locale-specific formatting for AM and PM.

Constructors

MeridiemLocale 

Fields

Instances
Eq a => Eq (MeridiemLocale a) # 
Instance details

Defined in Chronos

Methods

(==) :: MeridiemLocale a -> MeridiemLocale a -> Bool

(/=) :: MeridiemLocale a -> MeridiemLocale a -> Bool

Ord a => Ord (MeridiemLocale a) # 
Instance details

Defined in Chronos

Read a => Read (MeridiemLocale a) # 
Instance details

Defined in Chronos

Show a => Show (MeridiemLocale a) # 
Instance details

Defined in Chronos

Methods

showsPrec :: Int -> MeridiemLocale a -> ShowS

show :: MeridiemLocale a -> String

showList :: [MeridiemLocale a] -> ShowS

data TimeInterval #

A TimeInterval represents a start and end time. It can sometimes be more ergonomic than the Torsor API when you only care about whether or not a Time is within a certain range.

To construct a TimeInterval, it is best to use timeIntervalBuilder, which maintains the invariant that lowerBound interval <= upperBound interval (all functions that act on TimeIntervals assume this invariant).

Constructors

TimeInterval !Time !Time 
Instances
Bounded TimeInterval # 
Instance details

Defined in Chronos

Eq TimeInterval # 
Instance details

Defined in Chronos

Methods

(==) :: TimeInterval -> TimeInterval -> Bool

(/=) :: TimeInterval -> TimeInterval -> Bool

Ord TimeInterval # 
Instance details

Defined in Chronos

Read TimeInterval # 
Instance details

Defined in Chronos

Show TimeInterval # 
Instance details

Defined in Chronos

Methods

showsPrec :: Int -> TimeInterval -> ShowS

show :: TimeInterval -> String

showList :: [TimeInterval] -> ShowS