Issue #1116: Build ADR-319 D9: fs::Path orders, equates and hashes, so a path keys an ordered set or map (NK1247 today)

Open and answer this issue on GitHub.

ready · opened 2026-10-31 · updated 2026-10-31 · 0 comments

Met by the builder moving crates/nikaia/src/proofs.rs (where questions were asked: BTreeSet[(fs::Path?, i64)]). Decided by the architect under Language decisions (docs/architect.md): obvious - the order the type’s own == implies, the one Rust’s PathBuf and Python’s PurePath have. ADR-319 D9 (amendment, section 8) and Part III 17.1 (A path is an `fs::Path`).

What happens. The ledger row [type."fs::Path"] (crates/nikaia-std/std.contracts:4373) says compares = true only, so an ordered map or set keyed by a path is refused NK1247.

Probe (nikaia check p.nika; wanted: checked, and nikaia run prints 1):

use std::collections
use std::fs
fn main() {
    let mut a: collections::BTreeSet[fs::Path] = collections::BTreeSet()
    a.insert(fs::Path::from("b"))
    let mut b: collections::BTreeSet[(fs::Path?, i64)] = collections::BTreeSet()
    b.insert((fs::Path::from("a"), 1))
    println(a.len())
}

Today: NK1247 twice. (HashSet[fs::Path] is accepted today without hashes in the row: check why when adding it.)

To build

  1. The ledger row of fs::Path gains equates = true, orders = true, hashes = true (D9); its comment names ADR-319 D9.
  2. Test tests/compiler/tests/a_path_is_a_key_of_an_ordered_set.nika + .stdout: a BTreeSet[fs::Path] printed in order (a/b before a/c, a//b equal to a/b), a BTreeMap[(fs::Path?, i64), String], and a HashSet[fs::Path].

Generated by Claude Code

Back to Open Issues