Repository navigation
v1.0.0
mat 1.0.0
The first stable release of mat, a Scala 3 macro library for compile-time materialization of type-level descriptions into concrete values.
Highlights
- Macro-based derivation of
Materialize[A]. - Precise result types preserved for
materialize[A]andmaterializeOpt[A]. - Support for:
- literal types,
- tuples and named tuples,
- case-class products,
- unions and intersections,
- nested and parameterized sealed-trait ADTs,
- enums and GADT-like definitions.
CustomMaterialize[A]for application-specific materialization rules.- Explicit
Materialize[A]evidence throughMaterialize.fromValue. materializeOpt[A]for safe materialization withNoneon unsupported types.- Context-bound support for APIs requiring materializable types.
- Detection of ambiguous, recursive and unsupported derivations.
Diagnostics
Compilation errors now include detailed context:
- unsupported tuple elements,
- unsupported product fields,
- ambiguous unions,
- rejected ADT variants,
- recursive branches,
- incompatible intersections,
- unsupported parameterized variants.
Cross-building
The library supports Scala 3.8.x and 3.9.x.
Both versions are tested in CI. Since they share the _3 artifact suffix, releases publish a single artifact built with Scala 3.8.4.
Performance and tooling
- Added derivation caching for repeated nested types.
- Optimized tuple derivation.
- Added compile-time benchmarks for tuples, products and unions.
- Release benchmarks run on Scala 3.8.4 and detect significant regressions.
- Added statement and branch coverage thresholds to CI.
Documentation
- Added comprehensive Scaladoc.
- Scaladoc is generated during releases with external assets vendored locally.
- Versioned documentation is stored on the
scaladocbranch. - Benchmark reports are retained on the
benchmarksbranch.
Migration from 0.5.0
SingletonSumhas been removed. Singleton-sum derivation is now handled directly by the materialization macro.- Materialization is now derived through quoted macros instead of the previous implicit-only implementation.
- Explicit
Materialize[A]evidence takes precedence overCustomMaterialize[A], which in turn takes precedence over built-in derivation. - Diagnostic messages are more precise and may differ from previous versions.
- Recursive and ambiguous derivations that were previously unsupported are now detected and reported consistently.
Limitations
Materialization is intentionally conservative. It requires enough compile-time information to produce one unambiguous value. Abstract types, Any, Nothing, recursive structures, ambiguous unions and sums with multiple candidates are not materialized.
Macro expansion and deeply nested types may increase compilation time. No runtime reflection is used.