Skip to content

Releases

v0.8.0

Choose a tag to compare

@github-actions github-actions released this 25 Nov 00:57
678a9dd

HQL starts child processes
(HQL-0064), is a script language
(HQL-0062), and reads a vault and its
documents as HyperMarkDown 0.1.0 states them.

Breaking

Each of these is stated in full under Changed.

  • A .hmd/config.toml that sets wiki is refused. Rename the key to
    location_path.
  • A plain hql fence is a code listing. Mark a cell hql#eval, or
    hql#query for a cell that writes no output.
  • An option of hql written after the program is the program's
    argument.
    Write it before the program: hql --to json '<program>'.
  • A result that is err(e) exits 1. Handle the err, with match or
    unwrap_or, where it is not a failure.
  • Path.join keeps an absolute segment. base.join("/tmp") is /tmp.
    Pass a relative segment to stay under base.

Added

  • A program may open with a #! line. A source whose first two bytes
    are #! skips its first line, so an executable file that starts with
    #!/usr/bin/env hql runs as ./todo.hql. The line still counts as line
    1 in diagnostics. #! anywhere else is a syntax error.
  • hql FILE runs a file. A first free word that ends in .hql, or
    contains / and names a regular file, is hql run FILE. Any other word
    is a program, as before, so hql '10 / 2' and hql birds still
    evaluate. A command name wins over a file of that name.
  • hql -c '<program>' is hql eval '<program>', as -c is in Python
    and Bash.
  • hql with no program runs standard input when it is not a terminal,
    echo '1 + 1' | hql, and opens the REPL when it is.
  • Positional arguments, io.env.argv(). The words after a program
    file or an inline program are the program's own, in order, as a
    Seq<String>: ./todo.hql reading gives ["reading"]. They are always
    granted. The program's own path is not among them.
  • examples/scripts/: todo.hql and lsx.hql, executable scripts. The
    book's I/O chapter has a page on scripts, with how their relative paths
    differ from Python, Node and Bash, and a page on child processes.
  • Child processes (HQL-0064).
    command(program, args) of io.process names a program and starts
    nothing. source and tap start it and read its standard output,
    target and sink write its standard input, and run waits for it and
    gives ok(Output) or err(CommandFailure) with a reason: not-found,
    not-permitted, exited, signalled, timed-out or invalid-text.
    target and sink stop with closed when the child stops reading. No
    shell reads the command line.
  • A child runs in a process group of its own on Unix and in a Job Object
    on Windows. When it is terminated, at its timeout_ms or when a stream
    of its output is not read to its end, the processes it started end with
    it. SIGINT, SIGTERM or SIGHUP to hql ends its children first,
    and then hql by the same signal.
  • A project's .hql/config.toml lists the programs a run may start with
    commands = [...], and [command_output] invalid_utf8 = "replace" turns
    a child's text that is not UTF-8 into U+FFFD; it fails by default. A
    child inherits the variables the env grant gives the program.
  • The crate hql-sys holds the operating-system calls that need unsafe.
    hql depends on it and it is published with hql.
  • A diagnostic carries its causes. causes holds the failures below
    the one message states, nearest first, and the text report writes each
    as = caused by:. A child's failure gives the last lines of its standard
    error as its cause, and an HTTP request that does not connect gives the
    errors of the connection: connection failed, caused by Connect error,
    caused by Connection refused.

Changed

  • A vault's cards start where location_path says, the name HyperMarkDown
    0.1 gives the setting wiki had. It defaults to ., the vault root, where
    wiki defaulted to doc/wiki. A .hmd/config.toml that still sets wiki
    is refused with a message naming location_path, and the vault is not read
    until the key is renamed. The message for a missing cards location names
    location_path.
  • A result that is err(e) exits 1. It is still written on standard
    output. Only the result itself is tested: [ok(1), err("x")] exits 0.
    ./check.hql && ./publish.hql now stops on a failed check.
  • Every word after the program is the program's. An option of hql
    written after the program is now one of the program's arguments, so it
    moves before the program: hql --to json 'source(stdin, Json)', not
    hql 'source(stdin, Json)' --to json.
  • Path.join keeps an absolute segment. base.join(segment) is
    segment when segment has a root (/, C:/ or a share), so
    fs.working_dir().join(p) names the folder a user typed, relative or
    absolute. It was base//segment.
  • A collection of strings presented as text is one string per line.
    hql --to text -c '["a", "b"]' writes a and b on two lines, and an
    empty collection writes nothing. format(Text) writes the same.
    --to hql, the default, still writes the literal.
  • hql with no word and standard input not a terminal no longer prints the
    help and exits 2.
  • A plain hql fence is a code listing. In a document only a fence
    marked hql#eval or hql#query is a cell. hql render and hql check
    leave a plain ```hql fence as written: it does not run and gets no
    output, and an id= on it names nothing. A document whose cells are
    fenced plain hql marks them hql#eval instead.
  • hql#query is hql#eval hidden. A query cell runs so that other
    cells can read its value, and writes no output in any --emit mode.

Fixed

  • A package built against other dependency layouts is rebuilt. An
    installed build records the sizes of the types it exchanges with hql.
    A build of a [packages] paths crate whose sizes differ from this
    hql's is stale and is built again on first use, where it failed to
    load until hql package rebuild.

v0.7.2

Choose a tag to compare

@github-actions github-actions released this 22 Nov 04:41

Added

  • A Windows binary. The release carries hql.exe for
    x86_64-pc-windows-msvc, in a .tar.gz like the other targets, and every
    change is built and tested on Windows beside Linux and macOS.
  • The crate builds for a browser
    (HQL-0061). Everything that needs a
    socket, a process, a dynamic library or a terminal is behind one default
    cargo feature, native: the server endpoints, HTTP, package loading and
    the command line. Without it the crate is the language, its standard
    modules and SQLite, and builds for wasm32-unknown-unknown.
    cargo install hql and a plain cargo build are unchanged.
  • Without native, a program that names a server endpoint still checks, and
    a read or a write on it fails saying the build has no such endpoint.
  • hql::playground runs a program for a page: its source in, and what
    hql eval or hql check would print out, with a vault held in memory.
  • The website has a Playground page, and a Run button on each program of
    its front page. They run hql in the browser.

Fixed

  • On Windows, a path a program reads is written with /. A card's path
    was joined with \, so
    cards | filter(c => c.path | starts_with("books/")) kept no card.
    fs.source_dir(), fs.working_dir() and vault.root are read the same
    way, C:/Users/ada/notes, so name, parent, stem and extension find
    their segments. A path a message names is still written as the host
    writes it (HQL-0063).
  • A drive root and a share are roots of a Path, on every host:
    Path("C:/Users").parent() is some(Path("C:/")) where it was
    some(Path("C:")), and the parent of C:/ and of //server/share is
    none.

v0.7.1

Choose a tag to compare

@github-actions github-actions released this 16 Nov 00:28

Changed

  • One import mechanism for every module
    (HQL-0060). import m binds the
    module's name only: its functions are called m.f(x) and x | m.f, its
    receivers x.f(), and its types' constructors by their type's name. A
    program that called a non-prelude module's function bare after import m,
    import stats then mean(xs), no longer checks
    ; the error names both
    fixes, stats.mean(…) and from stats import mean. The same rules hold for
    a standard module, a package's and a project module.
  • The prelude is an ordinary list of import statements, import m and
    from m import * for each of its modules. core and collections are in
    it like the rest, so prelude = false withholds them too.
  • An entry of [modules] import and --import is an import statement: a
    module's name is import m, and an entry may be a whole from statement.
  • The guide on the site is the HQL book, under book/ in place of learn/,
    with its worked examples in examples/reading-club.

Added

  • from m import … binds names unqualified: from stats import mean, median, *, as for another name, and except to leave names out,
    from stats import * except (variance, stdev).
  • Type selectors select receivers by the type of their self:
    from club.titles import String.*, String.initials, and a group renamed
    by a pattern, String.* as String.club_*. The match is exact, with no
    supertype or subtype. An alias is the same function under another name.
  • The check error kind invalid-import, for an alias that changes a
    receiver's type and a group renamed without a pattern.

v0.7.0

Choose a tag to compare

@github-actions github-actions released this 15 Nov 14:53
6c49183

Changed

  • A vault's cards start where its wiki says
    (issue 0079).
    HQL reads a vault through HyperMarkdown's hypermarkdown crate: the cards
    are the documents below the namespace root, wiki in .hmd/config.toml
    against the vault root, and a card's path and file_of are relative to it.
    wiki defaults to doc/wiki, as HyperMarkdown defines it, so a vault
    that keeps its cards at its root must say wiki = "."
    ; a vault whose
    cards location does not exist fails to load, naming the setting. A
    directory a host names that holds no .hmd/ is still read whole.

  • A reference resolves as HyperMarkdown resolves it, through its
    resolver: a [[name]] in a card from that card (by path, named import, the
    card's folder and each above it, imported folders, then the whole vault),
    and @[[name]] in a program from the namespace root. A name two cards
    share no longer resolves by its stem rule: the nearer card wins, and a
    search that finds two chooses neither and warns. owl.hmd beside owl.md:
    [[owl]] is the .hmd card, and the other is named owl.md.

  • --vault names the vault root, the directory holding .hmd/. A
    directory inside a vault that holds no .hmd/ is refused, naming the vault
    root above it.

  • Projects and vaults are separate
    (HQL-0059). A project is a
    directory holding .hql/config.toml, which takes every key hql.toml
    took; hql.toml is no longer read. A vault is a directory holding
    .hmd/. Each is found by its own walk up from the program's source
    directory, and the HQL home is never a project. --project replaces
    --workspace, --vault names only the vault, and the named context key
    workspace is project. [extensions] import and prelude are
    [modules] import and prelude, and --import <module> is the
    command-line layer of [modules] import. A configuration file that
    states a key its layer does not take fails every run.

  • HyperMarkdown is the builtin package hmd, beside std. hmd.vault
    holds the vault, and hmd.search with hmd.search.lexical and
    hmd.search.semantic replaces the search package and its modules
    lexical and semantic. A run that has a vault, found at or above the
    program or named with --vault, or that imports hmd, by import hmd,
    --import hmd or [modules] import, gets hmd's prelude, the bindings
    vault, cards and graph, document references @[[..]] and vault
    endpoints; a run with no vault and no import of hmd has none of them. hql render imports hmd into
    every cell, and reads a vault's [hql] project from its
    .hmd/config.toml.

  • The semantic index and its [semantics] table live in the vault's
    .hmd/, not the project's configuration. The index producer is no
    longer contrib/semantics in this repository: it is HyperMarkdown's
    hmd-semantics,
    and the command a refusal names is hmd-semantics build.

  • A package is active per run. An import of one of its modules in the
    program or in a project module the program reaches activates it for
    every unit of the run, hmd included. A project module starts with the
    imports the program starts with: std's prelude, each active package's
    prelude, and [modules] import with --import.

  • In the crate's API, hql::environment::RunEnvironment is what a program
    is checked and run against: the project's configuration and an optional
    hql::vault::Vault, which holds a vault's cards and nothing of a
    project. check_in, run, run_on, plan and stream take it,
    hql::environment::load reads a directory as a host does, and
    EvalCx::environment() replaces EvalCx::vault().

  • A relative path resolves against the source directory of the unit naming
    it, a project module's own directory included, never the working
    directory.

Added

  • fs.source_dir() and fs.working_dir() in io.fs: the source directory
    of the calling unit, and the directory hql was started in.

  • Packages (HQL-0057, issue 0078). A
    package is a Cargo crate named hql-ext-<name> whose library is an
    extension: the Rust functions behind the declarations of the modules it
    provides. hql package install <name> builds one the registry of
    hql-extensions lists, and
    install --path <dir> one on this machine, with cargo against the
    running hql, and installs it into the project's .hql/packages/<name>/,
    or with --home into ~/.hql/packages/<name>/, declaring it by name in
    that level's config.toml and pinning it in its lock.toml;
    hql package install with no name installs every declared package at its
    pin. list, info, search, update, rebuild, remove and
    registry manage what is installed and what the registry offers, and
    hql doctor and hql builtins report it. A run finds packages in
    [packages] paths, then the project, then the HQL home, and refuses a
    declared package that is not installed. [packages] paths in
    .hql/config.toml names the crate of a package under development, built
    on first use. A program reaches a package's module with import, as it
    reaches a standard one, and [modules] import names a package too.

  • A package's prelude: prelude.hql at its module root, a list of imports
    every unit of a run imports while the package is active. A prelude that
    is no import list, or that imports a module that does not exist, refuses
    the package.

  • hql::ext, the API a package's crate implements an extension against,
    with hql::extension! and hql::native!. A library is loaded through
    the symbol hql_extension_v1 and held to the hql version, the
    compiler and the type sizes it was built with; one that differs is
    refused with run `hql package rebuild <name>` .

  • The book's Part V, Extending HQL:
    functions and declarations, packages and extensions, writing an
    extension, how a library is loaded, installing packages, the registry
    and publishing, and the ml package.

  • parse_date, parse_datetime and parse_instant take no pattern as
    well: "1982-05-09".parse_date() reads the ISO text that to_date
    reads, and the same for DateTime and Instant
    (HQL-0041 part 1, issue 0076).

  • [extensions] import in hql.toml names a builtin package as well as a
    module: import = ["search"] imports every module the package provides.

Changed

  • hql is built with one exact compiler, pinned in rust-toolchain.toml,
    and records it: a package is built with the compiler of the hql that
    installs it.
  • The binary registers one extension per builtin package, std and
    search, each a descriptor with id, abi and provides, in place of
    one entry per Rust source module
    (HQL-0057, issue 0049). Visibility is
    the module's: the diagnostic for a step whose module is not imported now
    reads `mean` is declared in the module `stats`: write `import stats`,
    and an ambiguous call names the modules declaring it, so the population
    variance beside stats.variance is qualified collections.variance,
    not core.variance. hql builtins groups steps by module and names the
    package beside it, collections (std 0.7.0, always available).
  • A vault no longer holds the documents of a vault nested inside it: a
    folder below the root that carries its own .hmd/ or hql.toml is
    another vault, and cards leaves it out, the way discovery stops at the
    nearest marker (issue 0077).
  • hql reference writes each reference page as a hyper-markdown card,
    name.hmd, and a module's page as its folder note, index.hmd. A doc
    string's citation is kept as the wikilink it is written as (issue 0077).
  • The documentation is hyper-markdown throughout: the book, the reference,
    the proposals, the issues and the design notes are .hmd cards, and the
    site is built from them with unchanged URLs (issue 0077).

v0.6.0

Choose a tag to compare

@github-actions github-actions released this 13 Nov 14:43
41a4d0f

Added

  • The book's Part II, Data flows:
    one shop's story from files to a lakehouse, in endpoints, tables and
    topics, subjects and the lakehouse, APIs and stores (as design), OLTP (the
    shop's day, mistakes, replays, streams against tables, a transfer as one
    transaction) and OLAP (bronze, silver and gold, grain and keys,
    deduplication, windows, merge, incremental loads), with a page on logical
    steps and physical plans. Checked programs are shown with what
    hql check prints; the programs that reach a server run in hql-demo.
  • Randomness (HQL-0041 part 4). The
    module random, imported with import random, declares sample,
    shuffle and choice over a sequence, sample over a stream by
    reservoir, random_int, random_float, a version 7 uuid() and a
    version 5 uuid(name, namespace). A draw with a seed argument is pure;
    without one it is effectful and draws from the evaluation seed, which
    --seed fixes. The generator is ChaCha12 and is not for secrets. The book
    teaches it in Random values.
  • abs over a Duration (HQL-0041
    part 1): the prelude's math declares fn abs(self: Duration) : Duration
    beside the numbers, so abs(Duration("-PT1H")) is PT1H with no
    import time.
  • Entry.modified? : Instant in io.fs
    (HQL-0040): the time an entry was
    last modified, a link's own and not its target's, absent where the
    platform records none. Every listing and entry read it with the rest
    of the entry.
  • hql --version names the time-zone database zone names resolve against
    on a second line, time-zone database: system for the host's, or the
    release of the database compiled into the binary, 2026e, bundled.
  • Descriptive statistics (HQL-0041
    part 2). The module stats, imported with import stats, declares the
    reductions mean, variance and stdev (sample, n - 1), pvariance
    and pstdev (population, n), and covariance and correlation over
    Pairs, and the barriers median, quantile(q), quantiles(n) and
    mode. A statistic of Int or Float values is a Float, of Decimal
    values a Decimal; an Int or Decimal statistic is computed exactly
    and rounded once, a Decimal root to 100 significant digits. An
    undefined statistic is none: the mean of nothing, the sample variance
    of one value, the correlation of a constant side. quantile is linear
    interpolation (type 7) and takes a Float or a Decimal q;
    quantiles is Python's inclusive method; mode gives the least of the
    most frequent values. With stats imported, variance over Ints or
    Floats is ambiguous with the prelude's population variance and is
    written stats.variance.
  • Environment variables and invocation arguments
    (HQL-0041 part 5). The module
    io.env, imported with import io.env and reached as env, declares the
    effectful var, vars, arg and args. A program run on its own reads
    every variable; env = ["NAME", "PREFIX_*"] in a workspace's hql.toml
    narrows that, and hql render reads none. An unset, a withheld and a
    non-UTF-8 variable all read as none. --arg name=value, repeatable,
    passes an argument, always granted; a name outside [a-z_][a-z0-9_]* or
    given twice is a usage error, exit 2, before evaluation.
  • The file system as data (HQL-0040).
    io declares Path, a place in a file system written as text and
    ordered by its segments, with join, parent, name, stem and
    extension, which read the text alone; file(p) takes a Path. The
    module io.fs, imported with import io.fs, declares Folder, Glob
    and Entry (path, name, kind, size?), and the effectful
    entries, walk, glob, exists and entry. A listing is a held
    Seq<Entry> in the order of the sorted walk the vault reads its cards in,
    reports a link without following it, is granted where reading a file is,
    and is bounded by [execution] max_elements. Path, Folder, Glob and
    Entry are built-in type names, so a program declares its own record
    under another name.
  • Traits (HQL-0039): trait Shape as Figure declares Figure, the union of the types implementing Shape,
    which holds a value of any of them, matches member by member, dispatches
    f.area() on the value's own type and satisfies T : Shape. A receiver
    module lists the traits its type implements, module shapes.circle for Circle : Shape, and its own self functions are the implementation;
    string and seq state Index and Slice this way, so string.at(s, 1), seq.at(xs, 1) and seq.slice(xs, r) are calls. A trait written as a
    type is refused, naming the bound <T : Shape>(x: T). A trait extending
    Validator is called a validator trait.
  • Execution contexts (HQL-0025): a
    program's file anchors workspace discovery, which stops at the nearest
    directory holding .hmd/ (a vault) or hql.toml. --workspace names the
    workspace, --bare runs with none, and hql context reports the mode,
    the workspace, the configuration files and the module roots with their
    layers. The system file (/etc/hql/config.toml, $HQL_SYSTEM_CONFIG), the
    user file ~/.hql/config.toml ($HQL_HOME), ~/.hql/modules/ and
    $HQL_PATH contribute module roots, extension settings, report settings
    and the backend in every mode. Named contexts, [context.<name>], are
    selected by --context, $HQL_CONTEXT or current-context, and
    hql config current-context, get-contexts, use-context and view
    manage them.
  • Transactions and relational mutations, phase 1
    (HQL-0051): four capabilities of a
    transport in io, Transactional, Insertable, Updatable and
    Deletable, each an abstract type below Transport and independent of
    the others, which Sqlite and Postgres declare; IsolationLevel with
    ReadCommitted, RepeatableRead and Serializable; and
    configured("id"), the endpoint configured under an id as a value of its
    kind's transport type, with its boundary, so source(configured("id"))
    reads what source("id") reads and target(xs, configured("id")) writes
    what target(xs, "id") writes.
  • Transactions and relational mutations, phase 2
    (HQL-0051): insert E rows,
    update E | filter(p) | set(f) and delete E | filter(p) change the
    rows of an Insertable, Updatable or Deletable endpoint in place,
    each as one statement of the endpoint's system, committed when it ends,
    with its value the number of rows changed. A clause's lambda is
    translated, never run row by row: a field of the row, a literal, a value
    bound outside, comparisons, and, or, not, arithmetic, contains
    of a bound collection and is_none or is_some of a field; anything
    else is a check error. The rows' type is the endpoint's configured
    element, or what of_type(T), written first, names; set gives the
    fields that change as a tree, each key a field of the rows. sqlite and
    postgres tables take all three. A table that does not exist is not
    created.
  • one in seq: the one element of a sequence of exactly one, and an
    evaluation failure naming the count otherwise.
  • Transactions and relational mutations, phases 3 and 4
    (HQL-0051): with transaction(attempts = 3, isolation = Serializable) tx on {accounts, transfers} { … } runs its block as one atomic unit over Transactional
    endpoints of one database, sqlite or postgres, and commits when the
    block ends. Inside the block every read and write of a participant runs on
    the attempt's connection, so a read sees the attempt's own writes. The
    scope's value is Result<T, TransactionFailure>, T the block's final
    value. The handle's control calls, in io.transaction, end an attempt:
    tx.commit(value), tx.rollback(reason) and tx.retry(), each of type
    Never, written as a statement or an arm of a given … otherwise or a
    match. A conflict with a concurrent transaction is retried while
    attempts remain; a constraint violation, a rollback and an exhausted
    retry are the err of the result; any other failure rolls the attempt
    back before it is reported. The checker refuses a nested scope, a
    participant set spanning two kinds or two databases, a computed set, a
    transactional endpoint in the block that is no participant, the handle
    outside a control call, a statement after one, and an isolation level
    the kind does not offer.
  • Two transaction warnings (HQL-0051),
    both of kind effect. A scope written as a statement before a program's
    last one, its Result neither bound nor the program's result, is warned:
    its failure would be observed by nothing. Under attempts written as a
    number above 1, each target, sink or log call in the block whose
    endpoint is no participant is warned, naming the endpoint: it runs on
    every attempt and is not rolled back.
  • The module io.db.spark (HQL-0047,
    HQL-0048): the transport Spark : {Network, RowTransport, Replayable, Writable, …} and its constructor
    spark(table = …, url = …, url_env = …, token_env = …, order = []),
    every parameter named, so source, tap and target reach a lakehouse
    table with no configured endpoint. A spark table takes insert,
    update and delete, each one Spark SQL statement, and a transaction
    scope over it holds that one table and at most one statement that
    changes it, since a Delta table comm...
Read more

v0.5.2

Choose a tag to compare

@github-actions github-actions released this 25 Oct 21:24

Changed

  • The error model (HQL-0045, shown in the
    error-handling examples): a failure is
    data or it is a diagnostic. A diagnostic names its phase (load,
    parse, check, plan, execute, render), its kind, a stable
    kebab-case name, its severity and its disposition (warning,
    recoverable, fatal), each set by the phase that wrote it; the severity
    is no longer derived from a stage. A contract read x | T that fails is
    an execute error[contract-violation] carrying the Violations
    validate would give; a data failure found while executing is of the
    execute phase, where it was stamped type. A Data value of the
    wrong shape, name read from a string, is an
    execute error[shape-mismatch].
  • The text form of a diagnostic is headed by its phase, severity and kind,
    check error[type-mismatch]: …, where it named a stage,
    type error: …. A nearest name moves out of the message onto a
    = help: line, a second place in the source onto a = note: line, and
    an element a step failed on onto = element:. A count of several reads
    3 diagnostics: …, where it read 3 reports: ….
  • --envelope json carries the run's diagnostics under diagnostics, where
    it carried reports; each has phase and kind in place of stage.
  • In hql repl each line typed is its own origin, <repl:N>, counted in
    what was typed: the second line's diagnostic points at <repl:2>:1, where
    it pointed into the replayed session.
  • The library API: Outcome.reports: Reports is
    Outcome.diagnostics: Vec<Diagnostic>, the channel's contents in order;
    Diagnostic is one record, and Report, Reports and Warning are
    removed.

Added

  • One diagnostic channel per run, opened before the vault loads and closed
    after the last phase: every phase writes into it, in order, and a fatal
    diagnostic leaves what was written before it intact. The program holds no
    name for it. A host may tap it; a tap does not keep the run open.
  • The loader writes load warning[skipped-document] for a document it does
    not load, a header that does not parse among them, and reads the rest; a
    warning does not change the exit status.
  • --diagnostics-format json writes each diagnostic to standard error as
    one JSON document per line, every field that applies present.
  • Under --report collect, map steps past an element whose function
    failed and writes the diagnostic as recoverable; the value stands
    without the element and the exit status is still 1. An overflow or an
    I/O failure stops under both modes.
  • A naming-convention warning gives the conventional spelling as help:
    write it `total_of` .
  • Diagnostic is a record of the standard library: diagnostics a run
    delivered with --diagnostics-format json read back in a later run with
    source(file(p), JsonLines) | Diagnostic.
  • DiagnosticText is a format a program names: | format(DiagnosticText)
    writes Diagnostic records as the report a run prints, and --to diagnostictext names it.
  • A failure inside called functions carries a call frame for each call
    that reached it, outermost first, and the bindings of the function or
    lambda it failed in; one over a card's value names the card's document as
    its source. The text form shows them as = trace:, = bindings: and
    = source: lines.
  • Under --report collect, filter and flat_map step past a failing
    element as map does, each naming itself as the step.
  • A cell's diagnostics in hql render name the cell as their origin,
    path#id or path#index, with a = cell: line in the text form.
  • A document renders only in a vault. hql render finds a document's vault
    from the document, not the working directory, so it renders from
    anywhere; a document in no vault is load failure[missing-vault], runs no
    cell and exits 1. A program outside any document still runs without a
    vault.
  • --vault names a vault: a directory holding neither .hmd/ nor
    hql.toml is refused, where it was read as one.

Fixed

  • A card's path is its place in the vault, authors/frank-herbert.hmd,
    as lib/std/doc declares it. It was the vault root joined with it, so the
    same card's path depended on the working directory and on how the vault
    was named. A diagnostic's source and a skipped document's origin name the
    same path.
  • Chapter 18 of the book, Errors:
    failures kept as data, diagnostics and the run's channel, strict and
    collect.

v0.5.1

Choose a tag to compare

@github-actions github-actions released this 25 Oct 15:04

Fixed

  • The documentation site and the crate are published for this version;
    0.5.0 was released on GitHub only, with neither.

v0.5.0

Choose a tag to compare

@github-actions github-actions released this 25 Oct 14:39

Changed

  • A Decimal's significand is bounded at 512 bits and its scale at 154
    digits (HQL-0031). A literal outside the
    bounds is a syntax error, to_decimal gives none, and arithmetic or
    round past them is a numeric overflow, where before a large exponent or
    place count exhausted memory.

Fixed

  • zip of a stream with a list, in either order, is a Seq traversed one
    position at a time; it failed with "needs a collection".
  • Data number leaves compare transitively: an integer and a float leaf of
    one value are equal, as each already was to a decimal leaf.

Added

  • Doc strings (HQL-0042, shown in the
    doc-string sessions): a block of ///
    lines opened after an empty line documents the declarations below it, up
    to the next empty line. A doc block anywhere else, one with no declaration
    directly below it, or a binding or expression in a documented paragraph is
    a syntax error. Every exported declaration of the standard library carries
    one, and its citations of published pages, [[/learn/…]], are checked.

  • hql help <name> and :help <name> in hql repl print each declaration
    of a function, type, trait or module, with its module and its doc string;
    a citation prints as its page's URL under the binary's version. A name
    nothing declares names the nearest one, and hql help exits 1.

  • :type <function> in hql repl prints each declaration of the function,
    the standard library's or the session's own, with its module and the
    first sentence of its doc string.

  • hql builtins describes each step with the first sentence of its doc
    string; the Rust descriptions it printed before are gone.

  • The site gains a page for every function, type, trait and module of the
    standard library under reference/, written from the doc strings by
    hql reference when a release is cut
    (HQL-0043). Each release's site is
    published under /vX.Y.Z/, and /latest/ is the newest.

  • + on two strings is concatenation: String implements Add, so
    "- [ ] " + title and reduce("", +) over strings type-check. Both
    operands are strings; "a" + 1 is still a type error.

  • hql repl leaves on the bare words exit and quit, as it does on
    :quit and Ctrl-D; they were unbound names.

  • A value block as a function body (HQL-0038;
    issue 0051, shown in the
    function examples): { … } written without
    = is bindings followed by a final expression, which is the function's
    value and has its declared result type. Any fn takes one, a trait's
    default body and an impl function included. A block containing yield
    stays an iterating block; a block that yields and ends in an expression,
    one that only binds, and for in a value block are refused.

  • Decimal, an exact decimal number (HQL-0031;
    issue 0042, shown in the
    decimal examples): a number written with a
    decimal point, 12.50 or 1.5e-3, is an arbitrary-precision Decimal
    whose scale is kept for display and whose equality and order are by value;
    a Float is written with the suffix f, 0.5f, 6.02e23f or 2f.
    +, - and * are exact, / is exact where the quotient terminates and
    otherwise rounded half to even to 100 significant digits, and
    round(x, places) rounds half to even. Decimal is Scalar and
    Orderable, and min, max, sum, product, average, abs and
    sign take it. An Int beside a Decimal widens to one; a Float beside
    one is a type error naming decimal(x) and float(d). decimal, float,
    int and s.to_decimal() convert. A JSON or YAML number or a CSV cell
    read as a Decimal keeps its digits, and a Decimal is written to JSON
    and YAML as a number with its scale, and to CSV and text as its digits.
    A program that passes a literal with a decimal point to a Float
    parameter, or mixes one with a Float, now writes the suffix f.

  • Contract rules and defaults (HQL-0032;
    issue 0043, shown in the
    structural examples): a TypeContract or
    DataContract body takes require P and validate f with V beside its
    fields, and name: T = literal defaults. In a rule f? reads an optional
    field, applying the rule only where it is present, or tests its presence
    as a condition, and => is implication. x | T and a decoded stream
    check every rule, and a value that breaks some is an evaluation error
    naming each as written. A contract's constructor, T(…), fills its
    defaults and checks its rules too. warn P is a rule whose violation
    leaves the value valid, and as name names a rule, reported as
    Contract.name. A default may be a list, set or Data literal of
    literals, never a call.

  • Errors as values (HQL-0033, shown in
    the structural examples):
    x | validate(T) reads a Data, a collection or a stream as T and
    gives a Result<T, Invalid> for each value instead of stopping. An
    Invalid holds the value and every Violation of it, each with its
    contract, path, kind (missing, undeclared, type or rule), rule
    identity, the rule as written and a message; a value that breaks only
    warnings is ok. oks() and errs() keep the successes and the
    failures of a collection of results. A missing or type violation
    fills expected with the type the field was read as, and a type or
    undeclared one fills actual with the tree the field holds;
    Violation.severity defaults to "error", so | Invalid reads a stored
    Invalid back. x | T and x | validate(T) derive their violations from
    one reading, so the fail-fast diagnostic says each error's message.
    oks() and errs() take a Stream of results to a Stream, one value
    at a time, as they take a List, Seq or Set to its own kind.

  • fork, broadcast fan-out (HQL-0037,
    shown in the dataflow examples):
    xs | fork { a = …, b = … } gives every branch the same input, evaluated
    once, and its value is the record of the branches' results, typed
    {a: A, b: B}. { a, b } = xs | fork { … } binds the branches, and
    over a Stream each branch is a stream in the upstream's order.
    A producer bound once is evaluated once: a tap of a file is read once
    and replayed for every later traversal, as standard input and sockets
    were, and a pure branch of a bound fork that nothing reads is not run.
    fork { accepted = oks(), rejected = errs() } gives both sides of a
    List, Seq or Stream of results. Rejected values written with
    errs() | sink(…) read back with | Invalid, null for an absent
    expected or actual, and repair from e.value.
    xs | retry(operation, attempts = n, when = …) reinvokes a fallible
    operation for each value while it fails, up to attempts invocations,
    the last failure standing; over a stream it is a stream. HQL-0033 is
    accepted, and HQL-0032's validation result and stream-routing sections
    are marked superseded by it.

  • Fan-in over streams (HQL-0037):
    a | merge(b) interleaves two streams, one value from each in turn,
    a | zip(b) pairs them by position, and a | concat(b) produces one and
    then the other. merge keeps its map form; over a List, Seq, Set
    or Table it is a type error naming concat or union, and f = merge
    with no expected function type is an ambiguous reference.
    hql plan names each step's topology, fan-out or fan-in, and lists a
    fork's or tee's branches beneath it.

  • Validator types (HQL-0034, shown in
    the structural examples): a trait may
    extend others, trait Email : Validator { }, and has their functions as
    its own. A trait extending the core trait Validator is a validator type.
    validate f with V holds where V's validate of the field is true, and
    is a type error where the field's type does not implement V; a field
    declared f: V is of the type implementing V and is held to it,
    reported as the violation Contract.f. import validators gives the
    standard validator types, Email and NonEmpty, the first module of
    the standard library written in HQL rather than declared for an
    extension; a validator implemented for several types is named in a rule.

  • Table<R> (issue 0044, shown in the
    constructors examples): a table is
    typed by its row, [Book(…)] | Table a Table<Book> and a table of
    Data maps a Table<Data>. Table written without its row is
    Table<Data>, and a Table<Book> is not a Table<Film>.

  • Schema boundaries in hql.toml (HQL-0035):
    a configured source maps its fields under
    [sources.<id>.fields.<field>] with name or a dotted path, type,
    position, read, write and absent, and keys its kind's extension
    owns in a subtable named by the kind; a malformed boundary refuses the
    vault. One resolver merges the format's defaults, the configuration and
    an invocation's override field by field, each property keeping its
    origin, and reports every boundary error at once: an undeclared or
    unmapped field, a shared or missing external field, and an external type
    with no decoder. A source read as a declared record is read through its
    boundary: a CSV header, a nested JSON path and a SQLite column map onto
    a ...

Read more

v0.4.2

Choose a tag to compare

@github-actions github-actions released this 19 Oct 08:33

HQL output that reads back as HQL, and a build floor that holds.

Added

  • An Hql presentation format, with the shorthand hql and --to hql: a
    value written as the literal that writes it, so the text reads back as the
    same value. A string is quoted even when it stands alone.

Changed

  • hql eval and the REPL write an unformatted result as Hql, so
    hql eval '"Dune"' prints "Dune". hql run still writes plain text, and
    --to text gives a bare string anywhere.
  • Rust 1.95 or newer is required to build HQL. The line editor,
    rustyline 19, needs it, so rust-version is now 1.95; 0.4.1 declared 1.88
    and did not build on it.

v0.4.1

Choose a tag to compare

@github-actions github-actions released this 19 Oct 03:20

A REPL that works on a terminal, and the HQL book.

Fixed

  • The REPL. A terminal session edits the line and recalls earlier inputs
    with the arrow keys, from a history kept in ~/.hql_history. An input goes
    on over several lines while a bracket is open, or while the next line opens
    with |, so a multi-line literal or a pipeline written one step per line
    runs as one input, typed or piped. Ctrl-C abandons the input being typed;
    Ctrl-D leaves. A session keeps every declaration — a binding with a lambda in
    it, an annotated binding, fn, an alias — where it used to drop some.
  • A record literal opening a line inside a list, [\n {title: …}], was read
    as a set.
  • format(…, limit = n) ignored its limit over a sequence the vault produced,
    such as cards | map(…).
  • A collection printed as text wrote its strings without quotes, so
    ["a, b"] read as two elements, and wrote a set in square brackets like a
    list. A value now prints as the literal that writes it: ["a, b"],
    {1, 3, 2}. Only a string standing alone prints bare.

Added

  • The HQL book. doc/public/learn/ teaches the whole language in twelve
    chapters, from a first value through records and lists, SQL-style
    questions, a vault of documents, graphs, retrieval, streams and formats, to
    documents built from their cells. Every program in it runs against the new
    tutorial vault, examples/tutorial/, and tests/tutorial.rs checks that
    each writes what the book shows.