1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use std::marker::PhantomData;
use session_types::SessionType;
pub unsafe trait Peano {}
pub struct Z;
unsafe impl Peano for Z {}
pub struct S<N> ( PhantomData<N> );
unsafe impl<N> Peano for S<N> {}
pub trait Pop<N: Peano> {
type Head: SessionType;
type Tail: SessionType;
}
impl<A: SessionType, B: SessionType> Pop<Z> for (A, B) {
type Head = A;
type Tail = (A, B);
}
impl<N: Peano, A, B: Pop<N>> Pop<S<N>> for (A, B) {
type Head = B::Head;
type Tail = B::Tail;
}