APITime

Time

Gregorian dates, zoned moments, exact durations, and calendar periods. Import the individual Time modules, normally with aliases such as import Time.Date as Date. Values are immutable; calendar arithmetic never consults a system clock. Zone conversion and formatting are total; the few fallible operations use Fail Error, and each one’s comment names the constructors it can raise.

Error

type Error    = InvalidComponent String    | InvalidText String    | OutOfRange    | Ambiguous    | NonexistentSource

A checked time operation could not produce a value.

Constructors

Ambiguous

Ambiguous : ErrorSource

A local clock reading occurs twice and the policy rejects it.

InvalidComponent

InvalidComponent : String -> ErrorSource

A component given to a constructor is outside its range; the text names it.

InvalidText

InvalidText : String -> ErrorSource

Text does not match the documented ISO grammar or denotes an unrepresentable moment.

OutOfRange

OutOfRange : ErrorSource

The result leaves the supported calendar: dates in years 1 through 9999, moments from 0001-01-02T00:00:00Z through 9999-12-30T23:59:59Z.

Nonexistent

Nonexistent : ErrorSource

A local clock reading does not occur: a gap under the Reject policy, or a calendar date with no instants at all under any policy.

Instances:

Eq Error
Show Error

Resolution

type Resolution    = Compatible    | Earlier    | Later    | RejectSource

How a local clock reading is resolved across an offset transition.

Constructors

Compatible

Compatible : ResolutionSource

Earlier in an overlap; forward by the gap for a skipped reading.

Earlier

Earlier : ResolutionSource

The earlier instant, moving backward by the gap for a skipped reading.

Later

Later : ResolutionSource

The later instant, moving forward by the gap for a skipped reading.

Reject

Reject : ResolutionSource

Fail for either an overlap or a skipped reading.

Instances:

Eq Resolution
Show Resolution

Weekday

type Weekday    = Monday    | Tuesday    | Wednesday    | Thursday    | Friday    | Saturday    | SundaySource

ISO weekdays, ordered Monday through Sunday.

Constructors

Friday

Friday : WeekdaySource

ISO weekday 5.

Monday

Monday : WeekdaySource

ISO weekday 1.

Tuesday

Tuesday : WeekdaySource

ISO weekday 2.

Wednesday

Wednesday : WeekdaySource

ISO weekday 3.

Thursday

Thursday : WeekdaySource

ISO weekday 4.

Saturday

Saturday : WeekdaySource

ISO weekday 6.

Sunday

Sunday : WeekdaySource

ISO weekday 7.

Instances:

Eq Weekday
Ord Weekday
Show Weekday