-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample.txt
More file actions
43 lines (31 loc) · 717 Bytes
/
Copy pathsample.txt
File metadata and controls
43 lines (31 loc) · 717 Bytes
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
type T = bool -> bool -> bool;
type U = (int, int, bool) -> bool;
enum Option[T](
Some(T),
None
) {
pub map[U](mapper: T -> U): Option[U] -> @and_then(mapper => Option.Some);
pub and_then[U](mapper: T -> Option[U]) -> match self {
Some(value) -> mapper(value)
None -> None
};
pub unwrap(): U -> match self {
Some(value) -> value
None -> panic(...)
};
}
fn test() {
// let u: U = (a, b) -> a and b;
// accept2(u(true));
// accept(a -> b -> (a or b));
let x: [int -> int] = a -> -a;
let x = [true];
array(x);
}
fn accept(value: T) {
accept2(value(true));
}
fn accept2(value: bool -> bool) {
}
fn array(value: [int]) {
}