coremem_types: add Peano numbers
not used yet, but will be by list/enum operations
This commit is contained in:
@@ -1 +1,2 @@
|
||||
pub mod list;
|
||||
pub mod peano;
|
||||
|
15
crates/types/src/compound/peano.rs
Normal file
15
crates/types/src/compound/peano.rs
Normal file
@@ -0,0 +1,15 @@
|
||||
pub struct PNext<P>(P);
|
||||
pub struct P0;
|
||||
pub type P1 = PNext<P0>;
|
||||
|
||||
pub trait Peano { }
|
||||
|
||||
pub trait PeanoNonZero {
|
||||
type Prev: Peano;
|
||||
}
|
||||
|
||||
impl Peano for P0 { }
|
||||
impl<P: Peano> Peano for PNext<P> {}
|
||||
impl<P: Peano> PeanoNonZero for PNext<P> {
|
||||
type Prev = P;
|
||||
}
|
Reference in New Issue
Block a user