ExactInterval

ExactInterval :: # (opaque)

Exact appointments, native profile exact-offset-interval-v1. Both endpoints are complete OffsetTimestamp declarations, separated by one slash. The start is inclusive and the end exclusive, with start strictly before end after resolving each supplied offset. Canonical text retains endpoint declarations, including fractional width and asserted versus unasserted offsets.

RFC 3339 does not specify interval syntax: this composition is a native contract, not an ISO/EDTF conformance claim. Bare dates, durations, abbreviated or missing endpoints and annotations are unsupported by this exact profile. Date-only EDTF endpoints mean something different and are never inferred here.

Parsing accepts at most 513 UTF-8 bytes (two 256-byte timestamp limits plus a separator). All construction, conversion and output work is bounded. Span projection discards source presentation explicitly; declaration equality retains it. Uncertain endpoints and original source spelling are not retained. Use canonical text for interchange. See OffsetTimestamp for endpoint limits.

parser_for : encoding -> (state -> Try({ value : ExactInterval, rest : state }, [InvalidExactInterval(Error), Encoding(err), ..]))
    where [
        encoding.parse_str : encoding, state -> Try({ value : Str, rest : state }, err),
    ]

Decode one encoded string using this type's text parser. Encoding failures remain distinct from this profile's validation errors. The encoding owns framing and its work limits; parse bounds the decoded text.

encoder_for : encoding -> (ExactInterval, state -> Try(state, err))
    where [
        encoding.encode_str : Str, state -> Try(state, err),
    ]

Encodes the canonical standard text as a string in the selected encoding; encoding failures pass through.

from_quote : Str -> Try(ExactInterval, [BadQuotedBytes(Str)])

Typed quoted literals use the same checked profile at compile time. Runtime interpolation remains Str followed by an explicit parse call.

profile : Str

Identifier of the supported text profile described above; it does not imply support for the entire standard.

new : OffsetTimestamp, OffsetTimestamp -> Try(ExactInterval, Error)

Constructs a nonempty half-open interval from two timestamp declarations. Rejects equal/reversed resolved boundaries and endpoint range failures.

parse : Str -> Try(ExactInterval, Error)

Parses two complete offset timestamps separated by one slash. Endpoint errors identify Start or End; this is not a general ISO interval parser.

endpoints : ExactInterval -> { start : OffsetTimestamp, end : OffsetTimestamp }

Returns the retained start/end declarations, including their fractional widths and offset assertions.

span : ExactInterval -> PosixSpan

Returns the resolved half-open POSIX extent. This projection discards endpoint presentation and offset-assertion distinctions.

to_text : ExactInterval -> Str

Serializes both retained endpoint declarations, separated by a slash; preserves fractional width and offset intent.

from_span : PosixSpan, Offset, U8 -> Try(ExactInterval, Error)

Explicit offset and exact fractional width for computed coverage output. Precision loss fails; output never silently rounds a boundary.

is_eq : ExactInterval, ExactInterval -> Bool

Compares endpoint declarations as well as their extent. Compare spans when only occupied time matters.

to_hash : ExactInterval, Hasher -> Hasher

Hashes the same declaration fields used by is_eq, so equal values are interchangeable as dictionary keys.

fact_count : ExactInterval -> U64

Stored extent plus original endpoint declarations, without re-resolution.

fact_at : ExactInterval, U64 -> [End, Item(SemanticFact)]

Returns the zero-based semantic fact, or End when the index is outside fact_count. Facts describe meaning, not a serialized record.

to_inspect : ExactInterval -> Str

A concise semantic summary for debugging. Use the standard text encoder for storage or interchange.

Error : [Malformed, Incomplete, TooLarge, Start(Error), End(Error), EmptySpan, ReversedBounds]

Separates endpoint timestamp errors from malformed interval syntax and empty or reversed resolved bounds.