4
4
//│ Type: ⊤
5
5
6
6
7
- fun andt(x)=x&& true
8
- fun k(f:Nothing-> Bool)= 1
9
- fun ap(f)=x=> f(x)
7
+ fun andt(x) = x && true
8
+ fun k(f: Nothing -> Bool) = 1
9
+ fun ap(f) = x => f(x)
10
10
//│ Type: ⊤
11
11
12
12
k(andt)
@@ -30,15 +30,28 @@ idIB(true)
30
30
idIB(if true then 1 else true)
31
31
//│ Type: Bool ∨ Int
32
32
33
- x=>
33
+ x =>
34
34
let y = x+1
35
35
idIB(x)
36
36
//│ Type: ('x) ->{⊥} ⊥
37
37
//│ Where:
38
38
//│ 'x <: Int ∨ Bool
39
39
//│ 'x <: Int
40
- //│ 'x#Bool ∨ Bool<:'app ∧ ⊥<:'eff}
41
40
//│ 'x#Int ∨ Int<:'app ∧ ⊥<:'eff}
41
+ //│ 'x#Bool ∨ Bool<:'app ∧ ⊥<:'eff}
42
+
43
+ (x: Int) =>
44
+ let y = x + 1
45
+ idIB(x)
46
+ //│ Type: (Int) ->{⊥} Int
47
+
48
+ (x: Bool) =>
49
+ idIB(x)
50
+ //│ Type: (Bool) ->{⊥} Bool
51
+
52
+ (x: Bool) =>
53
+ idIB(idIB(x))
54
+ //│ Type: (Bool) ->{⊥} Bool
42
55
43
56
fun ap1(f)=f(1)
44
57
ap1(idIB)
@@ -48,32 +61,39 @@ ap(idIB)(1)
48
61
//│ Type: Int
49
62
50
63
:todo
51
- x=> idIB(x)
64
+ x => idIB(x)
52
65
//│ Type: ('x) ->{⊥} ⊥
53
66
//│ Where:
54
67
//│ 'x <: Int ∨ Bool
55
- //│ 'x#Int ∨ Int<:'app ∧ ⊥<:'eff}
56
68
//│ 'x#Bool ∨ Bool<:'app ∧ ⊥<:'eff}
69
+ //│ 'x#Int ∨ Int<:'app ∧ ⊥<:'eff}
57
70
58
71
59
72
:todo // BbML
60
73
fun idIIBB: ([Int, Int] -> Int) & ([Bool, Bool] -> Bool)
61
74
//│ ╔══[ERROR] General type is not allowed here.
62
- //│ ║ l.60 : fun idIIBB: ([Int, Int] -> Int) & ([Bool, Bool] -> Bool)
75
+ //│ ║ l.73 : fun idIIBB: ([Int, Int] -> Int) & ([Bool, Bool] -> Bool)
63
76
//│ ╙── ^^^
64
77
//│ ╔══[ERROR] General type is not allowed here.
65
- //│ ║ l.60 : fun idIIBB: ([Int, Int] -> Int) & ([Bool, Bool] -> Bool)
78
+ //│ ║ l.73 : fun idIIBB: ([Int, Int] -> Int) & ([Bool, Bool] -> Bool)
66
79
//│ ╙── ^^^^
67
80
//│ Type: ⊤
68
81
69
82
:todo // BbML
70
83
idIIBB([1, 2])
71
84
//│ ╔══[ERROR] Term shape not yet supported by BbML: Tup(List(Fld(‹›,Lit(IntLit(1)),None), Fld(‹›,Lit(IntLit(2)),None)))
72
- //│ ║ l.70 : idIIBB([1, 2])
85
+ //│ ║ l.83 : idIIBB([1, 2])
73
86
//│ ╙── ^^^^^^
74
87
//│ Type: ⊥
75
88
76
89
90
+ x => if x is
91
+ Int then 0
92
+ Bool then 0
93
+ //│ Type: (((¬Bool ∨ Int) ∨ Bool) ∧ (¬Int ∨ Int)) ->{⊥} Int
94
+
95
+
96
+
77
97
class Pair[out A, out B](fst: A, snd: B)
78
98
//│ Type: ⊤
79
99
@@ -99,7 +119,7 @@ idIIBB(new Pair(1, true))
99
119
:todo
100
120
fun foo: ["x": Int, "y": Int]
101
121
//│ ╔══[ERROR] Invalid type
102
- //│ ║ l.100 : fun foo: ["x": Int, "y": Int]
122
+ //│ ║ l.120 : fun foo: ["x": Int, "y": Int]
103
123
//│ ╙── ^^^^^^^^^^^^^^^^^^^^
104
124
//│ Type: ⊤
105
125
0 commit comments