Expand description
§panproto-lens
Bidirectional lenses via protolens (schema-independent lens families).
Every schema migration is a lens with a get direction (= restrict,
projecting data forward) and a put direction (= restore from
complement, bringing modifications back). The lens laws (GetPut
and PutGet) guarantee round-trip fidelity.
This crate provides:
Lens: An asymmetric lens backed by a compiled migration.get/put: Forward and backward lens directions.Complement: Data discarded byget, needed byput.Protolens: A dependent function from schemas to lenses (Π(S : Schema | P(S)). Lens(F(S), G(S))).ProtolensChain: Composable sequence of protolenses.auto_generate: Automatic protolens generation from two schemas.compose(): Compose two lenses sequentially.check_laws: VerifyGetPutandPutGeton a test instance.
The mathematical foundations are based on asymmetric lenses with complement (Diskin et al., 2011), GAT-based protolenses (natural transformations between theory endofunctors), and Cambria’s approach to schema evolution (Ink & Switch, 2020).
Re-exports§
pub use asymmetric::Complement;pub use asymmetric::get;pub use asymmetric::put;pub use auto_lens::AutoLensConfig;pub use auto_lens::AutoLensResult;pub use auto_lens::Stringency;pub use auto_lens::auto_generate;pub use auto_lens::auto_generate_candidates;pub use auto_lens::auto_generate_candidates_with_hints;pub use auto_lens::auto_generate_with_hints;pub use candidate::CandidateStep;pub use candidate::LensCandidate;pub use complement_type::CapturedField;pub use complement_type::ComplementKind;pub use complement_type::ComplementSpec;pub use complement_type::DefaultRequirement;pub use complement_type::chain_complement_spec;pub use complement_type::complement_spec_at;pub use compose::compose;pub use cost::chain_cost;pub use cost::complement_cost;pub use cost::verify_identity_cost;pub use cost::verify_subadditivity;pub use diff_to_protolens::DiffSpec;pub use diff_to_protolens::KindChange;pub use diff_to_protolens::diff_to_lens;pub use diff_to_protolens::diff_to_protolens;pub use edit_error::EditLensError;pub use edit_lens::EditLens;pub use edit_pipeline::EditPipeline;pub use edit_provenance::EditProvenance;pub use error::LawViolation;pub use error::LensError;pub use graph::LensGraph;pub use laws::check_get_put;pub use laws::check_laws;pub use laws::check_put_get;pub use optic::OpticKind;pub use optic::classify_transform;pub use optic::refine_scoped_optic;pub use protolens::ComplementConstructor;pub use protolens::FleetResult;pub use protolens::Protolens;pub use protolens::ProtolensChain;pub use protolens::SchemaConstraint;pub use protolens::apply_to_fleet;pub use protolens::combinators;pub use protolens::elementary;pub use protolens::horizontal_compose as protolens_horizontal;pub use protolens::lift_chain;pub use protolens::lift_protolens;pub use protolens::vertical_compose as protolens_vertical;pub use symbolic::SymbolicStep;pub use symbolic::simplify_steps;pub use symmetric::CoherenceViolation;pub use symmetric::SymmetricLens;
Modules§
- asymmetric
- Asymmetric lens operations:
getandputwith complement tracking. - auto_
lens - Automatic protolens generation pipeline.
- candidate
- Ranked candidate lenses with per-step explanations.
- coercion_
laws - Sample-based verification of declared coercion classes.
- complement_
type - Complement type system for protolenses.
- compose
- Lens composition.
- cost
- Complement cost computation forming a Lawvere metric on lens graphs.
- diff_
to_ protolens - Convert schema diffs into protolens chains.
- edit_
error - Error types for edit lens operations.
- edit_
laws - Edit lens law verification.
- edit_
lens - Edit lens: translates individual edits between source and view schemas.
- edit_
pipeline - Per-pipeline-step edit translation for the edit lens.
- edit_
provenance - Provenance tracking for translated edits.
- enrichment_
registry - Cross-crate extension point for schema-enrichment synthesis.
- error
- Error types for lens operations.
- fibration
- Grothendieck fibration structure for the protolens framework.
- graph
- Weighted lens graph with Floyd-Warshall shortest paths.
- hint
- Forward-chaining hint propagation for auto-lens generation.
- laws
- Round-trip law verification for lenses.
- layout_
complement - The operational layout complement: the per-vertex fibres the emit review (put-direction) consumes.
- optic
- Optic classification for protolens chains.
- protolens
- Protolenses: schema-parameterized families of lenses.
- symbolic
- Symbolic simplification of protolens chains.
- symmetric
- Symmetric lenses via span composition.
Structs§
- Lens
- An asymmetric lens with complement tracking.