core API
Purpose
luna-generic is the algebraic trait layer of LunaFlow. It does not provide numerical algorithms or containers by itself; it defines the reusable capability surface that higher-level packages depend on.
Structural traits
AddMonoid,MulMonoidAddGroup,MulGroupSemiring,Ring,FieldIntegralNatNatHomomorphismIntegralHomomorphismNum
These traits live in src/structure.mbt.
Operational traits
ZeroOneInverseConjugate
These traits live in src/operation.mbt.
Shipped instances
- Signed integers:
Int,Int16,Int64 - Unsigned integers:
UInt,UInt16,UInt64 - Exact big integer:
BigInt - Floating instances:
Float,Double
Semantic notes
Integral::normalize(Self) -> BigIntis the canonical exact bridge from any integral instance intoBigInt.Natreuses the samenormalize(Self) -> BigIntbridge via trait inheritance.NatHomomorphism::from_natandIntegralHomomorphism::from_integralare polymorphic embedding entry points over source traits instead of width-specific constructors.- The default embedding strategy is
Integral::normalizefollowed by target-specific conversion fromBigInt. - Unsigned integer instances stop at
Semiring; they do not pretend to be additive groups or rings. FloatandDoubleimplement homomorphism traits as approximate embeddings, so very large integral values may round.
Source map
src/structure.mbt: trait definitionssrc/operation.mbt: operational traitssrc/impl_signed.mbt,src/impl_unsigned.mbt,src/impl_bigint.mbt,src/impl_float.mbt,src/impl_dbl.mbt: default instances