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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
use std::any::Any;
use super::sealed::IsSession;
use super::*;
use crate::tuple::{List, Tuple};
#[repr(transparent)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct Choose<Choices>(pub Choices);
impl<Choices: Any> IsSession for Choose<Choices> {}
impl<Choices: Any> HasDual for Choose<Choices>
where
Choices: Tuple,
Choices::AsList: EachHasDual,
<Choices::AsList as EachHasDual>::Duals: List + EachHasDual,
{
type DualSession = Offer<<<Choices::AsList as EachHasDual>::Duals as List>::AsTuple>;
}
impl<Choices: 'static> Actionable for Choose<Choices> {
type NextAction = Self;
}
impl<N: Unary, Choices: Tuple + 'static> Scoped<N> for Choose<Choices> where
Choices::AsList: EachScoped<N>
{
}
impl<N: Unary, P, Choices> Subst<P, N> for Choose<Choices>
where
Choices: Tuple + 'static,
Choices::AsList: EachSubst<P, N>,
<Choices::AsList as EachSubst<P, N>>::Substituted: List,
{
type Substituted = Choose<<<Choices::AsList as EachSubst<P, N>>::Substituted as List>::AsTuple>;
}
impl<N: Unary, P, Choices> Then<P, N> for Choose<Choices>
where
Choices: Tuple + 'static,
Choices::AsList: EachThen<P, N>,
<Choices::AsList as EachThen<P, N>>::Combined: List,
{
type Combined = Choose<<<Choices::AsList as EachThen<P, N>>::Combined as List>::AsTuple>;
}
impl<N: Unary, Level: Unary, Choices> Lift<N, Level> for Choose<Choices>
where
Choices: Tuple + 'static,
Choices::AsList: EachLift<N, Level>,
<Choices::AsList as EachLift<N, Level>>::Lifted: List,
{
type Lifted = Choose<<<Choices::AsList as EachLift<N, Level>>::Lifted as List>::AsTuple>;
}