Skip to content

std/core

module core

The types every other module is written in: the scalars, the collection types, the open tree Data, absence, failure, value order, the format category and the core traits. A type sits here when a module below it would otherwise import a module above it: Data is a tree of sequences and maps, so the collection types are core types, and the operations over them are the collections module's.

  • Orderable — A type whose values have a total order: of any two values of the type, one comes first or the two are equal.
  • Scalar — A leaf: a value with no parts of its own.
  • Bool — The truth values true and false: a Scalar with equality and no order.
  • Int — A 64-bit whole number, ordered by value: 7 / 2 is 3, and 7 % 2 is 1.
  • Float — A 64-bit binary floating-point number, written with the suffix f (2.5f), ordered by value.
  • Decimal — An exact decimal number, written with a decimal point and no suffix (2.50), ordered by value: 0.1 + 0.2 == 0.3 is true.
  • String — Text, ordered character by character: "ab" + "cd" is "abcd", and "hello"[1] is "e".
  • Date — A proleptic Gregorian calendar date, ordered by time: Date("2026-10-24").
  • DateTime — A date and a time of day with no zone or offset, ordered by time: DateTime("2026-10-24T09:30:00").
  • Instant — A point on the UTC timeline with nanosecond precision, ordered by time: Instant("2026-10-24T07:30:00Z").
  • Duration — A signed length of time in nanoseconds, ordered by length: Duration("PT1H30M").
  • Bytes — A finite sequence of octets, ordered octet by octet as unsigned numbers, a shorter prefix first (HQL-0053 part 1).
  • Iterable — A value whose elements can each be visited: the bound an operation states when it only visits each value.
  • Collection — A finite multiset of occurrences, unordered, with no runtime representation.
  • Stream — An ordered, possibly unending run of values x0, x1, x2, ....
  • Seq — A finite stream: a collection in which every occurrence has exactly one position in 0 .. size(c) - 1.
  • List — A sequence of materialized occurrences; repeated traversal preserves positions.
  • Set — Materialized distinct values under HQL equality: count(s, x) <= 1.
  • Map — Materialized associations from distinct keys of K to values of V; not a Collection.
  • OrderedMap — A Map whose keys keep their construction positions: its keys are a Seq<K>.
  • SortedMap — An OrderedMap whose key positions follow the intrinsic total order of K.
  • Data — An open tree whose keys belong to whoever wrote them: what a YAML or JSON document is.
  • TypeContract — The supertype of a closed contract: a structural type declared type C : TypeContract = {…} has exactly its declared fields, and is validated as a contract.
  • DataContract — The supertype of an open contract: a structural type declared type D : DataContract = {…} is a view over Data with at least its declared fields, and is validated as a contract.
  • Option — An optional value of T: present, holding one T, or absent.
  • Result — A computation that may have failed: ok(value) with a T, or err(error) with an E.
  • Ordering — The result of compare(a, b): Less, Equal or Greater.
  • Window — One row's place in its ordered partition under over: the rows with its key, in the order over gives them, and its position among them.
  • Type — A type written as an argument: is(Card), of_type(Card).
  • Format — The category of formats: how bytes are documents.
  • Is — What a predicate that tests its parameter's type, x => x | is(U), gives: a Bool that, where true, holds the parameter at U.
  • Eq — Equality: a == b and a != b over a type implementing Eq call its eq.
  • Ord — Order: a < b and the other comparisons over a type implementing Ord call its compare.
  • Add — Addition: a + b over a type implementing Add is a.add(b).
  • Sub — Subtraction: a - b over a type implementing Sub is a.sub(b).
  • Mul — Multiplication: a * b over a type implementing Mul is a.mul(b).
  • Div — Division: a / b over a type implementing Div is a.div(b).
  • Rem — Remainder: a % b over a type implementing Rem is a.rem(b).
  • Range — A window of positions, what a slice takes: xs[a:b] is xs[Range(start = a, end = b)], and a bound left out is absent.
  • Index — A position: xs[i] over a type implementing Index is xs.at(i), the element there or its absence.
  • Slice — A part: xs[a:b] over a type implementing Slice is xs.slice(Range(start = a, end = b)), a value of the type itself.
  • Validator — A check a value passes: a trait extending Validator is a validator trait.
  • Operation — A function from I to O that also carries its shape: what an executor may assume about splitting the step.
  • Elementwise — An Operation whose result for each element depends on that element alone, so it may run over any split of its input: map and filter are elementwise.
  • Partition — An Operation that regroups its input by a key, each group running independently and completing in any order: group is one.
  • Reduction — An Operation that collapses its whole input to one value through a combiner the runtime holds, so each split may be reduced and the results combined: size combines by addition, contains by disjunction.
  • Barrier — An Operation that needs its whole input before any output, so it is not split: sort, take and reduce are barriers.
  • Pair — Two values held together, each at its own type: what zip, enumerate, entries and join produce, and what Pair(first = a, second = b) builds.
  • Violation — One reason a value does not read as a contract, as validate(T) reports it.
  • Invalid — A value that did not read as a contract, and every reason why: its contract, the value, and the violations.
  • Diagnostic — A diagnostic a run delivered, read back as data: its phase, kind, severity and disposition, its message, and where it points, origin and span, a {start, end} byte range.

Implementations

impl Eq for Bool
impl Eq for Int
impl Eq for Float
impl Eq for Decimal
impl Eq for String
impl Eq for Date
impl Eq for DateTime
impl Eq for Instant
impl Eq for Duration
impl Eq for Bytes

Bool, Int, Float, Decimal, String, the time scalars and Bytes compare with == by value.

impl Ord for Int
impl Ord for Float
impl Ord for Decimal
impl Ord for String
impl Ord for Date
impl Ord for DateTime
impl Ord for Instant
impl Ord for Duration
impl Ord for Bytes

Int, Float and Decimal are ordered by value, String character by character, Date, DateTime and Instant by time, and Duration by length, and Bytes octet by octet, a shorter prefix first.

impl Add for Int
impl Add for Float
impl Add for Decimal
impl Add for String
impl Add for Duration
impl Add for Bytes

+ adds Ints, Floats, Decimals and Durations, and concatenates two Strings or two Bytes: "ab" + "cd" is "abcd".

impl Sub for Int
impl Sub for Float
impl Sub for Decimal
impl Sub for Duration

- subtracts Ints, Floats, Decimals and Durations.

impl Mul for Int
impl Mul for Float
impl Mul for Decimal

* multiplies Ints, Floats and Decimals.

impl Div for Int
impl Div for Float
impl Div for Decimal

/ divides Ints, Floats and Decimals: 7 / 2 is 3.

impl Rem for Int
impl Rem for Float
impl Rem for Decimal

% is the remainder of Ints, Floats and Decimals: 7 % 2 is 1.

impl Index<Data> for Data

xs[i] over Data is the document's own element at i.

impl Slice for Data

xs[a:b] over Data is the part of the document's sequence, as Data.