1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#![no_std] pub trait Semigroup { fn op(Self, Self) -> Self; } pub trait Monoid: Semigroup { fn neutral() -> Self; } pub trait Group: Monoid { fn invert(self) -> Self; } pub trait Module<A>: Semigroup { fn scale(self, a: A) -> Self; }