number_types/
neg.rs

1use crate::*;
2
3pub trait IsPositive: Number {}
4
5impl IsPositive for Zero {}
6impl<N: Number> IsPositive for Successor<N> {}
7
8pub trait Neg: Number {
9    type Output: Number + Neg;
10}
11
12impl Neg for Zero {
13    type Output = Zero;
14}
15
16impl<N: Number> Neg for Successor<N> {
17    type Output = Negative<Successor<N>>;
18}
19
20impl<N: Number + Neg> Neg for Negative<N> {
21    type Output = N;
22}