@effekt-lang/effekt 0.67.0 → 0.69.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/effekt CHANGED
Binary file
@@ -60,7 +60,6 @@ extern def unsafeAllocate[T](size: Int) at global: Array[T] =
60
60
  %ret_pos = insertvalue %Pos { i64 0, ptr poison }, ptr %calloc, 1
61
61
  ret %Pos %ret_pos
62
62
  """
63
- vm "array::unsafeAllocate(Int)"
64
63
 
65
64
  /// Fills a given array in-place.
66
65
  def fill[T](arr: Array[T], filler: T): Unit = {
@@ -99,7 +98,6 @@ extern def size[T](arr: Array[T]) at {}: Int =
99
98
  tail call void @erasePositive(%Pos ${arr})
100
99
  ret i64 %size
101
100
  """
102
- vm "array::size[T](Array[T])"
103
101
 
104
102
  extern llvm """
105
103
  define void @assertInbounds(i64 %index, %Pos %arr) alwaysinline {
@@ -141,7 +139,6 @@ extern def get[T](arr: Array[T], index: Int) at global: T =
141
139
  tail call void @erasePositive(%Pos ${arr})
142
140
  ret %Pos %element
143
141
  """
144
- vm "array::get[T](Array[T], Int)"
145
142
 
146
143
  extern js """
147
144
  function array$set(arr, index, value) {
@@ -168,7 +165,6 @@ extern def set[T](arr: Array[T], index: Int, value: T) at global: Unit =
168
165
  tail call void @erasePositive(%Pos ${arr})
169
166
  ret %Pos zeroinitializer
170
167
  """
171
- vm "array::set[T](Array[T], Int, T)"
172
168
 
173
169
  // Derived operations:
174
170
 
@@ -38,7 +38,6 @@ extern def allocate(size: Int) at global: ByteArray =
38
38
  ret %Pos %ret_object2
39
39
  """
40
40
  chez "(make-bytevector ${size})"
41
- vm "bytearray::allocate(Int)"
42
41
 
43
42
  extern def size(arr: ByteArray) at {}: Int =
44
43
  js "${arr}.length"
@@ -48,7 +47,6 @@ extern def size(arr: ByteArray) at {}: Int =
48
47
  ret i64 %size
49
48
  """
50
49
  chez "(bytevector-length ${arr})"
51
- vm "bytearray::size(ByteArray)"
52
50
 
53
51
  extern js """
54
52
  function bytearray$get(arr, index) {
@@ -82,7 +80,6 @@ extern def get(arr: ByteArray, index: Int) at global: Byte =
82
80
  ret i8 %element
83
81
  """
84
82
  chez "(bytevector-u8-ref ${arr} ${index})"
85
- vm "bytearray::get(ByteArray, Int)"
86
83
 
87
84
  extern def set(arr: ByteArray, index: Int, value: Byte) at global: Unit =
88
85
  js "bytearray$set(${arr}, ${index}, ${value})"
@@ -96,7 +93,6 @@ extern def set(arr: ByteArray, index: Int, value: Byte) at global: Unit =
96
93
  ret %Pos zeroinitializer
97
94
  """
98
95
  chez "(bytevector-u8-set! ${arr} ${index} ${value})"
99
- vm "bytearray::set(ByteArray, Int, Byte)"
100
96
 
101
97
  /// Creates a new ByteArray of size `size` filled with the value `init`
102
98
  def bytearray(size: Int, init: Byte): ByteArray = {
@@ -184,7 +180,6 @@ extern def fromString(str: String) at {}: ByteArray =
184
180
  ret %Pos ${str}
185
181
  """
186
182
  chez "(string->utf8 ${str})"
187
- vm "bytearray::fromString(String)"
188
183
 
189
184
  extern def toString(arr: ByteArray) at {}: String =
190
185
  js "(new TextDecoder('utf-8').decode(${arr}))"
@@ -193,7 +188,6 @@ extern def toString(arr: ByteArray) at {}: String =
193
188
  ret %Pos ${arr}
194
189
  """
195
190
  chez "(utf8->string ${arr})"
196
- vm "bytearray::toString(ByteArray)"
197
191
 
198
192
  extern js """
199
193
  function bytearray$set(bytes, index, value) {
@@ -247,7 +241,6 @@ extern def compareByteArrayImpl(b1: ByteArray, b2: ByteArray) at {}: Int =
247
241
  ret %Int %x
248
242
  """
249
243
  chez "(bytearray$compare ${b1} ${b2})"
250
- vm "bytearray::compare(ByteArray, ByteArray)"
251
244
 
252
245
  def compareByteArray(b1: ByteArray, b2: ByteArray): Ordering = {
253
246
  val ret = compareByteArrayImpl(b1, b2)
@@ -97,13 +97,11 @@ extern def toInt(ch: Char) at {}: Int =
97
97
  js "${ch}"
98
98
  chez "${ch}"
99
99
  llvm "ret %Int ${ch}"
100
- vm "string::toInt(Char)"
101
100
 
102
101
  extern def toChar(codepoint: Int) at {}: Char =
103
102
  js "${codepoint}"
104
103
  chez "${codepoint}"
105
104
  llvm "ret %Int ${codepoint}"
106
- vm "string::toChar(Int)"
107
105
 
108
106
 
109
107
  extern def infixLt(x: Char, y: Char) at {}: Bool =
@@ -115,7 +113,6 @@ extern def infixLt(x: Char, y: Char) at {}: Bool =
115
113
  %adt_boolean = insertvalue %Pos zeroinitializer, i64 %fat_z, 0
116
114
  ret %Pos %adt_boolean
117
115
  """
118
- vm "string::infixLt(Char, Char)"
119
116
 
120
117
  extern def infixLte(x: Char, y: Char) at {}: Bool =
121
118
  js "(${x} <= ${y})"
@@ -126,7 +123,6 @@ extern def infixLte(x: Char, y: Char) at {}: Bool =
126
123
  %adt_boolean = insertvalue %Pos zeroinitializer, i64 %fat_z, 0
127
124
  ret %Pos %adt_boolean
128
125
  """
129
- vm "string::infixLte(Char, Char)"
130
126
 
131
127
  extern def infixGt(x: Char, y: Char) at {}: Bool =
132
128
  js "(${x} > ${y})"
@@ -137,7 +133,6 @@ extern def infixGt(x: Char, y: Char) at {}: Bool =
137
133
  %adt_boolean = insertvalue %Pos zeroinitializer, i64 %fat_z, 0
138
134
  ret %Pos %adt_boolean
139
135
  """
140
- vm "string::infixGt(Char, Char)"
141
136
 
142
137
  extern def infixGte(x: Char, y: Char) at {}: Bool =
143
138
  js "(${x} >= ${y})"
@@ -148,7 +143,6 @@ extern def infixGte(x: Char, y: Char) at {}: Bool =
148
143
  %adt_boolean = insertvalue %Pos zeroinitializer, i64 %fat_z, 0
149
144
  ret %Pos %adt_boolean
150
145
  """
151
- vm "string::infixGte(Char, Char)"
152
146
 
153
147
 
154
148
  /**
@@ -46,7 +46,6 @@ extern def print(value: String): Unit =
46
46
  call void @c_io_print(%Pos ${value})
47
47
  ret %Pos zeroinitializer ; Unit
48
48
  """
49
- vm "effekt::print(String)"
50
49
 
51
50
  extern def println(value: String): Unit =
52
51
  js "$effekt.println(${value})"
@@ -55,7 +54,6 @@ extern def println(value: String): Unit =
55
54
  call void @c_io_println(%Pos ${value})
56
55
  ret %Pos zeroinitializer ; Unit
57
56
  """
58
- vm "effekt::println(String)"
59
57
 
60
58
  extern jsNode """
61
59
  $effekt.readln = function readln$impl(callback) {
@@ -92,7 +90,6 @@ extern def showBuiltin(value: Int) at {}: String =
92
90
  %z = call %Pos @c_bytearray_show_Int(%Int ${value})
93
91
  ret %Pos %z
94
92
  """
95
- vm "effekt::show(Int)"
96
93
 
97
94
  extern def showBuiltin(value: Double) at {}: String =
98
95
  js "'' + ${value}"
@@ -101,7 +98,6 @@ extern def showBuiltin(value: Double) at {}: String =
101
98
  %z = call %Pos @c_bytearray_show_Double(%Double ${value})
102
99
  ret %Pos %z
103
100
  """
104
- vm "effekt::show(Double)"
105
101
 
106
102
  extern def showBuiltin(value: Char) at {}: String =
107
103
  js "String.fromCodePoint(${value})"
@@ -110,7 +106,6 @@ extern def showBuiltin(value: Char) at {}: String =
110
106
  %z = call %Pos @c_bytearray_show_Char(%Int ${value})
111
107
  ret %Pos %z
112
108
  """
113
- vm "effekt::show(Char)"
114
109
 
115
110
  extern def showBuiltin(value: Byte) at {}: String =
116
111
  js "'0x' + ${value}.toString(16).toUpperCase().padStart(2, '0')"
@@ -119,11 +114,9 @@ extern def showBuiltin(value: Byte) at {}: String =
119
114
  %z = call %Pos @c_bytearray_show_Byte(%Byte ${value})
120
115
  ret %Pos %z
121
116
  """
122
- vm "effekt::show(Byte)"
123
117
 
124
118
  extern def inspect[R](value: R) at io: Unit =
125
119
  default { println(show(value)) }
126
- vm "effekt::inspect(Any)"
127
120
 
128
121
  /// A fatal runtime error that cannot be caught
129
122
  extern def panic(msg: String) at io: Nothing =
@@ -135,11 +128,16 @@ extern def panic(msg: String) at io: Nothing =
135
128
  ret %Pos zeroinitializer ; Unit
136
129
  """
137
130
 
138
- extern def show[R](value: R) at {}: String =
131
+ /// A show function structurally generated by the compiler for any type.
132
+ extern def generated::show[R](value: R) at {}: String =
139
133
  js "undefined"
140
134
  chez "(void)"
141
135
  llvm "ret %Pos poison"
142
136
 
137
+ /// Returns a textual representation of a value for debugging purposes.
138
+ /// The output is backend-specific, works only on JS and Chez backends.
139
+ ///
140
+ /// Prefer using `show` instead when possible.
143
141
  extern def genericShow[R](value: R) at {}: String =
144
142
  js "$effekt.show(${value})"
145
143
  chez "(show_impl ${value})"
@@ -153,7 +151,6 @@ extern def infixPlusPlus(s1: String, s2: String) at {}: String =
153
151
  %spz = call %Pos @c_bytearray_concatenate(%Pos ${s1}, %Pos ${s2})
154
152
  ret %Pos %spz
155
153
  """
156
- vm "effekt::infixPlusPlus(String, String)"
157
154
 
158
155
  extern def length(str: String) at {}: Int =
159
156
  js "${str}.length"
@@ -162,7 +159,6 @@ extern def length(str: String) at {}: Int =
162
159
  %x = call %Int @c_bytearray_size(%Pos ${str})
163
160
  ret %Int %x
164
161
  """
165
- vm "effekt::length(String)"
166
162
 
167
163
  extern def unsafeSubstring(str: String, from: Int, to: Int) at {}: String =
168
164
  js "${str}.substring(${from}, ${to})"
@@ -171,7 +167,6 @@ extern def unsafeSubstring(str: String, from: Int, to: Int) at {}: String =
171
167
  %x = call %Pos @c_bytearray_substring(%Pos ${str}, i64 ${from}, i64 ${to})
172
168
  ret %Pos %x
173
169
  """
174
- vm "effekt::substring(String, Int, Int)"
175
170
 
176
171
 
177
172
  // Side effecting ops
@@ -184,7 +179,6 @@ extern def random() at io: Double =
184
179
  %r = call double @c_io_random()
185
180
  ret double %r
186
181
  """
187
- vm "effekt::random()"
188
182
 
189
183
  // References and state
190
184
  // ====================
@@ -253,7 +247,6 @@ extern def infixEq(x: Int, y: Int) at {}: Bool =
253
247
  %adt_boolean = insertvalue %Pos zeroinitializer, i64 %fat_z, 0
254
248
  ret %Pos %adt_boolean
255
249
  """
256
- vm "effekt::infixEq(Int, Int)"
257
250
 
258
251
  extern def infixNeq(x: Int, y: Int) at {}: Bool =
259
252
  js "${x} !== ${y}"
@@ -264,7 +257,6 @@ extern def infixNeq(x: Int, y: Int) at {}: Bool =
264
257
  %adt_boolean = insertvalue %Pos zeroinitializer, i64 %fat_z, 0
265
258
  ret %Pos %adt_boolean
266
259
  """
267
- vm "effekt::infixNeq(Int, Int)"
268
260
 
269
261
  extern def infixEq(x: Char, y: Char) at {}: Bool =
270
262
  js "${x} === ${y}"
@@ -275,7 +267,6 @@ extern def infixEq(x: Char, y: Char) at {}: Bool =
275
267
  %adt_boolean = insertvalue %Pos zeroinitializer, i64 %fat_z, 0
276
268
  ret %Pos %adt_boolean
277
269
  """
278
- vm "effekt::infixEq(Char, Char)"
279
270
 
280
271
  extern def infixNeq(x: Char, y: Char) at {}: Bool =
281
272
  js "${x} !== ${y}"
@@ -294,7 +285,6 @@ extern def infixEq(x: String, y: String) at {}: Bool =
294
285
  %res = call %Pos @c_bytearray_equal(%Pos ${x}, %Pos ${y})
295
286
  ret %Pos %res
296
287
  """
297
- vm "effekt::infixEq(String, String)"
298
288
 
299
289
  def infixNeq(x: String, y: String): Bool = not(x == y)
300
290
 
@@ -309,7 +299,6 @@ extern def infixEq(x: Bool, y: Bool) at {}: Bool =
309
299
  %adt_boolean = insertvalue %Pos zeroinitializer, i64 %fat_z, 0
310
300
  ret %Pos %adt_boolean
311
301
  """
312
- vm "effekt::infixEq(Bool, Bool)"
313
302
 
314
303
  extern def infixNeq(x: Bool, y: Bool) at {}: Bool =
315
304
  js "${x} !== ${y}"
@@ -332,7 +321,6 @@ extern def infixEq(x: Byte, y: Byte) at {}: Bool =
332
321
  %adt_boolean = insertvalue %Pos zeroinitializer, i64 %fat_z, 0
333
322
  ret %Pos %adt_boolean
334
323
  """
335
- vm "effekt::infixEq(Byte, Byte)"
336
324
 
337
325
  extern def infixNeq(x: Byte, y: Byte) at {}: Bool =
338
326
  js "${x} !== ${y}"
@@ -343,7 +331,6 @@ extern def infixNeq(x: Byte, y: Byte) at {}: Bool =
343
331
  %adt_boolean = insertvalue %Pos zeroinitializer, i64 %fat_z, 0
344
332
  ret %Pos %adt_boolean
345
333
  """
346
- vm "effekt::infixNeq(Byte, Byte)"
347
334
 
348
335
  // Math ops
349
336
  // ========
@@ -351,85 +338,71 @@ extern def infixPlus(x: Int, y: Int) at {}: Int =
351
338
  js "(${x} + ${y})"
352
339
  chez "(+ ${x} ${y})"
353
340
  llvm "%z = add %Int ${x}, ${y} ret %Int %z"
354
- vm "effekt::infixPlus(Int, Int)"
355
341
 
356
342
  extern def infixStar(x: Int, y: Int) at {}: Int =
357
343
  js "(${x} * ${y})"
358
344
  chez "(* ${x} ${y})"
359
345
  llvm "%z = mul %Int ${x}, ${y} ret %Int %z"
360
- vm "effekt::infixStar(Int, Int)"
361
346
 
362
347
  extern def infixSlash(x: Int, y: Int) at {}: Int =
363
348
  js "Math.floor(${x} / ${y})"
364
349
  chez "(floor (/ ${x} ${y}))"
365
350
  llvm "%z = sdiv %Int ${x}, ${y} ret %Int %z"
366
- vm "effekt::infixSlash(Int, Int)"
367
351
 
368
352
  extern def infixMinus(x: Int, y: Int) at {}: Int =
369
353
  js "(${x} - ${y})"
370
354
  chez "(- ${x} ${y})"
371
355
  llvm "%z = sub %Int ${x}, ${y} ret %Int %z"
372
- vm "effekt::infixMinus(Int, Int)"
373
356
 
374
357
  extern def mod(x: Int, y: Int) at {}: Int =
375
358
  js "(${x} % ${y})"
376
359
  chez "(modulo ${x} ${y})"
377
360
  llvm "%z = srem %Int ${x}, ${y} ret %Int %z"
378
- vm "effekt::mod(Int, Int)"
379
361
 
380
362
  extern def infixPlus(x: Double, y: Double) at {}: Double =
381
363
  js "(${x} + ${y})"
382
364
  chez "(+ ${x} ${y})"
383
365
  llvm "%z = fadd %Double ${x}, ${y} ret %Double %z"
384
- vm "effekt::infixPlus(Double, Double)"
385
366
 
386
367
  extern def infixStar(x: Double, y: Double) at {}: Double =
387
368
  js "(${x} * ${y})"
388
369
  chez "(* ${x} ${y})"
389
370
  llvm "%z = fmul %Double ${x}, ${y} ret %Double %z"
390
- vm "effekt::infixStar(Double, Double)"
391
371
 
392
372
  extern def infixMinus(x: Double, y: Double) at {}: Double =
393
373
  js "(${x} - ${y})"
394
374
  chez "(- ${x} ${y})"
395
375
  llvm "%z = fsub %Double ${x}, ${y} ret %Double %z"
396
- vm "effekt::infixMinus(Double, Double)"
397
376
 
398
377
  extern def infixSlash(x: Double, y: Double) at {}: Double =
399
378
  js "(${x} / ${y})"
400
379
  chez "(fl/ ${x} ${y})"
401
380
  llvm "%z = fdiv %Double ${x}, ${y} ret %Double %z"
402
- vm "effekt::infixSlash(Double, Double)"
403
381
 
404
382
  extern def cos(x: Double) at {}: Double =
405
383
  js "Math.cos(${x})"
406
384
  chez "(cos ${x})"
407
- vm "effekt::cos(Double)"
408
385
  llvm "%z = call %Double @llvm.cos.f64(double ${x}) ret %Double %z"
409
386
 
410
387
  extern def sin(x: Double) at {}: Double =
411
388
  js "Math.sin(${x})"
412
389
  chez "(sin ${x})"
413
- vm "effekt::sin(Double)"
414
390
  llvm "%z = call %Double @llvm.sin.f64(double ${x}) ret %Double %z"
415
391
 
416
392
  extern def atan(x: Double) at {}: Double =
417
393
  js "Math.atan(${x})"
418
394
  chez "(atan ${x})"
419
- vm "effekt::atan(Double)"
420
395
  llvm "%z = call %Double @atan(double ${x}) ret %Double %z"
421
396
 
422
397
  extern def tan(x: Double) at {}: Double =
423
398
  js "Math.tan(${x})"
424
399
  chez "(tan ${x})"
425
- vm "effekt::tan(Double)"
426
400
  llvm "%z = call %Double @tan(double ${x}) ret %Double %z"
427
401
 
428
402
  extern def sqrt(x: Double) at {}: Double =
429
403
  js "Math.sqrt(${x})"
430
404
  chez "(sqrt ${x})"
431
405
  llvm "%z = call %Double @llvm.sqrt.f64(double ${x}) ret %Double %z"
432
- vm "effekt::sqrt(Double)"
433
406
 
434
407
  def square(x: Double): Double = x * x
435
408
 
@@ -448,7 +421,6 @@ def abs(n: Double): Double =
448
421
  extern def log(x: Double) at {}: Double =
449
422
  js "Math.log(${x})"
450
423
  chez "(log ${x})"
451
- vm "effekt::log(Double)"
452
424
  llvm "%z = call %Double @llvm.log.f64(double ${x}) ret %Double %z"
453
425
 
454
426
  extern def log1p(x: Double) at {}: Double =
@@ -459,7 +431,6 @@ extern def log1p(x: Double) at {}: Double =
459
431
  extern def exp(x: Double) at {}: Double =
460
432
  js "Math.exp(${x})"
461
433
  chez "(exp ${x})"
462
- vm "effekt::exp(Double)"
463
434
  llvm "%z = call %Double @llvm.exp.f64(double ${x}) ret %Double %z"
464
435
 
465
436
  def pow(base: Double, exponent: Int): Double = {
@@ -478,14 +449,12 @@ def pow(base: Double, exponent: Int): Double = {
478
449
  extern def pow(base: Double, exponent: Double) at {}: Double =
479
450
  js "Math.pow(${base}, ${exponent})"
480
451
  chez "(expt ${base} ${exponent})"
481
- vm "effekt::pow(Double, Double)"
482
452
  llvm "%z = call %Double @llvm.pow.f64(double ${base}, double ${exponent}) ret %Double %z"
483
453
 
484
454
  // since we do not have "extern val", yet
485
455
  extern def _pi() at {}: Double =
486
456
  js "Math.PI"
487
457
  chez "(* 4 (atan 1))"
488
- vm "effekt::pi()"
489
458
  llvm "ret double 3.14159265358979323846264338327950288419716939937510582097494459"
490
459
 
491
460
  val PI: Double = _pi()
@@ -494,13 +463,11 @@ extern def toInt(d: Double) at {}: Int =
494
463
  js "Math.trunc(${d})"
495
464
  chez "(flonum->fixnum ${d})"
496
465
  llvm "%z = fptosi double ${d} to %Int ret %Int %z"
497
- vm "effekt::toInt(Double)"
498
466
 
499
467
  extern def toDouble(d: Int) at {}: Double =
500
468
  js "${d}"
501
469
  chez "(fixnum->flonum ${d})"
502
470
  llvm "%z = sitofp i64 ${d} to double ret double %z"
503
- vm "effekt::toDouble(Int)"
504
471
 
505
472
 
506
473
  extern def round(d: Double) at {}: Int =
@@ -510,7 +477,6 @@ extern def round(d: Double) at {}: Int =
510
477
  %i = call %Double @llvm.round.f64(double ${d})
511
478
  %z = fptosi double %i to %Int ret %Int %z
512
479
  """
513
- vm "effekt::round(Double)"
514
480
 
515
481
  def round(d: Double, digits: Int): Double = {
516
482
  val factor = pow(10.0, digits)
@@ -555,7 +521,6 @@ extern def infixLt(x: Int, y: Int) at {}: Bool =
555
521
  %adt_boolean = insertvalue %Pos zeroinitializer, i64 %fat_z, 0
556
522
  ret %Pos %adt_boolean
557
523
  """
558
- vm "effekt::infixLt(Int, Int)"
559
524
 
560
525
  extern def infixLte(x: Int, y: Int) at {}: Bool =
561
526
  js "(${x} <= ${y})"
@@ -566,7 +531,6 @@ extern def infixLte(x: Int, y: Int) at {}: Bool =
566
531
  %adt_boolean = insertvalue %Pos zeroinitializer, i64 %fat_z, 0
567
532
  ret %Pos %adt_boolean
568
533
  """
569
- vm "effekt::infixLte(Int, Int)"
570
534
 
571
535
  extern def infixGt(x: Int, y: Int) at {}: Bool =
572
536
  js "(${x} > ${y})"
@@ -577,7 +541,6 @@ extern def infixGt(x: Int, y: Int) at {}: Bool =
577
541
  %adt_boolean = insertvalue %Pos zeroinitializer, i64 %fat_z, 0
578
542
  ret %Pos %adt_boolean
579
543
  """
580
- vm "effekt::infixGt(Int, Int)"
581
544
 
582
545
  extern def infixGte(x: Int, y: Int) at {}: Bool =
583
546
  js "(${x} >= ${y})"
@@ -588,17 +551,14 @@ extern def infixGte(x: Int, y: Int) at {}: Bool =
588
551
  %adt_boolean = insertvalue %Pos zeroinitializer, i64 %fat_z, 0
589
552
  ret %Pos %adt_boolean
590
553
  """
591
- vm "effekt::infixGte(Int, Int)"
592
554
 
593
555
  extern def infixEq(x: Double, y: Double) at {}: Bool =
594
556
  js "${x} === ${y}"
595
557
  chez "(= ${x} ${y})"
596
- vm "effekt::infixEq(Double, Double)"
597
558
 
598
559
  extern def infixNeq(x: Double, y: Double) at {}: Bool =
599
560
  js "${x} !== ${y}"
600
561
  chez "(not (= ${x} ${y}))"
601
- vm "effekt::infixNeq(Double, Double)"
602
562
 
603
563
  extern def infixLt(x: Double, y: Double) at {}: Bool =
604
564
  js "(${x} < ${y})"
@@ -609,12 +569,10 @@ extern def infixLt(x: Double, y: Double) at {}: Bool =
609
569
  %adt_boolean = insertvalue %Pos zeroinitializer, i64 %fat_z, 0
610
570
  ret %Pos %adt_boolean
611
571
  """
612
- vm "effekt::infixLt(Double, Double)"
613
572
 
614
573
  extern def infixLte(x: Double, y: Double) at {}: Bool =
615
574
  js "(${x} <= ${y})"
616
575
  chez "(<= ${x} ${y})"
617
- vm "effekt::infixLte(Double, Double)"
618
576
 
619
577
  extern def infixGt(x: Double, y: Double) at {}: Bool =
620
578
  js "(${x} > ${y})"
@@ -625,12 +583,10 @@ extern def infixGt(x: Double, y: Double) at {}: Bool =
625
583
  %adt_boolean = insertvalue %Pos zeroinitializer, i64 %fat_z, 0
626
584
  ret %Pos %adt_boolean
627
585
  """
628
- vm "effekt::infixGt(Double, Double)"
629
586
 
630
587
  extern def infixGte(x: Double, y: Double) at {}: Bool =
631
588
  js "(${x} >= ${y})"
632
589
  chez "(>= ${x} ${y})"
633
- vm "effekt::infixGte(Double, Double)"
634
590
 
635
591
  // TODO do we really need those? if yes, move to string.effekt
636
592
  extern def infixLt(x: String, y: String) at {}: Bool =
@@ -661,7 +617,6 @@ extern def not(b: Bool) at {}: Bool =
661
617
  %adt_q = insertvalue %Pos zeroinitializer, i64 %q, 0
662
618
  ret %Pos %adt_q
663
619
  """
664
- vm "effekt::not(Bool)"
665
620
 
666
621
  def infixBarBar { first: => Bool } { second: => Bool }: Bool =
667
622
  if (first()) true else second()
@@ -678,38 +633,32 @@ extern def bitwiseShl(x: Int, y: Int) at {}: Int =
678
633
  js "(${x} << ${y})"
679
634
  chez "(ash ${x} ${y})"
680
635
  llvm "%z = shl %Int ${x}, ${y} ret %Int %z"
681
- vm "effekt::bitwiseShl(Int, Int)"
682
636
 
683
637
  /// Arithmetic right shift
684
638
  extern def bitwiseShr(x: Int, y: Int) at {}: Int =
685
639
  js "(${x} >> ${y})"
686
640
  chez "(ash ${x} (- ${y}))"
687
641
  llvm "%z = ashr %Int ${x}, ${y} ret %Int %z"
688
- vm "effekt::bitwiseShr(Int, Int)"
689
642
 
690
643
  extern def bitwiseAnd(x: Int, y: Int) at {}: Int =
691
644
  js "(${x} & ${y})"
692
645
  chez "(logand ${x} ${y})"
693
646
  llvm "%z = and %Int ${x}, ${y} ret %Int %z"
694
- vm "effekt::bitwiseAnd(Int, Int)"
695
647
 
696
648
  extern def bitwiseOr(x: Int, y: Int) at {}: Int =
697
649
  js "(${x} | ${y})"
698
650
  chez "(logior ${x} ${y})"
699
651
  llvm "%z = or %Int ${x}, ${y} ret %Int %z"
700
- vm "effekt::bitwiseOr(Int, Int)"
701
652
 
702
653
  extern def bitwiseXor(x: Int, y: Int) at {}: Int =
703
654
  js "(${x} ^ ${y})"
704
655
  chez "(logxor ${x} ${y})"
705
656
  llvm "%z = xor %Int ${x}, ${y} ret %Int %z"
706
- vm "effekt::bitwiseXor(Int, Int)"
707
657
 
708
658
  extern def bitwiseNot(x: Int) at {}: Int =
709
659
  js "(~${x})"
710
660
  chez "(lognot ${x})"
711
661
  llvm "%z = xor %Int ${x}, -1 ret %Int %z"
712
- vm "effekt::bitwiseNot(Int)"
713
662
 
714
663
 
715
664
  // Byte operations
@@ -722,7 +671,6 @@ extern def toByte(n: Int) at {}: Byte =
722
671
  extern def toInt(n: Byte) at {}: Int =
723
672
  js "${n}"
724
673
  llvm "%z = zext %Byte ${n} to %Int ret %Int %z"
725
- vm "effekt::toInt(Byte)"
726
674
  chez "${n}"
727
675
 
728
676
 
@@ -739,13 +687,11 @@ extern def toInt(n: Byte) at {}: Int =
739
687
  extern def undefined[A]() at {}: A =
740
688
  js "undefined"
741
689
  chez "#f"
742
- vm "effekt::undefined()"
743
690
 
744
691
  /// Is an FFI value undefined?
745
692
  extern def isUndefined[A](value: A) at {}: Bool =
746
693
  js "(${value} === undefined || ${value} === null)"
747
694
  chez "(eq? ${value} #f)"
748
- vm "effekt::isUndefined[A](A)"
749
695
 
750
696
  // Ascription
751
697
  // ==========
@@ -842,4 +788,10 @@ effect write(s: String): Unit
842
788
 
843
789
  effect splice[A](x: A): Unit
844
790
 
791
+ // Source positions
792
+ // ================
793
+ //
794
+ // When adding an implicit value argument ?sourcePosition of this type, will have the information
795
+ // of the call site unless passed explicitly.
845
796
 
797
+ record SourcePosition(file: String, startLine: Int, startColumn: Int, endLine: Int, endColumn: Int)
@@ -72,7 +72,6 @@ extern def ref[T](init: T) at global: Ref[T] =
72
72
 
73
73
  ret %Pos %refWrap
74
74
  """
75
- vm "ref::ref[T](T)"
76
75
 
77
76
  /// Gets the referenced element of the `ref` in constant time.
78
77
  extern def get[T](ref: Ref[T]) at global: T =
@@ -88,7 +87,6 @@ llvm """
88
87
 
89
88
  ret %Pos %refField
90
89
  """
91
- vm "ref::get[T](Ref[T])"
92
90
 
93
91
  /// Sets the referenced element of the `ref` to `value` in constant time.
94
92
  extern def set[T](ref: Ref[T], value: T) at global: Unit =
@@ -106,7 +104,6 @@ extern def set[T](ref: Ref[T], value: T) at global: Unit =
106
104
 
107
105
  ret %Pos zeroinitializer
108
106
  """
109
- vm "ref::set[T](Ref[T], T)"
110
107
 
111
108
  /// Modifies the inner contents of the `ref` with a function `f`
112
109
  def map[T](ref: Ref[T]) { f: T => T }: Unit =
@@ -13,7 +13,6 @@ record Match(matched: String, index: Int)
13
13
  extern def regex(str: String) at {}: Regex =
14
14
  js "new RegExp(${str})"
15
15
  chez "(pregexp ${str})"
16
- vm "regex::regex(String)"
17
16
 
18
17
  def exec(reg: Regex, str: String): Option[Match] = {
19
18
  val v = internal::exec(reg, str)
@@ -34,12 +33,10 @@ namespace internal {
34
33
  extern def matched(r: RegexMatch) at {}: String =
35
34
  js "${r}.matched"
36
35
  chez "(vector-ref ${r} 0)"
37
- vm "regex::matched(RegexMatch)"
38
36
 
39
37
  extern def index(r: RegexMatch) at {}: Int =
40
38
  js "${r}.index"
41
39
  chez "(vector-ref ${r} 1)"
42
- vm "regex::index(RegexMatch)"
43
40
 
44
41
  extern js """
45
42
  function regex$exec(reg, str) {
@@ -62,5 +59,4 @@ namespace internal {
62
59
  extern def exec(reg: Regex, str: String) at io: RegexMatch =
63
60
  js "regex$exec(${reg}, ${str})"
64
61
  chez "(regex-exec ${reg} ${str})"
65
- vm "regex::exec(Regex, String)"
66
62
  }
@@ -231,7 +231,6 @@ extern def unsafeCharAt(str: String, n: Int) at {}: Char =
231
231
  %x = call %Int @c_bytearray_character_at(%Pos ${str}, %Int ${n})
232
232
  ret %Int %x
233
233
  """
234
- vm "string::unsafeCharAt(String, Int)"
235
234
 
236
235
 
237
236
  // Streaming
@@ -1,5 +1,5 @@
1
1
  <!doctype html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><title>Eclipse Public License 2.0 (EPL) | The Eclipse Foundation</title>
2
- <meta property="og:title" content="Eclipse Public License 2.0 (EPL) | The Eclipse Foundation"><meta name=twitter:title content="Eclipse Public License 2.0 (EPL) | The Eclipse Foundation"><meta name=description content="The Eclipse Foundation provides our global community of individuals and organisations with a mature, scalable, and business-friendly environment for open source …"><meta property="og:description" content="The Eclipse Foundation provides our global community of individuals and organisations with a mature, scalable, and business-friendly environment for open source …"><meta name=twitter:description content="The Eclipse Foundation provides our global community of individuals and organisations with a mature, scalable, and business-friendly environment for open source …"><meta name=author content="Wayne Beaton"><link href=/favicon.ico rel=icon type=image/x-icon><meta property="og:image" content="https://www.eclipse.org/images/og-image.jpg"><meta name=twitter:image content="https://www.eclipse.org/images/og-image.jpg"><meta name=twitter:card content="summary"><meta name=twitter:site content="@eclipsefdn"><meta name=twitter:creator content="@eclipsefdn"><meta property="og:url" content="https://www.eclipse.org/legal/epl-2.0/"><meta property="og:type" content="website"><meta property="og:site_name" content="Eclipse Foundation"><meta name=keywords content="epl,epl-2.0,legal,foundation,eclipse,eclipse public license,license,licenses"><meta name=generator content="Hugo 0.144.2"><link rel=canonical href=https://www.eclipse.org/legal/epl-2.0/><link rel=alternate href=/legal/epl-2.0/index.xml type=application/rss+xml title><link rel=stylesheet href="/public/css/styles.css?v=1776622808"><script>(function(e,t,n,s,o){e[s]=e[s]||[],e[s].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var a=t.getElementsByTagName(n)[0],i=t.createElement(n),r=s!="dataLayer"?"&l="+s:"";i.async=!0,i.src="https://www.googletagmanager.com/gtm.js?id="+o+r,a.parentNode.insertBefore(i,a)})(window,document,"script","dataLayer","GTM-5WLCZXC")</script><script>var tableClasses="table"</script><link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel=stylesheet type=text/css></head><body><noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-5WLCZXC" height=0 width=0 style=display:none;visibility:hidden></iframe></noscript><a href=#main class=skip-link>Skip to content</a><div class=eclipsefdn-featured-story-banner data-publish-target=eclipse_org></div><header class="header-wrapper header-wrapper" id=header><div class="navigation-bar dark"><div class=container><div class=navigation-bar-inner><div class=navigation-bar-left><a class="focus-highlight focus-inverse" href=/><img class=navigation-bar-brand src=https://www.eclipse.org/eclipse.org-common/themes/solstice/public/images/logo/eclipse-foundation-white-orange.svg alt="Eclipse Foundation"></a></div><nav class="navigation-bar-nav hidden-xs hidden-sm"><ul><li><button type=button class="btn btn-link" data-target=join-us-menu>Join us</button></li><li><button type=button class="btn btn-link" data-target=what-we-do-menu>What we do</button></li><li><button type=button class="btn btn-link" data-target=resources-menu>Resources</button></li><li><button type=button class="btn btn-link" data-target=about-us-menu>About us</button></li></ul></nav><div class=navigation-bar-right><div class="navigation-bar-controls hidden-xs hidden-sm"><ul><li class=dropdown><a class="dropdown-toggle link-unstyled focus-highlight" tabindex=0 id=search-dropdown-toggle data-toggle=dropdown href=# aria-label=Search><i class="fa-solid fa-magnifying-glass" aria-hidden=true></i></a><form class="search-bar dropdown-menu dropdown-menu-right" aria-labelledby=search-dropdown-toggle action=https://www.eclipse.org/home/search/ method=get><input class=search-bar-input name=q placeholder=Search>
2
+ <meta property="og:title" content="Eclipse Public License 2.0 (EPL) | The Eclipse Foundation"><meta name=twitter:title content="Eclipse Public License 2.0 (EPL) | The Eclipse Foundation"><meta name=description content="The Eclipse Foundation provides our global community of individuals and organisations with a mature, scalable, and business-friendly environment for open source …"><meta property="og:description" content="The Eclipse Foundation provides our global community of individuals and organisations with a mature, scalable, and business-friendly environment for open source …"><meta name=twitter:description content="The Eclipse Foundation provides our global community of individuals and organisations with a mature, scalable, and business-friendly environment for open source …"><meta name=author content="Wayne Beaton"><link href=/favicon.ico rel=icon type=image/x-icon><meta property="og:image" content="https://www.eclipse.org/images/og-image.jpg"><meta name=twitter:image content="https://www.eclipse.org/images/og-image.jpg"><meta name=twitter:card content="summary"><meta name=twitter:site content="@eclipsefdn"><meta name=twitter:creator content="@eclipsefdn"><meta property="og:url" content="https://www.eclipse.org/legal/epl-2.0/"><meta property="og:type" content="website"><meta property="og:site_name" content="Eclipse Foundation"><meta name=keywords content="epl,epl-2.0,legal,foundation,eclipse,eclipse public license,license,licenses"><meta name=generator content="Hugo 0.144.2"><link rel=canonical href=https://www.eclipse.org/legal/epl-2.0/><link rel=alternate href=/legal/epl-2.0/index.xml type=application/rss+xml title><link rel=stylesheet href="/public/css/styles.css?v=1777832386"><script>(function(e,t,n,s,o){e[s]=e[s]||[],e[s].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var a=t.getElementsByTagName(n)[0],i=t.createElement(n),r=s!="dataLayer"?"&l="+s:"";i.async=!0,i.src="https://www.googletagmanager.com/gtm.js?id="+o+r,a.parentNode.insertBefore(i,a)})(window,document,"script","dataLayer","GTM-5WLCZXC")</script><script>var tableClasses="table"</script><link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel=stylesheet type=text/css></head><body><noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-5WLCZXC" height=0 width=0 style=display:none;visibility:hidden></iframe></noscript><a href=#main class=skip-link>Skip to content</a><div class=eclipsefdn-featured-story-banner data-publish-target=eclipse_org></div><header class="header-wrapper header-wrapper" id=header><div class="navigation-bar dark"><div class=container><div class=navigation-bar-inner><div class=navigation-bar-left><a class="focus-highlight focus-inverse" href=/><img class=navigation-bar-brand src=https://www.eclipse.org/eclipse.org-common/themes/solstice/public/images/logo/eclipse-foundation-white-orange.svg alt="Eclipse Foundation"></a></div><nav class="navigation-bar-nav hidden-xs hidden-sm"><ul><li><button type=button class="btn btn-link" data-target=join-us-menu>Join us</button></li><li><button type=button class="btn btn-link" data-target=what-we-do-menu>What we do</button></li><li><button type=button class="btn btn-link" data-target=resources-menu>Resources</button></li><li><button type=button class="btn btn-link" data-target=about-us-menu>About us</button></li></ul></nav><div class=navigation-bar-right><div class="navigation-bar-controls hidden-xs hidden-sm"><ul><li class=dropdown><a class="dropdown-toggle link-unstyled focus-highlight" tabindex=0 id=search-dropdown-toggle data-toggle=dropdown href=# aria-label=Search><i class="fa-solid fa-magnifying-glass" aria-hidden=true></i></a><form class="search-bar dropdown-menu dropdown-menu-right" aria-labelledby=search-dropdown-toggle action=https://www.eclipse.org/home/search/ method=get><input class=search-bar-input name=q placeholder=Search>
3
3
  <button class="btn btn-link" type=submit>
4
4
  <i class="fa-solid fa-arrow-right"></i></button></form></li><li class=dropdown><a class="dropdown-toggle focus-highlight" id=user-menu href=# data-toggle=dropdown aria-haspopup=true aria-expanded=false tabindex=0><i class="fa-regular fa-user" aria-hidden=true></i></a><ul class="dropdown-menu dropdown-menu-right" aria-labelledby=user-menu><li><a href=https://accounts.eclipse.org/user><i class="fa-solid fa-user margin-right-10" aria-hidden=true></i>
5
5
  View my account</a></li><li><a href=https://accounts.eclipse.org/user/edit><i class="fa-solid fa-edit margin-right-10" aria-hidden=true></i>
@@ -43,4 +43,4 @@ Manage cookies</a></li></ul></li></ul></div><div class="navigation-bar-ctas hidd
43
43
  <i class="fa-brands fa-youtube fa-stack-1x fa-inverse" aria-hidden=true></i></span></a></li><li><a href=https://www.linkedin.com/company/eclipse-foundation aria-label=LinkedIn><span class=fa-stack><i class="fa-solid fa-circle fa-stack-2x" aria-hidden=true></i>
44
44
  <i class="fa-brands fa-linkedin-in fa-stack-1x fa-inverse" aria-hidden=true></i></span></a></li></ul></section><section class=newsletter-section><p class="subheading text-tertiary">Stay up to date</p><h2>Subscribe to our newsletter</h2><form class="newsletter-form margin-top-40" id=mc-embedded-subscribe-form action="https://eclipse.us6.list-manage.com/subscribe/post?u=eaf9e1f06f194eadc66788a85&amp;id=e7538485cd&amp;f_id=00f9c2e1f0" method=post novalidate target=_blank><div class=text-field-outlined><input name=EMAIL type=email placeholder="Your email">
45
45
  <button class=newsletter-form-submit type=submit name=subscribe id=mc-embedded-subscribe aria-label=Submit>
46
- <i class="fa-solid fa-arrow-right" aria-hidden=true></i></button></div></form></section><section class=footer-bottom-section><img class="img-responsive logo" src=https://www.eclipse.org/eclipse.org-common/themes/solstice/public/images/logo/eclipse-foundation-white.svg alt="Eclipse Foundation"><div class=legal-information><p>Copyright &copy; Eclipse Foundation AISBL. All rights reserved.</p><ul class=legal-links><li><a href=https://www.eclipse.org/legal/privacy/>Privacy policy</a></li><li><a href=https://www.eclipse.org/legal/terms-of-use/>Terms of use</a></li><li><a href=https://www.eclipse.org/legal/compliance/>Compliance</a></li><li><a href=https://www.eclipse.org/legal/>Legal</a></li></ul></div></section></div></div></footer><div id=footer-js><script src="/public/js/main.js?v1.0?v=1776622809"></script><script>(function(){})(jQuery,document)</script></div></body></html>
46
+ <i class="fa-solid fa-arrow-right" aria-hidden=true></i></button></div></form></section><section class=footer-bottom-section><img class="img-responsive logo" src=https://www.eclipse.org/eclipse.org-common/themes/solstice/public/images/logo/eclipse-foundation-white.svg alt="Eclipse Foundation"><div class=legal-information><p>Copyright &copy; Eclipse Foundation AISBL. All rights reserved.</p><ul class=legal-links><li><a href=https://www.eclipse.org/legal/privacy/>Privacy policy</a></li><li><a href=https://www.eclipse.org/legal/terms-of-use/>Terms of use</a></li><li><a href=https://www.eclipse.org/legal/compliance/>Compliance</a></li><li><a href=https://www.eclipse.org/legal/>Legal</a></li></ul></div></section></div></div></footer><div id=footer-js><script src="/public/js/main.js?v1.0?v=1777832386"></script><script>(function(){})(jQuery,document)</script></div></body></html>