General algebraic traits and default numeric instances for Luna projects.
This documentation tracks the intended v0.3.3 release content.
luna-genericprovides lightweight algebraic traits for additive, multiplicative, ring-like, field-like, and numeric behavior.- The package ships default instances for signed integers, unsigned integers,
BigInt,Float, andDouble. - Integral-to-target embeddings are now modeled explicitly through homomorphism traits instead of being mixed into
Integral.
BigIntis now part of the default exported numeric surface.Integralnow providesnormalize, which canonicalizes any integral value intoBigInt.NatHomomorphismandIntegralHomomorphismprovide polymorphic target-side embeddings for natural and integral source types.Integral::normalizeis the canonical source-side entry point for bothIntegralandNat.- Floating-point embeddings remain approximate and follow target floating-point precision limits.
- Traits:
AddMonoid,MulMonoid,AddGroup,MulGroup,Semiring,Ring,Field,Integral,Nat,NatHomomorphism,IntegralHomomorphism,Num - Operations:
One,Zero,Inverse,Conjugate - Default numeric types:
Int,Int16,Int64,UInt,UInt16,UInt64,BigInt,Float,Double
Natcovers pure unsigned integer types:UInt,UInt16,UInt64Integralcovers signed and unsigned integers plusBigInt:Int,Int16,Int64,UInt,UInt16,UInt64,BigIntByteis intentionally excluded from both traits- Unsigned integer instances stop at
Semiringand do not implementAddGroup,Ring, orNum
Integral::normalizeprovides a canonicalBigIntrepresentation for any integral valueNatsources reuse the samenormalize(Self) -> BigIntpath through trait inheritanceNatHomomorphism::from_natembeds anyNatsource vianormalizeIntegralHomomorphism::from_integralembeds anyIntegralsource vianormalizeBigIntembeddings are exactFloatandDoubleembeddings are approximate and may round large values
Comprehensive API documentation is available at mooncakes.io.
We provide README-level documentation in multiple languages:
- English: doc/en_US/README.md
- Simplified Chinese: doc/zh_CN/README.md
- Japanese: doc/ja_JP/README.md
| Version | Date | Status | Notes |
|---|---|---|---|
0.3.3 |
2026-06-12 | release candidate | Refactors homomorphism traits around polymorphic methods and unifies natural/integral embeddings through normalize |
0.3.2 |
2026-06-06 | published on mooncakes | Adds Integral::normalize as the canonical BigInt normalization entry point and aligns docs with the new integral embedding model |
0.3.1 |
2026-06-06 | published on mooncakes | Adds BigInt coverage, explicit integral embedding traits, and trilingual documentation refresh |
0.3.0 |
2026-06-06 | previous release baseline | Earlier generic algebraic trait surface before the current integral embedding redesign |
Useful local commands:
moon check
moon testBefore triggering the publish workflow:
- Confirm
moon.modcontains the intended version. - Confirm the README files match the exported package surface.
- Run
moon checkandmoon test. - Trigger
publish-packageafter the release commit is pushed.