Skip to content

Add per-crate prelude modules to eliminate the E0599 missing-trait failure mode #579

Description

@shinaoka

Problem

Core methods in this workspace live on traits, not inherent impls: sum() and rank() on AbstractTensorTrain (crates/tensor4all-simplett/src/traits.rs), contract_pair on TensorContractionLike (crates/tensor4all-core/src/tensor_like.rs). No crate ships a prelude module (pub mod prelude has zero hits across crates/).

Consequence: the most likely first-try failure for a new user or coding agent is error[E0599]: no method named 'sum' found after forgetting a trait import it had no reason to guess. Every quickstart in the repo works around this with an import list:

use tensor4all_simplett::{AbstractTensorTrain, CompressionOptions, TensorTrain};

tensor4all-interpolativeqtt partially compensates by re-exporting (src/lib.rs:47: pub use tensor4all_simplett::{AbstractTensorTrain, TensorTrain};), but this courtesy is not systematic.

Proposed direction

Add a conventional prelude module to each user-facing crate (tensor4all-core, tensor4all-simplett, tensor4all-treetn, tensor4all-itensorlike, tensor4all-tensorci, tensor4all-quanticstci, tensor4all-aci, tensor4all-interpolativeqtt), re-exporting that crate's public traits plus the handful of types needed to call them, so user code starts with:

use tensor4all_simplett::prelude::*;

Notes:

Non-goals

A facade crate; renaming or merging traits; deprecating direct imports.

Acceptance criteria

  • Each user-facing crate has a documented prelude covering its public traits.
  • README and getting-started quickstarts compile with prelude imports only.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions