From d3d4e12385f7f72965e90597cf2a6efde1d186dd Mon Sep 17 00:00:00 2001 From: Christoph Knittel Date: Thu, 5 Sep 2024 09:03:25 +0200 Subject: [PATCH] ReScript 12.0.0-alpha.2 / Rewatch 1.0.9 --- .github/workflows/ci.yml | 2 +- belt/src/belt_Array.js | 126 +++-- belt/src/belt_HashMap.js | 18 +- belt/src/belt_HashMapInt.js | 18 +- belt/src/belt_HashMapString.js | 18 +- belt/src/belt_HashSet.js | 16 +- belt/src/belt_HashSetInt.js | 16 +- belt/src/belt_HashSetString.js | 16 +- belt/src/belt_List.js | 128 ++--- belt/src/belt_MapDict.js | 12 +- belt/src/belt_MapInt.js | 4 +- belt/src/belt_MapString.js | 4 +- belt/src/belt_MutableMap.js | 4 +- belt/src/belt_MutableMapInt.js | 2 +- belt/src/belt_MutableMapString.js | 2 +- belt/src/belt_MutableQueue.js | 28 +- belt/src/belt_MutableSet.js | 4 +- belt/src/belt_MutableSetInt.js | 4 +- belt/src/belt_MutableSetString.js | 4 +- belt/src/belt_MutableStack.js | 6 +- belt/src/belt_Option.js | 8 +- belt/src/belt_Range.js | 10 +- belt/src/belt_Result.js | 8 +- belt/src/belt_SetDict.js | 4 +- belt/src/belt_SetInt.js | 4 +- belt/src/belt_SetString.js | 4 +- belt/src/belt_SortArray.js | 20 +- belt/src/belt_SortArrayInt.js | 20 +- belt/src/belt_SortArrayString.js | 20 +- belt/src/belt_internalAVLset.js | 144 +++--- belt/src/belt_internalAVLtree.js | 182 ++++--- belt/src/belt_internalBuckets.js | 54 +-- belt/src/belt_internalBucketsType.js | 4 +- belt/src/belt_internalMapInt.js | 28 +- belt/src/belt_internalMapString.js | 28 +- belt/src/belt_internalSetBuckets.js | 30 +- belt/src/belt_internalSetInt.js | 22 +- belt/src/belt_internalSetString.js | 22 +- core/src/Core__Array.js | 16 +- core/src/Core__AsyncIterator.js | 2 +- core/src/Core__Dict.js | 12 +- core/src/Core__Error.js | 4 +- core/src/Core__Int.js | 8 +- core/src/Core__Iterator.js | 2 +- core/src/Core__JSON.js | 34 +- core/src/Core__List.js | 132 ++--- core/src/Core__Null.js | 10 +- core/src/Core__Nullable.js | 10 +- core/src/Core__Promise.js | 4 +- core/src/Core__Result.js | 8 +- core/src/Core__Type.js | 52 +- .../Core__Intl__NumberFormat__Grouping.js | 28 +- js/src/js_dict.js | 10 +- js/src/js_exn.js | 28 +- js/src/js_json.js | 21 +- js/src/js_types.js | 19 +- package-lock.json | 23 +- package.json | 5 +- primitives/src/caml_array.js | 36 +- primitives/src/caml_bigint.js | 16 +- primitives/src/caml_bytes.js | 36 +- primitives/src/caml_format.js | 450 +++++++++--------- primitives/src/caml_hash.js | 8 +- primitives/src/caml_hash_primitive.js | 2 +- primitives/src/caml_int32.js | 16 +- primitives/src/caml_int64.js | 20 +- primitives/src/caml_md5.js | 12 +- primitives/src/caml_module.js | 84 ++-- primitives/src/caml_obj.js | 106 ++--- primitives/src/caml_string.js | 10 +- primitives/src/caml_sys.js | 36 +- runtime/src/runtime_deriving.js | 8 +- 72 files changed, 1120 insertions(+), 1192 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e0e567..56fdb01 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,4 +24,4 @@ jobs: run: npm ci --ignore-scripts - name: Build - run: npx rescript + run: npx rewatch diff --git a/belt/src/belt_Array.js b/belt/src/belt_Array.js index 4fdcbd8..cac24e3 100644 --- a/belt/src/belt_Array.js +++ b/belt/src/belt_Array.js @@ -14,15 +14,15 @@ function get(arr, i) { function getExn(arr, i) { if (!(i >= 0 && i < arr.length)) { throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "belt_Array.res", - 36, - 2 - ] - } - }); + cause: { + RE_EXN_ID: "Assert_failure", + _1: [ + "belt_Array.res", + 36, + 2 + ] + } + }); } return arr[i]; } @@ -39,15 +39,15 @@ function set(arr, i, v) { function setExn(arr, i, v) { if (!(i >= 0 && i < arr.length)) { throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "belt_Array.res", - 49, - 2 - ] - } - }); + cause: { + RE_EXN_ID: "Assert_failure", + _1: [ + "belt_Array.res", + 49, + 2 + ] + } + }); } arr[i] = v; } @@ -60,10 +60,8 @@ function swapUnsafe(xs, i, j) { function shuffleInPlace(xs) { let len = xs.length; - let random_int = function (min, max) { - return Math.floor(Math.random() * (max - min | 0)) + min | 0; - }; - for(let i = 0; i < len; ++i){ + let random_int = (min, max) => Math.floor(Math.random() * (max - min | 0)) + min | 0; + for (let i = 0; i < len; ++i) { swapUnsafe(xs, i, random_int(i, len)); } } @@ -77,7 +75,7 @@ function shuffle(xs) { function reverseInPlace(xs) { let len = xs.length; let ofs = 0; - for(let i = 0 ,i_finish = len / 2 | 0; i < i_finish; ++i){ + for (let i = 0, i_finish = len / 2 | 0; i < i_finish; ++i) { swapUnsafe(xs, ofs + i | 0, ((ofs + len | 0) - i | 0) - 1 | 0); } } @@ -85,7 +83,7 @@ function reverseInPlace(xs) { function reverse(xs) { let len = xs.length; let result = new Array(len); - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { result[i] = xs[(len - 1 | 0) - i | 0]; } return result; @@ -96,7 +94,7 @@ function make(l, f) { return []; } let res = new Array(l); - for(let i = 0; i < l; ++i){ + for (let i = 0; i < l; ++i) { res[i] = f; } return res; @@ -107,7 +105,7 @@ function makeBy(l, f) { return []; } let res = new Array(l); - for(let i = 0; i < l; ++i){ + for (let i = 0; i < l; ++i) { res[i] = f(i); } return res; @@ -125,7 +123,7 @@ function range(start, finish) { return []; } let arr = new Array(cut + 1 | 0); - for(let i = 0; i <= cut; ++i){ + for (let i = 0; i <= cut; ++i) { arr[i] = start + i | 0; } return arr; @@ -139,7 +137,7 @@ function rangeBy(start, finish, step) { let nb = Caml_int32.div(cut, step) + 1 | 0; let arr = new Array(nb); let cur = start; - for(let i = 0; i < nb; ++i){ + for (let i = 0; i < nb; ++i) { arr[i] = cur; cur = cur + step | 0; } @@ -151,7 +149,7 @@ function zip(xs, ys) { let leny = ys.length; let len = lenx < leny ? lenx : leny; let s = new Array(len); - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { s[i] = [ xs[i], ys[i] @@ -165,7 +163,7 @@ function zipBy(xs, ys, f) { let leny = ys.length; let len = lenx < leny ? lenx : leny; let s = new Array(len); - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { s[i] = f(xs[i], ys[i]); } return s; @@ -175,10 +173,10 @@ function concat(a1, a2) { let l1 = a1.length; let l2 = a2.length; let a1a2 = new Array(l1 + l2 | 0); - for(let i = 0; i < l1; ++i){ + for (let i = 0; i < l1; ++i) { a1a2[i] = a1[i]; } - for(let i$1 = 0; i$1 < l2; ++i$1){ + for (let i$1 = 0; i$1 < l2; ++i$1) { a1a2[l1 + i$1 | 0] = a2[i$1]; } return a1a2; @@ -187,14 +185,14 @@ function concat(a1, a2) { function concatMany(arrs) { let lenArrs = arrs.length; let totalLen = 0; - for(let i = 0; i < lenArrs; ++i){ + for (let i = 0; i < lenArrs; ++i) { totalLen = totalLen + arrs[i].length | 0; } let result = new Array(totalLen); totalLen = 0; - for(let j = 0; j < lenArrs; ++j){ + for (let j = 0; j < lenArrs; ++j) { let cur = arrs[j]; - for(let k = 0 ,k_finish = cur.length; k < k_finish; ++k){ + for (let k = 0, k_finish = cur.length; k < k_finish; ++k) { result[totalLen] = cur[k]; totalLen = totalLen + 1 | 0; } @@ -214,7 +212,7 @@ function slice(a, offset, len) { return []; } let result = new Array(copyLength); - for(let i = 0; i < copyLength; ++i){ + for (let i = 0; i < copyLength; ++i) { result[i] = a[ofs + i | 0]; } return result; @@ -225,7 +223,7 @@ function sliceToEnd(a, offset) { let ofs = offset < 0 ? Caml.int_max(lena + offset | 0, 0) : offset; let len = lena > ofs ? lena - ofs | 0 : 0; let result = new Array(len); - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { result[i] = a[ofs + i | 0]; } return result; @@ -242,19 +240,19 @@ function fill(a, offset, len, v) { if (fillLength <= 0) { return; } - for(let i = ofs ,i_finish = ofs + fillLength | 0; i < i_finish; ++i){ + for (let i = ofs, i_finish = ofs + fillLength | 0; i < i_finish; ++i) { a[i] = v; } } function blitUnsafe(a1, srcofs1, a2, srcofs2, blitLength) { if (srcofs2 <= srcofs1) { - for(let j = 0; j < blitLength; ++j){ + for (let j = 0; j < blitLength; ++j) { a2[j + srcofs2 | 0] = a1[j + srcofs1 | 0]; } return; } - for(let j$1 = blitLength - 1 | 0; j$1 >= 0; --j$1){ + for (let j$1 = blitLength - 1 | 0; j$1 >= 0; --j$1) { a2[j$1 + srcofs2 | 0] = a1[j$1 + srcofs1 | 0]; } } @@ -266,18 +264,18 @@ function blit(a1, ofs1, a2, ofs2, len) { let srcofs2 = ofs2 < 0 ? Caml.int_max(lena2 + ofs2 | 0, 0) : ofs2; let blitLength = Caml.int_min(len, Caml.int_min(lena1 - srcofs1 | 0, lena2 - srcofs2 | 0)); if (srcofs2 <= srcofs1) { - for(let j = 0; j < blitLength; ++j){ + for (let j = 0; j < blitLength; ++j) { a2[j + srcofs2 | 0] = a1[j + srcofs1 | 0]; } return; } - for(let j$1 = blitLength - 1 | 0; j$1 >= 0; --j$1){ + for (let j$1 = blitLength - 1 | 0; j$1 >= 0; --j$1) { a2[j$1 + srcofs2 | 0] = a1[j$1 + srcofs1 | 0]; } } function forEach(a, f) { - for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ + for (let i = 0, i_finish = a.length; i < i_finish; ++i) { f(a[i]); } } @@ -285,7 +283,7 @@ function forEach(a, f) { function map(a, f) { let l = a.length; let r = new Array(l); - for(let i = 0; i < l; ++i){ + for (let i = 0; i < l; ++i) { r[i] = f(a[i]); } return r; @@ -299,7 +297,7 @@ function getBy(a, p) { let l = a.length; let i = 0; let r; - while(r === undefined && i < l) { + while (r === undefined && i < l) { let v = a[i]; if (p(v)) { r = Caml_option.some(v); @@ -313,7 +311,7 @@ function getIndexBy(a, p) { let l = a.length; let i = 0; let r; - while(r === undefined && i < l) { + while (r === undefined && i < l) { let v = a[i]; if (p(v)) { r = i; @@ -327,7 +325,7 @@ function keep(a, f) { let l = a.length; let r = new Array(l); let j = 0; - for(let i = 0; i < l; ++i){ + for (let i = 0; i < l; ++i) { let v = a[i]; if (f(v)) { r[j] = v; @@ -343,7 +341,7 @@ function keepWithIndex(a, f) { let l = a.length; let r = new Array(l); let j = 0; - for(let i = 0; i < l; ++i){ + for (let i = 0; i < l; ++i) { let v = a[i]; if (f(v, i)) { r[j] = v; @@ -359,7 +357,7 @@ function keepMap(a, f) { let l = a.length; let r = new Array(l); let j = 0; - for(let i = 0; i < l; ++i){ + for (let i = 0; i < l; ++i) { let v = a[i]; let v$1 = f(v); if (v$1 !== undefined) { @@ -373,7 +371,7 @@ function keepMap(a, f) { } function forEachWithIndex(a, f) { - for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ + for (let i = 0, i_finish = a.length; i < i_finish; ++i) { f(i, a[i]); } } @@ -381,7 +379,7 @@ function forEachWithIndex(a, f) { function mapWithIndex(a, f) { let l = a.length; let r = new Array(l); - for(let i = 0; i < l; ++i){ + for (let i = 0; i < l; ++i) { r[i] = f(i, a[i]); } return r; @@ -389,7 +387,7 @@ function mapWithIndex(a, f) { function reduce(a, x, f) { let r = x; - for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ + for (let i = 0, i_finish = a.length; i < i_finish; ++i) { r = f(r, a[i]); } return r; @@ -397,7 +395,7 @@ function reduce(a, x, f) { function reduceReverse(a, x, f) { let r = x; - for(let i = a.length - 1 | 0; i >= 0; --i){ + for (let i = a.length - 1 | 0; i >= 0; --i) { r = f(r, a[i]); } return r; @@ -406,7 +404,7 @@ function reduceReverse(a, x, f) { function reduceReverse2(a, b, x, f) { let r = x; let len = Caml.int_min(a.length, b.length); - for(let i = len - 1 | 0; i >= 0; --i){ + for (let i = len - 1 | 0; i >= 0; --i) { r = f(r, a[i], b[i]); } return r; @@ -414,7 +412,7 @@ function reduceReverse2(a, b, x, f) { function reduceWithIndex(a, x, f) { let r = x; - for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ + for (let i = 0, i_finish = a.length; i < i_finish; ++i) { r = f(r, a[i], i); } return r; @@ -423,7 +421,7 @@ function reduceWithIndex(a, x, f) { function every(arr, b) { let len = arr.length; let _i = 0; - while(true) { + while (true) { let i = _i; if (i === len) { return true; @@ -439,7 +437,7 @@ function every(arr, b) { function some(arr, b) { let len = arr.length; let _i = 0; - while(true) { + while (true) { let i = _i; if (i === len) { return false; @@ -453,7 +451,7 @@ function some(arr, b) { } function everyAux2(arr1, arr2, _i, b, len) { - while(true) { + while (true) { let i = _i; if (i === len) { return true; @@ -473,7 +471,7 @@ function every2(a, b, p) { function some2(a, b, p) { let _i = 0; let len = Caml.int_min(a.length, b.length); - while(true) { + while (true) { let i = _i; if (i === len) { return false; @@ -505,7 +503,7 @@ function cmp(a, b, p) { return -1; } else { let _i = 0; - while(true) { + while (true) { let i = _i; if (i === lena) { return 0; @@ -526,7 +524,7 @@ function partition(a, f) { let j = 0; let a1 = new Array(l); let a2 = new Array(l); - for(let ii = 0; ii < l; ++ii){ + for (let ii = 0; ii < l; ++ii) { let v = a[ii]; if (f(v)) { a1[i] = v; @@ -548,7 +546,7 @@ function unzip(a) { let l = a.length; let a1 = new Array(l); let a2 = new Array(l); - for(let i = 0; i < l; ++i){ + for (let i = 0; i < l; ++i) { let match = a[i]; a1[i] = match[0]; a2[i] = match[1]; @@ -567,7 +565,7 @@ function joinWith(a, sep, toString) { let lastIndex = l - 1 | 0; let _i = 0; let _res = ""; - while(true) { + while (true) { let res = _res; let i = _i; if (i === lastIndex) { @@ -581,7 +579,7 @@ function joinWith(a, sep, toString) { function init(n, f) { let v = new Array(n); - for(let i = 0; i < n; ++i){ + for (let i = 0; i < n; ++i) { v[i] = f(i); } return v; diff --git a/belt/src/belt_HashMap.js b/belt/src/belt_HashMap.js index 78df0a4..75287d8 100644 --- a/belt/src/belt_HashMap.js +++ b/belt/src/belt_HashMap.js @@ -9,7 +9,7 @@ function size(h) { } function copyBucketReHash(hash, h_buckets, ndata_tail, _old_bucket) { - while(true) { + while (true) { let old_bucket = _old_bucket; if (old_bucket === undefined) { return; @@ -28,7 +28,7 @@ function copyBucketReHash(hash, h_buckets, ndata_tail, _old_bucket) { } function replaceInBucket(eq, key, info, _cell) { - while(true) { + while (true) { let cell = _cell; if (eq(cell.key, key)) { cell.value = info; @@ -76,10 +76,10 @@ function set0(h, key, value, eq, hash) { let h_buckets$1 = new Array(nsize); let ndata_tail = new Array(nsize); h.buckets = h_buckets$1; - for(let i$1 = 0; i$1 < osize; ++i$1){ + for (let i$1 = 0; i$1 < osize; ++i$1) { copyBucketReHash(hash, h_buckets$1, ndata_tail, odata[i$1]); } - for(let i$2 = 0; i$2 < nsize; ++i$2){ + for (let i$2 = 0; i$2 < nsize; ++i$2) { let tail = ndata_tail[i$2]; if (tail !== undefined) { tail.next = undefined; @@ -110,7 +110,7 @@ function remove(h, key) { } else { let _prec = bucket; let _bucket = bucket.next; - while(true) { + while (true) { let bucket$1 = _bucket; let prec = _prec; if (bucket$1 === undefined) { @@ -153,7 +153,7 @@ function get(h, key) { return Caml_option.some(cell3.value); } else { let _buckets = cell3.next; - while(true) { + while (true) { let buckets = _buckets; if (buckets === undefined) { return; @@ -176,7 +176,7 @@ function has(h, key) { if (bucket !== undefined) { let _cell = bucket; let eq = h.eq; - while(true) { + while (true) { let cell = _cell; if (eq(cell.key, key)) { return true; @@ -202,7 +202,7 @@ function fromArray(arr, id) { let eq = id.eq; let len = arr.length; let v = Belt_internalBucketsType.make(hash, eq, len); - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { let match = arr[i]; set0(v, match[0], match[1], eq, hash); } @@ -213,7 +213,7 @@ function mergeMany(h, arr) { let hash = h.hash; let eq = h.eq; let len = arr.length; - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { let match = arr[i]; set0(h, match[0], match[1], eq, hash); } diff --git a/belt/src/belt_HashMapInt.js b/belt/src/belt_HashMapInt.js index 36090d5..16b5f2c 100644 --- a/belt/src/belt_HashMapInt.js +++ b/belt/src/belt_HashMapInt.js @@ -6,7 +6,7 @@ import * as Belt_internalBuckets from "./belt_internalBuckets.js"; import * as Belt_internalBucketsType from "./belt_internalBucketsType.js"; function copyBucketReHash(h_buckets, ndata_tail, _old_bucket) { - while(true) { + while (true) { let old_bucket = _old_bucket; if (old_bucket === undefined) { return; @@ -25,7 +25,7 @@ function copyBucketReHash(h_buckets, ndata_tail, _old_bucket) { } function replaceInBucket(key, info, _cell) { - while(true) { + while (true) { let cell = _cell; if (cell.key === key) { cell.value = info; @@ -73,10 +73,10 @@ function set(h, key, value) { let h_buckets$1 = new Array(nsize); let ndata_tail = new Array(nsize); h.buckets = h_buckets$1; - for(let i$1 = 0; i$1 < osize; ++i$1){ + for (let i$1 = 0; i$1 < osize; ++i$1) { copyBucketReHash(h_buckets$1, ndata_tail, odata[i$1]); } - for(let i$2 = 0; i$2 < nsize; ++i$2){ + for (let i$2 = 0; i$2 < nsize; ++i$2) { let tail = ndata_tail[i$2]; if (tail !== undefined) { tail.next = undefined; @@ -100,7 +100,7 @@ function remove(h, key) { } else { let _prec = bucket; let _buckets = bucket.next; - while(true) { + while (true) { let buckets = _buckets; let prec = _prec; if (buckets === undefined) { @@ -144,7 +144,7 @@ function get(h, key) { return Caml_option.some(cell3.value); } else { let _buckets = cell3.next; - while(true) { + while (true) { let buckets = _buckets; if (buckets === undefined) { return; @@ -166,7 +166,7 @@ function has(h, key) { let bucket = h_buckets[nid]; if (bucket !== undefined) { let _cell = bucket; - while(true) { + while (true) { let cell = _cell; if (cell.key === key) { return true; @@ -194,7 +194,7 @@ function size(h) { function fromArray(arr) { let len = arr.length; let v = Belt_internalBucketsType.make(undefined, undefined, len); - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { let match = arr[i]; set(v, match[0], match[1]); } @@ -203,7 +203,7 @@ function fromArray(arr) { function mergeMany(h, arr) { let len = arr.length; - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { let match = arr[i]; set(h, match[0], match[1]); } diff --git a/belt/src/belt_HashMapString.js b/belt/src/belt_HashMapString.js index c378c2f..e23dc6c 100644 --- a/belt/src/belt_HashMapString.js +++ b/belt/src/belt_HashMapString.js @@ -6,7 +6,7 @@ import * as Belt_internalBuckets from "./belt_internalBuckets.js"; import * as Belt_internalBucketsType from "./belt_internalBucketsType.js"; function copyBucketReHash(h_buckets, ndata_tail, _old_bucket) { - while(true) { + while (true) { let old_bucket = _old_bucket; if (old_bucket === undefined) { return; @@ -25,7 +25,7 @@ function copyBucketReHash(h_buckets, ndata_tail, _old_bucket) { } function replaceInBucket(key, info, _cell) { - while(true) { + while (true) { let cell = _cell; if (cell.key === key) { cell.value = info; @@ -73,10 +73,10 @@ function set(h, key, value) { let h_buckets$1 = new Array(nsize); let ndata_tail = new Array(nsize); h.buckets = h_buckets$1; - for(let i$1 = 0; i$1 < osize; ++i$1){ + for (let i$1 = 0; i$1 < osize; ++i$1) { copyBucketReHash(h_buckets$1, ndata_tail, odata[i$1]); } - for(let i$2 = 0; i$2 < nsize; ++i$2){ + for (let i$2 = 0; i$2 < nsize; ++i$2) { let tail = ndata_tail[i$2]; if (tail !== undefined) { tail.next = undefined; @@ -100,7 +100,7 @@ function remove(h, key) { } else { let _prec = bucket; let _buckets = bucket.next; - while(true) { + while (true) { let buckets = _buckets; let prec = _prec; if (buckets === undefined) { @@ -144,7 +144,7 @@ function get(h, key) { return Caml_option.some(cell3.value); } else { let _buckets = cell3.next; - while(true) { + while (true) { let buckets = _buckets; if (buckets === undefined) { return; @@ -166,7 +166,7 @@ function has(h, key) { let bucket = h_buckets[nid]; if (bucket !== undefined) { let _cell = bucket; - while(true) { + while (true) { let cell = _cell; if (cell.key === key) { return true; @@ -194,7 +194,7 @@ function size(h) { function fromArray(arr) { let len = arr.length; let v = Belt_internalBucketsType.make(undefined, undefined, len); - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { let match = arr[i]; set(v, match[0], match[1]); } @@ -203,7 +203,7 @@ function fromArray(arr) { function mergeMany(h, arr) { let len = arr.length; - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { let match = arr[i]; set(h, match[0], match[1]); } diff --git a/belt/src/belt_HashSet.js b/belt/src/belt_HashSet.js index 9fe3fb0..38c338c 100644 --- a/belt/src/belt_HashSet.js +++ b/belt/src/belt_HashSet.js @@ -4,7 +4,7 @@ import * as Belt_internalSetBuckets from "./belt_internalSetBuckets.js"; import * as Belt_internalBucketsType from "./belt_internalBucketsType.js"; function copyBucket(hash, h_buckets, ndata_tail, _old_bucket) { - while(true) { + while (true) { let old_bucket = _old_bucket; if (old_bucket === undefined) { return; @@ -38,7 +38,7 @@ function remove(h, key) { } else if (next_cell !== undefined) { let _prec = l; let _cell = next_cell; - while(true) { + while (true) { let cell = _cell; let prec = _prec; let cell_next = cell.next; @@ -60,7 +60,7 @@ function remove(h, key) { } function addBucket(h, key, _cell, eq) { - while(true) { + while (true) { let cell = _cell; if (eq(cell.key, key)) { return; @@ -103,10 +103,10 @@ function add0(h, key, hash, eq) { let h_buckets$1 = new Array(nsize); let ndata_tail = new Array(nsize); h.buckets = h_buckets$1; - for(let i$1 = 0; i$1 < osize; ++i$1){ + for (let i$1 = 0; i$1 < osize; ++i$1) { copyBucket(hash, h_buckets$1, ndata_tail, odata[i$1]); } - for(let i$2 = 0; i$2 < nsize; ++i$2){ + for (let i$2 = 0; i$2 < nsize; ++i$2) { let tail = ndata_tail[i$2]; if (tail !== undefined) { tail.next = undefined; @@ -129,7 +129,7 @@ function has(h, key) { let bucket = h_buckets[nid]; if (bucket !== undefined) { let _cell = bucket; - while(true) { + while (true) { let cell = _cell; if (eq(cell.key, key)) { return true; @@ -159,7 +159,7 @@ function fromArray(arr, id) { let hash = id.hash; let len = arr.length; let v = Belt_internalBucketsType.make(hash, eq, len); - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { add0(v, arr[i], hash, eq); } return v; @@ -169,7 +169,7 @@ function mergeMany(h, arr) { let eq = h.eq; let hash = h.hash; let len = arr.length; - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { add0(h, arr[i], hash, eq); } } diff --git a/belt/src/belt_HashSetInt.js b/belt/src/belt_HashSetInt.js index 17ee2a9..89347bb 100644 --- a/belt/src/belt_HashSetInt.js +++ b/belt/src/belt_HashSetInt.js @@ -5,7 +5,7 @@ import * as Belt_internalSetBuckets from "./belt_internalSetBuckets.js"; import * as Belt_internalBucketsType from "./belt_internalBucketsType.js"; function copyBucket(h_buckets, ndata_tail, _old_bucket) { - while(true) { + while (true) { let old_bucket = _old_bucket; if (old_bucket === undefined) { return; @@ -38,7 +38,7 @@ function remove(h, key) { } else if (next_cell !== undefined) { let _prec = l; let _cell = next_cell; - while(true) { + while (true) { let cell = _cell; let prec = _prec; let cell_next = cell.next; @@ -60,7 +60,7 @@ function remove(h, key) { } function addBucket(h, key, _cell) { - while(true) { + while (true) { let cell = _cell; if (cell.key === key) { return; @@ -103,10 +103,10 @@ function add(h, key) { let h_buckets$1 = new Array(nsize); let ndata_tail = new Array(nsize); h.buckets = h_buckets$1; - for(let i$1 = 0; i$1 < osize; ++i$1){ + for (let i$1 = 0; i$1 < osize; ++i$1) { copyBucket(h_buckets$1, ndata_tail, odata[i$1]); } - for(let i$2 = 0; i$2 < nsize; ++i$2){ + for (let i$2 = 0; i$2 < nsize; ++i$2) { let tail = ndata_tail[i$2]; if (tail !== undefined) { tail.next = undefined; @@ -124,7 +124,7 @@ function has(h, key) { let bucket = h_buckets[nid]; if (bucket !== undefined) { let _cell = bucket; - while(true) { + while (true) { let cell = _cell; if (cell.key === key) { return true; @@ -152,7 +152,7 @@ function size(h) { function fromArray(arr) { let len = arr.length; let v = Belt_internalBucketsType.make(undefined, undefined, len); - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { add(v, arr[i]); } return v; @@ -160,7 +160,7 @@ function fromArray(arr) { function mergeMany(h, arr) { let len = arr.length; - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { add(h, arr[i]); } } diff --git a/belt/src/belt_HashSetString.js b/belt/src/belt_HashSetString.js index 48d111a..252738b 100644 --- a/belt/src/belt_HashSetString.js +++ b/belt/src/belt_HashSetString.js @@ -5,7 +5,7 @@ import * as Belt_internalSetBuckets from "./belt_internalSetBuckets.js"; import * as Belt_internalBucketsType from "./belt_internalBucketsType.js"; function copyBucket(h_buckets, ndata_tail, _old_bucket) { - while(true) { + while (true) { let old_bucket = _old_bucket; if (old_bucket === undefined) { return; @@ -38,7 +38,7 @@ function remove(h, key) { } else if (next_cell !== undefined) { let _prec = l; let _cell = next_cell; - while(true) { + while (true) { let cell = _cell; let prec = _prec; let cell_next = cell.next; @@ -60,7 +60,7 @@ function remove(h, key) { } function addBucket(h, key, _cell) { - while(true) { + while (true) { let cell = _cell; if (cell.key === key) { return; @@ -103,10 +103,10 @@ function add(h, key) { let h_buckets$1 = new Array(nsize); let ndata_tail = new Array(nsize); h.buckets = h_buckets$1; - for(let i$1 = 0; i$1 < osize; ++i$1){ + for (let i$1 = 0; i$1 < osize; ++i$1) { copyBucket(h_buckets$1, ndata_tail, odata[i$1]); } - for(let i$2 = 0; i$2 < nsize; ++i$2){ + for (let i$2 = 0; i$2 < nsize; ++i$2) { let tail = ndata_tail[i$2]; if (tail !== undefined) { tail.next = undefined; @@ -124,7 +124,7 @@ function has(h, key) { let bucket = h_buckets[nid]; if (bucket !== undefined) { let _cell = bucket; - while(true) { + while (true) { let cell = _cell; if (cell.key === key) { return true; @@ -152,7 +152,7 @@ function size(h) { function fromArray(arr) { let len = arr.length; let v = Belt_internalBucketsType.make(undefined, undefined, len); - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { add(v, arr[i]); } return v; @@ -160,7 +160,7 @@ function fromArray(arr) { function mergeMany(h, arr) { let len = arr.length; - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { add(h, arr[i]); } } diff --git a/belt/src/belt_List.js b/belt/src/belt_List.js index 3cb0fbd..96d56ce 100644 --- a/belt/src/belt_List.js +++ b/belt/src/belt_List.js @@ -16,10 +16,10 @@ function headExn(x) { return x.hd; } throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + cause: { + RE_EXN_ID: "Not_found" + } + }); } function tail(x) { @@ -34,10 +34,10 @@ function tailExn(x) { return x.tl; } throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + cause: { + RE_EXN_ID: "Not_found" + } + }); } function add(xs, x) { @@ -53,7 +53,7 @@ function get(x, n) { } else { let _x = x; let _n = n; - while(true) { + while (true) { let n$1 = _n; let x$1 = _x; if (!x$1) { @@ -72,14 +72,14 @@ function get(x, n) { function getExn(x, n) { if (n < 0) { throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + cause: { + RE_EXN_ID: "Not_found" + } + }); } let _x = x; let _n = n; - while(true) { + while (true) { let n$1 = _n; let x$1 = _x; if (x$1) { @@ -91,15 +91,15 @@ function getExn(x, n) { continue; } throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + cause: { + RE_EXN_ID: "Not_found" + } + }); }; } function partitionAux(p, _cell, _precX, _precY) { - while(true) { + while (true) { let precY = _precY; let precX = _precX; let cell = _cell; @@ -126,7 +126,7 @@ function partitionAux(p, _cell, _precX, _precY) { } function splitAux(_cell, _precX, _precY) { - while(true) { + while (true) { let precY = _precY; let precX = _precX; let cell = _cell; @@ -152,7 +152,7 @@ function splitAux(_cell, _precX, _precY) { } function copyAuxCont(_cellX, _prec) { - while(true) { + while (true) { let prec = _prec; let cellX = _cellX; if (!cellX) { @@ -170,7 +170,7 @@ function copyAuxCont(_cellX, _prec) { } function copyAuxWitFilter(f, _cellX, _prec) { - while(true) { + while (true) { let prec = _prec; let cellX = _cellX; if (!cellX) { @@ -194,7 +194,7 @@ function copyAuxWitFilter(f, _cellX, _prec) { } function copyAuxWithFilterIndex(f, _cellX, _prec, _i) { - while(true) { + while (true) { let i = _i; let prec = _prec; let cellX = _cellX; @@ -221,7 +221,7 @@ function copyAuxWithFilterIndex(f, _cellX, _prec, _i) { } function copyAuxWitFilterMap(f, _cellX, _prec) { - while(true) { + while (true) { let prec = _prec; let cellX = _cellX; if (!cellX) { @@ -245,7 +245,7 @@ function copyAuxWitFilterMap(f, _cellX, _prec) { } function removeAssocAuxWithMap(_cellX, x, _prec, f) { - while(true) { + while (true) { let prec = _prec; let cellX = _cellX; if (!cellX) { @@ -269,7 +269,7 @@ function removeAssocAuxWithMap(_cellX, x, _prec, f) { } function setAssocAuxWithMap(_cellX, x, k, _prec, eq) { - while(true) { + while (true) { let prec = _prec; let cellX = _cellX; if (!cellX) { @@ -299,7 +299,7 @@ function setAssocAuxWithMap(_cellX, x, k, _prec, eq) { } function copyAuxWithMap(_cellX, _prec, f) { - while(true) { + while (true) { let prec = _prec; let cellX = _cellX; if (!cellX) { @@ -317,7 +317,7 @@ function copyAuxWithMap(_cellX, _prec, f) { } function zipAux(_cellX, _cellY, _prec) { - while(true) { + while (true) { let prec = _prec; let cellY = _cellY; let cellX = _cellX; @@ -343,7 +343,7 @@ function zipAux(_cellX, _cellY, _prec) { } function copyAuxWithMap2(f, _cellX, _cellY, _prec) { - while(true) { + while (true) { let prec = _prec; let cellY = _cellY; let cellX = _cellX; @@ -366,7 +366,7 @@ function copyAuxWithMap2(f, _cellX, _cellY, _prec) { } function copyAuxWithMapI(f, _i, _cellX, _prec) { - while(true) { + while (true) { let prec = _prec; let cellX = _cellX; let i = _i; @@ -386,7 +386,7 @@ function copyAuxWithMapI(f, _i, _cellX, _prec) { } function takeAux(_n, _cell, _prec) { - while(true) { + while (true) { let prec = _prec; let cell = _cell; let n = _n; @@ -409,7 +409,7 @@ function takeAux(_n, _cell, _prec) { } function splitAtAux(_n, _cell, _prec) { - while(true) { + while (true) { let prec = _prec; let cell = _cell; let n = _n; @@ -458,7 +458,7 @@ function drop(lst, n) { } else { let _l = lst; let _n = n; - while(true) { + while (true) { let n$1 = _n; let l = _l; if (n$1 === 0) { @@ -562,7 +562,7 @@ function makeBy(n, f) { }; let cur = headX; let i = 1; - while(i < n) { + while (i < n) { let v = { hd: f(i), tl: /* [] */0 @@ -584,7 +584,7 @@ function make(n, v) { }; let cur = headX; let i = 1; - while(i < n) { + while (i < n) { let v$1 = { hd: v, tl: /* [] */0 @@ -599,7 +599,7 @@ function make(n, v) { function length(xs) { let _x = xs; let _acc = 0; - while(true) { + while (true) { let acc = _acc; let x = _x; if (!x) { @@ -612,7 +612,7 @@ function length(xs) { } function fillAux(arr, _i, _x) { - while(true) { + while (true) { let x = _x; let i = _i; if (!x) { @@ -628,7 +628,7 @@ function fillAux(arr, _i, _x) { function fromArray(a) { let _i = a.length - 1 | 0; let _res = /* [] */0; - while(true) { + while (true) { let res = _res; let i = _i; if (i < 0) { @@ -657,7 +657,7 @@ function shuffle(xs) { } function reverseConcat(_l1, _l2) { - while(true) { + while (true) { let l2 = _l2; let l1 = _l1; if (!l1) { @@ -677,7 +677,7 @@ function reverse(l) { } function flattenAux(_prec, _xs) { - while(true) { + while (true) { let xs = _xs; let prec = _prec; if (xs) { @@ -691,7 +691,7 @@ function flattenAux(_prec, _xs) { } function flatten(_xs) { - while(true) { + while (true) { let xs = _xs; if (!xs) { return /* [] */0; @@ -720,7 +720,7 @@ function concatMany(xs) { } let len$1 = xs.length; let v = xs[len$1 - 1 | 0]; - for(let i = len$1 - 2 | 0; i >= 0; --i){ + for (let i = len$1 - 2 | 0; i >= 0; --i) { v = concat(xs[i], v); } return v; @@ -729,7 +729,7 @@ function concatMany(xs) { function mapReverse(l, f) { let _accu = /* [] */0; let _xs = l; - while(true) { + while (true) { let xs = _xs; let accu = _accu; if (!xs) { @@ -745,7 +745,7 @@ function mapReverse(l, f) { } function forEach(_xs, f) { - while(true) { + while (true) { let xs = _xs; if (!xs) { return; @@ -759,7 +759,7 @@ function forEach(_xs, f) { function forEachWithIndex(l, f) { let _xs = l; let _i = 0; - while(true) { + while (true) { let i = _i; let xs = _xs; if (!xs) { @@ -773,7 +773,7 @@ function forEachWithIndex(l, f) { } function reduce(_l, _accu, f) { - while(true) { + while (true) { let accu = _accu; let l = _l; if (!l) { @@ -806,7 +806,7 @@ function reduceWithIndex(l, acc, f) { let _l = l; let _acc = acc; let _i = 0; - while(true) { + while (true) { let i = _i; let acc$1 = _acc; let l$1 = _l; @@ -824,7 +824,7 @@ function mapReverse2(l1, l2, f) { let _l1 = l1; let _l2 = l2; let _accu = /* [] */0; - while(true) { + while (true) { let accu = _accu; let l2$1 = _l2; let l1$1 = _l1; @@ -845,7 +845,7 @@ function mapReverse2(l1, l2, f) { } function forEach2(_l1, _l2, f) { - while(true) { + while (true) { let l2 = _l2; let l1 = _l1; if (!l1) { @@ -862,7 +862,7 @@ function forEach2(_l1, _l2, f) { } function reduce2(_l1, _l2, _accu, f) { - while(true) { + while (true) { let accu = _accu; let l2 = _l2; let l1 = _l1; @@ -897,7 +897,7 @@ function reduceReverse2(l1, l2, acc, f) { } function every(_xs, p) { - while(true) { + while (true) { let xs = _xs; if (!xs) { return true; @@ -911,7 +911,7 @@ function every(_xs, p) { } function some(_xs, p) { - while(true) { + while (true) { let xs = _xs; if (!xs) { return false; @@ -925,7 +925,7 @@ function some(_xs, p) { } function every2(_l1, _l2, p) { - while(true) { + while (true) { let l2 = _l2; let l1 = _l1; if (!l1) { @@ -944,7 +944,7 @@ function every2(_l1, _l2, p) { } function cmpByLength(_l1, _l2) { - while(true) { + while (true) { let l2 = _l2; let l1 = _l1; if (!l1) { @@ -964,7 +964,7 @@ function cmpByLength(_l1, _l2) { } function cmp(_l1, _l2, p) { - while(true) { + while (true) { let l2 = _l2; let l1 = _l1; if (!l1) { @@ -988,7 +988,7 @@ function cmp(_l1, _l2, p) { } function eq(_l1, _l2, p) { - while(true) { + while (true) { let l2 = _l2; let l1 = _l1; if (!l1) { @@ -1011,7 +1011,7 @@ function eq(_l1, _l2, p) { } function some2(_l1, _l2, p) { - while(true) { + while (true) { let l2 = _l2; let l1 = _l1; if (!l1) { @@ -1030,7 +1030,7 @@ function some2(_l1, _l2, p) { } function has(_xs, x, eq) { - while(true) { + while (true) { let xs = _xs; if (!xs) { return false; @@ -1044,7 +1044,7 @@ function has(_xs, x, eq) { } function getAssoc(_xs, x, eq) { - while(true) { + while (true) { let xs = _xs; if (!xs) { return; @@ -1059,7 +1059,7 @@ function getAssoc(_xs, x, eq) { } function hasAssoc(_xs, x, eq) { - while(true) { + while (true) { let xs = _xs; if (!xs) { return false; @@ -1139,7 +1139,7 @@ function sort(xs, cmp) { } function getBy(_xs, p) { - while(true) { + while (true) { let xs = _xs; if (!xs) { return; @@ -1154,7 +1154,7 @@ function getBy(_xs, p) { } function keep(_xs, p) { - while(true) { + while (true) { let xs = _xs; if (!xs) { return /* [] */0; @@ -1177,7 +1177,7 @@ function keep(_xs, p) { function keepWithIndex(xs, p) { let _xs = xs; let _i = 0; - while(true) { + while (true) { let i = _i; let xs$1 = _xs; if (!xs$1) { @@ -1200,7 +1200,7 @@ function keepWithIndex(xs, p) { } function keepMap(_xs, p) { - while(true) { + while (true) { let xs = _xs; if (!xs) { return /* [] */0; diff --git a/belt/src/belt_MapDict.js b/belt/src/belt_MapDict.js index a0c6d56..4d5de81 100644 --- a/belt/src/belt_MapDict.js +++ b/belt/src/belt_MapDict.js @@ -127,7 +127,7 @@ function remove(n, x, cmp) { function mergeMany(h, arr, cmp) { let len = arr.length; let v = h; - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { let match = arr[i]; v = set(v, match[0], match[1], cmp); } @@ -196,17 +196,13 @@ function split(n, x, cmp) { function merge(s1, s2, f, cmp) { if (s1 === undefined) { if (s2 !== undefined) { - return Belt_internalAVLtree.keepMap(s2, (function (k, v) { - return f(k, undefined, Caml_option.some(v)); - })); + return Belt_internalAVLtree.keepMap(s2, (k, v) => f(k, undefined, Caml_option.some(v))); } else { return; } } if (s2 === undefined) { - return Belt_internalAVLtree.keepMap(s1, (function (k, v) { - return f(k, Caml_option.some(v), undefined); - })); + return Belt_internalAVLtree.keepMap(s1, (k, v) => f(k, Caml_option.some(v), undefined)); } if (s1.h >= s2.h) { let v1 = s1.k; @@ -243,7 +239,7 @@ function removeMany(t, keys, cmp) { if (t !== undefined) { let _t = t; let _i = 0; - while(true) { + while (true) { let i = _i; let t$1 = _t; if (i >= len) { diff --git a/belt/src/belt_MapInt.js b/belt/src/belt_MapInt.js index e149988..74ac273 100644 --- a/belt/src/belt_MapInt.js +++ b/belt/src/belt_MapInt.js @@ -121,7 +121,7 @@ function removeMany(t, keys) { if (t !== undefined) { let _t = t; let _i = 0; - while(true) { + while (true) { let i = _i; let t$1 = _t; if (i >= len) { @@ -143,7 +143,7 @@ function removeMany(t, keys) { function mergeMany(h, arr) { let len = arr.length; let v = h; - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { let match = arr[i]; v = set(v, match[0], match[1]); } diff --git a/belt/src/belt_MapString.js b/belt/src/belt_MapString.js index edd1b63..3c57f8c 100644 --- a/belt/src/belt_MapString.js +++ b/belt/src/belt_MapString.js @@ -121,7 +121,7 @@ function removeMany(t, keys) { if (t !== undefined) { let _t = t; let _i = 0; - while(true) { + while (true) { let i = _i; let t$1 = _t; if (i >= len) { @@ -143,7 +143,7 @@ function removeMany(t, keys) { function mergeMany(h, arr) { let len = arr.length; let v = h; - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { let match = arr[i]; v = set(v, match[0], match[1]); } diff --git a/belt/src/belt_MutableMap.js b/belt/src/belt_MutableMap.js index 8e6cccc..83c9c0e 100644 --- a/belt/src/belt_MutableMap.js +++ b/belt/src/belt_MutableMap.js @@ -54,7 +54,7 @@ function remove(d, k) { } function removeArrayMutateAux(_t, xs, _i, len, cmp) { - while(true) { + while (true) { let i = _i; let t = _t; if (i >= len) { @@ -284,7 +284,7 @@ function set(m, e, v) { function mergeManyAux(t, xs, cmp) { let v = t; - for(let i = 0 ,i_finish = xs.length; i < i_finish; ++i){ + for (let i = 0, i_finish = xs.length; i < i_finish; ++i) { let match = xs[i]; v = Belt_internalAVLtree.updateMutate(v, match[0], match[1], cmp); } diff --git a/belt/src/belt_MutableMapInt.js b/belt/src/belt_MutableMapInt.js index abd5b46..a139517 100644 --- a/belt/src/belt_MutableMapInt.js +++ b/belt/src/belt_MutableMapInt.js @@ -214,7 +214,7 @@ function update(t, x, f) { } function removeArrayMutateAux(_t, xs, _i, len) { - while(true) { + while (true) { let i = _i; let t = _t; if (i >= len) { diff --git a/belt/src/belt_MutableMapString.js b/belt/src/belt_MutableMapString.js index 2af1002..5d2a99a 100644 --- a/belt/src/belt_MutableMapString.js +++ b/belt/src/belt_MutableMapString.js @@ -214,7 +214,7 @@ function update(t, x, f) { } function removeArrayMutateAux(_t, xs, _i, len) { - while(true) { + while (true) { let i = _i; let t = _t; if (i >= len) { diff --git a/belt/src/belt_MutableQueue.js b/belt/src/belt_MutableQueue.js index 54acbc9..a11c035 100644 --- a/belt/src/belt_MutableQueue.js +++ b/belt/src/belt_MutableQueue.js @@ -55,10 +55,10 @@ function peekExn(q) { return v.content; } throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + cause: { + RE_EXN_ID: "Not_found" + } + }); } function pop(q) { @@ -91,10 +91,10 @@ function popExn(q) { } } throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + cause: { + RE_EXN_ID: "Not_found" + } + }); } function popUndefined(q) { @@ -121,7 +121,7 @@ function copy(q) { }; let _prev; let _cell = q.first; - while(true) { + while (true) { let cell = _cell; let prev = _prev; if (cell !== undefined) { @@ -152,7 +152,7 @@ function map(q, f) { }; let _prev; let _cell = q.first; - while(true) { + while (true) { let cell = _cell; let prev = _prev; if (cell !== undefined) { @@ -185,7 +185,7 @@ function size(q) { function forEach(q, f) { let _cell = q.first; - while(true) { + while (true) { let cell = _cell; if (cell === undefined) { return; @@ -199,7 +199,7 @@ function forEach(q, f) { function reduce(q, accu, f) { let _accu = accu; let _cell = q.first; - while(true) { + while (true) { let cell = _cell; let accu$1 = _accu; if (cell === undefined) { @@ -231,7 +231,7 @@ function transfer(q1, q2) { } function fillAux(_i, arr, _cell) { - while(true) { + while (true) { let cell = _cell; let i = _i; if (cell === undefined) { @@ -256,7 +256,7 @@ function fromArray(arr) { first: undefined, last: undefined }; - for(let i = 0 ,i_finish = arr.length; i < i_finish; ++i){ + for (let i = 0, i_finish = arr.length; i < i_finish; ++i) { add(q, arr[i]); } return q; diff --git a/belt/src/belt_MutableSet.js b/belt/src/belt_MutableSet.js index e7b7939..0b32cee 100644 --- a/belt/src/belt_MutableSet.js +++ b/belt/src/belt_MutableSet.js @@ -52,7 +52,7 @@ function remove(d, v) { } function removeMany0(_t, xs, _i, len, cmp) { - while(true) { + while (true) { let i = _i; let t = _t; if (i >= len) { @@ -174,7 +174,7 @@ function add(m, e) { function addArrayMutate(t, xs, cmp) { let v = t; - for(let i = 0 ,i_finish = xs.length; i < i_finish; ++i){ + for (let i = 0, i_finish = xs.length; i < i_finish; ++i) { v = Belt_internalAVLset.addMutate(cmp, v, xs[i]); } return v; diff --git a/belt/src/belt_MutableSetInt.js b/belt/src/belt_MutableSetInt.js index 7732baa..eaddadf 100644 --- a/belt/src/belt_MutableSetInt.js +++ b/belt/src/belt_MutableSetInt.js @@ -52,7 +52,7 @@ function remove(d, v) { } function removeMany0(_t, xs, _i, len) { - while(true) { + while (true) { let i = _i; let t = _t; if (i >= len) { @@ -172,7 +172,7 @@ function add(d, k) { function addArrayMutate(t, xs) { let v = t; - for(let i = 0 ,i_finish = xs.length; i < i_finish; ++i){ + for (let i = 0, i_finish = xs.length; i < i_finish; ++i) { v = Belt_internalSetInt.addMutate(v, xs[i]); } return v; diff --git a/belt/src/belt_MutableSetString.js b/belt/src/belt_MutableSetString.js index 58cc4f0..b7c243d 100644 --- a/belt/src/belt_MutableSetString.js +++ b/belt/src/belt_MutableSetString.js @@ -52,7 +52,7 @@ function remove(d, v) { } function removeMany0(_t, xs, _i, len) { - while(true) { + while (true) { let i = _i; let t = _t; if (i >= len) { @@ -172,7 +172,7 @@ function add(d, k) { function addArrayMutate(t, xs) { let v = t; - for(let i = 0 ,i_finish = xs.length; i < i_finish; ++i){ + for (let i = 0, i_finish = xs.length; i < i_finish; ++i) { v = Belt_internalSetString.addMutate(v, xs[i]); } return v; diff --git a/belt/src/belt_MutableStack.js b/belt/src/belt_MutableStack.js index 883c44b..3a4c96c 100644 --- a/belt/src/belt_MutableStack.js +++ b/belt/src/belt_MutableStack.js @@ -68,7 +68,7 @@ function size(s) { if (x !== undefined) { let _x = x; let _acc = 0; - while(true) { + while (true) { let acc = _acc; let x$1 = _x; let x$2 = x$1.tail; @@ -86,7 +86,7 @@ function size(s) { function forEach(s, f) { let _s = s.root; - while(true) { + while (true) { let s$1 = _s; if (s$1 === undefined) { return; @@ -98,7 +98,7 @@ function forEach(s, f) { } function dynamicPopIter(s, f) { - while(true) { + while (true) { let match = s.root; if (match === undefined) { return; diff --git a/belt/src/belt_Option.js b/belt/src/belt_Option.js index dce4800..3a12069 100644 --- a/belt/src/belt_Option.js +++ b/belt/src/belt_Option.js @@ -21,10 +21,10 @@ function getExn(x) { return Caml_option.valFromOption(x); } throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + cause: { + RE_EXN_ID: "Not_found" + } + }); } function mapWithDefault(opt, $$default, f) { diff --git a/belt/src/belt_Range.js b/belt/src/belt_Range.js index 47f750e..1cc6096 100644 --- a/belt/src/belt_Range.js +++ b/belt/src/belt_Range.js @@ -2,13 +2,13 @@ function forEach(s, f, action) { - for(let i = s; i <= f; ++i){ + for (let i = s; i <= f; ++i) { action(i); } } function every(_s, f, p) { - while(true) { + while (true) { let s = _s; if (s > f) { return true; @@ -24,7 +24,7 @@ function every(_s, f, p) { function everyBy(s, f, step, p) { if (step > 0) { let _s = s; - while(true) { + while (true) { let s$1 = _s; if (s$1 > f) { return true; @@ -41,7 +41,7 @@ function everyBy(s, f, step, p) { } function some(_s, f, p) { - while(true) { + while (true) { let s = _s; if (s > f) { return false; @@ -57,7 +57,7 @@ function some(_s, f, p) { function someBy(s, f, step, p) { if (step > 0) { let _s = s; - while(true) { + while (true) { let s$1 = _s; if (s$1 > f) { return false; diff --git a/belt/src/belt_Result.js b/belt/src/belt_Result.js index 8e9dce6..90f1370 100644 --- a/belt/src/belt_Result.js +++ b/belt/src/belt_Result.js @@ -6,10 +6,10 @@ function getExn(x) { return x._0; } throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + cause: { + RE_EXN_ID: "Not_found" + } + }); } function mapWithDefault(opt, $$default, f) { diff --git a/belt/src/belt_SetDict.js b/belt/src/belt_SetDict.js index ddf9fbb..b390704 100644 --- a/belt/src/belt_SetDict.js +++ b/belt/src/belt_SetDict.js @@ -69,7 +69,7 @@ function remove(t, x, cmp) { function mergeMany(h, arr, cmp) { let len = arr.length; let v = h; - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { let key = arr[i]; v = add(v, key, cmp); } @@ -79,7 +79,7 @@ function mergeMany(h, arr, cmp) { function removeMany(h, arr, cmp) { let len = arr.length; let v = h; - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { let key = arr[i]; v = remove(v, key, cmp); } diff --git a/belt/src/belt_SetInt.js b/belt/src/belt_SetInt.js index 3690d69..3758141 100644 --- a/belt/src/belt_SetInt.js +++ b/belt/src/belt_SetInt.js @@ -32,7 +32,7 @@ function add(t, x) { function mergeMany(h, arr) { let len = arr.length; let v = h; - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { let key = arr[i]; v = add(v, key); } @@ -78,7 +78,7 @@ function remove(t, x) { function removeMany(h, arr) { let len = arr.length; let v = h; - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { let key = arr[i]; v = remove(v, key); } diff --git a/belt/src/belt_SetString.js b/belt/src/belt_SetString.js index 581ebb5..731c871 100644 --- a/belt/src/belt_SetString.js +++ b/belt/src/belt_SetString.js @@ -32,7 +32,7 @@ function add(t, x) { function mergeMany(h, arr) { let len = arr.length; let v = h; - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { let key = arr[i]; v = add(v, key); } @@ -78,7 +78,7 @@ function remove(t, x) { function removeMany(h, arr) { let len = arr.length; let v = h; - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { let key = arr[i]; v = remove(v, key); } diff --git a/belt/src/belt_SortArray.js b/belt/src/belt_SortArray.js index 1633e57..a1d32d8 100644 --- a/belt/src/belt_SortArray.js +++ b/belt/src/belt_SortArray.js @@ -3,7 +3,7 @@ import * as Belt_Array from "./belt_Array.js"; function sortedLengthAuxMore(xs, _prec, _acc, len, lt) { - while(true) { + while (true) { let acc = _acc; let prec = _prec; if (acc >= len) { @@ -29,7 +29,7 @@ function strictlySortedLength(xs, lt) { if (lt(x0, x1)) { let _prec = x1; let _acc = 2; - while(true) { + while (true) { let acc = _acc; let prec = _prec; if (acc >= len) { @@ -57,7 +57,7 @@ function isSorted(a, cmp) { } else { let _i = 0; let last_bound = len - 1 | 0; - while(true) { + while (true) { let i = _i; if (i === last_bound) { return true; @@ -79,7 +79,7 @@ function merge(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, cmp) let _i2 = src2ofs; let _s2 = src2[src2ofs]; let _d = dstofs; - while(true) { + while (true) { let d = _d; let s2 = _s2; let i2 = _i2; @@ -116,7 +116,7 @@ function union(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, cmp) let _i2 = src2ofs; let _s2 = src2[src2ofs]; let _d = dstofs; - while(true) { + while (true) { let d = _d; let s2 = _s2; let i2 = _i2; @@ -179,7 +179,7 @@ function intersect(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, c let _i2 = src2ofs; let _s2 = src2[src2ofs]; let _d = dstofs; - while(true) { + while (true) { let d = _d; let s2 = _s2; let i2 = _i2; @@ -228,7 +228,7 @@ function diff(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, cmp) { let _i2 = src2ofs; let _s2 = src2[src2ofs]; let _d = dstofs; - while(true) { + while (true) { let d = _d; let s2 = _s2; let i2 = _i2; @@ -276,10 +276,10 @@ function diff(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, cmp) { } function insertionSort(src, srcofs, dst, dstofs, len, cmp) { - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { let e = src[srcofs + i | 0]; let j = (dstofs + i | 0) - 1 | 0; - while(j >= dstofs && cmp(dst[j], e) > 0) { + while (j >= dstofs && cmp(dst[j], e) > 0) { dst[j + 1 | 0] = dst[j]; j = j - 1 | 0; }; @@ -334,7 +334,7 @@ function binarySearchBy(sorted, key, cmp) { } else { let _lo = 0; let _hi = len - 1 | 0; - while(true) { + while (true) { let hi$1 = _hi; let lo$1 = _lo; let mid = (lo$1 + hi$1 | 0) / 2 | 0; diff --git a/belt/src/belt_SortArrayInt.js b/belt/src/belt_SortArrayInt.js index 2ba1e57..efedb6a 100644 --- a/belt/src/belt_SortArrayInt.js +++ b/belt/src/belt_SortArrayInt.js @@ -3,7 +3,7 @@ import * as Belt_Array from "./belt_Array.js"; function sortedLengthAuxMore(xs, _prec, _acc, len) { - while(true) { + while (true) { let acc = _acc; let prec = _prec; if (acc >= len) { @@ -29,7 +29,7 @@ function strictlySortedLength(xs) { if (x0 < x1) { let _prec = x1; let _acc = 2; - while(true) { + while (true) { let acc = _acc; let prec = _prec; if (acc >= len) { @@ -57,7 +57,7 @@ function isSorted(a) { } else { let _i = 0; let last_bound = len - 1 | 0; - while(true) { + while (true) { let i = _i; if (i === last_bound) { return true; @@ -79,7 +79,7 @@ function merge(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs) { let _i2 = src2ofs; let _s2 = src2[src2ofs]; let _d = dstofs; - while(true) { + while (true) { let d = _d; let s2 = _s2; let i2 = _i2; @@ -116,7 +116,7 @@ function union(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs) { let _i2 = src2ofs; let _s2 = src2[src2ofs]; let _d = dstofs; - while(true) { + while (true) { let d = _d; let s2 = _s2; let i2 = _i2; @@ -178,7 +178,7 @@ function intersect(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs) { let _i2 = src2ofs; let _s2 = src2[src2ofs]; let _d = dstofs; - while(true) { + while (true) { let d = _d; let s2 = _s2; let i2 = _i2; @@ -226,7 +226,7 @@ function diff(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs) { let _i2 = src2ofs; let _s2 = src2[src2ofs]; let _d = dstofs; - while(true) { + while (true) { let d = _d; let s2 = _s2; let i2 = _i2; @@ -273,10 +273,10 @@ function diff(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs) { } function insertionSort(src, srcofs, dst, dstofs, len) { - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { let e = src[srcofs + i | 0]; let j = (dstofs + i | 0) - 1 | 0; - while(j >= dstofs && dst[j] > e) { + while (j >= dstofs && dst[j] > e) { dst[j + 1 | 0] = dst[j]; j = j - 1 | 0; }; @@ -329,7 +329,7 @@ function binarySearch(sorted, key) { } else { let _lo = 0; let _hi = len - 1 | 0; - while(true) { + while (true) { let hi$1 = _hi; let lo$1 = _lo; let mid = (lo$1 + hi$1 | 0) / 2 | 0; diff --git a/belt/src/belt_SortArrayString.js b/belt/src/belt_SortArrayString.js index 2ba1e57..efedb6a 100644 --- a/belt/src/belt_SortArrayString.js +++ b/belt/src/belt_SortArrayString.js @@ -3,7 +3,7 @@ import * as Belt_Array from "./belt_Array.js"; function sortedLengthAuxMore(xs, _prec, _acc, len) { - while(true) { + while (true) { let acc = _acc; let prec = _prec; if (acc >= len) { @@ -29,7 +29,7 @@ function strictlySortedLength(xs) { if (x0 < x1) { let _prec = x1; let _acc = 2; - while(true) { + while (true) { let acc = _acc; let prec = _prec; if (acc >= len) { @@ -57,7 +57,7 @@ function isSorted(a) { } else { let _i = 0; let last_bound = len - 1 | 0; - while(true) { + while (true) { let i = _i; if (i === last_bound) { return true; @@ -79,7 +79,7 @@ function merge(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs) { let _i2 = src2ofs; let _s2 = src2[src2ofs]; let _d = dstofs; - while(true) { + while (true) { let d = _d; let s2 = _s2; let i2 = _i2; @@ -116,7 +116,7 @@ function union(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs) { let _i2 = src2ofs; let _s2 = src2[src2ofs]; let _d = dstofs; - while(true) { + while (true) { let d = _d; let s2 = _s2; let i2 = _i2; @@ -178,7 +178,7 @@ function intersect(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs) { let _i2 = src2ofs; let _s2 = src2[src2ofs]; let _d = dstofs; - while(true) { + while (true) { let d = _d; let s2 = _s2; let i2 = _i2; @@ -226,7 +226,7 @@ function diff(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs) { let _i2 = src2ofs; let _s2 = src2[src2ofs]; let _d = dstofs; - while(true) { + while (true) { let d = _d; let s2 = _s2; let i2 = _i2; @@ -273,10 +273,10 @@ function diff(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs) { } function insertionSort(src, srcofs, dst, dstofs, len) { - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { let e = src[srcofs + i | 0]; let j = (dstofs + i | 0) - 1 | 0; - while(j >= dstofs && dst[j] > e) { + while (j >= dstofs && dst[j] > e) { dst[j + 1 | 0] = dst[j]; j = j - 1 | 0; }; @@ -329,7 +329,7 @@ function binarySearch(sorted, key) { } else { let _lo = 0; let _hi = len - 1 | 0; - while(true) { + while (true) { let hi$1 = _hi; let lo$1 = _lo; let mid = (lo$1 + hi$1 | 0) / 2 | 0; diff --git a/belt/src/belt_internalAVLset.js b/belt/src/belt_internalAVLset.js index 3772d6d..6982fc9 100644 --- a/belt/src/belt_internalAVLset.js +++ b/belt/src/belt_internalAVLset.js @@ -82,7 +82,7 @@ function bal(l, v, r) { } function min0Aux(_n) { - while(true) { + while (true) { let n = _n; let n$1 = n.l; if (n$1 === undefined) { @@ -108,7 +108,7 @@ function minUndefined(n) { } function max0Aux(_n) { - while(true) { + while (true) { let n = _n; let n$1 = n.r; if (n$1 === undefined) { @@ -148,7 +148,7 @@ function isEmpty(n) { } function stackAllLeft(_v, _s) { - while(true) { + while (true) { let s = _s; let v = _v; if (v === undefined) { @@ -164,7 +164,7 @@ function stackAllLeft(_v, _s) { } function forEach(_n, f) { - while(true) { + while (true) { let n = _n; if (n === undefined) { return; @@ -177,7 +177,7 @@ function forEach(_n, f) { } function reduce(_s, _accu, f) { - while(true) { + while (true) { let accu = _accu; let s = _s; if (s === undefined) { @@ -190,7 +190,7 @@ function reduce(_s, _accu, f) { } function every(_n, p) { - while(true) { + while (true) { let n = _n; if (n === undefined) { return true; @@ -207,7 +207,7 @@ function every(_n, p) { } function some(_n, p) { - while(true) { + while (true) { let n = _n; if (n === undefined) { return false; @@ -316,7 +316,7 @@ function size(n) { } function toListAux(_n, _accu) { - while(true) { + while (true) { let accu = _accu; let n = _n; if (n === undefined) { @@ -336,7 +336,7 @@ function toList(s) { } function checkInvariantInternal(_v) { - while(true) { + while (true) { let v = _v; if (v === undefined) { return; @@ -350,15 +350,15 @@ function checkInvariantInternal(_v) { ) | 0; if (!(diff <= 2 && diff >= -2)) { throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "belt_internalAVLset.res", - 310, - 4 - ] - } - }); + cause: { + RE_EXN_ID: "Assert_failure", + _1: [ + "belt_internalAVLset.res", + 310, + 4 + ] + } + }); } checkInvariantInternal(l); _v = r; @@ -367,7 +367,7 @@ function checkInvariantInternal(_v) { } function fillArray(_n, _i, arr) { - while(true) { + while (true) { let i = _i; let n = _n; let v = n.v; @@ -386,7 +386,7 @@ function fillArray(_n, _i, arr) { } function fillArrayWithPartition(_n, cursor, arr, p) { - while(true) { + while (true) { let n = _n; let v = n.v; let l = n.l; @@ -412,7 +412,7 @@ function fillArrayWithPartition(_n, cursor, arr, p) { } function fillArrayWithFilter(_n, _i, arr, p) { - while(true) { + while (true) { let i = _i; let n = _n; let v = n.v; @@ -442,28 +442,28 @@ function toArray(n) { function fromSortedArrayRevAux(arr, off, len) { switch (len) { case 0 : - return; + return; case 1 : - return singleton(arr[off]); + return singleton(arr[off]); case 2 : - let x0 = arr[off]; - let x1 = arr[off - 1 | 0]; - return { - v: x1, - h: 2, - l: singleton(x0), - r: undefined - }; + let x0 = arr[off]; + let x1 = arr[off - 1 | 0]; + return { + v: x1, + h: 2, + l: singleton(x0), + r: undefined + }; case 3 : - let x0$1 = arr[off]; - let x1$1 = arr[off - 1 | 0]; - let x2 = arr[off - 2 | 0]; - return { - v: x1$1, - h: 2, - l: singleton(x0$1), - r: singleton(x2) - }; + let x0$1 = arr[off]; + let x1$1 = arr[off - 1 | 0]; + let x2 = arr[off - 2 | 0]; + return { + v: x1$1, + h: 2, + l: singleton(x0$1), + r: singleton(x2) + }; default: let nl = len / 2 | 0; let left = fromSortedArrayRevAux(arr, off, nl); @@ -476,28 +476,28 @@ function fromSortedArrayRevAux(arr, off, len) { function fromSortedArrayAux(arr, off, len) { switch (len) { case 0 : - return; + return; case 1 : - return singleton(arr[off]); + return singleton(arr[off]); case 2 : - let x0 = arr[off]; - let x1 = arr[off + 1 | 0]; - return { - v: x1, - h: 2, - l: singleton(x0), - r: undefined - }; + let x0 = arr[off]; + let x1 = arr[off + 1 | 0]; + return { + v: x1, + h: 2, + l: singleton(x0), + r: undefined + }; case 3 : - let x0$1 = arr[off]; - let x1$1 = arr[off + 1 | 0]; - let x2 = arr[off + 2 | 0]; - return { - v: x1$1, - h: 2, - l: singleton(x0$1), - r: singleton(x2) - }; + let x0$1 = arr[off]; + let x1$1 = arr[off + 1 | 0]; + let x2 = arr[off + 2 | 0]; + return { + v: x1$1, + h: 2, + l: singleton(x0$1), + r: singleton(x2) + }; default: let nl = len / 2 | 0; let left = fromSortedArrayAux(arr, off, nl); @@ -565,7 +565,7 @@ function partitionCopy(n, p) { } function has(_t, x, cmp) { - while(true) { + while (true) { let t = _t; if (t === undefined) { return false; @@ -586,7 +586,7 @@ function cmp(s1, s2, cmp$1) { if (len1 === len2) { let _e1 = stackAllLeft(s1, /* [] */0); let _e2 = stackAllLeft(s2, /* [] */0); - while(true) { + while (true) { let e2 = _e2; let e1 = _e1; if (!e1) { @@ -617,7 +617,7 @@ function eq(s1, s2, c) { } function subset(_s1, _s2, cmp) { - while(true) { + while (true) { let s2 = _s2; let s1 = _s1; if (s1 === undefined) { @@ -657,7 +657,7 @@ function subset(_s1, _s2, cmp) { } function get(_n, x, cmp) { - while(true) { + while (true) { let n = _n; if (n === undefined) { return; @@ -673,7 +673,7 @@ function get(_n, x, cmp) { } function getUndefined(_n, x, cmp) { - while(true) { + while (true) { let n = _n; if (n === undefined) { return; @@ -689,7 +689,7 @@ function getUndefined(_n, x, cmp) { } function getExn(_n, x, cmp) { - while(true) { + while (true) { let n = _n; if (n !== undefined) { let v = n.v; @@ -701,10 +701,10 @@ function getExn(_n, x, cmp) { continue; } throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + cause: { + RE_EXN_ID: "Not_found" + } + }); }; } @@ -827,9 +827,7 @@ function fromArray(xs, cmp) { if (len === 0) { return; } - let next = Belt_SortArray.strictlySortedLength(xs, (function (x, y) { - return cmp(x, y) < 0; - })); + let next = Belt_SortArray.strictlySortedLength(xs, (x, y) => cmp(x, y) < 0); let result; if (next >= 0) { result = fromSortedArrayAux(xs, 0, next); @@ -837,7 +835,7 @@ function fromArray(xs, cmp) { next = -next | 0; result = fromSortedArrayRevAux(xs, next - 1 | 0, next); } - for(let i = next; i < len; ++i){ + for (let i = next; i < len; ++i) { result = addMutate(cmp, result, xs[i]); } return result; diff --git a/belt/src/belt_internalAVLtree.js b/belt/src/belt_internalAVLtree.js index 43e9d4b..56f39f1 100644 --- a/belt/src/belt_internalAVLtree.js +++ b/belt/src/belt_internalAVLtree.js @@ -104,7 +104,7 @@ function bal(l, x, d, r) { } function minKey0Aux(_n) { - while(true) { + while (true) { let n = _n; let n$1 = n.l; if (n$1 === undefined) { @@ -130,7 +130,7 @@ function minKeyUndefined(n) { } function maxKey0Aux(_n) { - while(true) { + while (true) { let n = _n; let n$1 = n.r; if (n$1 === undefined) { @@ -156,7 +156,7 @@ function maxKeyUndefined(n) { } function minKV0Aux(_n) { - while(true) { + while (true) { let n = _n; let n$1 = n.l; if (n$1 === undefined) { @@ -185,7 +185,7 @@ function minUndefined(n) { } function maxKV0Aux(_n) { - while(true) { + while (true) { let n = _n; let n$1 = n.r; if (n$1 === undefined) { @@ -229,7 +229,7 @@ function isEmpty(x) { } function stackAllLeft(_v, _s) { - while(true) { + while (true) { let s = _s; let v = _v; if (v === undefined) { @@ -269,7 +269,7 @@ function findFirstBy(n, p) { } function forEach(_n, f) { - while(true) { + while (true) { let n = _n; if (n === undefined) { return; @@ -315,7 +315,7 @@ function mapWithKey(n, f) { } function reduce(_m, _accu, f) { - while(true) { + while (true) { let accu = _accu; let m = _m; if (m === undefined) { @@ -332,7 +332,7 @@ function reduce(_m, _accu, f) { } function every(_n, p) { - while(true) { + while (true) { let n = _n; if (n === undefined) { return true; @@ -349,7 +349,7 @@ function every(_n, p) { } function some(_n, p) { - while(true) { + while (true) { let n = _n; if (n === undefined) { return false; @@ -510,7 +510,7 @@ function size(n) { } function toListAux(_n, _accu) { - while(true) { + while (true) { let accu = _accu; let n = _n; if (n === undefined) { @@ -537,7 +537,7 @@ function toList(s) { } function checkInvariantInternal(_v) { - while(true) { + while (true) { let v = _v; if (v === undefined) { return; @@ -547,15 +547,15 @@ function checkInvariantInternal(_v) { let diff = treeHeight(l) - treeHeight(r) | 0; if (!(diff <= 2 && diff >= -2)) { throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "belt_internalAVLtree.res", - 439, - 4 - ] - } - }); + cause: { + RE_EXN_ID: "Assert_failure", + _1: [ + "belt_internalAVLtree.res", + 439, + 4 + ] + } + }); } checkInvariantInternal(l); _v = r; @@ -564,7 +564,7 @@ function checkInvariantInternal(_v) { } function fillArrayKey(_n, _i, arr) { - while(true) { + while (true) { let i = _i; let n = _n; let v = n.k; @@ -583,7 +583,7 @@ function fillArrayKey(_n, _i, arr) { } function fillArrayValue(_n, _i, arr) { - while(true) { + while (true) { let i = _i; let n = _n; let l = n.l; @@ -601,7 +601,7 @@ function fillArrayValue(_n, _i, arr) { } function fillArray(_n, _i, arr) { - while(true) { + while (true) { let i = _i; let n = _n; let l = n.l; @@ -655,36 +655,36 @@ function valuesToArray(n) { function fromSortedArrayRevAux(arr, off, len) { switch (len) { case 0 : - return; + return; case 1 : - let match = arr[off]; - return singleton(match[0], match[1]); + let match = arr[off]; + return singleton(match[0], match[1]); case 2 : - let match_0 = arr[off]; - let match_1 = arr[off - 1 | 0]; - let match$1 = match_1; - let match$2 = match_0; - return { - k: match$1[0], - v: match$1[1], - h: 2, - l: singleton(match$2[0], match$2[1]), - r: undefined - }; + let match_0 = arr[off]; + let match_1 = arr[off - 1 | 0]; + let match$1 = match_1; + let match$2 = match_0; + return { + k: match$1[0], + v: match$1[1], + h: 2, + l: singleton(match$2[0], match$2[1]), + r: undefined + }; case 3 : - let match_0$1 = arr[off]; - let match_1$1 = arr[off - 1 | 0]; - let match_2 = arr[off - 2 | 0]; - let match$3 = match_2; - let match$4 = match_1$1; - let match$5 = match_0$1; - return { - k: match$4[0], - v: match$4[1], - h: 2, - l: singleton(match$5[0], match$5[1]), - r: singleton(match$3[0], match$3[1]) - }; + let match_0$1 = arr[off]; + let match_1$1 = arr[off - 1 | 0]; + let match_2 = arr[off - 2 | 0]; + let match$3 = match_2; + let match$4 = match_1$1; + let match$5 = match_0$1; + return { + k: match$4[0], + v: match$4[1], + h: 2, + l: singleton(match$5[0], match$5[1]), + r: singleton(match$3[0], match$3[1]) + }; default: let nl = len / 2 | 0; let left = fromSortedArrayRevAux(arr, off, nl); @@ -697,36 +697,36 @@ function fromSortedArrayRevAux(arr, off, len) { function fromSortedArrayAux(arr, off, len) { switch (len) { case 0 : - return; + return; case 1 : - let match = arr[off]; - return singleton(match[0], match[1]); + let match = arr[off]; + return singleton(match[0], match[1]); case 2 : - let match_0 = arr[off]; - let match_1 = arr[off + 1 | 0]; - let match$1 = match_1; - let match$2 = match_0; - return { - k: match$1[0], - v: match$1[1], - h: 2, - l: singleton(match$2[0], match$2[1]), - r: undefined - }; + let match_0 = arr[off]; + let match_1 = arr[off + 1 | 0]; + let match$1 = match_1; + let match$2 = match_0; + return { + k: match$1[0], + v: match$1[1], + h: 2, + l: singleton(match$2[0], match$2[1]), + r: undefined + }; case 3 : - let match_0$1 = arr[off]; - let match_1$1 = arr[off + 1 | 0]; - let match_2 = arr[off + 2 | 0]; - let match$3 = match_2; - let match$4 = match_1$1; - let match$5 = match_0$1; - return { - k: match$4[0], - v: match$4[1], - h: 2, - l: singleton(match$5[0], match$5[1]), - r: singleton(match$3[0], match$3[1]) - }; + let match_0$1 = arr[off]; + let match_1$1 = arr[off + 1 | 0]; + let match_2 = arr[off + 2 | 0]; + let match$3 = match_2; + let match$4 = match_1$1; + let match$5 = match_0$1; + return { + k: match$4[0], + v: match$4[1], + h: 2, + l: singleton(match$5[0], match$5[1]), + r: singleton(match$3[0], match$3[1]) + }; default: let nl = len / 2 | 0; let left = fromSortedArrayAux(arr, off, nl); @@ -746,7 +746,7 @@ function cmp(s1, s2, kcmp, vcmp) { if (len1 === len2) { let _e1 = stackAllLeft(s1, /* [] */0); let _e2 = stackAllLeft(s2, /* [] */0); - while(true) { + while (true) { let e2 = _e2; let e1 = _e1; if (!e1) { @@ -782,7 +782,7 @@ function eq(s1, s2, kcmp, veq) { if (len1 === len2) { let _e1 = stackAllLeft(s1, /* [] */0); let _e2 = stackAllLeft(s2, /* [] */0); - while(true) { + while (true) { let e2 = _e2; let e1 = _e1; if (!e1) { @@ -806,7 +806,7 @@ function eq(s1, s2, kcmp, veq) { } function get(_n, x, cmp) { - while(true) { + while (true) { let n = _n; if (n === undefined) { return; @@ -822,7 +822,7 @@ function get(_n, x, cmp) { } function getUndefined(_n, x, cmp) { - while(true) { + while (true) { let n = _n; if (n === undefined) { return; @@ -838,7 +838,7 @@ function getUndefined(_n, x, cmp) { } function getExn(_n, x, cmp) { - while(true) { + while (true) { let n = _n; if (n !== undefined) { let v = n.k; @@ -850,15 +850,15 @@ function getExn(_n, x, cmp) { continue; } throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + cause: { + RE_EXN_ID: "Not_found" + } + }); }; } function getWithDefault(_n, x, def, cmp) { - while(true) { + while (true) { let n = _n; if (n === undefined) { return def; @@ -874,7 +874,7 @@ function getWithDefault(_n, x, def, cmp) { } function has(_n, x, cmp) { - while(true) { + while (true) { let n = _n; if (n === undefined) { return false; @@ -1001,9 +1001,7 @@ function fromArray(xs, cmp) { if (len === 0) { return; } - let next = Belt_SortArray.strictlySortedLength(xs, (function (param, param$1) { - return cmp(param[0], param$1[0]) < 0; - })); + let next = Belt_SortArray.strictlySortedLength(xs, (param, param$1) => cmp(param[0], param$1[0]) < 0); let result; if (next >= 0) { result = fromSortedArrayAux(xs, 0, next); @@ -1011,7 +1009,7 @@ function fromArray(xs, cmp) { next = -next | 0; result = fromSortedArrayRevAux(xs, next - 1 | 0, next); } - for(let i = next; i < len; ++i){ + for (let i = next; i < len; ++i) { let match = xs[i]; result = updateMutate(result, match[0], match[1], cmp); } diff --git a/belt/src/belt_internalBuckets.js b/belt/src/belt_internalBuckets.js index a6c67c5..06de5c1 100644 --- a/belt/src/belt_internalBuckets.js +++ b/belt/src/belt_internalBuckets.js @@ -17,7 +17,7 @@ function copyBucket(c) { } function copyAuxCont(_c, _prec) { - while(true) { + while (true) { let prec = _prec; let c = _c; if (c === undefined) { @@ -38,7 +38,7 @@ function copyAuxCont(_c, _prec) { function copyBuckets(buckets) { let len = buckets.length; let newBuckets = new Array(len); - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { newBuckets[i] = copyBucket(buckets[i]); } return newBuckets; @@ -54,7 +54,7 @@ function copy(x) { } function bucketLength(_accu, _buckets) { - while(true) { + while (true) { let buckets = _buckets; let accu = _accu; if (buckets === undefined) { @@ -67,7 +67,7 @@ function bucketLength(_accu, _buckets) { } function do_bucket_iter(f, _buckets) { - while(true) { + while (true) { let buckets = _buckets; if (buckets === undefined) { return; @@ -80,13 +80,13 @@ function do_bucket_iter(f, _buckets) { function forEach(h, f) { let d = h.buckets; - for(let i = 0 ,i_finish = d.length; i < i_finish; ++i){ + for (let i = 0, i_finish = d.length; i < i_finish; ++i) { do_bucket_iter(f, d[i]); } } function do_bucket_fold(f, _b, _accu) { - while(true) { + while (true) { let accu = _accu; let b = _b; if (b === undefined) { @@ -101,32 +101,30 @@ function do_bucket_fold(f, _b, _accu) { function reduce(h, init, f) { let d = h.buckets; let accu = init; - for(let i = 0 ,i_finish = d.length; i < i_finish; ++i){ + for (let i = 0, i_finish = d.length; i < i_finish; ++i) { accu = do_bucket_fold(f, d[i], accu); } return accu; } function getMaxBucketLength(h) { - return Belt_Array.reduce(h.buckets, 0, (function (m, b) { + return Belt_Array.reduce(h.buckets, 0, (m, b) => { let len = bucketLength(0, b); if (m > len) { return m; } else { return len; } - })); + }); } function getBucketHistogram(h) { let mbl = getMaxBucketLength(h); - let histo = Belt_Array.makeBy(mbl + 1 | 0, (function (param) { - return 0; - })); - Belt_Array.forEach(h.buckets, (function (b) { + let histo = Belt_Array.makeBy(mbl + 1 | 0, param => 0); + Belt_Array.forEach(h.buckets, b => { let l = bucketLength(0, b); histo[l] = histo[l] + 1 | 0; - })); + }); return histo; } @@ -140,7 +138,7 @@ function logStats(h) { } function filterMapInplaceBucket(f, h, i, _prec, _cell) { - while(true) { + while (true) { let cell = _cell; let prec = _prec; let n = cell.next; @@ -176,7 +174,7 @@ function filterMapInplaceBucket(f, h, i, _prec, _cell) { function keepMapInPlace(h, f) { let h_buckets = h.buckets; - for(let i = 0 ,i_finish = h_buckets.length; i < i_finish; ++i){ + for (let i = 0, i_finish = h_buckets.length; i < i_finish; ++i) { let v = h_buckets[i]; if (v !== undefined) { filterMapInplaceBucket(f, h, i, undefined, v); @@ -186,7 +184,7 @@ function keepMapInPlace(h, f) { } function fillArray(_i, arr, _cell) { - while(true) { + while (true) { let cell = _cell; let i = _i; arr[i] = [ @@ -204,7 +202,7 @@ function fillArray(_i, arr, _cell) { } function fillArrayMap(_i, arr, _cell, f) { - while(true) { + while (true) { let cell = _cell; let i = _i; arr[i] = f(cell); @@ -222,7 +220,7 @@ function linear(h, f) { let d = h.buckets; let current = 0; let arr = new Array(h.size); - for(let i = 0 ,i_finish = d.length; i < i_finish; ++i){ + for (let i = 0, i_finish = d.length; i < i_finish; ++i) { let cell = d[i]; if (cell !== undefined) { current = fillArrayMap(current, arr, cell, f); @@ -233,24 +231,18 @@ function linear(h, f) { } function keysToArray(h) { - return linear(h, (function (x) { - return x.key; - })); + return linear(h, x => x.key); } function valuesToArray(h) { - return linear(h, (function (x) { - return x.value; - })); + return linear(h, x => x.value); } function toArray(h) { - return linear(h, (function (x) { - return [ - x.key, - x.value - ]; - })); + return linear(h, x => [ + x.key, + x.value + ]); } let C; diff --git a/belt/src/belt_internalBucketsType.js b/belt/src/belt_internalBucketsType.js index 39d523f..d2101f5 100644 --- a/belt/src/belt_internalBucketsType.js +++ b/belt/src/belt_internalBucketsType.js @@ -2,7 +2,7 @@ function power_2_above(_x, n) { - while(true) { + while (true) { let x = _x; if (x >= n) { return x; @@ -29,7 +29,7 @@ function clear(h) { h.size = 0; let h_buckets = h.buckets; let len = h_buckets.length; - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { h_buckets[i] = undefined; } } diff --git a/belt/src/belt_internalMapInt.js b/belt/src/belt_internalMapInt.js index 223f8bd..93cf073 100644 --- a/belt/src/belt_internalMapInt.js +++ b/belt/src/belt_internalMapInt.js @@ -22,7 +22,7 @@ function add(t, x, data) { } function get(_n, x) { - while(true) { + while (true) { let n = _n; if (n === undefined) { return; @@ -37,7 +37,7 @@ function get(_n, x) { } function getUndefined(_n, x) { - while(true) { + while (true) { let n = _n; if (n === undefined) { return; @@ -52,7 +52,7 @@ function getUndefined(_n, x) { } function getExn(_n, x) { - while(true) { + while (true) { let n = _n; if (n !== undefined) { let v = n.k; @@ -63,15 +63,15 @@ function getExn(_n, x) { continue; } throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + cause: { + RE_EXN_ID: "Not_found" + } + }); }; } function getWithDefault(_n, x, def) { - while(true) { + while (true) { let n = _n; if (n === undefined) { return def; @@ -86,7 +86,7 @@ function getWithDefault(_n, x, def) { } function has(_n, x) { - while(true) { + while (true) { let n = _n; if (n === undefined) { return false; @@ -209,7 +209,7 @@ function merge(s1, s2, f) { } function compareAux(_e1, _e2, vcmp) { - while(true) { + while (true) { let e2 = _e2; let e1 = _e1; if (!e1) { @@ -247,7 +247,7 @@ function cmp(s1, s2, cmp$1) { } function eqAux(_e1, _e2, eq) { - while(true) { + while (true) { let e2 = _e2; let e1 = _e1; if (!e1) { @@ -303,9 +303,7 @@ function fromArray(xs) { if (len === 0) { return; } - let next = Belt_SortArray.strictlySortedLength(xs, (function (param, param$1) { - return param[0] < param$1[0]; - })); + let next = Belt_SortArray.strictlySortedLength(xs, (param, param$1) => param[0] < param$1[0]); let result; if (next >= 0) { result = Belt_internalAVLtree.fromSortedArrayAux(xs, 0, next); @@ -313,7 +311,7 @@ function fromArray(xs) { next = -next | 0; result = Belt_internalAVLtree.fromSortedArrayRevAux(xs, next - 1 | 0, next); } - for(let i = next; i < len; ++i){ + for (let i = next; i < len; ++i) { let match = xs[i]; result = addMutate(result, match[0], match[1]); } diff --git a/belt/src/belt_internalMapString.js b/belt/src/belt_internalMapString.js index 04c95f5..e7cdec5 100644 --- a/belt/src/belt_internalMapString.js +++ b/belt/src/belt_internalMapString.js @@ -22,7 +22,7 @@ function add(t, x, data) { } function get(_n, x) { - while(true) { + while (true) { let n = _n; if (n === undefined) { return; @@ -37,7 +37,7 @@ function get(_n, x) { } function getUndefined(_n, x) { - while(true) { + while (true) { let n = _n; if (n === undefined) { return; @@ -52,7 +52,7 @@ function getUndefined(_n, x) { } function getExn(_n, x) { - while(true) { + while (true) { let n = _n; if (n !== undefined) { let v = n.k; @@ -63,15 +63,15 @@ function getExn(_n, x) { continue; } throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + cause: { + RE_EXN_ID: "Not_found" + } + }); }; } function getWithDefault(_n, x, def) { - while(true) { + while (true) { let n = _n; if (n === undefined) { return def; @@ -86,7 +86,7 @@ function getWithDefault(_n, x, def) { } function has(_n, x) { - while(true) { + while (true) { let n = _n; if (n === undefined) { return false; @@ -209,7 +209,7 @@ function merge(s1, s2, f) { } function compareAux(_e1, _e2, vcmp) { - while(true) { + while (true) { let e2 = _e2; let e1 = _e1; if (!e1) { @@ -247,7 +247,7 @@ function cmp(s1, s2, cmp$1) { } function eqAux(_e1, _e2, eq) { - while(true) { + while (true) { let e2 = _e2; let e1 = _e1; if (!e1) { @@ -303,9 +303,7 @@ function fromArray(xs) { if (len === 0) { return; } - let next = Belt_SortArray.strictlySortedLength(xs, (function (param, param$1) { - return param[0] < param$1[0]; - })); + let next = Belt_SortArray.strictlySortedLength(xs, (param, param$1) => param[0] < param$1[0]); let result; if (next >= 0) { result = Belt_internalAVLtree.fromSortedArrayAux(xs, 0, next); @@ -313,7 +311,7 @@ function fromArray(xs) { next = -next | 0; result = Belt_internalAVLtree.fromSortedArrayRevAux(xs, next - 1 | 0, next); } - for(let i = next; i < len; ++i){ + for (let i = next; i < len; ++i) { let match = xs[i]; result = addMutate(result, match[0], match[1]); } diff --git a/belt/src/belt_internalSetBuckets.js b/belt/src/belt_internalSetBuckets.js index 3c6b215..f98cc4c 100644 --- a/belt/src/belt_internalSetBuckets.js +++ b/belt/src/belt_internalSetBuckets.js @@ -3,7 +3,7 @@ import * as Belt_Array from "./belt_Array.js"; function copyAuxCont(_c, _prec) { - while(true) { + while (true) { let prec = _prec; let c = _c; if (c === undefined) { @@ -35,7 +35,7 @@ function copyBucket(c) { function copyBuckets(buckets) { let len = buckets.length; let newBuckets = new Array(len); - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { newBuckets[i] = copyBucket(buckets[i]); } return newBuckets; @@ -51,7 +51,7 @@ function copy(x) { } function bucketLength(_accu, _buckets) { - while(true) { + while (true) { let buckets = _buckets; let accu = _accu; if (buckets === undefined) { @@ -64,7 +64,7 @@ function bucketLength(_accu, _buckets) { } function doBucketIter(f, _buckets) { - while(true) { + while (true) { let buckets = _buckets; if (buckets === undefined) { return; @@ -77,13 +77,13 @@ function doBucketIter(f, _buckets) { function forEach(h, f) { let d = h.buckets; - for(let i = 0 ,i_finish = d.length; i < i_finish; ++i){ + for (let i = 0, i_finish = d.length; i < i_finish; ++i) { doBucketIter(f, d[i]); } } function fillArray(_i, arr, _cell) { - while(true) { + while (true) { let cell = _cell; let i = _i; arr[i] = cell.key; @@ -101,7 +101,7 @@ function toArray(h) { let d = h.buckets; let current = 0; let arr = new Array(h.size); - for(let i = 0 ,i_finish = d.length; i < i_finish; ++i){ + for (let i = 0, i_finish = d.length; i < i_finish; ++i) { let cell = d[i]; if (cell !== undefined) { current = fillArray(current, arr, cell); @@ -112,7 +112,7 @@ function toArray(h) { } function doBucketFold(f, _b, _accu) { - while(true) { + while (true) { let accu = _accu; let b = _b; if (b === undefined) { @@ -127,32 +127,30 @@ function doBucketFold(f, _b, _accu) { function reduce(h, init, f) { let d = h.buckets; let accu = init; - for(let i = 0 ,i_finish = d.length; i < i_finish; ++i){ + for (let i = 0, i_finish = d.length; i < i_finish; ++i) { accu = doBucketFold(f, d[i], accu); } return accu; } function getMaxBucketLength(h) { - return Belt_Array.reduce(h.buckets, 0, (function (m, b) { + return Belt_Array.reduce(h.buckets, 0, (m, b) => { let len = bucketLength(0, b); if (m > len) { return m; } else { return len; } - })); + }); } function getBucketHistogram(h) { let mbl = getMaxBucketLength(h); - let histo = Belt_Array.makeBy(mbl + 1 | 0, (function (param) { - return 0; - })); - Belt_Array.forEach(h.buckets, (function (b) { + let histo = Belt_Array.makeBy(mbl + 1 | 0, param => 0); + Belt_Array.forEach(h.buckets, b => { let l = bucketLength(0, b); histo[l] = histo[l] + 1 | 0; - })); + }); return histo; } diff --git a/belt/src/belt_internalSetInt.js b/belt/src/belt_internalSetInt.js index 94952bb..25243c2 100644 --- a/belt/src/belt_internalSetInt.js +++ b/belt/src/belt_internalSetInt.js @@ -4,7 +4,7 @@ import * as Belt_SortArrayInt from "./belt_SortArrayInt.js"; import * as Belt_internalAVLset from "./belt_internalAVLset.js"; function has(_t, x) { - while(true) { + while (true) { let t = _t; if (t === undefined) { return false; @@ -19,7 +19,7 @@ function has(_t, x) { } function compareAux(_e1, _e2) { - while(true) { + while (true) { let e2 = _e2; let e1 = _e1; if (!e1) { @@ -62,7 +62,7 @@ function eq(s1, s2) { } function subset(_s1, _s2) { - while(true) { + while (true) { let s2 = _s2; let s1 = _s1; if (s1 === undefined) { @@ -101,7 +101,7 @@ function subset(_s1, _s2) { } function get(_n, x) { - while(true) { + while (true) { let n = _n; if (n === undefined) { return; @@ -116,7 +116,7 @@ function get(_n, x) { } function getUndefined(_n, x) { - while(true) { + while (true) { let n = _n; if (n === undefined) { return; @@ -131,7 +131,7 @@ function getUndefined(_n, x) { } function getExn(_n, x) { - while(true) { + while (true) { let n = _n; if (n !== undefined) { let v = n.v; @@ -142,10 +142,10 @@ function getExn(_n, x) { continue; } throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + cause: { + RE_EXN_ID: "Not_found" + } + }); }; } @@ -180,7 +180,7 @@ function fromArray(xs) { next = -next | 0; result = Belt_internalAVLset.fromSortedArrayRevAux(xs, next - 1 | 0, next); } - for(let i = next; i < len; ++i){ + for (let i = next; i < len; ++i) { result = addMutate(result, xs[i]); } return result; diff --git a/belt/src/belt_internalSetString.js b/belt/src/belt_internalSetString.js index 120bbcf..cf752d3 100644 --- a/belt/src/belt_internalSetString.js +++ b/belt/src/belt_internalSetString.js @@ -4,7 +4,7 @@ import * as Belt_internalAVLset from "./belt_internalAVLset.js"; import * as Belt_SortArrayString from "./belt_SortArrayString.js"; function has(_t, x) { - while(true) { + while (true) { let t = _t; if (t === undefined) { return false; @@ -19,7 +19,7 @@ function has(_t, x) { } function compareAux(_e1, _e2) { - while(true) { + while (true) { let e2 = _e2; let e1 = _e1; if (!e1) { @@ -62,7 +62,7 @@ function eq(s1, s2) { } function subset(_s1, _s2) { - while(true) { + while (true) { let s2 = _s2; let s1 = _s1; if (s1 === undefined) { @@ -101,7 +101,7 @@ function subset(_s1, _s2) { } function get(_n, x) { - while(true) { + while (true) { let n = _n; if (n === undefined) { return; @@ -116,7 +116,7 @@ function get(_n, x) { } function getUndefined(_n, x) { - while(true) { + while (true) { let n = _n; if (n === undefined) { return; @@ -131,7 +131,7 @@ function getUndefined(_n, x) { } function getExn(_n, x) { - while(true) { + while (true) { let n = _n; if (n !== undefined) { let v = n.v; @@ -142,10 +142,10 @@ function getExn(_n, x) { continue; } throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + cause: { + RE_EXN_ID: "Not_found" + } + }); }; } @@ -180,7 +180,7 @@ function fromArray(xs) { next = -next | 0; result = Belt_internalAVLset.fromSortedArrayRevAux(xs, next - 1 | 0, next); } - for(let i = next; i < len; ++i){ + for (let i = next; i < len; ++i) { result = addMutate(result, xs[i]); } return result; diff --git a/core/src/Core__Array.js b/core/src/Core__Array.js index 1ab42a6..54d2f16 100644 --- a/core/src/Core__Array.js +++ b/core/src/Core__Array.js @@ -16,7 +16,7 @@ function fromInitializer(length, f) { return []; } let arr = new Array(length); - for(let i = 0; i < length; ++i){ + for (let i = 0; i < length; ++i) { arr[i] = f(i); } return arr; @@ -26,7 +26,7 @@ function equal(a, b, eq) { let len = a.length; if (len === b.length) { let _i = 0; - while(true) { + while (true) { let i = _i; if (i === len) { return true; @@ -51,7 +51,7 @@ function compare(a, b, cmp) { return 1; } else { let _i = 0; - while(true) { + while (true) { let i = _i; if (i === lenA) { return 0; @@ -118,7 +118,7 @@ function random_int(min, max) { function shuffle(xs) { let len = xs.length; - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { swapUnsafe(xs, i, random_int(i, len)); } } @@ -133,7 +133,7 @@ function filterMap(a, f) { let l = a.length; let r = new Array(l); let j = 0; - for(let i = 0; i < l; ++i){ + for (let i = 0; i < l; ++i) { let v = a[i]; let v$1 = f(v); if (v$1 !== undefined) { @@ -147,14 +147,12 @@ function filterMap(a, f) { } function keepSome(__x) { - return filterMap(__x, (function (x) { - return x; - })); + return filterMap(__x, x => x); } function findMap(arr, f) { let _i = 0; - while(true) { + while (true) { let i = _i; if (i === arr.length) { return; diff --git a/core/src/Core__AsyncIterator.js b/core/src/Core__AsyncIterator.js index 195edc4..064e2d9 100644 --- a/core/src/Core__AsyncIterator.js +++ b/core/src/Core__AsyncIterator.js @@ -3,7 +3,7 @@ async function forEach(iterator, f) { let iteratorDone = false; - while(!iteratorDone) { + while (!iteratorDone) { let match = await iterator.next(); f(match.value); iteratorDone = match.done; diff --git a/core/src/Core__Dict.js b/core/src/Core__Dict.js index fe6412a..4d12162 100644 --- a/core/src/Core__Dict.js +++ b/core/src/Core__Dict.js @@ -6,22 +6,18 @@ function $$delete$1(dict, string) { } function forEach(dict, f) { - Object.values(dict).forEach(function (value) { - f(value); - }); + Object.values(dict).forEach(value => f(value)); } function forEachWithKey(dict, f) { - Object.entries(dict).forEach(function (param) { - f(param[1], param[0]); - }); + Object.entries(dict).forEach(param => f(param[1], param[0])); } function mapValues(dict, f) { let target = {}; - forEachWithKey(dict, (function (value, key) { + forEachWithKey(dict, (value, key) => { target[key] = f(value); - })); + }); return target; } diff --git a/core/src/Core__Error.js b/core/src/Core__Error.js index 9fe3fa5..2058768 100644 --- a/core/src/Core__Error.js +++ b/core/src/Core__Error.js @@ -15,8 +15,8 @@ let $$URIError = {}; function panic(msg) { throw new Error(new Error("Panic! " + msg).RE_EXN_ID, { - cause: new Error("Panic! " + msg) - }); + cause: new Error("Panic! " + msg) + }); } export { diff --git a/core/src/Core__Int.js b/core/src/Core__Int.js index 231a883..82740b8 100644 --- a/core/src/Core__Int.js +++ b/core/src/Core__Int.js @@ -44,8 +44,8 @@ function range(start, end, optionsOpt) { } else { if (start !== end) { throw new Error(new RangeError("Incorrect range arguments").RE_EXN_ID, { - cause: new RangeError("Incorrect range arguments") - }); + cause: new RangeError("Incorrect range arguments") + }); } step = n; } @@ -62,9 +62,7 @@ function range(start, end, optionsOpt) { let range$2 = options.inclusive === true ? range$1 + 1 | 0 : range$1; length = Math.ceil(range$2 / abs(step)) | 0; } - return Core__Array.fromInitializer(length, (function (i) { - return start + Math.imul(i, step) | 0; - })); + return Core__Array.fromInitializer(length, i => start + Math.imul(i, step) | 0); } function rangeWithOptions(start, end, options) { diff --git a/core/src/Core__Iterator.js b/core/src/Core__Iterator.js index 810d17b..e793b51 100644 --- a/core/src/Core__Iterator.js +++ b/core/src/Core__Iterator.js @@ -3,7 +3,7 @@ function forEach(iterator, f) { let iteratorDone = false; - while(!iteratorDone) { + while (!iteratorDone) { let match = iterator.next(); f(match.value); iteratorDone = match.done; diff --git a/core/src/Core__JSON.js b/core/src/Core__JSON.js index e4fa1c8..bbfa0a1 100644 --- a/core/src/Core__JSON.js +++ b/core/src/Core__JSON.js @@ -5,27 +5,27 @@ function classify(value) { let match = Object.prototype.toString.call(value); switch (match) { case "[object Array]" : - return { - TAG: "Array", - _0: value - }; + return { + TAG: "Array", + _0: value + }; case "[object Boolean]" : - return { - TAG: "Bool", - _0: value - }; + return { + TAG: "Bool", + _0: value + }; case "[object Null]" : - return "Null"; + return "Null"; case "[object Number]" : - return { - TAG: "Number", - _0: value - }; + return { + TAG: "Number", + _0: value + }; case "[object String]" : - return { - TAG: "String", - _0: value - }; + return { + TAG: "String", + _0: value + }; default: return { TAG: "Object", diff --git a/core/src/Core__List.js b/core/src/Core__List.js index d47b5ea..62c5264 100644 --- a/core/src/Core__List.js +++ b/core/src/Core__List.js @@ -15,10 +15,10 @@ function headExn(x) { return x.hd; } throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + cause: { + RE_EXN_ID: "Not_found" + } + }); } function tail(x) { @@ -33,10 +33,10 @@ function tailExn(x) { return x.tl; } throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + cause: { + RE_EXN_ID: "Not_found" + } + }); } function add(xs, x) { @@ -52,7 +52,7 @@ function get(x, n) { } else { let _x = x; let _n = n; - while(true) { + while (true) { let n$1 = _n; let x$1 = _x; if (!x$1) { @@ -71,14 +71,14 @@ function get(x, n) { function getExn(x, n) { if (n < 0) { throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + cause: { + RE_EXN_ID: "Not_found" + } + }); } let _x = x; let _n = n; - while(true) { + while (true) { let n$1 = _n; let x$1 = _x; if (x$1) { @@ -90,15 +90,15 @@ function getExn(x, n) { continue; } throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + cause: { + RE_EXN_ID: "Not_found" + } + }); }; } function partitionAux(p, _cell, _precX, _precY) { - while(true) { + while (true) { let precY = _precY; let precX = _precX; let cell = _cell; @@ -125,7 +125,7 @@ function partitionAux(p, _cell, _precX, _precY) { } function splitAux(_cell, _precX, _precY) { - while(true) { + while (true) { let precY = _precY; let precX = _precX; let cell = _cell; @@ -151,7 +151,7 @@ function splitAux(_cell, _precX, _precY) { } function copyAuxCont(_cellX, _prec) { - while(true) { + while (true) { let prec = _prec; let cellX = _cellX; if (!cellX) { @@ -169,7 +169,7 @@ function copyAuxCont(_cellX, _prec) { } function copyAuxWitFilter(f, _cellX, _prec) { - while(true) { + while (true) { let prec = _prec; let cellX = _cellX; if (!cellX) { @@ -193,7 +193,7 @@ function copyAuxWitFilter(f, _cellX, _prec) { } function copyAuxWithFilterIndex(f, _cellX, _prec, _i) { - while(true) { + while (true) { let i = _i; let prec = _prec; let cellX = _cellX; @@ -220,7 +220,7 @@ function copyAuxWithFilterIndex(f, _cellX, _prec, _i) { } function copyAuxWitFilterMap(f, _cellX, _prec) { - while(true) { + while (true) { let prec = _prec; let cellX = _cellX; if (!cellX) { @@ -244,7 +244,7 @@ function copyAuxWitFilterMap(f, _cellX, _prec) { } function removeAssocAuxWithMap(_cellX, x, _prec, f) { - while(true) { + while (true) { let prec = _prec; let cellX = _cellX; if (!cellX) { @@ -268,7 +268,7 @@ function removeAssocAuxWithMap(_cellX, x, _prec, f) { } function setAssocAuxWithMap(_cellX, x, k, _prec, eq) { - while(true) { + while (true) { let prec = _prec; let cellX = _cellX; if (!cellX) { @@ -298,7 +298,7 @@ function setAssocAuxWithMap(_cellX, x, k, _prec, eq) { } function copyAuxWithMap(_cellX, _prec, f) { - while(true) { + while (true) { let prec = _prec; let cellX = _cellX; if (!cellX) { @@ -316,7 +316,7 @@ function copyAuxWithMap(_cellX, _prec, f) { } function zipAux(_cellX, _cellY, _prec) { - while(true) { + while (true) { let prec = _prec; let cellY = _cellY; let cellX = _cellX; @@ -342,7 +342,7 @@ function zipAux(_cellX, _cellY, _prec) { } function copyAuxWithMap2(f, _cellX, _cellY, _prec) { - while(true) { + while (true) { let prec = _prec; let cellY = _cellY; let cellX = _cellX; @@ -365,7 +365,7 @@ function copyAuxWithMap2(f, _cellX, _cellY, _prec) { } function copyAuxWithMapI(f, _i, _cellX, _prec) { - while(true) { + while (true) { let prec = _prec; let cellX = _cellX; let i = _i; @@ -385,7 +385,7 @@ function copyAuxWithMapI(f, _i, _cellX, _prec) { } function takeAux(_n, _cell, _prec) { - while(true) { + while (true) { let prec = _prec; let cell = _cell; let n = _n; @@ -408,7 +408,7 @@ function takeAux(_n, _cell, _prec) { } function splitAtAux(_n, _cell, _prec) { - while(true) { + while (true) { let prec = _prec; let cell = _cell; let n = _n; @@ -457,7 +457,7 @@ function drop(lst, n) { } else { let _l = lst; let _n = n; - while(true) { + while (true) { let n$1 = _n; let l = _l; if (n$1 === 0) { @@ -561,7 +561,7 @@ function fromInitializer(n, f) { }; let cur = headX; let i = 1; - while(i < n) { + while (i < n) { let v = { hd: f(i), tl: /* [] */0 @@ -583,7 +583,7 @@ function make(n, v) { }; let cur = headX; let i = 1; - while(i < n) { + while (i < n) { let v$1 = { hd: v, tl: /* [] */0 @@ -598,7 +598,7 @@ function make(n, v) { function length(xs) { let _x = xs; let _acc = 0; - while(true) { + while (true) { let acc = _acc; let x = _x; if (!x) { @@ -611,7 +611,7 @@ function length(xs) { } function fillAux(arr, _i, _x) { - while(true) { + while (true) { let x = _x; let i = _i; if (!x) { @@ -627,7 +627,7 @@ function fillAux(arr, _i, _x) { function fromArray(a) { let _i = a.length - 1 | 0; let _res = /* [] */0; - while(true) { + while (true) { let res = _res; let i = _i; if (i < 0) { @@ -656,7 +656,7 @@ function toShuffled(xs) { } function reverseConcat(_l1, _l2) { - while(true) { + while (true) { let l2 = _l2; let l1 = _l1; if (!l1) { @@ -676,7 +676,7 @@ function reverse(l) { } function flatAux(_prec, _xs) { - while(true) { + while (true) { let xs = _xs; let prec = _prec; if (xs) { @@ -690,7 +690,7 @@ function flatAux(_prec, _xs) { } function flat(_xs) { - while(true) { + while (true) { let xs = _xs; if (!xs) { return /* [] */0; @@ -719,7 +719,7 @@ function concatMany(xs) { } let len$1 = xs.length; let v = xs[len$1 - 1 | 0]; - for(let i = len$1 - 2 | 0; i >= 0; --i){ + for (let i = len$1 - 2 | 0; i >= 0; --i) { v = concat(xs[i], v); } return v; @@ -728,7 +728,7 @@ function concatMany(xs) { function mapReverse(l, f) { let _accu = /* [] */0; let _xs = l; - while(true) { + while (true) { let xs = _xs; let accu = _accu; if (!xs) { @@ -744,7 +744,7 @@ function mapReverse(l, f) { } function forEach(_xs, f) { - while(true) { + while (true) { let xs = _xs; if (!xs) { return; @@ -758,7 +758,7 @@ function forEach(_xs, f) { function forEachWithIndex(l, f) { let _xs = l; let _i = 0; - while(true) { + while (true) { let i = _i; let xs = _xs; if (!xs) { @@ -772,7 +772,7 @@ function forEachWithIndex(l, f) { } function reduce(_l, _accu, f) { - while(true) { + while (true) { let accu = _accu; let l = _l; if (!l) { @@ -799,7 +799,7 @@ function reduceReverse(l, acc, f) { } else { let a = toArray(l); let r = acc; - for(let i = a.length - 1 | 0; i >= 0; --i){ + for (let i = a.length - 1 | 0; i >= 0; --i) { r = f(r, a[i]); } return r; @@ -810,7 +810,7 @@ function reduceWithIndex(l, acc, f) { let _l = l; let _acc = acc; let _i = 0; - while(true) { + while (true) { let i = _i; let acc$1 = _acc; let l$1 = _l; @@ -828,7 +828,7 @@ function mapReverse2(l1, l2, f) { let _l1 = l1; let _l2 = l2; let _accu = /* [] */0; - while(true) { + while (true) { let accu = _accu; let l2$1 = _l2; let l1$1 = _l1; @@ -849,7 +849,7 @@ function mapReverse2(l1, l2, f) { } function forEach2(_l1, _l2, f) { - while(true) { + while (true) { let l2 = _l2; let l1 = _l1; if (!l1) { @@ -866,7 +866,7 @@ function forEach2(_l1, _l2, f) { } function reduce2(_l1, _l2, _accu, f) { - while(true) { + while (true) { let accu = _accu; let l2 = _l2; let l1 = _l1; @@ -900,7 +900,7 @@ function reduceReverse2(l1, l2, acc, f) { let b = toArray(l2); let r = acc; let len$1 = a.length < b.length ? a.length : b.length; - for(let i = len$1 - 1 | 0; i >= 0; --i){ + for (let i = len$1 - 1 | 0; i >= 0; --i) { r = f(r, a[i], b[i]); } return r; @@ -908,7 +908,7 @@ function reduceReverse2(l1, l2, acc, f) { } function every(_xs, p) { - while(true) { + while (true) { let xs = _xs; if (!xs) { return true; @@ -922,7 +922,7 @@ function every(_xs, p) { } function some(_xs, p) { - while(true) { + while (true) { let xs = _xs; if (!xs) { return false; @@ -936,7 +936,7 @@ function some(_xs, p) { } function every2(_l1, _l2, p) { - while(true) { + while (true) { let l2 = _l2; let l1 = _l1; if (!l1) { @@ -955,7 +955,7 @@ function every2(_l1, _l2, p) { } function compareLength(_l1, _l2) { - while(true) { + while (true) { let l2 = _l2; let l1 = _l1; if (!l1) { @@ -975,7 +975,7 @@ function compareLength(_l1, _l2) { } function compare(_l1, _l2, p) { - while(true) { + while (true) { let l2 = _l2; let l1 = _l1; if (!l1) { @@ -999,7 +999,7 @@ function compare(_l1, _l2, p) { } function equal(_l1, _l2, p) { - while(true) { + while (true) { let l2 = _l2; let l1 = _l1; if (!l1) { @@ -1022,7 +1022,7 @@ function equal(_l1, _l2, p) { } function some2(_l1, _l2, p) { - while(true) { + while (true) { let l2 = _l2; let l1 = _l1; if (!l1) { @@ -1041,7 +1041,7 @@ function some2(_l1, _l2, p) { } function has(_xs, x, eq) { - while(true) { + while (true) { let xs = _xs; if (!xs) { return false; @@ -1055,7 +1055,7 @@ function has(_xs, x, eq) { } function getAssoc(_xs, x, eq) { - while(true) { + while (true) { let xs = _xs; if (!xs) { return; @@ -1070,7 +1070,7 @@ function getAssoc(_xs, x, eq) { } function hasAssoc(_xs, x, eq) { - while(true) { + while (true) { let xs = _xs; if (!xs) { return false; @@ -1150,7 +1150,7 @@ function sort(xs, cmp) { } function find(_xs, p) { - while(true) { + while (true) { let xs = _xs; if (!xs) { return; @@ -1165,7 +1165,7 @@ function find(_xs, p) { } function filter(_xs, p) { - while(true) { + while (true) { let xs = _xs; if (!xs) { return /* [] */0; @@ -1188,7 +1188,7 @@ function filter(_xs, p) { function filterWithIndex(xs, p) { let _xs = xs; let _i = 0; - while(true) { + while (true) { let i = _i; let xs$1 = _xs; if (!xs$1) { @@ -1211,7 +1211,7 @@ function filterWithIndex(xs, p) { } function filterMap(_xs, p) { - while(true) { + while (true) { let xs = _xs; if (!xs) { return /* [] */0; diff --git a/core/src/Core__Null.js b/core/src/Core__Null.js index 1f534d6..336dd74 100644 --- a/core/src/Core__Null.js +++ b/core/src/Core__Null.js @@ -32,11 +32,11 @@ function getExn(value) { return value; } throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Null.getExn: value is null" - } - }); + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Null.getExn: value is null" + } + }); } function forEach(value, f) { diff --git a/core/src/Core__Nullable.js b/core/src/Core__Nullable.js index 0d56720..0dd5a73 100644 --- a/core/src/Core__Nullable.js +++ b/core/src/Core__Nullable.js @@ -31,11 +31,11 @@ function getExn(value) { return value; } throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Nullable.getExn: value is null or undefined" - } - }); + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Nullable.getExn: value is null or undefined" + } + }); } function forEach(value, f) { diff --git a/core/src/Core__Promise.js b/core/src/Core__Promise.js index ebf49d5..f49ed2c 100644 --- a/core/src/Core__Promise.js +++ b/core/src/Core__Promise.js @@ -3,9 +3,7 @@ import * as Caml_js_exceptions from "rescript/lib/es6/caml_js_exceptions.js"; function $$catch(promise, callback) { - return promise.catch(function (err) { - return callback(Caml_js_exceptions.internalToOCamlException(err)); - }); + return promise.catch(err => callback(Caml_js_exceptions.internalToOCamlException(err))); } export { diff --git a/core/src/Core__Result.js b/core/src/Core__Result.js index 471da83..422a24c 100644 --- a/core/src/Core__Result.js +++ b/core/src/Core__Result.js @@ -6,10 +6,10 @@ function getExn(x) { return x._0; } throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + cause: { + RE_EXN_ID: "Not_found" + } + }); } function mapOr(opt, $$default, f) { diff --git a/core/src/Core__Type.js b/core/src/Core__Type.js index 1656f95..9ee5d6e 100644 --- a/core/src/Core__Type.js +++ b/core/src/Core__Type.js @@ -5,41 +5,41 @@ function classify(value) { let match = Object.prototype.toString.call(value); switch (match) { case "[object BigInt]" : - return { - TAG: "BigInt", - _0: value - }; + return { + TAG: "BigInt", + _0: value + }; case "[object Boolean]" : - return { - TAG: "Bool", - _0: value - }; + return { + TAG: "Bool", + _0: value + }; case "[object AsyncFunction]" : case "[object Function]" : case "[object GeneratorFunction]" : - return { - TAG: "Function", - _0: value - }; + return { + TAG: "Function", + _0: value + }; case "[object Null]" : - return "Null"; + return "Null"; case "[object Number]" : - return { - TAG: "Number", - _0: value - }; + return { + TAG: "Number", + _0: value + }; case "[object String]" : - return { - TAG: "String", - _0: value - }; + return { + TAG: "String", + _0: value + }; case "[object Symbol]" : - return { - TAG: "Symbol", - _0: value - }; + return { + TAG: "Symbol", + _0: value + }; case "[object Undefined]" : - return "Undefined"; + return "Undefined"; default: return { TAG: "Object", diff --git a/core/src/intl/Core__Intl__NumberFormat__Grouping.js b/core/src/intl/Core__Intl__NumberFormat__Grouping.js index f6ff6e0..f0ea8ab 100644 --- a/core/src/intl/Core__Intl__NumberFormat__Grouping.js +++ b/core/src/intl/Core__Intl__NumberFormat__Grouping.js @@ -9,21 +9,21 @@ function parseJsValue(value) { } switch (value$1.TAG) { case "Bool" : - return { - NAME: "bool", - VAL: value$1._0 - }; + return { + NAME: "bool", + VAL: value$1._0 + }; case "String" : - switch (value$1._0) { - case "always" : - return "always"; - case "auto" : - return "auto"; - case "min2" : - return "min2"; - default: - return; - } + switch (value$1._0) { + case "always" : + return "always"; + case "auto" : + return "auto"; + case "min2" : + return "min2"; + default: + return; + } default: return; } diff --git a/js/src/js_dict.js b/js/src/js_dict.js index 1e415d5..f209154 100644 --- a/js/src/js_dict.js +++ b/js/src/js_dict.js @@ -17,7 +17,7 @@ function entries(dict) { let keys = Object.keys(dict); let l = keys.length; let values = new Array(l); - for(let i = 0; i < l; ++i){ + for (let i = 0; i < l; ++i) { let key = keys[i]; values[i] = [ key, @@ -31,7 +31,7 @@ function values(dict) { let keys = Object.keys(dict); let l = keys.length; let values$1 = new Array(l); - for(let i = 0; i < l; ++i){ + for (let i = 0; i < l; ++i) { values$1[i] = dict[keys[i]]; } return values$1; @@ -40,7 +40,7 @@ function values(dict) { function fromList(entries) { let dict = {}; let _x = entries; - while(true) { + while (true) { let x = _x; if (!x) { return dict; @@ -55,7 +55,7 @@ function fromList(entries) { function fromArray(entries) { let dict = {}; let l = entries.length; - for(let i = 0; i < l; ++i){ + for (let i = 0; i < l; ++i) { let match = entries[i]; dict[match[0]] = match[1]; } @@ -66,7 +66,7 @@ function map(f, source) { let target = {}; let keys = Object.keys(source); let l = keys.length; - for(let i = 0; i < l; ++i){ + for (let i = 0; i < l; ++i) { let key = keys[i]; target[key] = f(source[key]); } diff --git a/js/src/js_exn.js b/js/src/js_exn.js index 6df4f31..5d9a1f8 100644 --- a/js/src/js_exn.js +++ b/js/src/js_exn.js @@ -3,44 +3,44 @@ function raiseError(str) { throw new Error(new Error(str).RE_EXN_ID, { - cause: new Error(str) - }); + cause: new Error(str) + }); } function raiseEvalError(str) { throw new Error(new EvalError(str).RE_EXN_ID, { - cause: new EvalError(str) - }); + cause: new EvalError(str) + }); } function raiseRangeError(str) { throw new Error(new RangeError(str).RE_EXN_ID, { - cause: new RangeError(str) - }); + cause: new RangeError(str) + }); } function raiseReferenceError(str) { throw new Error(new ReferenceError(str).RE_EXN_ID, { - cause: new ReferenceError(str) - }); + cause: new ReferenceError(str) + }); } function raiseSyntaxError(str) { throw new Error(new SyntaxError(str).RE_EXN_ID, { - cause: new SyntaxError(str) - }); + cause: new SyntaxError(str) + }); } function raiseTypeError(str) { throw new Error(new TypeError(str).RE_EXN_ID, { - cause: new TypeError(str) - }); + cause: new TypeError(str) + }); } function raiseUriError(str) { throw new Error(new URIError(str).RE_EXN_ID, { - cause: new URIError(str) - }); + cause: new URIError(str) + }); } let $$Error$1 = "JsError"; diff --git a/js/src/js_json.js b/js/src/js_json.js index da59041..5d1e221 100644 --- a/js/src/js_json.js +++ b/js/src/js_json.js @@ -39,22 +39,21 @@ function classify(x) { function test(x, v) { switch (v) { case "String" : - return typeof x === "string"; + return typeof x === "string"; case "Number" : - return typeof x === "number"; + return typeof x === "number"; case "Object" : - if (x !== null && typeof x === "object") { - return !Array.isArray(x); - } else { - return false; - } + if (x !== null && typeof x === "object") { + return !Array.isArray(x); + } else { + return false; + } case "Array" : - return Array.isArray(x); + return Array.isArray(x); case "Boolean" : - return typeof x === "boolean"; + return typeof x === "boolean"; case "Null" : - return x === null; - + return x === null; } } diff --git a/js/src/js_types.js b/js/src/js_types.js index 4cefeba..a8a165b 100644 --- a/js/src/js_types.js +++ b/js/src/js_types.js @@ -49,24 +49,23 @@ function classify(x) { function test(x, v) { switch (v) { case "Undefined" : - return typeof x === "undefined"; + return typeof x === "undefined"; case "Null" : - return x === null; + return x === null; case "Boolean" : - return typeof x === "boolean"; + return typeof x === "boolean"; case "Number" : - return typeof x === "number"; + return typeof x === "number"; case "String" : - return typeof x === "string"; + return typeof x === "string"; case "Function" : - return typeof x === "function"; + return typeof x === "function"; case "Object" : - return typeof x === "object"; + return typeof x === "object"; case "Symbol" : - return typeof x === "symbol"; + return typeof x === "symbol"; case "BigInt" : - return typeof x === "bigint"; - + return typeof x === "bigint"; } } diff --git a/package-lock.json b/package-lock.json index 021c05e..4861340 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,10 +15,7 @@ "js" ], "dependencies": { - "rescript": "^12.0.0-alpha.1" - }, - "devDependencies": { - "@rolandpeelen/rewatch": "^1.0.8" + "rescript": "^12.0.0-alpha.2" } }, "belt": { @@ -30,16 +27,6 @@ "js": { "version": "0.0.0" }, - "node_modules/@rolandpeelen/rewatch": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@rolandpeelen/rewatch/-/rewatch-1.0.8.tgz", - "integrity": "sha512-EXYAgNkPU3WWP795tS05OSNwUmSOOB32fh+r5W3iNDaX0Ki9LXgtN3CWexZ66bbVuUE8nveiMuFsxT1hpWTIgg==", - "dev": true, - "hasInstallScript": true, - "bin": { - "rewatch": "rewatch" - } - }, "node_modules/belt": { "resolved": "belt", "link": true @@ -57,15 +44,15 @@ "link": true }, "node_modules/rescript": { - "version": "12.0.0-alpha.1", - "resolved": "https://registry.npmjs.org/rescript/-/rescript-12.0.0-alpha.1.tgz", - "integrity": "sha512-dYUjUsRxl2m2kMt8wyYRpNDp6ahuL64mE2TFMZwv+wOdn0C6rh+FxMDSg+c8CQaCJnfErDIjCwwb0r/6Ag1Dxg==", + "version": "12.0.0-alpha.2", + "resolved": "https://registry.npmjs.org/rescript/-/rescript-12.0.0-alpha.2.tgz", + "integrity": "sha512-9htB2dOo2u9xOxCkt0ddZSoweo1SmWhfbE/YGmbfBY7k2P4fkHOcakqO6iakLQUpNYFUzL1pfTCAXzvAppJ5mA==", "hasInstallScript": true, "bin": { "bsc": "bsc", "bstracing": "lib/bstracing", "rescript": "rescript", - "rewatch": "scripts/rewatch" + "rewatch": "cli/rewatch" }, "engines": { "node": ">=18" diff --git a/package.json b/package.json index f29bbdf..e2653c9 100644 --- a/package.json +++ b/package.json @@ -18,10 +18,7 @@ "format": "rescript format */src/*.res */src/*.resi", "formatCheck": "rescript format -check */src/*.res */src/*.resi" }, - "devDependencies": { - "@rolandpeelen/rewatch": "^1.0.8" - }, "dependencies": { - "rescript": "^12.0.0-alpha.1" + "rescript": "^12.0.0-alpha.2" } } diff --git a/primitives/src/caml_array.js b/primitives/src/caml_array.js index 80fad5d..692a92b 100644 --- a/primitives/src/caml_array.js +++ b/primitives/src/caml_array.js @@ -5,7 +5,7 @@ function sub(x, offset, len) { let result = new Array(len); let j = 0; let i = offset; - while(j < len) { + while (j < len) { result[j] = x[i]; j = j + 1 | 0; i = i + 1 | 0; @@ -14,7 +14,7 @@ function sub(x, offset, len) { } function len(_acc, _l) { - while(true) { + while (true) { let l = _l; let acc = _acc; if (!l) { @@ -27,7 +27,7 @@ function len(_acc, _l) { } function fill(arr, _i, _l) { - while(true) { + while (true) { let l = _l; let i = _i; if (!l) { @@ -37,7 +37,7 @@ function fill(arr, _i, _l) { let l$1 = x.length; let k = i; let j = 0; - while(j < l$1) { + while (j < l$1) { arr[k] = x[j]; k = k + 1 | 0; j = j + 1 | 0; @@ -58,11 +58,11 @@ function concat(l) { function set(xs, index, newval) { if (index < 0 || index >= xs.length) { throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "index out of bounds" - } - }); + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds" + } + }); } xs[index] = newval; } @@ -70,18 +70,18 @@ function set(xs, index, newval) { function get(xs, index) { if (index < 0 || index >= xs.length) { throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "index out of bounds" - } - }); + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds" + } + }); } return xs[index]; } function make(len, init) { let b = new Array(len); - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { b[i] = init; } return b; @@ -89,7 +89,7 @@ function make(len, init) { function make_float(len) { let b = new Array(len); - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { b[i] = 0; } return b; @@ -97,12 +97,12 @@ function make_float(len) { function blit(a1, i1, a2, i2, len) { if (i2 <= i1) { - for(let j = 0; j < len; ++j){ + for (let j = 0; j < len; ++j) { a2[j + i2 | 0] = a1[j + i1 | 0]; } return; } - for(let j$1 = len - 1 | 0; j$1 >= 0; --j$1){ + for (let j$1 = len - 1 | 0; j$1 >= 0; --j$1) { a2[j$1 + i2 | 0] = a1[j$1 + i1 | 0]; } } diff --git a/primitives/src/caml_bigint.js b/primitives/src/caml_bigint.js index 82eb6a5..bdac616 100644 --- a/primitives/src/caml_bigint.js +++ b/primitives/src/caml_bigint.js @@ -4,10 +4,10 @@ function div(x, y) { if (y === 0n) { throw new Error("Division_by_zero", { - cause: { - RE_EXN_ID: "Division_by_zero" - } - }); + cause: { + RE_EXN_ID: "Division_by_zero" + } + }); } return x / y; } @@ -15,10 +15,10 @@ function div(x, y) { function mod_(x, y) { if (y === 0n) { throw new Error("Division_by_zero", { - cause: { - RE_EXN_ID: "Division_by_zero" - } - }); + cause: { + RE_EXN_ID: "Division_by_zero" + } + }); } return x % y; } diff --git a/primitives/src/caml_bytes.js b/primitives/src/caml_bytes.js index 423dc9b..72ae5a5 100644 --- a/primitives/src/caml_bytes.js +++ b/primitives/src/caml_bytes.js @@ -4,11 +4,11 @@ function set(s, i, ch) { if (i < 0 || i >= s.length) { throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "index out of bounds" - } - }); + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds" + } + }); } s[i] = ch; } @@ -16,11 +16,11 @@ function set(s, i, ch) { function get(s, i) { if (i < 0 || i >= s.length) { throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "index out of bounds" - } - }); + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds" + } + }); } return s[i]; } @@ -28,21 +28,21 @@ function get(s, i) { function create(len) { if (len < 0) { throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.create" - } - }); + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.create" + } + }); } let result = new Array(len); - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { result[i] = /* '\000' */0; } return result; } function bytes_compare_aux(s1, s2, _off, len, def) { - while(true) { + while (true) { let off = _off; if (off >= len) { return def; @@ -77,7 +77,7 @@ function bytes_equal(s1, s2) { let len2 = s2.length; if (len1 === len2) { let _off = 0; - while(true) { + while (true) { let off = _off; if (off === len1) { return true; diff --git a/primitives/src/caml_format.js b/primitives/src/caml_format.js index ce4c0a6..f1bb011 100644 --- a/primitives/src/caml_format.js +++ b/primitives/src/caml_format.js @@ -27,14 +27,13 @@ function parse_digit(c) { function int_of_string_base(x) { switch (x) { case "Oct" : - return 8; + return 8; case "Hex" : - return 16; + return 16; case "Dec" : - return 10; + return 10; case "Bin" : - return 2; - + return 2; } } @@ -45,14 +44,12 @@ function parse_sign_and_base(s) { let match = s.codePointAt(i); switch (match) { case 43 : - i = i + 1 | 0; - break; + i = i + 1 | 0; + break; case 45 : - sign = -1; - i = i + 1 | 0; - break; - default: - + sign = -1; + i = i + 1 | 0; + break; } if (s.codePointAt(i) === /* '0' */48) { let match$1 = s.codePointAt(i + 1 | 0); @@ -61,12 +58,12 @@ function parse_sign_and_base(s) { if (match$1 < 121) { switch (match$1) { case 111 : - base = "Oct"; - i = i + 2 | 0; - break; + base = "Oct"; + i = i + 2 | 0; + break; case 117 : - i = i + 2 | 0; - break; + i = i + 2 | 0; + break; case 112 : case 113 : case 114 : @@ -74,12 +71,11 @@ function parse_sign_and_base(s) { case 116 : case 118 : case 119 : - break; + break; case 120 : - base = "Hex"; - i = i + 2 | 0; - break; - + base = "Hex"; + i = i + 2 | 0; + break; } } @@ -92,12 +88,12 @@ function parse_sign_and_base(s) { if (match$1 >= 79) { switch (match$1) { case 79 : - base = "Oct"; - i = i + 2 | 0; - break; + base = "Oct"; + i = i + 2 | 0; + break; case 85 : - i = i + 2 | 0; - break; + i = i + 2 | 0; + break; case 80 : case 81 : case 82 : @@ -105,12 +101,11 @@ function parse_sign_and_base(s) { case 84 : case 86 : case 87 : - break; + break; case 88 : - base = "Hex"; - i = i + 2 | 0; - break; - + base = "Hex"; + i = i + 2 | 0; + break; } } @@ -136,14 +131,14 @@ function int_of_string(s) { let d = parse_digit(c); if (d < 0 || d >= base) { throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "int_of_string" - } - }); + cause: { + RE_EXN_ID: "Failure", + _1: "int_of_string" + } + }); } - let aux = function (_acc, _k) { - while(true) { + let aux = (_acc, _k) => { + while (true) { let k = _k; let acc = _acc; if (k === len) { @@ -157,20 +152,20 @@ function int_of_string(s) { let v = parse_digit(a); if (v < 0 || v >= base) { throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "int_of_string" - } - }); + cause: { + RE_EXN_ID: "Failure", + _1: "int_of_string" + } + }); } let acc$1 = base * acc + v; if (acc$1 > threshold) { throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "int_of_string" - } - }); + cause: { + RE_EXN_ID: "Failure", + _1: "int_of_string" + } + }); } _k = k + 1 | 0; _acc = acc$1; @@ -181,11 +176,11 @@ function int_of_string(s) { let or_res = res | 0; if (base === 10 && res !== or_res) { throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "int_of_string" - } - }); + cause: { + RE_EXN_ID: "Failure", + _1: "int_of_string" + } + }); } return or_res; } @@ -199,41 +194,40 @@ function int64_of_string(s) { let threshold; switch (hbase) { case "Oct" : - threshold = [ - 536870911, - 4294967295 - ]; - break; + threshold = [ + 536870911, + 4294967295 + ]; + break; case "Hex" : - threshold = [ - 268435455, - 4294967295 - ]; - break; + threshold = [ + 268435455, + 4294967295 + ]; + break; case "Dec" : - threshold = [ - 429496729, - 2576980377 - ]; - break; + threshold = [ + 429496729, + 2576980377 + ]; + break; case "Bin" : - threshold = Caml_int64.max_int; - break; - + threshold = Caml_int64.max_int; + break; } let len = s.length; let c = i < len ? s.codePointAt(i) : /* '\000' */0; let d = Caml_int64.of_int32(parse_digit(c)); if (Caml.i64_lt(d, Caml_int64.zero) || Caml.i64_ge(d, base)) { throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "int64_of_string" - } - }); + cause: { + RE_EXN_ID: "Failure", + _1: "int64_of_string" + } + }); } - let aux = function (_acc, _k) { - while(true) { + let aux = (_acc, _k) => { + while (true) { let k = _k; let acc = _acc; if (k === len) { @@ -247,11 +241,11 @@ function int64_of_string(s) { let v = Caml_int64.of_int32(parse_digit(a)); if (Caml.i64_lt(v, Caml_int64.zero) || Caml.i64_ge(v, base) || Caml.i64_gt(acc, threshold)) { throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "int64_of_string" - } - }); + cause: { + RE_EXN_ID: "Failure", + _1: "int64_of_string" + } + }); } let acc$1 = Caml_int64.add(Caml_int64.mul(base, acc), v); _k = k + 1 | 0; @@ -266,11 +260,11 @@ function int64_of_string(s) { 10 ]) && Caml.i64_neq(res, or_res)) { throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "int64_of_string" - } - }); + cause: { + RE_EXN_ID: "Failure", + _1: "int64_of_string" + } + }); } return or_res; } @@ -278,12 +272,11 @@ function int64_of_string(s) { function int_of_base(x) { switch (x) { case "Oct" : - return 8; + return 8; case "Hex" : - return 16; + return 16; case "Dec" : - return 10; - + return 10; } } @@ -299,11 +292,11 @@ function parse_format(fmt) { let len = fmt.length; if (len > 31) { throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "format_int: format too long" - } - }); + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "format_int: format too long" + } + }); } let f = { justify: "+", @@ -319,7 +312,7 @@ function parse_format(fmt) { conv: "f" }; let _i = 0; - while(true) { + while (true) { let i = _i; if (i >= len) { return f; @@ -333,27 +326,27 @@ function parse_format(fmt) { } else { switch (c) { case 88 : - f.base = "Hex"; - f.uppercase = true; - _i = i + 1 | 0; - continue; + f.base = "Hex"; + f.uppercase = true; + _i = i + 1 | 0; + continue; case 101 : case 102 : case 103 : - exit = 5; - break; + exit = 5; + break; case 100 : case 105 : - exit = 4; - break; + exit = 4; + break; case 111 : - f.base = "Oct"; - _i = i + 1 | 0; - continue; + f.base = "Oct"; + _i = i + 1 | 0; + continue; case 117 : - f.base = "Dec"; - _i = i + 1 | 0; - continue; + f.base = "Dec"; + _i = i + 1 | 0; + continue; case 89 : case 90 : case 91 : @@ -378,13 +371,12 @@ function parse_format(fmt) { case 116 : case 118 : case 119 : - exit = 1; - break; + exit = 1; + break; case 120 : - f.base = "Hex"; - _i = i + 1 | 0; - continue; - + f.base = "Hex"; + _i = i + 1 | 0; + continue; } } } else if (c >= 72) { @@ -399,33 +391,33 @@ function parse_format(fmt) { } else { switch (c) { case 35 : - f.alternate = true; - _i = i + 1 | 0; - continue; + f.alternate = true; + _i = i + 1 | 0; + continue; case 32 : case 43 : - exit = 2; - break; + exit = 2; + break; case 45 : - f.justify = "-"; - _i = i + 1 | 0; - continue; + f.justify = "-"; + _i = i + 1 | 0; + continue; case 46 : - f.prec = 0; - let j = i + 1 | 0; - while((function () { - let w = fmt.codePointAt(j) - 48 | 0; - return w >= 0 && w <= 9; - })()) { - f.prec = (Math.imul(f.prec, 10) + fmt.codePointAt(j) | 0) - 48 | 0; - j = j + 1 | 0; - }; - _i = j; - continue; + f.prec = 0; + let j = i + 1 | 0; + while ((() => { + let w = fmt.codePointAt(j) - 48 | 0; + return w >= 0 && w <= 9; + })()) { + f.prec = (Math.imul(f.prec, 10) + fmt.codePointAt(j) | 0) - 48 | 0; + j = j + 1 | 0; + }; + _i = j; + continue; case 48 : - f.filter = "0"; - _i = i + 1 | 0; - continue; + f.filter = "0"; + _i = i + 1 | 0; + continue; case 49 : case 50 : case 51 : @@ -435,43 +427,42 @@ function parse_format(fmt) { case 55 : case 56 : case 57 : - exit = 3; - break; + exit = 3; + break; default: exit = 1; } } switch (exit) { case 1 : - _i = i + 1 | 0; - continue; + _i = i + 1 | 0; + continue; case 2 : - f.signstyle = String.fromCharCode(c); - _i = i + 1 | 0; - continue; + f.signstyle = String.fromCharCode(c); + _i = i + 1 | 0; + continue; case 3 : - f.width = 0; - let j$1 = i; - while((function () { - let w = fmt.codePointAt(j$1) - 48 | 0; - return w >= 0 && w <= 9; - })()) { - f.width = (Math.imul(f.width, 10) + fmt.codePointAt(j$1) | 0) - 48 | 0; - j$1 = j$1 + 1 | 0; - }; - _i = j$1; - continue; + f.width = 0; + let j$1 = i; + while ((() => { + let w = fmt.codePointAt(j$1) - 48 | 0; + return w >= 0 && w <= 9; + })()) { + f.width = (Math.imul(f.width, 10) + fmt.codePointAt(j$1) | 0) - 48 | 0; + j$1 = j$1 + 1 | 0; + }; + _i = j$1; + continue; case 4 : - f.signedconv = true; - f.base = "Dec"; - _i = i + 1 | 0; - continue; + f.signedconv = true; + f.base = "Dec"; + _i = i + 1 | 0; + continue; case 5 : - f.signedconv = true; - f.conv = String.fromCharCode(c); - _i = i + 1 | 0; - continue; - + f.signedconv = true; + f.conv = String.fromCharCode(c); + _i = i + 1 | 0; + continue; } }; } @@ -500,7 +491,7 @@ function finish_formatting(config, rawbuffer) { } let buffer = ""; if (justify === "+" && filter === " ") { - for(let _for = len; _for < width; ++_for){ + for (let _for = len; _for < width; ++_for) { buffer = buffer + filter; } } @@ -519,13 +510,13 @@ function finish_formatting(config, rawbuffer) { buffer = buffer + "0x"; } if (justify === "+" && filter === "0") { - for(let _for$1 = len; _for$1 < width; ++_for$1){ + for (let _for$1 = len; _for$1 < width; ++_for$1) { buffer = buffer + filter; } } buffer = uppercase ? buffer + rawbuffer.toUpperCase() : buffer + rawbuffer; if (justify === "-") { - for(let _for$2 = len; _for$2 < width; ++_for$2){ + for (let _for$2 = len; _for$2 < width; ++_for$2) { buffer = buffer + " "; } } @@ -589,7 +580,7 @@ function oct_of_int64(x) { ], match[0]); let modulus = match[1]; s = cvtbl[Caml_int64.to_int32(modulus)] + s; - while(Caml.i64_neq(quotient, Caml_int64.zero)) { + while (Caml.i64_neq(quotient, Caml_int64.zero)) { let match$1 = Caml_int64.div_mod(quotient, wbase); quotient = match$1[0]; modulus = match$1[1]; @@ -600,7 +591,7 @@ function oct_of_int64(x) { let quotient$1 = match$2[0]; let modulus$1 = match$2[1]; s = cvtbl[Caml_int64.to_int32(modulus$1)] + s; - while(Caml.i64_neq(quotient$1, Caml_int64.zero)) { + while (Caml.i64_neq(quotient$1, Caml_int64.zero)) { let match$3 = Caml_int64.div_mod(quotient$1, wbase); quotient$1 = match$3[0]; modulus$1 = match$3[1]; @@ -620,15 +611,14 @@ function int64_format(fmt, x) { let s; switch (match) { case "Oct" : - s = oct_of_int64(x$1); - break; + s = oct_of_int64(x$1); + break; case "Hex" : - s = Caml_int64.to_hex(x$1); - break; + s = Caml_int64.to_hex(x$1); + break; case "Dec" : - s = dec_of_pos_int64(x$1); - break; - + s = dec_of_pos_int64(x$1); + break; } let fill_s; if (f.prec >= 0) { @@ -653,62 +643,60 @@ function format_float(fmt, x) { let match = f.conv; switch (match) { case "e" : - s = x$1.toExponential(prec); - let i = s.length; - if (Caml_string.get(s, i - 3 | 0) === /* 'e' */101) { - s = s.slice(0, i - 1 | 0) + ("0" + s.slice(i - 1 | 0)); - } - break; + s = x$1.toExponential(prec); + let i = s.length; + if (Caml_string.get(s, i - 3 | 0) === /* 'e' */101) { + s = s.slice(0, i - 1 | 0) + ("0" + s.slice(i - 1 | 0)); + } + break; case "f" : - s = x$1.toFixed(prec); - break; + s = x$1.toFixed(prec); + break; case "g" : - let prec$1 = prec !== 0 ? prec : 1; - s = x$1.toExponential(prec$1 - 1 | 0); - let j = s.indexOf("e"); - let exp = Number(s.slice(j + 1 | 0)) | 0; - if (exp < -4 || x$1 >= 1e21 || x$1.toFixed().length > prec$1) { - let i$1 = j - 1 | 0; - while(Caml_string.get(s, i$1) === /* '0' */48) { - i$1 = i$1 - 1 | 0; - }; - if (Caml_string.get(s, i$1) === /* '.' */46) { - i$1 = i$1 - 1 | 0; - } - s = s.slice(0, i$1 + 1 | 0) + s.slice(j); - let i$2 = s.length; - if (Caml_string.get(s, i$2 - 3 | 0) === /* 'e' */101) { - s = s.slice(0, i$2 - 1 | 0) + ("0" + s.slice(i$2 - 1 | 0)); - } - + let prec$1 = prec !== 0 ? prec : 1; + s = x$1.toExponential(prec$1 - 1 | 0); + let j = s.indexOf("e"); + let exp = Number(s.slice(j + 1 | 0)) | 0; + if (exp < -4 || x$1 >= 1e21 || x$1.toFixed().length > prec$1) { + let i$1 = j - 1 | 0; + while (Caml_string.get(s, i$1) === /* '0' */48) { + i$1 = i$1 - 1 | 0; + }; + if (Caml_string.get(s, i$1) === /* '.' */46) { + i$1 = i$1 - 1 | 0; + } + s = s.slice(0, i$1 + 1 | 0) + s.slice(j); + let i$2 = s.length; + if (Caml_string.get(s, i$2 - 3 | 0) === /* 'e' */101) { + s = s.slice(0, i$2 - 1 | 0) + ("0" + s.slice(i$2 - 1 | 0)); + } + + } else { + let p = prec$1; + if (exp < 0) { + p = p - (exp + 1 | 0) | 0; + s = x$1.toFixed(p); } else { - let p = prec$1; - if (exp < 0) { - p = p - (exp + 1 | 0) | 0; - s = x$1.toFixed(p); - } else { - while((function () { - s = x$1.toFixed(p); - return s.length > (prec$1 + 1 | 0); - })()) { - p = p - 1 | 0; - }; - } - if (p !== 0) { - let k = s.length - 1 | 0; - while(Caml_string.get(s, k) === /* '0' */48) { - k = k - 1 | 0; - }; - if (Caml_string.get(s, k) === /* '.' */46) { - k = k - 1 | 0; - } - s = s.slice(0, k + 1 | 0); + while ((() => { + s = x$1.toFixed(p); + return s.length > (prec$1 + 1 | 0); + })()) { + p = p - 1 | 0; + }; + } + if (p !== 0) { + let k = s.length - 1 | 0; + while (Caml_string.get(s, k) === /* '0' */48) { + k = k - 1 | 0; + }; + if (Caml_string.get(s, k) === /* '.' */46) { + k = k - 1 | 0; } - + s = s.slice(0, k + 1 | 0); } - break; - default: - + + } + break; } } else { s = "inf"; diff --git a/primitives/src/caml_hash.js b/primitives/src/caml_hash.js index 41be4c6..c238fbd 100644 --- a/primitives/src/caml_hash.js +++ b/primitives/src/caml_hash.js @@ -52,7 +52,7 @@ function hash(count, _limit, seed, obj) { let num = count; push_back(queue, obj); num = num - 1 | 0; - while(queue.length !== 0 && num > 0) { + while (queue.length !== 0 && num > 0) { let obj$1 = unsafe_pop(queue); if (typeof obj$1 === "number") { let u$1 = obj$1 | 0; @@ -72,7 +72,7 @@ function hash(count, _limit, seed, obj) { s = Caml_hash_primitive.hash_mix_int(s, tag); let v = size - 1 | 0; let block = v < num ? v : num; - for(let i = 0; i <= block; ++i){ + for (let i = 0; i <= block; ++i) { push_back(queue, obj$1[i]); } } @@ -84,9 +84,7 @@ function hash(count, _limit, seed, obj) { ++ size } return size - })(obj$1, (function (v) { - push_back(queue, v); - })); + })(obj$1, v => push_back(queue, v)); s = Caml_hash_primitive.hash_mix_int(s, (size$1 << 10) | 0); } } diff --git a/primitives/src/caml_hash_primitive.js b/primitives/src/caml_hash_primitive.js index 2407c20..bd5d599 100644 --- a/primitives/src/caml_hash_primitive.js +++ b/primitives/src/caml_hash_primitive.js @@ -27,7 +27,7 @@ function hash_mix_string(h, s) { let len = s.length; let block = (len / 4 | 0) - 1 | 0; let hash = h; - for(let i = 0; i <= block; ++i){ + for (let i = 0; i <= block; ++i) { let j = (i << 2); let w = s.charCodeAt(j) | (s.charCodeAt(j + 1 | 0) << 8) | (s.charCodeAt(j + 2 | 0) << 16) | (s.charCodeAt(j + 3 | 0) << 24); hash = hash_mix_int(hash, w); diff --git a/primitives/src/caml_int32.js b/primitives/src/caml_int32.js index d1e7064..b5cd97b 100644 --- a/primitives/src/caml_int32.js +++ b/primitives/src/caml_int32.js @@ -4,10 +4,10 @@ function div(x, y) { if (y === 0) { throw new Error("Division_by_zero", { - cause: { - RE_EXN_ID: "Division_by_zero" - } - }); + cause: { + RE_EXN_ID: "Division_by_zero" + } + }); } return x / y | 0; } @@ -15,10 +15,10 @@ function div(x, y) { function mod_(x, y) { if (y === 0) { throw new Error("Division_by_zero", { - cause: { - RE_EXN_ID: "Division_by_zero" - } - }); + cause: { + RE_EXN_ID: "Division_by_zero" + } + }); } return x % y; } diff --git a/primitives/src/caml_int64.js b/primitives/src/caml_int64.js index be9d575..7e0be85 100644 --- a/primitives/src/caml_int64.js +++ b/primitives/src/caml_int64.js @@ -191,7 +191,7 @@ function is_zero(x) { } function mul(_this, _other) { - while(true) { + while (true) { let other = _other; let $$this = _this; let lo; @@ -374,7 +374,7 @@ function to_string(self) { } function div(_self, _other) { - while(true) { + while (true) { let other = _other; let self = _self; let self_hi = self[0]; @@ -384,10 +384,10 @@ function div(_self, _other) { exit$1 = 2; } else { throw new Error("Division_by_zero", { - cause: { - RE_EXN_ID: "Division_by_zero" - } - }); + cause: { + RE_EXN_ID: "Division_by_zero" + } + }); } if (exit$1 === 2) { if (self_hi !== -2147483648) { @@ -455,14 +455,14 @@ function div(_self, _other) { } let res = zero; let rem$1 = self; - while(Caml.i64_ge(rem$1, other)) { + while (Caml.i64_ge(rem$1, other)) { let b = Math.floor(to_float(rem$1) / to_float(other)); let approx$1 = 1 > b ? 1 : b; let log2 = Math.ceil(Math.log(approx$1) / Math.LN2); let delta = log2 <= 48 ? 1 : Math.pow(2, log2 - 48); let approxRes = of_float(approx$1); let approxRem = mul(approxRes, other); - while(approxRem[0] < 0 || Caml.i64_gt(approxRem, rem$1)) { + while (approxRem[0] < 0 || Caml.i64_gt(approxRem, rem$1)) { approx$1 = approx$1 - delta; approxRes = of_float(approx$1); approxRem = mul(approxRes, other); @@ -527,9 +527,7 @@ function to_int32(x) { function to_hex(x) { let x_lo = x[1]; let x_hi = x[0]; - let aux = function (v) { - return (v >>> 0).toString(16); - }; + let aux = v => (v >>> 0).toString(16); if (x_hi === 0 && x_lo === 0) { return "0"; } diff --git a/primitives/src/caml_md5.js b/primitives/src/caml_md5.js index f25333f..8ae9fe0 100644 --- a/primitives/src/caml_md5.js +++ b/primitives/src/caml_md5.js @@ -130,30 +130,30 @@ function md5_string(s, start, len) { state[1] = -271733879; state[2] = -1732584194; state[3] = 271733878; - for(let i = 0; i <= 15; ++i){ + for (let i = 0; i <= 15; ++i) { md5blk[i] = 0; } let i_end = n / 64 | 0; - for(let i$1 = 1; i$1 <= i_end; ++i$1){ - for(let j = 0; j <= 15; ++j){ + for (let i$1 = 1; i$1 <= i_end; ++i$1) { + for (let j = 0; j <= 15; ++j) { let k = ((i$1 << 6) - 64 | 0) + (j << 2) | 0; md5blk[j] = ((s$1.charCodeAt(k) + (s$1.charCodeAt(k + 1 | 0) << 8) | 0) + (s$1.charCodeAt(k + 2 | 0) << 16) | 0) + (s$1.charCodeAt(k + 3 | 0) << 24) | 0; } cycle(state, md5blk); } let s_tail = s$1.slice((i_end << 6)); - for(let kk = 0; kk <= 15; ++kk){ + for (let kk = 0; kk <= 15; ++kk) { md5blk[kk] = 0; } let i_end$1 = s_tail.length - 1 | 0; - for(let i$2 = 0; i$2 <= i_end$1; ++i$2){ + for (let i$2 = 0; i$2 <= i_end$1; ++i$2) { md5blk[i$2 / 4 | 0] = md5blk[i$2 / 4 | 0] | (s_tail.charCodeAt(i$2) << (i$2 % 4 << 3)); } let i$3 = i_end$1 + 1 | 0; md5blk[i$3 / 4 | 0] = md5blk[i$3 / 4 | 0] | (128 << (i$3 % 4 << 3)); if (i$3 > 55) { cycle(state, md5blk); - for(let i$4 = 0; i$4 <= 15; ++i$4){ + for (let i$4 = 0; i$4 <= 15; ++i$4) { md5blk[i$4] = 0; } } diff --git a/primitives/src/caml_module.js b/primitives/src/caml_module.js index 29fd105..51988ea 100644 --- a/primitives/src/caml_module.js +++ b/primitives/src/caml_module.js @@ -3,30 +3,29 @@ import * as Caml_obj from "./caml_obj.js"; function init_mod(loc, shape) { - let undef_module = function (param) { + let undef_module = param => { throw new Error("Undefined_recursive_module", { - cause: { - RE_EXN_ID: "Undefined_recursive_module", - _1: loc - } - }); + cause: { + RE_EXN_ID: "Undefined_recursive_module", + _1: loc + } + }); }; - let loop = function (shape, struct_, idx) { + let loop = (shape, struct_, idx) => { if (typeof shape !== "object") { switch (shape) { case "Function" : case "Lazy" : - struct_[idx] = undef_module; - return; + struct_[idx] = undef_module; + return; case "Class" : - struct_[idx] = [ - undef_module, - undef_module, - undef_module, - 0 - ]; - return; - + struct_[idx] = [ + undef_module, + undef_module, + undef_module, + 0 + ]; + return; } } else { if (shape.TAG === "Module") { @@ -34,7 +33,7 @@ function init_mod(loc, shape) { let v = {}; struct_[idx] = v; let len = comps.length; - for(let i = 0; i < len; ++i){ + for (let i = 0; i < len; ++i) { let match = comps[i]; loop(match[0], v, match[1]); } @@ -51,23 +50,22 @@ function init_mod(loc, shape) { } function update_mod(shape, o, n) { - let aux = function (shape, o, n, parent, i) { + let aux = (shape, o, n, parent, i) => { if (typeof shape !== "object") { switch (shape) { case "Function" : - parent[i] = n; - return; + parent[i] = n; + return; case "Lazy" : case "Class" : - return Caml_obj.update_dummy(o, n); - + return Caml_obj.update_dummy(o, n); } } else { if (shape.TAG !== "Module") { return; } let comps = shape._0; - for(let i$1 = 0 ,i_finish = comps.length; i$1 < i_finish; ++i$1){ + for (let i$1 = 0, i_finish = comps.length; i$1 < i_finish; ++i$1) { let match = comps[i$1]; let name = match[1]; aux(match[0], o[name], n[name], o, name); @@ -77,19 +75,19 @@ function update_mod(shape, o, n) { }; if (typeof shape !== "object") { throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "caml_module.res", - 109, - 9 - ] - } - }); + cause: { + RE_EXN_ID: "Assert_failure", + _1: [ + "caml_module.res", + 109, + 9 + ] + } + }); } if (shape.TAG === "Module") { let comps = shape._0; - for(let i = 0 ,i_finish = comps.length; i < i_finish; ++i){ + for (let i = 0, i_finish = comps.length; i < i_finish; ++i) { let match = comps[i]; let name = match[1]; aux(match[0], o[name], n[name], o, name); @@ -97,15 +95,15 @@ function update_mod(shape, o, n) { return; } throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "caml_module.res", - 109, - 9 - ] - } - }); + cause: { + RE_EXN_ID: "Assert_failure", + _1: [ + "caml_module.res", + 109, + 9 + ] + } + }); } export { diff --git a/primitives/src/caml_obj.js b/primitives/src/caml_obj.js index 3c8ca64..33ee585 100644 --- a/primitives/src/caml_obj.js +++ b/primitives/src/caml_obj.js @@ -45,46 +45,44 @@ function compare(a, b) { let b_type = typeof b; switch (a_type) { case "bigint" : - if (b_type === "bigint") { - return Caml.float_compare(a, b); - } - break; + if (b_type === "bigint") { + return Caml.float_compare(a, b); + } + break; case "boolean" : - if (b_type === "boolean") { - return Caml.bool_compare(a, b); - } - break; + if (b_type === "boolean") { + return Caml.bool_compare(a, b); + } + break; case "function" : - if (b_type === "function") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "compare: functional value" - } - }); - } - break; + if (b_type === "function") { + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "compare: functional value" + } + }); + } + break; case "number" : - if (b_type === "number") { - return Caml.float_compare(a, b); - } - break; + if (b_type === "number") { + return Caml.float_compare(a, b); + } + break; case "string" : - if (b_type === "string") { - return Caml.string_compare(a, b); - } else { - return 1; - } + if (b_type === "string") { + return Caml.string_compare(a, b); + } else { + return 1; + } case "undefined" : - return -1; - default: - + return -1; } switch (b_type) { case "string" : - return -1; + return -1; case "undefined" : - return 1; + return 1; default: if (a_type === "boolean") { return 1; @@ -140,11 +138,11 @@ function compare(a, b) { } if (tag_a === 251) { throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "equal: abstract value" - } - }); + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "equal: abstract value" + } + }); } if (tag_a !== tag_b) { if (tag_a < tag_b) { @@ -158,7 +156,7 @@ function compare(a, b) { if (len_a === len_b) { if (Array.isArray(a)) { let _i = 0; - while(true) { + while (true) { let i = _i; if (i === len_a) { return 0; @@ -177,7 +175,7 @@ function compare(a, b) { } } else if (len_a < len_b) { let _i$1 = 0; - while(true) { + while (true) { let i$1 = _i$1; if (i$1 === len_a) { return -1; @@ -191,7 +189,7 @@ function compare(a, b) { }; } else { let _i$2 = 0; - while(true) { + while (true) { let i$2 = _i$2; if (i$2 === len_b) { return 1; @@ -214,11 +212,11 @@ function aux_obj_compare(a, b) { let min_key_rhs = { contents: undefined }; - let do_key = function (param) { + let do_key = param => { let min_key = param[2]; let b = param[1]; let a = param[0]; - return function (key) { + return key => { if (!(!Object.prototype.hasOwnProperty.call(b, key) || compare(a[key], b[key]) > 0)) { return; } @@ -269,11 +267,11 @@ function equal(a, b) { let b_type = typeof b; if (a_type === "function" || b_type === "function") { throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "equal: functional value" - } - }); + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "equal: functional value" + } + }); } if (b_type === "number" || b_type === "bigint" || b_type === "undefined" || b === null) { return false; @@ -285,11 +283,11 @@ function equal(a, b) { } if (tag_a === 251) { throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "equal: abstract value" - } - }); + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "equal: abstract value" + } + }); } if (tag_a !== tag_b) { return false; @@ -299,7 +297,7 @@ function equal(a, b) { if (len_a === len_b) { if (Array.isArray(a)) { let _i = 0; - while(true) { + while (true) { let i = _i; if (i === len_a) { return true; @@ -316,14 +314,14 @@ function equal(a, b) { let result = { contents: true }; - let do_key_a = function (key) { + let do_key_a = key => { if (!Object.prototype.hasOwnProperty.call(b, key)) { result.contents = false; return; } }; - let do_key_b = function (key) { + let do_key_b = key => { if (!Object.prototype.hasOwnProperty.call(a, key) || !equal(b[key], a[key])) { result.contents = false; return; diff --git a/primitives/src/caml_string.js b/primitives/src/caml_string.js index 4ed21b8..8fe93ba 100644 --- a/primitives/src/caml_string.js +++ b/primitives/src/caml_string.js @@ -4,11 +4,11 @@ function get(s, i) { if (i >= s.length || i < 0) { throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "index out of bounds" - } - }); + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds" + } + }); } return s.codePointAt(i); } diff --git a/primitives/src/caml_sys.js b/primitives/src/caml_sys.js index d0a2aa2..c1b42a6 100644 --- a/primitives/src/caml_sys.js +++ b/primitives/src/caml_sys.js @@ -4,20 +4,20 @@ function sys_getenv(s) { if (typeof process === "undefined" || process.env === undefined) { throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + cause: { + RE_EXN_ID: "Not_found" + } + }); } let x = process.env[s]; if (x !== undefined) { return x; } throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + cause: { + RE_EXN_ID: "Not_found" + } + }); } let os_type = (function(_){ @@ -74,20 +74,20 @@ function sys_exit(exit_code) { function sys_is_directory(_s) { throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "sys_is_directory not implemented" - } - }); + cause: { + RE_EXN_ID: "Failure", + _1: "sys_is_directory not implemented" + } + }); } function sys_file_exists(_s) { throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "sys_file_exists not implemented" - } - }); + cause: { + RE_EXN_ID: "Failure", + _1: "sys_file_exists not implemented" + } + }); } export { diff --git a/runtime/src/runtime_deriving.js b/runtime/src/runtime_deriving.js index e2b665f..36b9eb0 100644 --- a/runtime/src/runtime_deriving.js +++ b/runtime/src/runtime_deriving.js @@ -4,10 +4,10 @@ function raiseWhenNotFound(x) { if (x == null) { throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + cause: { + RE_EXN_ID: "Not_found" + } + }); } return x; }