Skip to content

Commit 4a505e0

Browse files
committed
updated to rescript-v12.0.0-alpha.9
1 parent 13fe336 commit 4a505e0

11 files changed

+22
-43
lines changed

__tests__/Array_Test.res

+3-17
Original file line numberDiff line numberDiff line change
@@ -77,23 +77,9 @@ describe("clone", () => {
7777

7878
let numberGridCopy = clone(numberGrid)
7979

80-
numberGrid[1]
81-
->Option.flatMap(
82-
a => {
83-
a->Array.set(1, 0)
84-
Some(a)
85-
},
86-
)
87-
->ignore
88-
89-
numberGridCopy[1]
90-
->Option.flatMap(
91-
a => {
92-
a->Array.set(1, 9)
93-
Some(a)
94-
},
95-
)
96-
->ignore
80+
numberGrid->Array.getUnsafe(1)->Array.setUnsafe(1, 0)
81+
82+
numberGridCopy->Array.getUnsafe(1)->Array.setUnsafe(1, 9)
9783

9884
expect(numberGridCopy)->toEqual([[1, 2, 3], [4, 9, 6], [7, 8, 9]])
9985
})

__tests__/Array_Test.res.mjs

+5-12
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import * as Primitive_int from "rescript/lib/es6/Primitive_int.js";
77
import * as Stdlib__Array from "../src/Stdlib__Array.res.mjs";
88
import * as Stdlib__Float from "../src/Stdlib__Float.res.mjs";
99
import * as TableclothMap from "../src/Tablecloth/TableclothMap.res.mjs";
10-
import * as Stdlib__Option from "../src/Stdlib__Option.res.mjs";
1110
import * as Stdlib__Tuple2 from "../src/Stdlib__Tuple2.res.mjs";
1211
import * as Stdlib__Tuple3 from "../src/Stdlib__Tuple3.res.mjs";
1312

@@ -163,14 +162,8 @@ Jest.describe("clone", () => {
163162
]
164163
];
165164
let numberGridCopy = Stdlib__Array.clone(numberGrid);
166-
Stdlib__Option.flatMap(numberGrid[1], a => {
167-
a[1] = 0;
168-
return a;
169-
});
170-
Stdlib__Option.flatMap(numberGridCopy[1], a => {
171-
a[1] = 9;
172-
return a;
173-
});
165+
Stdlib__Array.setUnsafe(Stdlib__Array.getUnsafe(numberGrid, 1), 1, 0);
166+
Stdlib__Array.setUnsafe(Stdlib__Array.getUnsafe(numberGridCopy, 1), 1, 9);
174167
return Jest.Expect.toEqual(Jest.Expect.expect(numberGridCopy), [
175168
[
176169
1,
@@ -340,7 +333,7 @@ Jest.describe("filterMap", () => Jest.test("keep elements that [f] returns [true
340333
6
341334
], number => {
342335
if (Stdlib__Int.isEven(number)) {
343-
return Math.imul(number, number);
336+
return number * number | 0;
344337
}
345338

346339
})), [
@@ -392,7 +385,7 @@ Jest.describe("mapWithIndex", () => Jest.test("equals an array literal of the sa
392385
5,
393386
5,
394387
5
395-
].map((prim0, prim1) => Math.imul(prim0, prim1))), [
388+
].map((prim0, prim1) => prim0 * prim1 | 0)), [
396389
0,
397390
5,
398391
10
@@ -1089,7 +1082,7 @@ Jest.describe("slice", () => {
10891082

10901083
Jest.describe("fold", () => {
10911084
Jest.test("works for an empty array", () => Jest.Expect.toEqual(Jest.Expect.expect(Stdlib__Array.fold([], "", (prim0, prim1) => prim0 + prim1)), ""));
1092-
Jest.test("works for an ascociative operator", () => Jest.Expect.toEqual(Jest.Expect.expect(Stdlib__Array.fold(Stdlib__Array.repeat(7, 4), 1, (prim0, prim1) => Math.imul(prim0, prim1))), 2401));
1085+
Jest.test("works for an ascociative operator", () => Jest.Expect.toEqual(Jest.Expect.expect(Stdlib__Array.fold(Stdlib__Array.repeat(7, 4), 1, (prim0, prim1) => prim0 * prim1 | 0)), 2401));
10931086
Jest.test("works the order of arguments to `f` is important", () => Jest.Expect.toEqual(Jest.Expect.expect(Stdlib__Array.fold([
10941087
"a",
10951088
"b",

__tests__/List_Test.res.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Jest.describe("initalize", () => {
104104
}
105105
}
106106
}));
107-
Jest.test("with math", () => Jest.Expect.toEqual(Jest.Expect.expect(Stdlib__List.initialize(4, index => Math.imul(index, index))), {
107+
Jest.test("with math", () => Jest.Expect.toEqual(Jest.Expect.expect(Stdlib__List.initialize(4, index => index * index | 0)), {
108108
hd: 0,
109109
tl: {
110110
hd: 1,
@@ -1593,7 +1593,7 @@ Jest.describe("sortBy", () => {
15931593
}
15941594
}
15951595
}
1596-
}, x => Math.imul(x, x))), {
1596+
}, x => x * x | 0)), {
15971597
hd: 2,
15981598
tl: {
15991599
hd: -2,

__tests__/Option_Test.res.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ Jest.describe("flatten", () => {
4545
});
4646

4747
Jest.describe("map", () => {
48-
Jest.test("returns transformed value from inside option arg", () => Jest.Expect.toEqual(Jest.Expect.expect(Stdlib__Option.map(9, x => Math.imul(x, x))), 81));
48+
Jest.test("returns transformed value from inside option arg", () => Jest.Expect.toEqual(Jest.Expect.expect(Stdlib__Option.map(9, x => x * x | 0)), 81));
4949
Jest.test("returns transformed value from inside option arg", () => Jest.Expect.toEqual(Jest.Expect.expect(Stdlib__Option.map(9, __x => __x.toString())), "9"));
50-
Jest.test("returns none", () => Jest.Expect.toEqual(Jest.Expect.expect(Stdlib__Option.map(undefined, x => Math.imul(x, x))), undefined));
50+
Jest.test("returns none", () => Jest.Expect.toEqual(Jest.Expect.expect(Stdlib__Option.map(undefined, x => x * x | 0)), undefined));
5151
});
5252

5353
Jest.describe("map2", () => {

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
]
3737
},
3838
"peerDependencies": {
39-
"rescript": "^12.0.0-alpha.9"
39+
"rescript": "^12.0.0-alpha.10"
4040
},
4141
"devDependencies": {
4242
"@changesets/cli": "^2.27.11",
@@ -45,7 +45,7 @@
4545
"@swc/jest": "^0.2.37",
4646
"jest": "^29.7.0",
4747
"onchange": "^7.1.0",
48-
"rescript": "^12.0.0-alpha.9",
48+
"rescript": "^12.0.0-alpha.10",
4949
"tap-difflet": "^0.7.2"
5050
}
5151
}

src/Stdlib__Array_Ext.res

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ let uniqBy = (xs, uniqFn) => {
132132
let alreadyAdded = some(arr, x => uniqFn(TableclothFun.identity(x)) == uniqFn(value))
133133

134134
if !alreadyAdded {
135-
push(arr, value)->ignore
135+
push(arr, value)
136136
}
137137

138138
index := succ(index.contents)

src/Stdlib__BigInt.res.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import * as Stdlib_BigInt from "rescript/lib/es6/Stdlib_BigInt.js";
44

55
let toInt = Stdlib_BigInt.toInt;
66

7-
let lnot = Stdlib_BigInt.lnot;
7+
let bitwiseNot = Stdlib_BigInt.bitwiseNot;
88

99
export {
1010
toInt,
11-
lnot,
11+
bitwiseNot,
1212
}
1313
/* No side effect */

src/Stdlib__Int.res.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ let rangeWithOptions = Stdlib_Int.rangeWithOptions;
1313

1414
let clamp = Stdlib_Int.clamp;
1515

16-
let Bitwise = Stdlib_Int.Bitwise;
16+
let bitwiseNot = Stdlib_Int.bitwiseNot;
1717

1818
let zero = TableclothInt.zero;
1919

@@ -49,7 +49,7 @@ export {
4949
range,
5050
rangeWithOptions,
5151
clamp,
52-
Bitwise,
52+
bitwiseNot,
5353
zero,
5454
one,
5555
add,

src/Stdlib__Math.res.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function gcd(_a, _b) {
1818
}
1919

2020
function lcm(a, b) {
21-
return Primitive_int.div(Math.imul(a, b), gcd(a, b));
21+
return Primitive_int.div(a * b | 0, gcd(a, b));
2222
}
2323

2424
function gcd$1(_a, _b) {

src/Tablecloth/TableclothArray.res.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ function sliding(stepOpt, a, size) {
137137
if (size > n) {
138138
return [];
139139
} else {
140-
return Stdlib_Array.fromInitializer(1 + Primitive_int.div(n - size | 0, step) | 0, i => Stdlib_Array.fromInitializer(size, j => Stdlib_Option.getExn(a[Math.imul(i, step) + j | 0], undefined)));
140+
return Stdlib_Array.fromInitializer(1 + Primitive_int.div(n - size | 0, step) | 0, i => Stdlib_Array.fromInitializer(size, j => Stdlib_Option.getExn(a[(i * step | 0) + j | 0], undefined)));
141141
}
142142
}
143143

src/Tablecloth/TableclothInt.res.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function subtract(prim0, prim1) {
2020
}
2121

2222
function multiply(prim0, prim1) {
23-
return Math.imul(prim0, prim1);
23+
return prim0 * prim1 | 0;
2424
}
2525

2626
let divide = Primitive_int.div;

0 commit comments

Comments
 (0)