العرضar

fs lege carpe hauri

Translation status: العربية reader-locale proof. Term names and code fences follow the ar pack; supporting prose may still be English.

fs file reads are shape-specific: اقرأ<نص>, carpe (قائمة<نص>), hauri (بايتات).

Syntax: charta.read_file<نص>(عبر) | call 'solum:carpe' (عبر) ↦ قائمة<نص> | call 'solum:hauri' (عبر) ↦ بايتات

Category#

ad

Examples#

radix/corpus/ad/solum-lege-generic.fab (canonical · concept)#

fs file reads are shape-specific: اقرأ<نص>, carpe (قائمة<نص>), hauri (بايتات).

# =============================================================================
# فقط اقرأ carpe hauri — فقط file reads are shape-specific routes.
# =============================================================================
#
# What this teaches:
#   • Shape-specific reads — `charta.read_file<نص>` 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 فقط provider manifest, so the materialized target always matches
#
# Common mistakes:
#   • assuming one generic `charta.read_file<T>` reads every shape — `اقرأ` is
#     text-only; use `carpe` for `قائمة<نص>` and `hauri` for `بايتات`
#
# See also: اتصل, فقط, اقرأ, carpe, hauri
# =============================================================================

# فقط file reads — اقرأ (text) / carpe (lines) / hauri (bytes)
#
# The provider contract (hosts/crates/solum manifest) keeps one result shape
# per route: `solum:lege` → نص, `solum:carpe` → قائمة<نص>,
# `solum:hauri` → بايتات. The `norma:fs` wrappers `carpe`/`hauri` are
# module-private this release, so this fixture reaches the line/byte routes
# directly through the manifest-backed `اتصل` surface; the compiler's
# `@ radix نمط` 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 /tmp so each read route can prove its
# accepted result shape independently of the harness working directory.

import from "norma:fs" charta

main {
    const string textPath ← "/tmp/faber-fs-lege-generic.txt"
    charta.write_file(textPath, "prima\nsecunda\n")
    const string body ← charta.read_file<string>(textPath)
    assert body ≡ "prima\nsecunda\n"
    const list<string> lineae ← call 'solum:carpe' (textPath) ↦ list<string>
    assert lineae ≡ (["prima", "secunda"] ↦ list<string>)
    const bytes data ← call 'solum:hauri' (textPath) ↦ bytes
    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"]
[112, 114, 105, 109, 97, 10, 115, 101, 99, 117, 110, 100, 97, 10]
fs lege carpe hauri parata