1use std::marker::PhantomData;
3
4pub use crate::algebra::traits::*;
5use crate::impl_algebra;
6
7#[derive(Clone, Copy, Default, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
9pub struct Prod<T>(PhantomData<T>);
10impl<T> Prod<T> {
11 pub fn new() -> Self {
13 Self(PhantomData)
14 }
15}
16
17macro_rules! implement {
18 ($($t:ty),*) => {
19 $(impl_algebra!(
20 Prod<$t>; set: $t; op: |_, a: $t, b: $t| a * b;
21 id: |_| 1 as $t; commu; assoc;);)*
22 $(impl Multiplicative for Prod<$t> {})*
23 };
24}
25
26implement!(i8, i16, i32, i64, i128, isize, u8, u16, u32, u64, u128, usize, f32, f64);