Time
Dates and times. Each type has a module of its own, imported under the
type's name: import Time.Date as Date (Date) gives Date.new and the bare
type, and likewise Time.DateTime, Time.Instant, Time.Duration,
Time.Period and the rest. This module is what they share.
What the date and time types have in common, as classes, so that one
function serves every type that supports it and a type that does not is a
missing instance where it is used: hour of a Date, or shift of an
instant, fails to type-check.
Each class has the fewest methods its instances must write, and everything else is written once below in terms of them. The instances live here rather than beside each type so that the types' modules need not import the classes, which keeps the module graph a tree.
Timeout is how a function that waits takes its limit: one function with
[Timeout t], which a caller gives a Duration or a Deadline, rather
than a pair of one taking a Duration and an ...Until taking a
Deadline. A wait without a limit is a function of its own, named for it.
Has a calendar date.
Has a wall-clock time.
Moves by calendar amounts, keeping its wall-clock time.
A point on the global timeline, which moves by elapsed time.
A limit on how long something may wait: a Duration, which starts when the
wait is asked for, or a Deadline made earlier, so that one limit covers
several steps. A function that waits takes [Timeout t], and a caller
passes seconds(10) or the deadline it already has.
There is deliberately no instance for Option. With one, a None read
from configuration would make a wait unbounded without the code saying so,
and some waits hold a thread for as long as they last (a lookup in
getaddrinfo does). A wait without a limit is a function of its own,
named for it (Net.lookupUnbounded), so that the caller who wants one
writes it, in the arm of a match on the Option if it comes from there.
The time from from to to, negative if to is earlier. The two need not
be the same type: only their instants matter.