fs lege carpe hauri
Translation status: English reader-locale proof. Term names and code fences follow the en pack; supporting prose may still be English.
fs file reads are shape-specific: read<string>, carpe (list<string>), hauri (list<b8>).
Syntax: charta.read_file<string>(via) | call 'solum:carpe' (via) ↦ list<string> | call 'solum:hauri' (via) ↦ list<b8>
Category#
endpoint
Related#
Examples#
radix/corpus/reference/concept/fs-lege-carpe-hauri/solum-lege-generic.fab (canonical · concept)#
fs file reads are shape-specific: read<string>, carpe (list<string>), hauri (list<b8>).
# =============================================================================
# only read carpe hauri — only file reads are shape-specific routes.
# =============================================================================
#
# What this teaches:
# • Shape-specific reads — `charta.read_file<string>` reads a file as text;
# `solum:carpe` reads it as a line list; `solum:hauri` reads raw bytes
# • Manifest-backed surface — each route declares exactly one result shape in
# the only provider manifest, so the materialized target always matches
#
# Common mistakes:
# • assuming one generic `charta.read_file<T>` reads every shape — `read` is
# text-only; use `carpe` for `list<string>` and `hauri` for `list<b8>`
#
# See also: call, only, read, carpe, hauri
# =============================================================================
# only file reads — read (text) / carpe (lines) / hauri (bytes)
#
# The provider contract (hosts/crates/solum manifest) keeps one result shape
# per route: `solum:lege` → string, `solum:carpe` → list<string>,
# `solum:hauri` → list<b8>. The `norma:fs` wrappers `carpe`/`hauri` are
# module-private this release, so this fixture reaches the line/byte routes
# directly through the manifest-backed `call` surface; the compiler's
# `@ radix type` metadata on `norma:charta.read_file<T>` still admits the broader
# targets, which the provider rejects (recorded residual). Generic
# `charta.read_file<T>` across all three shapes is separate future provider work.
#
# Runtime check: files are prepared under the temp dir, keyed by process id so
# concurrent runs never share a path; each read route can prove its
# accepted result shape independently of the harness working directory.
import from "norma:fs" charta
import from "norma:process" process
main {
let string textPath ← "§/faber-fs-lege-generic-§.txt"(charta.temp_dir(), process.pid())
charta.write_file(textPath, "prima\nsecunda\n")
let string body ← charta.read_file<string>(textPath)
assert body ≡ "prima\nsecunda\n"
let list<string> lineae ← call 'solum:carpe' (textPath) ↦ list<string>
assert lineae ≡ (["prima", "secunda"] ↦ list<string>)
let list<b8> data ← call 'solum:hauri' (textPath) ↦ list<b8>
assert data ≡ |70 72 69 6d 61 0a 73 65 63 75 6e 64 61 0a|
print body
print lineae
print data
print "fs lege carpe hauri parata"
}Expected output:
prima
secunda
["prima", "secunda"]
[0x70, 0x72, 0x69, 0x6d, 0x61, 0x0a, 0x73, 0x65, 0x63, 0x75, 0x6e, 0x64, 0x61, 0x0a]
fs lege carpe hauri parata