Expand description
Prism — focus | project | settle.
A Beam carries three things through a pipeline: a value, the input
that produced it, and the accumulated loss (Imperfect). A Prism
defines three operations over beams:
- focus — select what matters from the input.
- project — transform the focused value (precision cut, eigenvalue threshold, the lossy step where information may not survive).
- settle — produce the output from what survived projection.
ⓘ
let result = seed("hello")
.apply(Focus(&my_prism))
.apply(Project(&my_prism))
.apply(Settle(&my_prism));Algebraically: a Beam is a semifunctor — you can map over the carried
value (smap), but the identity law may not hold because Failure beams
break it (mapping over a Failure panics rather than returning the same
Failure). A Prism is a monoid lifted into that semifunctor: prisms
compose associatively (focus | project | settle chains), and an identity
prism exists (pass-through on all three stages). This means pipelines are
type-safe by construction — the compiler enforces that each stage’s output
type matches the next stage’s input type.
Re-exports§
pub use beam::Beam;pub use beam::Operation;pub use beam::Optic;pub use coincidence::canonical_hash;pub use coincidence::coincidence_hash;pub use coincidence::Detector;pub use coincidence::HashPrism;pub use scalar_loss::ScalarLoss;pub use substrate_ref::Ref;pub use trace::Op;pub use trace::Step;pub use trace::StepOutput;pub use trace::Trace;pub use trace::Traced;pub use connection::Carrier;pub use connection::ScalarConnection;pub use content::ContentAddressed;pub use crystal::Crystal;pub use kernel::Decomposition;pub use kernel::KernelSpec;pub use luminosity::Luminosity;pub use merkle::diff;pub use merkle::Delta;pub use merkle::MerkleTree;pub use named::Named;pub use oid::Addressable;pub use oid::Oid;pub use optic_kind::FieldOptic;pub use optic_kind::OpticKind;pub use precision::Precision;pub use precision::Pressure;pub use spectral_oid::SpectralOid;pub use spectral_uuid::ParseError as SpectralUuidParseError;pub use spectral_uuid::SpectralUuid;pub use store::Store;
Modules§
- beam
- Beam — the functor. The pipeline value carrier.
- coincidence
- Minimal coincidence hash — eigenvalue-based content addressing.
- connection
- Carrier — the relational substrate flowing through a Beam.
- content
- Content addressing. A value’s identity is derived from its content,
not from where it lives or when it was created. Types that implement
ContentAddressedproduce an [Oid] that is their content-derived identity. - crystal
- Crystal — a settled Prism.
- kernel
- Kernel specification — what the runtime executes.
- luminosity
- Luminosity — how much signal is getting through.
- merkle
- Merkle tree — content-addressed tree structure.
- metal
- Metal — the five instructions. What Prism compiles to. The atoms below the trait. The thing the silicon does.
- named
- Named — a labeled Prism.
- oid
- Object identity. An
Oidis the content address of a value — two values with the same bytes produce the same Oid. Oids are the nodes in every graph this system builds: content-addressed, comparable, hashable. - optic_
kind - OpticKind — the taxonomy of optic field annotations.
- precision
- Precision and pressure.
Precisioncontrols how much detail survives projection — eigenvalues below the precision threshold are zeroed out.Pressuremeasures memory occupancy as a ratio, determining the resolution of what can be held in bounded storage. - scalar_
loss - Core’s own scalar loss type — a simple f64 measurement.
- spectral_
oid - Spectral object identity. A
SpectralOidis anOidviewed at a specificPrecision. Truncating the raw content address to fewer characters makes coarser identities — distinct values become “equal” when their truncated representations match. This is how the project operation controls resolution: lower precision merges more things into the same identity. - spectral_
uuid SpectralUuid— the 128-bit content-addressed identifier with navigable spectral structure.- store
- Store — where crystals live.
- substrate_
ref - Substrate reference (
@-prefixed nav-ref). - trace
- Trace — the execution record of a beam through a pipeline.
Macros§
- declaration
- Re-export the
declaration!{}function-like proc-macro — the@code/rust/macro.shim_typereception entry point (T23, permirror/shards/code/rust/macro.mirrorandmirror/docs/specs/code-macro-surface.md). Reads a substratetypedeclaration as input tokens and emits the Rust struct/enum that realises it.declaration!{}— the @code/rust/macro reception entry point.
Structs§
- Diagnostic
- A small human-readable message accompanying a
PropertyVerdict. Newtype overStringto keep bare strings out of the verdict surface (no-bare-types). - Focus
- focus: Input → Focused.
- Project
- project: Focused → Projected.
- Settle
- settle: Projected → Refracted.
Enums§
- Imperfect
- Result extended with partial success.
- Property
Verdict - The verdict carried for one substrate location in a
Transparency::Opaquemap. - Transparency
- Structured loss: empty light (
Clear) or accumulated opacities at substrate locations (Opaque).
Traits§
- Loss
- A measure of what didn’t survive a transformation.
- Metric
- A
Losswith metric properties. - Prism
- Three optic operations over beams: focus, project, settle.
Functions§
- apply
- Run a prism end-to-end: focus, then project, then settle.
- apply_h
- Run a prism end-to-end on a state value (not a beam) and discard
the source dimension, returning the focus of the refracted beam as
an
Imperfect.
Derive Macros§
- Derive
Prism - Re-export the
#[derive(Prism)]proc macro.