1use crate::*;
2
3pub trait Mul<Rhs: Number>: Number {
4 type Output: Number;
5}
6
7impl<Rhs: Number> Mul<Rhs> for Zero {
8 type Output = Zero;
9}
10
11impl<N: Number, Rhs: Number> Mul<Rhs> for Successor<N>
20where
21 N: Mul<Rhs>,
22 Rhs: Add<<N as Mul<Rhs>>::Output>,
23{
24 type Output = <Rhs as Add<<N as Mul<Rhs>>::Output>>::Output;
25}
26
27impl<N: Number, Rhs: Number> Mul<Rhs> for Negative<N>
30where
31 N: Mul<Rhs>,
32 <N as Mul<Rhs>>::Output: Neg,
33{
34 type Output = <<N as Mul<Rhs>>::Output as Neg>::Output;
35}
36
37pub trait MulOp {
38 type Output: Number;
39}
40
41impl<Lhs: Number, Rhs: Number> MulOp for Op<Lhs, Rhs>
42where
43 Lhs: Mul<Rhs>,
44{
45 type Output = <Lhs as Mul<Rhs>>::Output;
46}