EdtfInterval

EdtfInterval :: # (opaque)

EDTF date intervals with independently described endpoints. Known dates use EdtfDate's Gregorian 0000..9999 year/month/day profile and scoped qualifiers. An empty side means Unknown; '..' means explicitly Open. Both sides may be unknown or open, including '/' and '../..'. These are useful descriptions, not materialized coverage. Equal or overlapping date domains remain valid.

The LOC examples 1964/2008 and 2004-02-01/2005-02 describe when endpoints occurred within the supplied calendar units. They do not assert exact year starts or half-open timestamp appointments. No source spelling, numerical tolerance, timezone or general uncertainty solver is implied. This is a declared subset, not full EDTF Level 0, 1 or 2 conformance. Parsing visits at most 129 UTF-8 bytes; each known side retains EdtfDate's 64-byte limit. Partial known dates retain side-specific Incomplete errors.

parser_for : encoding -> (state -> Try({ value : EdtfInterval, rest : state }, [InvalidEdtfInterval(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 -> (EdtfInterval, 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(EdtfInterval, [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

The exact date-only interval profile supported by this adapter.

new : Endpoint, Endpoint -> Try(EdtfInterval, Error)

Construct through the shared native validator and date adapter. Known descriptions keep their independent resolutions and qualifications.

from_description : CalendarInterval -> Try(EdtfInterval, Error)

Check whether a native interval can be saved without losing meaning.

description : EdtfInterval -> CalendarInterval

Return the shared validated description. No calendar interpretation occurs.

parse : Str -> Try(EdtfInterval, Error)

Parse one slash with known, unknown or explicitly open sides.

to_text : EdtfInterval -> Str

Canonical EDTF text preserves knowledge, resolution and qualifier scopes.

is_eq : EdtfInterval, EdtfInterval -> Bool

Description equality; not extent equality between exact appointments.

to_hash : EdtfInterval, Hasher -> Hasher

Hash the declaration consistently with description equality.

fact_count : EdtfInterval -> U64

Number of bounded native facts, without interpretation.

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

Read the same endpoint knowledge and date facts as the native description.

to_inspect : EdtfInterval -> Str

Concise diagnostic summary. Use to_text for persistence.

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

Interval syntax and provable order errors, or an identified endpoint's existing date-profile validation failure.