44//│ Type: ⊤
55
66
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)
1010//│ Type: ⊤
1111
1212k(andt)
@@ -30,15 +30,28 @@ idIB(true)
3030idIB(if true then 1 else true)
3131//│ Type: Bool ∨ Int
3232
33- x=>
33+ x =>
3434 let y = x+1
3535 idIB(x)
3636//│ Type: ('x) ->{⊥} ⊥
3737//│ Where:
3838//│ 'x <: Int ∨ Bool
3939//│ 'x <: Int
40- //│ 'x#Bool ∨ Bool<:'app ∧ ⊥<:'eff}
4140//│ '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 ∨ Int
4255
4356fun ap1(f)=f(1)
4457ap1(idIB)
@@ -48,32 +61,53 @@ ap(idIB)(1)
4861//│ Type: Int
4962
5063:todo
51- x=> idIB(x)
64+ x => idIB(x)
5265//│ Type: ('x) ->{⊥} ⊥
5366//│ Where:
5467//│ 'x <: Int ∨ Bool
68+ //│ 'x#Bool ∨ Bool<:'app ∧ ⊥<:'eff}
5569//│ 'x#Int ∨ Int<:'app ∧ ⊥<:'eff}
70+
71+ fun forward(x) = idIB(x)
72+ forward
73+ //│ Type: ['x] -> 'x -> ⊥
74+ //│ Where:
75+ //│ 'x <: Int ∨ Bool
5676//│ 'x#Bool ∨ Bool<:'app ∧ ⊥<:'eff}
77+ //│ 'x#Int ∨ Int<:'app ∧ ⊥<:'eff}
78+
79+ forward(1)
80+ //│ Type: ⊥
81+
82+ forward(true)
83+ //│ Type: ⊥
5784
5885
5986:todo // BbML
6087fun idIIBB: ([Int, Int] -> Int) & ([Bool, Bool] -> Bool)
6188//│ ╔══[ERROR] General type is not allowed here.
62- //│ ║ l.60 : fun idIIBB: ([Int, Int] -> Int) & ([Bool, Bool] -> Bool)
89+ //│ ║ l.87 : fun idIIBB: ([Int, Int] -> Int) & ([Bool, Bool] -> Bool)
6390//│ ╙── ^^^
6491//│ ╔══[ERROR] General type is not allowed here.
65- //│ ║ l.60 : fun idIIBB: ([Int, Int] -> Int) & ([Bool, Bool] -> Bool)
92+ //│ ║ l.87 : fun idIIBB: ([Int, Int] -> Int) & ([Bool, Bool] -> Bool)
6693//│ ╙── ^^^^
6794//│ Type: ⊤
6895
6996:todo // BbML
7097idIIBB([1, 2])
7198//│ ╔══[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])
99+ //│ ║ l.97 : idIIBB([1, 2])
73100//│ ╙── ^^^^^^
74101//│ Type: ⊥
75102
76103
104+ x => if x is
105+ Int then 0
106+ Bool then 0
107+ //│ Type: (((¬Bool ∨ Int) ∨ Bool) ∧ (¬Int ∨ Int)) ->{⊥} Int
108+
109+
110+
77111class Pair[out A, out B](fst: A, snd: B)
78112//│ Type: ⊤
79113
@@ -99,7 +133,7 @@ idIIBB(new Pair(1, true))
99133:todo
100134fun foo: ["x": Int, "y": Int]
101135//│ ╔══[ERROR] Invalid type
102- //│ ║ l.100 : fun foo: ["x": Int, "y": Int]
136+ //│ ║ l.134 : fun foo: ["x": Int, "y": Int]
103137//│ ╙── ^^^^^^^^^^^^^^^^^^^^
104138//│ Type: ⊤
105139
0 commit comments