@@ -11,13 +11,13 @@ fun map: [A, B, E] -> List[out A] -> (A ->{E} B) ->{E} List[out B]
11
11
12
12
13
13
// * Dummy implementation
14
- fun mapi: [A, E] -> List[out A] -> ((Int, A) ->{E} A) ->{Alloc | E} List[out A]
14
+ fun mapi: [A, E] -> List[out A] -> ((Int, A) ->{E} A) ->{E} List[out A]
15
15
fun mapi = s => f =>
16
16
region r in
17
17
map(s) of x => f(0, x)
18
18
//│ Type: ⊤
19
19
20
- fun mapi: [A, E] -> List[out A] -> ((Int, A) ->{E} A) ->{Alloc | E} List[out A]
20
+ fun mapi: [A, E] -> List[out A] -> ((Int, A) ->{E} A) ->{E} List[out A]
21
21
fun mapi = s => f =>
22
22
region r in
23
23
let i = r.ref 0
@@ -43,14 +43,14 @@ region r in
43
43
// * Should be an error. This definition would not be referentially transparent.
44
44
// * The error message needs improvement, though.
45
45
:e
46
- fun mapi: [A, E] -> List[out A] -> ((Int, A) ->{E} A) ->{Alloc | E} List[out A]
46
+ fun mapi: [A, E] -> List[out A] -> ((Int, A) ->{E} A) ->{E} List[out A]
47
47
fun mapi = s =>
48
48
region r in
49
49
let i = r.ref 0
50
50
f => map(s) of x =>
51
51
i := !i + 1
52
52
f(!i, x)
53
- //│ ╔══[ERROR] Type error in region expression with expected type ((Int, <A>55_2 ) ->{<E>56_2 } <A>55_2 ) ->{Alloc ∨ <E>56_2 } List[out <A>55_2 ]
53
+ //│ ╔══[ERROR] Type error in region expression with expected type ((Int, <A>54_2 ) ->{<E>55_2 } <A>54_2 ) ->{<E>55_2 } List[out <A>54_2 ]
54
54
//│ ║ l.49: let i = r.ref 0
55
55
//│ ║ ^^^^^^^
56
56
//│ ║ l.50: f => map(s) of x =>
@@ -59,15 +59,15 @@ fun mapi = s =>
59
59
//│ ║ ^^^^^^^^^^^^^^^^^
60
60
//│ ║ l.52: f(!i, x)
61
61
//│ ║ ^^^^^^^^^^^^^^
62
- //│ ╟── because: cannot constrain f71_2 ->{E79_2 } List[out B78_2 ] <: ((Int, <A>55_2 ) ->{<E>56_2 } <A>55_2 ) ->{Alloc ∨ <E>56_2 } List[out <A>55_2 ]
63
- //│ ╟── because: cannot constrain D( E79_2 ) <: Alloc ∨ <E>56_2
64
- //│ ╟── because: cannot constrain E79_2 <: ¬(~{Alloc} && ~ <E>56_2 )
65
- //│ ╟── because: cannot constrain ¬⊥ ∧ α80_2 <: ¬(~{Alloc} && ~ <E>56_2 )
66
- //│ ╟── because: cannot constrain α80_2 <: ¬(~{Alloc} && ~ <E>56_2 )
67
- //│ ╟── because: cannot constrain ¬⊥ ∧ r81_2 <: ¬(~{Alloc} && ~ <E>56_2 )
68
- //│ ╟── because: cannot constrain r81_2 <: ¬(~{Alloc} && ~ <E>56_2 )
69
- //│ ╙── because: cannot constrain <: ¬(~{Alloc} && ~ <E>56_2 )
70
- //│ ╔══[ERROR] Type error in region expression with expected type ((Int, <A>55_2 ) ->{<E>56_2 } <A>55_2 ) ->{Alloc ∨ <E>56_2 } List[out <A>55_2 ]
62
+ //│ ╟── because: cannot constrain f70_2 ->{E78_2 } List[out B77_2 ] <: ((Int, <A>54_2 ) ->{<E>55_2 } <A>54_2 ) ->{<E>55_2 } List[out <A>54_2 ]
63
+ //│ ╟── because: cannot constrain D( E78_2 ) <: <E>55_2
64
+ //│ ╟── because: cannot constrain E78_2 <: ¬(~<E>55_2 )
65
+ //│ ╟── because: cannot constrain ¬⊥ ∧ α79_2 <: ¬(~<E>55_2 )
66
+ //│ ╟── because: cannot constrain α79_2 <: ¬(~<E>55_2 )
67
+ //│ ╟── because: cannot constrain ¬⊥ ∧ r80_2 <: ¬(~<E>55_2 )
68
+ //│ ╟── because: cannot constrain r80_2 <: ¬(~<E>55_2 )
69
+ //│ ╙── because: cannot constrain <: ¬(~<E>55_2 )
70
+ //│ ╔══[ERROR] Type error in region expression with expected type ((Int, <A>54_2 ) ->{<E>55_2 } <A>54_2 ) ->{<E>55_2 } List[out <A>54_2 ]
71
71
//│ ║ l.49: let i = r.ref 0
72
72
//│ ║ ^^^^^^^
73
73
//│ ║ l.50: f => map(s) of x =>
@@ -76,15 +76,15 @@ fun mapi = s =>
76
76
//│ ║ ^^^^^^^^^^^^^^^^^
77
77
//│ ║ l.52: f(!i, x)
78
78
//│ ║ ^^^^^^^^^^^^^^
79
- //│ ╟── because: cannot constrain f71_2 ->{E79_2 } List[out B78_2 ] <: ((Int, <A>55_2 ) ->{<E>56_2 } <A>55_2 ) ->{Alloc ∨ <E>56_2 } List[out <A>55_2 ]
80
- //│ ╟── because: cannot constrain D( E79_2 ) <: Alloc ∨ <E>56_2
81
- //│ ╟── because: cannot constrain E79_2 <: ¬(~{Alloc} && ~ <E>56_2 )
82
- //│ ╟── because: cannot constrain ¬⊥ ∧ α80_2 <: ¬(~{Alloc} && ~ <E>56_2 )
83
- //│ ╟── because: cannot constrain α80_2 <: ¬(~{Alloc} && ~ <E>56_2 )
84
- //│ ╟── because: cannot constrain ¬⊥ ∧ r81_2 <: ¬(~{Alloc} && ~ <E>56_2 )
85
- //│ ╟── because: cannot constrain r81_2 <: ¬(~{Alloc} && ~ <E>56_2 )
86
- //│ ╙── because: cannot constrain <: ¬(~{Alloc} && ~ <E>56_2 )
87
- //│ ╔══[ERROR] Type error in region expression with expected type ((Int, <A>55_2 ) ->{<E>56_2 } <A>55_2 ) ->{Alloc ∨ <E>56_2 } List[out <A>55_2 ]
79
+ //│ ╟── because: cannot constrain f70_2 ->{E78_2 } List[out B77_2 ] <: ((Int, <A>54_2 ) ->{<E>55_2 } <A>54_2 ) ->{<E>55_2 } List[out <A>54_2 ]
80
+ //│ ╟── because: cannot constrain D( E78_2 ) <: <E>55_2
81
+ //│ ╟── because: cannot constrain E78_2 <: ¬(~<E>55_2 )
82
+ //│ ╟── because: cannot constrain ¬⊥ ∧ α79_2 <: ¬(~<E>55_2 )
83
+ //│ ╟── because: cannot constrain α79_2 <: ¬(~<E>55_2 )
84
+ //│ ╟── because: cannot constrain ¬⊥ ∧ r80_2 <: ¬(~<E>55_2 )
85
+ //│ ╟── because: cannot constrain r80_2 <: ¬(~<E>55_2 )
86
+ //│ ╙── because: cannot constrain <: ¬(~<E>55_2 )
87
+ //│ ╔══[ERROR] Type error in region expression with expected type ((Int, <A>54_2 ) ->{<E>55_2 } <A>54_2 ) ->{<E>55_2 } List[out <A>54_2 ]
88
88
//│ ║ l.49: let i = r.ref 0
89
89
//│ ║ ^^^^^^^
90
90
//│ ║ l.50: f => map(s) of x =>
@@ -93,28 +93,14 @@ fun mapi = s =>
93
93
//│ ║ ^^^^^^^^^^^^^^^^^
94
94
//│ ║ l.52: f(!i, x)
95
95
//│ ║ ^^^^^^^^^^^^^^
96
- //│ ╟── because: cannot constrain f71_2 ->{E79_2} List[out B78_2] <: ((Int, <A>55_2) ->{<E>56_2} <A>55_2) ->{Alloc ∨ <E>56_2} List[out <A>55_2]
97
- //│ ╟── because: cannot constrain D( E79_2 ) <: Alloc ∨ <E>56_2
98
- //│ ╟── because: cannot constrain E79_2 <: ¬(~{Alloc} && ~<E>56_2)
99
- //│ ╟── because: cannot constrain ¬⊥ ∧ α80_2 <: ¬(~{Alloc} && ~<E>56_2)
100
- //│ ╟── because: cannot constrain α80_2 <: ¬(~{Alloc} && ~<E>56_2)
101
- //│ ╟── because: cannot constrain ¬⊥ ∧ r81_2 <: ¬(~{Alloc} && ~<E>56_2)
102
- //│ ╟── because: cannot constrain r81_2 <: ¬(~{Alloc} && ~<E>56_2)
103
- //│ ╙── because: cannot constrain <: ¬(~{Alloc} && ~<E>56_2)
104
- //│ ╔══[ERROR] Type error in function literal with expected type (List[out <A>55_2]) ->{⊥} ((Int, <A>55_2) ->{<E>56_2} <A>55_2) ->{Alloc ∨ <E>56_2} List[out <A>55_2]
105
- //│ ║ l.47: fun mapi = s =>
106
- //│ ║ ^^^^
107
- //│ ║ l.48: region r in
108
- //│ ║ ^^^^^^^^^^^^^
109
- //│ ║ l.49: let i = r.ref 0
110
- //│ ║ ^^^^^^^^^^^^^^^^^^^
111
- //│ ║ l.50: f => map(s) of x =>
112
- //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^
113
- //│ ║ l.51: i := !i + 1
114
- //│ ║ ^^^^^^^^^^^^^^^^^
115
- //│ ║ l.52: f(!i, x)
116
- //│ ║ ^^^^^^^^^^^^^^
117
- //│ ╙── because: cannot constrain α70_2 ∨ Alloc <: ⊥
96
+ //│ ╟── because: cannot constrain f70_2 ->{E78_2} List[out B77_2] <: ((Int, <A>54_2) ->{<E>55_2} <A>54_2) ->{<E>55_2} List[out <A>54_2]
97
+ //│ ╟── because: cannot constrain D( E78_2 ) <: <E>55_2
98
+ //│ ╟── because: cannot constrain E78_2 <: ¬(~<E>55_2)
99
+ //│ ╟── because: cannot constrain ¬⊥ ∧ α79_2 <: ¬(~<E>55_2)
100
+ //│ ╟── because: cannot constrain α79_2 <: ¬(~<E>55_2)
101
+ //│ ╟── because: cannot constrain ¬⊥ ∧ r80_2 <: ¬(~<E>55_2)
102
+ //│ ╟── because: cannot constrain r80_2 <: ¬(~<E>55_2)
103
+ //│ ╙── because: cannot constrain <: ¬(~<E>55_2)
118
104
//│ Type: ⊤
119
105
120
106
0 commit comments