1pub use crate::algebra::traits::*;
3
4#[derive(Clone, Copy, Default, Debug, PartialEq, Eq)]
6pub struct Dual<S>(pub S);
7
8impl<S: Set> Set for Dual<S> {}
9
10impl<S: BinaryOp> BinaryOp for Dual<S> {
11 fn op(self, b: Self) -> Self {
12 Self(b.0.op(self.0))
13 }
14}
15
16impl<S: Identity> Identity for Dual<S> {
17 fn id() -> Self {
18 Self(S::id())
19 }
20}
21
22impl<S: Inverse> Inverse for Dual<S> {
23 fn inv(self) -> Self {
24 Self(self.0.inv())
25 }
26}
27
28impl<S: Commutative> Commutative for Dual<S> {}
29impl<S: Associative> Associative for Dual<S> {}
30impl<S: Idempotence> Idempotence for Dual<S> {}