-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConcept.abs
71 lines (52 loc) · 1.14 KB
/
Concept.abs
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
63
64
65
66
67
68
69
70
module Concept;
type OptionInt = Maybe<Int>;
data Either<A,B> = Left(A left) | Right(B right);
data List<A> = Nil | Cons(A,List<A>);
def Int addEither(Either<Int, Int> e) = case e {
Left(a) => a+1;
Right(a) => a+3;
};
def A getLeft<A,B>(Either<A,B> e) = left(e);
def Int f(Int y) = let (Int x) = y+ 3 in
let (Int x) = x + 4 in x + 1;
interface Interf1 {
Int method1(Int n, Int m);
}
interface Interf2 extends Interf1 {
Unit method2(Bool b);
Bool method3(Int z);
}
class Class1(Int p1, Int p2, Int p3) implements Interf2 {
Int x = 0;
Interf2 o2;
{
this.x = 1;
this.x = this.x +1;
}
Int method1(Int n, Int m) {
return (n+m);
}
Unit method2(Bool b) {
}
Bool method3(Int z) {
z = z + 1;
z = 2 + z + 3;
z = this.x + 4 + 5;
Int y = this.method1(1,4);
this.x = this.method1(1,5);
this.x = y + 1;
this.x = this.x + y;
return (this.x==1);
}
}
{
Interf2 o1 = new Class1(1,2,3);
o1.method1(1,3);
o1.method2(True);
Fut<Int> f = o1 ! method1(1,4);
await f?;
Fut<Unit> f2 = o1 ! method2(True);
await f2?;
Int res = f.get;
Bool res_ = o1.method3(res);
}