Jadpo is experimental and not ready for production. These docs follow the compiler's main branch as of 1 Nov 2026. What's built · Install 0.2.0
jadpo
Reference: Standard library

Standard types

Range

On this page

The values of one ordered type from start up to but not including end, either of them none for an open end, written 2026-10-01/... T is the type in < >: Range<Grams>.

Maths and data; not ordered; since Jadpo 0.1.0.

Make one

Build one from its fields, Range<CalendarDate> { start: ... end: ... }.

text.parse(raw, as: Range<CalendarDate>) reads one from its text; text that isn't one at all fails malformed, such as 2026-10-01, 2026-11-01/2026-10-01 or 2026-10-01/tomorrow.

This operation gives one: range.intersection.

Its parts keep these rules; a value that breaks one fails with the rule's name:

  • start_not_after_end: start <= end

Fields

Field Type
start T?
end T?

Text, JSON and storage

text.from writes its canonical text, the one form text.parse reads back. JSON sends an object of its parts.

Text JSON
2026-10-01/2026-11-01 {"start":"2026-10-01","end":"2026-11-01"}
2026-10-01/.. {"start":"2026-10-01","end":null}
../2026-11-01 {"start":null,"end":"2026-11-01"}
../.. {"start":null,"end":null}

It is stored in one column named for the field, of type daterange. ../2026-11-01 is stored as daterange(NULL::date, '2026-11-01'::date, '[)').

Shown to people

text.format(value, locale:) shows it to people in their locale.

With locale: Locale.en_gb and format: TimeFormat.date_medium:

Value Shown
2026-10-01/2026-11-01 1 Oct 2026 – 1 Nov 2026
2026-10-01/.. 1 Oct 2026 – …
../2026-11-01 … – 1 Nov 2026
../.. … – …

Operations

  • range.contains(range: Range<T>, value: T) -> Bool: Whether value is inside range.
  • range.intersection(a: Range<T>, b: Range<T>) -> Range<T>?: The part a and b share; none when they don't overlap.
  • range.overlaps(a: Range<T>, b: Range<T>) -> Bool: Whether a and b share at least one value.

Like every standard type, it also has the contract's own operations: text.parse, text.from, text.format, json.read, json.write and ==. It isn't ordered, so < and sorting don't take it. Every standard type meets one contract says how they work.

Markdown for agents: /docs/types/type-range.md.Built from Jadpo main at e00e61f.