From 6a6a9f752ad9e9aacf88ebe2f4d76805e5139c9a Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Tue, 16 Jul 2024 08:07:51 +0200 Subject: [PATCH 1/8] Fix issues with the arity of externals. --- jscomp/ml/translcore.ml | 1 + 1 file changed, 1 insertion(+) diff --git a/jscomp/ml/translcore.ml b/jscomp/ml/translcore.ml index 8286deca4c..28fc6b8f7a 100644 --- a/jscomp/ml/translcore.ml +++ b/jscomp/ml/translcore.ml @@ -459,6 +459,7 @@ let specialize_primitive p env ty (* ~has_constant_constructor *) = (* Eta-expand a primitive *) let transl_primitive loc p env ty = + (* Printf.eprintf "----transl_primitive %s----\n" p.prim_name; *) let prim = try specialize_primitive p env ty (* ~has_constant_constructor:false *) with Not_found -> Pccall p From 11d578703adb4a36977ce5aaf4a2b07e82792b7a Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Thu, 4 Jul 2024 14:15:54 +0200 Subject: [PATCH 2/8] Audit what files are compiled in curried mode. Add a `-curried` option, and give an error whenever neither `-curried` not `-uncurried` are used. Then change the build and test files to always specify curried/uncurried. --- jscomp/bsc/rescript_compiler_main.ml | 13 ++++++-- jscomp/build_tests/super_errors/input.js | 2 +- jscomp/others/release.ninja | 2 +- jscomp/runtime/release.ninja | 4 +-- jscomp/stdlib-406/release.ninja | 14 +++++---- jscomp/test/build.ninja | 2 +- scripts/ninja.js | 38 +++++++++++++++++++----- 7 files changed, 54 insertions(+), 21 deletions(-) diff --git a/jscomp/bsc/rescript_compiler_main.ml b/jscomp/bsc/rescript_compiler_main.ml index e0da2d6364..1200b22f9c 100644 --- a/jscomp/bsc/rescript_compiler_main.ml +++ b/jscomp/bsc/rescript_compiler_main.ml @@ -34,6 +34,8 @@ let setup_runtime_path path = Bs_version.package_name := std); Js_config.customize_runtime := Some path +let curry_specified = ref false + let process_file sourcefile ?(kind ) ppf = (* This is a better default then "", it will be changed later @@ -46,6 +48,11 @@ let process_file sourcefile ?(kind ) ppf = match kind with | None -> Ext_file_extensions.classify_input (Ext_filename.get_extension_maybe sourcefile) | Some kind -> kind in + (if !curry_specified = false && !Clflags.dump_source = false && !Js_config.syntax_only = false && List.mem kind [Res; Resi] then + let _ = Printf.eprintf "XXX curry not specified %s\n%!" sourcefile in + let _ = assert false in + () + ); let res = match kind with | Res -> let sourcefile = set_abs_input_name sourcefile in @@ -406,8 +413,10 @@ let buckle_script_flags : (string * Bsc_args.spec * string) array = "-nopervasives", set Clflags.nopervasives, "*internal*"; - "-uncurried", unit_call (fun () -> Config.uncurried := Uncurried), - "*internal* Set jsx module"; + "-uncurried", unit_call (fun () -> curry_specified := true; Config.uncurried := Uncurried), + "*internal*"; + "-curried", unit_call (fun () -> curry_specified := true; Config.uncurried := Legacy), + "*internal*"; "-v", unit_call print_version_string, "Print compiler version and location of standard library and exit"; diff --git a/jscomp/build_tests/super_errors/input.js b/jscomp/build_tests/super_errors/input.js index d6bf82eb3a..6ab94f63ce 100644 --- a/jscomp/build_tests/super_errors/input.js +++ b/jscomp/build_tests/super_errors/input.js @@ -11,7 +11,7 @@ const fixtures = fs .filter(fileName => path.extname(fileName) === ".res"); // const runtime = path.join(__dirname, '..', '..', 'runtime') -const prefix = `${bsc} -w +A`; +const prefix = `${bsc} -w +A -curried`; const updateTests = process.argv[2] === "update"; diff --git a/jscomp/others/release.ninja b/jscomp/others/release.ninja index bc8c3d95b0..4f02eb3085 100644 --- a/jscomp/others/release.ninja +++ b/jscomp/others/release.ninja @@ -1,5 +1,5 @@ -bsc_primitive_flags = -no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero -nostdlib -bs-cross-module-opt -make-runtime -nopervasives -unsafe -w +50 -warn-error A +bsc_primitive_flags = -no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero -nostdlib -bs-cross-module-opt -make-runtime -nopervasives -unsafe -w +50 -warn-error A -curried bsc_flags = $bsc_primitive_flags -open Belt_internals rule cc diff --git a/jscomp/runtime/release.ninja b/jscomp/runtime/release.ninja index d0bd28fbd2..d4de758876 100644 --- a/jscomp/runtime/release.ninja +++ b/jscomp/runtime/release.ninja @@ -1,5 +1,5 @@ -bsc_no_open_flags = -no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero -nostdlib -bs-cross-module-opt -make-runtime -nopervasives -unsafe -w +50 -warn-error A +bsc_no_open_flags = -no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero -nostdlib -bs-cross-module-opt -make-runtime -nopervasives -unsafe -w +50 -warn-error A -curried bsc_flags = $bsc_no_open_flags -open Bs_stdlib_mini rule cc @@ -10,7 +10,7 @@ rule cc_cmi description = $in -> $out o runtime/bs_stdlib_mini.cmi : cc runtime/bs_stdlib_mini.resi - bsc_flags = -nostdlib -nopervasives + bsc_flags = -nostdlib -nopervasives -curried o runtime/js.cmj runtime/js.cmi : cc runtime/js.res bsc_flags = $bsc_no_open_flags o runtime/caml.cmj : cc_cmi runtime/caml.res | runtime/caml.cmi runtime/caml_int64_extern.cmj diff --git a/jscomp/stdlib-406/release.ninja b/jscomp/stdlib-406/release.ninja index 1360573c90..b43d399815 100644 --- a/jscomp/stdlib-406/release.ninja +++ b/jscomp/stdlib-406/release.ninja @@ -1,5 +1,5 @@ -bsc_flags = -no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero -nostdlib -bs-cross-module-opt -make-runtime -w -9-3-106 -warn-error A -I others +bsc_flags = -no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero -nostdlib -bs-cross-module-opt -make-runtime -w -9-3-106 -warn-error A -I others -curried rule cc command = $bsc -bs-cmi -bs-cmj $bsc_flags -I stdlib-406 $in @@ -9,9 +9,13 @@ rule cc_cmi description = $in -> $out o stdlib-406/pervasives.cmj : cc_cmi stdlib-406/pervasives.res | stdlib-406/pervasives.cmi $bsc others - bsc_flags = $bsc_flags -nopervasives + bsc_flags = $bsc_flags -nopervasives -curried o stdlib-406/pervasives.cmi : cc stdlib-406/pervasives.resi | $bsc others - bsc_flags = $bsc_flags -nopervasives + bsc_flags = $bsc_flags -nopervasives -curried +o stdlib-406/pervasivesU.cmj : cc_cmi stdlib-406/pervasivesU.res | stdlib-406/pervasivesU.cmi $bsc others + bsc_flags = $bsc_flags -nopervasives -curried +o stdlib-406/pervasivesU.cmi : cc stdlib-406/pervasivesU.resi | $bsc others + bsc_flags = $bsc_flags -nopervasives -curried o stdlib-406/arg.cmj : cc_cmi stdlib-406/arg.res | stdlib-406/arg.cmi stdlib-406/array.cmj stdlib-406/buffer.cmj stdlib-406/list.cmj stdlib-406/string.cmj stdlib-406/sys.cmj $bsc others o stdlib-406/arg.cmi : cc stdlib-406/arg.resi | stdlib-406/pervasives.cmj $bsc others o stdlib-406/array.cmj : cc_cmi stdlib-406/array.res | stdlib-406/array.cmi $bsc others @@ -64,8 +68,6 @@ o stdlib-406/obj.cmj : cc_cmi stdlib-406/obj.res | stdlib-406/obj.cmi $bsc other o stdlib-406/obj.cmi : cc stdlib-406/obj.resi | stdlib-406/pervasives.cmj $bsc others o stdlib-406/parsing.cmj : cc_cmi stdlib-406/parsing.res | stdlib-406/array.cmj stdlib-406/lexing.cmj stdlib-406/obj.cmj stdlib-406/parsing.cmi $bsc others o stdlib-406/parsing.cmi : cc stdlib-406/parsing.resi | stdlib-406/lexing.cmi stdlib-406/obj.cmi stdlib-406/pervasives.cmj $bsc others -o stdlib-406/pervasivesU.cmj : cc_cmi stdlib-406/pervasivesU.res | stdlib-406/pervasivesU.cmi $bsc others -o stdlib-406/pervasivesU.cmi : cc stdlib-406/pervasivesU.resi | stdlib-406/pervasives.cmj $bsc others o stdlib-406/queue.cmj : cc_cmi stdlib-406/queue.res | stdlib-406/queue.cmi $bsc others o stdlib-406/queue.cmi : cc stdlib-406/queue.resi | stdlib-406/pervasives.cmj $bsc others o stdlib-406/random.cmj : cc_cmi stdlib-406/random.res | stdlib-406/array.cmj stdlib-406/char.cmj stdlib-406/digest.cmj stdlib-406/int32.cmj stdlib-406/int64.cmj stdlib-406/random.cmi stdlib-406/string.cmj $bsc others @@ -89,4 +91,4 @@ o stdlib-406/sys.cmj : cc_cmi stdlib-406/sys.res | stdlib-406/sys.cmi $bsc other o stdlib-406/sys.cmi : cc stdlib-406/sys.resi | stdlib-406/pervasives.cmj $bsc others o stdlib-406/uchar.cmj : cc_cmi stdlib-406/uchar.res | stdlib-406/char.cmj stdlib-406/uchar.cmi $bsc others o stdlib-406/uchar.cmi : cc stdlib-406/uchar.resi | stdlib-406/pervasives.cmj $bsc others -o $stdlib : phony stdlib-406/pervasives.cmi stdlib-406/pervasives.cmj stdlib-406/arg.cmi stdlib-406/arg.cmj stdlib-406/array.cmi stdlib-406/array.cmj stdlib-406/arrayLabels.cmi stdlib-406/arrayLabels.cmj stdlib-406/buffer.cmi stdlib-406/buffer.cmj stdlib-406/bytes.cmi stdlib-406/bytes.cmj stdlib-406/bytesLabels.cmi stdlib-406/bytesLabels.cmj stdlib-406/callback.cmi stdlib-406/callback.cmj stdlib-406/camlinternalLazy.cmi stdlib-406/camlinternalLazy.cmj stdlib-406/camlinternalMod.cmi stdlib-406/camlinternalMod.cmj stdlib-406/char.cmi stdlib-406/char.cmj stdlib-406/complex.cmi stdlib-406/complex.cmj stdlib-406/digest.cmi stdlib-406/digest.cmj stdlib-406/filename.cmi stdlib-406/filename.cmj stdlib-406/genlex.cmi stdlib-406/genlex.cmj stdlib-406/hashtbl.cmi stdlib-406/hashtbl.cmj stdlib-406/hashtblLabels.cmi stdlib-406/hashtblLabels.cmj stdlib-406/int32.cmi stdlib-406/int32.cmj stdlib-406/int64.cmi stdlib-406/int64.cmj stdlib-406/lazy.cmi stdlib-406/lazy.cmj stdlib-406/lexing.cmi stdlib-406/lexing.cmj stdlib-406/list.cmi stdlib-406/list.cmj stdlib-406/listLabels.cmi stdlib-406/listLabels.cmj stdlib-406/map.cmi stdlib-406/map.cmj stdlib-406/mapLabels.cmi stdlib-406/mapLabels.cmj stdlib-406/moreLabels.cmi stdlib-406/moreLabels.cmj stdlib-406/obj.cmi stdlib-406/obj.cmj stdlib-406/parsing.cmi stdlib-406/parsing.cmj stdlib-406/pervasivesU.cmi stdlib-406/pervasivesU.cmj stdlib-406/queue.cmi stdlib-406/queue.cmj stdlib-406/random.cmi stdlib-406/random.cmj stdlib-406/set.cmi stdlib-406/set.cmj stdlib-406/setLabels.cmi stdlib-406/setLabels.cmj stdlib-406/sort.cmi stdlib-406/sort.cmj stdlib-406/stack.cmi stdlib-406/stack.cmj stdlib-406/stdLabels.cmi stdlib-406/stdLabels.cmj stdlib-406/stream.cmi stdlib-406/stream.cmj stdlib-406/string.cmi stdlib-406/string.cmj stdlib-406/stringLabels.cmi stdlib-406/stringLabels.cmj stdlib-406/sys.cmi stdlib-406/sys.cmj stdlib-406/uchar.cmi stdlib-406/uchar.cmj +o $stdlib : phony stdlib-406/pervasivesU.cmi stdlib-406/pervasivesU.cmj stdlib-406/arg.cmi stdlib-406/arg.cmj stdlib-406/array.cmi stdlib-406/array.cmj stdlib-406/arrayLabels.cmi stdlib-406/arrayLabels.cmj stdlib-406/buffer.cmi stdlib-406/buffer.cmj stdlib-406/bytes.cmi stdlib-406/bytes.cmj stdlib-406/bytesLabels.cmi stdlib-406/bytesLabels.cmj stdlib-406/callback.cmi stdlib-406/callback.cmj stdlib-406/camlinternalLazy.cmi stdlib-406/camlinternalLazy.cmj stdlib-406/camlinternalMod.cmi stdlib-406/camlinternalMod.cmj stdlib-406/char.cmi stdlib-406/char.cmj stdlib-406/complex.cmi stdlib-406/complex.cmj stdlib-406/digest.cmi stdlib-406/digest.cmj stdlib-406/filename.cmi stdlib-406/filename.cmj stdlib-406/genlex.cmi stdlib-406/genlex.cmj stdlib-406/hashtbl.cmi stdlib-406/hashtbl.cmj stdlib-406/hashtblLabels.cmi stdlib-406/hashtblLabels.cmj stdlib-406/int32.cmi stdlib-406/int32.cmj stdlib-406/int64.cmi stdlib-406/int64.cmj stdlib-406/lazy.cmi stdlib-406/lazy.cmj stdlib-406/lexing.cmi stdlib-406/lexing.cmj stdlib-406/list.cmi stdlib-406/list.cmj stdlib-406/listLabels.cmi stdlib-406/listLabels.cmj stdlib-406/map.cmi stdlib-406/map.cmj stdlib-406/mapLabels.cmi stdlib-406/mapLabels.cmj stdlib-406/moreLabels.cmi stdlib-406/moreLabels.cmj stdlib-406/obj.cmi stdlib-406/obj.cmj stdlib-406/parsing.cmi stdlib-406/parsing.cmj stdlib-406/queue.cmi stdlib-406/queue.cmj stdlib-406/random.cmi stdlib-406/random.cmj stdlib-406/set.cmi stdlib-406/set.cmj stdlib-406/setLabels.cmi stdlib-406/setLabels.cmj stdlib-406/sort.cmi stdlib-406/sort.cmj stdlib-406/stack.cmi stdlib-406/stack.cmj stdlib-406/stdLabels.cmi stdlib-406/stdLabels.cmj stdlib-406/stream.cmi stdlib-406/stream.cmj stdlib-406/string.cmi stdlib-406/string.cmj stdlib-406/stringLabels.cmi stdlib-406/stringLabels.cmj stdlib-406/sys.cmi stdlib-406/sys.cmj stdlib-406/uchar.cmi stdlib-406/uchar.cmj diff --git a/jscomp/test/build.ninja b/jscomp/test/build.ninja index d3d8237e0f..9f14516071 100644 --- a/jscomp/test/build.ninja +++ b/jscomp/test/build.ninja @@ -1,5 +1,5 @@ -bsc_flags = -bs-cross-module-opt -make-runtime-test -bs-package-output commonjs:jscomp/test -w -3-6-26-27-29-30-32..40-44-45-52-60-9-106+104 -warn-error A -I runtime -I $stdlib -I others +bsc_flags = -bs-cross-module-opt -make-runtime-test -bs-package-output commonjs:jscomp/test -w -3-6-26-27-29-30-32..40-44-45-52-60-9-106+104 -warn-error A -I runtime -I $stdlib -I others -curried rule cc command = $bsc -bs-cmi -bs-cmj $bsc_flags -I test $in diff --git a/scripts/ninja.js b/scripts/ninja.js index 3d556b2748..8bdaa038db 100755 --- a/scripts/ninja.js +++ b/scripts/ninja.js @@ -782,7 +782,7 @@ async function runtimeNinja(devmode = true) { var externalDeps = devmode ? [compilerTarget] : []; var ninjaOutput = devmode ? "build.ninja" : "release.ninja"; var templateRuntimeRules = ` -bsc_no_open_flags = ${commonBsFlags} -bs-cross-module-opt -make-runtime -nopervasives -unsafe -w +50 -warn-error A +bsc_no_open_flags = ${commonBsFlags} -bs-cross-module-opt -make-runtime -nopervasives -unsafe -w +50 -warn-error A -curried bsc_flags = $bsc_no_open_flags -open Bs_stdlib_mini ${ruleCC(ninjaCwd)} ${ninjaQuickBuildList([ @@ -791,7 +791,7 @@ ${ninjaQuickBuildList([ "bs_stdlib_mini.resi", "cc", ninjaCwd, - [["bsc_flags", "-nostdlib -nopervasives"]], + [["bsc_flags", "-nostdlib -nopervasives -curried"]], [], externalDeps, ], @@ -863,7 +863,7 @@ async function othersNinja(devmode = true) { var ninjaCwd = "others"; var templateOthersRules = ` -bsc_primitive_flags = ${commonBsFlags} -bs-cross-module-opt -make-runtime -nopervasives -unsafe -w +50 -warn-error A +bsc_primitive_flags = ${commonBsFlags} -bs-cross-module-opt -make-runtime -nopervasives -unsafe -w +50 -warn-error A -curried bsc_flags = $bsc_primitive_flags -open Belt_internals ${ruleCC(ninjaCwd)} ${ninjaQuickBuildList([ @@ -965,12 +965,14 @@ async function stdlibNinja(devmode = true) { /** * @type [string,string][] */ - var bsc_builtin_overrides = [[bsc_flags, `$${bsc_flags} -nopervasives`]]; + var bsc_builtin_overrides = [ + [bsc_flags, `$${bsc_flags} -nopervasives -curried`], + ]; // It is interesting `-w -a` would generate not great code sometimes // deprecations diabled due to string_of_float var warnings = "-w -9-3-106 -warn-error A"; var templateStdlibRules = ` -${bsc_flags} = ${commonBsFlags} -bs-cross-module-opt -make-runtime ${warnings} -I others +${bsc_flags} = ${commonBsFlags} -bs-cross-module-opt -make-runtime ${warnings} -I others -curried ${ruleCC(ninjaCwd)} ${ninjaQuickBuildList([ // we make it still depends on external @@ -994,12 +996,31 @@ ${ninjaQuickBuildList([ [], externalDeps, ], + [ + "pervasivesU.cmj", + "pervasivesU.res", + "cc_cmi", + ninjaCwd, + bsc_builtin_overrides, + "pervasivesU.cmi", + externalDeps, + ], + [ + "pervasivesU.cmi", + "pervasivesU.resi", + "cc", + ninjaCwd, + bsc_builtin_overrides, + [], + externalDeps, + ], ])} `; var stdlibDirFiles = fs.readdirSync(stdlibDir, "ascii"); var sources = stdlibDirFiles.filter(x => { return ( !x.startsWith("pervasives.") && + !x.startsWith("pervasivesU.") && (x.endsWith(".res") || x.endsWith(".resi")) ); }); @@ -1007,8 +1028,8 @@ ${ninjaQuickBuildList([ await ocamlDepForBscAsync(sources, stdlibDir, depsMap); var targets = collectTarget(sources); var allTargets = scanFileTargets(targets, [ - "pervasives.cmi", - "pervasives.cmj", + "pervasivesU.cmi", + "pervasivesU.cmj", ]); targets.forEach((ext, mod) => { switch (ext) { @@ -1083,10 +1104,11 @@ async function testNinja() { var ninjaOutput = "build.ninja"; var ninjaCwd = `test`; var templateTestRules = ` -bsc_flags = -bs-cross-module-opt -make-runtime-test -bs-package-output commonjs:jscomp/test -w -3-6-26-27-29-30-32..40-44-45-52-60-9-106+104 -warn-error A -I runtime -I $stdlib -I others +bsc_flags = -bs-cross-module-opt -make-runtime-test -bs-package-output commonjs:jscomp/test -w -3-6-26-27-29-30-32..40-44-45-52-60-9-106+104 -warn-error A -I runtime -I $stdlib -I others -curried ${ruleCC(ninjaCwd)} `; var testDirFiles = fs.readdirSync(testDir, "ascii"); + //testDirFiles = []; var sources = testDirFiles.filter(x => { return x.endsWith(".resi") || x.endsWith(".res"); }); From 3e4dd913ff297c31bfaf6062e1559231edf2d72c Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Mon, 8 Jul 2024 10:14:37 +0200 Subject: [PATCH 3/8] Remove `@uncurry` needed to turn on uncurried for `others`. --- jscomp/others/js_promise.res | 6 +++--- jscomp/others/js_promise2.res | 2 +- jscomp/test/Import.js | 8 +++----- jscomp/test/SafePromises.js | 5 ++--- jscomp/test/mt.js | 5 ++--- lib/es6/js_promise.js | 5 ++--- lib/js/js_promise.js | 5 ++--- 7 files changed, 15 insertions(+), 21 deletions(-) diff --git a/jscomp/others/js_promise.res b/jscomp/others/js_promise.res index cbe663caef..7657f21efb 100644 --- a/jscomp/others/js_promise.res +++ b/jscomp/others/js_promise.res @@ -44,7 +44,7 @@ type error */ @new -external make: ((@uncurry ~resolve: (. 'a) => unit, ~reject: (. exn) => unit) => unit) => promise< +external make: ((~resolve: (. 'a) => unit, ~reject: (. exn) => unit) => unit) => promise< 'a, > = "Promise" @@ -83,12 +83,12 @@ external all6: ( @val @scope("Promise") external race: array> => promise<'a> = "race" -@send external then_: (promise<'a>, @uncurry ('a => promise<'b>)) => promise<'b> = "then" +@send external then_: (promise<'a>, ('a => promise<'b>)) => promise<'b> = "then" let then_ = (arg1, obj) => then_(obj, arg1) @send -external catch: (promise<'a>, @uncurry (error => promise<'a>)) => promise<'a> = "catch" +external catch: (promise<'a>, (error => promise<'a>)) => promise<'a> = "catch" let catch = (arg1, obj) => catch(obj, arg1) /* ` p|> catch handler` Note in JS the returned promise type is actually runtime dependent, diff --git a/jscomp/others/js_promise2.res b/jscomp/others/js_promise2.res index 4fa6778aa3..5d6d389714 100644 --- a/jscomp/others/js_promise2.res +++ b/jscomp/others/js_promise2.res @@ -16,7 +16,7 @@ let catch: (promise<'a>, error => promise<'a>) => promise<'a> = %raw(` `) @new -external make: ((@uncurry ~resolve: (. 'a) => unit, ~reject: (. exn) => unit) => unit) => promise< +external make: ((~resolve: (. 'a) => unit, ~reject: (. exn) => unit) => unit) => promise< 'a, > = "Promise" diff --git a/jscomp/test/Import.js b/jscomp/test/Import.js index bc1f456e50..4e4acc7836 100644 --- a/jscomp/test/Import.js +++ b/jscomp/test/Import.js @@ -10,13 +10,11 @@ async function eachIntAsync(list, f) { } function eachIntLazy(list, f) { - let obj = import("../../lib/js/belt_List.js").then(function (m) { + return import("../../lib/js/belt_List.js").then(function (m) { return m.forEach; - }); - let arg1 = function (each) { + }).then(function (each) { return Promise.resolve(Curry._2(each, list, f)); - }; - return obj.then(arg1); + }); } eachIntLazy({ diff --git a/jscomp/test/SafePromises.js b/jscomp/test/SafePromises.js index 99fab296d4..73ff7b3c4e 100644 --- a/jscomp/test/SafePromises.js +++ b/jscomp/test/SafePromises.js @@ -12,10 +12,9 @@ async function nestedPromise(xxx) { console.log("Promise2.catch_", x); return Promise.resolve(0); })); - let arg1 = function (x) { + xx.then(function (x) { return Promise.resolve((console.log("Promise.then_", x), undefined)); - }; - xx.then(arg1); + }); } async function create(x) { diff --git a/jscomp/test/mt.js b/jscomp/test/mt.js index a49dfbd4fe..46d6f42c8b 100644 --- a/jscomp/test/mt.js +++ b/jscomp/test/mt.js @@ -235,11 +235,10 @@ function old_from_promise_suites_donotuse(name, suites) { List.iter((function (param) { let code = param[1]; it(param[0], (function (param) { - let arg1 = function (x) { + return code.then(function (x) { handleCode(x); return val_unit; - }; - return code.then(arg1); + }); })); }), suites); })); diff --git a/lib/es6/js_promise.js b/lib/es6/js_promise.js index 9b4b0bf80a..dd67694b07 100644 --- a/lib/es6/js_promise.js +++ b/lib/es6/js_promise.js @@ -1,13 +1,12 @@ -import * as Curry from "./curry.js"; function then_(arg1, obj) { - return obj.then(Curry.__1(arg1)); + return obj.then(arg1); } function $$catch(arg1, obj) { - return obj.catch(Curry.__1(arg1)); + return obj.catch(arg1); } export { diff --git a/lib/js/js_promise.js b/lib/js/js_promise.js index 41895787db..f4ade6ef7f 100644 --- a/lib/js/js_promise.js +++ b/lib/js/js_promise.js @@ -1,13 +1,12 @@ 'use strict'; -let Curry = require("./curry.js"); function then_(arg1, obj) { - return obj.then(Curry.__1(arg1)); + return obj.then(arg1); } function $$catch(arg1, obj) { - return obj.catch(Curry.__1(arg1)); + return obj.catch(arg1); } exports.then_ = then_; From 651888d77d07e94982dc61969b75091aa3e6a2b9 Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Mon, 8 Jul 2024 14:44:06 +0200 Subject: [PATCH 4/8] Don't rely on Curry in unit tests. --- jscomp/test/mt.js | 17 +---- jscomp/test/mt.res | 11 +-- jscomp/test/mt.resi | 2 - jscomp/test/ocaml_re_test.js | 138 +++++++++++++++++------------------ 4 files changed, 75 insertions(+), 93 deletions(-) diff --git a/jscomp/test/mt.js b/jscomp/test/mt.js index 46d6f42c8b..39ee552fae 100644 --- a/jscomp/test/mt.js +++ b/jscomp/test/mt.js @@ -4,7 +4,6 @@ let List = require("../../lib/js/list.js"); let Path = require("path"); let $$Array = require("../../lib/js/array.js"); -let Curry = require("../../lib/js/curry.js"); let Assert = require("assert"); let Process = require("process"); @@ -36,7 +35,7 @@ let from_suites = (function from_suites(name, suite) { return List.iter((function (param) { var partial_arg = param[1]; it(param[0], (function () { - return Curry._1(partial_arg, undefined); + return partial_arg(undefined); })); }), suite); })); @@ -96,15 +95,6 @@ function handleCode(spec) { } } -function force_curry(x) { - List.hd({ - hd: 3, - tl: /* [] */0 - }); - $$Array.copy([5]); - return Curry._1(x, undefined); -} - let from_pair_suites = (function from_pair_suites(name, suites) { var match = $$Array.to_list(Process.argv); if (match) { @@ -113,7 +103,7 @@ let from_pair_suites = (function from_pair_suites(name, suites) { return List.iter((function (param) { var code = param[1]; it(param[0], (function () { - return handleCode(Curry._1(code, undefined)); + return handleCode(code(undefined)); })); }), suites); })); @@ -125,7 +115,7 @@ let from_pair_suites = (function from_pair_suites(name, suites) { ]); return List.iter((function (param) { var name = param[0]; - var fn = Curry._1(param[1], undefined); + var fn = param[1](undefined); switch (fn.TAG) { case "Eq" : console.log([ @@ -306,5 +296,4 @@ exports.old_from_promise_suites_donotuse = old_from_promise_suites_donotuse; exports.eq_suites = eq_suites; exports.bool_suites = bool_suites; exports.throw_suites = throw_suites; -exports.force_curry = force_curry; /* val_unit Not a pure module */ diff --git a/jscomp/test/mt.res b/jscomp/test/mt.res index aaf6e225bc..428709b556 100644 --- a/jscomp/test/mt.res +++ b/jscomp/test/mt.res @@ -53,7 +53,7 @@ function from_suites(name, suite) { return List.iter((function (param) { var partial_arg = param[1]; it(param[0], (function () { - return Curry._1(partial_arg, undefined); + return partial_arg(undefined); })); }), suite); })); @@ -118,11 +118,6 @@ let handleCode = spec => | FailWith(msg) => assert_fail(msg) } -let force_curry = x => { - let _ = List.hd(list{3}) - let _ = Array.copy([5]) - x() -} let from_pair_suites = %raw(` function from_pair_suites(name, suites) { var match = $$Array.to_list(Process.argv); @@ -132,7 +127,7 @@ function from_pair_suites(name, suites) { return List.iter((function (param) { var code = param[1]; it(param[0], (function () { - return handleCode(Curry._1(code, undefined)); + return handleCode(code(undefined)); })); }), suites); })); @@ -144,7 +139,7 @@ function from_pair_suites(name, suites) { ]); return List.iter((function (param) { var name = param[0]; - var fn = Curry._1(param[1], undefined); + var fn = param[1](undefined); switch (fn.TAG) { case "Eq" : console.log([ diff --git a/jscomp/test/mt.resi b/jscomp/test/mt.resi index 1e18ec11e7..d96f9368a2 100644 --- a/jscomp/test/mt.resi +++ b/jscomp/test/mt.resi @@ -25,5 +25,3 @@ let eq_suites: (~test_id: ref, ~suites: ref, string, 'b, 'b) = let bool_suites: (~test_id: ref, ~suites: ref, string, bool) => unit let throw_suites: (~test_id: ref, ~suites: ref, string, unit => unit) => unit - -let force_curry: (unit => unit) => unit diff --git a/jscomp/test/ocaml_re_test.js b/jscomp/test/ocaml_re_test.js index 6de282344e..e2a4d4ca16 100644 --- a/jscomp/test/ocaml_re_test.js +++ b/jscomp/test/ocaml_re_test.js @@ -3541,6 +3541,75 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { continue; }; }; + let piece = function (param) { + let r = atom(); + if (accept(/* '*' */42)) { + return greedy_mod(repn(r, 0, undefined)); + } + if (accept(/* '+' */43)) { + return greedy_mod(repn(r, 1, undefined)); + } + if (accept(/* '?' */63)) { + return greedy_mod(repn(r, 0, 1)); + } + if (!accept(/* '{' */123)) { + return r; + } + let i$1 = integer(); + if (i$1 !== undefined) { + let j = accept(/* ',' */44) ? integer() : i$1; + if (!accept(/* '}' */125)) { + throw new Error(Parse_error, { + cause: { + RE_EXN_ID: Parse_error + } + }); + } + if (j !== undefined && j < i$1) { + throw new Error(Parse_error, { + cause: { + RE_EXN_ID: Parse_error + } + }); + } + return greedy_mod(repn(r, i$1, j)); + } + i.contents = i.contents - 1 | 0; + return r; + }; + let integer = function (param) { + if (i.contents === l) { + return; + } + let d = get(); + if (d > 57 || d < 48) { + i.contents = i.contents - 1 | 0; + return; + } else { + let _i = d - /* '0' */48 | 0; + while(true) { + let i$1 = _i; + if (i.contents === l) { + return i$1; + } + let d$1 = get(); + if (d$1 > 57 || d$1 < 48) { + i.contents = i.contents - 1 | 0; + return i$1; + } + let i$p = Math.imul(10, i$1) + (d$1 - /* '0' */48 | 0) | 0; + if (i$p < i$1) { + throw new Error(Parse_error, { + cause: { + RE_EXN_ID: Parse_error + } + }); + } + _i = i$p; + continue; + }; + } + }; let atom = function (param) { if (accept(/* '.' */46)) { if (dotall) { @@ -3812,75 +3881,6 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { }; } }; - let integer = function (param) { - if (i.contents === l) { - return; - } - let d = get(); - if (d > 57 || d < 48) { - i.contents = i.contents - 1 | 0; - return; - } else { - let _i = d - /* '0' */48 | 0; - while(true) { - let i$1 = _i; - if (i.contents === l) { - return i$1; - } - let d$1 = get(); - if (d$1 > 57 || d$1 < 48) { - i.contents = i.contents - 1 | 0; - return i$1; - } - let i$p = Math.imul(10, i$1) + (d$1 - /* '0' */48 | 0) | 0; - if (i$p < i$1) { - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); - } - _i = i$p; - continue; - }; - } - }; - let piece = function (param) { - let r = atom(); - if (accept(/* '*' */42)) { - return greedy_mod(repn(r, 0, undefined)); - } - if (accept(/* '+' */43)) { - return greedy_mod(repn(r, 1, undefined)); - } - if (accept(/* '?' */63)) { - return greedy_mod(repn(r, 0, 1)); - } - if (!accept(/* '{' */123)) { - return r; - } - let i$1 = integer(); - if (i$1 !== undefined) { - let j = accept(/* ',' */44) ? integer() : i$1; - if (!accept(/* '}' */125)) { - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); - } - if (j !== undefined && j < i$1) { - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); - } - return greedy_mod(repn(r, i$1, j)); - } - i.contents = i.contents - 1 | 0; - return r; - }; let char = function (param) { if (i.contents === l) { throw new Error(Parse_error, { From d1854ba8b485e72172a5860794465fd8e4b4d2c5 Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Mon, 8 Jul 2024 15:02:37 +0200 Subject: [PATCH 5/8] Switch the compiler to build in uncurried mode. --- jscomp/build_tests/super_errors/input.js | 2 +- scripts/ninja.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/jscomp/build_tests/super_errors/input.js b/jscomp/build_tests/super_errors/input.js index 6ab94f63ce..cdf31feffe 100644 --- a/jscomp/build_tests/super_errors/input.js +++ b/jscomp/build_tests/super_errors/input.js @@ -11,7 +11,7 @@ const fixtures = fs .filter(fileName => path.extname(fileName) === ".res"); // const runtime = path.join(__dirname, '..', '..', 'runtime') -const prefix = `${bsc} -w +A -curried`; +const prefix = `${bsc} -w +A -uncurried`; const updateTests = process.argv[2] === "update"; diff --git a/scripts/ninja.js b/scripts/ninja.js index 8bdaa038db..b58a121b9f 100755 --- a/scripts/ninja.js +++ b/scripts/ninja.js @@ -782,7 +782,7 @@ async function runtimeNinja(devmode = true) { var externalDeps = devmode ? [compilerTarget] : []; var ninjaOutput = devmode ? "build.ninja" : "release.ninja"; var templateRuntimeRules = ` -bsc_no_open_flags = ${commonBsFlags} -bs-cross-module-opt -make-runtime -nopervasives -unsafe -w +50 -warn-error A -curried +bsc_no_open_flags = ${commonBsFlags} -bs-cross-module-opt -make-runtime -nopervasives -unsafe -w +50 -warn-error A -uncurried bsc_flags = $bsc_no_open_flags -open Bs_stdlib_mini ${ruleCC(ninjaCwd)} ${ninjaQuickBuildList([ @@ -791,7 +791,7 @@ ${ninjaQuickBuildList([ "bs_stdlib_mini.resi", "cc", ninjaCwd, - [["bsc_flags", "-nostdlib -nopervasives -curried"]], + [["bsc_flags", "-nostdlib -nopervasives -uncurried"]], [], externalDeps, ], @@ -863,7 +863,7 @@ async function othersNinja(devmode = true) { var ninjaCwd = "others"; var templateOthersRules = ` -bsc_primitive_flags = ${commonBsFlags} -bs-cross-module-opt -make-runtime -nopervasives -unsafe -w +50 -warn-error A -curried +bsc_primitive_flags = ${commonBsFlags} -bs-cross-module-opt -make-runtime -nopervasives -unsafe -w +50 -warn-error A -uncurried bsc_flags = $bsc_primitive_flags -open Belt_internals ${ruleCC(ninjaCwd)} ${ninjaQuickBuildList([ @@ -966,13 +966,13 @@ async function stdlibNinja(devmode = true) { * @type [string,string][] */ var bsc_builtin_overrides = [ - [bsc_flags, `$${bsc_flags} -nopervasives -curried`], + [bsc_flags, `$${bsc_flags} -nopervasives -uncurried`], ]; // It is interesting `-w -a` would generate not great code sometimes // deprecations diabled due to string_of_float var warnings = "-w -9-3-106 -warn-error A"; var templateStdlibRules = ` -${bsc_flags} = ${commonBsFlags} -bs-cross-module-opt -make-runtime ${warnings} -I others -curried +${bsc_flags} = ${commonBsFlags} -bs-cross-module-opt -make-runtime ${warnings} -I others -uncurried ${ruleCC(ninjaCwd)} ${ninjaQuickBuildList([ // we make it still depends on external @@ -1104,7 +1104,7 @@ async function testNinja() { var ninjaOutput = "build.ninja"; var ninjaCwd = `test`; var templateTestRules = ` -bsc_flags = -bs-cross-module-opt -make-runtime-test -bs-package-output commonjs:jscomp/test -w -3-6-26-27-29-30-32..40-44-45-52-60-9-106+104 -warn-error A -I runtime -I $stdlib -I others -curried +bsc_flags = -bs-cross-module-opt -make-runtime-test -bs-package-output commonjs:jscomp/test -w -3-6-26-27-29-30-32..40-44-45-52-60-9-106+104 -warn-error A -I runtime -I $stdlib -I others -uncurried ${ruleCC(ninjaCwd)} `; var testDirFiles = fs.readdirSync(testDir, "ascii"); From 6f1f5632e60389aa0ec1c9975bc48f88772bda2a Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Mon, 8 Jul 2024 15:03:20 +0200 Subject: [PATCH 6/8] Update compiler artifacts. --- .../UncurriedArgsNotApplied.res.expected | 2 +- .../expected/arity_mismatch.res.expected | 2 +- .../expected/arity_mismatch2.res.expected | 2 +- .../expected/c_for_u_in_c_mode.res.expected | 28 - .../expected/curried_expected.res.expected | 2 +- .../expected/curry_in_uncurry.res.expected | 10 - .../method_arity_mismatch.res.expected | 2 +- .../expected/missing_label.res.expected | 7 +- .../expected/missing_labels.res.expected | 8 +- .../expected/moreArguments1.res.expected | 7 +- .../expected/moreArguments2.res.expected | 7 +- .../expected/moreArguments3.res.expected | 7 +- .../expected/moreArguments4.res.expected | 7 +- .../expected/moreArguments5.res.expected | 7 +- .../expected/partial_app.res.expected | 15 +- .../expected/primitives3.res.expected | 4 +- .../expected/u_for_c_in_c_mode.res.expected | 28 - .../expected/uncurried_expected.res.expected | 9 - .../uncurried_wrong_label.res.expected | 3 +- .../expected/warnings1.res.expected | 8 +- .../expected/warnings3.res.expected | 6 +- .../src/ImmutableArray.res.js | 128 +++- .../src/Records.res.js | 14 +- jscomp/others/release.ninja | 2 +- jscomp/runtime/release.ninja | 4 +- jscomp/stdlib-406/release.ninja | 10 +- jscomp/test/406_primitive_test.js | 2 +- jscomp/test/DerivingAccessorsCurried.js | 3 +- jscomp/test/DisambiguateOptionalFields.js | 4 +- jscomp/test/Import.js | 23 +- jscomp/test/UncurriedExternals.js | 10 +- jscomp/test/a_filename_test.js | 16 +- jscomp/test/a_recursive_type.js | 11 +- jscomp/test/a_scope_bug.js | 4 +- jscomp/test/alias_test.js | 2 +- jscomp/test/ari_regress_test.js | 10 +- jscomp/test/arith_lexer.js | 7 +- jscomp/test/arith_syntax.js | 4 +- jscomp/test/arity.js | 5 +- jscomp/test/arity_deopt.js | 6 +- jscomp/test/arity_infer.js | 3 +- jscomp/test/array_subtle_test.js | 2 +- jscomp/test/array_test.js | 3 +- jscomp/test/ast_abstract_test.js | 2 +- jscomp/test/async_await.js | 7 +- jscomp/test/async_inline.js | 31 +- jscomp/test/async_inside_loop.js | 4 +- jscomp/test/attr_test.js | 2 +- jscomp/test/basic_module_test.js | 4 +- jscomp/test/bdd.js | 14 +- jscomp/test/bench.js | 19 +- jscomp/test/bs_MapInt_test.js | 2 +- jscomp/test/bs_abstract_test.js | 11 +- jscomp/test/bs_array_test.js | 33 +- jscomp/test/bs_auto_uncurry.js | 40 +- jscomp/test/bs_auto_uncurry_test.js | 2 +- jscomp/test/bs_float_test.js | 2 +- jscomp/test/bs_hashmap_test.js | 9 +- jscomp/test/bs_hashset_int_test.js | 3 +- jscomp/test/bs_hashtbl_string_test.js | 23 +- jscomp/test/bs_ignore_effect.js | 2 +- jscomp/test/bs_int_test.js | 2 +- jscomp/test/bs_list_test.js | 218 ++++--- jscomp/test/bs_map_set_dict_test.js | 32 +- jscomp/test/bs_map_test.js | 14 +- jscomp/test/bs_min_max_test.js | 4 +- jscomp/test/bs_mutable_set_test.js | 36 +- jscomp/test/bs_poly_map_test.js | 55 +- jscomp/test/bs_poly_mutable_map_test.js | 10 +- jscomp/test/bs_poly_mutable_set_test.js | 116 +++- jscomp/test/bs_poly_set_test.js | 4 +- jscomp/test/bs_qualified.js | 2 +- jscomp/test/bs_queue_test.js | 23 +- jscomp/test/bs_rbset_int_bench.js | 2 +- jscomp/test/bs_set_bench.js | 2 +- jscomp/test/bs_set_int_test.js | 50 +- jscomp/test/bs_splice_partial.js | 7 +- jscomp/test/bs_string_test.js | 2 +- jscomp/test/bs_unwrap_test.js | 9 +- jscomp/test/build.ninja | 2 +- jscomp/test/bytes_split_gpr_743_test.js | 2 +- jscomp/test/caml_compare_bigint_test.js | 4 +- jscomp/test/caml_compare_test.js | 104 ++-- jscomp/test/caml_format_test.js | 46 +- jscomp/test/chain_code_test.js | 5 +- jscomp/test/chn_test.js | 2 +- jscomp/test/class_type_ffi_test.js | 34 +- jscomp/test/coercion_module_alias_test.js | 9 +- jscomp/test/complex_if_test.js | 2 +- jscomp/test/complex_while_loop.js | 4 +- jscomp/test/condition_compilation_test.js | 2 +- jscomp/test/const_block_test.js | 8 +- jscomp/test/const_defs_test.js | 2 +- jscomp/test/const_test.js | 2 +- jscomp/test/cps_test.js | 25 +- jscomp/test/custom_error_test.js | 8 +- jscomp/test/debugger_test.js | 4 +- jscomp/test/demo_int_map.js | 2 +- jscomp/test/demo_page.js | 9 +- jscomp/test/demo_pipe.js | 2 +- jscomp/test/digest_test.js | 24 +- jscomp/test/div_by_zero_test.js | 26 +- jscomp/test/dollar_escape_test.js | 14 +- jscomp/test/earger_curry_test.js | 29 +- jscomp/test/epsilon_test.js | 4 +- jscomp/test/equal_box_test.js | 4 +- jscomp/test/equal_exception_test.js | 6 +- jscomp/test/es6_module_test.js | 4 +- jscomp/test/event_ffi.js | 7 +- jscomp/test/exception_raise_test.js | 11 +- jscomp/test/exception_rebound_err_test.js | 7 +- jscomp/test/exception_value_test.js | 11 +- jscomp/test/ext_array_test.js | 59 +- jscomp/test/ext_bytes_test.js | 22 +- jscomp/test/ext_filename_test.js | 69 +-- jscomp/test/ext_list_test.js | 115 ++-- jscomp/test/ext_pervasives_test.js | 7 +- jscomp/test/ext_string_test.js | 77 ++- jscomp/test/external_ppx.js | 14 +- jscomp/test/ffi_arity_test.js | 17 +- jscomp/test/ffi_array_test.js | 2 +- jscomp/test/ffi_js_test.js | 4 +- jscomp/test/ffi_splice_test.js | 2 +- jscomp/test/ffi_test.js | 6 +- jscomp/test/flattern_order_test.js | 2 +- jscomp/test/flexible_array_test.js | 17 +- jscomp/test/float_of_bits_test.js | 8 +- jscomp/test/float_test.js | 26 +- jscomp/test/for_loop_test.js | 76 ++- jscomp/test/for_side_effect_test.js | 4 +- jscomp/test/format_test.js | 30 +- jscomp/test/fun_pattern_match.js | 85 ++- jscomp/test/functor_app_test.js | 7 +- jscomp/test/functor_def.js | 5 +- jscomp/test/functors.js | 24 +- jscomp/test/global_module_alias_test.js | 13 +- jscomp/test/google_closure_test.js | 2 +- jscomp/test/gpr496_test.js | 5 +- jscomp/test/gpr_1154_test.js | 4 +- jscomp/test/gpr_1245_test.js | 7 +- jscomp/test/gpr_1268.js | 7 +- jscomp/test/gpr_1409_test.js | 9 +- jscomp/test/gpr_1423_app_test.js | 18 +- jscomp/test/gpr_1481.js | 2 +- jscomp/test/gpr_1503_test.js | 2 +- jscomp/test/gpr_1658_test.js | 2 +- jscomp/test/gpr_1667_test.js | 6 +- jscomp/test/gpr_1692_test.js | 11 +- jscomp/test/gpr_1716_test.js | 2 +- jscomp/test/gpr_1728_test.js | 2 +- jscomp/test/gpr_1749_test.js | 2 +- jscomp/test/gpr_1760_test.js | 2 +- jscomp/test/gpr_1762_test.js | 4 +- jscomp/test/gpr_1817_test.js | 4 +- jscomp/test/gpr_1822_test.js | 2 +- jscomp/test/gpr_1891_test.js | 3 +- jscomp/test/gpr_1943_test.js | 2 +- jscomp/test/gpr_2316_test.js | 2 +- jscomp/test/gpr_2614_test.js | 2 +- jscomp/test/gpr_2633_test.js | 3 +- jscomp/test/gpr_2731_test.js | 2 +- jscomp/test/gpr_3492_test.js | 2 +- jscomp/test/gpr_3536_test.js | 3 +- jscomp/test/gpr_3566_test.js | 13 +- jscomp/test/gpr_3697_test.js | 7 +- jscomp/test/gpr_3875_test.js | 48 +- jscomp/test/gpr_3931_test.js | 3 +- jscomp/test/gpr_405_test.js | 37 +- jscomp/test/gpr_4069_test.js | 7 +- jscomp/test/gpr_4265_test.js | 5 +- jscomp/test/gpr_459_test.js | 2 +- jscomp/test/gpr_858_unit2_test.js | 9 +- jscomp/test/gpr_904_test.js | 2 +- jscomp/test/gpr_977_test.js | 2 +- jscomp/test/guide_for_ext.js | 2 +- jscomp/test/hash_sugar_desugar.js | 5 +- jscomp/test/hashtbl_test.js | 10 +- jscomp/test/ignore_test.js | 2 +- jscomp/test/imm_map_bench.js | 4 +- jscomp/test/incomplete_toplevel_test.js | 2 +- jscomp/test/inline_map2_test.js | 91 ++- jscomp/test/inline_map_demo.js | 2 +- jscomp/test/inline_map_test.js | 2 +- jscomp/test/inline_regression_test.js | 9 +- jscomp/test/inline_string_test.js | 14 +- jscomp/test/installation_test.js | 2 +- jscomp/test/int32_test.js | 18 +- jscomp/test/int64_mul_div_test.js | 28 +- jscomp/test/int64_test.js | 100 +-- jscomp/test/int_hashtbl_test.js | 33 +- jscomp/test/int_map.js | 49 +- jscomp/test/int_overflow_test.js | 28 +- jscomp/test/int_poly_var.js | 4 +- jscomp/test/int_switch_test.js | 17 +- jscomp/test/internal_unused_test.js | 2 +- jscomp/test/io_test.js | 2 +- jscomp/test/js_cast_test.js | 2 +- jscomp/test/js_date_test.js | 2 +- jscomp/test/js_dict_test.js | 2 +- jscomp/test/js_exception_catch_test.js | 35 +- jscomp/test/js_float_test.js | 24 +- jscomp/test/js_global_test.js | 4 +- jscomp/test/js_int_test.js | 14 +- jscomp/test/js_json_test.js | 146 +++-- jscomp/test/js_list_test.js | 17 +- jscomp/test/js_nullable_test.js | 2 +- jscomp/test/js_re_test.js | 6 +- jscomp/test/jsoo_400_test.js | 6 +- jscomp/test/jsoo_485_test.js | 2 +- jscomp/test/keep_uncurry_attribute.js | 3 +- jscomp/test/key_word_property.js | 2 +- jscomp/test/key_word_property_plus_test.js | 2 +- jscomp/test/lazy_demo.js | 7 +- jscomp/test/lazy_test.js | 57 +- jscomp/test/libarg_test.js | 2 +- jscomp/test/libqueue_test.js | 3 +- jscomp/test/limits_test.js | 8 +- jscomp/test/loop_regression_test.js | 2 +- jscomp/test/map_find_test.js | 42 +- jscomp/test/map_test.js | 5 +- jscomp/test/mario_game.js | 251 ++++---- jscomp/test/marshal.js | 48 +- jscomp/test/method_name_test.js | 15 +- jscomp/test/mock_mt.js | 3 +- jscomp/test/module_alias_test.js | 5 +- jscomp/test/module_as_class_ffi.js | 4 +- jscomp/test/module_parameter_test.js | 2 +- jscomp/test/module_splice_test.js | 2 +- jscomp/test/more_poly_variant_test.js | 24 +- jscomp/test/mpr_6033_test.js | 7 +- jscomp/test/mt.js | 4 +- jscomp/test/mutable_uncurry_test.js | 109 ++-- jscomp/test/name_mangle_test.js | 2 +- jscomp/test/noassert.js | 4 +- jscomp/test/number_lexer.js | 62 +- jscomp/test/ocaml_re_test.js | 569 ++++++++---------- jscomp/test/of_string_test.js | 6 +- jscomp/test/offset.js | 31 +- jscomp/test/option_repr_test.js | 2 +- jscomp/test/optional_ffi_test.js | 2 +- jscomp/test/pipe_syntax.js | 47 +- jscomp/test/poly_variant_test.js | 2 +- jscomp/test/polymorphic_raw_test.js | 2 +- jscomp/test/ppx_apply_test.js | 2 +- jscomp/test/pr6726.js | 4 +- jscomp/test/print_alpha_test.js | 7 +- jscomp/test/queue_402.js | 7 +- jscomp/test/queue_test.js | 9 +- jscomp/test/random_test.js | 42 +- jscomp/test/raw_hash_tbl_bench.js | 2 +- jscomp/test/raw_output_test.js | 3 +- jscomp/test/reactTestUtils.js | 5 +- jscomp/test/reasonReact.js | 35 +- jscomp/test/reasonReactCompat.js | 8 +- jscomp/test/reasonReactRouter.js | 29 +- jscomp/test/rec_fun_test.js | 7 +- jscomp/test/rec_module_opt.js | 76 ++- jscomp/test/rec_module_test.js | 256 +++++--- jscomp/test/recmodule.js | 17 +- jscomp/test/record_extension_test.js | 3 +- jscomp/test/record_name_test.js | 2 +- jscomp/test/record_with_test.js | 3 +- jscomp/test/recursive_module.js | 11 +- jscomp/test/recursive_module_test.js | 35 +- jscomp/test/recursive_unbound_module_test.js | 4 +- jscomp/test/res_debug.js | 3 +- jscomp/test/return_check.js | 2 +- jscomp/test/set_gen.js | 25 +- jscomp/test/sexp.js | 226 ++++--- jscomp/test/sexpm.js | 163 +++-- jscomp/test/sexpm_test.js | 2 +- jscomp/test/small_inline_test.js | 13 +- jscomp/test/stack_comp_test.js | 12 +- jscomp/test/stack_test.js | 2 +- jscomp/test/stream_parser_test.js | 129 ++-- jscomp/test/string_bound_get_test.js | 6 +- jscomp/test/string_get_set_test.js | 2 +- jscomp/test/string_runtime_test.js | 5 +- jscomp/test/string_set.js | 2 +- jscomp/test/string_set_test.js | 2 +- jscomp/test/string_test.js | 41 +- jscomp/test/string_unicode_test.js | 2 +- jscomp/test/submodule.js | 4 +- jscomp/test/submodule_call.js | 9 +- jscomp/test/switch_case_test.js | 2 +- jscomp/test/tagged_template_test.js | 12 +- jscomp/test/tailcall_inline_test.js | 2 +- jscomp/test/template.js | 2 +- jscomp/test/test_ari.js | 15 +- jscomp/test/test_array_primitive.js | 32 +- jscomp/test/test_bool_equal.js | 2 +- jscomp/test/test_bs_this.js | 5 +- jscomp/test/test_bytes.js | 4 +- jscomp/test/test_case_set.js | 3 +- jscomp/test/test_closure.js | 5 +- jscomp/test/test_cps.js | 11 +- jscomp/test/test_demo.js | 17 +- jscomp/test/test_exception.js | 10 +- jscomp/test/test_external.js | 3 +- jscomp/test/test_fib.js | 3 +- jscomp/test/test_for_loop.js | 41 +- jscomp/test/test_for_map.js | 51 +- jscomp/test/test_google_closure.js | 11 +- jscomp/test/test_list.js | 155 +++-- jscomp/test/test_match_exception.js | 3 +- jscomp/test/test_nested_print.js | 3 +- jscomp/test/test_per.js | 15 +- jscomp/test/test_primitive.js | 3 +- jscomp/test/test_react.js | 4 +- jscomp/test/test_seq.js | 9 +- jscomp/test/test_set.js | 27 +- jscomp/test/test_side_effect_functor.js | 2 +- jscomp/test/test_simple_ref.js | 5 +- jscomp/test/test_string_map.js | 9 +- jscomp/test/test_switch.js | 3 +- jscomp/test/test_trywith.js | 23 +- jscomp/test/test_type_based_arity.js | 31 +- jscomp/test/test_unsupported_primitive.js | 16 +- jscomp/test/test_while_closure.js | 9 +- jscomp/test/test_zero_nullable.js | 15 +- jscomp/test/ticker.js | 149 +++-- jscomp/test/to_string_test.js | 14 +- jscomp/test/topsort_test.js | 54 +- jscomp/test/tuple_alloc.js | 13 +- jscomp/test/unboxed_crash.js | 3 +- jscomp/test/unboxed_use_case.js | 5 +- jscomp/test/uncurried_cast.js | 8 +- jscomp/test/uncurried_default.args.js | 25 +- jscomp/test/uncurry_external_test.js | 2 +- jscomp/test/undef_regression2_test.js | 10 +- jscomp/test/unit_undefined_test.js | 4 +- jscomp/test/unsafe_ppx_test.js | 15 +- jscomp/test/update_record_test.js | 2 +- jscomp/test/variant.js | 3 +- jscomp/test/webpack_config.js | 2 +- lib/es6/arg.js | 47 +- lib/es6/array.js | 77 ++- lib/es6/arrayLabels.js | 77 ++- lib/es6/belt_Array.js | 105 +++- lib/es6/belt_HashMapInt.js | 2 +- lib/es6/belt_HashMapString.js | 2 +- lib/es6/belt_Id.js | 25 +- lib/es6/belt_List.js | 125 +++- lib/es6/belt_Map.js | 53 +- lib/es6/belt_MapDict.js | 9 +- lib/es6/belt_MapInt.js | 5 +- lib/es6/belt_MapString.js | 5 +- lib/es6/belt_MutableMap.js | 40 +- lib/es6/belt_MutableMapInt.js | 42 +- lib/es6/belt_MutableMapString.js | 42 +- lib/es6/belt_MutableQueue.js | 15 +- lib/es6/belt_MutableSet.js | 28 +- lib/es6/belt_MutableSetInt.js | 30 +- lib/es6/belt_MutableSetString.js | 30 +- lib/es6/belt_MutableStack.js | 11 +- lib/es6/belt_Option.js | 29 +- lib/es6/belt_Range.js | 21 +- lib/es6/belt_Result.js | 21 +- lib/es6/belt_Set.js | 25 +- lib/es6/belt_SortArray.js | 33 +- lib/es6/belt_internalAVLset.js | 33 +- lib/es6/belt_internalAVLtree.js | 49 +- lib/es6/belt_internalBuckets.js | 13 +- lib/es6/belt_internalMapInt.js | 13 +- lib/es6/belt_internalMapString.js | 13 +- lib/es6/belt_internalSetBuckets.js | 9 +- lib/es6/buffer.js | 68 +-- lib/es6/bytes.js | 168 +++--- lib/es6/bytesLabels.js | 168 +++--- lib/es6/caml.js | 6 +- lib/es6/caml_sys.js | 4 +- lib/es6/char.js | 16 +- lib/es6/digest.js | 16 +- lib/es6/filename.js | 54 +- lib/es6/genlex.js | 213 ++++--- lib/es6/hashtbl.js | 76 +-- lib/es6/hashtblLabels.js | 67 ++- lib/es6/js_array.js | 39 +- lib/es6/js_string.js | 9 +- lib/es6/lazy.js | 7 +- lib/es6/lexing.js | 3 +- lib/es6/list.js | 185 +++--- lib/es6/listLabels.js | 185 +++--- lib/es6/map.js | 67 +-- lib/es6/mapLabels.js | 67 +-- lib/es6/moreLabels.js | 117 ++-- lib/es6/parsing.js | 21 +- lib/es6/pervasives.js | 15 +- lib/es6/queue.js | 7 +- lib/es6/random.js | 114 ++-- lib/es6/set.js | 49 +- lib/es6/setLabels.js | 49 +- lib/es6/sort.js | 21 +- lib/es6/stack.js | 2 +- lib/es6/stream.js | 46 +- lib/es6/string.js | 69 ++- lib/es6/stringLabels.js | 73 +-- lib/es6/sys.js | 17 +- lib/es6/uchar.js | 32 +- lib/js/arg.js | 47 +- lib/js/array.js | 77 ++- lib/js/arrayLabels.js | 77 ++- lib/js/belt_Array.js | 105 +++- lib/js/belt_HashMapInt.js | 2 +- lib/js/belt_HashMapString.js | 2 +- lib/js/belt_Id.js | 25 +- lib/js/belt_List.js | 125 +++- lib/js/belt_Map.js | 53 +- lib/js/belt_MapDict.js | 9 +- lib/js/belt_MapInt.js | 5 +- lib/js/belt_MapString.js | 5 +- lib/js/belt_MutableMap.js | 40 +- lib/js/belt_MutableMapInt.js | 42 +- lib/js/belt_MutableMapString.js | 42 +- lib/js/belt_MutableQueue.js | 15 +- lib/js/belt_MutableSet.js | 28 +- lib/js/belt_MutableSetInt.js | 30 +- lib/js/belt_MutableSetString.js | 30 +- lib/js/belt_MutableStack.js | 11 +- lib/js/belt_Option.js | 29 +- lib/js/belt_Range.js | 21 +- lib/js/belt_Result.js | 21 +- lib/js/belt_Set.js | 25 +- lib/js/belt_SortArray.js | 33 +- lib/js/belt_internalAVLset.js | 33 +- lib/js/belt_internalAVLtree.js | 49 +- lib/js/belt_internalBuckets.js | 13 +- lib/js/belt_internalMapInt.js | 13 +- lib/js/belt_internalMapString.js | 13 +- lib/js/belt_internalSetBuckets.js | 9 +- lib/js/buffer.js | 68 +-- lib/js/bytes.js | 168 +++--- lib/js/bytesLabels.js | 168 +++--- lib/js/caml.js | 6 +- lib/js/caml_sys.js | 4 +- lib/js/char.js | 16 +- lib/js/digest.js | 16 +- lib/js/filename.js | 54 +- lib/js/genlex.js | 213 ++++--- lib/js/hashtbl.js | 76 +-- lib/js/hashtblLabels.js | 67 ++- lib/js/js_array.js | 39 +- lib/js/js_string.js | 9 +- lib/js/lazy.js | 7 +- lib/js/lexing.js | 3 +- lib/js/list.js | 185 +++--- lib/js/listLabels.js | 185 +++--- lib/js/map.js | 67 +-- lib/js/mapLabels.js | 67 +-- lib/js/moreLabels.js | 117 ++-- lib/js/parsing.js | 21 +- lib/js/pervasives.js | 15 +- lib/js/queue.js | 7 +- lib/js/random.js | 114 ++-- lib/js/set.js | 49 +- lib/js/setLabels.js | 49 +- lib/js/sort.js | 21 +- lib/js/stack.js | 2 +- lib/js/stream.js | 46 +- lib/js/string.js | 69 ++- lib/js/stringLabels.js | 73 +-- lib/js/sys.js | 17 +- lib/js/uchar.js | 32 +- 463 files changed, 6902 insertions(+), 5974 deletions(-) diff --git a/jscomp/build_tests/super_errors/expected/UncurriedArgsNotApplied.res.expected b/jscomp/build_tests/super_errors/expected/UncurriedArgsNotApplied.res.expected index ed86996f2b..6a7d407db0 100644 --- a/jscomp/build_tests/super_errors/expected/UncurriedArgsNotApplied.res.expected +++ b/jscomp/build_tests/super_errors/expected/UncurriedArgsNotApplied.res.expected @@ -12,4 +12,4 @@ Here's the original error message This has type: option<'a> - But it's expected to have type: (. unit) => option \ No newline at end of file + But it's expected to have type: unit => option \ No newline at end of file diff --git a/jscomp/build_tests/super_errors/expected/arity_mismatch.res.expected b/jscomp/build_tests/super_errors/expected/arity_mismatch.res.expected index 66063e76f9..ad2b681bc0 100644 --- a/jscomp/build_tests/super_errors/expected/arity_mismatch.res.expected +++ b/jscomp/build_tests/super_errors/expected/arity_mismatch.res.expected @@ -6,5 +6,5 @@ 2 │ let makeVariables = makeVar(.~f=f => f) 3 │ - This uncurried function has type (. ~f: 'a => 'a, unit) => int + This uncurried function has type (~f: 'a => 'a, unit) => int It is applied with 1 arguments but it requires 2. \ No newline at end of file diff --git a/jscomp/build_tests/super_errors/expected/arity_mismatch2.res.expected b/jscomp/build_tests/super_errors/expected/arity_mismatch2.res.expected index 0bd3bd998c..0d12df304a 100644 --- a/jscomp/build_tests/super_errors/expected/arity_mismatch2.res.expected +++ b/jscomp/build_tests/super_errors/expected/arity_mismatch2.res.expected @@ -6,5 +6,5 @@ 2 │ let makeVariables = makeVar(. 1, 2, 3) 3 │ - This uncurried function has type (. 'a, unit) => int + This uncurried function has type ('a, unit) => int It is applied with 3 arguments but it requires 2. \ No newline at end of file diff --git a/jscomp/build_tests/super_errors/expected/c_for_u_in_c_mode.res.expected b/jscomp/build_tests/super_errors/expected/c_for_u_in_c_mode.res.expected index a76943f8ff..e69de29bb2 100644 --- a/jscomp/build_tests/super_errors/expected/c_for_u_in_c_mode.res.expected +++ b/jscomp/build_tests/super_errors/expected/c_for_u_in_c_mode.res.expected @@ -1,28 +0,0 @@ - - We've found a bug for you! - /.../fixtures/c_for_u_in_c_mode.res:3:5-5:1 - - 1 │ module Foo: { - 2 │ let add: (. int, int) => int - 3 │ } = { - 4 │  let add = (a, b) => a + b - 5 │ } - 6 │ - - Signature mismatch: - Modules do not match: - { - let add: (int, int) => int -} - is not included in - { - let add: (. int, int) => int -} - Values do not match: - let add: (int, int) => int (curried) - is not included in - let add: (. int, int) => int (uncurried) - /.../fixtures/c_for_u_in_c_mode.res:2:3-30: - Expected declaration - /.../fixtures/c_for_u_in_c_mode.res:4:7-9: - Actual declaration \ No newline at end of file diff --git a/jscomp/build_tests/super_errors/expected/curried_expected.res.expected b/jscomp/build_tests/super_errors/expected/curried_expected.res.expected index 5b789c5abb..e0c22e9668 100644 --- a/jscomp/build_tests/super_errors/expected/curried_expected.res.expected +++ b/jscomp/build_tests/super_errors/expected/curried_expected.res.expected @@ -7,4 +7,4 @@ 3 │ let z1 = expectCurried((. x, y) => x+y) 4 │ - This function is an uncurried function where a curried function is expected \ No newline at end of file + This function expected 1 argument, but got 2 \ No newline at end of file diff --git a/jscomp/build_tests/super_errors/expected/curry_in_uncurry.res.expected b/jscomp/build_tests/super_errors/expected/curry_in_uncurry.res.expected index dfd086b799..e69de29bb2 100644 --- a/jscomp/build_tests/super_errors/expected/curry_in_uncurry.res.expected +++ b/jscomp/build_tests/super_errors/expected/curry_in_uncurry.res.expected @@ -1,10 +0,0 @@ - - We've found a bug for you! - /.../fixtures/curry_in_uncurry.res:3:1 - - 1 │ let f = (a, b) => a + b - 2 │ - 3 │ f(. 2, 2)->Js.log - 4 │ - - This function is a curried function where an uncurried function is expected \ No newline at end of file diff --git a/jscomp/build_tests/super_errors/expected/method_arity_mismatch.res.expected b/jscomp/build_tests/super_errors/expected/method_arity_mismatch.res.expected index e57bb53de8..7ccb8b108a 100644 --- a/jscomp/build_tests/super_errors/expected/method_arity_mismatch.res.expected +++ b/jscomp/build_tests/super_errors/expected/method_arity_mismatch.res.expected @@ -8,5 +8,5 @@ 4 │ } 5 │ - This uncurried function has type (. int, int) => unit + This uncurried function has type (int, int) => unit It is applied with 1 arguments but it requires 2. \ No newline at end of file diff --git a/jscomp/build_tests/super_errors/expected/missing_label.res.expected b/jscomp/build_tests/super_errors/expected/missing_label.res.expected index cc693a3312..c25d28bc84 100644 --- a/jscomp/build_tests/super_errors/expected/missing_label.res.expected +++ b/jscomp/build_tests/super_errors/expected/missing_label.res.expected @@ -1,10 +1,11 @@ We've found a bug for you! - /.../fixtures/missing_label.res:3:9 + /.../fixtures/missing_label.res:3:11-12 1 │ let f = (~a) => a ++ "" 2 │ - 3 │ let _ = f("") + 3 │ let _ = f("") 4 │ - Label ~a was omitted in the application of this labeled function. \ No newline at end of file + The function applied to this argument has type (~a: string) => string +This argument cannot be applied without label \ No newline at end of file diff --git a/jscomp/build_tests/super_errors/expected/missing_labels.res.expected b/jscomp/build_tests/super_errors/expected/missing_labels.res.expected index 3783b11ef5..e4c64c60c3 100644 --- a/jscomp/build_tests/super_errors/expected/missing_labels.res.expected +++ b/jscomp/build_tests/super_errors/expected/missing_labels.res.expected @@ -1,10 +1,12 @@ We've found a bug for you! - /.../fixtures/missing_labels.res:3:9 + /.../fixtures/missing_labels.res:3:11-12 1 │ let f = (~a, ~b) => a ++ b 2 │ - 3 │ let _ = f("", "") + 3 │ let _ = f("", "") 4 │ - Labels ~a, ~b were omitted in the application of this labeled function. \ No newline at end of file + The function applied to this argument has type + (~a: string, ~b: string) => string +This argument cannot be applied without label \ No newline at end of file diff --git a/jscomp/build_tests/super_errors/expected/moreArguments1.res.expected b/jscomp/build_tests/super_errors/expected/moreArguments1.res.expected index 3eb4dd6dd1..1333abc19f 100644 --- a/jscomp/build_tests/super_errors/expected/moreArguments1.res.expected +++ b/jscomp/build_tests/super_errors/expected/moreArguments1.res.expected @@ -1,9 +1,10 @@ We've found a bug for you! - /.../fixtures/moreArguments1.res:2:9-15 + /.../fixtures/moreArguments1.res:2:9 1 │ let x = (~a, ~b) => a + b - 2 │ let y = x(~a=2) + 2 + 2 │ let y = x(~a=2) + 2 3 │ - This call is missing an argument of type (~b: int) \ No newline at end of file + This uncurried function has type (~a: int, ~b: int) => int + It is applied with 1 arguments but it requires 2. \ No newline at end of file diff --git a/jscomp/build_tests/super_errors/expected/moreArguments2.res.expected b/jscomp/build_tests/super_errors/expected/moreArguments2.res.expected index 8c433b0967..e12c5afbb1 100644 --- a/jscomp/build_tests/super_errors/expected/moreArguments2.res.expected +++ b/jscomp/build_tests/super_errors/expected/moreArguments2.res.expected @@ -1,9 +1,10 @@ We've found a bug for you! - /.../fixtures/moreArguments2.res:2:9-12 + /.../fixtures/moreArguments2.res:2:9 1 │ let x = (a, b) => a + b - 2 │ let y = x(2) + 2 + 2 │ let y = x(2) + 2 3 │ - This call is missing an argument of type int \ No newline at end of file + This uncurried function has type (int, int) => int + It is applied with 1 arguments but it requires 2. \ No newline at end of file diff --git a/jscomp/build_tests/super_errors/expected/moreArguments3.res.expected b/jscomp/build_tests/super_errors/expected/moreArguments3.res.expected index cb3d0e4a60..a33272f9f8 100644 --- a/jscomp/build_tests/super_errors/expected/moreArguments3.res.expected +++ b/jscomp/build_tests/super_errors/expected/moreArguments3.res.expected @@ -1,9 +1,10 @@ We've found a bug for you! - /.../fixtures/moreArguments3.res:2:9-12 + /.../fixtures/moreArguments3.res:2:9 1 │ let x = (a, b, c, d) => a + b - 2 │ let y = x(2) + 2 + 2 │ let y = x(2) + 2 3 │ - This call is missing arguments of type: int, 'a, 'b \ No newline at end of file + This uncurried function has type (int, int, 'a, 'b) => int + It is applied with 1 arguments but it requires 4. \ No newline at end of file diff --git a/jscomp/build_tests/super_errors/expected/moreArguments4.res.expected b/jscomp/build_tests/super_errors/expected/moreArguments4.res.expected index 3d0e7f5d06..449bdf8315 100644 --- a/jscomp/build_tests/super_errors/expected/moreArguments4.res.expected +++ b/jscomp/build_tests/super_errors/expected/moreArguments4.res.expected @@ -1,9 +1,10 @@ We've found a bug for you! - /.../fixtures/moreArguments4.res:2:9-12 + /.../fixtures/moreArguments4.res:2:9 1 │ let x = (a, ~b, ~c, ~d) => a + b - 2 │ let y = x(2) + 2 + 2 │ let y = x(2) + 2 3 │ - This call is missing arguments of type: (~b: int), (~c: 'a), (~d: 'b) \ No newline at end of file + This uncurried function has type (int, ~b: int, ~c: 'a, ~d: 'b) => int + It is applied with 1 arguments but it requires 4. \ No newline at end of file diff --git a/jscomp/build_tests/super_errors/expected/moreArguments5.res.expected b/jscomp/build_tests/super_errors/expected/moreArguments5.res.expected index b5be57a134..0f17c3913e 100644 --- a/jscomp/build_tests/super_errors/expected/moreArguments5.res.expected +++ b/jscomp/build_tests/super_errors/expected/moreArguments5.res.expected @@ -1,10 +1,11 @@ We've found a bug for you! - /.../fixtures/moreArguments5.res:5:9-12 + /.../fixtures/moreArguments5.res:5:9 3 │ } 4 │ let x = (a, b, c, d) => {Sub.a: 2} - 5 │ let y = x(2).Sub.a + 5 │ let y = x(2).Sub.a 6 │ - This call is missing arguments of type: 'a, 'b, 'c \ No newline at end of file + This uncurried function has type (int, 'a, 'b, 'c) => Sub.a + It is applied with 1 arguments but it requires 4. \ No newline at end of file diff --git a/jscomp/build_tests/super_errors/expected/partial_app.res.expected b/jscomp/build_tests/super_errors/expected/partial_app.res.expected index b2ece41d95..de2121de51 100644 --- a/jscomp/build_tests/super_errors/expected/partial_app.res.expected +++ b/jscomp/build_tests/super_errors/expected/partial_app.res.expected @@ -1,16 +1,11 @@ - Warning number 109 (configured as error) - /.../fixtures/partial_app.res:5:1-7 + We've found a bug for you! + /.../fixtures/partial_app.res:5:1 3 │ } 4 │ - 5 │ f(1, 2) + 5 │ f(1, 2) 6 │ - This function call is at the top level and is expected to return `unit`. But it's returning `int => int`. - - In ReScript, anything at the top level must evaluate to `unit`. You can fix this by assigning the expression to a value, or piping it into the `ignore` function. - - Possible solutions: - - Assigning to a value that is then ignored: `let _ = yourFunctionCall()` - - Piping into the built-in ignore function to ignore the result: `yourFunctionCall()->ignore` \ No newline at end of file + This uncurried function has type (int, int, int) => int + It is applied with 2 arguments but it requires 3. \ No newline at end of file diff --git a/jscomp/build_tests/super_errors/expected/primitives3.res.expected b/jscomp/build_tests/super_errors/expected/primitives3.res.expected index b028b405d9..6092fdf01b 100644 --- a/jscomp/build_tests/super_errors/expected/primitives3.res.expected +++ b/jscomp/build_tests/super_errors/expected/primitives3.res.expected @@ -7,5 +7,5 @@ 3 │ x(2, 4) 4 │ - This function has type int => int - It only accepts 1 argument; here, it's called with more. \ No newline at end of file + This uncurried function has type int => int + It is applied with 2 arguments but it requires 1. \ No newline at end of file diff --git a/jscomp/build_tests/super_errors/expected/u_for_c_in_c_mode.res.expected b/jscomp/build_tests/super_errors/expected/u_for_c_in_c_mode.res.expected index 64ccef591c..e69de29bb2 100644 --- a/jscomp/build_tests/super_errors/expected/u_for_c_in_c_mode.res.expected +++ b/jscomp/build_tests/super_errors/expected/u_for_c_in_c_mode.res.expected @@ -1,28 +0,0 @@ - - We've found a bug for you! - /.../fixtures/u_for_c_in_c_mode.res:3:5-5:1 - - 1 │ module Foo: { - 2 │ let add: (int, int) => int - 3 │ } = { - 4 │  let add = (. a, b) => a + b - 5 │ } - 6 │ - - Signature mismatch: - Modules do not match: - { - let add: (. int, int) => int -} - is not included in - { - let add: (int, int) => int -} - Values do not match: - let add: (. int, int) => int (uncurried) - is not included in - let add: (int, int) => int (curried) - /.../fixtures/u_for_c_in_c_mode.res:2:3-28: - Expected declaration - /.../fixtures/u_for_c_in_c_mode.res:4:7-9: - Actual declaration \ No newline at end of file diff --git a/jscomp/build_tests/super_errors/expected/uncurried_expected.res.expected b/jscomp/build_tests/super_errors/expected/uncurried_expected.res.expected index cb4afd42cf..e69de29bb2 100644 --- a/jscomp/build_tests/super_errors/expected/uncurried_expected.res.expected +++ b/jscomp/build_tests/super_errors/expected/uncurried_expected.res.expected @@ -1,9 +0,0 @@ - - We've found a bug for you! - /.../fixtures/uncurried_expected.res:2:15-22 - - 1 │ let apply = (f) => f(. 1) - 2 │ let z = apply(x => x+1) - 3 │ - - This expression is expected to have an uncurried function \ No newline at end of file diff --git a/jscomp/build_tests/super_errors/expected/uncurried_wrong_label.res.expected b/jscomp/build_tests/super_errors/expected/uncurried_wrong_label.res.expected index 955e973b37..2ce03713d5 100644 --- a/jscomp/build_tests/super_errors/expected/uncurried_wrong_label.res.expected +++ b/jscomp/build_tests/super_errors/expected/uncurried_wrong_label.res.expected @@ -7,5 +7,6 @@ 3 │ let d = foo(. ~y=3) 4 │ - The function applied to this argument has type (. ~x: int, ~y: int) => int + The function applied to this argument has type + (~x: int) => (~y: int) => int This argument cannot be applied with label ~y \ No newline at end of file diff --git a/jscomp/build_tests/super_errors/expected/warnings1.res.expected b/jscomp/build_tests/super_errors/expected/warnings1.res.expected index 4d911382ed..5a0d1c5d76 100644 --- a/jscomp/build_tests/super_errors/expected/warnings1.res.expected +++ b/jscomp/build_tests/super_errors/expected/warnings1.res.expected @@ -1,12 +1,12 @@ We've found a bug for you! - /.../fixtures/warnings1.res:3:3-7 + /.../fixtures/warnings1.res:3:3 1 │ let x = (a, b) => a + b 2 │ let z = () => { - 3 │ x(10) + 3 │ x(10) 4 │ 10 5 │ } - This function call returns: int => int - But it's expected to return: unit \ No newline at end of file + This uncurried function has type (int, int) => int + It is applied with 1 arguments but it requires 2. \ No newline at end of file diff --git a/jscomp/build_tests/super_errors/expected/warnings3.res.expected b/jscomp/build_tests/super_errors/expected/warnings3.res.expected index 11f5a87056..d5bfef3589 100644 --- a/jscomp/build_tests/super_errors/expected/warnings3.res.expected +++ b/jscomp/build_tests/super_errors/expected/warnings3.res.expected @@ -6,7 +6,7 @@ 2 │ let _ = string_of_float(34.) 3 │ let _ = string_of_float(34.) - deprecated: Pervasives.string_of_float + deprecated: PervasivesU.string_of_float Please use Js.Float.toString instead, string_of_float generates unparseable floats @@ -18,7 +18,7 @@ 3 │ let _ = string_of_float(34.) 4 │ - deprecated: Pervasives.string_of_float + deprecated: PervasivesU.string_of_float Please use Js.Float.toString instead, string_of_float generates unparseable floats @@ -30,5 +30,5 @@ 3 │ let _ = string_of_float(34.) 4 │ - deprecated: Pervasives.string_of_float + deprecated: PervasivesU.string_of_float Please use Js.Float.toString instead, string_of_float generates unparseable floats \ No newline at end of file diff --git a/jscomp/gentype_tests/typescript-react-example/src/ImmutableArray.res.js b/jscomp/gentype_tests/typescript-react-example/src/ImmutableArray.res.js index 8f0f909427..630eccaa40 100644 --- a/jscomp/gentype_tests/typescript-react-example/src/ImmutableArray.res.js +++ b/jscomp/gentype_tests/typescript-react-example/src/ImmutableArray.res.js @@ -18,9 +18,13 @@ function size(a) { return a.length; } -let get = Belt_Array.get; +function get(a, x) { + return Belt_Array.get(a, x); +} -let getExn = Belt_Array.getExn; +function getExn(a, x) { + return Belt_Array.getExn(a, x); +} function getUnsafe(a, x) { return a[x]; @@ -30,9 +34,13 @@ function getUndefined(a, x) { return a[x]; } -let shuffle = Belt_Array.shuffle; +function shuffle(x) { + return Belt_Array.shuffle(x); +} -let reverse = Belt_Array.reverse; +function reverse(x) { + return Belt_Array.reverse(x); +} function makeUninitialized(x) { return new Array(x); @@ -42,13 +50,21 @@ function makeUninitializedUnsafe(x) { return new Array(x); } -let make = Belt_Array.make; +function make(x, y) { + return Belt_Array.make(x, y); +} -let range = Belt_Array.range; +function range(x, y) { + return Belt_Array.range(x, y); +} -let rangeBy = Belt_Array.rangeBy; +function rangeBy(x, y, step) { + return Belt_Array.rangeBy(x, y, step); +} -let makeByU = Belt_Array.makeByU; +function makeByU(c, f) { + return Belt_Array.makeByU(c, f); +} function makeBy(c, f) { return Belt_Array.makeBy(c, (function (x) { @@ -56,7 +72,9 @@ function makeBy(c, f) { })); } -let makeByAndShuffleU = Belt_Array.makeByAndShuffleU; +function makeByAndShuffleU(c, f) { + return Belt_Array.makeByAndShuffleU(c, f); +} function makeByAndShuffle(c, f) { return Belt_Array.makeByAndShuffle(c, (function (x) { @@ -64,9 +82,13 @@ function makeByAndShuffle(c, f) { })); } -let zip = Belt_Array.zip; +function zip(a1, a2) { + return Belt_Array.zip(a1, a2); +} -let zipByU = Belt_Array.zipByU; +function zipByU(a1, a2, f) { + return Belt_Array.zipByU(a1, a2, f); +} function zipBy(a1, a2, f) { return Belt_Array.zipBy(a1, a2, (function (x, y) { @@ -74,21 +96,33 @@ function zipBy(a1, a2, f) { })); } -let unzip = Belt_Array.unzip; +function unzip(a) { + return Belt_Array.unzip(a); +} -let concat = Belt_Array.concat; +function concat(a1, a2) { + return Belt_Array.concat(a1, a2); +} -let concatMany = Belt_Array.concatMany; +function concatMany(a) { + return Belt_Array.concatMany(a); +} -let slice = Belt_Array.slice; +function slice(a, offset, len) { + return Belt_Array.slice(a, offset, len); +} -let sliceToEnd = Belt_Array.sliceToEnd; +function sliceToEnd(a, b) { + return Belt_Array.sliceToEnd(a, b); +} function copy(a) { return a.slice(0); } -let forEachU = Belt_Array.forEachU; +function forEachU(a, f) { + Belt_Array.forEachU(a, f); +} function forEach(a, f) { Belt_Array.forEach(a, (function (x) { @@ -96,7 +130,9 @@ function forEach(a, f) { })); } -let mapU = Belt_Array.mapU; +function mapU(a, f) { + return Belt_Array.mapU(a, f); +} function map(a, f) { return Belt_Array.map(a, (function (x) { @@ -104,7 +140,9 @@ function map(a, f) { })); } -let keepWithIndexU = Belt_Array.keepWithIndexU; +function keepWithIndexU(a, f) { + return Belt_Array.keepWithIndexU(a, f); +} function keepWithIndex(a, f) { return Belt_Array.keepWithIndex(a, (function (x, y) { @@ -112,7 +150,9 @@ function keepWithIndex(a, f) { })); } -let keepMapU = Belt_Array.keepMapU; +function keepMapU(a, f) { + return Belt_Array.keepMapU(a, f); +} function keepMap(a, f) { return Belt_Array.keepMap(a, (function (x) { @@ -120,7 +160,9 @@ function keepMap(a, f) { })); } -let forEachWithIndexU = Belt_Array.forEachWithIndexU; +function forEachWithIndexU(a, f) { + Belt_Array.forEachWithIndexU(a, f); +} function forEachWithIndex(a, f) { Belt_Array.forEachWithIndex(a, (function (x, y) { @@ -128,7 +170,9 @@ function forEachWithIndex(a, f) { })); } -let mapWithIndexU = Belt_Array.mapWithIndexU; +function mapWithIndexU(a, f) { + return Belt_Array.mapWithIndexU(a, f); +} function mapWithIndex(a, f) { return Belt_Array.mapWithIndex(a, (function (x, y) { @@ -136,7 +180,9 @@ function mapWithIndex(a, f) { })); } -let partitionU = Belt_Array.partitionU; +function partitionU(a, f) { + return Belt_Array.partitionU(a, f); +} function partition(a, f) { return Belt_Array.partition(a, (function (x) { @@ -144,7 +190,9 @@ function partition(a, f) { })); } -let reduceU = Belt_Array.reduceU; +function reduceU(a, b, f) { + return Belt_Array.reduceU(a, b, f); +} function reduce(a, b, f) { return Belt_Array.reduce(a, b, (function (x, y) { @@ -152,7 +200,9 @@ function reduce(a, b, f) { })); } -let reduceReverseU = Belt_Array.reduceReverseU; +function reduceReverseU(a, b, f) { + return Belt_Array.reduceReverseU(a, b, f); +} function reduceReverse(a, b, f) { return Belt_Array.reduceReverse(a, b, (function (x, y) { @@ -160,7 +210,9 @@ function reduceReverse(a, b, f) { })); } -let reduceReverse2U = Belt_Array.reduceReverse2U; +function reduceReverse2U(a1, a2, c, f) { + return Belt_Array.reduceReverse2U(a1, a2, c, f); +} function reduceReverse2(a1, a2, c, f) { return Belt_Array.reduceReverse2(a1, a2, c, (function (x, y, z) { @@ -168,7 +220,9 @@ function reduceReverse2(a1, a2, c, f) { })); } -let someU = Belt_Array.someU; +function someU(a, f) { + return Belt_Array.someU(a, f); +} function some(a, f) { return Belt_Array.some(a, (function (x) { @@ -176,7 +230,9 @@ function some(a, f) { })); } -let everyU = Belt_Array.everyU; +function everyU(a, f) { + return Belt_Array.everyU(a, f); +} function every(a, f) { return Belt_Array.every(a, (function (x) { @@ -184,7 +240,9 @@ function every(a, f) { })); } -let every2U = Belt_Array.every2U; +function every2U(a1, a2, f) { + return Belt_Array.every2U(a1, a2, f); +} function every2(a1, a2, f) { return Belt_Array.every2(a1, a2, (function (x, y) { @@ -192,7 +250,9 @@ function every2(a1, a2, f) { })); } -let some2U = Belt_Array.some2U; +function some2U(a1, a2, f) { + return Belt_Array.some2U(a1, a2, f); +} function some2(a1, a2, f) { return Belt_Array.some2(a1, a2, (function (x, y) { @@ -200,7 +260,9 @@ function some2(a1, a2, f) { })); } -let cmpU = Belt_Array.cmpU; +function cmpU(a1, a2, f) { + return Belt_Array.cmpU(a1, a2, f); +} function cmp(a1, a2, f) { return Belt_Array.cmp(a1, a2, (function (x, y) { @@ -208,7 +270,9 @@ function cmp(a1, a2, f) { })); } -let eqU = Belt_Array.eqU; +function eqU(a1, a2, f) { + return Belt_Array.eqU(a1, a2, f); +} function eq(a1, a2, f) { return Belt_Array.eq(a1, a2, (function (x, y) { diff --git a/jscomp/gentype_tests/typescript-react-example/src/Records.res.js b/jscomp/gentype_tests/typescript-react-example/src/Records.res.js index 36bff49322..04f88e58dd 100644 --- a/jscomp/gentype_tests/typescript-react-example/src/Records.res.js +++ b/jscomp/gentype_tests/typescript-react-example/src/Records.res.js @@ -19,10 +19,12 @@ function coord2d(x, y) { }; } -let getOpt = Belt_Option.mapWithDefault; +function getOpt(opt, $$default, foo) { + return Belt_Option.mapWithDefault(opt, $$default, foo); +} function findAddress(business) { - return Belt_Option.mapWithDefault(business.address, /* [] */0, (function (a) { + return getOpt(business.address, /* [] */0, (function (a) { return { hd: a, tl: /* [] */0 @@ -32,13 +34,13 @@ function findAddress(business) { function findAllAddresses(businesses) { return Belt_List.toArray(Belt_List.flatten(Belt_List.fromArray(Belt_Array.map(businesses, (function (business) { - return Belt_List.concat(Belt_Option.mapWithDefault(business.address, /* [] */0, (function (a) { + return Belt_List.concat(getOpt(business.address, /* [] */0, (function (a) { return { hd: a, tl: /* [] */0 }; - })), Belt_Option.mapWithDefault(business.owner, /* [] */0, (function (p) { - return Belt_Option.mapWithDefault(p.address, /* [] */0, (function (a) { + })), getOpt(business.owner, /* [] */0, (function (p) { + return getOpt(p.address, /* [] */0, (function (a) { return { hd: a, tl: /* [] */0 @@ -75,7 +77,7 @@ function getPayloadRecordPlusOne(param) { } function findAddress2(business) { - return Belt_Option.mapWithDefault(Caml_option.nullable_to_opt(business.address2), /* [] */0, (function (a) { + return getOpt(Caml_option.nullable_to_opt(business.address2), /* [] */0, (function (a) { return { hd: a, tl: /* [] */0 diff --git a/jscomp/others/release.ninja b/jscomp/others/release.ninja index 4f02eb3085..8056470d24 100644 --- a/jscomp/others/release.ninja +++ b/jscomp/others/release.ninja @@ -1,5 +1,5 @@ -bsc_primitive_flags = -no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero -nostdlib -bs-cross-module-opt -make-runtime -nopervasives -unsafe -w +50 -warn-error A -curried +bsc_primitive_flags = -no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero -nostdlib -bs-cross-module-opt -make-runtime -nopervasives -unsafe -w +50 -warn-error A -uncurried bsc_flags = $bsc_primitive_flags -open Belt_internals rule cc diff --git a/jscomp/runtime/release.ninja b/jscomp/runtime/release.ninja index d4de758876..d6318b7ae0 100644 --- a/jscomp/runtime/release.ninja +++ b/jscomp/runtime/release.ninja @@ -1,5 +1,5 @@ -bsc_no_open_flags = -no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero -nostdlib -bs-cross-module-opt -make-runtime -nopervasives -unsafe -w +50 -warn-error A -curried +bsc_no_open_flags = -no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero -nostdlib -bs-cross-module-opt -make-runtime -nopervasives -unsafe -w +50 -warn-error A -uncurried bsc_flags = $bsc_no_open_flags -open Bs_stdlib_mini rule cc @@ -10,7 +10,7 @@ rule cc_cmi description = $in -> $out o runtime/bs_stdlib_mini.cmi : cc runtime/bs_stdlib_mini.resi - bsc_flags = -nostdlib -nopervasives -curried + bsc_flags = -nostdlib -nopervasives -uncurried o runtime/js.cmj runtime/js.cmi : cc runtime/js.res bsc_flags = $bsc_no_open_flags o runtime/caml.cmj : cc_cmi runtime/caml.res | runtime/caml.cmi runtime/caml_int64_extern.cmj diff --git a/jscomp/stdlib-406/release.ninja b/jscomp/stdlib-406/release.ninja index b43d399815..751ac9f0a4 100644 --- a/jscomp/stdlib-406/release.ninja +++ b/jscomp/stdlib-406/release.ninja @@ -1,5 +1,5 @@ -bsc_flags = -no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero -nostdlib -bs-cross-module-opt -make-runtime -w -9-3-106 -warn-error A -I others -curried +bsc_flags = -no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero -nostdlib -bs-cross-module-opt -make-runtime -w -9-3-106 -warn-error A -I others -uncurried rule cc command = $bsc -bs-cmi -bs-cmj $bsc_flags -I stdlib-406 $in @@ -9,13 +9,13 @@ rule cc_cmi description = $in -> $out o stdlib-406/pervasives.cmj : cc_cmi stdlib-406/pervasives.res | stdlib-406/pervasives.cmi $bsc others - bsc_flags = $bsc_flags -nopervasives -curried + bsc_flags = $bsc_flags -nopervasives -uncurried o stdlib-406/pervasives.cmi : cc stdlib-406/pervasives.resi | $bsc others - bsc_flags = $bsc_flags -nopervasives -curried + bsc_flags = $bsc_flags -nopervasives -uncurried o stdlib-406/pervasivesU.cmj : cc_cmi stdlib-406/pervasivesU.res | stdlib-406/pervasivesU.cmi $bsc others - bsc_flags = $bsc_flags -nopervasives -curried + bsc_flags = $bsc_flags -nopervasives -uncurried o stdlib-406/pervasivesU.cmi : cc stdlib-406/pervasivesU.resi | $bsc others - bsc_flags = $bsc_flags -nopervasives -curried + bsc_flags = $bsc_flags -nopervasives -uncurried o stdlib-406/arg.cmj : cc_cmi stdlib-406/arg.res | stdlib-406/arg.cmi stdlib-406/array.cmj stdlib-406/buffer.cmj stdlib-406/list.cmj stdlib-406/string.cmj stdlib-406/sys.cmj $bsc others o stdlib-406/arg.cmi : cc stdlib-406/arg.resi | stdlib-406/pervasives.cmj $bsc others o stdlib-406/array.cmj : cc_cmi stdlib-406/array.res | stdlib-406/array.cmi $bsc others diff --git a/jscomp/test/406_primitive_test.js b/jscomp/test/406_primitive_test.js index fb78f4a302..a1b63dd5ff 100644 --- a/jscomp/test/406_primitive_test.js +++ b/jscomp/test/406_primitive_test.js @@ -29,7 +29,7 @@ eq("File \"406_primitive_test.res\", line 23, characters 3-10", backend_type, { _0: "BS" }); -function f(param) { +function f() { let A = /* @__PURE__ */Caml_exceptions.create("A"); try { for(let i = 0; i <= 200; ++i){ diff --git a/jscomp/test/DerivingAccessorsCurried.js b/jscomp/test/DerivingAccessorsCurried.js index 2ad2d0eb53..49a7d6079e 100644 --- a/jscomp/test/DerivingAccessorsCurried.js +++ b/jscomp/test/DerivingAccessorsCurried.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); function myField(param) { return param.myField; @@ -23,7 +22,7 @@ function doubleNum(param_0, param_1) { } function compose(a, accessor) { - return Curry._1(accessor, a); + return accessor(a); } let _composedMyField = 1; diff --git a/jscomp/test/DisambiguateOptionalFields.js b/jscomp/test/DisambiguateOptionalFields.js index 6ebd358bf8..976d5e9947 100644 --- a/jscomp/test/DisambiguateOptionalFields.js +++ b/jscomp/test/DisambiguateOptionalFields.js @@ -10,13 +10,13 @@ function f2(v) { return v.x; } +let res = 3; + let v = { x: 3, y: 4 }; -let res = 3; - exports.f1 = f1; exports.f2 = f2; exports.v = v; diff --git a/jscomp/test/Import.js b/jscomp/test/Import.js index 4e4acc7836..b094a389db 100644 --- a/jscomp/test/Import.js +++ b/jscomp/test/Import.js @@ -1,19 +1,18 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); async function eachIntAsync(list, f) { - return Curry._2(await import("../../lib/js/belt_List.js").then(function (m) { + return (await import("../../lib/js/belt_List.js").then(function (m) { return m.forEach; - }), list, f); + }))(list, f); } function eachIntLazy(list, f) { return import("../../lib/js/belt_List.js").then(function (m) { return m.forEach; }).then(function (each) { - return Promise.resolve(Curry._2(each, list, f)); + return Promise.resolve(each(list, f)); }); } @@ -73,15 +72,15 @@ let M0 = await import("../../lib/js/belt_List.js"); let M1 = await import("../../lib/js/belt_List.js"); -async function f(param) { +async function f() { return (await import("../../lib/js/belt_List.js")).forEach; } -async function f1(param) { +async function f1() { return (await import("../../lib/js/belt_List.js")).forEach; } -async function f2(param) { +async function f2() { let M3 = await import("../../lib/js/belt_List.js"); let M4 = await import("../../lib/js/belt_List.js"); return [ @@ -90,7 +89,7 @@ async function f2(param) { ]; } -async function f3(param) { +async function f3() { let M3 = await import("../../lib/js/belt_List.js"); let M4 = await import("../../lib/js/belt_List.js"); return [ @@ -99,11 +98,11 @@ async function f3(param) { ]; } -async function f4(param) { +async function f4() { return (await import("../../lib/js/belt_Array.js")).forEach; } -async function f5(param) { +async function f5() { let A = await import("../../lib/js/belt_Array.js"); let O = await import("../../lib/js/belt_Option.js"); return [ @@ -112,7 +111,7 @@ async function f5(param) { ]; } -async function f6(param) { +async function f6() { let MS = await import("../../lib/js/belt_MapString.js"); let A = await import("../../lib/js/belt_Array.js"); return [ @@ -122,7 +121,7 @@ async function f6(param) { ]; } -async function f7(param) { +async function f7() { await import("../../lib/js/belt_MapInt.js"); return 1; } diff --git a/jscomp/test/UncurriedExternals.js b/jscomp/test/UncurriedExternals.js index de83580641..2aa967abd0 100644 --- a/jscomp/test/UncurriedExternals.js +++ b/jscomp/test/UncurriedExternals.js @@ -3,7 +3,7 @@ let React = require("react"); -function dd(param) { +function dd() { throw new Error("Not_found", { cause: { RE_EXN_ID: "Not_found" @@ -49,7 +49,7 @@ function tsiU(c) { }); } -let match = React.useState(function (param) { +let match = React.useState(function () { return 3; }); @@ -73,11 +73,11 @@ let StandardNotation = { set: StandardNotation_set }; -function methodWithAsync(param) { +function methodWithAsync() { let $$this = this ; - return (async function (arg) { + return async function (arg) { return $$this + arg | 0; - })(param); + }; } exports.StandardNotation = StandardNotation; diff --git a/jscomp/test/a_filename_test.js b/jscomp/test/a_filename_test.js index 94575f08ba..309864fbda 100644 --- a/jscomp/test/a_filename_test.js +++ b/jscomp/test/a_filename_test.js @@ -18,7 +18,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -44,49 +44,49 @@ if (process.platform !== "win32") { "/a/tmp.txt", "/a/tmp.txt/subdir/file.txt" ]); - eq("File \"a_filename_test.res\", line 28, characters 5-12", Ext_filename_test.node_relative_path(true, { + eq("File \"a_filename_test.res\", line 28, characters 5-12", test({ NAME: "File", VAL: "./a/b.c" }, { NAME: "File", VAL: "./a/u/g.c" }), "./u/g.c"); - eq("File \"a_filename_test.res\", line 31, characters 4-11", Ext_filename_test.node_relative_path(true, { + eq("File \"a_filename_test.res\", line 31, characters 4-11", test({ NAME: "File", VAL: "./a/b.c" }, { NAME: "File", VAL: "xxxghsoghos/ghsoghso/node_modules/buckle-stdlib/list.js" }), "buckle-stdlib/list.js"); - eq("File \"a_filename_test.res\", line 37, characters 4-11", Ext_filename_test.node_relative_path(true, { + eq("File \"a_filename_test.res\", line 37, characters 4-11", test({ NAME: "File", VAL: "./a/b.c" }, { NAME: "File", VAL: "xxxghsoghos/ghsoghso/node_modules//buckle-stdlib/list.js" }), "buckle-stdlib/list.js"); - eq("File \"a_filename_test.res\", line 43, characters 4-11", Ext_filename_test.node_relative_path(true, { + eq("File \"a_filename_test.res\", line 43, characters 4-11", test({ NAME: "File", VAL: "./a/b.c" }, { NAME: "File", VAL: "xxxghsoghos/ghsoghso/node_modules/./buckle-stdlib/list.js" }), "buckle-stdlib/list.js"); - eq("File \"a_filename_test.res\", line 48, characters 5-12", Ext_filename_test.node_relative_path(true, { + eq("File \"a_filename_test.res\", line 48, characters 5-12", test({ NAME: "File", VAL: "./a/c.js" }, { NAME: "File", VAL: "./a/b" }), "./b"); - eq("File \"a_filename_test.res\", line 49, characters 5-12", Ext_filename_test.node_relative_path(true, { + eq("File \"a_filename_test.res\", line 49, characters 5-12", test({ NAME: "File", VAL: "./a/c" }, { NAME: "File", VAL: "./a/b.js" }), "./b.js"); - eq("File \"a_filename_test.res\", line 50, characters 5-12", Ext_filename_test.node_relative_path(true, { + eq("File \"a_filename_test.res\", line 50, characters 5-12", test({ NAME: "Dir", VAL: "./a/" }, { diff --git a/jscomp/test/a_recursive_type.js b/jscomp/test/a_recursive_type.js index 1c8ad8884f..e46f155b06 100644 --- a/jscomp/test/a_recursive_type.js +++ b/jscomp/test/a_recursive_type.js @@ -1,10 +1,9 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); function g(x) { - return Curry._1(x._0, x); + return x._0(x); } let loop = g({ @@ -12,12 +11,12 @@ let loop = g({ _0: g }); -let x = { +let non_terminate = (function (x) { + return x._0(x); +})({ TAG: "A", _0: g -}; - -let non_terminate = g(x); +}); let xx = {}; diff --git a/jscomp/test/a_scope_bug.js b/jscomp/test/a_scope_bug.js index f80dcfef42..353958d34b 100644 --- a/jscomp/test/a_scope_bug.js +++ b/jscomp/test/a_scope_bug.js @@ -13,7 +13,9 @@ function odd(_z) { }; } -let even = odd; +function even(y) { + return odd(y); +} exports.odd = odd; exports.even = even; diff --git a/jscomp/test/alias_test.js b/jscomp/test/alias_test.js index 637e178967..6c1180a5fc 100644 --- a/jscomp/test/alias_test.js +++ b/jscomp/test/alias_test.js @@ -13,7 +13,7 @@ let a21 = a20 + a20; let a22 = "test " + (a21 + "hello"); -function ff(param) { +function ff() { return "cool " + a22; } diff --git a/jscomp/test/ari_regress_test.js b/jscomp/test/ari_regress_test.js index da79d0742c..55e9383ea1 100644 --- a/jscomp/test/ari_regress_test.js +++ b/jscomp/test/ari_regress_test.js @@ -3,7 +3,9 @@ let Mt = require("./mt.js"); -let g = 7; +let g = (function (extra) { + return 3 + extra | 0; +})(4); let h = { contents: 0 @@ -19,7 +21,9 @@ function g1(x, y) { let u = 8; -let x = u + 6 | 0; +let x = (function (z) { + return u + z | 0; +})(6); function v(__x) { return g1(3, 4)(6, __x); @@ -81,4 +85,4 @@ let suites = { Mt.from_pair_suites("Ari_regress_test", suites); -/* Not a pure module */ +/* g Not a pure module */ diff --git a/jscomp/test/arith_lexer.js b/jscomp/test/arith_lexer.js index 3fe31466a5..a0653b9414 100644 --- a/jscomp/test/arith_lexer.js +++ b/jscomp/test/arith_lexer.js @@ -1,10 +1,9 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let Lexing = require("../../lib/js/lexing.js"); -let Pervasives = require("../../lib/js/pervasives.js"); let Caml_format = require("../../lib/js/caml_format.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); let __ocaml_lex_tables = { lex_base: "\x00\x00\xf6\xff\xf7\xff\xf8\xff\xf9\xff\xfa\xff\xfb\xff\xfc\xff\ @@ -152,7 +151,7 @@ function __ocaml_lex_lexeme_rec(lexbuf, ___ocaml_lex_state) { case 9 : return "EOF"; default: - Curry._1(lexbuf.refill_buff, lexbuf); + lexbuf.refill_buff(lexbuf); ___ocaml_lex_state = __ocaml_lex_state$1; continue; } @@ -166,7 +165,7 @@ function lexeme(lexbuf) { function str(e) { switch (e.TAG) { case "Numeral" : - return Pervasives.string_of_float(e._0); + return PervasivesU.string_of_float(e._0); case "Plus" : return str(e._0) + ("+" + str(e._1)); case "Minus" : diff --git a/jscomp/test/arith_syntax.js b/jscomp/test/arith_syntax.js index 1847109dfd..d1b8edbf2f 100644 --- a/jscomp/test/arith_syntax.js +++ b/jscomp/test/arith_syntax.js @@ -1,12 +1,12 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Pervasives = require("../../lib/js/pervasives.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); function str(e) { switch (e.TAG) { case "Numeral" : - return Pervasives.string_of_float(e._0); + return PervasivesU.string_of_float(e._0); case "Plus" : return str(e._0) + ("+" + str(e._1)); case "Minus" : diff --git a/jscomp/test/arity.js b/jscomp/test/arity.js index c3c61451da..c102b0bb09 100644 --- a/jscomp/test/arity.js +++ b/jscomp/test/arity.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); function u(f, a, b) { console.log(f(a, b)); @@ -9,8 +8,8 @@ function u(f, a, b) { } function u2(f, a, b) { - console.log(Curry._2(f, a, b)); - console.log(Curry._2(f, a, b)); + console.log(f(a, b)); + console.log(f(a, b)); } function f(x, y) { diff --git a/jscomp/test/arity_deopt.js b/jscomp/test/arity_deopt.js index 7d1512fb7a..9424711c78 100644 --- a/jscomp/test/arity_deopt.js +++ b/jscomp/test/arity_deopt.js @@ -16,7 +16,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -56,7 +56,9 @@ eq("File \"arity_deopt.res\", line 48, characters 11-18", 6, (function (y, z) { return (1 + y | 0) + z | 0; })(2, 3)); -eq("File \"arity_deopt.res\", line 49, characters 11-18", 6, 6); +eq("File \"arity_deopt.res\", line 49, characters 11-18", 6, (function (z) { + return 3 + z | 0; +})(3)); eq("File \"arity_deopt.res\", line 50, characters 11-18", 6, (function (y, z) { return (1 + y | 0) + z | 0; diff --git a/jscomp/test/arity_infer.js b/jscomp/test/arity_infer.js index 287497a2b3..e79d4a0c52 100644 --- a/jscomp/test/arity_infer.js +++ b/jscomp/test/arity_infer.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); function f0(x) { let tmp; @@ -25,7 +24,7 @@ function f1(x) { RE_EXN_ID: "Not_found" } }); - return Curry._1(undefined, x); + return undefined(x); } function f3(x) { diff --git a/jscomp/test/array_subtle_test.js b/jscomp/test/array_subtle_test.js index 519247aa1e..c978ce2889 100644 --- a/jscomp/test/array_subtle_test.js +++ b/jscomp/test/array_subtle_test.js @@ -19,7 +19,7 @@ function eq(loc, param) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/array_test.js b/jscomp/test/array_test.js index 3c43f34ab2..8e971d222b 100644 --- a/jscomp/test/array_test.js +++ b/jscomp/test/array_test.js @@ -5,7 +5,6 @@ let Mt = require("./mt.js"); let Caml = require("../../lib/js/caml.js"); let List = require("../../lib/js/list.js"); let $$Array = require("../../lib/js/array.js"); -let Curry = require("../../lib/js/curry.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); let Caml_array = require("../../lib/js/caml_array.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); @@ -20,7 +19,7 @@ function starts_with(xs, prefix, p) { } try { for(let i = 0; i < len2; ++i){ - if (!Curry._2(p, Caml_array.get(xs, i), Caml_array.get(prefix, i))) { + if (!p(Caml_array.get(xs, i), Caml_array.get(prefix, i))) { throw new Error(H, { cause: { RE_EXN_ID: H diff --git a/jscomp/test/ast_abstract_test.js b/jscomp/test/ast_abstract_test.js index 04b70d13ee..27d20ddd01 100644 --- a/jscomp/test/ast_abstract_test.js +++ b/jscomp/test/ast_abstract_test.js @@ -17,7 +17,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/async_await.js b/jscomp/test/async_await.js index bb0aa4890d..ae29f57668 100644 --- a/jscomp/test/async_await.js +++ b/jscomp/test/async_await.js @@ -1,27 +1,26 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let Caml_array = require("../../lib/js/caml_array.js"); function next(n) { return n + 1 | 0; } -async function useNext(param) { +async function useNext() { return 4; } function Make(I) { let get = async function (key) { - return await Curry._1(I.get, key); + return await I.get(key); }; return { get: get }; } -async function topFoo(param) { +async function topFoo() { return 1; } diff --git a/jscomp/test/async_inline.js b/jscomp/test/async_inline.js index 4335b2c367..423dc97bb3 100644 --- a/jscomp/test/async_inline.js +++ b/jscomp/test/async_inline.js @@ -1,44 +1,47 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let React = require("react"); -async function willBeInlined(param) { +async function willBeInlined() { return 3; } let inlined = willBeInlined(); -function wrapSomethingAsync(param) { +function wrapSomethingAsync() { ((async function (param) { let test = await Promise.resolve("Test"); console.log(test); })(777)); } -function wrapSomethingAsync2(param) { - ((async function (param) { +function wrapSomethingAsync2() { + ((async function () { let test = await Promise.resolve("Test"); console.log(test); })()); } async function doSomethingAsync(someAsyncFunction) { - return await Curry._1(someAsyncFunction, undefined); + return await someAsyncFunction(); } -let broken = doSomethingAsync; +function broken(someAsyncFunction) { + return doSomethingAsync(someAsyncFunction); +} let M = { broken: broken }; async function broken$1(someAsyncFunction) { - return await Curry._1(someAsyncFunction, undefined); + return await someAsyncFunction(); } -let broken$2 = broken$1; +function broken$2(someAsyncFunction) { + return broken$1(someAsyncFunction); +} function curriedId(x) { return x; @@ -56,32 +59,32 @@ async function uncurriedIdAsync(x) { return x; } +let tci = 3; + let tcia = curriedIdAsync(3); let tui = 3; let tuia = uncurriedIdAsync(3); -function nested1(param) { +function nested1() { return async function (y) { return await y; }; } -async function nested2(param) { +async function nested2() { return async function (y) { return await y; }; } -function onSubmit(param) { +function onSubmit() { return React.useCallback(async function (b) { return await b; }); } -let tci = 3; - exports.willBeInlined = willBeInlined; exports.inlined = inlined; exports.wrapSomethingAsync = wrapSomethingAsync; diff --git a/jscomp/test/async_inside_loop.js b/jscomp/test/async_inside_loop.js index 9ec90b5307..226c4ac47b 100644 --- a/jscomp/test/async_inside_loop.js +++ b/jscomp/test/async_inside_loop.js @@ -2,9 +2,9 @@ 'use strict'; -async function topLevelAsyncFunction(param) { +async function topLevelAsyncFunction() { for(let innerScopeVal = 0; innerScopeVal <= 3; ++innerScopeVal){ - let asyncClosureAccessingScopedVal = async function (param) { + let asyncClosureAccessingScopedVal = async function () { console.log("Accessing scoped var inside loop", innerScopeVal); return await Promise.resolve(); }; diff --git a/jscomp/test/attr_test.js b/jscomp/test/attr_test.js index 4ad7b793fe..2d54972a0b 100644 --- a/jscomp/test/attr_test.js +++ b/jscomp/test/attr_test.js @@ -15,7 +15,7 @@ function max2(x, y) { let hh = 1 + 2; function f(x) { - des(x, (function (param) { + des(x, (function () { console.log("hei"); })); } diff --git a/jscomp/test/basic_module_test.js b/jscomp/test/basic_module_test.js index 74cffaa95f..cc66bb5a9e 100644 --- a/jscomp/test/basic_module_test.js +++ b/jscomp/test/basic_module_test.js @@ -2,8 +2,8 @@ 'use strict'; let Mt = require("./mt.js"); -let Curry = require("../../lib/js/curry.js"); let Offset = require("./offset.js"); +let Pr6726 = require("./pr6726.js"); let Mt_global = require("./mt_global.js"); let count = { @@ -14,7 +14,7 @@ function test(set) { count.contents = Offset.$$Set.cardinal(set) + count.contents | 0; } -test(Curry._1(Offset.M.$$Set.singleton, "42")); +test(Offset.M.$$Set.singleton("42")); let suites = { contents: /* [] */0 diff --git a/jscomp/test/bdd.js b/jscomp/test/bdd.js index a3c74117a9..71c28192b9 100644 --- a/jscomp/test/bdd.js +++ b/jscomp/test/bdd.js @@ -123,7 +123,7 @@ function insert(idl, idh, v, ind, bucket, newNode) { }); } -function resetUnique(param) { +function resetUnique() { sz_1.contents = 8191; htab.contents = Caml_array.make(sz_1.contents + 1 | 0, /* [] */0); n_items.contents = 0; @@ -338,16 +338,16 @@ function xor(n1, n2) { function hwb(n) { let h = function (i, j) { if (i === j) { - return mkNode("Zero", i, "One"); + return mkVar(i); } else { - return xor(and2(not(mkNode("Zero", j, "One")), h(i, j - 1 | 0)), and2(mkNode("Zero", j, "One"), g(i, j - 1 | 0))); + return xor(and2(not(mkVar(j)), h(i, j - 1 | 0)), and2(mkVar(j), g(i, j - 1 | 0))); } }; let g = function (i, j) { if (i === j) { - return mkNode("Zero", i, "One"); + return mkVar(i); } else { - return xor(and2(not(mkNode("Zero", i, "One")), h(i + 1 | 0, j)), and2(mkNode("Zero", i, "One"), g(i + 1 | 0, j))); + return xor(and2(not(mkVar(i)), h(i + 1 | 0, j)), and2(mkVar(i), g(i + 1 | 0, j))); } }; return h(0, n - 1 | 0); @@ -357,7 +357,7 @@ let seed = { contents: 0 }; -function random(param) { +function random() { seed.contents = Math.imul(seed.contents, 25173) + 17431 | 0; return (seed.contents & 1) > 0; } @@ -395,7 +395,7 @@ function test_hwb(bdd, vars) { return bool_equal($$eval(bdd, vars), ntrue > 0 ? Caml_array.get(vars, ntrue - 1 | 0) : false); } -function main(param) { +function main() { let bdd = hwb(22); let succeeded = true; for(let i = 1; i <= 100; ++i){ diff --git a/jscomp/test/bench.js b/jscomp/test/bench.js index c1b437fa45..f51082342d 100644 --- a/jscomp/test/bench.js +++ b/jscomp/test/bench.js @@ -1,12 +1,13 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let Caml_array = require("../../lib/js/caml_array.js"); -let Pervasives = require("../../lib/js/pervasives.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); function map(f, a) { - let f$1 = Curry.__1(f); + let f$1 = function (x) { + return f(x); + }; let l = a.length; if (l === 0) { return []; @@ -19,7 +20,9 @@ function map(f, a) { } function init(l, f) { - let f$1 = Curry.__1(f); + let f$1 = function (x) { + return f(x); + }; if (l === 0) { return []; } @@ -39,7 +42,9 @@ function init(l, f) { } function fold_left(f, x, a) { - let f$1 = Curry.__2(f); + let f$1 = function (x, y) { + return f(x, y); + }; let r = x; for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ r = f$1(r, a[i]); @@ -47,7 +52,7 @@ function fold_left(f, x, a) { return r; } -function f2(param) { +function f2() { let arr = init(3000000, (function (i) { return i; })); @@ -57,7 +62,7 @@ function f2(param) { let v = fold_left((function (prim0, prim1) { return prim0 + prim1; }), 0, b); - console.log(Pervasives.string_of_float(v)); + console.log(PervasivesU.string_of_float(v)); } f2(); diff --git a/jscomp/test/bs_MapInt_test.js b/jscomp/test/bs_MapInt_test.js index b372c76603..4934a8aaf3 100644 --- a/jscomp/test/bs_MapInt_test.js +++ b/jscomp/test/bs_MapInt_test.js @@ -11,7 +11,7 @@ function should(b) { } -function test(param) { +function test() { let m; for(let i = 0; i <= 999999; ++i){ m = Belt_MapInt.set(m, i, i); diff --git a/jscomp/test/bs_abstract_test.js b/jscomp/test/bs_abstract_test.js index 04b65a9ae0..650119951d 100644 --- a/jscomp/test/bs_abstract_test.js +++ b/jscomp/test/bs_abstract_test.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let v = { hd: 3, @@ -18,15 +17,17 @@ let f = { }; function uf(u) { - return Curry._1(u.y0, 1); + return u.y0(1); } function uf1(u) { - return Curry._1(u.y1, 1); + return function (extra) { + return u.y1(1, extra); + }; } function uf2(u) { - return Curry._2(u.y1, 1, 2); + return u.y1(1, 2); } function uff(f) { @@ -40,7 +41,7 @@ function uff2(f) { function uff3(f) { let x = f.yyyy2; if (x !== undefined) { - return Curry._1(x, 0); + return x(0); } else { return 0; } diff --git a/jscomp/test/bs_array_test.js b/jscomp/test/bs_array_test.js index babc807909..e34425f2ae 100644 --- a/jscomp/test/bs_array_test.js +++ b/jscomp/test/bs_array_test.js @@ -3,7 +3,6 @@ let Mt = require("./mt.js"); let Caml = require("../../lib/js/caml.js"); -let Curry = require("../../lib/js/curry.js"); let Js_list = require("../../lib/js/js_list.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); let Belt_List = require("../../lib/js/belt_List.js"); @@ -36,7 +35,7 @@ function neq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Neq", _0: x, @@ -84,45 +83,43 @@ eq("File \"bs_array_test.res\", line 31, characters 4-11", [ undefined ]); -$$throw("File \"bs_array_test.res\", line 35, characters 8-15", (function (param) { +$$throw("File \"bs_array_test.res\", line 35, characters 8-15", (function () { Belt_Array.getExn([ 0, 1 ], -1); })); -$$throw("File \"bs_array_test.res\", line 36, characters 8-15", (function (param) { +$$throw("File \"bs_array_test.res\", line 36, characters 8-15", (function () { Belt_Array.getExn([ 0, 1 ], 2); })); -let partial_arg = [ - 0, - 1 -]; - -function f(param) { - return Belt_Array.getExn(partial_arg, param); +function f(extra) { + return Belt_Array.getExn([ + 0, + 1 + ], extra); } b("File \"bs_array_test.res\", line 38, characters 4-11", Caml_obj.equal([ - Curry._1(f, 0), - Curry._1(f, 1) + f(0), + f(1) ], [ 0, 1 ])); -$$throw("File \"bs_array_test.res\", line 44, characters 8-15", (function (param) { +$$throw("File \"bs_array_test.res\", line 44, characters 8-15", (function () { Belt_Array.setExn([ 0, 1 ], -1, 0); })); -$$throw("File \"bs_array_test.res\", line 45, characters 8-15", (function (param) { +$$throw("File \"bs_array_test.res\", line 45, characters 8-15", (function () { Belt_Array.setExn([ 0, 1 @@ -310,7 +307,11 @@ let u = Belt_Array.shuffle(v$5); neq("File \"bs_array_test.res\", line 122, characters 6-13", u, v$5); -eq("File \"bs_array_test.res\", line 124, characters 5-12", Belt_Array.reduce(u, 0, add), Belt_Array.reduce(v$5, 0, add)); +function sum(x) { + return Belt_Array.reduce(x, 0, add); +} + +eq("File \"bs_array_test.res\", line 124, characters 5-12", sum(u), sum(v$5)); b("File \"bs_array_test.res\", line 129, characters 4-11", Caml_obj.equal(Belt_Array.range(0, 3), [ 0, diff --git a/jscomp/test/bs_auto_uncurry.js b/jscomp/test/bs_auto_uncurry.js index a564f5fe5e..3ea45355c0 100644 --- a/jscomp/test/bs_auto_uncurry.js +++ b/jscomp/test/bs_auto_uncurry.js @@ -1,10 +1,9 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let Caml_splice_call = require("../../lib/js/caml_splice_call.js"); -let Curry$1 = {}; +let Curry = {}; let Block = {}; @@ -23,7 +22,7 @@ function f(cb) { 2, 3, 4 - ], Curry.__1(cb)); + ], cb); } let xs = Array.prototype.map.call([ @@ -43,13 +42,13 @@ let xs = Array.prototype.map.call([ return (param[1] + param[0] | 0) + 1 | 0; })); -function f_0(param) { - return hi(function (param) { +function f_0() { + return hi(function () { }); } -function f_01(param) { +function f_01() { return hi(function (x) { if (x === undefined) { console.log("x"); @@ -67,20 +66,21 @@ function f_02(xs) { } function f_03(xs, u) { - return hi(Curry.__1(u)); + return hi(u); } function h(x, y, z) { - return map2(x, y, Curry.__2(z)); + return map2(x, y, z); } function h1(x, y, u, z) { - let partial_arg = Curry._1(z, u); - return map2(x, y, Curry.__2(partial_arg)); + return map2(x, y, z(u)); } -function add3(x, y, z) { - return (x + y | 0) + z | 0; +function add3(x) { + return function (y, z) { + return (x + y | 0) + z | 0; + }; } function h2(x) { @@ -90,20 +90,20 @@ function h2(x) { } function h3(x) { - return ff(x, (function (param, param$1) { - return add3(1, param, param$1); + return ff(x, (function (y, z) { + return (1 + y | 0) + z | 0; })); } function h4(x) { - return ff1(x, 3, (function (param, param$1) { - return add3(1, param, param$1); + return ff1(x, 3, (function (y, z) { + return (1 + y | 0) + z | 0; })); } function h5(x) { - return ff2(x, "3", (function (param, param$1) { - return add3(2, param, param$1); + return ff2(x, "3", (function (y, z) { + return (2 + y | 0) + z | 0; })); } @@ -119,7 +119,7 @@ function h6(x) { return ff2(x, "3", add); } -function unit_magic(param) { +function unit_magic() { console.log("noinline"); console.log("noinline"); return 3; @@ -134,7 +134,7 @@ function hh(xs, a) { ]); } -exports.Curry = Curry$1; +exports.Curry = Curry; exports.Block = Block; exports.xbs = xbs; exports.f = f; diff --git a/jscomp/test/bs_auto_uncurry_test.js b/jscomp/test/bs_auto_uncurry_test.js index e5b40de25a..0e218a1999 100644 --- a/jscomp/test/bs_auto_uncurry_test.js +++ b/jscomp/test/bs_auto_uncurry_test.js @@ -16,7 +16,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/bs_float_test.js b/jscomp/test/bs_float_test.js index 321f9d6b52..2a20e0d374 100644 --- a/jscomp/test/bs_float_test.js +++ b/jscomp/test/bs_float_test.js @@ -29,7 +29,7 @@ function neq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Neq", _0: x, diff --git a/jscomp/test/bs_hashmap_test.js b/jscomp/test/bs_hashmap_test.js index e44cd0452e..41e07fbb6e 100644 --- a/jscomp/test/bs_hashmap_test.js +++ b/jscomp/test/bs_hashmap_test.js @@ -9,7 +9,6 @@ let Belt_Array = require("../../lib/js/belt_Array.js"); let Belt_HashMap = require("../../lib/js/belt_HashMap.js"); let Belt_SortArray = require("../../lib/js/belt_SortArray.js"); let Array_data_util = require("./array_data_util.js"); -let Belt_internalBucketsType = require("../../lib/js/belt_internalBucketsType.js"); let suites = { contents: /* [] */0 @@ -31,13 +30,15 @@ function eq(x, y) { return x === y; } -let hash = Hashtbl.hash; +function hash(x) { + return Hashtbl.hash(x); +} let cmp = Caml.int_compare; let Y = Belt_Id.hashable(hash, eq); -let empty = Belt_internalBucketsType.make(Y.hash, Y.eq, 30); +let empty = Belt_HashMap.make(30, Y); function add(prim0, prim1) { return prim0 + prim1 | 0; @@ -78,7 +79,7 @@ eqx("File \"bs_hashmap_test.res\", line 42, characters 6-13", Belt_SortArray.sta let u$1 = Belt_Array.concat(Array_data_util.randomRange(0, 100000), Array_data_util.randomRange(0, 100)); -let v$1 = Belt_internalBucketsType.make(Y.hash, Y.eq, 40); +let v$1 = Belt_HashMap.make(40, Y); Belt_HashMap.mergeMany(v$1, Belt_Array.zip(u$1, u$1)); diff --git a/jscomp/test/bs_hashset_int_test.js b/jscomp/test/bs_hashset_int_test.js index 3abb87e389..c7647d3d44 100644 --- a/jscomp/test/bs_hashset_int_test.js +++ b/jscomp/test/bs_hashset_int_test.js @@ -7,7 +7,6 @@ let Belt_SetInt = require("../../lib/js/belt_SetInt.js"); let Array_data_util = require("./array_data_util.js"); let Belt_HashSetInt = require("../../lib/js/belt_HashSetInt.js"); let Belt_SortArrayInt = require("../../lib/js/belt_SortArrayInt.js"); -let Belt_internalBucketsType = require("../../lib/js/belt_internalBucketsType.js"); let suites = { contents: /* [] */0 @@ -55,7 +54,7 @@ eq("File \"bs_hashset_int_test.res\", line 25, characters 5-12", sum2(v), 6825); let u$1 = Belt_Array.concat(Array_data_util.randomRange(0, 100000), Array_data_util.randomRange(0, 100)); -let v$1 = Belt_internalBucketsType.make(undefined, undefined, 40); +let v$1 = Belt_HashSetInt.make(40); Belt_HashSetInt.mergeMany(v$1, u$1); diff --git a/jscomp/test/bs_hashtbl_string_test.js b/jscomp/test/bs_hashtbl_string_test.js index 0f52cd3162..ab60ab5044 100644 --- a/jscomp/test/bs_hashtbl_string_test.js +++ b/jscomp/test/bs_hashtbl_string_test.js @@ -10,7 +10,6 @@ let Belt_HashMapInt = require("../../lib/js/belt_HashMapInt.js"); let Belt_HashSetInt = require("../../lib/js/belt_HashSetInt.js"); let Belt_HashMapString = require("../../lib/js/belt_HashMapString.js"); let Caml_hash_primitive = require("../../lib/js/caml_hash_primitive.js"); -let Belt_internalBucketsType = require("../../lib/js/belt_internalBucketsType.js"); function hash_string(s) { return Caml_hash_primitive.hash_final_mix(Caml_hash_primitive.hash_mix_string(0, s)); @@ -43,9 +42,9 @@ let Int = Belt_Id.hashable(Hashtbl.hash, (function (x, y) { return x === y; })); -let empty = Belt_internalBucketsType.make(Int.hash, Int.eq, 500000); +let empty = Belt_HashMap.make(500000, Int); -function bench(param) { +function bench() { for(let i = 0; i <= 1000000; ++i){ Belt_HashMap.set(empty, i, i); } @@ -68,7 +67,7 @@ function bench(param) { } function bench2(m) { - let empty = Belt_internalBucketsType.make(m.hash, m.eq, 1000000); + let empty = Belt_HashMap.make(1000000, m); for(let i = 0; i <= 1000000; ++i){ Belt_HashMap.set(empty, String(i), i); } @@ -147,8 +146,8 @@ function bench3(m) { let Sx = Belt_Id.comparable(Caml.string_compare); -function bench4(param) { - let table = Belt_internalBucketsType.make(undefined, undefined, 1000000); +function bench4() { + let table = Belt_HashMapString.make(1000000); for(let i = 0; i <= 1000000; ++i){ Belt_HashMapString.set(table, String(i), i); } @@ -185,8 +184,8 @@ function bench4(param) { }); } -function bench5(param) { - let table = Belt_internalBucketsType.make(Int.hash, Int.eq, 1000000); +function bench5() { + let table = Belt_HashMap.make(1000000, Int); console.time("bs_hashtbl_string_test.res 112"); for(let i = 0; i <= 1000000; ++i){ Belt_HashMap.set(table, i, i); @@ -229,8 +228,8 @@ function bench5(param) { }); } -function bench6(param) { - let table = Belt_internalBucketsType.make(undefined, undefined, 1000000); +function bench6() { + let table = Belt_HashMapInt.make(1000000); for(let i = 0; i <= 1000000; ++i){ Belt_HashMapInt.set(table, i, i); } @@ -267,8 +266,8 @@ function bench6(param) { }); } -function bench7(param) { - let table = Belt_internalBucketsType.make(undefined, undefined, 2000000); +function bench7() { + let table = Belt_HashSetInt.make(2000000); for(let i = 0; i <= 1000000; ++i){ Belt_HashSetInt.add(table, i); } diff --git a/jscomp/test/bs_ignore_effect.js b/jscomp/test/bs_ignore_effect.js index f080ab193c..9aebbaf3a1 100644 --- a/jscomp/test/bs_ignore_effect.js +++ b/jscomp/test/bs_ignore_effect.js @@ -16,7 +16,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/bs_int_test.js b/jscomp/test/bs_int_test.js index d411ee74ea..1c319ab001 100644 --- a/jscomp/test/bs_int_test.js +++ b/jscomp/test/bs_int_test.js @@ -29,7 +29,7 @@ function neq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Neq", _0: x, diff --git a/jscomp/test/bs_list_test.js b/jscomp/test/bs_list_test.js index 21987afb08..52d626d882 100644 --- a/jscomp/test/bs_list_test.js +++ b/jscomp/test/bs_list_test.js @@ -110,7 +110,11 @@ eq("File \"bs_list_test.res\", line 33, characters 5-12", Belt_List.getBy({ return x % 5 === 0; })), undefined); -eq("FLATTEN", Belt_List.flatten({ +function $eq$tilde(extra, extra$1) { + return eq("FLATTEN", extra, extra$1); +} + +$eq$tilde(Belt_List.flatten({ hd: { hd: 1, tl: /* [] */0 @@ -159,9 +163,9 @@ eq("FLATTEN", Belt_List.flatten({ } }); -eq("FLATTEN", Belt_List.flatten(/* [] */0), /* [] */0); +$eq$tilde(Belt_List.flatten(/* [] */0), /* [] */0); -eq("FLATTEN", Belt_List.flatten({ +$eq$tilde(Belt_List.flatten({ hd: /* [] */0, tl: { hd: /* [] */0, @@ -199,7 +203,11 @@ eq("FLATTEN", Belt_List.flatten({ } }); -eq("CONCATMANY", Belt_List.concatMany([ +function $eq$tilde$1(extra, extra$1) { + return eq("CONCATMANY", extra, extra$1); +} + +$eq$tilde$1(Belt_List.concatMany([ { hd: 1, tl: /* [] */0 @@ -239,9 +247,9 @@ eq("CONCATMANY", Belt_List.concatMany([ } }); -eq("CONCATMANY", Belt_List.concatMany([]), /* [] */0); +$eq$tilde$1(Belt_List.concatMany([]), /* [] */0); -eq("CONCATMANY", Belt_List.concatMany([ +$eq$tilde$1(Belt_List.concatMany([ /* [] */0, /* [] */0, { @@ -268,7 +276,7 @@ eq("CONCATMANY", Belt_List.concatMany([ } }); -eq("CONCATMANY", Belt_List.concatMany([ +$eq$tilde$1(Belt_List.concatMany([ /* [] */0, /* [] */0, { @@ -301,7 +309,7 @@ eq("CONCATMANY", Belt_List.concatMany([ } }); -eq("CONCATMANY", Belt_List.concatMany([{ +$eq$tilde$1(Belt_List.concatMany([{ hd: 1, tl: { hd: 2, @@ -331,7 +339,11 @@ eq("File \"bs_list_test.res\", line 66, characters 2-9", Belt_List.toArray(Belt_ return i; })))); -eq("APPEND", Belt_List.concat({ +function $eq$tilde$2(extra, extra$1) { + return eq("APPEND", extra, extra$1); +} + +$eq$tilde$2(Belt_List.concat({ hd: 1, tl: /* [] */0 }, /* [] */0), { @@ -339,7 +351,7 @@ eq("APPEND", Belt_List.concat({ tl: /* [] */0 }); -eq("APPEND", Belt_List.concat(/* [] */0, { +$eq$tilde$2(Belt_List.concat(/* [] */0, { hd: 1, tl: /* [] */0 }), { @@ -347,7 +359,11 @@ eq("APPEND", Belt_List.concat(/* [] */0, { tl: /* [] */0 }); -eq("ZIP", Belt_List.zip({ +function $eq$tilde$3(extra, extra$1) { + return eq("ZIP", extra, extra$1); +} + +$eq$tilde$3(Belt_List.zip({ hd: 1, tl: { hd: 2, @@ -376,14 +392,14 @@ eq("ZIP", Belt_List.zip({ } }); -eq("ZIP", Belt_List.zip(/* [] */0, { +$eq$tilde$3(Belt_List.zip(/* [] */0, { hd: 1, tl: /* [] */0 }), /* [] */0); -eq("ZIP", Belt_List.zip(/* [] */0, /* [] */0), /* [] */0); +$eq$tilde$3(Belt_List.zip(/* [] */0, /* [] */0), /* [] */0); -eq("ZIP", Belt_List.zip({ +$eq$tilde$3(Belt_List.zip({ hd: 1, tl: { hd: 2, @@ -394,7 +410,7 @@ eq("ZIP", Belt_List.zip({ } }, /* [] */0), /* [] */0); -eq("ZIP", Belt_List.zip({ +$eq$tilde$3(Belt_List.zip({ hd: 1, tl: { hd: 2, @@ -440,7 +456,11 @@ function evenIndex(_x, i) { return i % 2 === 0; } -eq("PARTITION", Belt_List.partition({ +function $eq$tilde$4(extra, extra$1) { + return eq("PARTITION", extra, extra$1); +} + +$eq$tilde$4(Belt_List.partition({ hd: 1, tl: { hd: 2, @@ -481,7 +501,7 @@ eq("PARTITION", Belt_List.partition({ } ]); -eq("PARTITION", Belt_List.partition({ +$eq$tilde$4(Belt_List.partition({ hd: 2, tl: { hd: 2, @@ -510,7 +530,7 @@ eq("PARTITION", Belt_List.partition({ /* [] */0 ]); -eq("PARTITION", Belt_List.partition({ +$eq$tilde$4(Belt_List.partition({ hd: 2, tl: { hd: 2, @@ -541,17 +561,21 @@ eq("PARTITION", Belt_List.partition({ } ]); -eq("PARTITION", Belt_List.partition(/* [] */0, mod2), [ +$eq$tilde$4(Belt_List.partition(/* [] */0, mod2), [ /* [] */0, /* [] */0 ]); -eq("UNZIP", Belt_List.unzip(/* [] */0), [ +function $eq$tilde$5(extra, extra$1) { + return eq("UNZIP", extra, extra$1); +} + +$eq$tilde$5(Belt_List.unzip(/* [] */0), [ /* [] */0, /* [] */0 ]); -eq("UNZIP", Belt_List.unzip({ +$eq$tilde$5(Belt_List.unzip({ hd: [ 1, 2 @@ -568,7 +592,7 @@ eq("UNZIP", Belt_List.unzip({ } ]); -eq("UNZIP", Belt_List.unzip({ +$eq$tilde$5(Belt_List.unzip({ hd: [ 1, 2 @@ -597,7 +621,11 @@ eq("UNZIP", Belt_List.unzip({ } ]); -eq("FILTER", Belt_List.keep({ +function $eq$tilde$6(extra, extra$1) { + return eq("FILTER", extra, extra$1); +} + +$eq$tilde$6(Belt_List.keep({ hd: 1, tl: { hd: 2, @@ -617,7 +645,7 @@ eq("FILTER", Belt_List.keep({ } }); -eq("FILTER", Belt_List.keep({ +$eq$tilde$6(Belt_List.keep({ hd: 1, tl: { hd: 3, @@ -628,9 +656,9 @@ eq("FILTER", Belt_List.keep({ } }, mod2), /* [] */0); -eq("FILTER", Belt_List.keep(/* [] */0, mod2), /* [] */0); +$eq$tilde$6(Belt_List.keep(/* [] */0, mod2), /* [] */0); -eq("FILTER", Belt_List.keep({ +$eq$tilde$6(Belt_List.keep({ hd: 2, tl: { hd: 2, @@ -662,9 +690,13 @@ eq("FILTER", Belt_List.keep({ } }); -eq("FILTER2", Belt_List.keepWithIndex(/* [] */0, evenIndex), /* [] */0); +function $eq$tilde$7(extra, extra$1) { + return eq("FILTER2", extra, extra$1); +} + +$eq$tilde$7(Belt_List.keepWithIndex(/* [] */0, evenIndex), /* [] */0); -eq("FILTER2", Belt_List.keepWithIndex({ +$eq$tilde$7(Belt_List.keepWithIndex({ hd: 1, tl: { hd: 2, @@ -684,7 +716,7 @@ eq("FILTER2", Belt_List.keepWithIndex({ } }); -eq("FILTER2", Belt_List.keepWithIndex({ +$eq$tilde$7(Belt_List.keepWithIndex({ hd: 0, tl: { hd: 1, @@ -726,7 +758,11 @@ function id(x) { return x; } -eq("MAP", Belt_List.map(Belt_List.makeBy(5, id), (function (x) { +function $eq$tilde$8(extra, extra$1) { + return eq("MAP", extra, extra$1); +} + +$eq$tilde$8(Belt_List.map(Belt_List.makeBy(5, id), (function (x) { return (x << 1); })), { hd: 0, @@ -745,9 +781,9 @@ eq("MAP", Belt_List.map(Belt_List.makeBy(5, id), (function (x) { } }); -eq("MAP", Belt_List.map(/* [] */0, id), /* [] */0); +$eq$tilde$8(Belt_List.map(/* [] */0, id), /* [] */0); -eq("MAP", Belt_List.map({ +$eq$tilde$8(Belt_List.map({ hd: 1, tl: /* [] */0 }, (function (x) { @@ -765,25 +801,33 @@ let length_10_id = Belt_List.makeBy(10, id); let length_8_id = Belt_List.makeBy(8, id); +function $eq$tilde$9(extra, extra$1) { + return eq("MAP2", extra, extra$1); +} + let d = Belt_List.makeBy(10, (function (x) { return (x << 1); })); -eq("MAP2", Belt_List.zipBy(length_10_id, length_10_id, add), d); +function map2_add(x, y) { + return Belt_List.zipBy(x, y, add); +} + +$eq$tilde$9(map2_add(length_10_id, length_10_id), d); -eq("MAP2", Belt_List.zipBy(/* [] */0, { +$eq$tilde$9(map2_add(/* [] */0, { hd: 1, tl: /* [] */0 -}, add), /* [] */0); +}), /* [] */0); -eq("MAP2", Belt_List.zipBy({ +$eq$tilde$9(map2_add({ hd: 1, tl: /* [] */0 -}, /* [] */0, add), /* [] */0); +}, /* [] */0), /* [] */0); -eq("MAP2", Belt_List.zipBy(/* [] */0, /* [] */0, add), /* [] */0); +$eq$tilde$9(map2_add(/* [] */0, /* [] */0), /* [] */0); -eq("MAP2", Belt_List.zipBy(length_10_id, length_10_id, add), Belt_List.concat(Belt_List.map(length_8_id, (function (x) { +$eq$tilde$9(map2_add(length_10_id, length_10_id), Belt_List.concat(Belt_List.map(length_8_id, (function (x) { return (x << 1); })), { hd: 16, @@ -793,11 +837,11 @@ eq("MAP2", Belt_List.zipBy(length_10_id, length_10_id, add), Belt_List.concat(Be } })); -eq("MAP2", Belt_List.zipBy(length_10_id, length_8_id, add), Belt_List.mapWithIndex(length_8_id, (function (i, x) { +$eq$tilde$9(map2_add(length_10_id, length_8_id), Belt_List.mapWithIndex(length_8_id, (function (i, x) { return i + x | 0; }))); -eq("MAP2", Belt_List.reverse(Belt_List.mapReverse2(length_10_id, length_10_id, add)), Belt_List.map(length_10_id, (function (x) { +$eq$tilde$9(Belt_List.reverse(Belt_List.mapReverse2(length_10_id, length_10_id, add)), Belt_List.map(length_10_id, (function (x) { return (x << 1); }))); @@ -805,9 +849,9 @@ let xs = Belt_List.reverse(Belt_List.mapReverse2(length_8_id, length_10_id, add) eq("File \"bs_list_test.res\", line 163, characters 5-12", Belt_List.length(xs), 8); -eq("MAP2", xs, Belt_List.zipBy(length_10_id, length_8_id, add)); +$eq$tilde$9(xs, Belt_List.zipBy(length_10_id, length_8_id, add)); -eq("MAP2", Belt_List.mapReverse2({ +$eq$tilde$9(Belt_List.mapReverse2({ hd: 1, tl: { hd: 2, @@ -832,7 +876,11 @@ eq("MAP2", Belt_List.mapReverse2({ } }); -eq("TAKE", Belt_List.take({ +function $eq$tilde$10(extra, extra$1) { + return eq("TAKE", extra, extra$1); +} + +$eq$tilde$10(Belt_List.take({ hd: 1, tl: { hd: 2, @@ -849,9 +897,9 @@ eq("TAKE", Belt_List.take({ } }); -eq("TAKE", Belt_List.take(/* [] */0, 1), undefined); +$eq$tilde$10(Belt_List.take(/* [] */0, 1), undefined); -eq("TAKE", Belt_List.take({ +$eq$tilde$10(Belt_List.take({ hd: 1, tl: { hd: 2, @@ -859,7 +907,7 @@ eq("TAKE", Belt_List.take({ } }, 3), undefined); -eq("TAKE", Belt_List.take({ +$eq$tilde$10(Belt_List.take({ hd: 1, tl: { hd: 2, @@ -873,15 +921,19 @@ eq("TAKE", Belt_List.take({ } }); -eq("TAKE", Belt_List.take(length_10_id, 8), length_8_id); +$eq$tilde$10(Belt_List.take(length_10_id, 8), length_8_id); -eq("TAKE", Belt_List.take(length_10_id, 0), /* [] */0); +$eq$tilde$10(Belt_List.take(length_10_id, 0), /* [] */0); -eq("TAKE", Belt_List.take(length_8_id, -2), undefined); +$eq$tilde$10(Belt_List.take(length_8_id, -2), undefined); -eq("DROP", Belt_List.drop(length_10_id, 10), /* [] */0); +function $eq$tilde$11(extra, extra$1) { + return eq("DROP", extra, extra$1); +} + +$eq$tilde$11(Belt_List.drop(length_10_id, 10), /* [] */0); -eq("DROP", Belt_List.drop(length_10_id, 8), { +$eq$tilde$11(Belt_List.drop(length_10_id, 8), { hd: 8, tl: { hd: 9, @@ -889,22 +941,26 @@ eq("DROP", Belt_List.drop(length_10_id, 8), { } }); -eq("DROP", Belt_List.drop(length_10_id, 0), length_10_id); +$eq$tilde$11(Belt_List.drop(length_10_id, 0), length_10_id); -eq("DROP", Belt_List.drop(length_8_id, -1), undefined); +$eq$tilde$11(Belt_List.drop(length_8_id, -1), undefined); + +function $eq$tilde$12(extra, extra$1) { + return eq("SPLIT", extra, extra$1); +} let a = Belt_List.makeBy(5, id); -eq("SPLIT", Belt_List.splitAt(/* [] */0, 1), undefined); +$eq$tilde$12(Belt_List.splitAt(/* [] */0, 1), undefined); -eq("SPLIT", Belt_List.splitAt(a, 6), undefined); +$eq$tilde$12(Belt_List.splitAt(a, 6), undefined); -eq("SPLIT", Belt_List.splitAt(a, 5), [ +$eq$tilde$12(Belt_List.splitAt(a, 5), [ a, /* [] */0 ]); -eq("SPLIT", Belt_List.splitAt(a, 4), [ +$eq$tilde$12(Belt_List.splitAt(a, 4), [ { hd: 0, tl: { @@ -924,7 +980,7 @@ eq("SPLIT", Belt_List.splitAt(a, 4), [ } ]); -eq("SPLIT", Belt_List.splitAt(a, 3), [ +$eq$tilde$12(Belt_List.splitAt(a, 3), [ { hd: 0, tl: { @@ -944,7 +1000,7 @@ eq("SPLIT", Belt_List.splitAt(a, 3), [ } ]); -eq("SPLIT", Belt_List.splitAt(a, 2), [ +$eq$tilde$12(Belt_List.splitAt(a, 2), [ { hd: 0, tl: { @@ -964,7 +1020,7 @@ eq("SPLIT", Belt_List.splitAt(a, 2), [ } ]); -eq("SPLIT", Belt_List.splitAt(a, 1), [ +$eq$tilde$12(Belt_List.splitAt(a, 1), [ { hd: 0, tl: /* [] */0 @@ -984,17 +1040,21 @@ eq("SPLIT", Belt_List.splitAt(a, 1), [ } ]); -eq("SPLIT", Belt_List.splitAt(a, 0), [ +$eq$tilde$12(Belt_List.splitAt(a, 0), [ /* [] */0, a ]); -eq("SPLIT", Belt_List.splitAt(a, -1), undefined); +$eq$tilde$12(Belt_List.splitAt(a, -1), undefined); function succx(x) { return x + 1 | 0; } +function $eq$tilde$13(extra, extra$1) { + return eq("REMOVEASSOQ", extra, extra$1); +} + function eqx(x, y) { return x === y; } @@ -1065,7 +1125,7 @@ b("File \"bs_list_test.res\", line 207, characters 4-11", Belt_List.hasAssoc({ return (x + 1 | 0) === y; }))); -eq("REMOVEASSOQ", Belt_List.removeAssoc({ +$eq$tilde$13(Belt_List.removeAssoc({ hd: [ 1, "1" @@ -1099,7 +1159,7 @@ eq("REMOVEASSOQ", Belt_List.removeAssoc({ } }); -eq("REMOVEASSOQ", Belt_List.removeAssoc({ +$eq$tilde$13(Belt_List.removeAssoc({ hd: [ 1, "1" @@ -1133,7 +1193,7 @@ eq("REMOVEASSOQ", Belt_List.removeAssoc({ } }); -eq("REMOVEASSOQ", Belt_List.removeAssoc({ +$eq$tilde$13(Belt_List.removeAssoc({ hd: [ 1, "1" @@ -1167,7 +1227,7 @@ eq("REMOVEASSOQ", Belt_List.removeAssoc({ } }); -eq("REMOVEASSOQ", Belt_List.removeAssoc({ +$eq$tilde$13(Belt_List.removeAssoc({ hd: [ 1, "1" @@ -1207,7 +1267,7 @@ eq("REMOVEASSOQ", Belt_List.removeAssoc({ } }); -eq("REMOVEASSOQ", Belt_List.removeAssoc({ +$eq$tilde$13(Belt_List.removeAssoc({ hd: [ 1, "1" @@ -1239,7 +1299,7 @@ eq("REMOVEASSOQ", Belt_List.removeAssoc({ } }); -eq("REMOVEASSOQ", Belt_List.removeAssoc({ +$eq$tilde$13(Belt_List.removeAssoc({ hd: [ 1, "1" @@ -1271,7 +1331,7 @@ eq("REMOVEASSOQ", Belt_List.removeAssoc({ } }); -eq("REMOVEASSOQ", Belt_List.removeAssoc({ +$eq$tilde$13(Belt_List.removeAssoc({ hd: [ 1, "1" @@ -1303,7 +1363,7 @@ eq("REMOVEASSOQ", Belt_List.removeAssoc({ } }); -eq("REMOVEASSOQ", Belt_List.removeAssoc(/* [] */0, 2, eqx), /* [] */0); +$eq$tilde$13(Belt_List.removeAssoc(/* [] */0, 2, eqx), /* [] */0); let ll = { hd: [ @@ -1551,15 +1611,15 @@ eq("File \"bs_list_test.res\", line 248, characters 4-11", [ eq("File \"bs_list_test.res\", line 255, characters 5-12", Belt_List.head(/* [] */0), undefined); -$$throw("File \"bs_list_test.res\", line 256, characters 8-15", (function (param) { +$$throw("File \"bs_list_test.res\", line 256, characters 8-15", (function () { Belt_List.headExn(/* [] */0); })); -$$throw("File \"bs_list_test.res\", line 257, characters 8-15", (function (param) { +$$throw("File \"bs_list_test.res\", line 257, characters 8-15", (function () { Belt_List.tailExn(/* [] */0); })); -$$throw("File \"bs_list_test.res\", line 258, characters 8-15", (function (param) { +$$throw("File \"bs_list_test.res\", line 258, characters 8-15", (function () { Belt_List.getExn({ hd: 0, tl: { @@ -1569,7 +1629,7 @@ $$throw("File \"bs_list_test.res\", line 258, characters 8-15", (function (param }, -1); })); -$$throw("File \"bs_list_test.res\", line 259, characters 8-15", (function (param) { +$$throw("File \"bs_list_test.res\", line 259, characters 8-15", (function () { Belt_List.getExn({ hd: 0, tl: { @@ -2294,11 +2354,15 @@ makeTest(2); makeTest(3); +function $eq$tilde$14(extra, extra$1) { + return eq("SORT", extra, extra$1); +} + function cmp(a, b) { return a - b | 0; } -eq("SORT", Belt_List.sort({ +$eq$tilde$14(Belt_List.sort({ hd: 5, tl: { hd: 4, @@ -2324,7 +2388,7 @@ eq("SORT", Belt_List.sort({ } }); -eq("SORT", Belt_List.sort({ +$eq$tilde$14(Belt_List.sort({ hd: 3, tl: { hd: 9, diff --git a/jscomp/test/bs_map_set_dict_test.js b/jscomp/test/bs_map_set_dict_test.js index e881facfed..c3b367a6f5 100644 --- a/jscomp/test/bs_map_set_dict_test.js +++ b/jscomp/test/bs_map_set_dict_test.js @@ -65,7 +65,7 @@ let m2 = { data: undefined }; -let data; +let data = undefined; Belt_Map.getId(m2); @@ -75,13 +75,11 @@ for(let i = 0; i <= 100000; ++i){ data = Belt_MapDict.set(data, i, i, m_dict.cmp); } -let data$1 = data; - let newm_cmp = m_dict.cmp; let newm = { cmp: newm_cmp, - data: data$1 + data: data }; console.log(newm); @@ -94,30 +92,32 @@ let m_dict$1 = Belt_Map.getId(m); let cmp = m_dict$1.cmp; -let data$2; +let data$1 = undefined; for(let i$1 = 0; i$1 <= 100000; ++i$1){ - data$2 = Belt_SetDict.add(data$2, i$1, cmp); + data$1 = Belt_SetDict.add(data$1, i$1, cmp); } -console.log(data$2); +console.log(data$1); -function f(param) { - return Belt_Map.fromArray(param, Icmp); +function f(none) { + return Belt_Map.fromArray(none, Icmp); } function $eq$tilde(a, b) { - return function (param) { - return Belt_Map.eq(a, b, param); + return function (extra) { + return Belt_Map.eq(a, b, extra); }; } -let u0 = f(Belt_Array.map(Array_data_util.randomRange(0, 39), (function (x) { +let none = Belt_Array.map(Array_data_util.randomRange(0, 39), (function (x) { return [ x, x ]; -}))); +})); + +let u0 = Belt_Map.fromArray(none, Icmp); let u1 = Belt_Map.set(u0, 39, 120); @@ -151,12 +151,14 @@ eq("File \"bs_map_set_dict_test.res\", line 84, characters 5-12", Belt_Map.get(u eq("File \"bs_map_set_dict_test.res\", line 85, characters 5-12", Belt_Map.get(u1, 39), 120); -let u = f(Belt_Array.makeByAndShuffle(10000, (function (x) { +let none$1 = Belt_Array.makeByAndShuffle(10000, (function (x) { return [ x, x ]; -}))); +})); + +let u = Belt_Map.fromArray(none$1, Icmp); eq("File \"bs_map_set_dict_test.res\", line 90, characters 5-12", Belt_Array.makeBy(10000, (function (x) { return [ diff --git a/jscomp/test/bs_map_test.js b/jscomp/test/bs_map_test.js index 84523270b4..dd79a0faba 100644 --- a/jscomp/test/bs_map_test.js +++ b/jscomp/test/bs_map_test.js @@ -19,7 +19,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -36,7 +36,7 @@ function b(loc, v) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Ok", _0: v @@ -47,11 +47,15 @@ function b(loc, v) { }; } -let mapOfArray = Belt_MapInt.fromArray; +function mapOfArray(x) { + return Belt_MapInt.fromArray(x); +} -let setOfArray = Belt_SetInt.fromArray; +function setOfArray(x) { + return Belt_SetInt.fromArray(x); +} -function emptyMap(param) { +function emptyMap() { } diff --git a/jscomp/test/bs_min_max_test.js b/jscomp/test/bs_min_max_test.js index d32dc27d56..1a111e9a33 100644 --- a/jscomp/test/bs_min_max_test.js +++ b/jscomp/test/bs_min_max_test.js @@ -18,8 +18,8 @@ function eq(loc, x, y) { Mt.eq_suites(test_id, suites, loc, x, y); } -function b(param, param$1) { - return Mt.bool_suites(test_id, suites, param, param$1); +function b(extra, extra$1) { + return Mt.bool_suites(test_id, suites, extra, extra$1); } function f(x, y) { diff --git a/jscomp/test/bs_mutable_set_test.js b/jscomp/test/bs_mutable_set_test.js index 16d171bb1f..615216b6a4 100644 --- a/jscomp/test/bs_mutable_set_test.js +++ b/jscomp/test/bs_mutable_set_test.js @@ -55,7 +55,7 @@ for(let i = 0 ,i_finish = r.length; i < i_finish; ++i){ Belt_MutableSetInt.remove(u, r[i]); } -b("File \"bs_mutable_set_test.res\", line 33, characters 8-15", Belt_MutableSetInt.isEmpty(u)); +b("File \"bs_mutable_set_test.res\", line 33, characters 8-15", u.data === undefined); Belt_MutableSetInt.add(u, 0); @@ -67,13 +67,13 @@ Belt_MutableSetInt.add(u, 0); eq("File \"bs_mutable_set_test.res\", line 38, characters 9-16", Belt_internalAVLset.size(u.data), 3); -b("File \"bs_mutable_set_test.res\", line 39, characters 8-15", !Belt_MutableSetInt.isEmpty(u)); +b("File \"bs_mutable_set_test.res\", line 39, characters 8-15", u.data !== undefined); for(let i$1 = 0; i$1 <= 3; ++i$1){ Belt_MutableSetInt.remove(u, i$1); } -b("File \"bs_mutable_set_test.res\", line 43, characters 8-15", Belt_MutableSetInt.isEmpty(u)); +b("File \"bs_mutable_set_test.res\", line 43, characters 8-15", u.data === undefined); Belt_MutableSetInt.mergeMany(u, Array_data_util.randomRange(0, 20000)); @@ -101,11 +101,11 @@ Belt_MutableSetInt.removeMany(u, Array_data_util.randomRange(10000, 19999)); eq("File \"bs_mutable_set_test.res\", line 56, characters 9-16", Belt_internalAVLset.size(u.data), 1); -b("File \"bs_mutable_set_test.res\", line 57, characters 8-15", Belt_internalSetInt.has(u.data, 20000)); +b("File \"bs_mutable_set_test.res\", line 57, characters 8-15", Belt_MutableSetInt.has(u, 20000)); Belt_MutableSetInt.removeMany(u, Array_data_util.randomRange(10000, 30000)); -b("File \"bs_mutable_set_test.res\", line 59, characters 8-15", Belt_MutableSetInt.isEmpty(u)); +b("File \"bs_mutable_set_test.res\", line 59, characters 8-15", u.data === undefined); let xs$1 = Array_data_util.randomRange(1000, 2000); @@ -145,9 +145,11 @@ eq("File \"bs_mutable_set_test.res\", line 82, characters 9-16", indeedAded, 100 eq("File \"bs_mutable_set_test.res\", line 83, characters 9-16", Belt_internalAVLset.size(v.data), 1501); -b("File \"bs_mutable_set_test.res\", line 84, characters 8-15", Belt_MutableSetInt.isEmpty({ +let d = { data: undefined -})); +}; + +b("File \"bs_mutable_set_test.res\", line 84, characters 8-15", d.data === undefined); eq("File \"bs_mutable_set_test.res\", line 85, characters 9-16", Belt_internalAVLset.minimum(v.data), 500); @@ -171,9 +173,9 @@ eq("File \"bs_mutable_set_test.res\", line 91, characters 9-16", Belt_internalAV Belt_internalAVLset.checkInvariantInternal(v.data); -eq("File \"bs_mutable_set_test.res\", line 93, characters 9-16", Belt_internalSetInt.get(v.data, 3), undefined); +eq("File \"bs_mutable_set_test.res\", line 93, characters 9-16", Belt_MutableSetInt.get(v, 3), undefined); -eq("File \"bs_mutable_set_test.res\", line 94, characters 9-16", Belt_internalSetInt.get(v.data, 1200), 1200); +eq("File \"bs_mutable_set_test.res\", line 94, characters 9-16", Belt_MutableSetInt.get(v, 1200), 1200); let match = Belt_MutableSetInt.split(v, 1000); @@ -197,7 +199,9 @@ b("File \"bs_mutable_set_test.res\", line 99, characters 8-15", Belt_MutableSetI b("File \"bs_mutable_set_test.res\", line 100, characters 8-15", Belt_MutableSetInt.subset(bb, v)); -b("File \"bs_mutable_set_test.res\", line 101, characters 8-15", Belt_MutableSetInt.isEmpty(Belt_MutableSetInt.intersect(aa, bb))); +let d$1 = Belt_MutableSetInt.intersect(aa, bb); + +b("File \"bs_mutable_set_test.res\", line 101, characters 8-15", d$1.data === undefined); let c = Belt_MutableSetInt.removeCheck(v, 1000); @@ -225,7 +229,9 @@ b("File \"bs_mutable_set_test.res\", line 108, characters 8-15", Belt_MutableSet b("File \"bs_mutable_set_test.res\", line 109, characters 8-15", Belt_MutableSetInt.subset(bb$1, v)); -b("File \"bs_mutable_set_test.res\", line 110, characters 8-15", Belt_MutableSetInt.isEmpty(Belt_MutableSetInt.intersect(aa$1, bb$1))); +let d$2 = Belt_MutableSetInt.intersect(aa$1, bb$1); + +b("File \"bs_mutable_set_test.res\", line 110, characters 8-15", d$2.data === undefined); let xs$2 = Array_data_util.randomRange(0, 100); @@ -428,7 +434,7 @@ for(let i$2 = 0; i$2 <= 100000; ++i$2){ Belt_internalAVLset.checkInvariantInternal(v$1.data); b("File \"bs_mutable_set_test.res\", line 188, characters 10-17", Belt_Range.every(0, 100000, (function (i) { - return Belt_internalSetInt.has(v$1.data, i); + return Belt_MutableSetInt.has(v$1, i); }))); eq("File \"bs_mutable_set_test.res\", line 189, characters 5-12", Belt_internalAVLset.size(v$1.data), 100001); @@ -469,7 +475,7 @@ for(let i$4 = 0 ,i_finish$2 = vv.length; i$4 < i_finish$2; ++i$4){ eq("File \"bs_mutable_set_test.res\", line 216, characters 5-12", Belt_internalAVLset.size(v$3.data), 0); -b("File \"bs_mutable_set_test.res\", line 217, characters 4-11", Belt_MutableSetInt.isEmpty(v$3)); +b("File \"bs_mutable_set_test.res\", line 217, characters 4-11", v$3.data === undefined); let xs$25 = Belt_Array.makeBy(30, (function (i) { return i; @@ -652,11 +658,11 @@ let xs$30 = Belt_Array.map(Array_data_util.randomRange(0, 1000), (function (x) { return (x << 1); })); -let d = { +let d$3 = { data: Belt_internalSetInt.fromArray(xs$30) }; -let match$8 = Belt_MutableSetInt.split(d, 1001); +let match$8 = Belt_MutableSetInt.split(d$3, 1001); let match$9 = match$8[0]; diff --git a/jscomp/test/bs_poly_map_test.js b/jscomp/test/bs_poly_map_test.js index 700bc4a593..0865fa4cc5 100644 --- a/jscomp/test/bs_poly_map_test.js +++ b/jscomp/test/bs_poly_map_test.js @@ -37,7 +37,7 @@ function setOfArray(x) { return Belt_Set.fromArray(x, Icmp); } -function emptyMap(param) { +function emptyMap() { return { cmp: Icmp.cmp, data: undefined @@ -51,7 +51,8 @@ function mergeInter(s1, s2) { } })); - return Belt_Set.fromArray(Belt_MapDict.keysToArray(m.data), Icmp); + let x = Belt_MapDict.keysToArray(m.data); + return Belt_Set.fromArray(x, Icmp); } function mergeUnion(s1, s2) { @@ -61,7 +62,8 @@ function mergeUnion(s1, s2) { } })); - return Belt_Set.fromArray(Belt_MapDict.keysToArray(m.data), Icmp); + let x = Belt_MapDict.keysToArray(m.data); + return Belt_Set.fromArray(x, Icmp); } function mergeDiff(s1, s2) { @@ -71,7 +73,8 @@ function mergeDiff(s1, s2) { } })); - return Belt_Set.fromArray(Belt_MapDict.keysToArray(m.data), Icmp); + let x = Belt_MapDict.keysToArray(m.data); + return Belt_Set.fromArray(x, Icmp); } function randomRange(i, j) { @@ -83,19 +86,33 @@ function randomRange(i, j) { })); } -let u0 = Belt_Map.fromArray(randomRange(0, 100), Icmp); +let x = randomRange(0, 100); + +let u0 = Belt_Map.fromArray(x, Icmp); + +let x$1 = randomRange(30, 120); + +let u1 = Belt_Map.fromArray(x$1, Icmp); + +let x$2 = Array_data_util.range(30, 100); + +b("File \"bs_poly_map_test.res\", line 64, characters 4-11", Belt_Set.eq(mergeInter(u0, u1), Belt_Set.fromArray(x$2, Icmp))); -let u1 = Belt_Map.fromArray(randomRange(30, 120), Icmp); +let x$3 = Array_data_util.range(0, 120); -b("File \"bs_poly_map_test.res\", line 64, characters 4-11", Belt_Set.eq(mergeInter(u0, u1), Belt_Set.fromArray(Array_data_util.range(30, 100), Icmp))); +b("File \"bs_poly_map_test.res\", line 65, characters 4-11", Belt_Set.eq(mergeUnion(u0, u1), Belt_Set.fromArray(x$3, Icmp))); -b("File \"bs_poly_map_test.res\", line 65, characters 4-11", Belt_Set.eq(mergeUnion(u0, u1), Belt_Set.fromArray(Array_data_util.range(0, 120), Icmp))); +let x$4 = Array_data_util.range(0, 29); -b("File \"bs_poly_map_test.res\", line 66, characters 4-11", Belt_Set.eq(mergeDiff(u0, u1), Belt_Set.fromArray(Array_data_util.range(0, 29), Icmp))); +b("File \"bs_poly_map_test.res\", line 66, characters 4-11", Belt_Set.eq(mergeDiff(u0, u1), Belt_Set.fromArray(x$4, Icmp))); -b("File \"bs_poly_map_test.res\", line 67, characters 4-11", Belt_Set.eq(mergeDiff(u1, u0), Belt_Set.fromArray(Array_data_util.range(101, 120), Icmp))); +let x$5 = Array_data_util.range(101, 120); -let a0 = Belt_Map.fromArray(randomRange(0, 10), Icmp); +b("File \"bs_poly_map_test.res\", line 67, characters 4-11", Belt_Set.eq(mergeDiff(u1, u0), Belt_Set.fromArray(x$5, Icmp))); + +let x$6 = randomRange(0, 10); + +let a0 = Belt_Map.fromArray(x$6, Icmp); let a1 = Belt_Map.set(a0, 3, 33); @@ -159,7 +176,9 @@ let a8 = Belt_Map.removeMany(a7, Array_data_util.randomRange(0, 100)); b("File \"bs_poly_map_test.res\", line 101, characters 4-11", Belt_MapDict.isEmpty(a8.data)); -let u0$1 = Belt_Map.fromArray(randomRange(0, 100), Icmp); +let x$7 = randomRange(0, 100); + +let u0$1 = Belt_Map.fromArray(x$7, Icmp); let u1$1 = Belt_Map.set(u0$1, 3, 32); @@ -188,12 +207,14 @@ let m = { let m1 = acc(m, Belt_Array.concat(Array_data_util.randomRange(0, 20), Array_data_util.randomRange(10, 30))); -b("File \"bs_poly_map_test.res\", line 126, characters 4-11", Belt_Map.eq(m1, Belt_Map.fromArray(Belt_Array.makeBy(31, (function (i) { +let x$8 = Belt_Array.makeBy(31, (function (i) { return [ i, i >= 10 && i <= 20 ? 2 : 1 ]; -})), Icmp), (function (x, y) { +})); + +b("File \"bs_poly_map_test.res\", line 126, characters 4-11", Belt_Map.eq(m1, Belt_Map.fromArray(x$8, Icmp), (function (x, y) { return x === y; }))); @@ -211,12 +232,14 @@ let v1 = Belt_Map.mergeMany(v0, Belt_Array.map(Array_data_util.randomRange(0, 10 ]; }))); -let v2 = Belt_Map.fromArray(Belt_Array.map(Array_data_util.randomRange(0, 10000), (function (x) { +let x$9 = Belt_Array.map(Array_data_util.randomRange(0, 10000), (function (x) { return [ x, x ]; -})), Icmp); +})); + +let v2 = Belt_Map.fromArray(x$9, Icmp); b("File \"bs_poly_map_test.res\", line 150, characters 4-11", Belt_Map.eq(v1, v2, (function (x, y) { return x === y; diff --git a/jscomp/test/bs_poly_mutable_map_test.js b/jscomp/test/bs_poly_mutable_map_test.js index 9563788e47..3bbcd3dbfa 100644 --- a/jscomp/test/bs_poly_mutable_map_test.js +++ b/jscomp/test/bs_poly_mutable_map_test.js @@ -45,7 +45,9 @@ function randomRange(i, j) { })); } -let a0 = Belt_MutableMap.fromArray(randomRange(0, 10), Icmp); +let x = randomRange(0, 10); + +let a0 = Belt_MutableMap.fromArray(x, Icmp); Belt_MutableMap.set(a0, 3, 33); @@ -72,9 +74,11 @@ eq("File \"bs_poly_mutable_map_test.res\", line 29, characters 5-12", Belt_inter Belt_MutableMap.removeMany(a0, Array_data_util.randomRange(0, 100)); -b("File \"bs_poly_mutable_map_test.res\", line 31, characters 4-11", Belt_MutableMap.isEmpty(a0)); +b("File \"bs_poly_mutable_map_test.res\", line 31, characters 4-11", a0.data === undefined); + +let x$1 = randomRange(0, 10000); -let a0$1 = Belt_MutableMap.fromArray(randomRange(0, 10000), Icmp); +let a0$1 = Belt_MutableMap.fromArray(x$1, Icmp); Belt_MutableMap.set(a0$1, 2000, 33); diff --git a/jscomp/test/bs_poly_mutable_set_test.js b/jscomp/test/bs_poly_mutable_set_test.js index 191ff290e4..676ec6ca82 100644 --- a/jscomp/test/bs_poly_mutable_set_test.js +++ b/jscomp/test/bs_poly_mutable_set_test.js @@ -28,18 +28,20 @@ function b(loc, x) { let IntCmp = Belt_Id.comparable(Caml.int_compare); -function fromArray(param) { - return Belt_MutableSet.fromArray(param, IntCmp); +function fromArray(none) { + return Belt_MutableSet.fromArray(none, IntCmp); } -function empty(param) { +function empty() { return { cmp: IntCmp.cmp, data: undefined }; } -let u = fromArray(Array_data_util.range(0, 30)); +let none = Array_data_util.range(0, 30); + +let u = Belt_MutableSet.fromArray(none, IntCmp); b("File \"bs_poly_mutable_set_test.res\", line 16, characters 4-11", Belt_MutableSet.removeCheck(u, 0)); @@ -63,7 +65,7 @@ for(let i = 0 ,i_finish = r.length; i < i_finish; ++i){ Belt_MutableSet.remove(u, r[i]); } -b("File \"bs_poly_mutable_set_test.res\", line 28, characters 4-11", Belt_MutableSet.isEmpty(u)); +b("File \"bs_poly_mutable_set_test.res\", line 28, characters 4-11", u.data === undefined); Belt_MutableSet.add(u, 0); @@ -75,13 +77,13 @@ Belt_MutableSet.add(u, 0); eq("File \"bs_poly_mutable_set_test.res\", line 33, characters 5-12", Belt_internalAVLset.size(u.data), 3); -b("File \"bs_poly_mutable_set_test.res\", line 34, characters 4-11", !Belt_MutableSet.isEmpty(u)); +b("File \"bs_poly_mutable_set_test.res\", line 34, characters 4-11", u.data !== undefined); for(let i$1 = 0; i$1 <= 3; ++i$1){ Belt_MutableSet.remove(u, i$1); } -b("File \"bs_poly_mutable_set_test.res\", line 38, characters 4-11", Belt_MutableSet.isEmpty(u)); +b("File \"bs_poly_mutable_set_test.res\", line 38, characters 4-11", u.data === undefined); Belt_MutableSet.mergeMany(u, Array_data_util.randomRange(0, 20000)); @@ -113,9 +115,11 @@ b("File \"bs_poly_mutable_set_test.res\", line 52, characters 4-11", Belt_Mutabl Belt_MutableSet.removeMany(u, Array_data_util.randomRange(10000, 30000)); -b("File \"bs_poly_mutable_set_test.res\", line 54, characters 4-11", Belt_MutableSet.isEmpty(u)); +b("File \"bs_poly_mutable_set_test.res\", line 54, characters 4-11", u.data === undefined); + +let none$1 = Array_data_util.randomRange(1000, 2000); -let v = fromArray(Array_data_util.randomRange(1000, 2000)); +let v = Belt_MutableSet.fromArray(none$1, IntCmp); let bs = Belt_Array.map(Array_data_util.randomRange(500, 1499), (function (x) { return Belt_MutableSet.removeCheck(v, x); @@ -149,10 +153,12 @@ eq("File \"bs_poly_mutable_set_test.res\", line 77, characters 5-12", indeedAded eq("File \"bs_poly_mutable_set_test.res\", line 78, characters 5-12", Belt_internalAVLset.size(v.data), 1501); -b("File \"bs_poly_mutable_set_test.res\", line 79, characters 4-11", Belt_MutableSet.isEmpty({ +let d = { cmp: IntCmp.cmp, data: undefined -})); +}; + +b("File \"bs_poly_mutable_set_test.res\", line 79, characters 4-11", d.data === undefined); eq("File \"bs_poly_mutable_set_test.res\", line 80, characters 5-12", Belt_internalAVLset.minimum(v.data), 500); @@ -202,7 +208,9 @@ b("File \"bs_poly_mutable_set_test.res\", line 94, characters 4-11", Belt_Mutabl b("File \"bs_poly_mutable_set_test.res\", line 95, characters 4-11", Belt_MutableSet.subset(bb, v)); -b("File \"bs_poly_mutable_set_test.res\", line 96, characters 4-11", Belt_MutableSet.isEmpty(Belt_MutableSet.intersect(aa, bb))); +let d$1 = Belt_MutableSet.intersect(aa, bb); + +b("File \"bs_poly_mutable_set_test.res\", line 96, characters 4-11", d$1.data === undefined); let c = Belt_MutableSet.removeCheck(v, 1000); @@ -230,62 +238,110 @@ b("File \"bs_poly_mutable_set_test.res\", line 103, characters 4-11", Belt_Mutab b("File \"bs_poly_mutable_set_test.res\", line 104, characters 4-11", Belt_MutableSet.subset(bb$1, v)); -b("File \"bs_poly_mutable_set_test.res\", line 105, characters 4-11", Belt_MutableSet.isEmpty(Belt_MutableSet.intersect(aa$1, bb$1))); +let d$2 = Belt_MutableSet.intersect(aa$1, bb$1); + +b("File \"bs_poly_mutable_set_test.res\", line 105, characters 4-11", d$2.data === undefined); + +let none$2 = Array_data_util.randomRange(0, 100); -let aa$2 = fromArray(Array_data_util.randomRange(0, 100)); +let aa$2 = Belt_MutableSet.fromArray(none$2, IntCmp); -let bb$2 = fromArray(Array_data_util.randomRange(40, 120)); +let none$3 = Array_data_util.randomRange(40, 120); + +let bb$2 = Belt_MutableSet.fromArray(none$3, IntCmp); let cc = Belt_MutableSet.union(aa$2, bb$2); -b("File \"bs_poly_mutable_set_test.res\", line 115, characters 4-11", Belt_MutableSet.eq(cc, fromArray(Array_data_util.randomRange(0, 120)))); +let none$4 = Array_data_util.randomRange(0, 120); + +b("File \"bs_poly_mutable_set_test.res\", line 115, characters 4-11", Belt_MutableSet.eq(cc, Belt_MutableSet.fromArray(none$4, IntCmp))); + +let none$5 = Array_data_util.randomRange(0, 20); + +let none$6 = Array_data_util.randomRange(21, 40); -b("File \"bs_poly_mutable_set_test.res\", line 118, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.union(fromArray(Array_data_util.randomRange(0, 20)), fromArray(Array_data_util.randomRange(21, 40))), fromArray(Array_data_util.randomRange(0, 40)))); +let none$7 = Array_data_util.randomRange(0, 40); + +b("File \"bs_poly_mutable_set_test.res\", line 118, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.union(Belt_MutableSet.fromArray(none$5, IntCmp), Belt_MutableSet.fromArray(none$6, IntCmp)), Belt_MutableSet.fromArray(none$7, IntCmp))); let dd = Belt_MutableSet.intersect(aa$2, bb$2); -b("File \"bs_poly_mutable_set_test.res\", line 122, characters 4-11", Belt_MutableSet.eq(dd, fromArray(Array_data_util.randomRange(40, 100)))); +let none$8 = Array_data_util.randomRange(40, 100); + +b("File \"bs_poly_mutable_set_test.res\", line 122, characters 4-11", Belt_MutableSet.eq(dd, Belt_MutableSet.fromArray(none$8, IntCmp))); + +let none$9 = Array_data_util.randomRange(0, 20); -b("File \"bs_poly_mutable_set_test.res\", line 124, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.intersect(fromArray(Array_data_util.randomRange(0, 20)), fromArray(Array_data_util.randomRange(21, 40))), { +let none$10 = Array_data_util.randomRange(21, 40); + +b("File \"bs_poly_mutable_set_test.res\", line 124, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.intersect(Belt_MutableSet.fromArray(none$9, IntCmp), Belt_MutableSet.fromArray(none$10, IntCmp)), { cmp: IntCmp.cmp, data: undefined })); -b("File \"bs_poly_mutable_set_test.res\", line 128, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.intersect(fromArray(Array_data_util.randomRange(21, 40)), fromArray(Array_data_util.randomRange(0, 20))), { +let none$11 = Array_data_util.randomRange(21, 40); + +let none$12 = Array_data_util.randomRange(0, 20); + +b("File \"bs_poly_mutable_set_test.res\", line 128, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.intersect(Belt_MutableSet.fromArray(none$11, IntCmp), Belt_MutableSet.fromArray(none$12, IntCmp)), { cmp: IntCmp.cmp, data: undefined })); -b("File \"bs_poly_mutable_set_test.res\", line 131, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.intersect(fromArray([ +b("File \"bs_poly_mutable_set_test.res\", line 131, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.intersect(Belt_MutableSet.fromArray([ 1, 3, 4, 5, 7, 9 -]), fromArray([ +], IntCmp), Belt_MutableSet.fromArray([ 2, 4, 5, 6, 8, 10 -])), fromArray([ +], IntCmp)), Belt_MutableSet.fromArray([ 4, 5 -]))); +], IntCmp))); + +let none$13 = Array_data_util.randomRange(0, 39); + +b("File \"bs_poly_mutable_set_test.res\", line 132, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.diff(aa$2, bb$2), Belt_MutableSet.fromArray(none$13, IntCmp))); + +let none$14 = Array_data_util.randomRange(101, 120); + +b("File \"bs_poly_mutable_set_test.res\", line 133, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.diff(bb$2, aa$2), Belt_MutableSet.fromArray(none$14, IntCmp))); + +let none$15 = Array_data_util.randomRange(21, 40); + +let none$16 = Array_data_util.randomRange(0, 20); + +let none$17 = Array_data_util.randomRange(21, 40); + +b("File \"bs_poly_mutable_set_test.res\", line 135, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.diff(Belt_MutableSet.fromArray(none$15, IntCmp), Belt_MutableSet.fromArray(none$16, IntCmp)), Belt_MutableSet.fromArray(none$17, IntCmp))); + +let none$18 = Array_data_util.randomRange(0, 20); + +let none$19 = Array_data_util.randomRange(21, 40); + +let none$20 = Array_data_util.randomRange(0, 20); + +b("File \"bs_poly_mutable_set_test.res\", line 142, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.diff(Belt_MutableSet.fromArray(none$18, IntCmp), Belt_MutableSet.fromArray(none$19, IntCmp)), Belt_MutableSet.fromArray(none$20, IntCmp))); -b("File \"bs_poly_mutable_set_test.res\", line 132, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.diff(aa$2, bb$2), fromArray(Array_data_util.randomRange(0, 39)))); +let none$21 = Array_data_util.randomRange(0, 20); -b("File \"bs_poly_mutable_set_test.res\", line 133, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.diff(bb$2, aa$2), fromArray(Array_data_util.randomRange(101, 120)))); +let none$22 = Array_data_util.randomRange(0, 40); -b("File \"bs_poly_mutable_set_test.res\", line 135, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.diff(fromArray(Array_data_util.randomRange(21, 40)), fromArray(Array_data_util.randomRange(0, 20))), fromArray(Array_data_util.randomRange(21, 40)))); +let none$23 = Array_data_util.randomRange(0, -1); -b("File \"bs_poly_mutable_set_test.res\", line 142, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.diff(fromArray(Array_data_util.randomRange(0, 20)), fromArray(Array_data_util.randomRange(21, 40))), fromArray(Array_data_util.randomRange(0, 20)))); +b("File \"bs_poly_mutable_set_test.res\", line 150, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.diff(Belt_MutableSet.fromArray(none$21, IntCmp), Belt_MutableSet.fromArray(none$22, IntCmp)), Belt_MutableSet.fromArray(none$23, IntCmp))); -b("File \"bs_poly_mutable_set_test.res\", line 150, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.diff(fromArray(Array_data_util.randomRange(0, 20)), fromArray(Array_data_util.randomRange(0, 40))), fromArray(Array_data_util.randomRange(0, -1)))); +let none$24 = Array_data_util.randomRange(0, 1000); -let a0 = fromArray(Array_data_util.randomRange(0, 1000)); +let a0 = Belt_MutableSet.fromArray(none$24, IntCmp); let a1 = Belt_MutableSet.keep(a0, (function (x) { return x % 2 === 0; diff --git a/jscomp/test/bs_poly_set_test.js b/jscomp/test/bs_poly_set_test.js index ce833839b9..0d1949548e 100644 --- a/jscomp/test/bs_poly_set_test.js +++ b/jscomp/test/bs_poly_set_test.js @@ -301,11 +301,11 @@ eq("File \"bs_poly_set_test.res\", line 129, characters 5-12", Belt_Set.getExn(a eq("File \"bs_poly_set_test.res\", line 130, characters 5-12", Belt_Set.getExn(a0, 4), 4); -t("File \"bs_poly_set_test.res\", line 131, characters 4-11", (function (param) { +t("File \"bs_poly_set_test.res\", line 131, characters 4-11", (function () { Belt_Set.getExn(a0, 1002); })); -t("File \"bs_poly_set_test.res\", line 132, characters 4-11", (function (param) { +t("File \"bs_poly_set_test.res\", line 132, characters 4-11", (function () { Belt_Set.getExn(a0, -1); })); diff --git a/jscomp/test/bs_qualified.js b/jscomp/test/bs_qualified.js index 28491a3ee5..96ae426c27 100644 --- a/jscomp/test/bs_qualified.js +++ b/jscomp/test/bs_qualified.js @@ -11,7 +11,7 @@ function f(a, b, c) { return process.env; } -function f2(param) { +function f2() { return [ Z.a0.a1.a2.hi, a0.a1.a2.ho, diff --git a/jscomp/test/bs_queue_test.js b/jscomp/test/bs_queue_test.js index 2d9e79e69a..432d8a9bdb 100644 --- a/jscomp/test/bs_queue_test.js +++ b/jscomp/test/bs_queue_test.js @@ -2,7 +2,6 @@ 'use strict'; let Mt = require("./mt.js"); -let Curry = require("../../lib/js/curry.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); let Belt_Array = require("../../lib/js/belt_Array.js"); let Belt_MutableQueue = require("../../lib/js/belt_MutableQueue.js"); @@ -25,7 +24,7 @@ function b(loc, x) { function does_raise(f, q) { try { - Curry._1(f, q); + f(q); return false; } catch (exn){ @@ -57,7 +56,7 @@ if (!(Caml_obj.equal(Belt_MutableQueue.toArray(q), []) && q.length === 0)) { }); } -if (!(Caml_obj.equal(Belt_MutableQueue.toArray((Belt_MutableQueue.add(q, 1), q)), [1]) && q.length === 1)) { +if (!(Caml_obj.equal(Belt_MutableQueue.toArray($plus$plus(q, 1)), [1]) && q.length === 1)) { throw new Error("Assert_failure", { cause: { RE_EXN_ID: "Assert_failure", @@ -70,7 +69,7 @@ if (!(Caml_obj.equal(Belt_MutableQueue.toArray((Belt_MutableQueue.add(q, 1), q)) }); } -if (!(Caml_obj.equal(Belt_MutableQueue.toArray((Belt_MutableQueue.add(q, 2), q)), [ +if (!(Caml_obj.equal(Belt_MutableQueue.toArray($plus$plus(q, 2)), [ 1, 2 ]) && q.length === 2)) { @@ -86,7 +85,7 @@ if (!(Caml_obj.equal(Belt_MutableQueue.toArray((Belt_MutableQueue.add(q, 2), q)) }); } -if (!(Caml_obj.equal(Belt_MutableQueue.toArray((Belt_MutableQueue.add(q, 3), q)), [ +if (!(Caml_obj.equal(Belt_MutableQueue.toArray($plus$plus(q, 3)), [ 1, 2, 3 @@ -103,7 +102,7 @@ if (!(Caml_obj.equal(Belt_MutableQueue.toArray((Belt_MutableQueue.add(q, 3), q)) }); } -if (!(Caml_obj.equal(Belt_MutableQueue.toArray((Belt_MutableQueue.add(q, 4), q)), [ +if (!(Caml_obj.equal(Belt_MutableQueue.toArray($plus$plus(q, 4)), [ 1, 2, 3, @@ -251,7 +250,7 @@ let q$1 = { last: undefined }; -if (Belt_MutableQueue.popExn((Belt_MutableQueue.add(q$1, 1), q$1)) !== 1) { +if (Belt_MutableQueue.popExn($plus$plus(q$1, 1)) !== 1) { throw new Error("Assert_failure", { cause: { RE_EXN_ID: "Assert_failure", @@ -277,7 +276,7 @@ if (!does_raise(Belt_MutableQueue.popExn, q$1)) { }); } -if (Belt_MutableQueue.popExn((Belt_MutableQueue.add(q$1, 2), q$1)) !== 2) { +if (Belt_MutableQueue.popExn($plus$plus(q$1, 2)) !== 2) { throw new Error("Assert_failure", { cause: { RE_EXN_ID: "Assert_failure", @@ -322,7 +321,7 @@ let q$2 = { last: undefined }; -if (Belt_MutableQueue.peekExn((Belt_MutableQueue.add(q$2, 1), q$2)) !== 1) { +if (Belt_MutableQueue.peekExn($plus$plus(q$2, 1)) !== 1) { throw new Error("Assert_failure", { cause: { RE_EXN_ID: "Assert_failure", @@ -335,7 +334,7 @@ if (Belt_MutableQueue.peekExn((Belt_MutableQueue.add(q$2, 1), q$2)) !== 1) { }); } -if (Belt_MutableQueue.peekExn((Belt_MutableQueue.add(q$2, 2), q$2)) !== 1) { +if (Belt_MutableQueue.peekExn($plus$plus(q$2, 2)) !== 1) { throw new Error("Assert_failure", { cause: { RE_EXN_ID: "Assert_failure", @@ -348,7 +347,7 @@ if (Belt_MutableQueue.peekExn((Belt_MutableQueue.add(q$2, 2), q$2)) !== 1) { }); } -if (Belt_MutableQueue.peekExn((Belt_MutableQueue.add(q$2, 3), q$2)) !== 1) { +if (Belt_MutableQueue.peekExn($plus$plus(q$2, 3)) !== 1) { throw new Error("Assert_failure", { cause: { RE_EXN_ID: "Assert_failure", @@ -1372,4 +1371,4 @@ exports.b = b; exports.Q = Q; exports.does_raise = does_raise; exports.$plus$plus = $plus$plus; -/* Not a pure module */ +/* q Not a pure module */ diff --git a/jscomp/test/bs_rbset_int_bench.js b/jscomp/test/bs_rbset_int_bench.js index 3250da4a9a..c53e48d22a 100644 --- a/jscomp/test/bs_rbset_int_bench.js +++ b/jscomp/test/bs_rbset_int_bench.js @@ -3,7 +3,7 @@ let Rbset = require("./rbset.js"); -function bench(param) { +function bench() { let data = "Empty"; console.time("bs_rbset_int_bench.res 6"); for(let i = 0; i <= 1000000; ++i){ diff --git a/jscomp/test/bs_set_bench.js b/jscomp/test/bs_set_bench.js index 1500275233..2b006a4d68 100644 --- a/jscomp/test/bs_set_bench.js +++ b/jscomp/test/bs_set_bench.js @@ -3,7 +3,7 @@ let Belt_SetInt = require("../../lib/js/belt_SetInt.js"); -function bench(param) { +function bench() { let data; console.time("bs_set_bench.res 6"); for(let i = 0; i <= 1000000; ++i){ diff --git a/jscomp/test/bs_set_int_test.js b/jscomp/test/bs_set_int_test.js index 80039fd7d5..83bfef16e5 100644 --- a/jscomp/test/bs_set_int_test.js +++ b/jscomp/test/bs_set_int_test.js @@ -52,7 +52,7 @@ let u = Belt_SetInt.intersect(Belt_SetInt.fromArray([ 5 ])); -b("File \"bs_set_int_test.res\", line 27, characters 11-18", Belt_SetInt.eq(Belt_SetInt.fromArray([3]), u)); +b("File \"bs_set_int_test.res\", line 27, characters 11-18", $eq$tilde(u, [3])); function range(i, j) { return $$Array.init((j - i | 0) + 1 | 0, (function (k) { @@ -68,9 +68,7 @@ function revRange(i, j) { let v = Belt_SetInt.fromArray($$Array.append(range(100, 1000), revRange(400, 1500))); -let i = range(100, 1500); - -b("File \"bs_set_int_test.res\", line 37, characters 4-11", Belt_SetInt.eq(Belt_SetInt.fromArray(i), v)); +b("File \"bs_set_int_test.res\", line 37, characters 4-11", $eq$tilde(v, range(100, 1500))); let match = Belt_SetInt.partition(v, (function (x) { return x % 3 === 0; @@ -80,11 +78,11 @@ let l; let r; -for(let i$1 = 100; i$1 <= 1500; ++i$1){ - if (i$1 % 3 === 0) { - l = Belt_SetInt.add(l, i$1); +for(let i = 100; i <= 1500; ++i){ + if (i % 3 === 0) { + l = Belt_SetInt.add(l, i); } else { - r = Belt_SetInt.add(r, i$1); + r = Belt_SetInt.add(r, i); } } @@ -96,41 +94,17 @@ b("File \"bs_set_int_test.res\", line 50, characters 4-11", Belt_SetInt.eq(match b("File \"bs_set_int_test.res\", line 51, characters 4-11", Belt_SetInt.eq(match[1], nr)); -let i$2 = range(50, 100); - -let s = Belt_SetInt.intersect(Belt_SetInt.fromArray(range(1, 100)), Belt_SetInt.fromArray(range(50, 200))); - -b("File \"bs_set_int_test.res\", line 55, characters 2-9", Belt_SetInt.eq(Belt_SetInt.fromArray(i$2), s)); - -let i$3 = range(1, 200); - -let s$1 = Belt_SetInt.union(Belt_SetInt.fromArray(range(1, 100)), Belt_SetInt.fromArray(range(50, 200))); - -b("File \"bs_set_int_test.res\", line 66, characters 2-9", Belt_SetInt.eq(Belt_SetInt.fromArray(i$3), s$1)); - -let i$4 = range(1, 49); - -let s$2 = Belt_SetInt.diff(Belt_SetInt.fromArray(range(1, 100)), Belt_SetInt.fromArray(range(50, 200))); - -b("File \"bs_set_int_test.res\", line 77, characters 2-9", Belt_SetInt.eq(Belt_SetInt.fromArray(i$4), s$2)); - -let i$5 = revRange(50, 100); - -let s$3 = Belt_SetInt.intersect(Belt_SetInt.fromArray(revRange(1, 100)), Belt_SetInt.fromArray(revRange(50, 200))); - -b("File \"bs_set_int_test.res\", line 88, characters 2-9", Belt_SetInt.eq(Belt_SetInt.fromArray(i$5), s$3)); - -let i$6 = revRange(1, 200); +b("File \"bs_set_int_test.res\", line 55, characters 2-9", $eq$tilde(Belt_SetInt.intersect(Belt_SetInt.fromArray(range(1, 100)), Belt_SetInt.fromArray(range(50, 200))), range(50, 100))); -let s$4 = Belt_SetInt.union(Belt_SetInt.fromArray(revRange(1, 100)), Belt_SetInt.fromArray(revRange(50, 200))); +b("File \"bs_set_int_test.res\", line 66, characters 2-9", $eq$tilde(Belt_SetInt.union(Belt_SetInt.fromArray(range(1, 100)), Belt_SetInt.fromArray(range(50, 200))), range(1, 200))); -b("File \"bs_set_int_test.res\", line 99, characters 2-9", Belt_SetInt.eq(Belt_SetInt.fromArray(i$6), s$4)); +b("File \"bs_set_int_test.res\", line 77, characters 2-9", $eq$tilde(Belt_SetInt.diff(Belt_SetInt.fromArray(range(1, 100)), Belt_SetInt.fromArray(range(50, 200))), range(1, 49))); -let i$7 = revRange(1, 49); +b("File \"bs_set_int_test.res\", line 88, characters 2-9", $eq$tilde(Belt_SetInt.intersect(Belt_SetInt.fromArray(revRange(1, 100)), Belt_SetInt.fromArray(revRange(50, 200))), revRange(50, 100))); -let s$5 = Belt_SetInt.diff(Belt_SetInt.fromArray(revRange(1, 100)), Belt_SetInt.fromArray(revRange(50, 200))); +b("File \"bs_set_int_test.res\", line 99, characters 2-9", $eq$tilde(Belt_SetInt.union(Belt_SetInt.fromArray(revRange(1, 100)), Belt_SetInt.fromArray(revRange(50, 200))), revRange(1, 200))); -b("File \"bs_set_int_test.res\", line 110, characters 2-9", Belt_SetInt.eq(Belt_SetInt.fromArray(i$7), s$5)); +b("File \"bs_set_int_test.res\", line 110, characters 2-9", $eq$tilde(Belt_SetInt.diff(Belt_SetInt.fromArray(revRange(1, 100)), Belt_SetInt.fromArray(revRange(50, 200))), revRange(1, 49))); let ss = [ 1, diff --git a/jscomp/test/bs_splice_partial.js b/jscomp/test/bs_splice_partial.js index eaedc95430..aa01df223d 100644 --- a/jscomp/test/bs_splice_partial.js +++ b/jscomp/test/bs_splice_partial.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); function test(g) { g.xx(10, 3, "xxx", 1, 2, 3); @@ -27,8 +26,8 @@ function test_hi__2(x) { } function test_cb(x) { - Curry._1(x.cb("hI", 1, 2, 3), 3); - Curry._1(x.cb("hI", 1, 2, 3), 3); + x.cb("hI", 1, 2, 3)(3); + x.cb("hI", 1, 2, 3)(3); return x.cb2("hI", 1, 2, 3)(3); } @@ -36,7 +35,7 @@ function f(x) { v(x); } -function testUndefined(param) { +function testUndefined() { return say(1, 2, [undefined,undefined]); } diff --git a/jscomp/test/bs_string_test.js b/jscomp/test/bs_string_test.js index 9c14cda158..7570541190 100644 --- a/jscomp/test/bs_string_test.js +++ b/jscomp/test/bs_string_test.js @@ -16,7 +16,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/bs_unwrap_test.js b/jscomp/test/bs_unwrap_test.js index f49fc94cbf..25e7a582d8 100644 --- a/jscomp/test/bs_unwrap_test.js +++ b/jscomp/test/bs_unwrap_test.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let Caml_option = require("../../lib/js/caml_option.js"); console.log([ @@ -49,7 +48,9 @@ console.log(5, Caml_option.option_unwrap(some_arg)); console.log(6, undefined); -console.log(7, Caml_option.option_unwrap((console.log("trace"), undefined))); +console.log(7, Caml_option.option_unwrap((function () { + console.log("trace"); +})())); function dyn_log3(prim0, prim1, prim2) { console.log(prim0.VAL, Caml_option.option_unwrap(prim1)); @@ -86,10 +87,10 @@ function ff0(x, p) { } function ff1(x, p) { - console.log(Caml_option.option_unwrap(Curry._1(x, undefined)), p); + console.log(Caml_option.option_unwrap(x()), p); } -function test00(param) { +function test00() { return { a: 1, b: 2, diff --git a/jscomp/test/build.ninja b/jscomp/test/build.ninja index 9f14516071..0d3c2401e3 100644 --- a/jscomp/test/build.ninja +++ b/jscomp/test/build.ninja @@ -1,5 +1,5 @@ -bsc_flags = -bs-cross-module-opt -make-runtime-test -bs-package-output commonjs:jscomp/test -w -3-6-26-27-29-30-32..40-44-45-52-60-9-106+104 -warn-error A -I runtime -I $stdlib -I others -curried +bsc_flags = -bs-cross-module-opt -make-runtime-test -bs-package-output commonjs:jscomp/test -w -3-6-26-27-29-30-32..40-44-45-52-60-9-106+104 -warn-error A -I runtime -I $stdlib -I others -uncurried rule cc command = $bsc -bs-cmi -bs-cmj $bsc_flags -I test $in diff --git a/jscomp/test/bytes_split_gpr_743_test.js b/jscomp/test/bytes_split_gpr_743_test.js index 84742bac6c..476a31379c 100644 --- a/jscomp/test/bytes_split_gpr_743_test.js +++ b/jscomp/test/bytes_split_gpr_743_test.js @@ -20,7 +20,7 @@ function eq(loc, param) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/caml_compare_bigint_test.js b/jscomp/test/caml_compare_bigint_test.js index 1427f44a73..907e14a663 100644 --- a/jscomp/test/caml_compare_bigint_test.js +++ b/jscomp/test/caml_compare_bigint_test.js @@ -3,7 +3,7 @@ let Mt = require("./mt.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); -let Pervasives = require("../../lib/js/pervasives.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); function isLessThan(title, small, big) { return { @@ -423,7 +423,7 @@ function isEqual(title, num1, num2) { let five = BigInt("5"); -let suites = Pervasives.$at(isLessThan("123 and 555555", BigInt("123"), BigInt("555555")), Pervasives.$at(isEqual("98765 and 98765", BigInt("98765"), BigInt("98765")), isEqual("same instance", five, five))); +let suites = PervasivesU.$at(isLessThan("123 and 555555", BigInt("123"), BigInt("555555")), PervasivesU.$at(isEqual("98765 and 98765", BigInt("98765"), BigInt("98765")), isEqual("same instance", five, five))); Mt.from_pair_suites("caml_compare_bigint_test.res", suites); diff --git a/jscomp/test/caml_compare_test.js b/jscomp/test/caml_compare_test.js index 1b75ec4c72..1fe8a2fb37 100644 --- a/jscomp/test/caml_compare_test.js +++ b/jscomp/test/caml_compare_test.js @@ -23,7 +23,7 @@ let suites = { contents: { hd: [ "File \"caml_compare_test.res\", line 12, characters 5-12", - (function (param) { + (function () { return { TAG: "Eq", _0: true, @@ -34,7 +34,7 @@ let suites = { tl: { hd: [ "option2", - (function (param) { + (function () { return { TAG: "Eq", _0: true, @@ -45,7 +45,7 @@ let suites = { tl: { hd: [ "File \"caml_compare_test.res\", line 14, characters 5-12", - (function (param) { + (function () { return { TAG: "Eq", _0: true, @@ -59,7 +59,7 @@ let suites = { tl: { hd: [ "listeq", - (function (param) { + (function () { return { TAG: "Eq", _0: true, @@ -88,7 +88,7 @@ let suites = { tl: { hd: [ "listneq", - (function (param) { + (function () { return { TAG: "Eq", _0: true, @@ -117,7 +117,7 @@ let suites = { tl: { hd: [ "custom_u", - (function (param) { + (function () { return { TAG: "Eq", _0: true, @@ -156,7 +156,7 @@ let suites = { tl: { hd: [ "custom_u2", - (function (param) { + (function () { return { TAG: "Eq", _0: true, @@ -195,7 +195,7 @@ let suites = { tl: { hd: [ "function", - (function (param) { + (function () { return { TAG: "Eq", _0: true, @@ -206,7 +206,7 @@ let suites = { tl: { hd: [ "File \"caml_compare_test.res\", line 20, characters 5-12", - (function (param) { + (function () { return { TAG: "Eq", _0: true, @@ -217,7 +217,7 @@ let suites = { tl: { hd: [ "File \"caml_compare_test.res\", line 21, characters 5-12", - (function (param) { + (function () { return { TAG: "Eq", _0: true, @@ -231,7 +231,7 @@ let suites = { tl: { hd: [ "File \"caml_compare_test.res\", line 22, characters 5-12", - (function (param) { + (function () { return { TAG: "Eq", _0: true, @@ -245,7 +245,7 @@ let suites = { tl: { hd: [ "File \"caml_compare_test.res\", line 24, characters 6-13", - (function (param) { + (function () { return { TAG: "Eq", _0: true, @@ -313,7 +313,7 @@ let suites = { tl: { hd: [ "File \"caml_compare_test.res\", line 27, characters 5-12", - (function (param) { + (function () { return { TAG: "Eq", _0: true, @@ -333,7 +333,7 @@ let suites = { tl: { hd: [ "File \"caml_compare_test.res\", line 28, characters 5-12", - (function (param) { + (function () { return { TAG: "Eq", _0: true, @@ -347,7 +347,7 @@ let suites = { tl: { hd: [ "File \"caml_compare_test.res\", line 30, characters 6-13", - (function (param) { + (function () { return { TAG: "Eq", _0: true, @@ -415,7 +415,7 @@ let suites = { tl: { hd: [ "File \"caml_compare_test.res\", line 33, characters 5-12", - (function (param) { + (function () { return { TAG: "Eq", _0: false, @@ -426,7 +426,7 @@ let suites = { tl: { hd: [ "File \"caml_compare_test.res\", line 34, characters 5-12", - (function (param) { + (function () { return { TAG: "Eq", _0: false, @@ -437,7 +437,7 @@ let suites = { tl: { hd: [ "File \"caml_compare_test.res\", line 36, characters 6-13", - (function (param) { + (function () { return { TAG: "Eq", _0: false, @@ -505,7 +505,7 @@ let suites = { tl: { hd: [ "File \"caml_compare_test.res\", line 40, characters 6-13", - (function (param) { + (function () { return { TAG: "Eq", _0: false, @@ -573,7 +573,7 @@ let suites = { tl: { hd: [ "cmp_id", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.compare({ @@ -590,7 +590,7 @@ let suites = { tl: { hd: [ "cmp_val", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.compare({ @@ -605,7 +605,7 @@ let suites = { tl: { hd: [ "cmp_val2", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.compare({ @@ -620,7 +620,7 @@ let suites = { tl: { hd: [ "cmp_empty", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.compare({}, {}), @@ -631,7 +631,7 @@ let suites = { tl: { hd: [ "cmp_empty2", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.compare({}, {x:1}), @@ -642,7 +642,7 @@ let suites = { tl: { hd: [ "cmp_swap", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.compare({ @@ -659,7 +659,7 @@ let suites = { tl: { hd: [ "cmp_size", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.compare({x:1}, {x:1, y:2}), @@ -670,7 +670,7 @@ let suites = { tl: { hd: [ "cmp_size2", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.compare({x:1, y:2}, {x:1}), @@ -681,7 +681,7 @@ let suites = { tl: { hd: [ "cmp_order", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.compare({ @@ -698,7 +698,7 @@ let suites = { tl: { hd: [ "cmp_order2", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.compare({ @@ -715,7 +715,7 @@ let suites = { tl: { hd: [ "cmp_in_list", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.compare({ @@ -736,7 +736,7 @@ let suites = { tl: { hd: [ "cmp_in_list2", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.compare({ @@ -757,7 +757,7 @@ let suites = { tl: { hd: [ "cmp_with_list", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.compare({ @@ -778,7 +778,7 @@ let suites = { tl: { hd: [ "cmp_with_list2", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.compare({ @@ -799,7 +799,7 @@ let suites = { tl: { hd: [ "eq_id", - (function (param) { + (function () { return { TAG: "Ok", _0: Caml_obj.equal({ @@ -815,7 +815,7 @@ let suites = { tl: { hd: [ "eq_val", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.equal({ @@ -830,7 +830,7 @@ let suites = { tl: { hd: [ "eq_val2", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.equal({ @@ -845,7 +845,7 @@ let suites = { tl: { hd: [ "eq_empty", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.equal({}, {}), @@ -856,7 +856,7 @@ let suites = { tl: { hd: [ "eq_empty2", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.equal({}, {x:1}), @@ -867,7 +867,7 @@ let suites = { tl: { hd: [ "eq_swap", - (function (param) { + (function () { return { TAG: "Ok", _0: Caml_obj.equal({ @@ -883,7 +883,7 @@ let suites = { tl: { hd: [ "eq_size", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.equal({x:1}, {x:1, y:2}), @@ -894,7 +894,7 @@ let suites = { tl: { hd: [ "eq_size2", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.equal({x:1, y:2}, {x:1}), @@ -905,7 +905,7 @@ let suites = { tl: { hd: [ "eq_in_list", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.equal({ @@ -926,7 +926,7 @@ let suites = { tl: { hd: [ "eq_in_list2", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.equal({ @@ -947,7 +947,7 @@ let suites = { tl: { hd: [ "eq_with_list", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.equal({ @@ -968,7 +968,7 @@ let suites = { tl: { hd: [ "eq_with_list2", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.equal({ @@ -989,7 +989,7 @@ let suites = { tl: { hd: [ "eq_no_prototype", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.equal({x:1}, ((function(){let o = Object.create(null);o.x = 1;return o;})())), @@ -1000,7 +1000,7 @@ let suites = { tl: { hd: [ "File \"caml_compare_test.res\", line 76, characters 5-12", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.compare(null, { @@ -1014,7 +1014,7 @@ let suites = { tl: { hd: [ "File \"caml_compare_test.res\", line 77, characters 5-12", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.compare({ @@ -1028,7 +1028,7 @@ let suites = { tl: { hd: [ "File \"caml_compare_test.res\", line 78, characters 5-12", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.compare(null, 0), @@ -1039,7 +1039,7 @@ let suites = { tl: { hd: [ "File \"caml_compare_test.res\", line 79, characters 5-12", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.compare(0, null), @@ -1050,7 +1050,7 @@ let suites = { tl: { hd: [ "File \"caml_compare_test.res\", line 80, characters 5-12", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.compare(undefined, 0), @@ -1061,7 +1061,7 @@ let suites = { tl: { hd: [ "File \"caml_compare_test.res\", line 81, characters 5-12", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.compare(0, undefined), diff --git a/jscomp/test/caml_format_test.js b/jscomp/test/caml_format_test.js index 6030a74115..a7e67f6659 100644 --- a/jscomp/test/caml_format_test.js +++ b/jscomp/test/caml_format_test.js @@ -4,8 +4,8 @@ let Mt = require("./mt.js"); let $$Array = require("../../lib/js/array.js"); let Caml_int64 = require("../../lib/js/caml_int64.js"); -let Pervasives = require("../../lib/js/pervasives.js"); let Caml_format = require("../../lib/js/caml_format.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); let of_string = [ [ @@ -80,7 +80,7 @@ let of_string = [ function from_float_of_string(xs) { return $$Array.mapi((function (i, param) { - return Pervasives.string_of_float; + return PervasivesU.string_of_float; }), xs); } @@ -141,38 +141,38 @@ let pairs$1 = [ ] ]; -let suites = Pervasives.$at(from_of_string(of_string), Pervasives.$at({ +let suites = PervasivesU.$at(from_of_string(of_string), PervasivesU.$at({ hd: [ "isnan_of_string", - (function (param) { + (function () { return { TAG: "Eq", _0: true, - _1: Pervasives.classify_float(Caml_format.float_of_string("nan")) === "FP_nan" + _1: PervasivesU.classify_float(Caml_format.float_of_string("nan")) === "FP_nan" }; }) ], tl: /* [] */0 -}, Pervasives.$at($$Array.to_list($$Array.mapi((function (i, param) { +}, PervasivesU.$at($$Array.to_list($$Array.mapi((function (i, param) { let b = param[1]; let a = param[0]; return [ "infinity_of_string " + String(i), - (function (param) { + (function () { return { TAG: "Eq", _0: a, - _1: Pervasives.classify_float(Caml_format.float_of_string(b)) + _1: PervasivesU.classify_float(Caml_format.float_of_string(b)) }; }) ]; -}), pairs)), Pervasives.$at({ +}), pairs)), PervasivesU.$at({ hd: [ "throw", - (function (param) { + (function () { return { TAG: "ThrowAny", - _0: (function (param) { + _0: (function () { Caml_format.float_of_string(""); }) }; @@ -181,7 +181,7 @@ let suites = Pervasives.$at(from_of_string(of_string), Pervasives.$at({ tl: { hd: [ "format_int", - (function (param) { + (function () { return { TAG: "Eq", _0: " 33", @@ -196,7 +196,7 @@ let suites = Pervasives.$at(from_of_string(of_string), Pervasives.$at({ let a = param[0]; return [ "normal_float_of_string " + String(i), - (function (param) { + (function () { return { TAG: "Eq", _0: a, @@ -206,8 +206,8 @@ let suites = Pervasives.$at(from_of_string(of_string), Pervasives.$at({ ]; }), pairs$1)))))); -function ff(param) { - return Caml_format.format_int("%32d", param); +function ff(extra) { + return Caml_format.format_int("%32d", extra); } let float_data = [ @@ -223,12 +223,12 @@ let float_data = [ ], [ "%f", - Pervasives.infinity, + PervasivesU.infinity, "inf" ], [ "%f", - Pervasives.neg_infinity, + PervasivesU.neg_infinity, "-inf" ], [ @@ -423,13 +423,13 @@ let of_string_data = [ ] ]; -Mt.from_pair_suites("Caml_format_test", Pervasives.$at(suites, Pervasives.$at($$Array.to_list($$Array.mapi((function (i, param) { +let extra = PervasivesU.$at(suites, PervasivesU.$at($$Array.to_list($$Array.mapi((function (i, param) { let str_result = param[2]; let f = param[1]; let fmt = param[0]; return [ "loat_format " + String(i), - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_format.format_float(fmt, f), @@ -437,12 +437,12 @@ Mt.from_pair_suites("Caml_format_test", Pervasives.$at(suites, Pervasives.$at($$ }; }) ]; -}), float_data)), Pervasives.$at(int64_suites, $$Array.to_list($$Array.mapi((function (i, param) { +}), float_data)), PervasivesU.$at(int64_suites, $$Array.to_list($$Array.mapi((function (i, param) { let b = param[1]; let a = param[0]; return [ "int64_of_string " + String(i) + " ", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_format.int64_of_string(b), @@ -450,7 +450,9 @@ Mt.from_pair_suites("Caml_format_test", Pervasives.$at(suites, Pervasives.$at($$ }; }) ]; -}), of_string_data)))))); +}), of_string_data))))); + +Mt.from_pair_suites("Caml_format_test", extra); let float_suites = { hd: "float_nan", diff --git a/jscomp/test/chain_code_test.js b/jscomp/test/chain_code_test.js index 00d412fbe8..a290de375a 100644 --- a/jscomp/test/chain_code_test.js +++ b/jscomp/test/chain_code_test.js @@ -2,7 +2,6 @@ 'use strict'; let Mt = require("./mt.js"); -let Curry = require("../../lib/js/curry.js"); let suites = { contents: /* [] */0 @@ -17,7 +16,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -38,7 +37,7 @@ function f2(h) { } function f3(h, x, y) { - return Curry._2(Curry._2(h.paint, x, y).draw, x, y); + return h.paint(x, y).draw(x, y); } function f4(h, x, y) { diff --git a/jscomp/test/chn_test.js b/jscomp/test/chn_test.js index b8c937ecb5..06f028068e 100644 --- a/jscomp/test/chn_test.js +++ b/jscomp/test/chn_test.js @@ -18,7 +18,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/class_type_ffi_test.js b/jscomp/test/class_type_ffi_test.js index 8f7154c819..b38f435362 100644 --- a/jscomp/test/class_type_ffi_test.js +++ b/jscomp/test/class_type_ffi_test.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); function test_set(x) { x.length__aux = 3; @@ -16,39 +15,12 @@ function ff2(fn, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) { } function off2(o, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) { - return Curry.app(o.huge_method, [ - a0, - a1, - a2, - a3, - a4, - a5, - a6, - a7, - a8, - a9, - a10, - a11, - a12 - ]); + return o.huge_method(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); } -function mk_f(param) { +function mk_f() { return function (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) { - return Curry.app(a0, [ - a1, - a2, - a3, - a4, - a5, - a6, - a7, - a8, - a9, - a10, - a11, - a12 - ]); + return a0(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }; } diff --git a/jscomp/test/coercion_module_alias_test.js b/jscomp/test/coercion_module_alias_test.js index abdd32ce6f..42b9423056 100644 --- a/jscomp/test/coercion_module_alias_test.js +++ b/jscomp/test/coercion_module_alias_test.js @@ -3,7 +3,6 @@ let Char = require("../../lib/js/char.js"); let List = require("../../lib/js/list.js"); -let Curry = require("../../lib/js/curry.js"); function l(prim) { console.log(prim); @@ -25,7 +24,9 @@ let prim$2 = Char.chr(66); console.log(prim$2); -let f = List.length; +function f(x) { + return List.length(x); +} function g(x) { return List.length(List.map((function (prim) { @@ -153,7 +154,7 @@ let M9 = { C$p: C$p$1 }; -let prim$4 = Curry._1(Char.chr, 66); +let prim$4 = Char.chr(66); console.log(prim$4); @@ -161,7 +162,7 @@ let M10 = { C$p: Char }; -let prim$5 = Curry._1(M10.C$p.chr, 66); +let prim$5 = M10.C$p.chr(66); console.log(prim$5); diff --git a/jscomp/test/complex_if_test.js b/jscomp/test/complex_if_test.js index ac9d60a393..6fc7e2d7c5 100644 --- a/jscomp/test/complex_if_test.js +++ b/jscomp/test/complex_if_test.js @@ -127,7 +127,7 @@ let suites_0 = [ (function (param) { return { TAG: "Eq", - _0: Bytes.to_string(escaped(Bytes.of_string("\x00\x01\x02\x03\x04\x05\x06\x07\b\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"))), + _0: string_escaped("\x00\x01\x02\x03\x04\x05\x06\x07\b\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"), _1: "\\000\\001\\002\\003\\004\\005\\006\\007\\b\\t\\n\\011\\012\\r\\014\\015\\016\\017\\018\\019\\020\\021\\022\\023\\024\\025\\026\\027\\028\\029\\030\\031 !\\\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\\127\\128\\129\\130\\131\\132\\133\\134\\135\\136\\137\\138\\139\\140\\141\\142\\143\\144\\145\\146\\147\\148\\149\\150\\151\\152\\153\\154\\155\\156\\157\\158\\159\\160\\161\\162\\163\\164\\165\\166\\167\\168\\169\\170\\171\\172\\173\\174\\175\\176\\177\\178\\179\\180\\181\\182\\183\\184\\185\\186\\187\\188\\189\\190\\191\\192\\193\\194\\195\\196\\197\\198\\199\\200\\201\\202\\203\\204\\205\\206\\207\\208\\209\\210\\211\\212\\213\\214\\215\\216\\217\\218\\219\\220\\221\\222\\223\\224\\225\\226\\227\\228\\229\\230\\231\\232\\233\\234\\235\\236\\237\\238\\239\\240\\241\\242\\243\\244\\245\\246\\247\\248\\249\\250\\251\\252\\253\\254\\255" }; }) diff --git a/jscomp/test/complex_while_loop.js b/jscomp/test/complex_while_loop.js index d533daffeb..5120844c09 100644 --- a/jscomp/test/complex_while_loop.js +++ b/jscomp/test/complex_while_loop.js @@ -2,7 +2,7 @@ 'use strict'; -function f(param) { +function f() { let n = 0; while((function () { let fib = function (x) { @@ -19,7 +19,7 @@ function f(param) { }; } -function ff(param) { +function ff() { while((function () { let b = 9; return (3 + b | 0) > 10; diff --git a/jscomp/test/condition_compilation_test.js b/jscomp/test/condition_compilation_test.js index b4fcba6b4b..74f9d79ea3 100644 --- a/jscomp/test/condition_compilation_test.js +++ b/jscomp/test/condition_compilation_test.js @@ -24,7 +24,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/const_block_test.js b/jscomp/test/const_block_test.js index 0750029c96..e436304834 100644 --- a/jscomp/test/const_block_test.js +++ b/jscomp/test/const_block_test.js @@ -25,16 +25,16 @@ let c = [ 5 ]; -function f(param) { +function f() { Caml_array.set(a, 0, 3.0); Caml_array.set(b, 0, 3); } -function h(param) { +function h() { return c; } -function g(param) { +function g() { f(); return { TAG: "Eq", @@ -57,7 +57,7 @@ let suites_0 = [ let suites_1 = { hd: [ "avoid_mutable_inline_test", - (function (param) { + (function () { Caml_array.set(c, 0, 3); Caml_array.set(c, 1, 4); return { diff --git a/jscomp/test/const_defs_test.js b/jscomp/test/const_defs_test.js index 6f49155394..4c529ee379 100644 --- a/jscomp/test/const_defs_test.js +++ b/jscomp/test/const_defs_test.js @@ -4,7 +4,7 @@ let u = 3; -function f(param) { +function f() { throw new Error("Invalid_argument", { cause: { RE_EXN_ID: "Invalid_argument", diff --git a/jscomp/test/const_test.js b/jscomp/test/const_test.js index 3ea696e740..f0116628ce 100644 --- a/jscomp/test/const_test.js +++ b/jscomp/test/const_test.js @@ -36,7 +36,7 @@ function h(x) { } } -function hh(param) { +function hh() { return 3; } diff --git a/jscomp/test/cps_test.js b/jscomp/test/cps_test.js index f75abc2f22..8939bea0dd 100644 --- a/jscomp/test/cps_test.js +++ b/jscomp/test/cps_test.js @@ -3,10 +3,9 @@ let Mt = require("./mt.js"); let $$Array = require("../../lib/js/array.js"); -let Curry = require("../../lib/js/curry.js"); let Caml_array = require("../../lib/js/caml_array.js"); -function test(param) { +function test() { let v = { contents: 0 }; @@ -15,23 +14,23 @@ function test(param) { let acc = _acc; let n = _n; if (n === 0) { - return Curry._1(acc, undefined); + return acc(); } - _acc = (function (param) { + _acc = (function () { v.contents = v.contents + n | 0; - return Curry._1(acc, undefined); + return acc(); }); _n = n - 1 | 0; continue; }; }; - f(10, (function (param) { + f(10, (function () { })); return v.contents; } -function test_closure(param) { +function test_closure() { let v = { contents: 0 }; @@ -44,12 +43,12 @@ function test_closure(param) { })); } $$Array.iter((function (i) { - v.contents = v.contents + Curry._1(i, 0) | 0; + v.contents = v.contents + i(0) | 0; }), arr); return v.contents; } -function test_closure2(param) { +function test_closure2() { let v = { contents: 0 }; @@ -63,7 +62,7 @@ function test_closure2(param) { })); } $$Array.iter((function (i) { - v.contents = v.contents + Curry._1(i, 0) | 0; + v.contents = v.contents + i(0) | 0; }), arr); return v.contents; } @@ -71,7 +70,7 @@ function test_closure2(param) { Mt.from_pair_suites("Cps_test", { hd: [ "cps_test_sum", - (function (param) { + (function () { return { TAG: "Eq", _0: 55, @@ -82,7 +81,7 @@ Mt.from_pair_suites("Cps_test", { tl: { hd: [ "cps_test_closure", - (function (param) { + (function () { return { TAG: "Eq", _0: 15, @@ -93,7 +92,7 @@ Mt.from_pair_suites("Cps_test", { tl: { hd: [ "cps_test_closure2", - (function (param) { + (function () { return { TAG: "Eq", _0: 30, diff --git a/jscomp/test/custom_error_test.js b/jscomp/test/custom_error_test.js index 0b695ad2d7..e126b6f346 100644 --- a/jscomp/test/custom_error_test.js +++ b/jscomp/test/custom_error_test.js @@ -4,7 +4,7 @@ let Js_exn = require("../../lib/js/js_exn.js"); let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); -function test_js_error(param) { +function test_js_error() { let e; try { e = JSON.parse(" {\"x\" : }"); @@ -22,7 +22,7 @@ function test_js_error(param) { return e; } -function test_js_error2(param) { +function test_js_error2() { try { return JSON.parse(" {\"x\" : }"); } @@ -40,7 +40,7 @@ function test_js_error2(param) { } } -function example1(param) { +function example1() { let v; try { v = JSON.parse(" {\"x\" }"); @@ -58,7 +58,7 @@ function example1(param) { return v; } -function example2(param) { +function example2() { try { return JSON.parse(" {\"x\"}"); } diff --git a/jscomp/test/debugger_test.js b/jscomp/test/debugger_test.js index 592eba45df..37d33813f9 100644 --- a/jscomp/test/debugger_test.js +++ b/jscomp/test/debugger_test.js @@ -10,7 +10,7 @@ function f(x, y) { return x + y | 0; } -function g(param) { +function g() { f(1, 2); debugger; f(1, 2); @@ -18,7 +18,7 @@ function g(param) { return 3; } -function exterme_g(param) { +function exterme_g() { f(1, 2); debugger; let v; diff --git a/jscomp/test/demo_int_map.js b/jscomp/test/demo_int_map.js index 98da29bee8..34ee5f4df4 100644 --- a/jscomp/test/demo_int_map.js +++ b/jscomp/test/demo_int_map.js @@ -155,7 +155,7 @@ function find(x, _param) { }; } -function test(param) { +function test() { let m = "Empty"; for(let i = 0; i <= 1000000; ++i){ m = add(i, i, m); diff --git a/jscomp/test/demo_page.js b/jscomp/test/demo_page.js index e7c9ae5352..03af90cb46 100644 --- a/jscomp/test/demo_page.js +++ b/jscomp/test/demo_page.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let React = require("react"); let ReactDom = require("react-dom"); @@ -27,7 +26,7 @@ function map(f, x) { } else { return { TAG: "Cons", - _0: Curry._1(f, x._0), + _0: f(x._0), _1: map(f, x._1) }; } @@ -37,12 +36,12 @@ function test_curry(x, y) { return x + y | 0; } -function f(param) { - return 32 + param | 0; +function f(extra) { + return 32 + extra | 0; } ReactDom.render(React.createClass({ - render: (function (param) { + render: (function () { return React.DOM.div({ alt: "pic" }, React.DOM.h1(undefined, "hello react"), React.DOM.h2(undefined, "type safe!")); diff --git a/jscomp/test/demo_pipe.js b/jscomp/test/demo_pipe.js index 0159fe6a0a..2a83141fe6 100644 --- a/jscomp/test/demo_pipe.js +++ b/jscomp/test/demo_pipe.js @@ -5,7 +5,7 @@ function register(rl) { return rl.on("line", (function (x) { console.log(x); - })).on("close", (function (param) { + })).on("close", (function () { console.log("finished"); })); } diff --git a/jscomp/test/digest_test.js b/jscomp/test/digest_test.js index 2ceaad6b71..f3d612c5f2 100644 --- a/jscomp/test/digest_test.js +++ b/jscomp/test/digest_test.js @@ -5,7 +5,7 @@ let Mt = require("./mt.js"); let $$Array = require("../../lib/js/array.js"); let Digest = require("../../lib/js/digest.js"); let Caml_array = require("../../lib/js/caml_array.js"); -let Pervasives = require("../../lib/js/pervasives.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); let Ext_array_test = require("./ext_array_test.js"); function f(x) { @@ -145,10 +145,10 @@ let ref = [ "b325dc1c6f5e7a2b7cf465b9feab7948" ]; -Mt.from_pair_suites("Digest_test", Pervasives.$at({ +let extra = PervasivesU.$at({ hd: [ "File \"digest_test.res\", line 9, characters 9-16", - (function (param) { + (function () { return { TAG: "Eq", _0: Digest.to_hex(Digest.string("value")), @@ -159,7 +159,7 @@ Mt.from_pair_suites("Digest_test", Pervasives.$at({ tl: { hd: [ "File \"digest_test.res\", line 11, characters 10-17", - (function (param) { + (function () { return { TAG: "Eq", _0: Digest.to_hex(Digest.string("The quick brown fox jumps over the lazy dog")), @@ -170,7 +170,7 @@ Mt.from_pair_suites("Digest_test", Pervasives.$at({ tl: { hd: [ "File \"digest_test.res\", line 18, characters 10-17", - (function (param) { + (function () { return { TAG: "Eq", _0: Digest.to_hex(Digest.string("The quick brown fox jumps over the lazy dog.")), @@ -181,7 +181,7 @@ Mt.from_pair_suites("Digest_test", Pervasives.$at({ tl: { hd: [ "File \"digest_test.res\", line 24, characters 9-16", - (function (param) { + (function () { return { TAG: "Eq", _0: Digest.to_hex(Digest.string("")), @@ -192,7 +192,7 @@ Mt.from_pair_suites("Digest_test", Pervasives.$at({ tl: { hd: [ "File \"digest_test.res\", line 26, characters 10-17", - (function (param) { + (function () { return { TAG: "Eq", _0: Digest.to_hex(Digest.string("The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.")), @@ -203,7 +203,7 @@ Mt.from_pair_suites("Digest_test", Pervasives.$at({ tl: { hd: [ "File \"digest_test.res\", line 45, characters 10-17", - (function (param) { + (function () { return { TAG: "Eq", _0: Digest.to_hex(Digest.string("The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.")), @@ -220,7 +220,7 @@ Mt.from_pair_suites("Digest_test", Pervasives.$at({ }, $$Array.to_list($$Array.map((function (i) { return [ String(i), - (function (param) { + (function () { return { TAG: "Eq", _0: Digest.to_hex(Digest.string("a".repeat(i))), @@ -228,7 +228,9 @@ Mt.from_pair_suites("Digest_test", Pervasives.$at({ }; }) ]; -}), Ext_array_test.range(0, 129))))); +}), Ext_array_test.range(0, 129)))); + +Mt.from_pair_suites("Digest_test", extra); exports.f = f; -/* Not a pure module */ +/* extra Not a pure module */ diff --git a/jscomp/test/div_by_zero_test.js b/jscomp/test/div_by_zero_test.js index b2851ede0a..6d14eeef6c 100644 --- a/jscomp/test/div_by_zero_test.js +++ b/jscomp/test/div_by_zero_test.js @@ -18,7 +18,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -39,10 +39,10 @@ function add(suite) { add([ "File \"div_by_zero_test.res\", line 11, characters 7-14", - (function (param) { + (function () { return { TAG: "ThrowAny", - _0: (function (param) { + _0: (function () { Caml_int32.div(3, 0); }) }; @@ -51,10 +51,10 @@ add([ add([ "File \"div_by_zero_test.res\", line 12, characters 7-14", - (function (param) { + (function () { return { TAG: "ThrowAny", - _0: (function (param) { + _0: (function () { Caml_int32.mod_(3, 0); }) }; @@ -63,10 +63,10 @@ add([ add([ "File \"div_by_zero_test.res\", line 13, characters 7-14", - (function (param) { + (function () { return { TAG: "ThrowAny", - _0: (function (param) { + _0: (function () { Caml_int32.div(3, 0); }) }; @@ -75,10 +75,10 @@ add([ add([ "File \"div_by_zero_test.res\", line 14, characters 7-14", - (function (param) { + (function () { return { TAG: "ThrowAny", - _0: (function (param) { + _0: (function () { Caml_int32.mod_(3, 0); }) }; @@ -87,10 +87,10 @@ add([ add([ "File \"div_by_zero_test.res\", line 15, characters 7-14", - (function (param) { + (function () { return { TAG: "ThrowAny", - _0: (function (param) { + _0: (function () { Caml_int64.div([ 0, 3 @@ -102,10 +102,10 @@ add([ add([ "File \"div_by_zero_test.res\", line 16, characters 7-14", - (function (param) { + (function () { return { TAG: "ThrowAny", - _0: (function (param) { + _0: (function () { Caml_int64.mod_([ 0, 3 diff --git a/jscomp/test/dollar_escape_test.js b/jscomp/test/dollar_escape_test.js index b5c9c7532a..820c31b7eb 100644 --- a/jscomp/test/dollar_escape_test.js +++ b/jscomp/test/dollar_escape_test.js @@ -16,7 +16,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -32,19 +32,19 @@ function $$(x, y) { return x + y | 0; } +let v = 3; + function $$$plus(x, y) { return Math.imul(x, y); } -eq("File \"dollar_escape_test.res\", line 17, characters 3-10", 3, 3); - -eq("File \"dollar_escape_test.res\", line 18, characters 3-10", 3, 3); +let u = 3; -Mt.from_pair_suites("Dollar_escape_test", suites.contents); +eq("File \"dollar_escape_test.res\", line 17, characters 3-10", v, 3); -let v = 3; +eq("File \"dollar_escape_test.res\", line 18, characters 3-10", u, 3); -let u = 3; +Mt.from_pair_suites("Dollar_escape_test", suites.contents); exports.suites = suites; exports.test_id = test_id; diff --git a/jscomp/test/earger_curry_test.js b/jscomp/test/earger_curry_test.js index bfa934c89d..91481c8a07 100644 --- a/jscomp/test/earger_curry_test.js +++ b/jscomp/test/earger_curry_test.js @@ -2,12 +2,13 @@ 'use strict'; let Mt = require("./mt.js"); -let Curry = require("../../lib/js/curry.js"); let Caml_array = require("../../lib/js/caml_array.js"); -let Pervasives = require("../../lib/js/pervasives.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); function map(f, a) { - let f$1 = Curry.__1(f); + let f$1 = function (x) { + return f(x); + }; let l = a.length; if (l === 0) { return []; @@ -20,7 +21,9 @@ function map(f, a) { } function init(l, f) { - let f$1 = Curry.__1(f); + let f$1 = function (x) { + return f(x); + }; if (l === 0) { return []; } @@ -40,7 +43,9 @@ function init(l, f) { } function fold_left(f, x, a) { - let f$1 = Curry.__2(f); + let f$1 = function (x, y) { + return f(x, y); + }; let r = x; for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ r = f$1(r, a[i]); @@ -48,7 +53,7 @@ function fold_left(f, x, a) { return r; } -function f2(param) { +function f2() { let arr = init(30000000, (function (i) { return i; })); @@ -58,7 +63,7 @@ function f2(param) { let v = fold_left((function (prim0, prim1) { return prim0 + prim1; }), 0, b); - console.log(Pervasives.string_of_float(v)); + console.log(PervasivesU.string_of_float(v)); } f2(); @@ -76,7 +81,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -112,12 +117,8 @@ function add5(a0, a1, a2, a3, a4) { } function f(x) { - v.contents = v.contents + 1 | 0; - let partial_arg = 2; - v.contents = v.contents + 1 | 0; - let partial_arg$1 = 1; - return function (param, param$1) { - return add5(x, partial_arg$1, partial_arg, param, param$1); + return function (extra, extra$1) { + return add5(x, (v.contents = v.contents + 1 | 0, 1), (v.contents = v.contents + 1 | 0, 2), extra, extra$1); }; } diff --git a/jscomp/test/epsilon_test.js b/jscomp/test/epsilon_test.js index 07c8ae1e65..68afc22a78 100644 --- a/jscomp/test/epsilon_test.js +++ b/jscomp/test/epsilon_test.js @@ -2,7 +2,7 @@ 'use strict'; let Mt = require("./mt.js"); -let Pervasives = require("../../lib/js/pervasives.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); let v = (Number.EPSILON?Number.EPSILON:2.220446049250313e-16); @@ -11,7 +11,7 @@ let suites_0 = [ (function (param) { return { TAG: "Eq", - _0: Pervasives.epsilon_float, + _0: PervasivesU.epsilon_float, _1: v }; }) diff --git a/jscomp/test/equal_box_test.js b/jscomp/test/equal_box_test.js index ee87a62d8a..a3df571f19 100644 --- a/jscomp/test/equal_box_test.js +++ b/jscomp/test/equal_box_test.js @@ -27,11 +27,11 @@ function b(loc, x) { Mt.bool_suites(test_id, suites, loc, x); } -function f(param) { +function f() { } -function shouldBeNull(param) { +function shouldBeNull() { return null; } diff --git a/jscomp/test/equal_exception_test.js b/jscomp/test/equal_exception_test.js index 910ff6b937..082585d43c 100644 --- a/jscomp/test/equal_exception_test.js +++ b/jscomp/test/equal_exception_test.js @@ -11,7 +11,7 @@ let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let v = "gso"; -function is_equal(param) { +function is_equal() { if (Caml_bytes.get(Bytes.make(3, /* 'a' */97), 0) !== /* 'a' */97) { throw new Error("Assert_failure", { cause: { @@ -65,7 +65,7 @@ function is_equal(param) { }); } -function is_exception(param) { +function is_exception() { try { throw new Error("Not_found", { cause: { @@ -111,7 +111,7 @@ function is_normal_exception(_x) { } } -function is_arbitrary_exception(param) { +function is_arbitrary_exception() { let A = /* @__PURE__ */Caml_exceptions.create("A"); try { throw new Error(A, { diff --git a/jscomp/test/es6_module_test.js b/jscomp/test/es6_module_test.js index 08a57ee793..b990ee9ecb 100644 --- a/jscomp/test/es6_module_test.js +++ b/jscomp/test/es6_module_test.js @@ -11,7 +11,7 @@ function length(param) { Mt.from_pair_suites("Es6_module_test", { hd: [ "list_length", - (function (param) { + (function () { return { TAG: "Eq", _0: List.length({ @@ -28,7 +28,7 @@ Mt.from_pair_suites("Es6_module_test", { tl: { hd: [ "length", - (function (param) { + (function () { return { TAG: "Eq", _0: 3, diff --git a/jscomp/test/event_ffi.js b/jscomp/test/event_ffi.js index eefdb27560..c1a9fb070f 100644 --- a/jscomp/test/event_ffi.js +++ b/jscomp/test/event_ffi.js @@ -2,7 +2,6 @@ 'use strict'; let List = require("../../lib/js/list.js"); -let Curry = require("../../lib/js/curry.js"); function h0(x) { return x(); @@ -31,7 +30,7 @@ function h33(x) { } function h34(x) { - return Curry._1(x(1, 2, 3), 4); + return x(1, 2, 3)(4); } function ocaml_run(b, c) { @@ -43,7 +42,7 @@ function a0() { console.log("hi"); } -function a1(param) { +function a1() { return function (x) { return x; }; @@ -57,7 +56,7 @@ function a3(x, y, z) { return (x + y | 0) + z | 0; } -function xx(param) { +function xx() { return function (param) { console.log(3); }; diff --git a/jscomp/test/exception_raise_test.js b/jscomp/test/exception_raise_test.js index eed1be39b7..e46937b21b 100644 --- a/jscomp/test/exception_raise_test.js +++ b/jscomp/test/exception_raise_test.js @@ -3,7 +3,6 @@ let Mt = require("./mt.js"); let List = require("../../lib/js/list.js"); -let Curry = require("../../lib/js/curry.js"); let Js_exn = require("../../lib/js/js_exn.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); @@ -19,7 +18,7 @@ let D = /* @__PURE__ */Caml_exceptions.create("Exception_raise_test.D"); function appf(g, x) { let A = /* @__PURE__ */Caml_exceptions.create("A"); try { - return Curry._1(g, x); + return g(x); } catch (raw_exn){ let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); @@ -135,7 +134,7 @@ let suites = { contents: { hd: [ "File \"exception_raise_test.res\", line 120, characters 5-12", - (function (param) { + (function () { return { TAG: "Eq", _0: [ @@ -156,7 +155,7 @@ let suites = { tl: { hd: [ "File \"exception_raise_test.res\", line 123, characters 6-13", - (function (param) { + (function () { if (a1.RE_EXN_ID === Js_exn.$$Error) { return { TAG: "Eq", @@ -212,12 +211,12 @@ catch (raw_e$3){ function fff0(x, g) { let val; try { - val = Curry._1(x, undefined); + val = x(); } catch (exn){ return 1; } - return Curry._1(g, undefined); + return g(); } function input_lines(ic, _acc) { diff --git a/jscomp/test/exception_rebound_err_test.js b/jscomp/test/exception_rebound_err_test.js index b77e33abab..3c0843c748 100644 --- a/jscomp/test/exception_rebound_err_test.js +++ b/jscomp/test/exception_rebound_err_test.js @@ -2,7 +2,6 @@ 'use strict'; let Mt = require("./mt.js"); -let Curry = require("../../lib/js/curry.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); @@ -19,7 +18,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -37,7 +36,7 @@ let B = /* @__PURE__ */Caml_exceptions.create("Exception_rebound_err_test.B"); let C = /* @__PURE__ */Caml_exceptions.create("Exception_rebound_err_test.C"); -function test_js_error4(param) { +function test_js_error4() { try { JSON.parse(" {\"x\"}"); return 1; @@ -68,7 +67,7 @@ function test_js_error4(param) { function f(g) { try { - return Curry._1(g, undefined); + return g(); } catch (raw_exn){ let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); diff --git a/jscomp/test/exception_value_test.js b/jscomp/test/exception_value_test.js index 533c2ae25a..a48c45483f 100644 --- a/jscomp/test/exception_value_test.js +++ b/jscomp/test/exception_value_test.js @@ -1,12 +1,11 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let Js_exn = require("../../lib/js/js_exn.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); -function f(param) { +function f() { throw new Error("Not_found", { cause: { RE_EXN_ID: "Not_found" @@ -30,7 +29,7 @@ function assert_f(x) { return 3; } -function hh(param) { +function hh() { throw new Error("Not_found", { cause: { RE_EXN_ID: "Not_found" @@ -51,7 +50,7 @@ let u = { function test_not_found(f, param) { try { - return Curry._1(f, undefined); + return f(); } catch (raw_exn){ let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); @@ -64,7 +63,7 @@ function test_not_found(f, param) { } } -function test_js_error2(param) { +function test_js_error2() { try { return JSON.parse(" {\"x\" : }"); } @@ -82,7 +81,7 @@ function test_js_error2(param) { } } -function test_js_error3(param) { +function test_js_error3() { try { JSON.parse(" {\"x\"}"); return 1; diff --git a/jscomp/test/ext_array_test.js b/jscomp/test/ext_array_test.js index d8e014a68f..6e74676a71 100644 --- a/jscomp/test/ext_array_test.js +++ b/jscomp/test/ext_array_test.js @@ -3,7 +3,6 @@ let List = require("../../lib/js/list.js"); let $$Array = require("../../lib/js/array.js"); -let Curry = require("../../lib/js/curry.js"); let Caml_array = require("../../lib/js/caml_array.js"); let Caml_option = require("../../lib/js/caml_option.js"); @@ -66,7 +65,7 @@ function filter(f, a) { return reverse_of_list(acc); } let v = a[i]; - if (Curry._1(f, v)) { + if (f(v)) { _i = i + 1 | 0; _acc = { hd: v, @@ -90,7 +89,7 @@ function filter_map(f, a) { return reverse_of_list(acc); } let v = a[i]; - let v$1 = Curry._1(f, v); + let v$1 = f(v); if (v$1 !== undefined) { _i = i + 1 | 0; _acc = { @@ -105,32 +104,32 @@ function filter_map(f, a) { } function range(from, to_) { - if (from > to_) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_array_test.range" - } - }); + if (from <= to_) { + return $$Array.init((to_ - from | 0) + 1 | 0, (function (i) { + return i + from | 0; + })); } - return $$Array.init((to_ - from | 0) + 1 | 0, (function (i) { - return i + from | 0; - })); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_array_test.range" + } + }); } function map2i(f, a, b) { let len = a.length; - if (len !== b.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_array_test.map2i" - } - }); + if (len === b.length) { + return $$Array.mapi((function (i, a) { + return f(i, a, b[i]); + }), a); } - return $$Array.mapi((function (i, a) { - return Curry._3(f, i, a, b[i]); - }), a); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_array_test.map2i" + } + }); } function tolist_aux(a, f, _i, _res) { @@ -141,7 +140,7 @@ function tolist_aux(a, f, _i, _res) { return res; } let v = a[i]; - let v$1 = Curry._1(f, v); + let v$1 = f(v); _res = v$1 !== undefined ? ({ hd: Caml_option.valFromOption(v$1), tl: res @@ -164,7 +163,7 @@ function of_list_map(f, a) { return []; } let tl = a.tl; - let hd = Curry._1(f, a.hd); + let hd = f(a.hd); let len = List.length(tl) + 1 | 0; let arr = Caml_array.make(len, hd); let _i = 1; @@ -175,7 +174,7 @@ function of_list_map(f, a) { if (!x) { return arr; } - arr[i] = Curry._1(f, x.hd); + arr[i] = f(x.hd); _x = x.tl; _i = i + 1 | 0; continue; @@ -190,7 +189,7 @@ function rfind_with_index(arr, cmp, v) { if (i < 0) { return i; } - if (Curry._2(cmp, arr[i], v)) { + if (cmp(arr[i], v)) { return i; } _i = i - 1 | 0; @@ -221,7 +220,7 @@ function find_with_index(arr, cmp, v) { if (i >= len) { return -1; } - if (Curry._2(cmp, arr[i], v)) { + if (cmp(arr[i], v)) { return i; } _i = i + 1 | 0; @@ -252,7 +251,7 @@ function exists(p, a) { if (i === n) { return false; } - if (Curry._1(p, a[i])) { + if (p(a[i])) { return true; } _i = i + 1 | 0; @@ -270,7 +269,7 @@ function unsafe_loop(_index, len, p, xs, ys) { if (index >= len) { return true; } - if (!Curry._2(p, xs[index], ys[index])) { + if (!p(xs[index], ys[index])) { return false; } _index = index + 1 | 0; diff --git a/jscomp/test/ext_bytes_test.js b/jscomp/test/ext_bytes_test.js index c8de2ffa23..9c496d4a89 100644 --- a/jscomp/test/ext_bytes_test.js +++ b/jscomp/test/ext_bytes_test.js @@ -5,7 +5,7 @@ let Mt = require("./mt.js"); let Caml = require("../../lib/js/caml.js"); let Char = require("../../lib/js/char.js"); let Bytes = require("../../lib/js/bytes.js"); -let Curry = require("../../lib/js/curry.js"); +let $$String = require("../../lib/js/string.js"); let Caml_bytes = require("../../lib/js/caml_bytes.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); @@ -136,7 +136,7 @@ function starts_with(xs, prefix, p) { } try { for(let i = 0; i < len2; ++i){ - if (!Curry._2(p, Caml_bytes.get(xs, i), Caml_bytes.get(prefix, i))) { + if (!p(Caml_bytes.get(xs, i), Caml_bytes.get(prefix, i))) { throw new Error(H, { cause: { RE_EXN_ID: H @@ -158,21 +158,25 @@ function starts_with(xs, prefix, p) { } } -let a = Bytes.init(100, Char.chr); +let a = Bytes.init(100, (function (i) { + return Char.chr(i); +})); Bytes.blit(a, 5, a, 10, 10); eq("File \"ext_bytes_test.res\", line 116, characters 4-11", a, Bytes.of_string("\x00\x01\x02\x03\x04\x05\x06\x07\b\t\x05\x06\x07\b\t\n\x0b\x0c\r\x0e\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abc")); -let a$1 = Bytes.init(100, Char.chr); +let a$1 = Bytes.init(100, (function (i) { + return Char.chr(i); +})); Bytes.blit(a$1, 10, a$1, 5, 10); eq("File \"ext_bytes_test.res\", line 128, characters 4-11", a$1, Bytes.of_string("\x00\x01\x02\x03\x04\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abc")); -let f = Char.chr; - -let a$2 = Bytes.unsafe_to_string(Bytes.init(100, f)); +let a$2 = $$String.init(100, (function (i) { + return Char.chr(i); +})); let b = Bytes.init(100, (function (i) { return /* '\000' */0; @@ -192,7 +196,7 @@ let s2 = Bytes.of_string(s1); eq("File \"ext_bytes_test.res\", line 153, characters 5-12", s, s2); -function f$1(a, b) { +function f(a, b) { return [ Caml_bytes.bytes_greaterthan(a, b), Caml_bytes.bytes_greaterequal(a, b), @@ -219,6 +223,6 @@ exports.test_id = test_id; exports.eq = eq; exports.escaped = escaped; exports.starts_with = starts_with; -exports.f = f$1; +exports.f = f; exports.f_0 = f_0; /* a Not a pure module */ diff --git a/jscomp/test/ext_filename_test.js b/jscomp/test/ext_filename_test.js index 7837155517..938ec7cb92 100644 --- a/jscomp/test/ext_filename_test.js +++ b/jscomp/test/ext_filename_test.js @@ -2,13 +2,12 @@ 'use strict'; let Sys = require("../../lib/js/sys.js"); +let Lazy = require("../../lib/js/lazy.js"); let List = require("../../lib/js/list.js"); -let $$Array = require("../../lib/js/array.js"); -let Bytes = require("../../lib/js/bytes.js"); -let Curry = require("../../lib/js/curry.js"); +let $$String = require("../../lib/js/string.js"); let Caml_sys = require("../../lib/js/caml_sys.js"); let Filename = require("../../lib/js/filename.js"); -let Pervasives = require("../../lib/js/pervasives.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); let Test_literals = require("./test_literals.js"); let Ext_string_test = require("./ext_string_test.js"); let CamlinternalLazy = require("../../lib/js/camlinternalLazy.js"); @@ -20,7 +19,7 @@ let node_parent = ".."; let node_current = "."; -let cwd = CamlinternalLazy.from_fun(function () { +let cwd = Lazy.from_fun(function () { return Caml_sys.sys_getcwd(); }); @@ -33,18 +32,18 @@ function path_as_directory(x) { } function absolute_path(s) { - let s$1 = Curry._1(Filename.is_relative, s) ? Filename.concat(CamlinternalLazy.force(cwd), s) : s; + let s$1 = Filename.is_relative(s) ? Filename.concat(CamlinternalLazy.force(cwd), s) : s; let aux = function (_s) { while(true) { let s = _s; - let base = Curry._1(Filename.basename, s); - let dir = Curry._1(Filename.dirname, s); + let base = Filename.basename(s); + let dir = Filename.dirname(s); if (dir === s) { return dir; } if (base !== Filename.current_dir_name) { if (base === Filename.parent_dir_name) { - return Curry._1(Filename.dirname, aux(dir)); + return Filename.dirname(aux(dir)); } else { return Filename.concat(aux(dir), base); } @@ -64,11 +63,10 @@ function chop_extension(locOpt, name) { catch (raw_exn){ let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); if (exn.RE_EXN_ID === "Invalid_argument") { - let s = "Filename.chop_extension ( " + loc + " : " + name + " )"; throw new Error("Invalid_argument", { cause: { RE_EXN_ID: "Invalid_argument", - _1: s + _1: "Filename.chop_extension ( " + loc + " : " + name + " )" } }); } @@ -96,8 +94,8 @@ function chop_extension_if_any(fname) { let os_path_separator_char = Filename.dir_sep.codePointAt(0); function relative_path(file_or_dir_1, file_or_dir_2) { - let relevant_dir1 = file_or_dir_1.NAME === "File" ? Curry._1(Filename.dirname, file_or_dir_1.VAL) : file_or_dir_1.VAL; - let relevant_dir2 = file_or_dir_2.NAME === "File" ? Curry._1(Filename.dirname, file_or_dir_2.VAL) : file_or_dir_2.VAL; + let relevant_dir1 = file_or_dir_1.NAME === "File" ? Filename.dirname(file_or_dir_1.VAL) : file_or_dir_1.VAL; + let relevant_dir2 = file_or_dir_2.NAME === "File" ? Filename.dirname(file_or_dir_2.VAL) : file_or_dir_2.VAL; let dir1 = Ext_string_test.split(undefined, relevant_dir1, os_path_separator_char); let dir2 = Ext_string_test.split(undefined, relevant_dir2, os_path_separator_char); let go = function (_dir1, _dir2) { @@ -109,20 +107,20 @@ function relative_path(file_or_dir_1, file_or_dir_2) { _dir1 = dir1.tl; continue; } - return Pervasives.$at(List.map((function (param) { + return PervasivesU.$at(List.map((function (param) { return node_parent; }), dir2), dir1); }; }; let ys = go(dir1, dir2); if (ys && ys.hd === node_parent) { - return $$Array.of_list(ys).join(node_sep); + return $$String.concat(node_sep, ys); } - let xs = { + let __x = { hd: node_current, tl: ys }; - return $$Array.of_list(xs).join(node_sep); + return $$String.concat(node_sep, __x); } function node_relative_path(node_modules_shorten, file1, dep_file) { @@ -142,17 +140,16 @@ function node_relative_path(node_modules_shorten, file1, dep_file) { }) : ({ NAME: "Dir", VAL: absolute_path(file1.VAL) - })) + (node_sep + Curry._1(Filename.basename, file2)); + })) + (node_sep + Filename.basename(file2)); } let skip = function (_i) { while(true) { let i = _i; if (i >= len) { - let s = "invalid path: " + file2; throw new Error("Failure", { cause: { RE_EXN_ID: "Failure", - _1: s + _1: "invalid path: " + file2 } }); } @@ -173,16 +170,15 @@ function find_root_filename(_cwd, filename) { if (Caml_sys.sys_file_exists(Filename.concat(cwd, filename))) { return cwd; } - let cwd$p = Curry._1(Filename.dirname, cwd); + let cwd$p = Filename.dirname(cwd); if (cwd$p.length < cwd.length) { _cwd = cwd$p; continue; } - let s = filename + " not found from " + cwd; throw new Error("Failure", { cause: { RE_EXN_ID: "Failure", - _1: s + _1: filename + " not found from " + cwd } }); }; @@ -192,19 +188,17 @@ function find_package_json_dir(cwd) { return find_root_filename(cwd, Test_literals.bsconfig_json); } -let package_dir = CamlinternalLazy.from_fun(function () { +let package_dir = Lazy.from_fun(function () { let cwd$1 = CamlinternalLazy.force(cwd); return find_root_filename(cwd$1, Test_literals.bsconfig_json); }); function module_name_of_file(file) { - let s = Filename.chop_extension(Curry._1(Filename.basename, file)); - return Bytes.unsafe_to_string(Bytes.capitalize_ascii(Bytes.unsafe_of_string(s))); + return $$String.capitalize_ascii(Filename.chop_extension(Filename.basename(file))); } function module_name_of_file_if_any(file) { - let s = chop_extension_if_any(Curry._1(Filename.basename, file)); - return Bytes.unsafe_to_string(Bytes.capitalize_ascii(Bytes.unsafe_of_string(s))); + return $$String.capitalize_ascii(chop_extension_if_any(Filename.basename(file))); } function combine(p1, p2) { @@ -212,7 +206,7 @@ function combine(p1, p2) { return p2; } else if (p2 === "" || p2 === Filename.current_dir_name) { return p1; - } else if (Curry._1(Filename.is_relative, p2)) { + } else if (Filename.is_relative(p2)) { return Filename.concat(p1, p2); } else { return p2; @@ -225,14 +219,14 @@ function split_aux(p) { while(true) { let acc = _acc; let p$1 = _p; - let dir = Curry._1(Filename.dirname, p$1); + let dir = Filename.dirname(p$1); if (dir === p$1) { return [ dir, acc ]; } - let new_path = Curry._1(Filename.basename, p$1); + let new_path = Filename.basename(p$1); if (new_path === Filename.dir_sep) { _p = dir; continue; @@ -260,7 +254,9 @@ function rel_normalized_absolute_path(from, to_) { let xss = _xss; if (!xss) { if (yss) { - return List.fold_left(Filename.concat, yss.hd, yss.tl); + return List.fold_left((function (acc, x) { + return Filename.concat(acc, x); + }), yss.hd, yss.tl); } else { return Ext_string_test.empty; } @@ -279,7 +275,9 @@ function rel_normalized_absolute_path(from, to_) { let start = List.fold_left((function (acc, param) { return Filename.concat(acc, Ext_string_test.parent_dir_lit); }), Ext_string_test.parent_dir_lit, xs); - return List.fold_left(Filename.concat, start, yss); + return List.fold_left((function (acc, v) { + return Filename.concat(acc, v); + }), start, yss); }; } @@ -356,11 +354,10 @@ if (Sys.unix) { } else if (Sys.win32 || false) { simple_convert_node_path_to_os_path = Ext_string_test.replace_slash_backward; } else { - let s = "Unknown OS : " + Sys.os_type; throw new Error("Failure", { cause: { RE_EXN_ID: "Failure", - _1: s + _1: "Unknown OS : " + Sys.os_type } }); } @@ -390,4 +387,4 @@ exports.rel_normalized_absolute_path = rel_normalized_absolute_path; exports.normalize_absolute_path = normalize_absolute_path; exports.get_extension = get_extension; exports.simple_convert_node_path_to_os_path = simple_convert_node_path_to_os_path; -/* simple_convert_node_path_to_os_path Not a pure module */ +/* cwd Not a pure module */ diff --git a/jscomp/test/ext_list_test.js b/jscomp/test/ext_list_test.js index 4a7e668636..d2870ed0bd 100644 --- a/jscomp/test/ext_list_test.js +++ b/jscomp/test/ext_list_test.js @@ -3,7 +3,6 @@ let List = require("../../lib/js/list.js"); let $$Array = require("../../lib/js/array.js"); -let Curry = require("../../lib/js/curry.js"); let Caml_option = require("../../lib/js/caml_option.js"); let Ext_string_test = require("./ext_string_test.js"); @@ -14,7 +13,7 @@ function filter_map(f, _xs) { return /* [] */0; } let ys = xs.tl; - let z = Curry._1(f, xs.hd); + let z = f(xs.hd); if (z !== undefined) { return { hd: Caml_option.valFromOption(z), @@ -39,7 +38,7 @@ function excludes(p, l) { } let l = x.tl; let x$1 = x.hd; - if (Curry._1(p, x$1)) { + if (p(x$1)) { excluded.contents = true; _x = l; continue; @@ -79,7 +78,7 @@ function exclude_with_fact(p, l) { } let l = x.tl; let x$1 = x.hd; - if (Curry._1(p, x$1)) { + if (p(x$1)) { excluded.contents = Caml_option.some(x$1); _x = l; continue; @@ -115,12 +114,12 @@ function exclude_with_fact2(p1, p2, l) { } let l = x.tl; let x$1 = x.hd; - if (Curry._1(p1, x$1)) { + if (p1(x$1)) { excluded1.contents = Caml_option.some(x$1); _x = l; continue; } - if (Curry._1(p2, x$1)) { + if (p2(x$1)) { excluded2.contents = Caml_option.some(x$1); _x = l; continue; @@ -170,7 +169,7 @@ function filter_mapi(f, xs) { return /* [] */0; } let ys = xs.tl; - let z = Curry._2(f, i, xs.hd); + let z = f(i, xs.hd); if (z !== undefined) { return { hd: Caml_option.valFromOption(z), @@ -193,7 +192,7 @@ function filter_map2(f, _xs, _ys) { if (ys) { let vs = ys.tl; let us = xs.tl; - let z = Curry._2(f, xs.hd, ys.hd); + let z = f(xs.hd, ys.hd); if (z !== undefined) { return { hd: Caml_option.valFromOption(z), @@ -233,7 +232,7 @@ function filter_map2i(f, xs, ys) { if (ys) { let vs = ys.tl; let us = xs.tl; - let z = Curry._3(f, i, xs.hd, ys.hd); + let z = f(i, xs.hd, ys.hd); if (z !== undefined) { return { hd: Caml_option.valFromOption(z), @@ -274,7 +273,7 @@ function rev_map_append(f, _l1, _l2) { return l2; } _l2 = { - hd: Curry._1(f, l1.hd), + hd: f(l1.hd), tl: l2 }; _l1 = l1.tl; @@ -294,7 +293,7 @@ function flat_map2(f, lx, ly) { if (ly$1) { _ly = ly$1.tl; _lx = lx$1.tl; - _acc = List.rev_append(Curry._2(f, lx$1.hd, ly$1.hd), acc); + _acc = List.rev_append(f(lx$1.hd, ly$1.hd), acc); continue; } throw new Error("Invalid_argument", { @@ -304,15 +303,15 @@ function flat_map2(f, lx, ly) { } }); } - if (ly$1) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_list_test.flat_map2" - } - }); + if (!ly$1) { + return List.rev(acc); } - return List.rev(acc); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.flat_map2" + } + }); }; } @@ -324,7 +323,7 @@ function flat_map_aux(f, _acc, append, _lx) { return List.rev_append(acc, append); } _lx = lx.tl; - _acc = List.rev_append(Curry._1(f, lx.hd), acc); + _acc = List.rev_append(f(lx.hd), acc); continue; }; } @@ -345,7 +344,7 @@ function map2_last(f, l1, l2) { if (l2) { if (!l2.tl) { return { - hd: Curry._3(f, true, u, l2.hd), + hd: f(true, u, l2.hd), tl: /* [] */0 }; } @@ -360,7 +359,7 @@ function map2_last(f, l1, l2) { } } if (l2) { - let r = Curry._3(f, false, u, l2.hd); + let r = f(false, u, l2.hd); return { hd: r, tl: map2_last(f, l1$1, l2.tl) @@ -392,11 +391,11 @@ function map_last(f, l1) { let u = l1.hd; if (!l1$1) { return { - hd: Curry._2(f, true, u), + hd: f(true, u), tl: /* [] */0 }; } - let r = Curry._2(f, false, u); + let r = f(false, u); return { hd: r, tl: map_last(f, l1$1) @@ -410,7 +409,7 @@ function fold_right2_last(f, l1, l2, accu) { if (!l1$1) { if (l2) { if (!l2.tl) { - return Curry._4(f, true, last1, l2.hd, accu); + return f(true, last1, l2.hd, accu); } } else { @@ -423,7 +422,7 @@ function fold_right2_last(f, l1, l2, accu) { } } if (l2) { - return Curry._4(f, false, last1, l2.hd, fold_right2_last(f, l1$1, l2.tl, accu)); + return f(false, last1, l2.hd, fold_right2_last(f, l1$1, l2.tl, accu)); } throw new Error("Invalid_argument", { cause: { @@ -432,15 +431,15 @@ function fold_right2_last(f, l1, l2, accu) { } }); } - if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2" - } - }); + if (!l2) { + return accu; } - return accu; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2" + } + }); } function init(n, f) { @@ -450,18 +449,18 @@ function init(n, f) { function take(n, l) { let arr = $$Array.of_list(l); let arr_length = arr.length; - if (arr_length < n) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_list_test.take" - } - }); + if (arr_length >= n) { + return [ + $$Array.to_list($$Array.sub(arr, 0, n)), + $$Array.to_list($$Array.sub(arr, n, arr_length - n | 0)) + ]; } - return [ - $$Array.to_list($$Array.sub(arr, 0, n)), - $$Array.to_list($$Array.sub(arr, n, arr_length - n | 0)) - ]; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.take" + } + }); } function try_take(n, l) { @@ -569,7 +568,7 @@ function aux(cmp, x, xss) { } let ys = xss.tl; let y = xss.hd; - if (Curry._2(cmp, x, List.hd(y))) { + if (cmp(x, List.hd(y))) { return { hd: { hd: x, @@ -625,7 +624,7 @@ function find_first_not(p, _x) { return; } let a = x.hd; - if (!Curry._1(p, a)) { + if (!p(a)) { return Caml_option.some(a); } _x = x.tl; @@ -639,7 +638,7 @@ function for_all_opt(p, _x) { if (!x) { return; } - let v = Curry._1(p, x.hd); + let v = p(x.hd); if (v !== undefined) { return v; } @@ -650,7 +649,7 @@ function for_all_opt(p, _x) { function fold(f, l, init) { return List.fold_left((function (acc, i) { - return Curry._2(f, i, init); + return f(i, init); }), init, l); } @@ -665,7 +664,7 @@ function rev_map_acc(acc, f, l) { } _x = x.tl; _accu = { - hd: Curry._1(f, x.hd), + hd: f(x.hd), tl: accu }; continue; @@ -675,7 +674,7 @@ function rev_map_acc(acc, f, l) { function map_acc(acc, f, l) { if (l) { return { - hd: Curry._1(f, l.hd), + hd: f(l.hd), tl: map_acc(acc, f, l.tl) }; } else { @@ -686,7 +685,7 @@ function map_acc(acc, f, l) { function rev_iter(f, xs) { if (xs) { rev_iter(f, xs.tl); - return Curry._1(f, xs.hd); + return f(xs.hd); } } @@ -705,7 +704,7 @@ function for_all2_no_exn(p, _l1, _l2) { if (!l2) { return false; } - if (!Curry._2(p, l1.hd, l2.hd)) { + if (!p(l1.hd, l2.hd)) { return false; } _l2 = l2.tl; @@ -721,7 +720,7 @@ function find_no_exn(p, _x) { return; } let x$1 = x.hd; - if (Curry._1(p, x$1)) { + if (p(x$1)) { return Caml_option.some(x$1); } _x = x.tl; @@ -735,7 +734,7 @@ function find_opt(p, _x) { if (!x) { return; } - let v = Curry._1(p, x.hd); + let v = p(x.hd); if (v !== undefined) { return v; } @@ -758,7 +757,7 @@ function split_map(f, xs) { List.rev(cs) ]; } - let match = Curry._1(f, xs$1.hd); + let match = f(xs$1.hd); _xs = xs$1.tl; _cs = { hd: match[1], @@ -776,7 +775,7 @@ function reduce_from_right(fn, lst) { let match = List.rev(lst); if (match) { return List.fold_left((function (x, y) { - return Curry._2(fn, y, x); + return fn(y, x); }), match.hd, match.tl); } throw new Error("Invalid_argument", { @@ -799,7 +798,7 @@ function reduce_from_left(fn, lst) { }); } -function create_ref_empty(param) { +function create_ref_empty() { return { contents: /* [] */0 }; diff --git a/jscomp/test/ext_pervasives_test.js b/jscomp/test/ext_pervasives_test.js index e2da1da2c2..87cf58893c 100644 --- a/jscomp/test/ext_pervasives_test.js +++ b/jscomp/test/ext_pervasives_test.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let Caml_string = require("../../lib/js/caml_string.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); @@ -9,15 +8,15 @@ let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function $$finally(v, action, f) { let e; try { - e = Curry._1(f, v); + e = f(v); } catch (e$1){ - Curry._1(action, v); + action(v); throw new Error(e$1.RE_EXN_ID, { cause: e$1 }); } - Curry._1(action, v); + action(v); return e; } diff --git a/jscomp/test/ext_string_test.js b/jscomp/test/ext_string_test.js index 45c8749f01..53b4cc582a 100644 --- a/jscomp/test/ext_string_test.js +++ b/jscomp/test/ext_string_test.js @@ -3,7 +3,6 @@ let List = require("../../lib/js/list.js"); let Bytes = require("../../lib/js/bytes.js"); -let Curry = require("../../lib/js/curry.js"); let $$String = require("../../lib/js/string.js"); let Caml_bytes = require("../../lib/js/caml_bytes.js"); let Caml_string = require("../../lib/js/caml_string.js"); @@ -31,7 +30,7 @@ function split_by(keep_emptyOpt, is_delim, str) { }; } } - if (Curry._1(is_delim, Caml_string.get(str, pos))) { + if (is_delim(Caml_string.get(str, pos))) { let new_len = (last_pos - pos | 0) - 1 | 0; if (new_len !== 0 || keep_empty) { let v = $$String.sub(str, pos + 1 | 0, new_len); @@ -207,7 +206,7 @@ function unsafe_for_all_range(s, _start, finish, p) { if (start > finish) { return true; } - if (!Curry._1(p, s.codePointAt(start))) { + if (!p(s.codePointAt(start))) { return false; } _start = start + 1 | 0; @@ -217,15 +216,15 @@ function unsafe_for_all_range(s, _start, finish, p) { function for_all_range(s, start, finish, p) { let len = s.length; - if (start < 0 || finish >= len) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_string_test.for_all_range" - } - }); + if (!(start < 0 || finish >= len)) { + return unsafe_for_all_range(s, start, finish, p); } - return unsafe_for_all_range(s, start, finish, p); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_string_test.for_all_range" + } + }); } function for_all(p, s) { @@ -301,27 +300,27 @@ function contain_substring(s, sub) { function non_overlap_count(sub, s) { let sub_len = sub.length; - if (sub.length === 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_string_test.non_overlap_count" - } - }); + if (sub.length !== 0) { + let _acc = 0; + let _off = 0; + while(true) { + let off = _off; + let acc = _acc; + let i = find(off, sub, s); + if (i < 0) { + return acc; + } + _off = i + sub_len | 0; + _acc = acc + 1 | 0; + continue; + }; } - let _acc = 0; - let _off = 0; - while(true) { - let off = _off; - let acc = _acc; - let i = find(off, sub, s); - if (i < 0) { - return acc; - } - _off = i + sub_len | 0; - _acc = acc + 1 | 0; - continue; - }; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_string_test.non_overlap_count" + } + }); } function rfind(sub, s) { @@ -554,15 +553,15 @@ function unsafe_no_char_idx(x, ch, _i, last_idx) { function no_char(x, ch, i, len) { let str_len = x.length; - if (i < 0 || i >= str_len || len >= str_len) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_string_test.no_char" - } - }); + if (!(i < 0 || i >= str_len || len >= str_len)) { + return unsafe_no_char(x, ch, i, len); } - return unsafe_no_char(x, ch, i, len); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_string_test.no_char" + } + }); } function no_slash(x) { diff --git a/jscomp/test/external_ppx.js b/jscomp/test/external_ppx.js index 48b694f509..c5dd25dc0e 100644 --- a/jscomp/test/external_ppx.js +++ b/jscomp/test/external_ppx.js @@ -3,16 +3,10 @@ let External_ppxGen = require("./external_ppx.gen"); -function renamed(param) { - let tmp = { - type: "123", - normal: 12 - }; - if (param !== undefined) { - tmp.WIDTH = param; - } - return tmp; -} +let renamed = { + type: "123", + normal: 12 +}; let u = { hi: 2, diff --git a/jscomp/test/ffi_arity_test.js b/jscomp/test/ffi_arity_test.js index 2dbb783de4..71cf9a5704 100644 --- a/jscomp/test/ffi_arity_test.js +++ b/jscomp/test/ffi_arity_test.js @@ -2,7 +2,6 @@ 'use strict'; let Mt = require("./mt.js"); -let Curry = require("../../lib/js/curry.js"); function f(v) { if (v % 2 === 0) { @@ -48,7 +47,7 @@ let vvv = { contents: 0 }; -function fff(param) { +function fff() { console.log("x"); console.log("x"); vvv.contents = vvv.contents + 1 | 0; @@ -64,14 +63,16 @@ function abc(x, y, z) { return (x + y | 0) + z | 0; } -let abc_u = abc; +function abc_u(x, y, z) { + return abc(x, y, z); +} fff(); Mt.from_pair_suites("Ffi_arity_test", { hd: [ "File \"ffi_arity_test.res\", line 51, characters 7-14", - (function (param) { + (function () { return { TAG: "Eq", _0: v, @@ -86,7 +87,7 @@ Mt.from_pair_suites("Ffi_arity_test", { tl: { hd: [ "File \"ffi_arity_test.res\", line 52, characters 7-14", - (function (param) { + (function () { return { TAG: "Eq", _0: vv, @@ -101,7 +102,7 @@ Mt.from_pair_suites("Ffi_arity_test", { tl: { hd: [ "File \"ffi_arity_test.res\", line 53, characters 7-14", - (function (param) { + (function () { return { TAG: "Eq", _0: hh, @@ -119,10 +120,10 @@ Mt.from_pair_suites("Ffi_arity_test", { }); function bar(fn) { - return Curry._1(fn, undefined); + return fn(); } -(Curry._1((function(){console.log("forgiving arity")}), undefined)); +((function(){console.log("forgiving arity")})()); exports.f = f; exports.v = v; diff --git a/jscomp/test/ffi_array_test.js b/jscomp/test/ffi_array_test.js index a858a8a7ef..1fa6dbda0f 100644 --- a/jscomp/test/ffi_array_test.js +++ b/jscomp/test/ffi_array_test.js @@ -16,7 +16,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/ffi_js_test.js b/jscomp/test/ffi_js_test.js index 9883b2d69b..b97a7f580d 100644 --- a/jscomp/test/ffi_js_test.js +++ b/jscomp/test/ffi_js_test.js @@ -27,7 +27,7 @@ function eq(loc, param) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -121,7 +121,7 @@ function vvvv(z) { return z.ff_pipe2(); } -function create_prim(param) { +function create_prim() { return { "x'": 3, "x''": 3, diff --git a/jscomp/test/ffi_splice_test.js b/jscomp/test/ffi_splice_test.js index d6133427dc..7f52cffcc2 100644 --- a/jscomp/test/ffi_splice_test.js +++ b/jscomp/test/ffi_splice_test.js @@ -16,7 +16,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/ffi_test.js b/jscomp/test/ffi_test.js index c89bc21459..e677b1fbff 100644 --- a/jscomp/test/ffi_test.js +++ b/jscomp/test/ffi_test.js @@ -2,7 +2,7 @@ 'use strict'; -function u(param) { +function u() { return xx(3); } @@ -10,13 +10,13 @@ let Textarea = {}; let $$Int32Array = {}; -function v(param) { +function v() { let u = new TextArea(); u.minHeight = 3; return u.minHeight; } -function f(param) { +function f() { let v = new Int32Array(32); v[0] = 3; return v[0]; diff --git a/jscomp/test/flattern_order_test.js b/jscomp/test/flattern_order_test.js index f5878b46af..f2878f47ea 100644 --- a/jscomp/test/flattern_order_test.js +++ b/jscomp/test/flattern_order_test.js @@ -30,7 +30,7 @@ let v = { contents: 0 }; -function obj_get(param) { +function obj_get() { return v.contents; } diff --git a/jscomp/test/flexible_array_test.js b/jscomp/test/flexible_array_test.js index c1beeb128a..c2d2426b27 100644 --- a/jscomp/test/flexible_array_test.js +++ b/jscomp/test/flexible_array_test.js @@ -2,7 +2,6 @@ 'use strict'; let $$Array = require("../../lib/js/array.js"); -let Curry = require("../../lib/js/curry.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); let Caml_array = require("../../lib/js/caml_array.js"); @@ -245,7 +244,7 @@ function filter_from(i, p, s) { let u = empty; for(let i$1 = i ,i_finish = length(s); i$1 < i_finish; ++i$1){ let ele = get(s, i$1); - if (Curry._1(p, ele)) { + if (p(ele)) { u = push_back(u, ele); } @@ -316,16 +315,14 @@ let u = of_array([ 6 ]); -let x = sort(u); - -if (!Caml_obj.equal(x, of_array([ +if (!$eq$tilde(sort(u), [ 1, 2, 2, 3, 5, 6 - ]))) { + ])) { throw new Error("Assert_failure", { cause: { RE_EXN_ID: "Assert_failure", @@ -342,13 +339,9 @@ let v = $$Array.init(500, (function (i) { return 500 - i | 0; })); -let y = $$Array.init(500, (function (i) { +$eq$tilde(sort(of_array(v)), $$Array.init(500, (function (i) { return i + 1 | 0; -})); - -let x$1 = sort(of_array(v)); - -Caml_obj.equal(x$1, of_array(y)); +}))); exports.sub = sub; exports.update = update; diff --git a/jscomp/test/float_of_bits_test.js b/jscomp/test/float_of_bits_test.js index ab56973d40..54526635e3 100644 --- a/jscomp/test/float_of_bits_test.js +++ b/jscomp/test/float_of_bits_test.js @@ -6,7 +6,7 @@ let List = require("../../lib/js/list.js"); let $$Array = require("../../lib/js/array.js"); let Caml_float = require("../../lib/js/caml_float.js"); let Caml_int64 = require("../../lib/js/caml_int64.js"); -let Pervasives = require("../../lib/js/pervasives.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); let one_float = [ 1072693248, @@ -56,10 +56,10 @@ function from_pairs(pair) { }), int32_pairs))); } -let suites = Pervasives.$at({ +let suites = PervasivesU.$at({ hd: [ "one", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_int64.bits_of_float(1.0), @@ -70,7 +70,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "two", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_int64.float_of_bits(one_float), diff --git a/jscomp/test/float_test.js b/jscomp/test/float_test.js index 3dcc34ff30..12af2a87ad 100644 --- a/jscomp/test/float_test.js +++ b/jscomp/test/float_test.js @@ -8,7 +8,7 @@ let Caml_obj = require("../../lib/js/caml_obj.js"); let Mt_global = require("./mt_global.js"); let Caml_float = require("../../lib/js/caml_float.js"); let Caml_int64 = require("../../lib/js/caml_int64.js"); -let Pervasives = require("../../lib/js/pervasives.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); let test_id = { contents: 0 @@ -174,7 +174,7 @@ function float_greaterequal(x, y) { let generic_greaterequal = Caml_obj.greaterequal; -eq("File \"float_test.res\", line 59, characters 5-12", Pervasives.classify_float(3), "FP_normal"); +eq("File \"float_test.res\", line 59, characters 5-12", PervasivesU.classify_float(3), "FP_normal"); eq("File \"float_test.res\", line 60, characters 5-12", Caml_float.modf_float(-3.125), [ -0.125, @@ -236,13 +236,13 @@ eq("File \"float_test.res\", line 89, characters 5-12", Caml.float_compare(NaN, eq("File \"float_test.res\", line 90, characters 5-12", Caml_obj.compare(NaN, NaN), 0); -eq("File \"float_test.res\", line 91, characters 5-12", Caml.float_compare(NaN, Pervasives.neg_infinity), -1); +eq("File \"float_test.res\", line 91, characters 5-12", Caml.float_compare(NaN, PervasivesU.neg_infinity), -1); -eq("File \"float_test.res\", line 92, characters 5-12", Caml_obj.compare(NaN, Pervasives.neg_infinity), -1); +eq("File \"float_test.res\", line 92, characters 5-12", Caml_obj.compare(NaN, PervasivesU.neg_infinity), -1); -eq("File \"float_test.res\", line 93, characters 5-12", Caml.float_compare(Pervasives.neg_infinity, NaN), 1); +eq("File \"float_test.res\", line 93, characters 5-12", Caml.float_compare(PervasivesU.neg_infinity, NaN), 1); -eq("File \"float_test.res\", line 94, characters 5-12", Caml_obj.compare(Pervasives.neg_infinity, NaN), 1); +eq("File \"float_test.res\", line 94, characters 5-12", Caml_obj.compare(PervasivesU.neg_infinity, NaN), 1); eq("File \"float_test.res\", line 95, characters 5-12", NaN === NaN, false); @@ -322,10 +322,10 @@ let b = match$4[1]; let a = match$4[0]; -Mt.from_pair_suites("Float_test", Pervasives.$at({ +let extra = PervasivesU.$at({ hd: [ "mod_float", - (function (param) { + (function () { return { TAG: "Approx", _0: 3.2 % 0.5, @@ -336,7 +336,7 @@ Mt.from_pair_suites("Float_test", Pervasives.$at({ tl: { hd: [ "modf_float1", - (function (param) { + (function () { return { TAG: "Approx", _0: a, @@ -347,7 +347,7 @@ Mt.from_pair_suites("Float_test", Pervasives.$at({ tl: { hd: [ "modf_float2", - (function (param) { + (function () { return { TAG: "Approx", _0: b, @@ -358,7 +358,7 @@ Mt.from_pair_suites("Float_test", Pervasives.$at({ tl: { hd: [ "int_of_float", - (function (param) { + (function () { return { TAG: "Eq", _0: 3, @@ -370,7 +370,9 @@ Mt.from_pair_suites("Float_test", Pervasives.$at({ } } } -}, Pervasives.$at(from_pairs(results), suites.contents))); +}, PervasivesU.$at(from_pairs(results), suites.contents)); + +Mt.from_pair_suites("Float_test", extra); exports.test_id = test_id; exports.suites = suites; diff --git a/jscomp/test/for_loop_test.js b/jscomp/test/for_loop_test.js index ace1d0413c..03b984a4c1 100644 --- a/jscomp/test/for_loop_test.js +++ b/jscomp/test/for_loop_test.js @@ -3,24 +3,25 @@ let List = require("../../lib/js/list.js"); let $$Array = require("../../lib/js/array.js"); -let Curry = require("../../lib/js/curry.js"); let Caml_array = require("../../lib/js/caml_array.js"); function for_3(x) { let v = { contents: 0 }; - let arr = $$Array.map((function (param, param$1) { - + let arr = $$Array.map((function (param) { + return function () { + + }; }), x); for(let i = 0 ,i_finish = x.length; i < i_finish; ++i){ let j = (i << 1); - Caml_array.set(arr, i, (function (param) { + Caml_array.set(arr, i, (function () { v.contents = v.contents + j | 0; })); } $$Array.iter((function (x) { - Curry._1(x, undefined); + x(); }), arr); return v.contents; } @@ -29,18 +30,20 @@ function for_4(x) { let v = { contents: 0 }; - let arr = $$Array.map((function (param, param$1) { - + let arr = $$Array.map((function (param) { + return function () { + + }; }), x); for(let i = 0 ,i_finish = x.length; i < i_finish; ++i){ let j = (i << 1); let k = (j << 1); - Caml_array.set(arr, i, (function (param) { + Caml_array.set(arr, i, (function () { v.contents = v.contents + k | 0; })); } $$Array.iter((function (x) { - Curry._1(x, undefined); + x(); }), arr); return v.contents; } @@ -49,17 +52,19 @@ function for_5(x, u) { let v = { contents: 0 }; - let arr = $$Array.map((function (param, param$1) { - + let arr = $$Array.map((function (param) { + return function () { + + }; }), x); for(let i = 0 ,i_finish = x.length; i < i_finish; ++i){ let k = Math.imul((u << 1), u); - Caml_array.set(arr, i, (function (param) { + Caml_array.set(arr, i, (function () { v.contents = v.contents + k | 0; })); } $$Array.iter((function (x) { - Curry._1(x, undefined); + x(); }), arr); return v.contents; } @@ -68,8 +73,10 @@ function for_6(x, u) { let v = { contents: 0 }; - let arr = $$Array.map((function (param, param$1) { - + let arr = $$Array.map((function (param) { + return function () { + + }; }), x); let v4 = { contents: 0 @@ -88,14 +95,14 @@ function for_6(x, u) { let k = Math.imul((u << 1), u); let h = (v5.contents << 1); v2.contents = v2.contents + 1 | 0; - Caml_array.set(arr, i, (function (param) { + Caml_array.set(arr, i, (function () { v.contents = (((((v.contents + k | 0) + v2.contents | 0) + v4.contents | 0) + v5.contents | 0) + h | 0) + u | 0; })); } inspect_3 = v2.contents; } $$Array.iter((function (x) { - Curry._1(x, undefined); + x(); }), arr); return [ v.contents, @@ -105,49 +112,49 @@ function for_6(x, u) { ]; } -function for_7(param) { +function for_7() { let v = { contents: 0 }; - let arr = Caml_array.make(21, (function (param) { + let arr = Caml_array.make(21, (function () { })); for(let i = 0; i <= 6; ++i){ for(let j = 0; j <= 2; ++j){ - Caml_array.set(arr, Math.imul(i, 3) + j | 0, (function (param) { + Caml_array.set(arr, Math.imul(i, 3) + j | 0, (function () { v.contents = (v.contents + i | 0) + j | 0; })); } } $$Array.iter((function (f) { - Curry._1(f, undefined); + f(); }), arr); return v.contents; } -function for_8(param) { +function for_8() { let v = { contents: 0 }; - let arr = Caml_array.make(21, (function (param) { + let arr = Caml_array.make(21, (function () { })); for(let i = 0; i <= 6; ++i){ let k = (i << 1); for(let j = 0; j <= 2; ++j){ let h = i + j | 0; - Caml_array.set(arr, Math.imul(i, 3) + j | 0, (function (param) { + Caml_array.set(arr, Math.imul(i, 3) + j | 0, (function () { v.contents = (((v.contents + i | 0) + j | 0) + h | 0) + k | 0; })); } } $$Array.iter((function (f) { - Curry._1(f, undefined); + f(); }), arr); return v.contents; } -function for_9(param) { +function for_9() { let v = { contents: /* [] */0 }; @@ -157,16 +164,19 @@ function for_9(param) { tl: v.contents }; }; + let get = function () { + return $$Array.of_list(List.rev(v.contents)); + }; let vv = { contents: 0 }; let vv2 = { contents: 0 }; - let arr = Caml_array.make(4, (function (param) { + let arr = Caml_array.make(4, (function () { })); - let arr2 = Caml_array.make(2, (function (param) { + let arr2 = Caml_array.make(2, (function () { })); for(let i = 0; i <= 1; ++i){ @@ -177,23 +187,23 @@ function for_9(param) { for(let j = 0; j <= 1; ++j){ v$1.contents = v$1.contents + 1 | 0; collect(v$1.contents); - Caml_array.set(arr, (i << 1) + j | 0, (function (param) { + Caml_array.set(arr, (i << 1) + j | 0, (function () { vv.contents = vv.contents + v$1.contents | 0; })); } - Caml_array.set(arr2, i, (function (param) { + Caml_array.set(arr2, i, (function () { vv2.contents = vv2.contents + v$1.contents | 0; })); } $$Array.iter((function (f) { - Curry._1(f, undefined); + f(); }), arr); $$Array.iter((function (f) { - Curry._1(f, undefined); + f(); }), arr2); return [[ vv.contents, - $$Array.of_list(List.rev(v.contents)), + get(), vv2.contents ]]; } diff --git a/jscomp/test/for_side_effect_test.js b/jscomp/test/for_side_effect_test.js index cf4074acee..0a047d4d17 100644 --- a/jscomp/test/for_side_effect_test.js +++ b/jscomp/test/for_side_effect_test.js @@ -3,13 +3,13 @@ let Mt = require("./mt.js"); -function tst(param) { +function tst() { for(let i = (console.log("hi"), 0) ,i_finish = (console.log("hello"), 3); i <= i_finish; ++i){ } } -function test2(param) { +function test2() { let v = 0; v = 3; v = 10; diff --git a/jscomp/test/format_test.js b/jscomp/test/format_test.js index 54cec63dd7..379177e27d 100644 --- a/jscomp/test/format_test.js +++ b/jscomp/test/format_test.js @@ -3,9 +3,9 @@ let Mt = require("./mt.js"); let List = require("../../lib/js/list.js"); -let Bytes = require("../../lib/js/bytes.js"); -let Pervasives = require("../../lib/js/pervasives.js"); +let $$String = require("../../lib/js/string.js"); let Caml_format = require("../../lib/js/caml_format.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); let suites = { contents: /* [] */0 @@ -20,7 +20,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -44,27 +44,27 @@ eq("File \"format_test.res\", line 23, characters 5-12", 7.875, 7.875); eq("File \"format_test.res\", line 25, characters 5-12", -7.875, -7.875); -eq3("File \"format_test.res\", line 29, characters 6-13", Infinity, Number.POSITIVE_INFINITY, Pervasives.infinity); +eq3("File \"format_test.res\", line 29, characters 6-13", Infinity, Number.POSITIVE_INFINITY, PervasivesU.infinity); -eq3("File \"format_test.res\", line 30, characters 6-13", -Infinity, Number.NEGATIVE_INFINITY, Pervasives.neg_infinity); +eq3("File \"format_test.res\", line 30, characters 6-13", -Infinity, Number.NEGATIVE_INFINITY, PervasivesU.neg_infinity); -eq3("File \"format_test.res\", line 31, characters 6-13", Pervasives.max_float, 1.79769313486231571e+308, Number.MAX_VALUE); +eq3("File \"format_test.res\", line 31, characters 6-13", PervasivesU.max_float, 1.79769313486231571e+308, Number.MAX_VALUE); -eq("File \"format_test.res\", line 32, characters 5-12", Pervasives.classify_float(Infinity), "FP_infinite"); +eq("File \"format_test.res\", line 32, characters 5-12", PervasivesU.classify_float(Infinity), "FP_infinite"); -eq("File \"format_test.res\", line 33, characters 5-12", Pervasives.classify_float(Infinity), "FP_infinite"); +eq("File \"format_test.res\", line 33, characters 5-12", PervasivesU.classify_float(Infinity), "FP_infinite"); -eq("File \"format_test.res\", line 35, characters 5-12", Pervasives.min_float, 2.22507385850720138e-308); +eq("File \"format_test.res\", line 35, characters 5-12", PervasivesU.min_float, 2.22507385850720138e-308); -eq("File \"format_test.res\", line 36, characters 5-12", Pervasives.epsilon_float, 2.22044604925031308e-16); +eq("File \"format_test.res\", line 36, characters 5-12", PervasivesU.epsilon_float, 2.22044604925031308e-16); eq("File \"format_test.res\", line 37, characters 5-12", 4.94065645841e-324, 5e-324); -eq("File \"format_test.res\", line 38, characters 5-12", 1.00000000000000022 - 1, Pervasives.epsilon_float); +eq("File \"format_test.res\", line 38, characters 5-12", 1.00000000000000022 - 1, PervasivesU.epsilon_float); eq("File \"format_test.res\", line 39, characters 5-12", 1.11253692925360069e-308 / 2.22507385850720138e-308, 0.5); -eq("File \"format_test.res\", line 40, characters 5-12", Pervasives.classify_float(1.11253692925360069e-308), "FP_subnormal"); +eq("File \"format_test.res\", line 40, characters 5-12", PervasivesU.classify_float(1.11253692925360069e-308), "FP_subnormal"); eq("File \"format_test.res\", line 41, characters 5-12", 1.11253692925360069e-308, 1.11253692925360069e-308); @@ -124,7 +124,7 @@ let literals_1 = { ], tl: { hd: [ - Pervasives.infinity, + PervasivesU.infinity, "infinity" ], tl: { @@ -174,9 +174,7 @@ let literals = { aux_list("File \"format_test.res\", line 72, characters 18-25", literals); -let s = Caml_format.hexstring_of_float(7.875, -1, /* '-' */45); - -eq("File \"format_test.res\", line 74, characters 12-19", Bytes.unsafe_to_string(Bytes.uppercase_ascii(Bytes.unsafe_of_string(s))), "0X1.F8P+2"); +eq("File \"format_test.res\", line 74, characters 12-19", $$String.uppercase_ascii(Caml_format.hexstring_of_float(7.875, -1, /* '-' */45)), "0X1.F8P+2"); function scan_float(loc, s, expect) { eq(loc, Caml_format.float_of_string(s), expect); diff --git a/jscomp/test/fun_pattern_match.js b/jscomp/test/fun_pattern_match.js index 13a3c4bce0..a7f1adbd17 100644 --- a/jscomp/test/fun_pattern_match.js +++ b/jscomp/test/fun_pattern_match.js @@ -2,7 +2,6 @@ 'use strict'; let Caml = require("../../lib/js/caml.js"); -let Curry = require("../../lib/js/curry.js"); function f(param, v) { return ((((param.x0 + param.x1 | 0) + param.x2 | 0) + param.x3 | 0) + param.x4 | 0) + v | 0; @@ -12,54 +11,50 @@ function f2(param, param$1) { return (((((param.x0 + param.x1 | 0) + param.x2 | 0) + param.x3 | 0) + param.x4 | 0) + param$1.a | 0) + param$1.b | 0; } -function f3(param) { +function f3(param, param$1) { let lhs = param.rank; - return function (param) { - let rhs = param.rank; - if (typeof lhs !== "object") { - lhs === "Uninitialized"; - } else { - if (typeof rhs === "object") { - return Caml.int_compare(lhs._0, rhs._0); - } - rhs === "Uninitialized"; + let rhs = param$1.rank; + if (typeof lhs !== "object") { + lhs === "Uninitialized"; + } else { + if (typeof rhs === "object") { + return Caml.int_compare(lhs._0, rhs._0); } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "fun_pattern_match.res", - 33, - 9 - ] - } - }); - }; + rhs === "Uninitialized"; + } + throw new Error("Assert_failure", { + cause: { + RE_EXN_ID: "Assert_failure", + _1: [ + "fun_pattern_match.res", + 33, + 9 + ] + } + }); } -function f4(param) { +function f4(param, param$1) { let lhs = param.rank; - return function (param) { - let rhs = param.rank; - if (typeof lhs !== "object") { - lhs === "Uninitialized"; - } else { - if (typeof rhs === "object") { - return Caml.int_compare(lhs._0, rhs._0); - } - rhs === "Uninitialized"; + let rhs = param$1.rank; + if (typeof lhs !== "object") { + lhs === "Uninitialized"; + } else { + if (typeof rhs === "object") { + return Caml.int_compare(lhs._0, rhs._0); } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "fun_pattern_match.res", - 39, - 9 - ] - } - }); - }; + rhs === "Uninitialized"; + } + throw new Error("Assert_failure", { + cause: { + RE_EXN_ID: "Assert_failure", + _1: [ + "fun_pattern_match.res", + 39, + 9 + ] + } + }); } let x = { @@ -67,13 +62,13 @@ let x = { VAL: r }; -function r(param) { +function r() { return x; } let match = r(); -let v = Curry._1(match.VAL, undefined); +let v = match.VAL(); console.log(v); diff --git a/jscomp/test/functor_app_test.js b/jscomp/test/functor_app_test.js index e2cb33f434..53402b6e29 100644 --- a/jscomp/test/functor_app_test.js +++ b/jscomp/test/functor_app_test.js @@ -2,7 +2,6 @@ 'use strict'; let Mt = require("./mt.js"); -let Curry = require("../../lib/js/curry.js"); let Functor_def = require("./functor_def.js"); let Functor_inst = require("./functor_inst.js"); @@ -19,7 +18,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -35,9 +34,9 @@ let Y0 = Functor_def.Make(Functor_inst); let Y1 = Functor_def.Make(Functor_inst); -eq("File \"functor_app_test.res\", line 15, characters 3-10", Curry._2(Y0.h, 1, 2), 4); +eq("File \"functor_app_test.res\", line 15, characters 3-10", Y0.h(1, 2), 4); -eq("File \"functor_app_test.res\", line 16, characters 3-10", Curry._2(Y1.h, 2, 3), 6); +eq("File \"functor_app_test.res\", line 16, characters 3-10", Y1.h(2, 3), 6); let v = Functor_def.$$return(); diff --git a/jscomp/test/functor_def.js b/jscomp/test/functor_def.js index 75d6056744..8c1046548d 100644 --- a/jscomp/test/functor_def.js +++ b/jscomp/test/functor_def.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let v = { contents: 0 @@ -12,14 +11,14 @@ function f(x, x$1) { return x$1 + x$1 | 0; } -function $$return(param) { +function $$return() { return v.contents; } function Make(U) { let h = function (x, x$1) { console.log(f(x$1, x$1)); - return Curry._2(U.say, x$1, x$1); + return U.say(x$1, x$1); }; return { h: h diff --git a/jscomp/test/functors.js b/jscomp/test/functors.js index d0b513a63c..7af4f0d308 100644 --- a/jscomp/test/functors.js +++ b/jscomp/test/functors.js @@ -1,14 +1,13 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); function O(X) { let cow = function (x) { - return Curry._1(X.foo, x); + return X.foo(x); }; let sheep = function (x) { - return 1 + Curry._1(X.foo, x) | 0; + return 1 + X.foo(x) | 0; }; return { cow: cow, @@ -18,10 +17,10 @@ function O(X) { function F(X, Y) { let cow = function (x) { - return Curry._1(Y.foo, Curry._1(X.foo, x)); + return Y.foo(X.foo(x)); }; let sheep = function (x) { - return 1 + Curry._1(Y.foo, Curry._1(X.foo, x)) | 0; + return 1 + cow(x) | 0; }; return { cow: cow, @@ -30,8 +29,11 @@ function F(X, Y) { } function F1(X, Y) { + let cow = function (x) { + return Y.foo(X.foo(x)); + }; let sheep = function (x) { - return 1 + Curry._1(Y.foo, Curry._1(X.foo, x)) | 0; + return 1 + cow(x) | 0; }; return { sheep: sheep @@ -39,8 +41,11 @@ function F1(X, Y) { } function F2(X, Y) { + let cow = function (x) { + return Y.foo(X.foo(x)); + }; let sheep = function (x) { - return 1 + Curry._1(Y.foo, Curry._1(X.foo, x)) | 0; + return 1 + cow(x) | 0; }; return { sheep: sheep @@ -49,8 +54,11 @@ function F2(X, Y) { let M = { F: (function (funarg, funarg$1) { + let cow = function (x) { + return funarg$1.foo(funarg.foo(x)); + }; let sheep = function (x) { - return 1 + Curry._1(funarg$1.foo, Curry._1(funarg.foo, x)) | 0; + return 1 + cow(x) | 0; }; return { sheep: sheep diff --git a/jscomp/test/global_module_alias_test.js b/jscomp/test/global_module_alias_test.js index b0c757dba9..99890d07ea 100644 --- a/jscomp/test/global_module_alias_test.js +++ b/jscomp/test/global_module_alias_test.js @@ -3,7 +3,6 @@ let Mt = require("./mt.js"); let List = require("../../lib/js/list.js"); -let Curry = require("../../lib/js/curry.js"); let suites = { contents: /* [] */0 @@ -18,7 +17,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -41,7 +40,7 @@ function Make(U) { return U; } -function f(param) { +function f() { v.contents = v.contents + 1 | 0; v.contents = v.contents + 1 | 0; v.contents = v.contents + 1 | 0; @@ -87,7 +86,7 @@ let H = List; eq("File \"global_module_alias_test.res\", line 52, characters 12-19", v.contents, 12); -function g(param) { +function g() { return List.length({ hd: 1, tl: { @@ -103,7 +102,7 @@ function g(param) { }); } -function xx(param) { +function xx() { v.contents = v.contents + 1 | 0; v.contents = v.contents + 1 | 0; v.contents = v.contents + 1 | 0; @@ -114,7 +113,7 @@ eq("File \"global_module_alias_test.res\", line 80, characters 12-19", g(), 4); let V = xx(); -eq("File \"global_module_alias_test.res\", line 84, characters 5-12", Curry._1(V.length, { +eq("File \"global_module_alias_test.res\", line 84, characters 5-12", V.length({ hd: 1, tl: { hd: 2, @@ -129,7 +128,7 @@ eq("File \"global_module_alias_test.res\", line 85, characters 5-12", v.contents let H$1 = f(); -eq("File \"global_module_alias_test.res\", line 87, characters 5-12", Curry._1(H$1.length, { +eq("File \"global_module_alias_test.res\", line 87, characters 5-12", H$1.length({ hd: 1, tl: { hd: 2, diff --git a/jscomp/test/google_closure_test.js b/jscomp/test/google_closure_test.js index 922111d0a7..488df56280 100644 --- a/jscomp/test/google_closure_test.js +++ b/jscomp/test/google_closure_test.js @@ -7,7 +7,7 @@ let Test_google_closure = require("./test_google_closure.js"); Mt.from_pair_suites("Closure", { hd: [ "partial", - (function (param) { + (function () { return { TAG: "Eq", _0: [ diff --git a/jscomp/test/gpr496_test.js b/jscomp/test/gpr496_test.js index d00555cf45..89eb671d8d 100644 --- a/jscomp/test/gpr496_test.js +++ b/jscomp/test/gpr496_test.js @@ -3,7 +3,6 @@ let Mt = require("./mt.js"); let Caml = require("../../lib/js/caml.js"); -let Curry = require("../../lib/js/curry.js"); let suites = { contents: /* [] */0 @@ -18,7 +17,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -68,7 +67,7 @@ eq("File \"gpr496_test.res\", line 32, characters 12-19", expected, u); eq("File \"gpr496_test.res\", line 34, characters 12-19", expected, expected2); function ff(x, y) { - return Caml.bool_min(x, Curry._1(y, undefined)); + return Caml.bool_min(x, y()); } eq("File \"gpr496_test.res\", line 37, characters 12-19", true < false ? true : false, false); diff --git a/jscomp/test/gpr_1154_test.js b/jscomp/test/gpr_1154_test.js index 5313e06294..96e585681a 100644 --- a/jscomp/test/gpr_1154_test.js +++ b/jscomp/test/gpr_1154_test.js @@ -18,7 +18,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -52,7 +52,7 @@ function g2(x) { return Caml_int64.or_(x, (v.contents = v.contents + 1 | 0, x)); } -let a = Caml_int64.or_(Int64.one, (v.contents = v.contents + 1 | 0, Int64.one)); +let a = g2(Int64.one); eq("File \"gpr_1154_test.res\", line 28, characters 12-19", v.contents, 1); diff --git a/jscomp/test/gpr_1245_test.js b/jscomp/test/gpr_1245_test.js index faa9bb19a7..3ad00c8c05 100644 --- a/jscomp/test/gpr_1245_test.js +++ b/jscomp/test/gpr_1245_test.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); @@ -23,12 +22,12 @@ function f(param) { console.log(a, b); } -function g(param) { +function g() { return 3; } function a0(f) { - let u = Curry._1(f, undefined); + let u = f(); if (u !== null) { console.log(u); console.log(u); @@ -41,7 +40,7 @@ function a0(f) { function a1(f) { let E = /* @__PURE__ */Caml_exceptions.create("E"); try { - return Curry._1(f, undefined); + return f(); } catch (raw_exn){ let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); diff --git a/jscomp/test/gpr_1268.js b/jscomp/test/gpr_1268.js index 883fd90291..ffc1dafced 100644 --- a/jscomp/test/gpr_1268.js +++ b/jscomp/test/gpr_1268.js @@ -1,18 +1,17 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); function f_add2(a, b, x, y) { - return add(Curry._1(b, y), Curry._1(a, x)); + return add(b(y), a(x)); } function f(a, b, x, y) { - return Curry._1(a, x) + Curry._1(b, y) | 0; + return a(x) + b(y) | 0; } function f1(a, b, x, y) { - return add(Curry._1(a, x), Curry._1(b, y)); + return add(a(x), b(y)); } function f2(x) { diff --git a/jscomp/test/gpr_1409_test.js b/jscomp/test/gpr_1409_test.js index d438928556..ec0b717f46 100644 --- a/jscomp/test/gpr_1409_test.js +++ b/jscomp/test/gpr_1409_test.js @@ -3,7 +3,6 @@ let Mt = require("./mt.js"); let $$Array = require("../../lib/js/array.js"); -let Curry = require("../../lib/js/curry.js"); let String_set = require("./string_set.js"); let Caml_option = require("../../lib/js/caml_option.js"); @@ -20,7 +19,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -40,7 +39,7 @@ let b = { function map(f, x) { if (x !== undefined) { - return Caml_option.some(Curry._1(f, Caml_option.valFromOption(x))); + return Caml_option.some(f(Caml_option.valFromOption(x))); } } @@ -102,11 +101,11 @@ function test5(f, x) { let tmp = { hi: 2 }; - let tmp$1 = Curry._1(f, x); + let tmp$1 = f(x); if (tmp$1 !== undefined) { tmp._open = tmp$1; } - let tmp$2 = Curry._1(f, x); + let tmp$2 = f(x); if (tmp$2 !== undefined) { tmp.xx__hi = tmp$2; } diff --git a/jscomp/test/gpr_1423_app_test.js b/jscomp/test/gpr_1423_app_test.js index 20b6db0834..fee9718e51 100644 --- a/jscomp/test/gpr_1423_app_test.js +++ b/jscomp/test/gpr_1423_app_test.js @@ -2,8 +2,6 @@ 'use strict'; let Mt = require("./mt.js"); -let Curry = require("../../lib/js/curry.js"); -let Gpr_1423_nav = require("./gpr_1423_nav.js"); let suites = { contents: /* [] */0 @@ -18,7 +16,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -31,20 +29,20 @@ function eq(loc, x, y) { } function foo(f) { - console.log(Curry._2(f, "a1", undefined)); + console.log(f("a1", undefined)); } -foo(function (param) { - return function (param$1) { - return Gpr_1423_nav.busted(param, "a2", param$1); - }; +foo(function (none, extra) { + return none + "a2"; }); function foo2(f) { - return Curry._2(f, "a1", undefined); + return f("a1", undefined); } -eq("File \"gpr_1423_app_test.res\", line 15, characters 12-19", "a1a2", "a1a2"); +eq("File \"gpr_1423_app_test.res\", line 15, characters 12-19", (function (none, extra) { + return none + "a2"; +})("a1", undefined), "a1a2"); Mt.from_pair_suites("Gpr_1423_app_test", suites.contents); diff --git a/jscomp/test/gpr_1481.js b/jscomp/test/gpr_1481.js index abdd9f8224..71d2813dd7 100644 --- a/jscomp/test/gpr_1481.js +++ b/jscomp/test/gpr_1481.js @@ -3,7 +3,7 @@ let Moduleid = require("#moduleid"); -function f(param) { +function f() { return Moduleid.name; } diff --git a/jscomp/test/gpr_1503_test.js b/jscomp/test/gpr_1503_test.js index e74ed31179..41af088b96 100644 --- a/jscomp/test/gpr_1503_test.js +++ b/jscomp/test/gpr_1503_test.js @@ -19,7 +19,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/gpr_1658_test.js b/jscomp/test/gpr_1658_test.js index 100bef7e91..22768108a3 100644 --- a/jscomp/test/gpr_1658_test.js +++ b/jscomp/test/gpr_1658_test.js @@ -17,7 +17,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/gpr_1667_test.js b/jscomp/test/gpr_1667_test.js index 3f998c6183..75efb35a82 100644 --- a/jscomp/test/gpr_1667_test.js +++ b/jscomp/test/gpr_1667_test.js @@ -16,7 +16,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -28,6 +28,10 @@ function eq(loc, x, y) { }; } +(function (z) { + return 0; +})(false) === 0; + eq("File \"gpr_1667_test.res\", line 24, characters 5-12", 0, 0); Mt.from_pair_suites("Gpr_1667_test", suites.contents); diff --git a/jscomp/test/gpr_1692_test.js b/jscomp/test/gpr_1692_test.js index d856702bfe..ba792ec3b4 100644 --- a/jscomp/test/gpr_1692_test.js +++ b/jscomp/test/gpr_1692_test.js @@ -1,2 +1,11 @@ // Generated by ReScript, PLEASE EDIT WITH CARE -/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */ +'use strict'; + + +(function (x) { + return function (f) { + return 0; + }; +})("")(""); + +/* Not a pure module */ diff --git a/jscomp/test/gpr_1716_test.js b/jscomp/test/gpr_1716_test.js index 5bc111d5e9..ae4d162250 100644 --- a/jscomp/test/gpr_1716_test.js +++ b/jscomp/test/gpr_1716_test.js @@ -17,7 +17,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/gpr_1728_test.js b/jscomp/test/gpr_1728_test.js index f16ea44529..90f5f5fa50 100644 --- a/jscomp/test/gpr_1728_test.js +++ b/jscomp/test/gpr_1728_test.js @@ -17,7 +17,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/gpr_1749_test.js b/jscomp/test/gpr_1749_test.js index 51d6d79c68..c0df289865 100644 --- a/jscomp/test/gpr_1749_test.js +++ b/jscomp/test/gpr_1749_test.js @@ -16,7 +16,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/gpr_1760_test.js b/jscomp/test/gpr_1760_test.js index 4f2ea803ad..e5a68ca3a2 100644 --- a/jscomp/test/gpr_1760_test.js +++ b/jscomp/test/gpr_1760_test.js @@ -18,7 +18,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/gpr_1762_test.js b/jscomp/test/gpr_1762_test.js index eade611bfc..99d10508f4 100644 --- a/jscomp/test/gpr_1762_test.js +++ b/jscomp/test/gpr_1762_test.js @@ -16,7 +16,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -32,7 +32,7 @@ let v = { contents: 3 }; -function update(param) { +function update() { v.contents = v.contents + 1 | 0; return true; } diff --git a/jscomp/test/gpr_1817_test.js b/jscomp/test/gpr_1817_test.js index d5a3941fcc..f28147a06b 100644 --- a/jscomp/test/gpr_1817_test.js +++ b/jscomp/test/gpr_1817_test.js @@ -17,7 +17,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -29,7 +29,7 @@ function eq(loc, x, y) { }; } -function f(param) { +function f() { let x = new Date(); let y = new Date(); return [ diff --git a/jscomp/test/gpr_1822_test.js b/jscomp/test/gpr_1822_test.js index 333bf62326..73e3a281bb 100644 --- a/jscomp/test/gpr_1822_test.js +++ b/jscomp/test/gpr_1822_test.js @@ -16,7 +16,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/gpr_1891_test.js b/jscomp/test/gpr_1891_test.js index 2237c480ad..0be949d234 100644 --- a/jscomp/test/gpr_1891_test.js +++ b/jscomp/test/gpr_1891_test.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); function foo(x) { if (typeof x === "object" && x.NAME === "Foo" && x.VAL === 3) { @@ -29,7 +28,7 @@ function foo3(x) { function foo4(x, h) { if (typeof x === "object" && x.NAME === "Foo" && x.VAL === 3) { - return Curry._1(h, undefined); + return h(); } } diff --git a/jscomp/test/gpr_1943_test.js b/jscomp/test/gpr_1943_test.js index cc0e287369..49cadb62cf 100644 --- a/jscomp/test/gpr_1943_test.js +++ b/jscomp/test/gpr_1943_test.js @@ -16,7 +16,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/gpr_2316_test.js b/jscomp/test/gpr_2316_test.js index 3cf2d8204d..6d6b817ecd 100644 --- a/jscomp/test/gpr_2316_test.js +++ b/jscomp/test/gpr_2316_test.js @@ -17,7 +17,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/gpr_2614_test.js b/jscomp/test/gpr_2614_test.js index 7bbb9b9c1b..81a8745f08 100644 --- a/jscomp/test/gpr_2614_test.js +++ b/jscomp/test/gpr_2614_test.js @@ -13,7 +13,7 @@ let b = v.l; let c = v.open; -function ff(param) { +function ff() { v["Content-Type"] = 3; v.l = 2; } diff --git a/jscomp/test/gpr_2633_test.js b/jscomp/test/gpr_2633_test.js index ac7f5d007c..43ff22b9d0 100644 --- a/jscomp/test/gpr_2633_test.js +++ b/jscomp/test/gpr_2633_test.js @@ -1,14 +1,13 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); function on1(foo, event) { foo.on(event.NAME, event.VAL); } function on2(foo, h, event) { - foo.on(Curry._1(h, event).NAME, Curry._1(h, event).VAL); + foo.on(h(event).NAME, h(event).VAL); } exports.on1 = on1; diff --git a/jscomp/test/gpr_2731_test.js b/jscomp/test/gpr_2731_test.js index 0226d7729c..dc4a63ff60 100644 --- a/jscomp/test/gpr_2731_test.js +++ b/jscomp/test/gpr_2731_test.js @@ -10,7 +10,7 @@ let a = f(1); let b = f(2); -function g(param) { +function g() { return 1; } diff --git a/jscomp/test/gpr_3492_test.js b/jscomp/test/gpr_3492_test.js index 80ed2b1bb2..2778593e60 100644 --- a/jscomp/test/gpr_3492_test.js +++ b/jscomp/test/gpr_3492_test.js @@ -18,7 +18,7 @@ function eq(loc, x, y) { function foo(a){return a()} ; -function fn(param) { +function fn() { console.log("hi"); return 1; } diff --git a/jscomp/test/gpr_3536_test.js b/jscomp/test/gpr_3536_test.js index 51f486cf3f..e07b0156a2 100644 --- a/jscomp/test/gpr_3536_test.js +++ b/jscomp/test/gpr_3536_test.js @@ -2,7 +2,6 @@ 'use strict'; let Mt = require("./mt.js"); -let Curry = require("../../lib/js/curry.js"); let suites = { contents: /* [] */0 @@ -19,7 +18,7 @@ function eq(loc, x, y) { let X = {}; function xx(obj, a0, a1, a2, a3, a4, a5) { - return (Curry._2(a4, Curry._2(a2, Curry._2(a0, obj, a1), a3), a5) - 1 | 0) - 3 | 0; + return (a4(a2(a0(obj, a1), a3), a5) - 1 | 0) - 3 | 0; } eq("File \"gpr_3536_test.res\", line 18, characters 12-19", 5, 5); diff --git a/jscomp/test/gpr_3566_test.js b/jscomp/test/gpr_3566_test.js index 6bcf903005..5604508e53 100644 --- a/jscomp/test/gpr_3566_test.js +++ b/jscomp/test/gpr_3566_test.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); let Caml_option = require("../../lib/js/caml_option.js"); @@ -105,24 +104,24 @@ function Test7($star) { } function Test8($star) { - let Curry$1 = {}; + let Curry = {}; let f = function (x) { - return Curry._1(x, 1); + return x(1); }; return { - Curry: Curry$1, + Curry: Curry, f: f }; } function Test9($star) { let f = function (x) { - return Curry._1(x, 1); + return x(1); }; - let Curry$1 = {}; + let Curry = {}; return { f: f, - Curry: Curry$1 + Curry: Curry }; } diff --git a/jscomp/test/gpr_3697_test.js b/jscomp/test/gpr_3697_test.js index aa3d0f7474..1d38845ec9 100644 --- a/jscomp/test/gpr_3697_test.js +++ b/jscomp/test/gpr_3697_test.js @@ -1,14 +1,13 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; +let Lazy = require("../../lib/js/lazy.js"); let CamlinternalLazy = require("../../lib/js/camlinternalLazy.js"); -function fix(param) { +function fix() { return { TAG: "Fix", - _0: CamlinternalLazy.from_fun(function () { - return fix(); - }) + _0: Lazy.from_fun(fix) }; } diff --git a/jscomp/test/gpr_3875_test.js b/jscomp/test/gpr_3875_test.js index 404c98f932..abb933adc3 100644 --- a/jscomp/test/gpr_3875_test.js +++ b/jscomp/test/gpr_3875_test.js @@ -2,7 +2,6 @@ 'use strict'; let Mt = require("./mt.js"); -let Curry = require("../../lib/js/curry.js"); let result = { contents: "" @@ -18,32 +17,31 @@ let Xx = { function compilerBug(a, b, c, f) { let exit = 0; - if (a !== "x") { + let exit$1 = 0; + if (a === "x") { exit = 2; + } else { + exit$1 = 3; } - if (exit === 2) { - if (b === undefined) { - if (c) { - result.contents = "No x, c is true"; - } else { - result.contents = "No x, c is false"; - } - return; - } - if (b !== "x") { - if (c) { - result.contents = "No x, c is true"; - } else { - result.contents = "No x, c is false"; - } - return; - } - + if (exit$1 === 3) { + exit = b === "x" ? 2 : 1; } - if (Curry._1(f, undefined)) { - result.contents = "Some x, f returns true"; - } else { - result.contents = "Some x, f returns false"; + switch (exit) { + case 1 : + if (c) { + result.contents = "No x, c is true"; + } else { + result.contents = "No x, c is false"; + } + return; + case 2 : + if (f()) { + result.contents = "Some x, f returns true"; + } else { + result.contents = "Some x, f returns false"; + } + return; + } } @@ -59,7 +57,7 @@ function eq(loc, x, y) { Mt.eq_suites(test_id, suites, loc, x, y); } -compilerBug("x", undefined, true, (function (param) { +compilerBug("x", undefined, true, (function () { return true; })); diff --git a/jscomp/test/gpr_3931_test.js b/jscomp/test/gpr_3931_test.js index 7c6e386b5f..cba2beac9b 100644 --- a/jscomp/test/gpr_3931_test.js +++ b/jscomp/test/gpr_3931_test.js @@ -2,7 +2,6 @@ 'use strict'; let $$Array = require("../../lib/js/array.js"); -let Curry = require("../../lib/js/curry.js"); let Caml_module = require("../../lib/js/caml_module.js"); let PA = Caml_module.init_mod([ @@ -57,7 +56,7 @@ Caml_module.update_mod({ print: print$1 }); -Curry._1(PA.print, [ +PA.print([ 1, 2 ]); diff --git a/jscomp/test/gpr_405_test.js b/jscomp/test/gpr_405_test.js index 072699a11f..a27fad4498 100644 --- a/jscomp/test/gpr_405_test.js +++ b/jscomp/test/gpr_405_test.js @@ -2,7 +2,6 @@ 'use strict'; let Caml = require("../../lib/js/caml.js"); -let Curry = require("../../lib/js/curry.js"); let Hashtbl = require("../../lib/js/hashtbl.js"); let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); @@ -14,7 +13,7 @@ function Make(funarg) { }); let find_default = function (htbl, x) { try { - return Curry._2(H.find, htbl, x); + return H.find(htbl, x); } catch (raw_exn){ let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); @@ -27,10 +26,10 @@ function Make(funarg) { } }; let min_cutset = function (gr, first_node) { - let n_labels = Curry._1(H.create, 97); - let l_labels = Curry._1(H.create, 97); - let already_processed = Curry._1(H.create, 97); - let on_the_stack = Curry._1(H.create, 97); + let n_labels = H.create(97); + let l_labels = H.create(97); + let already_processed = H.create(97); + let on_the_stack = H.create(97); let cut_set = { contents: /* [] */0 }; @@ -62,12 +61,12 @@ function Make(funarg) { } }); } - Curry._3(H.add, on_the_stack, top, true); - Curry._3(H.add, n_labels, top, counter.contents); + H.add(on_the_stack, top, true); + H.add(n_labels, top, counter.contents); counter.contents = counter.contents + 1 | 0; - Curry._3(H.add, l_labels, top, 0); - Curry._3(H.add, already_processed, top, true); - let _successors = Curry._2(funarg.succ, gr, top); + H.add(l_labels, top, 0); + H.add(already_processed, top, true); + let _successors = funarg.succ(gr, top); let _top = top; let _rest_of_stack = rest_of_stack; while(true) { @@ -85,19 +84,19 @@ function Make(funarg) { tl: rest_of_stack$1 }); } - let x = find_default(on_the_stack, successor) ? Curry._2(H.find, n_labels, successor) : Curry._2(H.find, l_labels, successor); - Curry._3(H.add, l_labels, top$1, Caml.int_max(Curry._2(H.find, l_labels, top$1), x)); + let x = find_default(on_the_stack, successor) ? H.find(n_labels, successor) : H.find(l_labels, successor); + H.add(l_labels, top$1, Caml.int_max(H.find(l_labels, top$1), x)); _successors = successors.tl; continue; } - if (Curry._2(H.find, l_labels, top$1) === Curry._2(H.find, n_labels, top$1)) { + if (H.find(l_labels, top$1) === H.find(n_labels, top$1)) { cut_set.contents = { hd: top$1, tl: cut_set.contents }; - Curry._3(H.add, l_labels, top$1, 0); + H.add(l_labels, top$1, 0); } - if (Curry._2(H.find, l_labels, top$1) > Curry._2(H.find, n_labels, top$1)) { + if (H.find(l_labels, top$1) > H.find(n_labels, top$1)) { throw new Error("Invalid_argument", { cause: { RE_EXN_ID: "Invalid_argument", @@ -110,8 +109,8 @@ function Make(funarg) { } let match = rest_of_stack$1.hd; let new_top = match[0]; - Curry._3(H.add, on_the_stack, top$1, false); - Curry._3(H.add, l_labels, new_top, Caml.int_max(Curry._2(H.find, l_labels, top$1), Curry._2(H.find, l_labels, new_top))); + H.add(on_the_stack, top$1, false); + H.add(l_labels, new_top, Caml.int_max(H.find(l_labels, top$1), H.find(l_labels, new_top))); _rest_of_stack = rest_of_stack$1.tl; _top = new_top; _successors = match[1]; @@ -126,4 +125,4 @@ function Make(funarg) { } exports.Make = Make; -/* No side effect */ +/* Hashtbl Not a pure module */ diff --git a/jscomp/test/gpr_4069_test.js b/jscomp/test/gpr_4069_test.js index bbb85781f4..6f99c9ae1b 100644 --- a/jscomp/test/gpr_4069_test.js +++ b/jscomp/test/gpr_4069_test.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); function f(value) { if (value == null) { @@ -12,7 +11,7 @@ function f(value) { } function fxx(v) { - let match = Curry._1(v, undefined); + let match = v(); switch (match) { case 1 : return /* 'a' */97; @@ -26,7 +25,7 @@ function fxx(v) { } function fxxx2(v) { - if (Curry._1(v, undefined)) { + if (v()) { return 2; } else { return 1; @@ -34,7 +33,7 @@ function fxxx2(v) { } function fxxx3(v) { - if (Curry._1(v, undefined)) { + if (v()) { return 2; } else { return 1; diff --git a/jscomp/test/gpr_4265_test.js b/jscomp/test/gpr_4265_test.js index 56b6ad3757..f40f38c687 100644 --- a/jscomp/test/gpr_4265_test.js +++ b/jscomp/test/gpr_4265_test.js @@ -3,7 +3,6 @@ let Mt = require("./mt.js"); let Belt_MutableMapInt = require("../../lib/js/belt_MutableMapInt.js"); -let Belt_internalMapInt = require("../../lib/js/belt_internalMapInt.js"); let suites = { contents: /* [] */0 @@ -38,7 +37,7 @@ add(486); Belt_MutableMapInt.remove(mockMap, 1726); -let n1 = Belt_internalMapInt.getExn(mockMap.data, 6667); +let n1 = Belt_MutableMapInt.getExn(mockMap, 6667); eq("File \"gpr_4265_test.res\", line 18, characters 3-10", n, n1); @@ -52,4 +51,4 @@ exports.add = add; exports.remove = remove; exports.n = n; exports.n1 = n1; -/* Not a pure module */ +/* mockMap Not a pure module */ diff --git a/jscomp/test/gpr_459_test.js b/jscomp/test/gpr_459_test.js index 327b55d68c..3284e178ee 100644 --- a/jscomp/test/gpr_459_test.js +++ b/jscomp/test/gpr_459_test.js @@ -16,7 +16,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/gpr_858_unit2_test.js b/jscomp/test/gpr_858_unit2_test.js index 8f3e47dfa4..5a84b19c17 100644 --- a/jscomp/test/gpr_858_unit2_test.js +++ b/jscomp/test/gpr_858_unit2_test.js @@ -1,10 +1,9 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let delayed = { - contents: (function (param) { + contents: (function () { }) }; @@ -13,8 +12,8 @@ for(let i = 1; i <= 2; ++i){ let f = function (n, x) { if (x !== 0) { let prev = delayed.contents; - delayed.contents = (function (param) { - Curry._1(prev, undefined); + delayed.contents = (function () { + prev(); f(((n + 1 | 0) + i | 0) - i | 0, x - 1 | 0); }); return; @@ -36,6 +35,6 @@ for(let i = 1; i <= 2; ++i){ f(0, i); } -Curry._1(delayed.contents, undefined); +delayed.contents(); /* Not a pure module */ diff --git a/jscomp/test/gpr_904_test.js b/jscomp/test/gpr_904_test.js index f00953f8ee..f130ac5a27 100644 --- a/jscomp/test/gpr_904_test.js +++ b/jscomp/test/gpr_904_test.js @@ -16,7 +16,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/gpr_977_test.js b/jscomp/test/gpr_977_test.js index c1032909f3..b8056514fd 100644 --- a/jscomp/test/gpr_977_test.js +++ b/jscomp/test/gpr_977_test.js @@ -17,7 +17,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/guide_for_ext.js b/jscomp/test/guide_for_ext.js index 61646a7caa..54cb1abb17 100644 --- a/jscomp/test/guide_for_ext.js +++ b/jscomp/test/guide_for_ext.js @@ -2,7 +2,7 @@ 'use strict'; -function mk(param) { +function mk() { return { text: 32, label: "hel" diff --git a/jscomp/test/hash_sugar_desugar.js b/jscomp/test/hash_sugar_desugar.js index 3d903dcf61..32667634e3 100644 --- a/jscomp/test/hash_sugar_desugar.js +++ b/jscomp/test/hash_sugar_desugar.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); function h1(u) { return u.p; @@ -9,7 +8,7 @@ function h1(u) { function h3(u) { let f = u.hi; - return Curry._2(f, 1, 2); + return f(1, 2); } function g5(u) { @@ -30,7 +29,7 @@ function h7(u) { function h8(u) { let f = u.hi; - return Curry._2(f, 1, 2); + return f(1, 2); } function chain_g(h) { diff --git a/jscomp/test/hashtbl_test.js b/jscomp/test/hashtbl_test.js index 4b7983a031..c64c09f5b9 100644 --- a/jscomp/test/hashtbl_test.js +++ b/jscomp/test/hashtbl_test.js @@ -20,13 +20,14 @@ function to_list(tbl) { }), tbl, /* [] */0); } -function f(param) { +function f() { let tbl = Hashtbl.create(undefined, 17); Hashtbl.add(tbl, 1, /* '1' */49); Hashtbl.add(tbl, 2, /* '2' */50); + let extra = to_list(tbl); return List.sort((function (param, param$1) { return Caml.int_compare(param[0], param$1[0]); - }), to_list(tbl)); + }), extra); } function g(count) { @@ -38,9 +39,10 @@ function g(count) { Hashtbl.replace(tbl, (i$1 << 1), String(i$1)); } let v = to_list(tbl); - return $$Array.of_list(List.sort((function (param, param$1) { + let v$1 = List.sort((function (param, param$1) { return Caml.int_compare(param[0], param$1[0]); - }), v)); + }), v); + return $$Array.of_list(v$1); } let suites_0 = [ diff --git a/jscomp/test/ignore_test.js b/jscomp/test/ignore_test.js index 1665fc6e6f..a32d149c2b 100644 --- a/jscomp/test/ignore_test.js +++ b/jscomp/test/ignore_test.js @@ -16,7 +16,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/imm_map_bench.js b/jscomp/test/imm_map_bench.js index 6cc1b2f8fa..6878124c1f 100644 --- a/jscomp/test/imm_map_bench.js +++ b/jscomp/test/imm_map_bench.js @@ -32,14 +32,14 @@ let shuffledDataAdd = Belt_Array.makeByAndShuffle(1000001, (function (i) { ]; })); -function test(param) { +function test() { let v = fromArray(shuffledDataAdd); for(let j = 0; j <= 1000000; ++j){ should(v.has(j)); } } -function test2(param) { +function test2() { let v = Belt_MapInt.fromArray(shuffledDataAdd); for(let j = 0; j <= 1000000; ++j){ should(Belt_MapInt.has(v, j)); diff --git a/jscomp/test/incomplete_toplevel_test.js b/jscomp/test/incomplete_toplevel_test.js index d9c1d15a84..0d65fa6c4d 100644 --- a/jscomp/test/incomplete_toplevel_test.js +++ b/jscomp/test/incomplete_toplevel_test.js @@ -2,7 +2,7 @@ 'use strict'; -function f(param) { +function f() { console.log("no inline"); return [ 1, diff --git a/jscomp/test/inline_map2_test.js b/jscomp/test/inline_map2_test.js index 27ddb0a47d..cbf6192f59 100644 --- a/jscomp/test/inline_map2_test.js +++ b/jscomp/test/inline_map2_test.js @@ -4,7 +4,6 @@ let Mt = require("./mt.js"); let Caml = require("../../lib/js/caml.js"); let List = require("../../lib/js/list.js"); -let Curry = require("../../lib/js/curry.js"); let Caml_option = require("../../lib/js/caml_option.js"); function Make(Ord) { @@ -125,7 +124,7 @@ function Make(Ord) { let d = x_._2; let v = x_._1; let l = x_._0; - let c = Curry._2(Ord.compare, x, v); + let c = Ord.compare(x, v); if (c === 0) { return { TAG: "Node", @@ -151,7 +150,7 @@ function Make(Ord) { } }); } - let c = Curry._2(Ord.compare, x, x_._1); + let c = Ord.compare(x, x_._1); if (c === 0) { return x_._2; } @@ -165,7 +164,7 @@ function Make(Ord) { if (typeof x_ !== "object") { return false; } - let c = Curry._2(Ord.compare, x, x_._1); + let c = Ord.compare(x, x_._1); if (c === 0) { return true; } @@ -239,7 +238,7 @@ function Make(Ord) { let d = x_._2; let v = x_._1; let l = x_._0; - let c = Curry._2(Ord.compare, x, v); + let c = Ord.compare(x, v); if (c === 0) { if (typeof l !== "object") { return r; @@ -262,7 +261,7 @@ function Make(Ord) { return; } iter(f, x._0); - Curry._2(f, x._1, x._2); + f(x._1, x._2); _x = x._3; continue; }; @@ -272,7 +271,7 @@ function Make(Ord) { return "Empty"; } let l$p = map(f, x._0); - let d$p = Curry._1(f, x._2); + let d$p = f(x._2); let r$p = map(f, x._3); return { TAG: "Node", @@ -289,7 +288,7 @@ function Make(Ord) { } let v = x._1; let l$p = mapi(f, x._0); - let d$p = Curry._2(f, v, x._2); + let d$p = f(v, x._2); let r$p = mapi(f, x._3); return { TAG: "Node", @@ -307,7 +306,7 @@ function Make(Ord) { if (typeof m !== "object") { return accu; } - _accu = Curry._3(f, m._1, m._2, fold(f, m._0, accu)); + _accu = f(m._1, m._2, fold(f, m._0, accu)); _m = m._3; continue; }; @@ -318,7 +317,7 @@ function Make(Ord) { if (typeof x !== "object") { return true; } - if (!Curry._2(p, x._1, x._2)) { + if (!p(x._1, x._2)) { return false; } if (!for_all(p, x._0)) { @@ -334,7 +333,7 @@ function Make(Ord) { if (typeof x !== "object") { return false; } - if (Curry._2(p, x._1, x._2)) { + if (p(x._1, x._2)) { return true; } if (exists(p, x._0)) { @@ -404,7 +403,7 @@ function Make(Ord) { let d = x_._2; let v = x_._1; let l = x_._0; - let c = Curry._2(Ord.compare, x, v); + let c = Ord.compare(x, v); if (c === 0) { return [ l, @@ -437,7 +436,7 @@ function Make(Ord) { let v1 = s1._1; if (s1._4 >= height(s2)) { let match = split(v1, s2); - return concat_or_join(merge(f, s1._0, match[0]), v1, Curry._3(f, v1, Caml_option.some(s1._2), match[1]), merge(f, s1._3, match[2])); + return concat_or_join(merge(f, s1._0, match[0]), v1, f(v1, Caml_option.some(s1._2), match[1]), merge(f, s1._3, match[2])); } } @@ -455,7 +454,7 @@ function Make(Ord) { } let v2 = s2._1; let match$1 = split(v2, s1); - return concat_or_join(merge(f, match$1[0], s2._0), v2, Curry._3(f, v2, match$1[1], Caml_option.some(s2._2)), merge(f, match$1[2], s2._3)); + return concat_or_join(merge(f, match$1[0], s2._0), v2, f(v2, match$1[1], Caml_option.some(s2._2)), merge(f, match$1[2], s2._3)); }; let filter = function (p, x) { if (typeof x !== "object") { @@ -464,7 +463,7 @@ function Make(Ord) { let d = x._2; let v = x._1; let l$p = filter(p, x._0); - let pvd = Curry._2(p, v, d); + let pvd = p(v, d); let r$p = filter(p, x._3); if (pvd) { return join(l$p, v, d, r$p); @@ -484,7 +483,7 @@ function Make(Ord) { let match = partition(p, x._0); let lf = match[1]; let lt = match[0]; - let pvd = Curry._2(p, v, d); + let pvd = p(v, d); let match$1 = partition(p, x._3); let rf = match$1[1]; let rt = match$1[0]; @@ -534,11 +533,11 @@ function Make(Ord) { if (typeof e2 !== "object") { return 1; } - let c = Curry._2(Ord.compare, e1._0, e2._0); + let c = Ord.compare(e1._0, e2._0); if (c !== 0) { return c; } - let c$1 = Curry._2(cmp, e1._1, e2._1); + let c$1 = cmp(e1._1, e2._1); if (c$1 !== 0) { return c$1; } @@ -563,10 +562,10 @@ function Make(Ord) { if (typeof e2 !== "object") { return false; } - if (Curry._2(Ord.compare, e1._0, e2._0) !== 0) { + if (Ord.compare(e1._0, e2._0) !== 0) { return false; } - if (!Curry._2(cmp, e1._1, e2._1)) { + if (!cmp(e1._1, e2._1)) { return false; } _e2 = cons_enum(e2._2, e2._3); @@ -907,7 +906,7 @@ function iter(f, _x) { return; } iter(f, x._0); - Curry._2(f, x._1, x._2); + f(x._1, x._2); _x = x._3; continue; }; @@ -918,7 +917,7 @@ function map(f, x) { return "Empty"; } let l$p = map(f, x._0); - let d$p = Curry._1(f, x._2); + let d$p = f(x._2); let r$p = map(f, x._3); return { TAG: "Node", @@ -936,7 +935,7 @@ function mapi(f, x) { } let v = x._1; let l$p = mapi(f, x._0); - let d$p = Curry._2(f, v, x._2); + let d$p = f(v, x._2); let r$p = mapi(f, x._3); return { TAG: "Node", @@ -955,7 +954,7 @@ function fold(f, _m, _accu) { if (typeof m !== "object") { return accu; } - _accu = Curry._3(f, m._1, m._2, fold(f, m._0, accu)); + _accu = f(m._1, m._2, fold(f, m._0, accu)); _m = m._3; continue; }; @@ -967,7 +966,7 @@ function for_all(p, _x) { if (typeof x !== "object") { return true; } - if (!Curry._2(p, x._1, x._2)) { + if (!p(x._1, x._2)) { return false; } if (!for_all(p, x._0)) { @@ -984,7 +983,7 @@ function exists(p, _x) { if (typeof x !== "object") { return false; } - if (Curry._2(p, x._1, x._2)) { + if (p(x._1, x._2)) { return true; } if (exists(p, x._0)) { @@ -1094,7 +1093,7 @@ function merge(f, s1, s2) { let v1 = s1._1; if (s1._4 >= height(s2)) { let match = split(v1, s2); - return concat_or_join(merge(f, s1._0, match[0]), v1, Curry._3(f, v1, Caml_option.some(s1._2), match[1]), merge(f, s1._3, match[2])); + return concat_or_join(merge(f, s1._0, match[0]), v1, f(v1, Caml_option.some(s1._2), match[1]), merge(f, s1._3, match[2])); } } @@ -1112,7 +1111,7 @@ function merge(f, s1, s2) { } let v2 = s2._1; let match$1 = split(v2, s1); - return concat_or_join(merge(f, match$1[0], s2._0), v2, Curry._3(f, v2, match$1[1], Caml_option.some(s2._2)), merge(f, match$1[2], s2._3)); + return concat_or_join(merge(f, match$1[0], s2._0), v2, f(v2, match$1[1], Caml_option.some(s2._2)), merge(f, match$1[2], s2._3)); } function filter(p, x) { @@ -1122,7 +1121,7 @@ function filter(p, x) { let d = x._2; let v = x._1; let l$p = filter(p, x._0); - let pvd = Curry._2(p, v, d); + let pvd = p(v, d); let r$p = filter(p, x._3); if (pvd) { return join(l$p, v, d, r$p); @@ -1143,7 +1142,7 @@ function partition(p, x) { let match = partition(p, x._0); let lf = match[1]; let lt = match[0]; - let pvd = Curry._2(p, v, d); + let pvd = p(v, d); let match$1 = partition(p, x._3); let rf = match$1[1]; let rt = match$1[0]; @@ -1199,7 +1198,7 @@ function compare(cmp, m1, m2) { if (c !== 0) { return c; } - let c$1 = Curry._2(cmp, e1._1, e2._1); + let c$1 = cmp(e1._1, e2._1); if (c$1 !== 0) { return c$1; } @@ -1228,7 +1227,7 @@ function equal(cmp, m1, m2) { if (e1._0 !== e2._0) { return false; } - if (!Curry._2(cmp, e1._1, e2._1)) { + if (!cmp(e1._1, e2._1)) { return false; } _e2 = cons_enum(e2._2, e2._3); @@ -1600,7 +1599,7 @@ function iter$1(f, _x) { return; } iter$1(f, x._0); - Curry._2(f, x._1, x._2); + f(x._1, x._2); _x = x._3; continue; }; @@ -1611,7 +1610,7 @@ function map$1(f, x) { return "Empty"; } let l$p = map$1(f, x._0); - let d$p = Curry._1(f, x._2); + let d$p = f(x._2); let r$p = map$1(f, x._3); return { TAG: "Node", @@ -1629,7 +1628,7 @@ function mapi$1(f, x) { } let v = x._1; let l$p = mapi$1(f, x._0); - let d$p = Curry._2(f, v, x._2); + let d$p = f(v, x._2); let r$p = mapi$1(f, x._3); return { TAG: "Node", @@ -1648,7 +1647,7 @@ function fold$1(f, _m, _accu) { if (typeof m !== "object") { return accu; } - _accu = Curry._3(f, m._1, m._2, fold$1(f, m._0, accu)); + _accu = f(m._1, m._2, fold$1(f, m._0, accu)); _m = m._3; continue; }; @@ -1660,7 +1659,7 @@ function for_all$1(p, _x) { if (typeof x !== "object") { return true; } - if (!Curry._2(p, x._1, x._2)) { + if (!p(x._1, x._2)) { return false; } if (!for_all$1(p, x._0)) { @@ -1677,7 +1676,7 @@ function exists$1(p, _x) { if (typeof x !== "object") { return false; } - if (Curry._2(p, x._1, x._2)) { + if (p(x._1, x._2)) { return true; } if (exists$1(p, x._0)) { @@ -1787,7 +1786,7 @@ function merge$1(f, s1, s2) { let v1 = s1._1; if (s1._4 >= height$1(s2)) { let match = split$1(v1, s2); - return concat_or_join$1(merge$1(f, s1._0, match[0]), v1, Curry._3(f, v1, Caml_option.some(s1._2), match[1]), merge$1(f, s1._3, match[2])); + return concat_or_join$1(merge$1(f, s1._0, match[0]), v1, f(v1, Caml_option.some(s1._2), match[1]), merge$1(f, s1._3, match[2])); } } @@ -1805,7 +1804,7 @@ function merge$1(f, s1, s2) { } let v2 = s2._1; let match$1 = split$1(v2, s1); - return concat_or_join$1(merge$1(f, match$1[0], s2._0), v2, Curry._3(f, v2, match$1[1], Caml_option.some(s2._2)), merge$1(f, match$1[2], s2._3)); + return concat_or_join$1(merge$1(f, match$1[0], s2._0), v2, f(v2, match$1[1], Caml_option.some(s2._2)), merge$1(f, match$1[2], s2._3)); } function filter$1(p, x) { @@ -1815,7 +1814,7 @@ function filter$1(p, x) { let d = x._2; let v = x._1; let l$p = filter$1(p, x._0); - let pvd = Curry._2(p, v, d); + let pvd = p(v, d); let r$p = filter$1(p, x._3); if (pvd) { return join$1(l$p, v, d, r$p); @@ -1836,7 +1835,7 @@ function partition$1(p, x) { let match = partition$1(p, x._0); let lf = match[1]; let lt = match[0]; - let pvd = Curry._2(p, v, d); + let pvd = p(v, d); let match$1 = partition$1(p, x._3); let rf = match$1[1]; let rt = match$1[0]; @@ -1892,7 +1891,7 @@ function compare$1(cmp, m1, m2) { if (c !== 0) { return c; } - let c$1 = Curry._2(cmp, e1._1, e2._1); + let c$1 = cmp(e1._1, e2._1); if (c$1 !== 0) { return c$1; } @@ -1921,7 +1920,7 @@ function equal$1(cmp, m1, m2) { if (Caml.string_compare(e1._0, e2._0) !== 0) { return false; } - if (!Curry._2(cmp, e1._1, e2._1)) { + if (!cmp(e1._1, e2._1)) { return false; } _e2 = cons_enum$1(e2._2, e2._3); @@ -2030,7 +2029,7 @@ let s = List.fold_left((function (acc, param) { Mt.from_pair_suites("Inline_map2_test", { hd: [ "assertion1", - (function (param) { + (function () { return { TAG: "Eq", _0: find(10, m), @@ -2041,7 +2040,7 @@ Mt.from_pair_suites("Inline_map2_test", { tl: { hd: [ "assertion2", - (function (param) { + (function () { return { TAG: "Eq", _0: find$1("10", s), diff --git a/jscomp/test/inline_map_demo.js b/jscomp/test/inline_map_demo.js index 3c00e2308c..f79ef8e5ea 100644 --- a/jscomp/test/inline_map_demo.js +++ b/jscomp/test/inline_map_demo.js @@ -191,7 +191,7 @@ function find(px, _x) { Mt.from_pair_suites("Inline_map_demo", { hd: [ "find", - (function (param) { + (function () { return { TAG: "Eq", _0: find(10, m), diff --git a/jscomp/test/inline_map_test.js b/jscomp/test/inline_map_test.js index 0f1899e51f..8c9c73ae01 100644 --- a/jscomp/test/inline_map_test.js +++ b/jscomp/test/inline_map_test.js @@ -175,7 +175,7 @@ let m = List.fold_left((function (acc, param) { Mt.from_pair_suites("Inline_map_test", { hd: [ "find", - (function (param) { + (function () { return { TAG: "Eq", _0: find(10, m), diff --git a/jscomp/test/inline_regression_test.js b/jscomp/test/inline_regression_test.js index 9773b21ff2..f67cdb3232 100644 --- a/jscomp/test/inline_regression_test.js +++ b/jscomp/test/inline_regression_test.js @@ -2,7 +2,6 @@ 'use strict'; let Mt = require("./mt.js"); -let Curry = require("../../lib/js/curry.js"); let $$String = require("../../lib/js/string.js"); let Filename = require("../../lib/js/filename.js"); let Caml_string = require("../../lib/js/caml_string.js"); @@ -17,7 +16,7 @@ function generic_basename(is_dir_sep, current_dir_name, name) { if (n < 0) { return $$String.sub(name, 0, 1); } - if (!Curry._2(is_dir_sep, name, n)) { + if (!is_dir_sep(name, n)) { let _n$1 = n; let p = n + 1 | 0; while(true) { @@ -25,7 +24,7 @@ function generic_basename(is_dir_sep, current_dir_name, name) { if (n$1 < 0) { return $$String.sub(name, 0, p); } - if (Curry._2(is_dir_sep, name, n$1)) { + if (is_dir_sep(name, n$1)) { return $$String.sub(name, n$1 + 1 | 0, (p - n$1 | 0) - 1 | 0); } _n$1 = n$1 - 1 | 0; @@ -38,10 +37,10 @@ function generic_basename(is_dir_sep, current_dir_name, name) { } } -function basename(param) { +function basename(extra) { return generic_basename((function (s, i) { return Caml_string.get(s, i) === /* '/' */47; - }), Filename.current_dir_name, param); + }), Filename.current_dir_name, extra); } let suites_0 = [ diff --git a/jscomp/test/inline_string_test.js b/jscomp/test/inline_string_test.js index c81d1e60ac..09713e1294 100644 --- a/jscomp/test/inline_string_test.js +++ b/jscomp/test/inline_string_test.js @@ -22,7 +22,19 @@ console.log([ console.log([ "A", - "A" + (function (x) { + switch (x.TAG) { + case "A" : + return "A"; + case "B" : + return "B"; + default: + return "?"; + } + })({ + TAG: "A", + _0: 3 + }) ]); /* Not a pure module */ diff --git a/jscomp/test/installation_test.js b/jscomp/test/installation_test.js index 2a75e8e236..3f46493c48 100644 --- a/jscomp/test/installation_test.js +++ b/jscomp/test/installation_test.js @@ -16,7 +16,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/int32_test.js b/jscomp/test/int32_test.js index 0513cfb023..fb85a5f735 100644 --- a/jscomp/test/int32_test.js +++ b/jscomp/test/int32_test.js @@ -5,7 +5,7 @@ let Mt = require("./mt.js"); let $$Array = require("../../lib/js/array.js"); let Int32 = require("../../lib/js/int32.js"); let Caml_float = require("../../lib/js/caml_float.js"); -let Pervasives = require("../../lib/js/pervasives.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); let Ext_array_test = require("./ext_array_test.js"); function f(x) { @@ -153,10 +153,10 @@ function $star$tilde(prim0, prim1) { } let suites = { - contents: Pervasives.$at({ + contents: PervasivesU.$at({ hd: [ "File \"int32_test.res\", line 131, characters 9-16", - (function (param) { + (function () { return { TAG: "Eq", _0: 1, @@ -167,7 +167,7 @@ let suites = { tl: { hd: [ "File \"int32_test.res\", line 132, characters 9-16", - (function (param) { + (function () { return { TAG: "Eq", _0: -2147483647, @@ -177,10 +177,10 @@ let suites = { ], tl: /* [] */0 } - }, Pervasives.$at($$Array.to_list(Ext_array_test.map2i((function (i, a, b) { + }, PervasivesU.$at($$Array.to_list(Ext_array_test.map2i((function (i, a, b) { return [ "shift_right_logical_cases " + i, - (function (param) { + (function () { return { TAG: "Eq", _0: a, @@ -188,10 +188,10 @@ let suites = { }; }) ]; - }), shift_right_logical_tests_0, shift_right_logical_tests_1)), Pervasives.$at($$Array.to_list(Ext_array_test.map2i((function (i, a, b) { + }), shift_right_logical_tests_0, shift_right_logical_tests_1)), PervasivesU.$at($$Array.to_list(Ext_array_test.map2i((function (i, a, b) { return [ "shift_right_cases " + i, - (function (param) { + (function () { return { TAG: "Eq", _0: a, @@ -202,7 +202,7 @@ let suites = { }), shift_right_tests_0, shift_right_tests_1)), $$Array.to_list(Ext_array_test.map2i((function (i, a, b) { return [ "shift_left_cases " + i, - (function (param) { + (function () { return { TAG: "Eq", _0: a, diff --git a/jscomp/test/int64_mul_div_test.js b/jscomp/test/int64_mul_div_test.js index 99ee078baf..12b57ac72b 100644 --- a/jscomp/test/int64_mul_div_test.js +++ b/jscomp/test/int64_mul_div_test.js @@ -6,7 +6,7 @@ let List = require("../../lib/js/list.js"); let $$Array = require("../../lib/js/array.js"); let Int64 = require("../../lib/js/int64.js"); let Caml_int64 = require("../../lib/js/caml_int64.js"); -let Pervasives = require("../../lib/js/pervasives.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); function commutative_mul(result, a, b) { return { @@ -1600,12 +1600,12 @@ function from_to_string(xs) { }), $$Array.to_list(xs)); } -Mt.from_pair_suites("Int64_mul_div_test", Pervasives.$at(from_pairs("random", pairs), Pervasives.$at(from_pairs("small", small_pairs), Pervasives.$at(List.mapi((function (i, param) { +let extra = PervasivesU.$at(from_pairs("random", pairs), PervasivesU.$at(from_pairs("small", small_pairs), PervasivesU.$at(List.mapi((function (i, param) { let f = param[1]; let i64 = param[0]; return [ "to_float_" + i, - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_int64.to_float(i64), @@ -1613,12 +1613,12 @@ Mt.from_pair_suites("Int64_mul_div_test", Pervasives.$at(from_pairs("random", pa }; }) ]; -}), $$Array.to_list(to_floats)), Pervasives.$at(List.mapi((function (i, param) { +}), $$Array.to_list(to_floats)), PervasivesU.$at(List.mapi((function (i, param) { let i64 = param[1]; let f = param[0]; return [ "of_float_" + i, - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_int64.of_float(f), @@ -1626,10 +1626,10 @@ Mt.from_pair_suites("Int64_mul_div_test", Pervasives.$at(from_pairs("random", pa }; }) ]; -}), $$Array.to_list(of_float_pairs)), Pervasives.$at({ +}), $$Array.to_list(of_float_pairs)), PervasivesU.$at({ hd: [ "compare_check_complete", - (function (param) { + (function () { return { TAG: "Eq", _0: $$Array.map((function (param) { @@ -1640,10 +1640,10 @@ Mt.from_pair_suites("Int64_mul_div_test", Pervasives.$at(from_pairs("random", pa }) ], tl: /* [] */0 -}, Pervasives.$at(from(simple_divs), Pervasives.$at(from_compare(int64_compare_tests), { +}, PervasivesU.$at(from(simple_divs), PervasivesU.$at(from_compare(int64_compare_tests), { hd: [ "div_rem_0", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_int64.zero, @@ -1654,7 +1654,7 @@ Mt.from_pair_suites("Int64_mul_div_test", Pervasives.$at(from_pairs("random", pa tl: { hd: [ "div_rem_1", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_int64.neg_one, @@ -1665,7 +1665,7 @@ Mt.from_pair_suites("Int64_mul_div_test", Pervasives.$at(from_pairs("random", pa tl: { hd: [ "File \"int64_mul_div_test.res\", line 263, characters 19-26", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_int64.to_float(Int64.max_int), @@ -1676,7 +1676,9 @@ Mt.from_pair_suites("Int64_mul_div_test", Pervasives.$at(from_pairs("random", pa tl: /* [] */0 } } -})))))))); +}))))))); + +Mt.from_pair_suites("Int64_mul_div_test", extra); exports.commutative_mul = commutative_mul; exports.pairs = pairs; @@ -1691,4 +1693,4 @@ exports.to_string = to_string; exports.int64_compare_tests = int64_compare_tests; exports.from_compare = from_compare; exports.from_to_string = from_to_string; -/* Not a pure module */ +/* extra Not a pure module */ diff --git a/jscomp/test/int64_test.js b/jscomp/test/int64_test.js index 17dc6deb67..3807d3d7a9 100644 --- a/jscomp/test/int64_test.js +++ b/jscomp/test/int64_test.js @@ -7,7 +7,7 @@ let Int32 = require("../../lib/js/int32.js"); let Int64 = require("../../lib/js/int64.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); let Caml_int64 = require("../../lib/js/caml_int64.js"); -let Pervasives = require("../../lib/js/pervasives.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); let Ext_array_test = require("./ext_array_test.js"); let v = Caml_int64.add(Caml_int64.of_int32(Int32.max_int), Int64.one); @@ -849,10 +849,10 @@ function fac(_n, _acc) { }; } -let suites = Pervasives.$at({ +let suites = PervasivesU.$at({ hd: [ "add_one", - (function (param) { + (function () { return { TAG: "Eq", _0: v, @@ -866,7 +866,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "add_2", - (function (param) { + (function () { return { TAG: "Eq", _0: [ @@ -880,7 +880,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "add_3", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_int64.zero, @@ -891,7 +891,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "add_4", - (function (param) { + (function () { return commutative_add([ -1, 4294967294 @@ -904,7 +904,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "add_5", - (function (param) { + (function () { return commutative_add([ -1, 4294967293 @@ -917,7 +917,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "add_6", - (function (param) { + (function () { return commutative_add([ 0, 4 @@ -933,7 +933,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "add_7", - (function (param) { + (function () { return commutative_add([ 1, 0 @@ -949,7 +949,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "add_8", - (function (param) { + (function () { return commutative_add([ 1, 0 @@ -962,7 +962,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "add_9", - (function (param) { + (function () { return commutative_add([ 0, 4294967295 @@ -978,7 +978,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "add_10", - (function (param) { + (function () { return commutative_add([ 0, 2147483648 @@ -991,7 +991,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "add_11", - (function (param) { + (function () { return commutative_add([ 0, 4294967295 @@ -1004,7 +1004,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "to_int32", - (function (param) { + (function () { return { TAG: "Eq", _0: 3, @@ -1018,7 +1018,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "to_int", - (function (param) { + (function () { return { TAG: "Eq", _0: 3, @@ -1032,7 +1032,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "of_int", - (function (param) { + (function () { return { TAG: "Eq", _0: [ @@ -1049,7 +1049,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "lognot", - (function (param) { + (function () { return { TAG: "Eq", _0: [ @@ -1066,7 +1066,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "neg", - (function (param) { + (function () { return { TAG: "Eq", _0: [ @@ -1083,7 +1083,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "File \"int64_test.res\", line 277, characters 7-14", - (function (param) { + (function () { return { TAG: "Eq", _0: Int64.min_int, @@ -1094,7 +1094,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "File \"int64_test.res\", line 279, characters 8-15", - (function (param) { + (function () { return { TAG: "Eq", _0: Int64.max_int, @@ -1105,7 +1105,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "sub1", - (function (param) { + (function () { return { TAG: "Eq", _0: [ @@ -1122,7 +1122,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "xor1", - (function (param) { + (function () { return { TAG: "Eq", _0: [ @@ -1151,7 +1151,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "or", - (function (param) { + (function () { return { TAG: "Eq", _0: [ @@ -1168,7 +1168,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "and", - (function (param) { + (function () { return { TAG: "Eq", _0: [ @@ -1185,7 +1185,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "lsl", - (function (param) { + (function () { return { TAG: "Eq", _0: $$Array.map((function (x) { @@ -1451,7 +1451,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "lsr", - (function (param) { + (function () { return { TAG: "Eq", _0: $$Array.map((function (x) { @@ -1714,7 +1714,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "asr", - (function (param) { + (function () { return { TAG: "Eq", _0: $$Array.map((function (x) { @@ -1794,7 +1794,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "mul simple", - (function (param) { + (function () { return { TAG: "Eq", _0: [ @@ -1811,7 +1811,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "of_int32", - (function (param) { + (function () { return { TAG: "Eq", _0: $$Array.map(Caml_int64.of_int32, [ @@ -1831,7 +1831,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "of_int32_singleton", - (function (param) { + (function () { return { TAG: "Eq", _0: [ @@ -1848,7 +1848,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "File \"int64_test.res\", line 526, characters 7-14", - (function (param) { + (function () { return { TAG: "Eq", _0: [ @@ -1865,7 +1865,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "to_int32", - (function (param) { + (function () { return { TAG: "Eq", _0: $$Array.map(Caml_int64.to_int32, [ @@ -1885,7 +1885,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "discard_sign", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_int64.discard_sign(Caml_int64.neg_one), @@ -1896,7 +1896,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "div_mod", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_int64.div_mod([ @@ -1919,7 +1919,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "to_hex", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_int64.to_hex(Caml_int64.neg_one), @@ -1930,7 +1930,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "generic_compare", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.compare([ @@ -1944,7 +1944,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "test_compier_literal", - (function (param) { + (function () { return { TAG: "Eq", _0: [ @@ -1961,7 +1961,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "generic_compare2", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_obj.compare([ @@ -1975,7 +1975,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "shift_left", - (function (param) { + (function () { return { TAG: "Eq", _0: [ @@ -1992,7 +1992,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "fib_int64", - (function (param) { + (function () { return { TAG: "Eq", _0: fib(1000, Caml_int64.one, [ @@ -2009,7 +2009,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "fac_int64", - (function (param) { + (function () { return { TAG: "Eq", _0: fac(30, Caml_int64.one), @@ -2023,7 +2023,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "File \"int64_test.res\", line 553, characters 8-15", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_int64.add(Int64.max_int, Int64.max_int), @@ -2037,7 +2037,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "File \"int64_test.res\", line 563, characters 8-15", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_int64.add(Int64.min_int, Int64.min_int), @@ -2048,7 +2048,7 @@ let suites = Pervasives.$at({ tl: { hd: [ "File \"int64_test.res\", line 573, characters 8-15", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_int64.neg_one, @@ -2098,10 +2098,10 @@ let suites = Pervasives.$at({ } } } -}, Pervasives.$at($$Array.to_list(Ext_array_test.map2i((function (i, a, b) { +}, PervasivesU.$at($$Array.to_list(Ext_array_test.map2i((function (i, a, b) { return [ "shift_left_cases " + i, - (function (param) { + (function () { return { TAG: "Eq", _0: a, @@ -2109,10 +2109,10 @@ let suites = Pervasives.$at({ }; }) ]; -}), shift_left_tests_0, shift_left_tests_1)), Pervasives.$at($$Array.to_list(Ext_array_test.map2i((function (i, a, b) { +}), shift_left_tests_0, shift_left_tests_1)), PervasivesU.$at($$Array.to_list(Ext_array_test.map2i((function (i, a, b) { return [ "shift_right_cases " + i, - (function (param) { + (function () { return { TAG: "Eq", _0: a, @@ -2123,7 +2123,7 @@ let suites = Pervasives.$at({ }), shift_right_tests_0, shift_right_tests_1)), $$Array.to_list(Ext_array_test.map2i((function (i, a, b) { return [ "shift_right_logical_cases " + i, - (function (param) { + (function () { return { TAG: "Eq", _0: a, @@ -2147,7 +2147,7 @@ function eq(loc, x, y) { function id(loc, x) { let float_value = Caml_int64.float_of_bits(x); - let match = Pervasives.classify_float(float_value); + let match = PervasivesU.classify_float(float_value); if (match === "FP_nan") { return; } else { diff --git a/jscomp/test/int_hashtbl_test.js b/jscomp/test/int_hashtbl_test.js index 75ca3080e8..d6c1d924b2 100644 --- a/jscomp/test/int_hashtbl_test.js +++ b/jscomp/test/int_hashtbl_test.js @@ -5,16 +5,13 @@ let Mt = require("./mt.js"); let Caml = require("../../lib/js/caml.js"); let List = require("../../lib/js/list.js"); let $$Array = require("../../lib/js/array.js"); -let Curry = require("../../lib/js/curry.js"); let Hashtbl = require("../../lib/js/hashtbl.js"); function f(H) { - let tbl = Curry._1(H.create, 17); - Curry._3(H.add, tbl, 1, /* '1' */49); - Curry._3(H.add, tbl, 2, /* '2' */50); - return List.sort((function (param, param$1) { - return Caml.int_compare(param[0], param$1[0]); - }), Curry._3(H.fold, (function (k, v, acc) { + let tbl = H.create(17); + H.add(tbl, 1, /* '1' */49); + H.add(tbl, 2, /* '2' */50); + let extra = H.fold((function (k, v, acc) { return { hd: [ k, @@ -22,18 +19,21 @@ function f(H) { ], tl: acc }; - }), tbl, /* [] */0)); + }), tbl, /* [] */0); + return List.sort((function (param, param$1) { + return Caml.int_compare(param[0], param$1[0]); + }), extra); } function g(H, count) { - let tbl = Curry._1(H.create, 17); + let tbl = H.create(17); for(let i = 0; i <= count; ++i){ - Curry._3(H.replace, tbl, (i << 1), String(i)); + H.replace(tbl, (i << 1), String(i)); } for(let i$1 = 0; i$1 <= count; ++i$1){ - Curry._3(H.replace, tbl, (i$1 << 1), String(i$1)); + H.replace(tbl, (i$1 << 1), String(i$1)); } - let v = Curry._3(H.fold, (function (k, v, acc) { + let v = H.fold((function (k, v, acc) { return { hd: [ k, @@ -42,12 +42,15 @@ function g(H, count) { tl: acc }; }), tbl, /* [] */0); - return $$Array.of_list(List.sort((function (param, param$1) { + let v$1 = List.sort((function (param, param$1) { return Caml.int_compare(param[0], param$1[0]); - }), v)); + }), v); + return $$Array.of_list(v$1); } -let hash = Hashtbl.hash; +function hash(x) { + return Hashtbl.hash(x); +} function equal(x, y) { return x === y; diff --git a/jscomp/test/int_map.js b/jscomp/test/int_map.js index b776fbda6d..4e161c5c06 100644 --- a/jscomp/test/int_map.js +++ b/jscomp/test/int_map.js @@ -2,7 +2,6 @@ 'use strict'; let Caml = require("../../lib/js/caml.js"); -let Curry = require("../../lib/js/curry.js"); let Caml_option = require("../../lib/js/caml_option.js"); function height(param) { @@ -188,7 +187,7 @@ function find_first(f, _param) { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _d0 = param.d; let _param$1 = param.l; @@ -203,7 +202,7 @@ function find_first(f, _param) { ]; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.l; _d0 = param$1.d; _v0 = v$1; @@ -225,7 +224,7 @@ function find_first_opt(f, _param) { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _d0 = param.d; let _param$1 = param.l; @@ -240,7 +239,7 @@ function find_first_opt(f, _param) { ]; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.l; _d0 = param$1.d; _v0 = v$1; @@ -266,7 +265,7 @@ function find_last(f, _param) { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _d0 = param.d; let _param$1 = param.r; @@ -281,7 +280,7 @@ function find_last(f, _param) { ]; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.r; _d0 = param$1.d; _v0 = v$1; @@ -303,7 +302,7 @@ function find_last_opt(f, _param) { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _d0 = param.d; let _param$1 = param.r; @@ -318,7 +317,7 @@ function find_last_opt(f, _param) { ]; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.r; _d0 = param$1.d; _v0 = v$1; @@ -501,7 +500,7 @@ function remove(x, param) { function update(x, f, param) { if (typeof param !== "object") { - let data = Curry._1(f, undefined); + let data = f(undefined); if (data !== undefined) { return { TAG: "Node", @@ -521,7 +520,7 @@ function update(x, f, param) { let l = param.l; let c = Caml.int_compare(x, v); if (c === 0) { - let data$1 = Curry._1(f, Caml_option.some(d)); + let data$1 = f(Caml_option.some(d)); if (data$1 === undefined) { return merge(l, r); } @@ -562,7 +561,7 @@ function iter(f, _param) { return; } iter(f, param.l); - Curry._2(f, param.v, param.d); + f(param.v, param.d); _param = param.r; continue; }; @@ -573,7 +572,7 @@ function map(f, param) { return "Empty"; } let l$p = map(f, param.l); - let d$p = Curry._1(f, param.d); + let d$p = f(param.d); let r$p = map(f, param.r); return { TAG: "Node", @@ -591,7 +590,7 @@ function mapi(f, param) { } let v = param.v; let l$p = mapi(f, param.l); - let d$p = Curry._2(f, v, param.d); + let d$p = f(v, param.d); let r$p = mapi(f, param.r); return { TAG: "Node", @@ -610,7 +609,7 @@ function fold(f, _m, _accu) { if (typeof m !== "object") { return accu; } - _accu = Curry._3(f, m.v, m.d, fold(f, m.l, accu)); + _accu = f(m.v, m.d, fold(f, m.l, accu)); _m = m.r; continue; }; @@ -622,7 +621,7 @@ function for_all(p, _param) { if (typeof param !== "object") { return true; } - if (!Curry._2(p, param.v, param.d)) { + if (!p(param.v, param.d)) { return false; } if (!for_all(p, param.l)) { @@ -639,7 +638,7 @@ function exists(p, _param) { if (typeof param !== "object") { return false; } - if (Curry._2(p, param.v, param.d)) { + if (p(param.v, param.d)) { return true; } if (exists(p, param.l)) { @@ -749,7 +748,7 @@ function merge$1(f, s1, s2) { let v1 = s1.v; if (s1.h >= height(s2)) { let match = split(v1, s2); - return concat_or_join(merge$1(f, s1.l, match[0]), v1, Curry._3(f, v1, Caml_option.some(s1.d), match[1]), merge$1(f, s1.r, match[2])); + return concat_or_join(merge$1(f, s1.l, match[0]), v1, f(v1, Caml_option.some(s1.d), match[1]), merge$1(f, s1.r, match[2])); } } @@ -767,7 +766,7 @@ function merge$1(f, s1, s2) { } let v2 = s2.v; let match$1 = split(v2, s1); - return concat_or_join(merge$1(f, match$1[0], s2.l), v2, Curry._3(f, v2, match$1[1], Caml_option.some(s2.d)), merge$1(f, match$1[2], s2.r)); + return concat_or_join(merge$1(f, match$1[0], s2.l), v2, f(v2, match$1[1], Caml_option.some(s2.d)), merge$1(f, match$1[2], s2.r)); } function union(f, s1, s2) { @@ -787,7 +786,7 @@ function union(f, s1, s2) { let l = union(f, s1.l, match[0]); let r = union(f, s1.r, match[2]); if (d2$1 !== undefined) { - return concat_or_join(l, v1, Curry._3(f, v1, d1, Caml_option.valFromOption(d2$1)), r); + return concat_or_join(l, v1, f(v1, d1, Caml_option.valFromOption(d2$1)), r); } else { return join(l, v1, d1, r); } @@ -797,7 +796,7 @@ function union(f, s1, s2) { let l$1 = union(f, match$1[0], s2.l); let r$1 = union(f, match$1[2], s2.r); if (d1$1 !== undefined) { - return concat_or_join(l$1, v2, Curry._3(f, v2, Caml_option.valFromOption(d1$1), d2), r$1); + return concat_or_join(l$1, v2, f(v2, Caml_option.valFromOption(d1$1), d2), r$1); } else { return join(l$1, v2, d2, r$1); } @@ -812,7 +811,7 @@ function filter(p, param) { let v = param.v; let l = param.l; let l$p = filter(p, l); - let pvd = Curry._2(p, v, d); + let pvd = p(v, d); let r$p = filter(p, r); if (pvd) { if (l === l$p && r === r$p) { @@ -837,7 +836,7 @@ function partition(p, param) { let match = partition(p, param.l); let lf = match[1]; let lt = match[0]; - let pvd = Curry._2(p, v, d); + let pvd = p(v, d); let match$1 = partition(p, param.r); let rf = match$1[1]; let rt = match$1[0]; @@ -893,7 +892,7 @@ function compare(cmp, m1, m2) { if (c !== 0) { return c; } - let c$1 = Curry._2(cmp, e1._1, e2._1); + let c$1 = cmp(e1._1, e2._1); if (c$1 !== 0) { return c$1; } @@ -922,7 +921,7 @@ function equal(cmp, m1, m2) { if (e1._0 !== e2._0) { return false; } - if (!Curry._2(cmp, e1._1, e2._1)) { + if (!cmp(e1._1, e2._1)) { return false; } _e2 = cons_enum(e2._2, e2._3); diff --git a/jscomp/test/int_overflow_test.js b/jscomp/test/int_overflow_test.js index 11099804f7..7658f197d3 100644 --- a/jscomp/test/int_overflow_test.js +++ b/jscomp/test/int_overflow_test.js @@ -41,7 +41,7 @@ function fib(x) { Mt.from_pair_suites("Int_overflow_test", { hd: [ "plus_overflow", - (function (param) { + (function () { return { TAG: "Eq", _0: true, @@ -52,7 +52,7 @@ Mt.from_pair_suites("Int_overflow_test", { tl: { hd: [ "minus_overflow", - (function (param) { + (function () { return { TAG: "Eq", _0: true, @@ -63,7 +63,7 @@ Mt.from_pair_suites("Int_overflow_test", { tl: { hd: [ "flow_again", - (function (param) { + (function () { return { TAG: "Eq", _0: 2147483646, @@ -74,7 +74,7 @@ Mt.from_pair_suites("Int_overflow_test", { tl: { hd: [ "flow_again", - (function (param) { + (function () { return { TAG: "Eq", _0: -2, @@ -85,7 +85,7 @@ Mt.from_pair_suites("Int_overflow_test", { tl: { hd: [ "hash_test", - (function (param) { + (function () { return { TAG: "Eq", _0: hash_variant("xxyyzzuuxxzzyy00112233"), @@ -96,7 +96,7 @@ Mt.from_pair_suites("Int_overflow_test", { tl: { hd: [ "hash_test2", - (function (param) { + (function () { return { TAG: "Eq", _0: hash_variant("xxyyzxzzyy"), @@ -107,7 +107,7 @@ Mt.from_pair_suites("Int_overflow_test", { tl: { hd: [ "File \"int_overflow_test.res\", line 88, characters 5-12", - (function (param) { + (function () { return { TAG: "Eq", _0: hash_variant2("xxyyzzuuxxzzyy00112233"), @@ -118,7 +118,7 @@ Mt.from_pair_suites("Int_overflow_test", { tl: { hd: [ "File \"int_overflow_test.res\", line 89, characters 5-12", - (function (param) { + (function () { return { TAG: "Eq", _0: hash_variant2("xxyyzxzzyy"), @@ -129,7 +129,7 @@ Mt.from_pair_suites("Int_overflow_test", { tl: { hd: [ "int_literal_flow", - (function (param) { + (function () { return { TAG: "Eq", _0: -1, @@ -140,7 +140,7 @@ Mt.from_pair_suites("Int_overflow_test", { tl: { hd: [ "int_literal_flow2", - (function (param) { + (function () { return { TAG: "Eq", _0: -1, @@ -151,7 +151,7 @@ Mt.from_pair_suites("Int_overflow_test", { tl: { hd: [ "int_literal_flow3", - (function (param) { + (function () { return { TAG: "Eq", _0: -1, @@ -162,7 +162,7 @@ Mt.from_pair_suites("Int_overflow_test", { tl: { hd: [ "int32_mul", - (function (param) { + (function () { return { TAG: "Eq", _0: -33554431, @@ -173,7 +173,7 @@ Mt.from_pair_suites("Int_overflow_test", { tl: { hd: [ "File \"int_overflow_test.res\", line 94, characters 5-12", - (function (param) { + (function () { return { TAG: "Eq", _0: Number("3") | 0, @@ -184,7 +184,7 @@ Mt.from_pair_suites("Int_overflow_test", { tl: { hd: [ "File \"int_overflow_test.res\", line 96, characters 5-12", - (function (param) { + (function () { return { TAG: "Eq", _0: Number("3.2") | 0, diff --git a/jscomp/test/int_poly_var.js b/jscomp/test/int_poly_var.js index c58817214f..6fa3335c9d 100644 --- a/jscomp/test/int_poly_var.js +++ b/jscomp/test/int_poly_var.js @@ -66,6 +66,8 @@ function h(x) { return x === 0; } +let g = /* 'b' */98; + let hihi = f3(3, 0); let hh10 = "3" === 3; @@ -173,8 +175,6 @@ let eq_suites = Mt.eq_suites; let u = 1; -let g = /* 'b' */98; - let hh9 = true; let begin = 3; diff --git a/jscomp/test/int_switch_test.js b/jscomp/test/int_switch_test.js index 0cdd07393a..caff715926 100644 --- a/jscomp/test/int_switch_test.js +++ b/jscomp/test/int_switch_test.js @@ -2,7 +2,6 @@ 'use strict'; let Mt = require("./mt.js"); -let Curry = require("../../lib/js/curry.js"); let suites = { contents: /* [] */0 @@ -21,7 +20,7 @@ function b(loc, x) { } function f(x) { - let match = Curry._1(x, undefined); + let match = x(); switch (match) { case 1 : return /* 'a' */97; @@ -35,7 +34,7 @@ function f(x) { } function f22(x) { - let match = Curry._1(x, undefined); + let match = x(); switch (match) { case 1 : return /* 'a' */97; @@ -49,7 +48,7 @@ function f22(x) { } function f33(x) { - let match = Curry._1(x, undefined); + let match = x(); switch (match) { case "A" : return /* 'a' */97; @@ -63,23 +62,23 @@ function f33(x) { } } -eq("File \"int_switch_test.res\", line 32, characters 3-10", f(function (param) { +eq("File \"int_switch_test.res\", line 32, characters 3-10", f(function () { return 1; }), /* 'a' */97); -eq("File \"int_switch_test.res\", line 33, characters 3-10", f(function (param) { +eq("File \"int_switch_test.res\", line 33, characters 3-10", f(function () { return 2; }), /* 'b' */98); -eq("File \"int_switch_test.res\", line 34, characters 3-10", f(function (param) { +eq("File \"int_switch_test.res\", line 34, characters 3-10", f(function () { return 3; }), /* 'c' */99); -eq("File \"int_switch_test.res\", line 35, characters 3-10", f(function (param) { +eq("File \"int_switch_test.res\", line 35, characters 3-10", f(function () { return 0; }), /* 'x' */120); -eq("File \"int_switch_test.res\", line 36, characters 3-10", f(function (param) { +eq("File \"int_switch_test.res\", line 36, characters 3-10", f(function () { return -1; }), /* 'x' */120); diff --git a/jscomp/test/internal_unused_test.js b/jscomp/test/internal_unused_test.js index 6b4f1b57ac..968d42b9ce 100644 --- a/jscomp/test/internal_unused_test.js +++ b/jscomp/test/internal_unused_test.js @@ -7,7 +7,7 @@ console.log(3); let A = /* @__PURE__ */Caml_exceptions.create("Internal_unused_test.P1.A"); -function f(param) { +function f() { throw new Error(A, { cause: { RE_EXN_ID: A diff --git a/jscomp/test/io_test.js b/jscomp/test/io_test.js index 61e043cbb0..d7fdad7cbe 100644 --- a/jscomp/test/io_test.js +++ b/jscomp/test/io_test.js @@ -2,7 +2,7 @@ 'use strict'; -function f(param) { +function f() { console.error("x"); console.log(); console.log("hi"); diff --git a/jscomp/test/js_cast_test.js b/jscomp/test/js_cast_test.js index ee261560a5..ba86ae998f 100644 --- a/jscomp/test/js_cast_test.js +++ b/jscomp/test/js_cast_test.js @@ -24,7 +24,7 @@ function add_test(loc, test) { } function eq(loc, x, y) { - add_test(loc, (function (param) { + add_test(loc, (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/js_date_test.js b/jscomp/test/js_date_test.js index 18d562756f..ae4924ef81 100644 --- a/jscomp/test/js_date_test.js +++ b/jscomp/test/js_date_test.js @@ -4,7 +4,7 @@ let Mt = require("./mt.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); -function date(param) { +function date() { return new Date("1976-03-08T12:34:56.789+01:23"); } diff --git a/jscomp/test/js_dict_test.js b/jscomp/test/js_dict_test.js index 6fd120e2c8..e9085c3ca6 100644 --- a/jscomp/test/js_dict_test.js +++ b/jscomp/test/js_dict_test.js @@ -4,7 +4,7 @@ let Mt = require("./mt.js"); let Js_dict = require("../../lib/js/js_dict.js"); -function obj(param) { +function obj() { return { foo: 43, bar: 86 diff --git a/jscomp/test/js_exception_catch_test.js b/jscomp/test/js_exception_catch_test.js index 6446aa65dc..0d08a67689 100644 --- a/jscomp/test/js_exception_catch_test.js +++ b/jscomp/test/js_exception_catch_test.js @@ -2,7 +2,6 @@ 'use strict'; let Mt = require("./mt.js"); -let Curry = require("../../lib/js/curry.js"); let Js_exn = require("../../lib/js/js_exn.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); @@ -28,7 +27,7 @@ function add_test(loc, test) { } function eq(loc, x, y) { - add_test(loc, (function (param) { + add_test(loc, (function () { return { TAG: "Eq", _0: x, @@ -38,7 +37,7 @@ function eq(loc, x, y) { } function false_(loc) { - add_test(loc, (function (param) { + add_test(loc, (function () { return { TAG: "Ok", _0: false @@ -47,7 +46,7 @@ function false_(loc) { } function true_(loc) { - add_test(loc, (function (param) { + add_test(loc, (function () { return { TAG: "Ok", _0: true @@ -66,7 +65,7 @@ try { catch (raw_x){ let x = Caml_js_exceptions.internalToOCamlException(raw_x); if (x.RE_EXN_ID === Js_exn.$$Error) { - add_test("File \"js_exception_catch_test.res\", line 18, characters 37-44", (function (param) { + add_test("File \"js_exception_catch_test.res\", line 18, characters 37-44", (function () { return { TAG: "Ok", _0: true @@ -80,7 +79,7 @@ catch (raw_x){ } if (exit === 1) { - add_test("File \"js_exception_catch_test.res\", line 19, characters 14-21", (function (param) { + add_test("File \"js_exception_catch_test.res\", line 19, characters 14-21", (function () { return { TAG: "Ok", _0: false @@ -96,7 +95,7 @@ let C = /* @__PURE__ */Caml_exceptions.create("Js_exception_catch_test.C"); function test(f) { try { - Curry._1(f, undefined); + f(); return "No_error"; } catch (raw_e){ @@ -131,11 +130,11 @@ function test(f) { } } -eq("File \"js_exception_catch_test.res\", line 44, characters 5-12", test(function (param) { +eq("File \"js_exception_catch_test.res\", line 44, characters 5-12", test(function () { }), "No_error"); -eq("File \"js_exception_catch_test.res\", line 45, characters 5-12", test(function (param) { +eq("File \"js_exception_catch_test.res\", line 45, characters 5-12", test(function () { throw new Error("Not_found", { cause: { RE_EXN_ID: "Not_found" @@ -143,7 +142,7 @@ eq("File \"js_exception_catch_test.res\", line 45, characters 5-12", test(functi }); }), "Not_found"); -eq("File \"js_exception_catch_test.res\", line 46, characters 5-12", test(function (param) { +eq("File \"js_exception_catch_test.res\", line 46, characters 5-12", test(function () { throw new Error("Invalid_argument", { cause: { RE_EXN_ID: "Invalid_argument", @@ -152,7 +151,7 @@ eq("File \"js_exception_catch_test.res\", line 46, characters 5-12", test(functi }); }), "Invalid_argument"); -eq("File \"js_exception_catch_test.res\", line 47, characters 5-12", test(function (param) { +eq("File \"js_exception_catch_test.res\", line 47, characters 5-12", test(function () { throw new Error("Invalid_argument", { cause: { RE_EXN_ID: "Invalid_argument", @@ -161,7 +160,7 @@ eq("File \"js_exception_catch_test.res\", line 47, characters 5-12", test(functi }); }), "Invalid_any"); -eq("File \"js_exception_catch_test.res\", line 48, characters 5-12", test(function (param) { +eq("File \"js_exception_catch_test.res\", line 48, characters 5-12", test(function () { throw new Error(A, { cause: { RE_EXN_ID: A, @@ -170,7 +169,7 @@ eq("File \"js_exception_catch_test.res\", line 48, characters 5-12", test(functi }); }), "A2"); -eq("File \"js_exception_catch_test.res\", line 49, characters 5-12", test(function (param) { +eq("File \"js_exception_catch_test.res\", line 49, characters 5-12", test(function () { throw new Error(A, { cause: { RE_EXN_ID: A, @@ -179,7 +178,7 @@ eq("File \"js_exception_catch_test.res\", line 49, characters 5-12", test(functi }); }), "A_any"); -eq("File \"js_exception_catch_test.res\", line 50, characters 5-12", test(function (param) { +eq("File \"js_exception_catch_test.res\", line 50, characters 5-12", test(function () { throw new Error(B, { cause: { RE_EXN_ID: B @@ -187,7 +186,7 @@ eq("File \"js_exception_catch_test.res\", line 50, characters 5-12", test(functi }); }), "B"); -eq("File \"js_exception_catch_test.res\", line 51, characters 5-12", test(function (param) { +eq("File \"js_exception_catch_test.res\", line 51, characters 5-12", test(function () { throw new Error(C, { cause: { RE_EXN_ID: C, @@ -197,7 +196,7 @@ eq("File \"js_exception_catch_test.res\", line 51, characters 5-12", test(functi }); }), "C"); -eq("File \"js_exception_catch_test.res\", line 52, characters 5-12", test(function (param) { +eq("File \"js_exception_catch_test.res\", line 52, characters 5-12", test(function () { throw new Error(C, { cause: { RE_EXN_ID: C, @@ -207,13 +206,13 @@ eq("File \"js_exception_catch_test.res\", line 52, characters 5-12", test(functi }); }), "C_any"); -eq("File \"js_exception_catch_test.res\", line 53, characters 5-12", test(function (param) { +eq("File \"js_exception_catch_test.res\", line 53, characters 5-12", test(function () { throw new Error(new Error("x").RE_EXN_ID, { cause: new Error("x") }); }), "Js_error"); -eq("File \"js_exception_catch_test.res\", line 54, characters 5-12", test(function (param) { +eq("File \"js_exception_catch_test.res\", line 54, characters 5-12", test(function () { throw new Error("Failure", { cause: { RE_EXN_ID: "Failure", diff --git a/jscomp/test/js_float_test.js b/jscomp/test/js_float_test.js index 5c509bb326..2e441470dd 100644 --- a/jscomp/test/js_float_test.js +++ b/jscomp/test/js_float_test.js @@ -2,7 +2,7 @@ 'use strict'; let Mt = require("./mt.js"); -let Pervasives = require("../../lib/js/pervasives.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); let suites_0 = [ "_NaN <> _NaN", @@ -44,7 +44,7 @@ let suites_1 = { return { TAG: "Eq", _0: false, - _1: Number.isFinite(Pervasives.infinity) + _1: Number.isFinite(PervasivesU.infinity) }; }) ], @@ -55,7 +55,7 @@ let suites_1 = { return { TAG: "Eq", _0: false, - _1: Number.isFinite(Pervasives.neg_infinity) + _1: Number.isFinite(PervasivesU.neg_infinity) }; }) ], @@ -142,7 +142,7 @@ let suites_1 = { (function (param) { return { TAG: "ThrowAny", - _0: (function (param) { + _0: (function () { (0).toExponential(101); }) }; @@ -154,7 +154,7 @@ let suites_1 = { (function (param) { return { TAG: "ThrowAny", - _0: (function (param) { + _0: (function () { (0).toExponential(-1); }) }; @@ -221,7 +221,7 @@ let suites_1 = { (function (param) { return { TAG: "ThrowAny", - _0: (function (param) { + _0: (function () { (0).toFixed(101); }) }; @@ -233,7 +233,7 @@ let suites_1 = { (function (param) { return { TAG: "ThrowAny", - _0: (function (param) { + _0: (function () { (0).toFixed(-1); }) }; @@ -300,7 +300,7 @@ let suites_1 = { (function (param) { return { TAG: "ThrowAny", - _0: (function (param) { + _0: (function () { (0).toPrecision(101); }) }; @@ -312,7 +312,7 @@ let suites_1 = { (function (param) { return { TAG: "ThrowAny", - _0: (function (param) { + _0: (function () { (0).toPrecision(-1); }) }; @@ -379,7 +379,7 @@ let suites_1 = { (function (param) { return { TAG: "ThrowAny", - _0: (function (param) { + _0: (function () { (0).toString(37); }) }; @@ -391,7 +391,7 @@ let suites_1 = { (function (param) { return { TAG: "ThrowAny", - _0: (function (param) { + _0: (function () { (0).toString(1); }) }; @@ -403,7 +403,7 @@ let suites_1 = { (function (param) { return { TAG: "ThrowAny", - _0: (function (param) { + _0: (function () { (0).toString(-1); }) }; diff --git a/jscomp/test/js_global_test.js b/jscomp/test/js_global_test.js index 8b8a343d04..298af9a7c6 100644 --- a/jscomp/test/js_global_test.js +++ b/jscomp/test/js_global_test.js @@ -6,7 +6,7 @@ let Mt = require("./mt.js"); let suites_0 = [ "setTimeout/clearTimeout sanity check", (function (param) { - let handle = setTimeout((function (param) { + let handle = setTimeout((function () { }), 0); clearTimeout(handle); @@ -21,7 +21,7 @@ let suites_1 = { hd: [ "setInerval/clearInterval sanity check", (function (param) { - let handle = setInterval((function (param) { + let handle = setInterval((function () { }), 0); clearInterval(handle); diff --git a/jscomp/test/js_int_test.js b/jscomp/test/js_int_test.js index 7cb8f148af..bb6fb5d699 100644 --- a/jscomp/test/js_int_test.js +++ b/jscomp/test/js_int_test.js @@ -53,7 +53,7 @@ let suites_1 = { (function (param) { return { TAG: "ThrowAny", - _0: (function (param) { + _0: (function () { (0).toExponential(101); }) }; @@ -65,7 +65,7 @@ let suites_1 = { (function (param) { return { TAG: "ThrowAny", - _0: (function (param) { + _0: (function () { (0).toExponential(-1); }) }; @@ -121,7 +121,7 @@ let suites_1 = { (function (param) { return { TAG: "ThrowAny", - _0: (function (param) { + _0: (function () { (0).toPrecision(101); }) }; @@ -133,7 +133,7 @@ let suites_1 = { (function (param) { return { TAG: "ThrowAny", - _0: (function (param) { + _0: (function () { (0).toPrecision(-1); }) }; @@ -189,7 +189,7 @@ let suites_1 = { (function (param) { return { TAG: "ThrowAny", - _0: (function (param) { + _0: (function () { (0).toString(37); }) }; @@ -201,7 +201,7 @@ let suites_1 = { (function (param) { return { TAG: "ThrowAny", - _0: (function (param) { + _0: (function () { (0).toString(1); }) }; @@ -213,7 +213,7 @@ let suites_1 = { (function (param) { return { TAG: "ThrowAny", - _0: (function (param) { + _0: (function () { (0).toString(-1); }) }; diff --git a/jscomp/test/js_json_test.js b/jscomp/test/js_json_test.js index a1a017bac1..e9533d4cbb 100644 --- a/jscomp/test/js_json_test.js +++ b/jscomp/test/js_json_test.js @@ -31,7 +31,7 @@ function add_test(loc, test) { } function eq(loc, x, y) { - add_test(loc, (function (param) { + add_test(loc, (function () { return { TAG: "Eq", _0: x, @@ -41,7 +41,7 @@ function eq(loc, x, y) { } function false_(loc) { - add_test(loc, (function (param) { + add_test(loc, (function () { return { TAG: "Ok", _0: false @@ -50,7 +50,7 @@ function false_(loc) { } function true_(loc) { - add_test(loc, (function (param) { + add_test(loc, (function () { return { TAG: "Ok", _0: true @@ -60,7 +60,7 @@ function true_(loc) { let v = JSON.parse(" { \"x\" : [1, 2, 3 ] } "); -add_test("File \"js_json_test.res\", line 22, characters 11-18", (function (param) { +add_test("File \"js_json_test.res\", line 22, characters 11-18", (function () { let ty = Js_json.classify(v); if (typeof ty !== "object") { return { @@ -82,21 +82,34 @@ add_test("File \"js_json_test.res\", line 22, characters 11-18", (function (para }; } let ty2 = Js_json.classify(v$1); - if (typeof ty2 !== "object") { + if (typeof ty2 !== "object" || ty2.TAG !== "JSONArray") { return { TAG: "Ok", _0: false }; - } - if (ty2.TAG !== "JSONArray") { - return { - TAG: "Ok", - _0: false - }; - } - ty2._0.forEach(function (x) { - let ty3 = Js_json.classify(x); - if (typeof ty3 !== "object") { + } else { + return (function () { + return { + TAG: "Ok", + _0: true + }; + })((ty2._0.forEach(function (x) { + let ty3 = Js_json.classify(x); + if (typeof ty3 !== "object") { + throw new Error("Assert_failure", { + cause: { + RE_EXN_ID: "Assert_failure", + _1: [ + "js_json_test.res", + 37, + 19 + ] + } + }); + } + if (ty3.TAG === "JSONNumber") { + return; + } throw new Error("Assert_failure", { cause: { RE_EXN_ID: "Assert_failure", @@ -107,25 +120,8 @@ add_test("File \"js_json_test.res\", line 22, characters 11-18", (function (para ] } }); - } - if (ty3.TAG === "JSONNumber") { - return; - } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "js_json_test.res", - 37, - 19 - ] - } - }); - }); - return { - TAG: "Ok", - _0: true - }; + }), undefined)); + } })); eq("File \"js_json_test.res\", line 48, characters 5-12", Js_json.test(v, "Object"), true); @@ -136,7 +132,7 @@ let ty = Js_json.classify(json); if (typeof ty !== "object") { if (ty === "JSONNull") { - add_test("File \"js_json_test.res\", line 55, characters 24-31", (function (param) { + add_test("File \"js_json_test.res\", line 55, characters 24-31", (function () { return { TAG: "Ok", _0: true @@ -144,7 +140,7 @@ if (typeof ty !== "object") { })); } else { console.log(ty); - add_test("File \"js_json_test.res\", line 58, characters 11-18", (function (param) { + add_test("File \"js_json_test.res\", line 58, characters 11-18", (function () { return { TAG: "Ok", _0: false @@ -153,7 +149,7 @@ if (typeof ty !== "object") { } } else { console.log(ty); - add_test("File \"js_json_test.res\", line 58, characters 11-18", (function (param) { + add_test("File \"js_json_test.res\", line 58, characters 11-18", (function () { return { TAG: "Ok", _0: false @@ -166,7 +162,7 @@ let json$1 = JSON.parse(JSON.stringify("test string")); let ty$1 = Js_json.classify(json$1); if (typeof ty$1 !== "object") { - add_test("File \"js_json_test.res\", line 68, characters 16-23", (function (param) { + add_test("File \"js_json_test.res\", line 68, characters 16-23", (function () { return { TAG: "Ok", _0: false @@ -175,7 +171,7 @@ if (typeof ty$1 !== "object") { } else if (ty$1.TAG === "JSONString") { eq("File \"js_json_test.res\", line 67, characters 26-33", ty$1._0, "test string"); } else { - add_test("File \"js_json_test.res\", line 68, characters 16-23", (function (param) { + add_test("File \"js_json_test.res\", line 68, characters 16-23", (function () { return { TAG: "Ok", _0: false @@ -196,7 +192,7 @@ if (typeof ty$2 !== "object" || ty$2.TAG !== "JSONNumber") { } if (exit === 1) { - add_test("File \"js_json_test.res\", line 78, characters 18-25", (function (param) { + add_test("File \"js_json_test.res\", line 78, characters 18-25", (function () { return { TAG: "Ok", _0: false @@ -217,7 +213,7 @@ if (typeof ty$3 !== "object" || ty$3.TAG !== "JSONNumber") { } if (exit$1 === 1) { - add_test("File \"js_json_test.res\", line 88, characters 18-25", (function (param) { + add_test("File \"js_json_test.res\", line 88, characters 18-25", (function () { return { TAG: "Ok", _0: false @@ -229,7 +225,7 @@ function test(v) { let json = JSON.parse(JSON.stringify(v)); let ty = Js_json.classify(json); if (typeof ty === "object") { - return add_test("File \"js_json_test.res\", line 100, characters 18-25", (function (param) { + return add_test("File \"js_json_test.res\", line 100, characters 18-25", (function () { return { TAG: "Ok", _0: false @@ -242,7 +238,7 @@ function test(v) { case "JSONTrue" : return eq("File \"js_json_test.res\", line 98, characters 23-30", true, v); default: - return add_test("File \"js_json_test.res\", line 100, characters 18-25", (function (param) { + return add_test("File \"js_json_test.res\", line 100, characters 18-25", (function () { return { TAG: "Ok", _0: false @@ -282,7 +278,7 @@ let json$4 = JSON.parse(JSON.stringify(dict)); let ty$4 = Js_json.classify(json$4); if (typeof ty$4 !== "object") { - add_test("File \"js_json_test.res\", line 142, characters 16-23", (function (param) { + add_test("File \"js_json_test.res\", line 142, characters 16-23", (function () { return { TAG: "Ok", _0: false @@ -292,7 +288,7 @@ if (typeof ty$4 !== "object") { let x = ty$4._0; let ta = Js_json.classify(option_get(Js_dict.get(x, "a"))); if (typeof ta !== "object") { - add_test("File \"js_json_test.res\", line 140, characters 18-25", (function (param) { + add_test("File \"js_json_test.res\", line 140, characters 18-25", (function () { return { TAG: "Ok", _0: false @@ -300,7 +296,7 @@ if (typeof ty$4 !== "object") { })); } else if (ta.TAG === "JSONString") { if (ta._0 !== "test string") { - add_test("File \"js_json_test.res\", line 131, characters 15-22", (function (param) { + add_test("File \"js_json_test.res\", line 131, characters 15-22", (function () { return { TAG: "Ok", _0: false @@ -309,7 +305,7 @@ if (typeof ty$4 !== "object") { } else { let ty$5 = Js_json.classify(option_get(Js_dict.get(x, "b"))); if (typeof ty$5 !== "object") { - add_test("File \"js_json_test.res\", line 137, characters 22-29", (function (param) { + add_test("File \"js_json_test.res\", line 137, characters 22-29", (function () { return { TAG: "Ok", _0: false @@ -317,7 +313,7 @@ if (typeof ty$4 !== "object") { })); } else if (ty$5.TAG === "JSONNumber") { let b = ty$5._0; - add_test("File \"js_json_test.res\", line 136, characters 38-45", (function (param) { + add_test("File \"js_json_test.res\", line 136, characters 38-45", (function () { return { TAG: "Approx", _0: 123.0, @@ -325,7 +321,7 @@ if (typeof ty$4 !== "object") { }; })); } else { - add_test("File \"js_json_test.res\", line 137, characters 22-29", (function (param) { + add_test("File \"js_json_test.res\", line 137, characters 22-29", (function () { return { TAG: "Ok", _0: false @@ -334,7 +330,7 @@ if (typeof ty$4 !== "object") { } } } else { - add_test("File \"js_json_test.res\", line 140, characters 18-25", (function (param) { + add_test("File \"js_json_test.res\", line 140, characters 18-25", (function () { return { TAG: "Ok", _0: false @@ -342,7 +338,7 @@ if (typeof ty$4 !== "object") { })); } } else { - add_test("File \"js_json_test.res\", line 142, characters 16-23", (function (param) { + add_test("File \"js_json_test.res\", line 142, characters 16-23", (function () { return { TAG: "Ok", _0: false @@ -353,7 +349,7 @@ if (typeof ty$4 !== "object") { function eq_at_i(loc, json, i, kind, expected) { let ty = Js_json.classify(json); if (typeof ty !== "object") { - return add_test(loc, (function (param) { + return add_test(loc, (function () { return { TAG: "Ok", _0: false @@ -361,7 +357,7 @@ function eq_at_i(loc, json, i, kind, expected) { })); } if (ty.TAG !== "JSONArray") { - return add_test(loc, (function (param) { + return add_test(loc, (function () { return { TAG: "Ok", _0: false @@ -372,7 +368,7 @@ function eq_at_i(loc, json, i, kind, expected) { switch (kind) { case "String" : if (typeof ty$1 !== "object") { - return add_test(loc, (function (param) { + return add_test(loc, (function () { return { TAG: "Ok", _0: false @@ -381,7 +377,7 @@ function eq_at_i(loc, json, i, kind, expected) { } else if (ty$1.TAG === "JSONString") { return eq(loc, ty$1._0, expected); } else { - return add_test(loc, (function (param) { + return add_test(loc, (function () { return { TAG: "Ok", _0: false @@ -390,7 +386,7 @@ function eq_at_i(loc, json, i, kind, expected) { } case "Number" : if (typeof ty$1 !== "object") { - return add_test(loc, (function (param) { + return add_test(loc, (function () { return { TAG: "Ok", _0: false @@ -399,7 +395,7 @@ function eq_at_i(loc, json, i, kind, expected) { } else if (ty$1.TAG === "JSONNumber") { return eq(loc, ty$1._0, expected); } else { - return add_test(loc, (function (param) { + return add_test(loc, (function () { return { TAG: "Ok", _0: false @@ -408,7 +404,7 @@ function eq_at_i(loc, json, i, kind, expected) { } case "Object" : if (typeof ty$1 !== "object") { - return add_test(loc, (function (param) { + return add_test(loc, (function () { return { TAG: "Ok", _0: false @@ -417,7 +413,7 @@ function eq_at_i(loc, json, i, kind, expected) { } else if (ty$1.TAG === "JSONObject") { return eq(loc, ty$1._0, expected); } else { - return add_test(loc, (function (param) { + return add_test(loc, (function () { return { TAG: "Ok", _0: false @@ -426,7 +422,7 @@ function eq_at_i(loc, json, i, kind, expected) { } case "Array" : if (typeof ty$1 !== "object") { - return add_test(loc, (function (param) { + return add_test(loc, (function () { return { TAG: "Ok", _0: false @@ -435,7 +431,7 @@ function eq_at_i(loc, json, i, kind, expected) { } else if (ty$1.TAG === "JSONArray") { return eq(loc, ty$1._0, expected); } else { - return add_test(loc, (function (param) { + return add_test(loc, (function () { return { TAG: "Ok", _0: false @@ -444,7 +440,7 @@ function eq_at_i(loc, json, i, kind, expected) { } case "Boolean" : if (typeof ty$1 === "object") { - return add_test(loc, (function (param) { + return add_test(loc, (function () { return { TAG: "Ok", _0: false @@ -457,7 +453,7 @@ function eq_at_i(loc, json, i, kind, expected) { case "JSONTrue" : return eq(loc, true, expected); default: - return add_test(loc, (function (param) { + return add_test(loc, (function () { return { TAG: "Ok", _0: false @@ -467,14 +463,14 @@ function eq_at_i(loc, json, i, kind, expected) { case "Null" : if (typeof ty$1 !== "object") { if (ty$1 === "JSONNull") { - return add_test(loc, (function (param) { + return add_test(loc, (function () { return { TAG: "Ok", _0: true }; })); } else { - return add_test(loc, (function (param) { + return add_test(loc, (function () { return { TAG: "Ok", _0: false @@ -482,7 +478,7 @@ function eq_at_i(loc, json, i, kind, expected) { })); } } else { - return add_test(loc, (function (param) { + return add_test(loc, (function () { return { TAG: "Ok", _0: false @@ -580,7 +576,7 @@ let json$10 = JSON.parse(JSON.stringify(a$3)); let ty$6 = Js_json.classify(json$10); if (typeof ty$6 !== "object") { - add_test("File \"js_json_test.res\", line 271, characters 16-23", (function (param) { + add_test("File \"js_json_test.res\", line 271, characters 16-23", (function () { return { TAG: "Ok", _0: false @@ -589,7 +585,7 @@ if (typeof ty$6 !== "object") { } else if (ty$6.TAG === "JSONArray") { let ty$7 = Js_json.classify(Caml_array.get(ty$6._0, 1)); if (typeof ty$7 !== "object") { - add_test("File \"js_json_test.res\", line 269, characters 18-25", (function (param) { + add_test("File \"js_json_test.res\", line 269, characters 18-25", (function () { return { TAG: "Ok", _0: false @@ -598,7 +594,7 @@ if (typeof ty$6 !== "object") { } else if (ty$7.TAG === "JSONObject") { let ty$8 = Js_json.classify(option_get(Js_dict.get(ty$7._0, "a"))); if (typeof ty$8 !== "object") { - add_test("File \"js_json_test.res\", line 267, characters 20-27", (function (param) { + add_test("File \"js_json_test.res\", line 267, characters 20-27", (function () { return { TAG: "Ok", _0: false @@ -607,7 +603,7 @@ if (typeof ty$6 !== "object") { } else if (ty$8.TAG === "JSONString") { eq("File \"js_json_test.res\", line 266, characters 35-42", ty$8._0, "bbb"); } else { - add_test("File \"js_json_test.res\", line 267, characters 20-27", (function (param) { + add_test("File \"js_json_test.res\", line 267, characters 20-27", (function () { return { TAG: "Ok", _0: false @@ -615,7 +611,7 @@ if (typeof ty$6 !== "object") { })); } } else { - add_test("File \"js_json_test.res\", line 269, characters 18-25", (function (param) { + add_test("File \"js_json_test.res\", line 269, characters 18-25", (function () { return { TAG: "Ok", _0: false @@ -623,7 +619,7 @@ if (typeof ty$6 !== "object") { })); } } else { - add_test("File \"js_json_test.res\", line 271, characters 16-23", (function (param) { + add_test("File \"js_json_test.res\", line 271, characters 16-23", (function () { return { TAG: "Ok", _0: false @@ -633,7 +629,7 @@ if (typeof ty$6 !== "object") { try { JSON.parse("{{ A}"); - add_test("File \"js_json_test.res\", line 279, characters 11-18", (function (param) { + add_test("File \"js_json_test.res\", line 279, characters 11-18", (function () { return { TAG: "Ok", _0: false @@ -641,7 +637,7 @@ try { })); } catch (exn){ - add_test("File \"js_json_test.res\", line 281, characters 17-24", (function (param) { + add_test("File \"js_json_test.res\", line 281, characters 17-24", (function () { return { TAG: "Ok", _0: true @@ -744,7 +740,7 @@ function id(obj) { } function idtest(obj) { - eq("File \"js_json_test.res\", line 355, characters 23-30", obj, Js_json.deserializeUnsafe(Js_json.serializeExn(obj))); + eq("File \"js_json_test.res\", line 355, characters 23-30", obj, id(obj)); } idtest(undefined); diff --git a/jscomp/test/js_list_test.js b/jscomp/test/js_list_test.js index fa56dc2efb..6409eb647f 100644 --- a/jscomp/test/js_list_test.js +++ b/jscomp/test/js_list_test.js @@ -3,7 +3,6 @@ let Mt = require("./mt.js"); let Js_list = require("../../lib/js/js_list.js"); -let Js_vector = require("../../lib/js/js_vector.js"); let suites = { contents: /* [] */0 @@ -18,7 +17,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -173,11 +172,9 @@ eq("File \"js_list_test.res\", line 29, characters 5-12", Js_list.countBy((funct } }), 3); -function f(i) { +let v = Js_list.init(100000, (function (i) { return i; -} - -let v = Js_vector.toList(Js_vector.init(100000, f)); +})); eq("File \"js_list_test.res\", line 31, characters 5-12", Js_list.countBy((function (x) { return x % 2 === 0; @@ -200,13 +197,11 @@ let vvv = Js_list.filter((function (x) { eq("File \"js_list_test.res\", line 36, characters 5-12", Js_list.length(vvv), 10000); -function f$1(x) { - return Math.imul(x, 10); -} - eq("File \"js_list_test.res\", line 37, characters 5-12", true, Js_list.equal((function (x, y) { return x === y; -}), vvv, Js_vector.toList(Js_vector.init(10000, f$1)))); +}), vvv, Js_list.init(10000, (function (x) { + return Math.imul(x, 10); +})))); Mt.from_pair_suites("Js_list_test", suites.contents); diff --git a/jscomp/test/js_nullable_test.js b/jscomp/test/js_nullable_test.js index a8534460eb..ba64e5e938 100644 --- a/jscomp/test/js_nullable_test.js +++ b/jscomp/test/js_nullable_test.js @@ -16,7 +16,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/js_re_test.js b/jscomp/test/js_re_test.js index e2c90977b5..32dab9fbaf 100644 --- a/jscomp/test/js_re_test.js +++ b/jscomp/test/js_re_test.js @@ -37,9 +37,9 @@ let suites_1 = { "fromString", (function (param) { let contentOf = function (tag, xmlString) { - let x = new RegExp("<" + (tag + (">(.*?)<\\/" + (tag + ">")))).exec(xmlString); - if (x !== null) { - return Caml_option.nullable_to_opt(Caml_array.get(x, 1)); + let x = Caml_option.null_to_opt(new RegExp("<" + (tag + (">(.*?)<\\/" + (tag + ">")))).exec(xmlString)); + if (x !== undefined) { + return Caml_option.nullable_to_opt(Caml_array.get(Caml_option.valFromOption(x), 1)); } }; diff --git a/jscomp/test/jsoo_400_test.js b/jscomp/test/jsoo_400_test.js index 9d9e93d5f3..f88c3ce847 100644 --- a/jscomp/test/jsoo_400_test.js +++ b/jscomp/test/jsoo_400_test.js @@ -4,7 +4,7 @@ let Mt = require("./mt.js"); let Caml_int32 = require("../../lib/js/caml_int32.js"); -function u(param) { +function u() { let n; try { n = "123".length; @@ -18,10 +18,10 @@ function u(param) { Mt.from_pair_suites("Jsoo_400_test", { hd: [ "File \"jsoo_400_test.res\", line 7, characters 38-45", - (function (param) { + (function () { return { TAG: "ThrowAny", - _0: (function (param) { + _0: (function () { u(); }) }; diff --git a/jscomp/test/jsoo_485_test.js b/jscomp/test/jsoo_485_test.js index 25e071fbce..2d3d8fcb08 100644 --- a/jscomp/test/jsoo_485_test.js +++ b/jscomp/test/jsoo_485_test.js @@ -2,7 +2,7 @@ 'use strict'; -function f(param) { +function f() { 3; } diff --git a/jscomp/test/keep_uncurry_attribute.js b/jscomp/test/keep_uncurry_attribute.js index f5f236e0af..6ca125db40 100644 --- a/jscomp/test/keep_uncurry_attribute.js +++ b/jscomp/test/keep_uncurry_attribute.js @@ -1,10 +1,9 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); function map1(prim0, prim1) { - return map(prim0, Curry.__1(prim1)); + return map(prim0, prim1); } function map2(prim0, prim1) { diff --git a/jscomp/test/key_word_property.js b/jscomp/test/key_word_property.js index 57ebfadaa7..f3c8178555 100644 --- a/jscomp/test/key_word_property.js +++ b/jscomp/test/key_word_property.js @@ -46,7 +46,7 @@ let test = { window: 3 }; -function u(param) { +function u() { return window.switch(); } diff --git a/jscomp/test/key_word_property_plus_test.js b/jscomp/test/key_word_property_plus_test.js index 039f59d620..15f26b1b9f 100644 --- a/jscomp/test/key_word_property_plus_test.js +++ b/jscomp/test/key_word_property_plus_test.js @@ -17,7 +17,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/lazy_demo.js b/jscomp/test/lazy_demo.js index 1d4fa28466..d950f3be7d 100644 --- a/jscomp/test/lazy_demo.js +++ b/jscomp/test/lazy_demo.js @@ -1,14 +1,15 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; +let Lazy = require("../../lib/js/lazy.js"); let CamlinternalLazy = require("../../lib/js/camlinternalLazy.js"); -let lazy1 = CamlinternalLazy.from_fun(function () { +let lazy1 = Lazy.from_fun(function () { console.log("Hello, lazy"); return 1; }); -let lazy2 = CamlinternalLazy.from_fun(function () { +let lazy2 = Lazy.from_fun(function () { return 3; }); @@ -24,4 +25,4 @@ exports.lazy1 = lazy1; exports.lazy2 = lazy2; exports.la = la; exports.lb = lb; -/* Not a pure module */ +/* lazy1 Not a pure module */ diff --git a/jscomp/test/lazy_test.js b/jscomp/test/lazy_test.js index 9a611e41d3..b8e3f1dc4e 100644 --- a/jscomp/test/lazy_test.js +++ b/jscomp/test/lazy_test.js @@ -9,11 +9,11 @@ let u = { contents: 3 }; -let v = CamlinternalLazy.from_fun(function () { +let v = Lazy.from_fun(function () { u.contents = 32; }); -function lazy_test(param) { +function lazy_test() { let h = u.contents; CamlinternalLazy.force(v); let g = u.contents; @@ -27,7 +27,7 @@ let u_v = { contents: 0 }; -let u$1 = CamlinternalLazy.from_fun(function () { +let u$1 = Lazy.from_fun(function () { u_v.contents = 2; }); @@ -35,27 +35,27 @@ CamlinternalLazy.force(u$1); let exotic = CamlinternalLazy.force; -let l_from_fun = CamlinternalLazy.from_fun(function () { +let l_from_fun = Lazy.from_fun(function () { return 3; }); -let forward_test = CamlinternalLazy.from_fun(function () { +let forward_test = Lazy.from_fun(function () { let u = 3; u = u + 1 | 0; return u; }); -let f005 = CamlinternalLazy.from_fun(function () { +let f005 = Lazy.from_fun(function () { return 6; }); -let f006 = CamlinternalLazy.from_fun(function () { - return function (param) { +let f006 = Lazy.from_fun(function () { + return function () { return 3; }; }); -let f007 = CamlinternalLazy.from_fun(function () { +let f007 = Lazy.from_fun(function () { throw new Error("Not_found", { cause: { RE_EXN_ID: "Not_found" @@ -63,7 +63,7 @@ let f007 = CamlinternalLazy.from_fun(function () { }); }); -let f008 = CamlinternalLazy.from_fun(function () { +let f008 = Lazy.from_fun(function () { console.log("hi"); throw new Error("Not_found", { cause: { @@ -72,7 +72,9 @@ let f008 = CamlinternalLazy.from_fun(function () { }); }); -let a2 = CamlinternalLazy.from_val; +function a2(x) { + return CamlinternalLazy.from_val(x); +} let a3 = CamlinternalLazy.from_val(3); @@ -89,7 +91,7 @@ let a8 = CamlinternalLazy.force(a6); Mt.from_pair_suites("Lazy_test", { hd: [ "simple", - (function (param) { + (function () { return { TAG: "Eq", _0: lazy_test(), @@ -103,7 +105,7 @@ Mt.from_pair_suites("Lazy_test", { tl: { hd: [ "lazy_force", - (function (param) { + (function () { return { TAG: "Eq", _0: u_v.contents, @@ -114,7 +116,7 @@ Mt.from_pair_suites("Lazy_test", { tl: { hd: [ "lazy_from_fun", - (function (param) { + (function () { return { TAG: "Eq", _0: CamlinternalLazy.force(l_from_fun), @@ -125,7 +127,7 @@ Mt.from_pair_suites("Lazy_test", { tl: { hd: [ "lazy_from_val", - (function (param) { + (function () { return { TAG: "Eq", _0: CamlinternalLazy.force(CamlinternalLazy.from_val(3)), @@ -136,12 +138,13 @@ Mt.from_pair_suites("Lazy_test", { tl: { hd: [ "lazy_from_val2", - (function (param) { + (function () { + let v = Lazy.from_fun(function () { + return 3; + }); return { TAG: "Eq", - _0: CamlinternalLazy.force(CamlinternalLazy.force(CamlinternalLazy.from_val(CamlinternalLazy.from_fun(function () { - return 3; - })))), + _0: CamlinternalLazy.force(CamlinternalLazy.force(CamlinternalLazy.from_val(v))), _1: 3 }; }) @@ -149,7 +152,7 @@ Mt.from_pair_suites("Lazy_test", { tl: { hd: [ "lazy_from_val3", - (function (param) { + (function () { debugger; return { TAG: "Eq", @@ -161,7 +164,7 @@ Mt.from_pair_suites("Lazy_test", { tl: { hd: [ "lazy_test.res", - (function (param) { + (function () { return { TAG: "Eq", _0: a3, @@ -172,7 +175,7 @@ Mt.from_pair_suites("Lazy_test", { tl: { hd: [ "lazy_test.res", - (function (param) { + (function () { return { TAG: "Eq", _0: a7, @@ -183,7 +186,7 @@ Mt.from_pair_suites("Lazy_test", { tl: { hd: [ "lazy_test.res", - (function (param) { + (function () { return { TAG: "Eq", _0: a8, @@ -194,7 +197,7 @@ Mt.from_pair_suites("Lazy_test", { tl: { hd: [ "File \"lazy_test.res\", line 95, characters 7-14", - (function (param) { + (function () { return { TAG: "Ok", _0: Lazy.is_val(CamlinternalLazy.from_val(3)) @@ -204,10 +207,10 @@ Mt.from_pair_suites("Lazy_test", { tl: { hd: [ "File \"lazy_test.res\", line 96, characters 7-14", - (function (param) { + (function () { return { TAG: "Ok", - _0: !Lazy.is_val(CamlinternalLazy.from_fun(function () { + _0: !Lazy.is_val(Lazy.from_fun(function () { throw new Error("Not_found", { cause: { RE_EXN_ID: "Not_found" @@ -248,4 +251,4 @@ exports.a5 = a5; exports.a6 = a6; exports.a7 = a7; exports.a8 = a8; -/* Not a pure module */ +/* v Not a pure module */ diff --git a/jscomp/test/libarg_test.js b/jscomp/test/libarg_test.js index 39c867d552..9a26d50250 100644 --- a/jscomp/test/libarg_test.js +++ b/jscomp/test/libarg_test.js @@ -21,7 +21,7 @@ function record(fmt) { }; } -function f_unit(param) { +function f_unit() { record("unit()"); } diff --git a/jscomp/test/libqueue_test.js b/jscomp/test/libqueue_test.js index 146b72d8ea..9154961b61 100644 --- a/jscomp/test/libqueue_test.js +++ b/jscomp/test/libqueue_test.js @@ -2,7 +2,6 @@ 'use strict'; let List = require("../../lib/js/list.js"); -let Curry = require("../../lib/js/curry.js"); let Queue = require("../../lib/js/queue.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); @@ -37,7 +36,7 @@ let Q = { function does_raise(f, q) { try { - Curry._1(f, q); + f(q); return false; } catch (raw_exn){ diff --git a/jscomp/test/limits_test.js b/jscomp/test/limits_test.js index 6851483919..fd3a43448c 100644 --- a/jscomp/test/limits_test.js +++ b/jscomp/test/limits_test.js @@ -3,7 +3,7 @@ let Mt = require("./mt.js"); let Int32 = require("../../lib/js/int32.js"); -let Pervasives = require("../../lib/js/pervasives.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); let suites = { contents: /* [] */0 @@ -18,7 +18,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -30,9 +30,9 @@ function eq(loc, x, y) { }; } -eq("File \"limits_test.res\", line 10, characters 5-12", Pervasives.max_int, 2147483647); +eq("File \"limits_test.res\", line 10, characters 5-12", PervasivesU.max_int, 2147483647); -eq("File \"limits_test.res\", line 11, characters 5-12", Pervasives.min_int, -2147483648); +eq("File \"limits_test.res\", line 11, characters 5-12", PervasivesU.min_int, -2147483648); eq("File \"limits_test.res\", line 12, characters 5-12", Int32.max_int, 2147483647); diff --git a/jscomp/test/loop_regression_test.js b/jscomp/test/loop_regression_test.js index edc17d1e7c..a797923bc7 100644 --- a/jscomp/test/loop_regression_test.js +++ b/jscomp/test/loop_regression_test.js @@ -3,7 +3,7 @@ let Mt = require("./mt.js"); -function f(param) { +function f() { let v = { contents: 0 }; diff --git a/jscomp/test/map_find_test.js b/jscomp/test/map_find_test.js index 3f9a5deec7..10193d80f0 100644 --- a/jscomp/test/map_find_test.js +++ b/jscomp/test/map_find_test.js @@ -367,30 +367,36 @@ let s = List.fold_left((function (acc, param) { } }); -Mt.from_pair_suites("Map_find_test", { +let extra_0 = [ + "int", + (function () { + return { + TAG: "Eq", + _0: find(10, m), + _1: /* 'a' */97 + }; + }) +]; + +let extra_1 = { hd: [ - "int", - (function (param) { + "string", + (function () { return { TAG: "Eq", - _0: find(10, m), + _0: find$1("10", s), _1: /* 'a' */97 }; }) ], - tl: { - hd: [ - "string", - (function (param) { - return { - TAG: "Eq", - _0: find$1("10", s), - _1: /* 'a' */97 - }; - }) - ], - tl: /* [] */0 - } -}); + tl: /* [] */0 +}; + +let extra = { + hd: extra_0, + tl: extra_1 +}; + +Mt.from_pair_suites("Map_find_test", extra); /* m Not a pure module */ diff --git a/jscomp/test/map_test.js b/jscomp/test/map_test.js index 501aa76e42..2b04082cb6 100644 --- a/jscomp/test/map_test.js +++ b/jscomp/test/map_test.js @@ -4,7 +4,6 @@ let Mt = require("./mt.js"); let Caml = require("../../lib/js/caml.js"); let List = require("../../lib/js/list.js"); -let Curry = require("../../lib/js/curry.js"); function height(param) { if (typeof param !== "object") { @@ -179,7 +178,7 @@ function compare(cmp, m1, m2) { if (c !== 0) { return c; } - let c$1 = Curry._2(cmp, e1._1, e2._1); + let c$1 = cmp(e1._1, e2._1); if (c$1 !== 0) { return c$1; } @@ -208,7 +207,7 @@ function equal(cmp, m1, m2) { if (e1._0 !== e2._0) { return false; } - if (!Curry._2(cmp, e1._1, e2._1)) { + if (!cmp(e1._1, e2._1)) { return false; } _e2 = cons_enum(e2._2, e2._3); diff --git a/jscomp/test/mario_game.js b/jscomp/test/mario_game.js index 9ae6a416a1..ba143f5ca6 100644 --- a/jscomp/test/mario_game.js +++ b/jscomp/test/mario_game.js @@ -3,12 +3,11 @@ let Caml = require("../../lib/js/caml.js"); let List = require("../../lib/js/list.js"); -let Curry = require("../../lib/js/curry.js"); let Random = require("../../lib/js/random.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); let Caml_int32 = require("../../lib/js/caml_int32.js"); -let Pervasives = require("../../lib/js/pervasives.js"); let Caml_option = require("../../lib/js/caml_option.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); let Actors = {}; @@ -703,11 +702,7 @@ function make_type$1(typ, ctx) { switch (typ) { case "BrickChunkL" : case "BrickChunkR" : - return { - sprite: make_particle$1(typ, ctx), - rot: 0, - lifetime: 300 - }; + break; default: return { sprite: make_particle$1(typ, ctx), @@ -715,6 +710,11 @@ function make_type$1(typ, ctx) { lifetime: 30 }; } + return { + sprite: make_particle$1(typ, ctx), + rot: 0, + lifetime: 300 + }; } function make$1(velOpt, accOpt, part_type, pos, ctx) { @@ -789,7 +789,7 @@ let Particle = { }; let id_counter = { - contents: Pervasives.min_int + contents: PervasivesU.min_int }; function setup_obj(has_gravityOpt, speedOpt, param) { @@ -811,10 +811,14 @@ function set_vel_to_speed(obj) { } } +function make_player() { + return setup_obj(undefined, 2.8, undefined); +} + function make_type$2(x) { switch (x.TAG) { case "SPlayer" : - return setup_obj(undefined, 2.8, undefined); + return make_player(); case "SEnemy" : let x$1 = x._0; switch (x$1) { @@ -837,7 +841,7 @@ function make_type$2(x) { } } -function new_id(param) { +function new_id() { id_counter.contents = id_counter.contents + 1 | 0; return id_counter.contents; } @@ -956,9 +960,9 @@ function update_player(player, keys, context) { let prev_jumping = player.jumping; let prev_dir = player.dir; let prev_vx = Math.abs(player.vel.x); - List.iter((function (param) { + List.iter((function (extra) { let lr_acc = player.vel.x * 0.2; - switch (param) { + switch (extra) { case "CLeft" : if (!player.crouch) { if (player.vel.x > - player.params.speed) { @@ -1342,7 +1346,7 @@ function kill(collid, ctx) { hd: make$1(undefined, undefined, "GoombaSquish", pos, ctx), tl: /* [] */0 }) : /* [] */0; - return Pervasives.$at(score, remains); + return PervasivesU.$at(score, remains); case "Item" : let o$1 = collid._2; if (collid._0 === "Mushroom") { @@ -1445,7 +1449,7 @@ function render_bbox(sprite, param) { let match = sprite.params.bbox_offset; let match$1 = sprite.params.bbox_size; context.strokeStyle = "#FF0000"; - return Curry._4(context.strokeRect, param[0] + match[0], param[1] + match[1], match$1[0], match$1[1]); + return context.strokeRect(param[0] + match[0], param[1] + match[1], match$1[0], match$1[1]); } function render(sprite, param) { @@ -1455,17 +1459,7 @@ function render(sprite, param) { let sw = match$1[0]; let match$2 = sprite.params.frame_size; let sx = match[0] + sprite.frame.contents * sw; - return Curry.app(context.drawImage, [ - sprite.img, - sx, - match[1], - sw, - match$1[1], - param[0], - param[1], - match$2[0], - match$2[1] - ]); + return context.drawImage(sprite.img, sx, match[1], sw, match$1[1], param[0], param[1], match$2[0], match$2[1]); } function draw_bgd(bgd, off_x) { @@ -1480,34 +1474,34 @@ function draw_bgd(bgd, off_x) { } function clear_canvas(canvas) { - let context = Curry._1(canvas.getContext, "2d"); + let context = canvas.getContext("2d"); let cwidth = canvas.width; let cheight = canvas.height; - Curry._4(context.clearRect, 0, 0, cwidth, cheight); + context.clearRect(0, 0, cwidth, cheight); } function hud(canvas, score, coins) { let score_string = String(score); let coin_string = String(coins); - let context = Curry._1(canvas.getContext, "2d"); + let context = canvas.getContext("2d"); context.font = "10px 'Press Start 2P'"; - Curry._3(context.fillText, "Score: " + score_string, canvas.width - 140, 18); - Curry._3(context.fillText, "Coins: " + coin_string, 120, 18); + context.fillText("Score: " + score_string, canvas.width - 140, 18); + context.fillText("Coins: " + coin_string, 120, 18); } function fps(canvas, fps_val) { let fps_str = String(fps_val | 0); - let context = Curry._1(canvas.getContext, "2d"); - Curry._3(context.fillText, fps_str, 10, 18); + let context = canvas.getContext("2d"); + context.fillText(fps_str, 10, 18); } function game_win(ctx) { - Curry._4(ctx.rect, 0, 0, 512, 512); + ctx.rect(0, 0, 512, 512); ctx.fillStyle = "black"; - Curry._1(ctx.fill, undefined); + ctx.fill(); ctx.fillStyle = "white"; ctx.font = "20px 'Press Start 2P'"; - Curry._3(ctx.fillText, "You win!", 180, 128); + ctx.fillText("You win!", 180, 128); throw new Error("Failure", { cause: { RE_EXN_ID: "Failure", @@ -1517,12 +1511,12 @@ function game_win(ctx) { } function game_loss(ctx) { - Curry._4(ctx.rect, 0, 0, 512, 512); + ctx.rect(0, 0, 512, 512); ctx.fillStyle = "black"; - Curry._1(ctx.fill, undefined); + ctx.fill(); ctx.fillStyle = "white"; ctx.font = "20px 'Press Start 2P'"; - Curry._3(ctx.fillText, "GAME OVER. You lose!", 60, 128); + ctx.fillText("GAME OVER. You lose!", 60, 128); throw new Error("Failure", { cause: { RE_EXN_ID: "Failure", @@ -1658,9 +1652,10 @@ function process_collision(dir, c1, c2, state) { let o1$2; let t2$1; let o2$2; + let o1$3; switch (c1.TAG) { case "Player" : - let o1$3 = c1._2; + let o1$4 = c1._2; let s1$2 = c1._1; switch (c2.TAG) { case "Player" : @@ -1674,14 +1669,14 @@ function process_collision(dir, c1, c2, state) { let typ$1 = c2._0; if (dir === "South") { s1 = s1$2; - o1 = o1$3; + o1 = o1$4; typ = typ$1; s2 = s2$2; o2 = o2$3; exit = 1; } else { s1$1 = s1$2; - o1$1 = o1$3; + o1$1 = o1$4; t2 = typ$1; s2$1 = s2$2; o2$1 = o2$3; @@ -1689,7 +1684,7 @@ function process_collision(dir, c1, c2, state) { } break; case "Item" : - o1$2 = o1$3; + o1$2 = o1$4; t2$1 = c2._0; o2$2 = c2._2; exit = 3; @@ -1702,14 +1697,14 @@ function process_collision(dir, c1, c2, state) { switch (t) { case "Brick" : if (c1._0 === "BigM") { - collide_block(undefined, dir, o1$3); + collide_block(undefined, dir, o1$4); dec_health(o2$4); return [ undefined, undefined ]; } else { - collide_block(undefined, dir, o1$3); + collide_block(undefined, dir, o1$4); return [ undefined, undefined @@ -1722,7 +1717,7 @@ function process_collision(dir, c1, c2, state) { undefined ]; default: - collide_block(undefined, dir, o1$3); + collide_block(undefined, dir, o1$4); return [ undefined, undefined @@ -1730,8 +1725,8 @@ function process_collision(dir, c1, c2, state) { } } else { let updated_block = evolve_block(o2$4, context); - let spawned_item = spawn_above(o1$3.dir, o2$4, t._0, context); - collide_block(undefined, dir, o1$3); + let spawned_item = spawn_above(o1$4.dir, o2$4, t._0, context); + collide_block(undefined, dir, o1$4); return [ spawned_item, updated_block @@ -1747,20 +1742,20 @@ function process_collision(dir, c1, c2, state) { undefined ]; } - exit$1 = 4; + exit$1 = 5; } else { - exit$1 = 4; + exit$1 = 5; } - if (exit$1 === 4) { + if (exit$1 === 5) { if (dir === "South") { state.multiplier = 1; - collide_block(undefined, dir, o1$3); + collide_block(undefined, dir, o1$4); return [ undefined, undefined ]; } - collide_block(undefined, dir, o1$3); + collide_block(undefined, dir, o1$4); return [ undefined, undefined @@ -1773,26 +1768,26 @@ function process_collision(dir, c1, c2, state) { } break; case "Enemy" : - let o1$4 = c1._2; + let o1$5 = c1._2; let s1$3 = c1._1; let t1 = c1._0; switch (c2.TAG) { case "Player" : - let o1$5 = c2._2; + let o1$6 = c2._2; let s1$4 = c2._1; if (dir === "North") { s1 = s1$4; - o1 = o1$5; + o1 = o1$6; typ = t1; s2 = s1$3; - o2 = o1$4; + o2 = o1$5; exit = 1; } else { s1$1 = s1$4; - o1$1 = o1$5; + o1$1 = o1$6; t2 = t1; s2$1 = s1$3; - o2$1 = o1$4; + o2$1 = o1$5; exit = 2; } break; @@ -1844,7 +1839,7 @@ function process_collision(dir, c1, c2, state) { } if (exit$3 === 4) { - rev_dir(o1$4, t1, s1$3); + rev_dir(o1$5, t1, s1$3); rev_dir(o2$5, t2$2, s2$3); return [ undefined, @@ -1856,14 +1851,14 @@ function process_collision(dir, c1, c2, state) { } switch (exit$2) { case 1 : - dec_health(o1$4); + dec_health(o1$5); dec_health(o2$5); return [ undefined, undefined ]; case 2 : - if (o1$4.vel.x === 0) { + if (o1$5.vel.x === 0) { rev_dir(o2$5, t2$2, s2$3); return [ undefined, @@ -1878,13 +1873,13 @@ function process_collision(dir, c1, c2, state) { } case 3 : if (o2$5.vel.x === 0) { - rev_dir(o1$4, t1, s1$3); + rev_dir(o1$5, t1, s1$3); return [ undefined, undefined ]; } else { - dec_health(o1$4); + dec_health(o1$5); return [ undefined, undefined @@ -1904,67 +1899,56 @@ function process_collision(dir, c1, c2, state) { switch (dir) { case "North" : case "South" : - collide_block(undefined, dir, o1$4); - return [ - undefined, - undefined - ]; + o1$3 = o1$5; + exit = 4; + break; case "East" : case "West" : - exit$4 = 4; + exit$4 = 5; break; } - if (exit$4 === 4) { + if (exit$4 === 5) { let exit$5 = 0; let typ$2; switch (t1) { case "GKoopaShell" : if (typeof t2$3 !== "object") { - if (t2$3 === "Brick") { - dec_health(o2$6); - reverse_left_right(o1$4); - return [ - undefined, - undefined - ]; - } - exit$5 = 5; + exit$5 = t2$3 === "Brick" ? 7 : 6; } else { typ$2 = t2$3._0; - exit$5 = 6; + exit$5 = 8; } break; case "RKoopaShell" : if (typeof t2$3 !== "object") { - if (t2$3 === "Brick") { - dec_health(o2$6); - reverse_left_right(o1$4); - return [ - undefined, - undefined - ]; - } - exit$5 = 5; + exit$5 = t2$3 === "Brick" ? 7 : 6; } else { typ$2 = t2$3._0; - exit$5 = 6; + exit$5 = 8; } break; default: - exit$5 = 5; + exit$5 = 6; } switch (exit$5) { - case 5 : - rev_dir(o1$4, t1, s1$3); + case 6 : + rev_dir(o1$5, t1, s1$3); return [ undefined, undefined ]; - case 6 : + case 7 : + dec_health(o2$6); + reverse_left_right(o1$5); + return [ + undefined, + undefined + ]; + case 8 : let updated_block$1 = evolve_block(o2$6, context); - let spawned_item$1 = spawn_above(o1$4.dir, o2$6, typ$2, context); - rev_dir(o1$4, t1, s1$3); + let spawned_item$1 = spawn_above(o1$5.dir, o2$6, typ$2, context); + rev_dir(o1$5, t1, s1$3); return [ updated_block$1, spawned_item$1 @@ -1995,11 +1979,9 @@ function process_collision(dir, c1, c2, state) { switch (dir) { case "North" : case "South" : - collide_block(undefined, dir, o2$7); - return [ - undefined, - undefined - ]; + o1$3 = o2$7; + exit = 4; + break; case "East" : case "West" : reverse_left_right(o2$7); @@ -2009,6 +1991,7 @@ function process_collision(dir, c1, c2, state) { ]; } + break; } break; @@ -2093,7 +2076,7 @@ function process_collision(dir, c1, c2, state) { ]; case "FireFlower" : case "Star" : - exit$6 = 4; + exit$6 = 5; break; case "Coin" : state.coins = state.coins + 1 | 0; @@ -2105,7 +2088,7 @@ function process_collision(dir, c1, c2, state) { ]; } - if (exit$6 === 4) { + if (exit$6 === 5) { dec_health(o2$2); update_score(state, 1000); return [ @@ -2114,6 +2097,12 @@ function process_collision(dir, c1, c2, state) { ]; } break; + case 4 : + collide_block(undefined, dir, o1$3); + return [ + undefined, + undefined + ]; } } @@ -2212,7 +2201,7 @@ function update_collidable(state, collid, all_collids) { return evolved; } -function translate_keys(param) { +function translate_keys() { let ctrls_0 = [ pressed_keys.left, "CLeft" @@ -2272,7 +2261,7 @@ function run_update_collid(state, collid, all_collids) { player = collid; } let evolved = update_collidable(state, player, all_collids); - collid_objs.contents = Pervasives.$at(collid_objs.contents, evolved); + collid_objs.contents = PervasivesU.$at(collid_objs.contents, evolved); return player; } let obj = collid._2; @@ -2280,17 +2269,17 @@ function run_update_collid(state, collid, all_collids) { if (!obj.kill) { collid_objs.contents = { hd: collid, - tl: Pervasives.$at(collid_objs.contents, evolved$1) + tl: PervasivesU.$at(collid_objs.contents, evolved$1) }; } let new_parts = obj.kill ? kill(collid, state.ctx) : /* [] */0; - particles.contents = Pervasives.$at(particles.contents, new_parts); + particles.contents = PervasivesU.$at(particles.contents, new_parts); return collid; } function update_loop(canvas, param, map_dim) { let player = param[0]; - let ctx = Curry._1(canvas.getContext, "2d"); + let ctx = canvas.getContext("2d"); let cwidth = canvas.width / 1; let cheight = canvas.height / 1; let viewport = make$3([ @@ -2307,7 +2296,7 @@ function update_loop(canvas, param, map_dim) { multiplier: 1, game_over: false }; - Curry._2(state.ctx.scale, 1, 1); + state.ctx.scale(1, 1); let update_helper = function (time, state, player, objs, parts) { if (state.game_over === true) { return game_win(state.ctx); @@ -2484,7 +2473,7 @@ function convert_list(lst) { return /* [] */0; } let h = lst.hd; - return Pervasives.$at({ + return PervasivesU.$at({ hd: [ h[0], [ @@ -2548,7 +2537,7 @@ function avoid_overlap(_lst, currentLst) { let t = lst.tl; let h = lst.hd; if (!mem_loc(h[1], currentLst)) { - return Pervasives.$at({ + return PervasivesU.$at({ hd: h, tl: /* [] */0 }, avoid_overlap(t, currentLst)); @@ -2571,7 +2560,7 @@ function trim_edges(_lst, blockw, blockh) { let pixx = blockw * 16; let pixy = blockh * 16; if (!(cx < 128 || pixx - cx < 528 || cy === 0 || pixy - cy < 48)) { - return Pervasives.$at({ + return PervasivesU.$at({ hd: h, tl: /* [] */0 }, trim_edges(t, blockw, blockh)); @@ -2585,7 +2574,7 @@ function generate_clouds(cbx, cby, typ, num) { if (num === 0) { return /* [] */0; } else { - return Pervasives.$at({ + return PervasivesU.$at({ hd: [ typ, [ @@ -2610,7 +2599,7 @@ function generate_coins(_block_coord) { if (place_coin === 0) { let xc = h[1][0]; let yc = h[1][1]; - return Pervasives.$at({ + return PervasivesU.$at({ hd: [ 0, [ @@ -2807,7 +2796,7 @@ function choose_block_pattern(blockw, blockh, cbx, cby, prob) { hd: one_0, tl: /* [] */0 }; - return Pervasives.$at(four, Pervasives.$at(three, Pervasives.$at(two, one))); + return PervasivesU.$at(four, PervasivesU.$at(three, PervasivesU.$at(two, one))); } else { return /* [] */0; } @@ -2885,7 +2874,7 @@ function choose_block_pattern(blockw, blockh, cbx, cby, prob) { hd: one_0$1, tl: one_1 }; - return Pervasives.$at(three$1, Pervasives.$at(two$1, one$1)); + return PervasivesU.$at(three$1, PervasivesU.$at(two$1, one$1)); } else if (blockh - cby > 2) { let one_0$2 = [ stair_typ, @@ -2959,7 +2948,7 @@ function choose_block_pattern(blockw, blockh, cbx, cby, prob) { hd: three_0$2, tl: three_1$2 }; - return Pervasives.$at(one$2, Pervasives.$at(two$2, three$2)); + return PervasivesU.$at(one$2, PervasivesU.$at(two$2, three$2)); } else { return { hd: [ @@ -3087,7 +3076,7 @@ function generate_enemies(blockw, blockh, _cbx, _cby, acc) { hd: enemy_0, tl: /* [] */0 }; - return Pervasives.$at(enemy, generate_enemies(blockw, blockh, cbx, cby + 1, acc)); + return PervasivesU.$at(enemy, generate_enemies(blockw, blockh, cbx, cby + 1, acc)); } _cby = cby + 1; continue; @@ -3107,7 +3096,7 @@ function generate_block_enemies(_block_coord) { if (place_enemy === 0) { let xc = h[1][0]; let yc = h[1][1]; - return Pervasives.$at({ + return PervasivesU.$at({ hd: [ enemy_typ, [ @@ -3147,7 +3136,7 @@ function generate_block_locs(blockw, blockh, _cbx, _cby, _acc) { if (prob < 5) { let newacc = choose_block_pattern(blockw, blockh, cbx, cby, prob); let undup_lst = avoid_overlap(newacc, acc); - let called_acc = Pervasives.$at(acc, undup_lst); + let called_acc = PervasivesU.$at(acc, undup_lst); _acc = called_acc; _cby = cby + 1; continue; @@ -3176,7 +3165,7 @@ function generate_ground(blockw, blockh, _inc, _acc) { } if (inc > 10) { let skip = Random.int(10); - let newacc = Pervasives.$at(acc, { + let newacc = PervasivesU.$at(acc, { hd: [ 4, [ @@ -3194,7 +3183,7 @@ function generate_ground(blockw, blockh, _inc, _acc) { _inc = inc + 1; continue; } - let newacc$1 = Pervasives.$at(acc, { + let newacc$1 = PervasivesU.$at(acc, { hd: [ 4, [ @@ -3220,7 +3209,7 @@ function convert_to_block_obj(lst, context) { TAG: "SBlock", _0: sblock_typ }, context, h[1]); - return Pervasives.$at({ + return PervasivesU.$at({ hd: ob, tl: /* [] */0 }, convert_to_block_obj(lst.tl, context)); @@ -3236,7 +3225,7 @@ function convert_to_enemy_obj(lst, context) { TAG: "SEnemy", _0: senemy_typ }, context, h[1]); - return Pervasives.$at({ + return PervasivesU.$at({ hd: ob, tl: /* [] */0 }, convert_to_enemy_obj(lst.tl, context)); @@ -3250,7 +3239,7 @@ function convert_to_coin_obj(lst, context) { TAG: "SItem", _0: "Coin" }, context, lst.hd[1]); - return Pervasives.$at({ + return PervasivesU.$at({ hd: ob, tl: /* [] */0 }, convert_to_coin_obj(lst.tl, context)); @@ -3262,19 +3251,19 @@ function generate_helper(blockw, blockh, cx, cy, context) { let obj_converted_block_locs = convert_to_block_obj(converted_block_locs, context); let ground_blocks = generate_ground(blockw, blockh, 0, /* [] */0); let obj_converted_ground_blocks = convert_to_block_obj(ground_blocks, context); - let block_locations = Pervasives.$at(block_locs, ground_blocks); - let all_blocks = Pervasives.$at(obj_converted_block_locs, obj_converted_ground_blocks); + let block_locations = PervasivesU.$at(block_locs, ground_blocks); + let all_blocks = PervasivesU.$at(obj_converted_block_locs, obj_converted_ground_blocks); let enemy_locs = generate_enemies(blockw, blockh, 0, 0, block_locations); let obj_converted_enemies = convert_to_enemy_obj(enemy_locs, context); let coin_locs = generate_coins(converted_block_locs); let undup_coin_locs = trim_edges(avoid_overlap(coin_locs, converted_block_locs), blockw, blockh); - let converted_block_coin_locs = Pervasives.$at(converted_block_locs, coin_locs); + let converted_block_coin_locs = PervasivesU.$at(converted_block_locs, coin_locs); let enemy_block_locs = generate_block_enemies(converted_block_locs); let undup_enemy_block_locs = avoid_overlap(enemy_block_locs, converted_block_coin_locs); let obj_enemy_blocks = convert_to_enemy_obj(undup_enemy_block_locs, context); let coin_objects = convert_to_coin_obj(undup_coin_locs, context); let obj_panel = generate_panel(context, blockw, blockh); - return Pervasives.$at(all_blocks, Pervasives.$at(obj_converted_enemies, Pervasives.$at(coin_objects, Pervasives.$at(obj_enemy_blocks, { + return PervasivesU.$at(all_blocks, PervasivesU.$at(obj_converted_enemies, PervasivesU.$at(coin_objects, PervasivesU.$at(obj_enemy_blocks, { hd: obj_panel, tl: /* [] */0 })))); @@ -3298,7 +3287,7 @@ function generate(w, h, context) { ]; } -function init(param) { +function init() { Random.self_init(); } @@ -3327,7 +3316,7 @@ function load(param) { } }); } - let context = Curry._1(canvas.getContext, "2d"); + let context = canvas.getContext("2d"); document.addEventListener("keydown", keydown, true); document.addEventListener("keyup", keyup, true); Random.self_init(); diff --git a/jscomp/test/marshal.js b/jscomp/test/marshal.js index 5a1dcc9aff..dc884923cd 100644 --- a/jscomp/test/marshal.js +++ b/jscomp/test/marshal.js @@ -5,27 +5,27 @@ let Bytes = require("../../lib/js/bytes.js"); let Caml_external_polyfill = require("../../lib/js/caml_external_polyfill.js"); function to_buffer(buff, ofs, len, v, flags) { - if (ofs < 0 || len < 0 || ofs > (buff.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Marshal.to_buffer: substring out of bounds" - } - }); + if (!(ofs < 0 || len < 0 || ofs > (buff.length - len | 0))) { + return Caml_external_polyfill.resolve("output_value_to_buffer")(buff, ofs, len, v, flags); } - return Caml_external_polyfill.resolve("output_value_to_buffer")(buff, ofs, len, v, flags); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Marshal.to_buffer: substring out of bounds" + } + }); } function data_size(buff, ofs) { - if (ofs < 0 || ofs > (buff.length - 20 | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Marshal.data_size" - } - }); + if (!(ofs < 0 || ofs > (buff.length - 20 | 0))) { + return Caml_external_polyfill.resolve("marshal_data_size")(buff, ofs); } - return Caml_external_polyfill.resolve("marshal_data_size")(buff, ofs); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Marshal.data_size" + } + }); } function total_size(buff, ofs) { @@ -42,15 +42,15 @@ function from_bytes(buff, ofs) { }); } let len = Caml_external_polyfill.resolve("marshal_data_size")(buff, ofs); - if (ofs > (buff.length - (20 + len | 0) | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Marshal.from_bytes" - } - }); + if (ofs <= (buff.length - (20 + len | 0) | 0)) { + return Caml_external_polyfill.resolve("input_value_from_string")(buff, ofs); } - return Caml_external_polyfill.resolve("input_value_from_string")(buff, ofs); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Marshal.from_bytes" + } + }); } function from_string(buff, ofs) { diff --git a/jscomp/test/method_name_test.js b/jscomp/test/method_name_test.js index 4d0850373d..3c0e9a5a9d 100644 --- a/jscomp/test/method_name_test.js +++ b/jscomp/test/method_name_test.js @@ -2,7 +2,6 @@ 'use strict'; let Mt = require("./mt.js"); -let Curry = require("../../lib/js/curry.js"); let suites = { contents: /* [] */0 @@ -17,7 +16,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -30,18 +29,18 @@ function eq(loc, x, y) { } function f(x, i, file, v) { - Curry._1(x.case, i); - Curry._2(x.case__set, i, v); - Curry._1(x._open, file); - Curry._1(x.open__, file); + x.case(i); + x.case__set(i, v); + x._open(file); + x.open__(file); return x._MAX_LENGTH; } function ff(x, i, v) { x.make__config = v; x.make_config = v; - Curry._1(x.case__unsafe, i); - return Curry._1(x._open__, 3); + x.case__unsafe(i); + return x._open__(3); } let u = { diff --git a/jscomp/test/mock_mt.js b/jscomp/test/mock_mt.js index 3fed04d922..70eea7c7fc 100644 --- a/jscomp/test/mock_mt.js +++ b/jscomp/test/mock_mt.js @@ -2,7 +2,6 @@ 'use strict'; let List = require("../../lib/js/list.js"); -let Curry = require("../../lib/js/curry.js"); function from_pair_suites(name, suites) { console.log([ @@ -11,7 +10,7 @@ function from_pair_suites(name, suites) { ]); List.iter((function (param) { let name = param[0]; - let fn = Curry._1(param[1], undefined); + let fn = param[1](); switch (fn.TAG) { case "Eq" : console.log([ diff --git a/jscomp/test/module_alias_test.js b/jscomp/test/module_alias_test.js index 73cc0d9ee9..ad1d061bc7 100644 --- a/jscomp/test/module_alias_test.js +++ b/jscomp/test/module_alias_test.js @@ -3,7 +3,6 @@ let Mt = require("./mt.js"); let List = require("../../lib/js/list.js"); -let Curry = require("../../lib/js/curry.js"); let suites = { contents: /* [] */0 @@ -18,7 +17,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -38,7 +37,7 @@ function f(x) { let h = f(/* [] */0); -let a = Curry._1(h.length, { +let a = h.length({ hd: 1, tl: { hd: 2, diff --git a/jscomp/test/module_as_class_ffi.js b/jscomp/test/module_as_class_ffi.js index 5e45174035..487e85c4bc 100644 --- a/jscomp/test/module_as_class_ffi.js +++ b/jscomp/test/module_as_class_ffi.js @@ -3,11 +3,11 @@ let Foo_class = require("xx/foo_class"); -function f(param) { +function f() { return new Foo_class(3); } -function v(param) { +function v() { return Foo_class.ff(3); } diff --git a/jscomp/test/module_parameter_test.js b/jscomp/test/module_parameter_test.js index 226fa02a6d..d4d7c5e122 100644 --- a/jscomp/test/module_parameter_test.js +++ b/jscomp/test/module_parameter_test.js @@ -38,7 +38,7 @@ let suites_1 = { return { TAG: "Eq", _0: 3, - _1: "abc".length + _1: v("abc") }; }) ], diff --git a/jscomp/test/module_splice_test.js b/jscomp/test/module_splice_test.js index 7cf9fec71f..1aafc543dc 100644 --- a/jscomp/test/module_splice_test.js +++ b/jscomp/test/module_splice_test.js @@ -20,7 +20,7 @@ function eq(loc, param) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/more_poly_variant_test.js b/jscomp/test/more_poly_variant_test.js index 6d3fafdad8..7e9057076a 100644 --- a/jscomp/test/more_poly_variant_test.js +++ b/jscomp/test/more_poly_variant_test.js @@ -2,17 +2,19 @@ 'use strict'; -function map(f, x) { - if (typeof x !== "object") { - return "Nil"; - } - let match = x.VAL; - return { - NAME: "Cons", - VAL: [ - f(match[0]), - map(f, match[1]) - ] +function map(f) { + return function (x) { + if (typeof x !== "object") { + return "Nil"; + } + let match = x.VAL; + return { + NAME: "Cons", + VAL: [ + f(match[0]), + map(f)(match[1]) + ] + }; }; } diff --git a/jscomp/test/mpr_6033_test.js b/jscomp/test/mpr_6033_test.js index 0aa8eb3024..a0b19a29a0 100644 --- a/jscomp/test/mpr_6033_test.js +++ b/jscomp/test/mpr_6033_test.js @@ -2,6 +2,7 @@ 'use strict'; let Mt = require("./mt.js"); +let Lazy = require("../../lib/js/lazy.js"); let CamlinternalLazy = require("../../lib/js/camlinternalLazy.js"); let suites = { @@ -17,7 +18,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -33,7 +34,7 @@ function f(x) { return CamlinternalLazy.force(x) + "abc"; } -let x = CamlinternalLazy.from_fun(function () { +let x = Lazy.from_fun(function () { return "def"; }); @@ -50,4 +51,4 @@ exports.test_id = test_id; exports.eq = eq; exports.f = f; exports.u = u; -/* Not a pure module */ +/* x Not a pure module */ diff --git a/jscomp/test/mt.js b/jscomp/test/mt.js index 39ee552fae..19b896e753 100644 --- a/jscomp/test/mt.js +++ b/jscomp/test/mt.js @@ -11,7 +11,7 @@ function assert_fail(msg) { Assert.fail(undefined, undefined, msg, ""); } -function is_mocha(param) { +function is_mocha() { let match = $$Array.to_list(Process.argv); if (!match) { return false; @@ -224,7 +224,7 @@ function old_from_promise_suites_donotuse(name, suites) { describe(name, (function () { List.iter((function (param) { let code = param[1]; - it(param[0], (function (param) { + it(param[0], (function () { return code.then(function (x) { handleCode(x); return val_unit; diff --git a/jscomp/test/mutable_uncurry_test.js b/jscomp/test/mutable_uncurry_test.js index 5ff071f158..c5d12b79b5 100644 --- a/jscomp/test/mutable_uncurry_test.js +++ b/jscomp/test/mutable_uncurry_test.js @@ -2,7 +2,6 @@ 'use strict'; let Mt = require("./mt.js"); -let Curry = require("../../lib/js/curry.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); let suites = { @@ -51,22 +50,35 @@ function ut3(param, param$1, param$2) { ]; } -function t3(param) { +function t3(param, param$1, param$2) { let x0 = param.contents; - return function (param) { - let x1 = param.contents; + let x1 = param$1.contents; + let x2 = param$2.contents; + return [ + x0, + x1, + x2 + ]; +} + +function ut4(param, param$1, param$2, param$3) { + let x0 = param.contents; + let x1 = param$1.contents; + return (function (param) { + let x2 = param.contents; return function (param) { - let x2 = param.contents; + let x3 = param.contents; return [ x0, x1, - x2 + x2, + x3 ]; }; - }; + })(param$2)(param$3); } -function ut4(param, param$1, param$2, param$3) { +function t4(param, param$1, param$2, param$3) { let x0 = param.contents; let x1 = param$1.contents; return (function (param) { @@ -83,26 +95,28 @@ function ut4(param, param$1, param$2, param$3) { })(param$2)(param$3); } -function t4(param) { +function ut5(param, param$1, param$2, param$3, param$4) { let x0 = param.contents; - return function (param) { - let x1 = param.contents; + let x1 = param$1.contents; + return (function (param) { + let x2 = param.contents; return function (param) { - let x2 = param.contents; + let x3 = param.contents; return function (param) { - let x3 = param.contents; + let x4 = param.contents; return [ x0, x1, x2, - x3 + x3, + x4 ]; }; }; - }; + })(param$2)(param$3)(param$4); } -function ut5(param, param$1, param$2, param$3, param$4) { +function t5(param, param$1, param$2, param$3, param$4) { let x0 = param.contents; let x1 = param$1.contents; return (function (param) { @@ -123,60 +137,29 @@ function ut5(param, param$1, param$2, param$3, param$4) { })(param$2)(param$3)(param$4); } -function t5(param) { - let x0 = param.contents; - return function (param) { - let x1 = param.contents; - return function (param) { - let x2 = param.contents; - return function (param) { - let x3 = param.contents; - return function (param) { - let x4 = param.contents; - return [ - x0, - x1, - x2, - x3, - x4 - ]; - }; - }; - }; - }; -} - function nested0(param, param$1, param$2) { let x0 = param.contents; let x1 = param$1.contents; let x2 = param$2.contents; let a = (x0 + x1 | 0) + x2 | 0; - return function (param) { + return function (param, param$1, param$2) { let x0 = param.contents; - return function (param) { - let x1 = param.contents; - return function (param) { - let x2 = param.contents; - return ((a + x0 | 0) + x1 | 0) + x2 | 0; - }; - }; + let x1 = param$1.contents; + let x2 = param$2.contents; + return ((a + x0 | 0) + x1 | 0) + x2 | 0; }; } -function nested1(param) { +function nested1(param, param$1, param$2) { let x0 = param.contents; - return function (param) { - let x1 = param.contents; - return function (param) { - let x2 = param.contents; - let a = (x0 + x1 | 0) + x2 | 0; - return function (param, param$1, param$2) { - let x0 = param.contents; - let x1 = param$1.contents; - let x2 = param$2.contents; - return ((a + x0 | 0) + x1 | 0) + x2 | 0; - }; - }; + let x1 = param$1.contents; + let x2 = param$2.contents; + let a = (x0 + x1 | 0) + x2 | 0; + return function (param, param$1, param$2) { + let x0 = param.contents; + let x1 = param$1.contents; + let x2 = param$2.contents; + return ((a + x0 | 0) + x1 | 0) + x2 | 0; }; } @@ -192,11 +175,11 @@ eqs("File \"mutable_uncurry_test.res\", line 51, characters 4-11", ut3({ 3 ]); -eqs("File \"mutable_uncurry_test.res\", line 52, characters 4-11", Curry._1(t3({ +eqs("File \"mutable_uncurry_test.res\", line 52, characters 4-11", t3({ contents: 1 -})({ +}, { contents: 2 -}), { +}, { contents: 3 }), [ 1, diff --git a/jscomp/test/name_mangle_test.js b/jscomp/test/name_mangle_test.js index 0bf576ce7f..23d9221ab0 100644 --- a/jscomp/test/name_mangle_test.js +++ b/jscomp/test/name_mangle_test.js @@ -16,7 +16,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/noassert.js b/jscomp/test/noassert.js index 6ba808303a..9335aecfc6 100644 --- a/jscomp/test/noassert.js +++ b/jscomp/test/noassert.js @@ -2,7 +2,7 @@ 'use strict'; -function f(param) { +function f() { throw new Error("Assert_failure", { cause: { RE_EXN_ID: "Assert_failure", @@ -15,7 +15,7 @@ function f(param) { }); } -function h(param) { +function h() { } diff --git a/jscomp/test/number_lexer.js b/jscomp/test/number_lexer.js index d0042c47fa..74309374ea 100644 --- a/jscomp/test/number_lexer.js +++ b/jscomp/test/number_lexer.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let Lexing = require("../../lib/js/lexing.js"); function l(prim) { @@ -121,63 +120,54 @@ let __ocaml_lex_tables = { lex_code: "" }; +function token(l, lexbuf) { + __ocaml_lex_token_rec(l, lexbuf, 0); +} + function __ocaml_lex_token_rec(l, lexbuf, ___ocaml_lex_state) { while(true) { let __ocaml_lex_state = ___ocaml_lex_state; let __ocaml_lex_state$1 = Lexing.engine(__ocaml_lex_tables, __ocaml_lex_state, lexbuf); switch (__ocaml_lex_state$1) { case 0 : - Curry._1(l, "new line"); - ___ocaml_lex_state = 0; - continue; + l("new line"); + return token(l, lexbuf); case 1 : - Curry._1(l, "number"); - Curry._1(l, Lexing.lexeme(lexbuf)); - ___ocaml_lex_state = 0; - continue; + l("number"); + l(Lexing.lexeme(lexbuf)); + return token(l, lexbuf); case 2 : - Curry._1(l, "ident"); - Curry._1(l, Lexing.lexeme(lexbuf)); - ___ocaml_lex_state = 0; - continue; + l("ident"); + l(Lexing.lexeme(lexbuf)); + return token(l, lexbuf); case 3 : - Curry._1(l, "+"); - ___ocaml_lex_state = 0; - continue; + l("+"); + return token(l, lexbuf); case 4 : - Curry._1(l, "-"); - ___ocaml_lex_state = 0; - continue; + l("-"); + return token(l, lexbuf); case 5 : - Curry._1(l, "*"); - ___ocaml_lex_state = 0; - continue; + l("*"); + return token(l, lexbuf); case 6 : - Curry._1(l, "/"); - ___ocaml_lex_state = 0; - continue; + l("/"); + return token(l, lexbuf); case 7 : - Curry._1(l, "("); - ___ocaml_lex_state = 0; - continue; + l("("); + return token(l, lexbuf); case 8 : - Curry._1(l, ")"); - ___ocaml_lex_state = 0; - continue; + l(")"); + return token(l, lexbuf); case 9 : - return Curry._1(l, "eof"); + return l("eof"); default: - Curry._1(lexbuf.refill_buff, lexbuf); + lexbuf.refill_buff(lexbuf); ___ocaml_lex_state = __ocaml_lex_state$1; continue; } }; } -function token(l, lexbuf) { - __ocaml_lex_token_rec(l, lexbuf, 0); -} - exports.l = l; exports.__ocaml_lex_tables = __ocaml_lex_tables; exports.token = token; diff --git a/jscomp/test/ocaml_re_test.js b/jscomp/test/ocaml_re_test.js index e2a4d4ca16..6cedd81b44 100644 --- a/jscomp/test/ocaml_re_test.js +++ b/jscomp/test/ocaml_re_test.js @@ -7,15 +7,14 @@ let Char = require("../../lib/js/char.js"); let List = require("../../lib/js/list.js"); let $$Array = require("../../lib/js/array.js"); let Bytes = require("../../lib/js/bytes.js"); -let Curry = require("../../lib/js/curry.js"); let $$String = require("../../lib/js/string.js"); let Hashtbl = require("../../lib/js/hashtbl.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); let Caml_array = require("../../lib/js/caml_array.js"); let Caml_bytes = require("../../lib/js/caml_bytes.js"); -let Pervasives = require("../../lib/js/pervasives.js"); let Caml_option = require("../../lib/js/caml_option.js"); let Caml_string = require("../../lib/js/caml_string.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); @@ -32,7 +31,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -212,6 +211,10 @@ function single(c) { }; } +function add(c, l) { + return union(single(c), l); +} + function seq(c, c$p) { if (Caml_obj.lessequal(c, c$p)) { return { @@ -381,7 +384,7 @@ function bal(l, x, d, r) { }); } -function add(x, data, param) { +function add$1(x, data, param) { if (typeof param !== "object") { return { TAG: "Node", @@ -412,14 +415,14 @@ function add(x, data, param) { } } if (c < 0) { - let ll = add(x, data, l); + let ll = add$1(x, data, l); if (l === ll) { return param; } else { return bal(ll, v, d, r); } } - let rr = add(x, data, r); + let rr = add$1(x, data, r); if (r === rr) { return param; } else { @@ -427,6 +430,10 @@ function add(x, data, param) { } } +function fold_right(t, init, f) { + return List.fold_right(f, t, init); +} + let cany = { hd: [ 0, @@ -579,7 +586,7 @@ function bal$1(l, v, r) { }); } -function add$1(x, param) { +function add$2(x, param) { if (typeof param !== "object") { return { TAG: "Node", @@ -597,14 +604,14 @@ function add$1(x, param) { return param; } if (c < 0) { - let ll = add$1(x, l); + let ll = add$2(x, l); if (l === ll) { return param; } else { return bal$1(ll, v, r); } } - let rr = add$1(x, r); + let rr = add$2(x, r); if (r === rr) { return param; } else { @@ -668,7 +675,7 @@ function first(f, _x) { if (!x) { return; } - let res = Curry._1(f, x.hd); + let res = f(x.hd); if (res !== undefined) { return res; } @@ -774,6 +781,20 @@ function rep(ids, kind, sem, x) { }); } +function mark(ids, m) { + return mk_expr(ids, { + TAG: "Mark", + _0: m + }); +} + +function pmark(ids, i) { + return mk_expr(ids, { + TAG: "Pmark", + _0: i + }); +} + function erase(ids, m, m$p) { return mk_expr(ids, { TAG: "Erase", @@ -782,6 +803,20 @@ function erase(ids, m, m$p) { }); } +function before(ids, c) { + return mk_expr(ids, { + TAG: "Before", + _0: c + }); +} + +function after(ids, c) { + return mk_expr(ids, { + TAG: "After", + _0: c + }); +} + function rename(ids, x) { let l = x.def; if (typeof l !== "object") { @@ -791,8 +826,8 @@ function rename(ids, x) { case "Alt" : return mk_expr(ids, { TAG: "Alt", - _0: List.map((function (param) { - return rename(ids, param); + _0: List.map((function (extra) { + return rename(ids, extra); }), l._0) }); case "Seq" : @@ -1008,7 +1043,7 @@ function reset_table(a) { } function mark_used_indices(tbl) { - return function (param) { + return function (extra) { return List.iter((function (x) { switch (x.TAG) { case "TSeq" : @@ -1025,7 +1060,7 @@ function mark_used_indices(tbl) { } }), x._0.marks); - }), param); + }), extra); }; } @@ -1052,7 +1087,7 @@ function free_index(tbl_ref, l) { return idx; } -function remove_matches(param) { +function remove_matches(extra) { return List.filter((function (x) { switch (x.TAG) { case "TSeq" : @@ -1062,7 +1097,7 @@ function remove_matches(param) { return false; } - }), param); + }), extra); } function split_at_match_rec(_l$p, _x) { @@ -1074,12 +1109,7 @@ function split_at_match_rec(_l$p, _x) { switch (x$1.TAG) { case "TSeq" : case "TExp" : - _x = x.tl; - _l$p = { - hd: x$1, - tl: l$p - }; - continue; + break; case "TMatch" : return [ List.rev(l$p), @@ -1087,18 +1117,23 @@ function split_at_match_rec(_l$p, _x) { ]; } - } else { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "ocaml_re_test.res", - 816, - 16 - ] - } - }); + _x = x.tl; + _l$p = { + hd: x$1, + tl: l$p + }; + continue; } + throw new Error("Assert_failure", { + cause: { + RE_EXN_ID: "Assert_failure", + _1: [ + "ocaml_re_test.res", + 816, + 16 + ] + } + }); }; } @@ -1345,7 +1380,7 @@ function delta_1(marks, c, next_cat, prev_cat, x, rem) { } case "Pmark" : let marks_marks$1 = marks.marks; - let marks_pmarks$1 = add$1(s._0, marks.pmarks); + let marks_pmarks$1 = add$2(s._0, marks.pmarks); let marks$2 = { marks: marks_marks$1, pmarks: marks_pmarks$1 @@ -1490,7 +1525,7 @@ function iter(_n, f, _v) { if (n === 0) { return v; } - _v = Curry._1(f, v); + _v = f(v); _n = n - 1 | 0; continue; }; @@ -1500,9 +1535,9 @@ function category(re, c) { if (c === -1) { return Re_automata_Category.inexistant; } else if (c === re.lnl) { - return Curry._2(Re_automata_Category.$plus$plus, Curry._2(Re_automata_Category.$plus$plus, Re_automata_Category.lastnewline, Re_automata_Category.newline), Re_automata_Category.not_letter); + return Re_automata_Category.$plus$plus(Re_automata_Category.$plus$plus(Re_automata_Category.lastnewline, Re_automata_Category.newline), Re_automata_Category.not_letter); } else { - return Curry._1(Re_automata_Category.from_char, Caml_bytes.get(re.col_repr, c)); + return Re_automata_Category.from_char(Caml_bytes.get(re.col_repr, c)); } } @@ -1531,13 +1566,13 @@ function mk_state(ncol, desc) { function find_state(re, desc) { try { - return Curry._2(Re_automata_State.Table.find, re.states, desc); + return Re_automata_State.Table.find(re.states, desc); } catch (raw_exn){ let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); if (exn.RE_EXN_ID === "Not_found") { let st = mk_state(re.ncol, desc); - Curry._3(Re_automata_State.Table.add, re.states, desc, st); + Re_automata_State.Table.add(re.states, desc, st); return st; } throw new Error(exn.RE_EXN_ID, { @@ -1636,7 +1671,7 @@ function find_initial_state(re, cat) { catch (raw_exn){ let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); if (exn.RE_EXN_ID === "Not_found") { - let st = find_state(re, Curry._2(Re_automata_State.create, cat, re.initial)); + let st = find_state(re, Re_automata_State.create(cat, re.initial)); re.initial_states = { hd: [ cat, @@ -1733,7 +1768,7 @@ function scan_str(info, s, initial_state, groups) { } function cadd(c, s) { - return union(single(c), s); + return add(c, s); } function trans_set(cache, cm, s) { @@ -1768,10 +1803,10 @@ function trans_set(cache, cm, s) { catch (raw_exn){ let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); if (exn.RE_EXN_ID === "Not_found") { - let l = List.fold_right((function (param, l) { + let l = fold_right(s, /* [] */0, (function (param, l) { return union(seq(Caml_bytes.get(cm, param[0]), Caml_bytes.get(cm, param[1])), l); - }), s, /* [] */0); - cache.contents = add(v, l, cache.contents); + })); + cache.contents = add$1(v, l, cache.contents); return l; } throw new Error(exn.RE_EXN_ID, { @@ -1801,7 +1836,7 @@ function is_charset(_x) { case "Alternative" : case "Intersection" : case "Complement" : - return List.for_all(is_charset, x._0); + break; case "Difference" : if (!is_charset(x._0)) { return false; @@ -1811,6 +1846,7 @@ function is_charset(_x) { default: return false; } + return List.for_all(is_charset, x._0); }; } @@ -1826,7 +1862,7 @@ function split(s, cm) { return; } let match = t.hd; - Curry._2(f, match[0], match[1]); + f(match[0], match[1]); _t = t.tl; continue; }; @@ -1857,13 +1893,7 @@ let cdigit = seq(/* '0' */48, /* '9' */57); let calnum = union(calpha, cdigit); -let cword = union({ - hd: [ - /* '_' */95, - /* '_' */95 - ], - tl: /* [] */0 -}, calnum); +let cword = add(/* '_' */95, calnum); function colorize(c, regexp) { let lnl = { @@ -2275,7 +2305,7 @@ function merge_sequences(_x) { } break; case "Alternative" : - _x = Pervasives.$at(l$p._0, x.tl); + _x = PervasivesU.$at(l$p._0, x.tl); continue; default: @@ -2304,67 +2334,31 @@ function translate(ids, kind, _ign_group, ign_case, _greedy, pos, cache, c, _x) if (typeof x !== "object") { switch (x) { case "Beg_of_line" : - let c$1 = Curry._2(Re_automata_Category.$plus$plus, Re_automata_Category.inexistant, Re_automata_Category.newline); return [ - mk_expr(ids, { - TAG: "After", - _0: c$1 - }), + after(ids, Re_automata_Category.$plus$plus(Re_automata_Category.inexistant, Re_automata_Category.newline)), kind ]; case "End_of_line" : - let c$2 = Curry._2(Re_automata_Category.$plus$plus, Re_automata_Category.inexistant, Re_automata_Category.newline); return [ - mk_expr(ids, { - TAG: "Before", - _0: c$2 - }), + before(ids, Re_automata_Category.$plus$plus(Re_automata_Category.inexistant, Re_automata_Category.newline)), kind ]; case "Beg_of_word" : - let c$3 = Curry._2(Re_automata_Category.$plus$plus, Re_automata_Category.inexistant, Re_automata_Category.not_letter); - let c$4 = Curry._2(Re_automata_Category.$plus$plus, Re_automata_Category.inexistant, Re_automata_Category.letter); return [ - seq$1(ids, "First", mk_expr(ids, { - TAG: "After", - _0: c$3 - }), mk_expr(ids, { - TAG: "Before", - _0: c$4 - })), + seq$1(ids, "First", after(ids, Re_automata_Category.$plus$plus(Re_automata_Category.inexistant, Re_automata_Category.not_letter)), before(ids, Re_automata_Category.$plus$plus(Re_automata_Category.inexistant, Re_automata_Category.letter))), kind ]; case "End_of_word" : - let c$5 = Curry._2(Re_automata_Category.$plus$plus, Re_automata_Category.inexistant, Re_automata_Category.letter); - let c$6 = Curry._2(Re_automata_Category.$plus$plus, Re_automata_Category.inexistant, Re_automata_Category.not_letter); return [ - seq$1(ids, "First", mk_expr(ids, { - TAG: "After", - _0: c$5 - }), mk_expr(ids, { - TAG: "Before", - _0: c$6 - })), + seq$1(ids, "First", after(ids, Re_automata_Category.$plus$plus(Re_automata_Category.inexistant, Re_automata_Category.letter)), before(ids, Re_automata_Category.$plus$plus(Re_automata_Category.inexistant, Re_automata_Category.not_letter))), kind ]; case "Not_bound" : return [ alt(ids, { - hd: seq$1(ids, "First", mk_expr(ids, { - TAG: "After", - _0: Re_automata_Category.letter - }), mk_expr(ids, { - TAG: "Before", - _0: Re_automata_Category.letter - })), + hd: seq$1(ids, "First", after(ids, Re_automata_Category.letter), before(ids, Re_automata_Category.letter)), tl: { - hd: seq$1(ids, "First", mk_expr(ids, { - TAG: "After", - _0: Re_automata_Category.letter - }), mk_expr(ids, { - TAG: "Before", - _0: Re_automata_Category.letter - })), + hd: seq$1(ids, "First", after(ids, Re_automata_Category.letter), before(ids, Re_automata_Category.letter)), tl: /* [] */0 } }), @@ -2372,43 +2366,27 @@ function translate(ids, kind, _ign_group, ign_case, _greedy, pos, cache, c, _x) ]; case "Beg_of_str" : return [ - mk_expr(ids, { - TAG: "After", - _0: Re_automata_Category.inexistant - }), + after(ids, Re_automata_Category.inexistant), kind ]; case "End_of_str" : return [ - mk_expr(ids, { - TAG: "Before", - _0: Re_automata_Category.inexistant - }), + before(ids, Re_automata_Category.inexistant), kind ]; case "Last_end_of_line" : - let c$7 = Curry._2(Re_automata_Category.$plus$plus, Re_automata_Category.inexistant, Re_automata_Category.lastnewline); return [ - mk_expr(ids, { - TAG: "Before", - _0: c$7 - }), + before(ids, Re_automata_Category.$plus$plus(Re_automata_Category.inexistant, Re_automata_Category.lastnewline)), kind ]; case "Start" : return [ - mk_expr(ids, { - TAG: "After", - _0: Re_automata_Category.search_boundary - }), + after(ids, Re_automata_Category.search_boundary), kind ]; case "Stop" : return [ - mk_expr(ids, { - TAG: "Before", - _0: Re_automata_Category.search_boundary - }), + before(ids, Re_automata_Category.search_boundary), kind ]; @@ -2497,13 +2475,7 @@ function translate(ids, kind, _ign_group, ign_case, _greedy, pos, cache, c, _x) pos.contents = pos.contents + 2 | 0; let match$3 = translate(ids, kind, ign_group, ign_case, greedy, pos, cache, c, r$p); return [ - seq$1(ids, "First", mk_expr(ids, { - TAG: "Mark", - _0: p - }), seq$1(ids, "First", match$3[0], mk_expr(ids, { - TAG: "Mark", - _0: p + 1 | 0 - }))), + seq$1(ids, "First", mark(ids, p), seq$1(ids, "First", match$3[0], mark(ids, p + 1 | 0))), match$3[1] ]; case "No_group" : @@ -2530,10 +2502,7 @@ function translate(ids, kind, _ign_group, ign_case, _greedy, pos, cache, c, _x) case "Pmark" : let match$5 = translate(ids, kind, ign_group, ign_case, greedy, pos, cache, c, x._1); return [ - seq$1(ids, "First", mk_expr(ids, { - TAG: "Pmark", - _0: x._0 - }), match$5[0]), + seq$1(ids, "First", pmark(ids, x._0), match$5[0]), match$5[1] ]; default: @@ -2623,13 +2592,13 @@ function handle_case(_ign_case, _x) { case "Sequence" : return { TAG: "Sequence", - _0: List.map((function (param) { - return handle_case(ign_case, param); + _0: List.map((function (extra) { + return handle_case(ign_case, extra); }), x._0) }; case "Alternative" : - let l$p = List.map((function (param) { - return handle_case(ign_case, param); + let l$p = List.map((function (extra) { + return handle_case(ign_case, extra); }), x._0); if (is_charset({ TAG: "Alternative", @@ -2839,6 +2808,18 @@ function repn(r, i, j) { }; } +function rep$1(r) { + return repn(r, 0, undefined); +} + +function rep1(r) { + return repn(r, 1, undefined); +} + +function opt(r) { + return repn(r, 0, 1); +} + function set(str) { let s = /* [] */0; for(let i = 0 ,i_finish = str.length; i < i_finish; ++i){ @@ -2850,6 +2831,13 @@ function set(str) { }; } +function rg(c, c$p) { + return { + TAG: "Set", + _0: seq(c, c$p) + }; +} + function compl(l) { let r = { TAG: "Complement", @@ -2883,10 +2871,7 @@ let notnl = { }; let lower = alt$1({ - hd: { - TAG: "Set", - _0: seq(/* 'a' */97, /* 'z' */122) - }, + hd: rg(/* 'a' */97, /* 'z' */122), tl: { hd: { TAG: "Set", @@ -2899,15 +2884,9 @@ let lower = alt$1({ } }, tl: { - hd: { - TAG: "Set", - _0: seq(/* '\223' */223, /* '\246' */246) - }, + hd: rg(/* '\223' */223, /* '\246' */246), tl: { - hd: { - TAG: "Set", - _0: seq(/* '\248' */248, /* '\255' */255) - }, + hd: rg(/* '\248' */248, /* '\255' */255), tl: /* [] */0 } } @@ -2915,20 +2894,11 @@ let lower = alt$1({ }); let upper = alt$1({ - hd: { - TAG: "Set", - _0: seq(/* 'A' */65, /* 'Z' */90) - }, + hd: rg(/* 'A' */65, /* 'Z' */90), tl: { - hd: { - TAG: "Set", - _0: seq(/* '\192' */192, /* '\214' */214) - }, + hd: rg(/* '\192' */192, /* '\214' */214), tl: { - hd: { - TAG: "Set", - _0: seq(/* '\216' */216, /* '\222' */222) - }, + hd: rg(/* '\216' */216, /* '\222' */222), tl: /* [] */0 } } @@ -2966,10 +2936,7 @@ let alpha = alt$1({ } }); -let digit = { - TAG: "Set", - _0: seq(/* '0' */48, /* '9' */57) -}; +let digit = rg(/* '0' */48, /* '9' */57); let alnum = alt$1({ hd: alpha, @@ -2996,95 +2963,50 @@ let wordc = alt$1({ } }); -let ascii = { - TAG: "Set", - _0: seq(/* '\000' */0, /* '\127' */127) -}; +let ascii = rg(/* '\000' */0, /* '\127' */127); let blank = set("\t "); let cntrl = alt$1({ - hd: { - TAG: "Set", - _0: seq(/* '\000' */0, /* '\031' */31) - }, + hd: rg(/* '\000' */0, /* '\031' */31), tl: { - hd: { - TAG: "Set", - _0: seq(/* '\127' */127, /* '\159' */159) - }, + hd: rg(/* '\127' */127, /* '\159' */159), tl: /* [] */0 } }); let graph = alt$1({ - hd: { - TAG: "Set", - _0: seq(/* '!' */33, /* '~' */126) - }, + hd: rg(/* '!' */33, /* '~' */126), tl: { - hd: { - TAG: "Set", - _0: seq(/* '\160' */160, /* '\255' */255) - }, + hd: rg(/* '\160' */160, /* '\255' */255), tl: /* [] */0 } }); let print = alt$1({ - hd: { - TAG: "Set", - _0: seq(/* ' ' */32, /* '~' */126) - }, + hd: rg(/* ' ' */32, /* '~' */126), tl: { - hd: { - TAG: "Set", - _0: seq(/* '\160' */160, /* '\255' */255) - }, + hd: rg(/* '\160' */160, /* '\255' */255), tl: /* [] */0 } }); let punct = alt$1({ - hd: { - TAG: "Set", - _0: seq(/* '!' */33, /* '/' */47) - }, + hd: rg(/* '!' */33, /* '/' */47), tl: { - hd: { - TAG: "Set", - _0: seq(/* ':' */58, /* '@' */64) - }, + hd: rg(/* ':' */58, /* '@' */64), tl: { - hd: { - TAG: "Set", - _0: seq(/* '[' */91, /* '`' */96) - }, + hd: rg(/* '[' */91, /* '`' */96), tl: { - hd: { - TAG: "Set", - _0: seq(/* '{' */123, /* '~' */126) - }, + hd: rg(/* '{' */123, /* '~' */126), tl: { - hd: { - TAG: "Set", - _0: seq(/* '\160' */160, /* '\169' */169) - }, + hd: rg(/* '\160' */160, /* '\169' */169), tl: { - hd: { - TAG: "Set", - _0: seq(/* '\171' */171, /* '\180' */180) - }, + hd: rg(/* '\171' */171, /* '\180' */180), tl: { - hd: { - TAG: "Set", - _0: seq(/* '\182' */182, /* '\185' */185) - }, + hd: rg(/* '\182' */182, /* '\185' */185), tl: { - hd: { - TAG: "Set", - _0: seq(/* '\187' */187, /* '\191' */191) - }, + hd: rg(/* '\187' */187, /* '\191' */191), tl: { hd: { TAG: "Set", @@ -3131,10 +3053,7 @@ let space = alt$1({ } }, tl: { - hd: { - TAG: "Set", - _0: seq(/* '\t' */9, /* '\r' */13) - }, + hd: rg(/* '\t' */9, /* '\r' */13), tl: /* [] */0 } }); @@ -3142,73 +3061,14 @@ let space = alt$1({ let xdigit = alt$1({ hd: digit, tl: { - hd: { - TAG: "Set", - _0: seq(/* 'a' */97, /* 'f' */102) - }, + hd: rg(/* 'a' */97, /* 'f' */102), tl: { - hd: { - TAG: "Set", - _0: seq(/* 'A' */65, /* 'F' */70) - }, + hd: rg(/* 'A' */65, /* 'F' */70), tl: /* [] */0 } } }); -function compile(r) { - let regexp = anchored(r) ? ({ - TAG: "Group", - _0: r - }) : seq$2({ - hd: { - TAG: "Sem", - _0: "Shortest", - _1: repn(any, 0, undefined) - }, - tl: { - hd: { - TAG: "Group", - _0: r - }, - tl: /* [] */0 - } - }); - let regexp$1 = handle_case(false, regexp); - let c = Bytes.make(257, /* '\000' */0); - let need_lnl = colorize(c, regexp$1); - let match = flatten_cmap(c); - let ncol = match[2]; - let col = match[0]; - let lnl = need_lnl ? ncol : -1; - let ncol$1 = need_lnl ? ncol + 1 | 0 : ncol; - let ids = { - contents: 0 - }; - let pos = { - contents: 0 - }; - let match$1 = translate(ids, "First", false, false, "Greedy", pos, { - contents: "Empty" - }, col, regexp$1); - let r$1 = enforce_kind(ids, "First", match$1[1], match$1[0]); - let col_repr = match[1]; - let group_count = pos.contents / 2 | 0; - return { - initial: r$1, - initial_states: /* [] */0, - cols: col, - col_repr: col_repr, - ncol: ncol$1, - lnl: lnl, - tbl: { - contents: [false] - }, - states: Curry._1(Re_automata_State.Table.create, 97), - group_count: group_count - }; -} - function exec_internal(name, posOpt, lenOpt, groups, re, s) { let pos = posOpt !== undefined ? posOpt : 0; let len = lenOpt !== undefined ? lenOpt : -1; @@ -3248,14 +3108,14 @@ function exec_internal(name, posOpt, lenOpt, groups, re, s) { pos: pos, last: last }; - let initial_cat = pos === 0 ? Curry._2(Re_automata_Category.$plus$plus, Re_automata_Category.search_boundary, Re_automata_Category.inexistant) : Curry._2(Re_automata_Category.$plus$plus, Re_automata_Category.search_boundary, category(re, get_color(re, s, pos - 1 | 0))); + let initial_cat = pos === 0 ? Re_automata_Category.$plus$plus(Re_automata_Category.search_boundary, Re_automata_Category.inexistant) : Re_automata_Category.$plus$plus(Re_automata_Category.search_boundary, category(re, get_color(re, s, pos - 1 | 0))); let initial_state = find_initial_state(re, initial_cat); let st = scan_str(info, s, initial_state, groups); let res; if (st.idx === -3 || partial) { res = status(st.desc); } else { - let final_cat = last === slen ? Curry._2(Re_automata_Category.$plus$plus, Re_automata_Category.search_boundary, Re_automata_Category.inexistant) : Curry._2(Re_automata_Category.$plus$plus, Re_automata_Category.search_boundary, category(re, get_color(re, s, last))); + let final_cat = last === slen ? Re_automata_Category.$plus$plus(Re_automata_Category.search_boundary, Re_automata_Category.inexistant) : Re_automata_Category.$plus$plus(Re_automata_Category.search_boundary, category(re, get_color(re, s, last))); let match = final(info, st, final_cat); if (groups) { Caml_array.set(info.positions, match[0], last + 1 | 0); @@ -3345,11 +3205,10 @@ function posix_class_of_string(x) { case "xdigit" : return xdigit; default: - let s = "Invalid pcre class: " + x; throw new Error("Invalid_argument", { cause: { RE_EXN_ID: "Invalid_argument", - _1: s + _1: "Invalid pcre class: " + x } }); } @@ -3380,18 +3239,18 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { for(let j = 0; j < len; ++j){ try { if (Caml_string.get(s$p, j) !== Caml_string.get(s, i.contents + j | 0)) { - throw new Error(Pervasives.Exit, { + throw new Error(PervasivesU.Exit, { cause: { - RE_EXN_ID: Pervasives.Exit + RE_EXN_ID: PervasivesU.Exit } }); } } catch (exn){ - throw new Error(Pervasives.Exit, { + throw new Error(PervasivesU.Exit, { cause: { - RE_EXN_ID: Pervasives.Exit + RE_EXN_ID: PervasivesU.Exit } }); } @@ -3401,7 +3260,7 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { } catch (raw_exn){ let exn$1 = Caml_js_exceptions.internalToOCamlException(raw_exn); - if (exn$1.RE_EXN_ID === Pervasives.Exit) { + if (exn$1.RE_EXN_ID === PervasivesU.Exit) { return false; } throw new Error(exn$1.RE_EXN_ID, { @@ -3409,7 +3268,7 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { }); } }; - let get = function (param) { + let get = function () { let r = Caml_string.get(s, i.contents); i.contents = i.contents + 1 | 0; return r; @@ -3431,7 +3290,8 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { }; } }; - let regexp$p = function (_left) { + let regexp = function () { + let _left = branch$p(/* [] */0); while(true) { let left = _left; if (!accept(/* '|' */124)) { @@ -3447,16 +3307,13 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { continue; }; }; - let branch$p = function (_left) { + let comment = function () { while(true) { - let left = _left; - if (i.contents === l || test(/* '|' */124) || test(/* ')' */41)) { - return seq$2(List.rev(left)); + if (accept(/* ')' */41)) { + return epsilon; } - _left = { - hd: piece(), - tl: left - }; + i.contents = i.contents + 1 | 0; + _param = undefined; continue; }; }; @@ -3517,10 +3374,7 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { }; } _s = { - hd: { - TAG: "Set", - _0: seq(c, match$1.VAL) - }, + hd: rg(c, match$1.VAL), tl: s }; continue; @@ -3541,16 +3395,16 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { continue; }; }; - let piece = function (param) { + let piece = function () { let r = atom(); if (accept(/* '*' */42)) { - return greedy_mod(repn(r, 0, undefined)); + return greedy_mod(rep$1(r)); } if (accept(/* '+' */43)) { - return greedy_mod(repn(r, 1, undefined)); + return greedy_mod(rep1(r)); } if (accept(/* '?' */63)) { - return greedy_mod(repn(r, 0, 1)); + return greedy_mod(opt(r)); } if (!accept(/* '{' */123)) { return r; @@ -3577,7 +3431,20 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { i.contents = i.contents - 1 | 0; return r; }; - let integer = function (param) { + let branch$p = function (_left) { + while(true) { + let left = _left; + if (i.contents === l || test(/* '|' */124) || test(/* ')' */41)) { + return seq$2(List.rev(left)); + } + _left = { + hd: piece(), + tl: left + }; + continue; + }; + }; + let integer = function () { if (i.contents === l) { return; } @@ -3610,7 +3477,7 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { }; } }; - let atom = function (param) { + let atom = function () { if (accept(/* '.' */46)) { if (dotall) { return any; @@ -3621,7 +3488,7 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { if (accept(/* '(' */40)) { if (accept(/* '?' */63)) { if (accept(/* ':' */58)) { - let r = regexp$p(branch$p(/* [] */0)); + let r = regexp(); if (!accept(/* ')' */41)) { throw new Error(Parse_error, { cause: { @@ -3632,15 +3499,7 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { return r; } if (accept(/* '#' */35)) { - let _param; - while(true) { - if (accept(/* ')' */41)) { - return epsilon; - } - i.contents = i.contents + 1 | 0; - _param = undefined; - continue; - }; + return comment(); } throw new Error(Parse_error, { cause: { @@ -3648,7 +3507,7 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { } }); } - let r$1 = regexp$p(branch$p(/* [] */0)); + let r$1 = regexp(); if (!accept(/* ')' */41)) { throw new Error(Parse_error, { cause: { @@ -3881,7 +3740,7 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { }; } }; - let char = function (param) { + let char = function () { if (i.contents === l) { throw new Error(Parse_error, { cause: { @@ -4187,7 +4046,7 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { }; } }; - let res = regexp$p(branch$p(/* [] */0)); + let res = regexp(); if (i.contents !== l) { throw new Error(Parse_error, { cause: { @@ -4229,6 +4088,60 @@ function re(flagsOpt, pat) { } } +function regexp(flags, pat) { + let r = re(flags, pat); + let regexp$1 = anchored(r) ? ({ + TAG: "Group", + _0: r + }) : seq$2({ + hd: { + TAG: "Sem", + _0: "Shortest", + _1: rep$1(any) + }, + tl: { + hd: { + TAG: "Group", + _0: r + }, + tl: /* [] */0 + } + }); + let regexp$2 = handle_case(false, regexp$1); + let c = Bytes.make(257, /* '\000' */0); + let need_lnl = colorize(c, regexp$2); + let match = flatten_cmap(c); + let ncol = match[2]; + let col = match[0]; + let lnl = need_lnl ? ncol : -1; + let ncol$1 = need_lnl ? ncol + 1 | 0 : ncol; + let ids = { + contents: 0 + }; + let pos = { + contents: 0 + }; + let match$1 = translate(ids, "First", false, false, "Greedy", pos, { + contents: "Empty" + }, col, regexp$2); + let r$1 = enforce_kind(ids, "First", match$1[1], match$1[0]); + let col_repr = match[1]; + let group_count = pos.contents / 2 | 0; + return { + initial: r$1, + initial_states: /* [] */0, + cols: col, + col_repr: col_repr, + ncol: ncol$1, + lnl: lnl, + tbl: { + contents: [false] + }, + states: Re_automata_State.Table.create(97), + group_count: group_count + }; +} + function exec(rex, pos, s) { let len; let substr = exec_internal("Re.exec", pos, len, true, rex, s); @@ -4251,7 +4164,7 @@ function exec(rex, pos, s) { let s = "a".repeat(1048575) + "b"; -eq("File \"ocaml_re_test.res\", line 3843, characters 7-14", get(exec(compile(re(undefined, "aa?b")), undefined, s), 0), "aab"); +eq("File \"ocaml_re_test.res\", line 3843, characters 7-14", get(exec(regexp(undefined, "aa?b"), undefined, s), 0), "aab"); Mt.from_pair_suites("Ocaml_re_test", suites.contents); diff --git a/jscomp/test/of_string_test.js b/jscomp/test/of_string_test.js index fffd6400b2..3e1775ed0d 100644 --- a/jscomp/test/of_string_test.js +++ b/jscomp/test/of_string_test.js @@ -2,7 +2,7 @@ 'use strict'; let Mt = require("./mt.js"); -let Pervasives = require("../../lib/js/pervasives.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); let suites_0 = [ "string_of_float_1", @@ -10,7 +10,7 @@ let suites_0 = [ return { TAG: "Eq", _0: "10.", - _1: Pervasives.string_of_float(10) + _1: PervasivesU.string_of_float(10) }; }) ]; @@ -33,7 +33,7 @@ let suites_1 = { return { TAG: "Eq", _0: "10.", - _1: Pervasives.valid_float_lexem("10") + _1: PervasivesU.valid_float_lexem("10") }; }) ], diff --git a/jscomp/test/offset.js b/jscomp/test/offset.js index f14004e9c2..efec476040 100644 --- a/jscomp/test/offset.js +++ b/jscomp/test/offset.js @@ -3,7 +3,6 @@ let Caml = require("../../lib/js/caml.js"); let List = require("../../lib/js/list.js"); -let Curry = require("../../lib/js/curry.js"); let $$String = require("../../lib/js/string.js"); let Caml_option = require("../../lib/js/caml_option.js"); @@ -525,7 +524,7 @@ function iter(f, _param) { return; } iter(f, param.l); - Curry._1(f, param.v); + f(param.v); _param = param.r; continue; }; @@ -538,7 +537,7 @@ function fold(f, _s, _accu) { if (typeof s !== "object") { return accu; } - _accu = Curry._2(f, s.v, fold(f, s.l, accu)); + _accu = f(s.v, fold(f, s.l, accu)); _s = s.r; continue; }; @@ -550,7 +549,7 @@ function for_all(p, _param) { if (typeof param !== "object") { return true; } - if (!Curry._1(p, param.v)) { + if (!p(param.v)) { return false; } if (!for_all(p, param.l)) { @@ -567,7 +566,7 @@ function exists(p, _param) { if (typeof param !== "object") { return false; } - if (Curry._1(p, param.v)) { + if (p(param.v)) { return true; } if (exists(p, param.l)) { @@ -586,7 +585,7 @@ function filter(p, param) { let v = param.v; let l = param.l; let l$p = filter(p, l); - let pv = Curry._1(p, v); + let pv = p(v); let r$p = filter(p, r); if (pv) { if (l === l$p && r === r$p) { @@ -610,7 +609,7 @@ function partition(p, param) { let match = partition(p, param.l); let lf = match[1]; let lt = match[0]; - let pv = Curry._1(p, v); + let pv = p(v); let match$1 = partition(p, param.r); let rf = match$1[1]; let rt = match$1[0]; @@ -686,7 +685,7 @@ function find_first(f, _param) { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _param$1 = param.l; while(true) { @@ -696,7 +695,7 @@ function find_first(f, _param) { return v0; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.l; _v0 = v$1; continue; @@ -717,7 +716,7 @@ function find_first_opt(f, _param) { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _param$1 = param.l; while(true) { @@ -727,7 +726,7 @@ function find_first_opt(f, _param) { return Caml_option.some(v0); } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.l; _v0 = v$1; continue; @@ -752,7 +751,7 @@ function find_last(f, _param) { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _param$1 = param.r; while(true) { @@ -762,7 +761,7 @@ function find_last(f, _param) { return v0; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.r; _v0 = v$1; continue; @@ -783,7 +782,7 @@ function find_last_opt(f, _param) { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _param$1 = param.r; while(true) { @@ -793,7 +792,7 @@ function find_last_opt(f, _param) { return Caml_option.some(v0); } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.r; _v0 = v$1; continue; @@ -831,7 +830,7 @@ function map(f, param) { let v = param.v; let l = param.l; let l$p = map(f, l); - let v$p = Curry._1(f, v); + let v$p = f(v); let r$p = map(f, r); if (l === l$p && v === v$p && r === r$p) { return param; diff --git a/jscomp/test/option_repr_test.js b/jscomp/test/option_repr_test.js index 192d824106..d11f4a8f4b 100644 --- a/jscomp/test/option_repr_test.js +++ b/jscomp/test/option_repr_test.js @@ -112,7 +112,7 @@ let length_10_id = Belt_List.makeBy(10, (function (x) { return x; })); -function f13$1(param) { +function f13$1() { return Caml_obj.equal(Belt_List.take(length_10_id, 8), { hd: 1, tl: { diff --git a/jscomp/test/optional_ffi_test.js b/jscomp/test/optional_ffi_test.js index 5e5be366e6..ee8af83093 100644 --- a/jscomp/test/optional_ffi_test.js +++ b/jscomp/test/optional_ffi_test.js @@ -19,7 +19,7 @@ function eq(loc, param) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/pipe_syntax.js b/jscomp/test/pipe_syntax.js index 058c3f6833..868d41895b 100644 --- a/jscomp/test/pipe_syntax.js +++ b/jscomp/test/pipe_syntax.js @@ -1,66 +1,67 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let Caml_option = require("../../lib/js/caml_option.js"); function t0(x, f) { - return Curry._1(f, Curry._1(f, Curry._1(f, x))); + return f(f(f(x))); } function t1(x, f) { - return Curry._1(f, x); + return f(x); } function t2(x, f, g) { - return Curry._1(f, Curry._3(g, Curry._1(f, x), x, x)); + return f(g(f(x), x, x)); } function t3(x, f) { - return Curry._3(f, x, 1, 2); + return f(x, 1, 2); } function f(a, b, c) { return [ - Curry._1(b, a), - Curry._1(c, a) + b(a), + c(a) ]; } function f1(a, b, c, d) { - let __tuple_internal_obj = Curry._1(a, b); + let __tuple_internal_obj = a(b); return [ - Curry._1(c, __tuple_internal_obj), - Curry._1(d, __tuple_internal_obj) + c(__tuple_internal_obj), + d(__tuple_internal_obj) ]; } function f2(a, b, c, d) { - let __tuple_internal_obj = Curry._1(a, b); - let u = Curry._1(c, __tuple_internal_obj); - let v = Curry._1(d, __tuple_internal_obj); + let __tuple_internal_obj = a(b); + let u = c(__tuple_internal_obj); + let v = d(__tuple_internal_obj); return u + v | 0; } function f3(a, b, c, d, e) { - let __tuple_internal_obj = Curry._1(a, b); - let u = Curry._2(c, __tuple_internal_obj, d); - let v = Curry._3(d, __tuple_internal_obj, 1, 2); - let h = Curry._1(e, __tuple_internal_obj); - return (u + v | 0) + h | 0; + let __tuple_internal_obj = a(b); + let param = [ + c(__tuple_internal_obj, d), + d(__tuple_internal_obj, 1, 2), + e(__tuple_internal_obj) + ]; + return (param[0] + param[1] | 0) + param[2] | 0; } function f4(a, b, c) { return [ - Curry._2(b, a, c), - Curry._2(b, a, c) + b(a, c), + b(a, c) ]; } function f5(a, b, c, d) { - let v0 = Curry._3(b, a, c, c); - let v1 = Curry._3(b, a, c, c); - let v2 = Curry._3(b, a, d, d); + let v0 = b(a, c, c); + let v1 = b(a, c, c); + let v2 = b(a, d, d); return (v0 + v1 | 0) + v2 | 0; } diff --git a/jscomp/test/poly_variant_test.js b/jscomp/test/poly_variant_test.js index f985052b39..be1b53951c 100644 --- a/jscomp/test/poly_variant_test.js +++ b/jscomp/test/poly_variant_test.js @@ -16,7 +16,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/polymorphic_raw_test.js b/jscomp/test/polymorphic_raw_test.js index def11e6cf2..47e63d1f48 100644 --- a/jscomp/test/polymorphic_raw_test.js +++ b/jscomp/test/polymorphic_raw_test.js @@ -16,7 +16,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/ppx_apply_test.js b/jscomp/test/ppx_apply_test.js index 94825eedd4..e3c501ddfe 100644 --- a/jscomp/test/ppx_apply_test.js +++ b/jscomp/test/ppx_apply_test.js @@ -16,7 +16,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/pr6726.js b/jscomp/test/pr6726.js index 9ef4d9b9f8..ff6e484b7a 100644 --- a/jscomp/test/pr6726.js +++ b/jscomp/test/pr6726.js @@ -22,7 +22,7 @@ function test_endian_string(x) { return 33; } -let v = 33; +let v = test_endian_string(1); let Test = { test_endian_string: test_endian_string, @@ -32,4 +32,4 @@ let Test = { exports.ExtUnixAll = ExtUnixAll; exports.ExtUnix = ExtUnix; exports.Test = Test; -/* No side effect */ +/* v Not a pure module */ diff --git a/jscomp/test/print_alpha_test.js b/jscomp/test/print_alpha_test.js index 277d9a78ab..e9f3efb844 100644 --- a/jscomp/test/print_alpha_test.js +++ b/jscomp/test/print_alpha_test.js @@ -2,17 +2,18 @@ 'use strict'; let Mt = require("./mt.js"); -let Curry = require("../../lib/js/curry.js"); function f(h, param) { console.log(3); - return Curry.__2(h); + return function (x, y) { + return h(x, y); + }; } Mt.from_pair_suites("Print_alpha_test", { hd: [ "File \"print_alpha_test.res\", line 16, characters 10-17", - (function (param) { + (function () { return { TAG: "Eq", _0: f((function (prim0, prim1) { diff --git a/jscomp/test/queue_402.js b/jscomp/test/queue_402.js index ed21a89983..9adf63c154 100644 --- a/jscomp/test/queue_402.js +++ b/jscomp/test/queue_402.js @@ -1,13 +1,12 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); let Empty = /* @__PURE__ */Caml_exceptions.create("Queue_402.Empty"); -function create(param) { +function create() { return { length: 0, tail: undefined @@ -122,7 +121,7 @@ function iter(f, q) { let _cell = tail.next; while(true) { let cell = _cell; - Curry._1(f, cell.content); + f(cell.content); if (cell === tail) { return; } @@ -141,7 +140,7 @@ function fold(f, accu, q) { while(true) { let cell = _cell; let accu$1 = _accu; - let accu$2 = Curry._2(f, accu$1, cell.content); + let accu$2 = f(accu$1, cell.content); if (cell === tail) { return accu$2; } diff --git a/jscomp/test/queue_test.js b/jscomp/test/queue_test.js index 1671b5341b..a13947853a 100644 --- a/jscomp/test/queue_test.js +++ b/jscomp/test/queue_test.js @@ -3,24 +3,23 @@ let Mt = require("./mt.js"); let $$Array = require("../../lib/js/array.js"); -let Curry = require("../../lib/js/curry.js"); let Queue = require("../../lib/js/queue.js"); let Queue_402 = require("./queue_402.js"); let Caml_array = require("../../lib/js/caml_array.js"); function Test(Queue) { let to_array = function (q) { - let v = Caml_array.make(Curry._1(Queue.length, q), 0); - Curry._3(Queue.fold, (function (i, e) { + let v = Caml_array.make(Queue.length(q), 0); + Queue.fold((function (i, e) { Caml_array.set(v, i, e); return i + 1 | 0; }), 0, q); return v; }; let queue_1 = function (x) { - let q = Curry._1(Queue.create, undefined); + let q = Queue.create(); $$Array.iter((function (x) { - Curry._2(Queue.add, x, q); + Queue.add(x, q); }), x); return to_array(q); }; diff --git a/jscomp/test/random_test.js b/jscomp/test/random_test.js index 6cd6a227ba..2aa27ff159 100644 --- a/jscomp/test/random_test.js +++ b/jscomp/test/random_test.js @@ -16,24 +16,26 @@ let suites = { }; function eq(f) { - return function (param, param$1) { - return Mt_global.collect_eq(id, suites, f, param, param$1); + return function (extra, extra$1) { + return Mt_global.collect_eq(id, suites, f, extra, extra$1); }; } function neq(f) { - return function (param, param$1) { - return Mt_global.collect_neq(id, suites, f, param, param$1); + return function (extra, extra$1) { + return Mt_global.collect_neq(id, suites, f, extra, extra$1); }; } function approx(f) { - return function (param, param$1) { - return Mt_global.collect_approx(id, suites, f, param, param$1); + return function (extra, extra$1) { + return Mt_global.collect_approx(id, suites, f, extra, extra$1); }; } -Mt_global.collect_neq(id, suites, "File \"random_test.res\", line 9, characters 2-9", (Random.self_init(), Random.int(10000)), (Random.self_init(), Random.int(1000))); +((function (extra, extra$1) { + return Mt_global.collect_neq(id, suites, "File \"random_test.res\", line 9, characters 2-9", extra, extra$1); + })((Random.self_init(), Random.int(10000)), (Random.self_init(), Random.int(1000)))); Random.init(0); @@ -43,18 +45,20 @@ for(let i = 0; i <= 9; ++i){ Caml_array.set(v, i, Random.bool()); } -Mt_global.collect_eq(id, suites, "File \"random_test.res\", line 28, characters 12-19", v, [ - true, - true, - true, - true, - true, - false, - true, - true, - true, - false -]); +((function (extra, extra$1) { + return Mt_global.collect_eq(id, suites, "File \"random_test.res\", line 28, characters 12-19", extra, extra$1); + })(v, [ + true, + true, + true, + true, + true, + false, + true, + true, + true, + false + ])); let f = Random.int64(Int64.max_int); diff --git a/jscomp/test/raw_hash_tbl_bench.js b/jscomp/test/raw_hash_tbl_bench.js index de9b019430..1f295c92bb 100644 --- a/jscomp/test/raw_hash_tbl_bench.js +++ b/jscomp/test/raw_hash_tbl_bench.js @@ -3,7 +3,7 @@ let Hashtbl = require("../../lib/js/hashtbl.js"); -function bench(param) { +function bench() { let table = Hashtbl.create(undefined, 1000000); for(let i = 0; i <= 1000000; ++i){ Hashtbl.add(table, i, i); diff --git a/jscomp/test/raw_output_test.js b/jscomp/test/raw_output_test.js index d236b9b48b..9322ea7fd8 100644 --- a/jscomp/test/raw_output_test.js +++ b/jscomp/test/raw_output_test.js @@ -1,10 +1,9 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); function mk(fn) { - return Curry._1(fn, undefined); + return fn(); } (((_)=> console.log('should works'))()); diff --git a/jscomp/test/reactTestUtils.js b/jscomp/test/reactTestUtils.js index b94a28de95..05a3759b7c 100644 --- a/jscomp/test/reactTestUtils.js +++ b/jscomp/test/reactTestUtils.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let Belt_Array = require("../../lib/js/belt_Array.js"); let Belt_Option = require("../../lib/js/belt_Option.js"); let Caml_option = require("../../lib/js/caml_option.js"); @@ -9,14 +8,14 @@ let TestUtils = require("react-dom/test-utils"); function act(func) { let reactFunc = function () { - Curry._1(func, undefined); + func(); }; TestUtils.act(reactFunc); } function actAsync(func) { return TestUtils.act(function () { - return Curry._1(func, undefined); + return func(); }); } diff --git a/jscomp/test/reasonReact.js b/jscomp/test/reasonReact.js index 55c86ce840..fcd2352d0f 100644 --- a/jscomp/test/reasonReact.js +++ b/jscomp/test/reasonReact.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let React = require("react"); function createDomElement(s, props, children) { @@ -9,7 +8,7 @@ function createDomElement(s, props, children) { s, props ].concat(children); - return Curry._2(React.createElement.apply, null, vararg); + return React.createElement.apply(null, vararg); } function anyToUnit(param) { @@ -28,7 +27,7 @@ function renderDefault(_self) { return "RenderNotImplemented"; } -function initialStateDefault(param) { +function initialStateDefault() { } @@ -57,13 +56,21 @@ function basicComponent(debugName) { }; } -let statelessComponent = basicComponent; +function statelessComponent(debugName) { + return basicComponent(debugName); +} -let statelessComponentWithRetainedProps = basicComponent; +function statelessComponentWithRetainedProps(debugName) { + return basicComponent(debugName); +} -let reducerComponent = basicComponent; +function reducerComponent(debugName) { + return basicComponent(debugName); +} -let reducerComponentWithRetainedProps = basicComponent; +function reducerComponentWithRetainedProps(debugName) { + return basicComponent(debugName); +} function element(keyOpt, refOpt, component) { let key = keyOpt !== undefined ? keyOpt : undefined; @@ -74,7 +81,7 @@ function element(keyOpt, refOpt, component) { }; let jsElementWrapped = component.jsElementWrapped; if (jsElementWrapped !== undefined) { - return Curry._2(jsElementWrapped, key, ref); + return jsElementWrapped(key, ref); } else { return React.createElement(component.reactClassInternal, { key: key, @@ -85,7 +92,9 @@ function element(keyOpt, refOpt, component) { } function wrapReasonForJs(component, jsPropsToReason) { - let uncurriedJsPropsToReason = Curry.__1(jsPropsToReason); + let uncurriedJsPropsToReason = function (jsProps) { + return jsPropsToReason(jsProps); + }; component.reactClassInternal.prototype.jsPropsToReason = uncurriedJsPropsToReason; return component.reactClassInternal; } @@ -93,16 +102,16 @@ function wrapReasonForJs(component, jsPropsToReason) { let dummyInteropComponent = basicComponent("interop"); function wrapJsForReason(reactClass, props, children) { - let jsElementWrapped = (function (param, param$1) { + let jsElementWrapped = (function (extra, extra$1) { let props$1 = Object.assign(Object.assign({}, props), { - ref: param$1, - key: param + ref: extra$1, + key: extra }); let varargs = [ reactClass, props$1 ].concat(children); - return Curry._2(React.createElement.apply, null, varargs); + return React.createElement.apply(null, varargs); }); return { debugName: dummyInteropComponent.debugName, diff --git a/jscomp/test/reasonReactCompat.js b/jscomp/test/reasonReactCompat.js index 43f178a76d..cde9d8b3ad 100644 --- a/jscomp/test/reasonReactCompat.js +++ b/jscomp/test/reasonReactCompat.js @@ -3,9 +3,13 @@ let ReasonReact = require("./reasonReact.js"); -let wrapReactForReasonReact = ReasonReact.wrapJsForReason; +function wrapReactForReasonReact(component, props, children) { + return ReasonReact.wrapJsForReason(component, props, children); +} -let wrapReasonReactForReact = ReasonReact.wrapReasonForJs; +function wrapReasonReactForReact(component, propsConverter) { + return ReasonReact.wrapReasonForJs(component, propsConverter); +} exports.wrapReactForReasonReact = wrapReactForReasonReact; exports.wrapReasonReactForReact = wrapReasonReactForReact; diff --git a/jscomp/test/reasonReactRouter.js b/jscomp/test/reasonReactRouter.js index b85dea0242..16a967a133 100644 --- a/jscomp/test/reasonReactRouter.js +++ b/jscomp/test/reasonReactRouter.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let React = require("react"); function safeMakeEvent(eventName) { @@ -13,7 +12,7 @@ function safeMakeEvent(eventName) { return event; } -function path(param) { +function path() { let window = typeof window === "undefined" ? undefined : window; if (window === undefined) { return /* [] */0; @@ -46,7 +45,7 @@ function path(param) { } } -function hash(param) { +function hash() { let window = typeof window === "undefined" ? undefined : window; if (window === undefined) { return ""; @@ -61,7 +60,7 @@ function hash(param) { } } -function search(param) { +function search() { let window = typeof window === "undefined" ? undefined : window; if (window === undefined) { return ""; @@ -127,7 +126,7 @@ function urlNotEqual(a, b) { } } -function url(param) { +function url() { return { path: path(), hash: hash(), @@ -138,12 +137,12 @@ function url(param) { function watchUrl(callback) { let window = typeof window === "undefined" ? undefined : window; if (window === undefined) { - return function (param) { + return function () { }; } - let watcherID = function (param) { - Curry._1(callback, url()); + let watcherID = function () { + callback(url()); }; window.addEventListener("popstate", watcherID); return watcherID; @@ -159,7 +158,7 @@ function unwatchUrl(watcherID) { } function useUrl(serverUrl, param) { - let match = React.useState(function (param) { + let match = React.useState(function () { if (serverUrl !== undefined) { return serverUrl; } else { @@ -168,19 +167,19 @@ function useUrl(serverUrl, param) { }); let setUrl = match[1]; let url$1 = match[0]; - React.useEffect((function (param) { + React.useEffect((function () { let watcherId = watchUrl(function (url) { - Curry._1(setUrl, (function (param) { + setUrl(function (param) { return url; - })); + }); }); let newUrl = url(); if (urlNotEqual(newUrl, url$1)) { - Curry._1(setUrl, (function (param) { + setUrl(function (param) { return newUrl; - })); + }); } - return (function (param) { + return (function () { unwatchUrl(watcherId); }); }), []); diff --git a/jscomp/test/rec_fun_test.js b/jscomp/test/rec_fun_test.js index 558627d5dd..43b6b52903 100644 --- a/jscomp/test/rec_fun_test.js +++ b/jscomp/test/rec_fun_test.js @@ -2,7 +2,6 @@ 'use strict'; let Mt = require("./mt.js"); -let Curry = require("../../lib/js/curry.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); let suites = { @@ -18,7 +17,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -34,12 +33,12 @@ let called = { contents: 0 }; -function g(param) { +function g() { let v = {}; let next = function (i, b) { called.contents = called.contents + 1 | 0; if (b) { - Curry._2(v.contents, i, false); + v.contents(i, false); } return i + 1 | 0; }; diff --git a/jscomp/test/rec_module_opt.js b/jscomp/test/rec_module_opt.js index ac331de436..61b06f835b 100644 --- a/jscomp/test/rec_module_opt.js +++ b/jscomp/test/rec_module_opt.js @@ -3,7 +3,21 @@ let $$Set = require("../../lib/js/set.js"); let Caml = require("../../lib/js/caml.js"); -let Curry = require("../../lib/js/curry.js"); +let Caml_module = require("../../lib/js/caml_module.js"); + +let A = Caml_module.init_mod([ + "rec_module_opt.res", + 15, + 4 +], { + TAG: "Module", + _0: [[ + "Function", + "compare" + ]] +}); + +let ASet = $$Set.Make(A); function compare(t1, t2) { if (t1.TAG === "Leaf") { @@ -15,35 +29,75 @@ function compare(t1, t2) { } else if (t2.TAG === "Leaf") { return -1; } else { - return Curry._2(ASet.compare, t1._0, t2._0); + return ASet.compare(t1._0, t2._0); } } -let A = { +Caml_module.update_mod({ + TAG: "Module", + _0: [[ + "Function", + "compare" + ]] +}, A, { compare: compare -}; - -let ASet = $$Set.Make(A); +}); let X0 = {}; let Y0 = {}; +let X1 = Caml_module.init_mod([ + "rec_module_opt.res", + 44, + 19 +], { + TAG: "Module", + _0: [[ + "Function", + "f" + ]] +}); + +let Y1 = Caml_module.init_mod([ + "rec_module_opt.res", + 47, + 12 +], { + TAG: "Module", + _0: [[ + "Function", + "f" + ]] +}); + function f(x) { return x + 1 | 0; } -let X1 = { +Caml_module.update_mod({ + TAG: "Module", + _0: [[ + "Function", + "f" + ]] +}, X1, { f: f -}; +}); function f$1(x) { return x + 2 | 0; } -let Y1 = { +Caml_module.update_mod({ + TAG: "Module", + _0: [[ + "Function", + "f" + ]] +}, Y1, { f: f$1 -}; +}); let X; @@ -54,4 +108,4 @@ exports.X0 = X0; exports.Y0 = Y0; exports.X1 = X1; exports.Y1 = Y1; -/* ASet Not a pure module */ +/* A Not a pure module */ diff --git a/jscomp/test/rec_module_test.js b/jscomp/test/rec_module_test.js index 82dde281c0..2e22414f15 100644 --- a/jscomp/test/rec_module_test.js +++ b/jscomp/test/rec_module_test.js @@ -4,22 +4,52 @@ let Mt = require("./mt.js"); let Caml = require("../../lib/js/caml.js"); let List = require("../../lib/js/list.js"); -let Curry = require("../../lib/js/curry.js"); +let Caml_module = require("../../lib/js/caml_module.js"); let Caml_option = require("../../lib/js/caml_option.js"); +let A = Caml_module.init_mod([ + "rec_module_test.res", + 3, + 4 +], { + TAG: "Module", + _0: [[ + "Function", + "even" + ]] +}); + +let B = Caml_module.init_mod([ + "rec_module_test.res", + 15, + 4 +], { + TAG: "Module", + _0: [[ + "Function", + "odd" + ]] +}); + function even(n) { if (n === 0) { return true; } else if (n === 1) { return false; } else { - return Curry._1(B.odd, n - 1 | 0); + return B.odd(n - 1 | 0); } } -let A = { +Caml_module.update_mod({ + TAG: "Module", + _0: [[ + "Function", + "even" + ]] +}, A, { even: even -}; +}); function odd(n) { if (n === 1) { @@ -27,13 +57,55 @@ function odd(n) { } else if (n === 0) { return false; } else { - return Curry._1(A.even, n - 1 | 0); + return A.even(n - 1 | 0); } } -let B = { +Caml_module.update_mod({ + TAG: "Module", + _0: [[ + "Function", + "odd" + ]] +}, B, { odd: odd -}; +}); + +let AA = Caml_module.init_mod([ + "rec_module_test.res", + 29, + 4 +], { + TAG: "Module", + _0: [ + [ + "Function", + "even" + ], + [ + "Function", + "x" + ] + ] +}); + +let BB = Caml_module.init_mod([ + "rec_module_test.res", + 43, + 4 +], { + TAG: "Module", + _0: [ + [ + "Function", + "odd" + ], + [ + "Function", + "y" + ] + ] +}); function even$1(n) { if (n === 0) { @@ -41,18 +113,30 @@ function even$1(n) { } else if (n === 1) { return false; } else { - return Curry._1(BB.odd, n - 1 | 0); + return BB.odd(n - 1 | 0); } } -function x(param) { - return Curry._1(BB.y, undefined) + 3 | 0; +function x() { + return BB.y() + 3 | 0; } -let AA = { +Caml_module.update_mod({ + TAG: "Module", + _0: [ + [ + "Function", + "even" + ], + [ + "Function", + "x" + ] + ] +}, AA, { even: even$1, x: x -}; +}); function odd$1(n) { if (n === 1) { @@ -60,40 +144,46 @@ function odd$1(n) { } else if (n === 0) { return false; } else { - return Curry._1(even$1, n - 1 | 0); + return AA.even(n - 1 | 0); } } -function y(param) { +function y() { return 32; } -let BB = { +Caml_module.update_mod({ + TAG: "Module", + _0: [ + [ + "Function", + "odd" + ], + [ + "Function", + "y" + ] + ] +}, BB, { odd: odd$1, y: y -}; +}); let Even = {}; let Odd = {}; -function compare(t1, t2) { - if (t1.TAG === "Leaf") { - if (t2.TAG === "Leaf") { - return Caml.string_compare(t1._0, t2._0); - } else { - return 1; - } - } else if (t2.TAG === "Leaf") { - return -1; - } else { - return Curry._2(ASet.compare, t1._0, t2._0); - } -} - -let AAA = { - compare: compare -}; +let AAA = Caml_module.init_mod([ + "rec_module_test.res", + 69, + 4 +], { + TAG: "Module", + _0: [[ + "Function", + "compare" + ]] +}); function height(param) { if (typeof param !== "object") { @@ -194,7 +284,7 @@ function add(x, param) { let r = param.r; let v = param.v; let l = param.l; - let c = Curry._2(AAA.compare, x, v); + let c = AAA.compare(x, v); if (c === 0) { return param; } @@ -364,7 +454,7 @@ function split(x, param) { let r = param.r; let v = param.v; let l = param.l; - let c = Curry._2(AAA.compare, x, v); + let c = AAA.compare(x, v); if (c === 0) { return [ l, @@ -402,7 +492,7 @@ function mem(x, _param) { if (typeof param !== "object") { return false; } - let c = Curry._2(AAA.compare, x, param.v); + let c = AAA.compare(x, param.v); if (c === 0) { return true; } @@ -418,7 +508,7 @@ function remove(x, param) { let r = param.r; let v = param.v; let l = param.l; - let c = Curry._2(AAA.compare, x, v); + let c = AAA.compare(x, v); if (c === 0) { if (typeof l !== "object") { return r; @@ -525,7 +615,7 @@ function cons_enum(_s, _e) { }; } -function compare$1(s1, s2) { +function compare(s1, s2) { let _e1 = cons_enum(s1, "End"); let _e2 = cons_enum(s2, "End"); while(true) { @@ -541,7 +631,7 @@ function compare$1(s1, s2) { if (typeof e2 !== "object") { return 1; } - let c = Curry._2(AAA.compare, e1._0, e2._0); + let c = AAA.compare(e1._0, e2._0); if (c !== 0) { return c; } @@ -552,7 +642,7 @@ function compare$1(s1, s2) { } function equal(s1, s2) { - return compare$1(s1, s2) === 0; + return compare(s1, s2) === 0; } function subset(_s1, _s2) { @@ -570,7 +660,7 @@ function subset(_s1, _s2) { } let r2 = s2.r; let l2 = s2.l; - let c = Curry._2(AAA.compare, v1, s2.v); + let c = AAA.compare(v1, s2.v); if (c === 0) { if (!subset(l1, l2)) { return false; @@ -613,7 +703,7 @@ function iter(f, _param) { return; } iter(f, param.l); - Curry._1(f, param.v); + f(param.v); _param = param.r; continue; }; @@ -626,7 +716,7 @@ function fold(f, _s, _accu) { if (typeof s !== "object") { return accu; } - _accu = Curry._2(f, s.v, fold(f, s.l, accu)); + _accu = f(s.v, fold(f, s.l, accu)); _s = s.r; continue; }; @@ -638,7 +728,7 @@ function for_all(p, _param) { if (typeof param !== "object") { return true; } - if (!Curry._1(p, param.v)) { + if (!p(param.v)) { return false; } if (!for_all(p, param.l)) { @@ -655,7 +745,7 @@ function exists(p, _param) { if (typeof param !== "object") { return false; } - if (Curry._1(p, param.v)) { + if (p(param.v)) { return true; } if (exists(p, param.l)) { @@ -674,7 +764,7 @@ function filter(p, param) { let v = param.v; let l = param.l; let l$p = filter(p, l); - let pv = Curry._1(p, v); + let pv = p(v); let r$p = filter(p, r); if (pv) { if (l === l$p && r === r$p) { @@ -698,7 +788,7 @@ function partition(p, param) { let match = partition(p, param.l); let lf = match[1]; let lt = match[0]; - let pv = Curry._1(p, v); + let pv = p(v); let match$1 = partition(p, param.r); let rf = match$1[1]; let rt = match$1[0]; @@ -754,7 +844,7 @@ function find(x, _param) { }); } let v = param.v; - let c = Curry._2(AAA.compare, x, v); + let c = AAA.compare(x, v); if (c === 0) { return v; } @@ -774,7 +864,7 @@ function find_first(f, _param) { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _param$1 = param.l; while(true) { @@ -784,7 +874,7 @@ function find_first(f, _param) { return v0; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.l; _v0 = v$1; continue; @@ -805,7 +895,7 @@ function find_first_opt(f, _param) { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _param$1 = param.l; while(true) { @@ -815,7 +905,7 @@ function find_first_opt(f, _param) { return Caml_option.some(v0); } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.l; _v0 = v$1; continue; @@ -840,7 +930,7 @@ function find_last(f, _param) { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _param$1 = param.r; while(true) { @@ -850,7 +940,7 @@ function find_last(f, _param) { return v0; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.r; _v0 = v$1; continue; @@ -871,7 +961,7 @@ function find_last_opt(f, _param) { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _param$1 = param.r; while(true) { @@ -881,7 +971,7 @@ function find_last_opt(f, _param) { return Caml_option.some(v0); } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.r; _v0 = v$1; continue; @@ -902,7 +992,7 @@ function find_opt(x, _param) { return; } let v = param.v; - let c = Curry._2(AAA.compare, x, v); + let c = AAA.compare(x, v); if (c === 0) { return Caml_option.some(v); } @@ -919,11 +1009,11 @@ function map(f, param) { let v = param.v; let l = param.l; let l$p = map(f, l); - let v$p = Curry._1(f, v); + let v$p = f(v); let r$p = map(f, r); if (l === l$p && v === v$p && r === r$p) { return param; - } else if ((l$p === "Empty" || Curry._2(AAA.compare, max_elt(l$p), v$p) < 0) && (r$p === "Empty" || Curry._2(AAA.compare, v$p, min_elt(r$p)) < 0)) { + } else if ((l$p === "Empty" || AAA.compare(max_elt(l$p), v$p) < 0) && (r$p === "Empty" || AAA.compare(v$p, min_elt(r$p)) < 0)) { return join(l$p, v$p, r$p); } else { return union(l$p, add(v$p, r$p)); @@ -1076,7 +1166,7 @@ let ASet = { union: union, inter: inter, diff: diff, - compare: compare$1, + compare: compare, equal: equal, subset: subset, iter: iter, @@ -1104,6 +1194,30 @@ let ASet = { of_list: of_list }; +function compare$1(t1, t2) { + if (t1.TAG === "Leaf") { + if (t2.TAG === "Leaf") { + return Caml.string_compare(t1._0, t2._0); + } else { + return 1; + } + } else if (t2.TAG === "Leaf") { + return -1; + } else { + return compare(t1._0, t2._0); + } +} + +Caml_module.update_mod({ + TAG: "Module", + _0: [[ + "Function", + "compare" + ]] +}, AAA, { + compare: compare$1 +}); + let suites_0 = [ "test1", (function (param) { @@ -1116,10 +1230,10 @@ let suites_0 = [ false ], _1: [ - Curry._1(A.even, 2), - Curry._1(even$1, 4), - Curry._1(B.odd, 2), - Curry._1(odd$1, 4) + A.even(2), + AA.even(4), + B.odd(2), + BB.odd(4) ] }; }) @@ -1131,7 +1245,7 @@ let suites_1 = { (function (param) { return { TAG: "Eq", - _0: Curry._1(y, undefined), + _0: BB.y(), _1: 32 }; }) @@ -1142,7 +1256,7 @@ let suites_1 = { (function (param) { return { TAG: "Eq", - _0: Curry._1(x, undefined), + _0: AA.x(), _1: 35 }; }) @@ -1154,7 +1268,7 @@ let suites_1 = { return { TAG: "Eq", _0: true, - _1: Curry._1(A.even, 2) + _1: A.even(2) }; }) ], @@ -1165,7 +1279,7 @@ let suites_1 = { return { TAG: "Eq", _0: true, - _1: Curry._1(even$1, 4) + _1: AA.even(4) }; }) ], @@ -1176,7 +1290,7 @@ let suites_1 = { return { TAG: "Eq", _0: false, - _1: Curry._1(B.odd, 2) + _1: B.odd(2) }; }) ], @@ -1187,7 +1301,7 @@ let suites_1 = { return { TAG: "Eq", _0: 2, - _1: Curry._1(cardinal, Curry._1(of_list, { + _1: cardinal(of_list({ hd: { TAG: "Leaf", _0: "a" @@ -1233,4 +1347,4 @@ exports.Odd = Odd; exports.AAA = AAA; exports.ASet = ASet; exports.suites = suites; -/* Not a pure module */ +/* A Not a pure module */ diff --git a/jscomp/test/recmodule.js b/jscomp/test/recmodule.js index 9594c0ecbe..c5b9cec6fc 100644 --- a/jscomp/test/recmodule.js +++ b/jscomp/test/recmodule.js @@ -1,14 +1,13 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let Caml_module = require("../../lib/js/caml_module.js"); let Entity = {}; function MakeLayer(Deps) { let getLight = function (id) { - return Curry._1(Deps.presentLight, { + return Deps.presentLight({ id: id, name: "Light 1" }); @@ -24,10 +23,10 @@ let UseCase = { function MakeLayer$1(Deps, UC) { let presentLight = function (light) { - return Curry._2(Deps.presentJson, light, 200); + return Deps.presentJson(light, 200); }; let handleGetLight = function (req) { - return Curry._1(UC.getLight, req.params.id); + return UC.getLight(req.params.id); }; return { handleGetLight: handleGetLight, @@ -52,7 +51,7 @@ function MakeLayer$2(Deps) { } }); }; - let routes = function (param) { + let routes = function () { return [[ "/lights", Deps.handleGetLight @@ -129,7 +128,7 @@ function presentJson(json, status) { }); } -function routes(param) { +function routes() { return [[ "/lights", A.handleGetLight @@ -154,11 +153,11 @@ Caml_module.update_mod({ }); function presentLight(light) { - return Curry._2(I.presentJson, light, 200); + return I.presentJson(light, 200); } function handleGetLight(req) { - return Curry._1(U.getLight, req.params.id); + return U.getLight(req.params.id); } Caml_module.update_mod({ @@ -179,7 +178,7 @@ Caml_module.update_mod({ }); function getLight(id) { - return Curry._1(A.presentLight, { + return A.presentLight({ id: id, name: "Light 1" }); diff --git a/jscomp/test/record_extension_test.js b/jscomp/test/record_extension_test.js index 9e6b29e605..2067603615 100644 --- a/jscomp/test/record_extension_test.js +++ b/jscomp/test/record_extension_test.js @@ -2,7 +2,6 @@ 'use strict'; let Mt = require("./mt.js"); -let Curry = require("../../lib/js/curry.js"); let Caml_format = require("../../lib/js/caml_format.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); @@ -64,7 +63,7 @@ let C = /* @__PURE__ */Caml_exceptions.create("Record_extension_test.C"); function u(f) { try { - return Curry._1(f, undefined); + return f(); } catch (raw_x){ let x = Caml_js_exceptions.internalToOCamlException(raw_x); diff --git a/jscomp/test/record_name_test.js b/jscomp/test/record_name_test.js index 82a26542ba..df9245bcb9 100644 --- a/jscomp/test/record_name_test.js +++ b/jscomp/test/record_name_test.js @@ -35,7 +35,7 @@ function f4(param) { return (((param.EXACT_MAPPING_TO_JS_LABEL + param.EXACT_2 | 0) + param.z.hello | 0) << 1); } -function u(param) { +function u() { return { x: 22, h: 3 diff --git a/jscomp/test/record_with_test.js b/jscomp/test/record_with_test.js index c1cadd2cad..045fc38e5b 100644 --- a/jscomp/test/record_with_test.js +++ b/jscomp/test/record_with_test.js @@ -2,7 +2,6 @@ 'use strict'; let Mt = require("./mt.js"); -let Curry = require("../../lib/js/curry.js"); let v = { syntax: undefined, @@ -25,7 +24,7 @@ let u_v = { }; function f(g, h) { - let init = Curry._1(g, h); + let init = g(h); return { syntax: init.syntax, imports: 0, diff --git a/jscomp/test/recursive_module.js b/jscomp/test/recursive_module.js index 2574e8eeb4..c28f063fcd 100644 --- a/jscomp/test/recursive_module.js +++ b/jscomp/test/recursive_module.js @@ -3,7 +3,6 @@ let Mt = require("./mt.js"); let Lazy = require("../../lib/js/lazy.js"); -let Curry = require("../../lib/js/curry.js"); let Caml_module = require("../../lib/js/caml_module.js"); let CamlinternalLazy = require("../../lib/js/camlinternalLazy.js"); let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); @@ -71,7 +70,7 @@ let Intb = Caml_module.init_mod([ ]] }); -let a = CamlinternalLazy.from_fun(function () { +let a = Lazy.from_fun(function () { return CamlinternalLazy.force(Intb.a); }); @@ -85,7 +84,7 @@ Caml_module.update_mod({ a: a }); -let a$1 = CamlinternalLazy.from_fun(function () { +let a$1 = Lazy.from_fun(function () { return CamlinternalLazy.force(Inta.a) + 1 | 0; }); @@ -141,7 +140,7 @@ let Intb$1 = Caml_module.init_mod([ ]] }); -let a$2 = CamlinternalLazy.from_fun(function () { +let a$2 = Lazy.from_fun(function () { return CamlinternalLazy.force(Intb$1.a) + 1 | 0; }); @@ -155,7 +154,7 @@ Caml_module.update_mod({ a: a$2 }); -let a$3 = CamlinternalLazy.from_fun(function () { +let a$3 = Lazy.from_fun(function () { return 2; }); @@ -179,7 +178,7 @@ eq("File \"recursive_module.res\", line 59, characters 3-10", CamlinternalLazy.f let tmp$1; try { - Curry._1(Int3.u, 3); + Int3.u(3); tmp$1 = 3; } catch (raw_exn$1){ diff --git a/jscomp/test/recursive_module_test.js b/jscomp/test/recursive_module_test.js index 9a75930356..6edee60332 100644 --- a/jscomp/test/recursive_module_test.js +++ b/jscomp/test/recursive_module_test.js @@ -2,7 +2,6 @@ 'use strict'; let Mt = require("./mt.js"); -let Curry = require("../../lib/js/curry.js"); let Caml_module = require("../../lib/js/caml_module.js"); let suites = { @@ -18,7 +17,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -57,17 +56,35 @@ Caml_module.update_mod({ ]] }, Int3, Int3); +let M = Caml_module.init_mod([ + "recursive_module_test.res", + 18, + 20 +], { + TAG: "Module", + _0: [[ + "Function", + "fact" + ]] +}); + function fact(n) { if (n <= 1) { return 1; } else { - return Math.imul(n, Curry._1(M.fact, n - 1 | 0)); + return Math.imul(n, M.fact(n - 1 | 0)); } } -let M = { +Caml_module.update_mod({ + TAG: "Module", + _0: [[ + "Function", + "fact" + ]] +}, M, { fact: fact -}; +}); let fact$1 = M.fact; @@ -76,15 +93,15 @@ let Fact = { fact: fact$1 }; -eq("File \"recursive_module_test.res\", line 29, characters 12-19", 120, Curry._1(fact$1, 5)); +eq("File \"recursive_module_test.res\", line 29, characters 12-19", 120, fact$1(5)); add([ "File \"recursive_module_test.res\", line 31, characters 14-21", - (function (param) { + (function () { return { TAG: "ThrowAny", - _0: (function (param) { - Curry._1(Int3.u, 3); + _0: (function () { + Int3.u(3); }) }; }) diff --git a/jscomp/test/recursive_unbound_module_test.js b/jscomp/test/recursive_unbound_module_test.js index 4cea961e3c..380e3aa408 100644 --- a/jscomp/test/recursive_unbound_module_test.js +++ b/jscomp/test/recursive_unbound_module_test.js @@ -4,7 +4,7 @@ let Caml_module = require("../../lib/js/caml_module.js"); function Make(X) { - let f = function (param) { + let f = function () { }; let M = { @@ -33,7 +33,7 @@ let B = Caml_module.init_mod([ ]] }); -function f(param) { +function f() { } diff --git a/jscomp/test/res_debug.js b/jscomp/test/res_debug.js index 500a818437..da1289ce18 100644 --- a/jscomp/test/res_debug.js +++ b/jscomp/test/res_debug.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); let Caml_option = require("../../lib/js/caml_option.js"); @@ -29,7 +28,7 @@ function testMatch(v) { function optionMap(x, f) { if (x !== undefined) { - return Caml_option.some(Curry._1(f, Caml_option.valFromOption(x))); + return Caml_option.some(f(Caml_option.valFromOption(x))); } } diff --git a/jscomp/test/return_check.js b/jscomp/test/return_check.js index ea41a8d33e..58a814e65e 100644 --- a/jscomp/test/return_check.js +++ b/jscomp/test/return_check.js @@ -42,7 +42,7 @@ function f_escaped_not(xs, i) { function f_escaped_1(xs, i) { let x = xs[i]; - return function (param) { + return function () { if (x !== undefined) { return x; } else { diff --git a/jscomp/test/set_gen.js b/jscomp/test/set_gen.js index ab3ba89780..bdf878e07d 100644 --- a/jscomp/test/set_gen.js +++ b/jscomp/test/set_gen.js @@ -2,8 +2,7 @@ 'use strict'; let List = require("../../lib/js/list.js"); -let Curry = require("../../lib/js/curry.js"); -let Pervasives = require("../../lib/js/pervasives.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); function cons_enum(_s, _e) { @@ -122,7 +121,7 @@ function iter(f, _x) { return; } iter(f, x._0); - Curry._1(f, x._1); + f(x._1); _x = x._2; continue; }; @@ -135,7 +134,7 @@ function fold(f, _s, _accu) { if (typeof s !== "object") { return accu; } - _accu = Curry._2(f, s._1, fold(f, s._0, accu)); + _accu = f(s._1, fold(f, s._0, accu)); _s = s._2; continue; }; @@ -147,7 +146,7 @@ function for_all(p, _x) { if (typeof x !== "object") { return true; } - if (!Curry._1(p, x._1)) { + if (!p(x._1)) { return false; } if (!for_all(p, x._0)) { @@ -164,7 +163,7 @@ function exists(p, _x) { if (typeof x !== "object") { return false; } - if (Curry._1(p, x._1)) { + if (p(x._1)) { return true; } if (exists(p, x._0)) { @@ -215,7 +214,7 @@ function check_height_and_diff(x) { } }); } - let diff = Pervasives.abs(hl - hr | 0); + let diff = PervasivesU.abs(hl - hr | 0); if (diff > 2) { throw new Error(Height_diff_borken, { cause: { @@ -411,7 +410,7 @@ function filter(p, x) { } let v = x._1; let l$p = filter(p, x._0); - let pv = Curry._1(p, v); + let pv = p(v); let r$p = filter(p, x._2); if (pv) { return internal_join(l$p, v, r$p); @@ -431,7 +430,7 @@ function partition(p, x) { let match = partition(p, x._0); let lf = match[1]; let lt = match[0]; - let pv = Curry._1(p, v); + let pv = p(v); let match$1 = partition(p, x._2); let rf = match$1[1]; let rt = match$1[0]; @@ -635,7 +634,7 @@ function is_ordered(cmp, tree) { let min_v = match$1[0]; let match$2 = is_ordered_min_max(r); if (typeof match$2 !== "object") { - if (match$2 === "Empty" && Curry._2(cmp, max_v, v) < 0) { + if (match$2 === "Empty" && cmp(max_v, v) < 0) { return { NAME: "V", VAL: [ @@ -648,7 +647,7 @@ function is_ordered(cmp, tree) { } } let match$3 = match$2.VAL; - if (Curry._2(cmp, max_v, match$3[0]) < 0) { + if (cmp(max_v, match$3[0]) < 0) { return { NAME: "V", VAL: [ @@ -678,7 +677,7 @@ function is_ordered(cmp, tree) { } } let match$5 = match$4.VAL; - if (Curry._2(cmp, v, match$5[0]) < 0) { + if (cmp(v, match$5[0]) < 0) { return { NAME: "V", VAL: [ @@ -712,7 +711,7 @@ function compare_aux(cmp, _e1, _e2) { if (typeof e2 !== "object") { return 1; } - let c = Curry._2(cmp, e1._0, e2._0); + let c = cmp(e1._0, e2._0); if (c !== 0) { return c; } diff --git a/jscomp/test/sexp.js b/jscomp/test/sexp.js index aace8269f8..2969de47ea 100644 --- a/jscomp/test/sexp.js +++ b/jscomp/test/sexp.js @@ -2,18 +2,19 @@ 'use strict'; let List = require("../../lib/js/list.js"); -let Curry = require("../../lib/js/curry.js"); let Hashtbl = require("../../lib/js/hashtbl.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); -let Pervasives = require("../../lib/js/pervasives.js"); let Caml_format = require("../../lib/js/caml_format.js"); let Caml_option = require("../../lib/js/caml_option.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); let equal = Caml_obj.equal; let compare = Caml_obj.compare; -let hash = Hashtbl.hash; +function hash(a) { + return Hashtbl.hash(a); +} function of_int(x) { return { @@ -25,7 +26,7 @@ function of_int(x) { function of_float(x) { return { NAME: "Atom", - VAL: Pervasives.string_of_float(x) + VAL: PervasivesU.string_of_float(x) }; } @@ -149,14 +150,14 @@ function $$return(x) { function $great$pipe$eq(e, f) { if (e !== undefined) { - return Caml_option.some(Curry._1(f, Caml_option.valFromOption(e))); + return Caml_option.some(f(Caml_option.valFromOption(e))); } } function $great$great$eq(e, f) { if (e !== undefined) { - return Curry._1(f, Caml_option.valFromOption(e)); + return f(Caml_option.valFromOption(e)); } } @@ -170,7 +171,7 @@ function map_opt(f, l) { if (!l$1) { return List.rev(acc); } - let y = Curry._1(f, l$1.hd); + let y = f(l$1.hd); if (y === undefined) { return; } @@ -191,7 +192,7 @@ function list_any(f, e) { if (!l) { return; } - let res = Curry._1(f, l.hd); + let res = f(l.hd); if (res !== undefined) { return res; } @@ -213,7 +214,7 @@ function list_all(f, e) { return List.rev(acc); } let tl = l.tl; - let y = Curry._1(f, l.hd); + let y = f(l.hd); if (y !== undefined) { _l = tl; _acc = { @@ -235,7 +236,7 @@ function _try_atom(e, f) { return; } try { - return Caml_option.some(Curry._1(f, e.VAL)); + return Caml_option.some(f(e.VAL)); } catch (exn){ return; @@ -247,7 +248,7 @@ function to_int(e) { } function to_bool(e) { - return _try_atom(e, Pervasives.bool_of_string); + return _try_atom(e, PervasivesU.bool_of_string); } function to_float(e) { @@ -281,18 +282,20 @@ function to_pair(e) { } -function to_pair_with(f1, f2, e) { - return $great$great$eq(to_pair(e), (function (param) { - let y = param[1]; - return $great$great$eq(Curry._1(f1, param[0]), (function (x) { - return $great$great$eq(Curry._1(f2, y), (function (y) { - return [ - x, - y - ]; +function to_pair_with(f1, f2) { + return function (e) { + return $great$great$eq(to_pair(e), (function (param) { + let y = param[1]; + return $great$great$eq(f1(param[0]), (function (x) { + return $great$great$eq(f2(y), (function (y) { + return [ + x, + y + ]; + })); })); })); - })); + }; } function to_triple(e) { @@ -321,22 +324,24 @@ function to_triple(e) { } -function to_triple_with(f1, f2, f3, e) { - return $great$great$eq(to_triple(e), (function (param) { - let z = param[2]; - let y = param[1]; - return $great$great$eq(Curry._1(f1, param[0]), (function (x) { - return $great$great$eq(Curry._1(f2, y), (function (y) { - return $great$great$eq(Curry._1(f3, z), (function (z) { - return [ - x, - y, - z - ]; +function to_triple_with(f1, f2, f3) { + return function (e) { + return $great$great$eq(to_triple(e), (function (param) { + let z = param[2]; + let y = param[1]; + return $great$great$eq(f1(param[0]), (function (x) { + return $great$great$eq(f2(y), (function (y) { + return $great$great$eq(f3(z), (function (z) { + return [ + x, + y, + z + ]; + })); })); })); })); - })); + }; } function to_list(e) { @@ -346,65 +351,52 @@ function to_list(e) { } -function to_list_with(f, e) { - if (e.NAME === "List") { - return map_opt(f, e.VAL); - } - +function to_list_with(f) { + return function (e) { + if (e.NAME === "List") { + return map_opt(f, e.VAL); + } + + }; } -function get_field(name, e) { - if (e.NAME === "List") { - let _l = e.VAL; - while(true) { - let l = _l; - if (!l) { - return; - } - let match = l.hd; - if (typeof match === "object") { - if (match.NAME === "List") { +function get_field(name) { + return function (e) { + if (e.NAME === "List") { + let _l = e.VAL; + while(true) { + let l = _l; + if (!l) { + return; + } + let match = l.hd; + if (typeof match === "object" && match.NAME === "List") { let match$1 = match.VAL; if (match$1) { let match$2 = match$1.hd; - if (typeof match$2 === "object") { - if (match$2.NAME === "Atom") { - let match$3 = match$1.tl; - if (match$3) { - if (match$3.tl) { - _l = l.tl; - continue; - } - if (Caml_obj.equal(name, match$2.VAL)) { - return match$3.hd; - } - _l = l.tl; - continue; - } - _l = l.tl; - continue; + if (typeof match$2 === "object" && match$2.NAME === "Atom") { + let match$3 = match$1.tl; + if (match$3 && !match$3.tl && Caml_obj.equal(name, match$2.VAL)) { + return match$3.hd; } - _l = l.tl; - continue; + } - _l = l.tl; - continue; + } - _l = l.tl; - continue; + } _l = l.tl; continue; - } - _l = l.tl; - continue; - }; - } - + }; + } + + }; } -function field(name, f, e) { - return $great$great$eq(get_field(name, e), f); +function field(name, f) { + return function (e) { + return $great$great$eq(get_field(name)(e), f); + }; } function _get_field_list(name, _l) { @@ -414,41 +406,29 @@ function _get_field_list(name, _l) { return; } let match = l.hd; - if (typeof match === "object") { - if (match.NAME === "List") { - let match$1 = match.VAL; - if (match$1) { - let match$2 = match$1.hd; - if (typeof match$2 === "object") { - if (match$2.NAME === "Atom") { - if (Caml_obj.equal(name, match$2.VAL)) { - return match$1.tl; - } - _l = l.tl; - continue; - } - _l = l.tl; - continue; - } - _l = l.tl; - continue; + if (typeof match === "object" && match.NAME === "List") { + let match$1 = match.VAL; + if (match$1) { + let match$2 = match$1.hd; + if (typeof match$2 === "object" && match$2.NAME === "Atom" && Caml_obj.equal(name, match$2.VAL)) { + return match$1.tl; } - _l = l.tl; - continue; + } - _l = l.tl; - continue; + } _l = l.tl; continue; }; } -function field_list(name, f, e) { - if (e.NAME === "List") { - return $great$great$eq(_get_field_list(name, e.VAL), f); - } - +function field_list(name, f) { + return function (e) { + if (e.NAME === "List") { + return $great$great$eq(_get_field_list(name, e.VAL), f); + } + + }; } function _get_variant(s, args, _l) { @@ -459,26 +439,28 @@ function _get_variant(s, args, _l) { } let match = l.hd; if (Caml_obj.equal(s, match[0])) { - return Curry._1(match[1], args); + return match[1](args); } _l = l.tl; continue; }; } -function get_variant(l, e) { - if (e.NAME !== "List") { - return _get_variant(e.VAL, /* [] */0, l); - } - let match = e.VAL; - if (!match) { - return; - } - let match$1 = match.hd; - if (typeof match$1 === "object" && match$1.NAME === "Atom") { - return _get_variant(match$1.VAL, match.tl, l); - } - +function get_variant(l) { + return function (e) { + if (e.NAME !== "List") { + return _get_variant(e.VAL, /* [] */0, l); + } + let match = e.VAL; + if (!match) { + return; + } + let match$1 = match.hd; + if (typeof match$1 === "object" && match$1.NAME === "Atom") { + return _get_variant(match$1.VAL, match.tl, l); + } + + }; } function get_exn(e) { @@ -539,4 +521,4 @@ exports.of_variant = of_variant; exports.of_field = of_field; exports.of_record = of_record; exports.Traverse = Traverse; -/* No side effect */ +/* Hashtbl Not a pure module */ diff --git a/jscomp/test/sexpm.js b/jscomp/test/sexpm.js index 252d30acdd..bce2d06177 100644 --- a/jscomp/test/sexpm.js +++ b/jscomp/test/sexpm.js @@ -6,11 +6,10 @@ let Caml = require("../../lib/js/caml.js"); let Char = require("../../lib/js/char.js"); let List = require("../../lib/js/list.js"); let Bytes = require("../../lib/js/bytes.js"); -let Curry = require("../../lib/js/curry.js"); let Buffer = require("../../lib/js/buffer.js"); let $$String = require("../../lib/js/string.js"); let Caml_bytes = require("../../lib/js/caml_bytes.js"); -let Pervasives = require("../../lib/js/pervasives.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function _must_escape(s) { @@ -23,16 +22,16 @@ function _must_escape(s) { if (c !== 92) { exit = 1; } else { - throw new Error(Pervasives.Exit, { + throw new Error(PervasivesU.Exit, { cause: { - RE_EXN_ID: Pervasives.Exit + RE_EXN_ID: PervasivesU.Exit } }); } } else { - throw new Error(Pervasives.Exit, { + throw new Error(PervasivesU.Exit, { cause: { - RE_EXN_ID: Pervasives.Exit + RE_EXN_ID: PervasivesU.Exit } }); } @@ -51,9 +50,9 @@ function _must_escape(s) { case 34 : case 40 : case 41 : - throw new Error(Pervasives.Exit, { + throw new Error(PervasivesU.Exit, { cause: { - RE_EXN_ID: Pervasives.Exit + RE_EXN_ID: PervasivesU.Exit } }); @@ -63,18 +62,18 @@ function _must_escape(s) { } } else { if (c >= 9) { - throw new Error(Pervasives.Exit, { + throw new Error(PervasivesU.Exit, { cause: { - RE_EXN_ID: Pervasives.Exit + RE_EXN_ID: PervasivesU.Exit } }); } exit = 1; } if (exit === 1 && c > 127) { - throw new Error(Pervasives.Exit, { + throw new Error(PervasivesU.Exit, { cause: { - RE_EXN_ID: Pervasives.Exit + RE_EXN_ID: PervasivesU.Exit } }); } @@ -84,7 +83,7 @@ function _must_escape(s) { } catch (raw_exn){ let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); - if (exn.RE_EXN_ID === Pervasives.Exit) { + if (exn.RE_EXN_ID === PervasivesU.Exit) { return true; } throw new Error(exn.RE_EXN_ID, { @@ -152,13 +151,13 @@ function _is_digit(c) { } function _refill(t, k_succ, k_fail) { - let n = Curry._3(t.refill, t.buf, 0, t.buf.length); + let n = t.refill(t.buf, 0, t.buf.length); t.i = 0; t.len = n; if (n === 0) { - return Curry._1(k_fail, t); + return k_fail(t); } else { - return Curry._1(k_succ, t); + return k_succ(t); } } @@ -186,30 +185,28 @@ function _get(t) { return c; } -function _error(param) { +function _error(param, param$1) { let line = param.line; let col = param.col; - return function (msg) { - let b = Buffer.create(32); - Buffer.add_string(b, "at " + (line + (", " + (col + ": ")))); - Buffer.add_string(b, msg); - let msg$p = Buffer.contents(b); - return { - NAME: "Error", - VAL: msg$p - }; + let b = Buffer.create(32); + Buffer.add_string(b, "at " + (line + (", " + (col + ": ")))); + Buffer.add_string(b, param$1); + let msg$p = Buffer.contents(b); + return { + NAME: "Error", + VAL: msg$p }; } function _error_eof(t) { - return _error(t)("unexpected end of input"); + return _error(t, "unexpected end of input"); } function expr(k, t) { while(true) { if (t.i === t.len) { - return _refill(t, (function (param) { - return expr(k, param); + return _refill(t, (function (extra) { + return expr(k, extra); }), _error_eof); } let c = _get(t); @@ -234,7 +231,7 @@ function expr_starting_with(c, k, t) { }), t); } if (c === 92) { - return _error(t)("unexpected '\\'"); + return _error(t, "unexpected '\\'"); } } else if (c >= 11) { @@ -263,7 +260,7 @@ function expr_starting_with(c, k, t) { case 40 : return expr_list(/* [] */0, k, t); case 41 : - return _error(t)("unexpected ')'"); + return _error(t, "unexpected ')'"); } } @@ -287,14 +284,14 @@ function expr_starting_with(c, k, t) { function expr_list(acc, k, t) { while(true) { if (t.i === t.len) { - return _refill(t, (function (param) { - return expr_list(acc, k, param); + return _refill(t, (function (extra) { + return expr_list(acc, k, extra); }), _error_eof); } let c = _get(t); if (c > 32 || c < 9) { if (c === 41) { - return Curry._2(k, undefined, { + return k(undefined, { NAME: "List", VAL: List.rev(acc) }); @@ -305,22 +302,7 @@ function expr_list(acc, k, t) { } return expr_starting_with(c, (function (last, e) { if (last !== undefined) { - if (last !== 40) { - if (last !== 41) { - return expr_list({ - hd: e, - tl: acc - }, k, t); - } else { - return Curry._2(k, undefined, { - NAME: "List", - VAL: List.rev({ - hd: e, - tl: acc - }) - }); - } - } else { + if (last === 40) { return expr_list(/* [] */0, (function (param, l) { return expr_list({ hd: l, @@ -328,12 +310,21 @@ function expr_list(acc, k, t) { }, k, t); }), t); } - } else { - return expr_list({ - hd: e, - tl: acc - }, k, t); + if (last === 41) { + return k(undefined, { + NAME: "List", + VAL: List.rev({ + hd: e, + tl: acc + }) + }); + } + } + return expr_list({ + hd: e, + tl: acc + }, k, t); }), t); }; } @@ -341,7 +332,7 @@ function expr_list(acc, k, t) { function _return_atom(last, k, t) { let s = Buffer.contents(t.atom); t.atom.position = 0; - return Curry._2(k, last, { + return k(last, { NAME: "Atom", VAL: s }); @@ -350,10 +341,10 @@ function _return_atom(last, k, t) { function atom(k, t) { while(true) { if (t.i === t.len) { - return _refill(t, (function (param) { - return atom(k, param); - }), (function (param) { - return _return_atom(undefined, k, param); + return _refill(t, (function (extra) { + return atom(k, extra); + }), (function (extra) { + return _return_atom(undefined, k, extra); })); } let c = _get(t); @@ -361,7 +352,7 @@ function atom(k, t) { if (c >= 35) { if (c >= 42) { if (c === 92) { - return _error(t)("unexpected '\\' in non-quoted string"); + return _error(t, "unexpected '\\' in non-quoted string"); } exit = 1; } else { @@ -377,7 +368,7 @@ function atom(k, t) { exit = 1; break; case 34 : - return _error(t)("unexpected '\"' in the middle of an atom"); + return _error(t, "unexpected '\"' in the middle of an atom"); } } else { @@ -400,8 +391,8 @@ function atom(k, t) { function quoted(k, t) { while(true) { if (t.i === t.len) { - return _refill(t, (function (param) { - return quoted(k, param); + return _refill(t, (function (extra) { + return quoted(k, extra); }), _error_eof); } let c = _get(t); @@ -421,8 +412,8 @@ function quoted(k, t) { function escaped(k, t) { if (t.i === t.len) { - return _refill(t, (function (param) { - return escaped(k, param); + return _refill(t, (function (extra) { + return escaped(k, extra); }), _error_eof); } let c = _get(t); @@ -430,13 +421,13 @@ function escaped(k, t) { if (c < 117) { switch (c) { case 92 : - return Curry._1(k, /* '\\' */92); + return k(/* '\\' */92); case 98 : - return Curry._1(k, /* '\b' */8); + return k(/* '\b' */8); case 110 : - return Curry._1(k, /* '\n' */10); + return k(/* '\n' */10); case 114 : - return Curry._1(k, /* '\r' */13); + return k(/* '\r' */13); case 93 : case 94 : case 95 : @@ -459,61 +450,61 @@ function escaped(k, t) { case 115 : break; case 116 : - return Curry._1(k, /* '\t' */9); + return k(/* '\t' */9); } } } else if (c === 34) { - return Curry._1(k, /* '"' */34); + return k(/* '"' */34); } if (_is_digit(c)) { return read2int(c - /* '0' */48 | 0, (function (n) { - return Curry._1(k, Char.chr(n)); + return k(Char.chr(n)); }), t); } else { - return _error(t)("unexpected escaped char '" + (c + "'")); + return _error(t, "unexpected escaped char '" + (c + "'")); } } function read2int(i, k, t) { if (t.i === t.len) { - return _refill(t, (function (param) { - return read2int(i, k, param); + return _refill(t, (function (extra) { + return read2int(i, k, extra); }), _error_eof); } let c = _get(t); if (_is_digit(c)) { return read1int(Math.imul(10, i) + (c - /* '0' */48 | 0) | 0, k, t); } else { - return _error(t)("unexpected escaped char '" + (c + "' when reading byte")); + return _error(t, "unexpected escaped char '" + (c + "' when reading byte")); } } function read1int(i, k, t) { if (t.i === t.len) { - return _refill(t, (function (param) { - return read1int(i, k, param); + return _refill(t, (function (extra) { + return read1int(i, k, extra); }), _error_eof); } let c = _get(t); if (_is_digit(c)) { - return Curry._1(k, Math.imul(10, i) + (c - /* '0' */48 | 0) | 0); + return k(Math.imul(10, i) + (c - /* '0' */48 | 0) | 0); } else { - return _error(t)("unexpected escaped char '" + (c + "' when reading byte")); + return _error(t, "unexpected escaped char '" + (c + "' when reading byte")); } } function skip_comment(k, t) { while(true) { if (t.i === t.len) { - return _refill(t, (function (param) { - return skip_comment(k, param); + return _refill(t, (function (extra) { + return skip_comment(k, extra); }), _error_eof); } let match = _get(t); if (match === 10) { - return Curry._2(k, undefined, undefined); + return k(undefined, undefined); } continue; }; @@ -522,8 +513,8 @@ function skip_comment(k, t) { function expr_or_end(k, t) { while(true) { if (t.i === t.len) { - return _refill(t, (function (param) { - return expr_or_end(k, param); + return _refill(t, (function (extra) { + return expr_or_end(k, extra); }), (function (param) { return "End"; })); diff --git a/jscomp/test/sexpm_test.js b/jscomp/test/sexpm_test.js index c780da38fc..2183f46fb3 100644 --- a/jscomp/test/sexpm_test.js +++ b/jscomp/test/sexpm_test.js @@ -19,7 +19,7 @@ function eq(loc, param) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/small_inline_test.js b/jscomp/test/small_inline_test.js index f68a3a8a52..9e13d19432 100644 --- a/jscomp/test/small_inline_test.js +++ b/jscomp/test/small_inline_test.js @@ -1,30 +1,29 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); function $pipe$great(x, f) { - return Curry._1(f, x); + return f(x); } function hello1(y, f) { - return Curry._1(f, y); + return f(y); } function hello2(y, f) { - return Curry._1(f, y); + return f(y); } function hello3(y, f) { - return Curry._1(f, y); + return f(y); } function hello4(y, f) { - return Curry._1(f, y); + return f(y); } function hello5(y, f) { - return Curry._1(f, y); + return f(y); } function f(_x) { diff --git a/jscomp/test/stack_comp_test.js b/jscomp/test/stack_comp_test.js index d44a82031f..5f384a3582 100644 --- a/jscomp/test/stack_comp_test.js +++ b/jscomp/test/stack_comp_test.js @@ -2,8 +2,6 @@ 'use strict'; let Mt = require("./mt.js"); -let List = require("../../lib/js/list.js"); -let Curry = require("../../lib/js/curry.js"); let Stack = require("../../lib/js/stack.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); let Mt_global = require("./mt_global.js"); @@ -32,12 +30,12 @@ function to_list(s) { let l = { contents: /* [] */0 }; - List.iter((function (x) { + Stack.iter((function (x) { l.contents = { hd: x, tl: l.contents }; - }), s.c); + }), s); return l.contents; } @@ -58,7 +56,7 @@ let S = { function does_raise(f, s) { try { - Curry._1(f, s); + f(s); return false; } catch (raw_exn){ @@ -360,10 +358,10 @@ let i$7 = { contents: 1 }; -List.iter((function (j) { +Stack.iter((function (j) { assert_("File \"stack_comp_test.res\", line 143, characters 12-19", i$7.contents === j); i$7.contents = i$7.contents + 1 | 0; -}), s$5.c); +}), s$5); let s1$1 = { c: /* [] */0, diff --git a/jscomp/test/stack_test.js b/jscomp/test/stack_test.js index c4e4f0d2f3..462de12883 100644 --- a/jscomp/test/stack_test.js +++ b/jscomp/test/stack_test.js @@ -16,7 +16,7 @@ function to_list(v) { return List.rev(acc); } -function v(param) { +function v() { let v$1 = { c: /* [] */0, len: 0 diff --git a/jscomp/test/stream_parser_test.js b/jscomp/test/stream_parser_test.js index 9a66bed2cd..63128f88f2 100644 --- a/jscomp/test/stream_parser_test.js +++ b/jscomp/test/stream_parser_test.js @@ -2,7 +2,6 @@ 'use strict'; let Mt = require("./mt.js"); -let Curry = require("../../lib/js/curry.js"); let Queue = require("../../lib/js/queue.js"); let Genlex = require("../../lib/js/genlex.js"); let Stream = require("../../lib/js/stream.js"); @@ -17,12 +16,12 @@ function parse(token) { first: "Nil", last: "Nil" }; - let token$1 = function (param) { + let token$1 = function () { if (look_ahead.length !== 0) { return Queue.pop(look_ahead); } try { - return Curry._1(token, undefined); + return token(); } catch (exn){ return { @@ -31,12 +30,12 @@ function parse(token) { }; } }; - let parse_atom = function (param) { + let parse_atom = function () { let n = token$1(); switch (n.TAG) { case "Kwd" : if (n._0 === "(") { - let v = parse_expr_aux(parse_term_aux(parse_atom())); + let v = parse_expr(); let match = token$1(); if (match.TAG === "Kwd") { if (match._0 === ")") { @@ -75,14 +74,15 @@ function parse(token) { }); } }; - let parse_term_aux = function (e1) { + let parse_term = function () { + let e1 = parse_atom(); let e = token$1(); if (e.TAG === "Kwd") { switch (e._0) { case "*" : - return Math.imul(e1, parse_term_aux(parse_atom())); + return Math.imul(e1, parse_term()); case "/" : - return Caml_int32.div(e1, parse_term_aux(parse_atom())); + return Caml_int32.div(e1, parse_term()); default: Queue.push(e, look_ahead); return e1; @@ -92,14 +92,15 @@ function parse(token) { return e1; } }; - let parse_expr_aux = function (e1) { + let parse_expr = function () { + let e1 = parse_term(); let e = token$1(); if (e.TAG === "Kwd") { switch (e._0) { case "+" : - return e1 + parse_expr_aux(parse_term_aux(parse_atom())) | 0; + return e1 + parse_expr() | 0; case "-" : - return e1 - parse_expr_aux(parse_term_aux(parse_atom())) | 0; + return e1 - parse_expr() | 0; default: Queue.push(e, look_ahead); return e1; @@ -109,7 +110,7 @@ function parse(token) { return e1; } }; - let r = parse_expr_aux(parse_term_aux(parse_atom())); + let r = parse_expr(); return [ r, Queue.fold((function (acc, x) { @@ -143,7 +144,7 @@ let lexer = Genlex.make_lexer({ function token(chars) { let strm = lexer(chars); - return function (param) { + return function () { return Stream.next(strm); }; } @@ -154,12 +155,12 @@ function l_parse(token) { first: "Nil", last: "Nil" }; - let token$1 = function (param) { + let token$1 = function () { if (look_ahead.length !== 0) { return Queue.pop(look_ahead); } try { - return Curry._1(token, undefined); + return token(); } catch (exn){ return { @@ -168,12 +169,58 @@ function l_parse(token) { }; } }; - let parse_f = function (param) { + let parse_e = function () { + let _a = parse_t(); + while(true) { + let a = _a; + let t = token$1(); + if (t.TAG === "Kwd") { + switch (t._0) { + case "+" : + _a = a + parse_t() | 0; + continue; + case "-" : + _a = a - parse_t() | 0; + continue; + default: + Queue.push(t, look_ahead); + return a; + } + } else { + Queue.push(t, look_ahead); + return a; + } + }; + }; + let parse_t = function () { + let _a = parse_f(); + while(true) { + let a = _a; + let t = token$1(); + if (t.TAG === "Kwd") { + switch (t._0) { + case "*" : + _a = Math.imul(a, parse_f()); + continue; + case "/" : + _a = Caml_int32.div(a, parse_f()); + continue; + default: + Queue.push(t, look_ahead); + return a; + } + } else { + Queue.push(t, look_ahead); + return a; + } + }; + }; + let parse_f = function () { let i = token$1(); switch (i.TAG) { case "Kwd" : if (i._0 === "(") { - let v = parse_t_aux(parse_f_aux(parse_f())); + let v = parse_e(); let t = token$1(); if (t.TAG === "Kwd") { if (t._0 === ")") { @@ -210,51 +257,7 @@ function l_parse(token) { }); } }; - let parse_f_aux = function (_a) { - while(true) { - let a = _a; - let t = token$1(); - if (t.TAG === "Kwd") { - switch (t._0) { - case "*" : - _a = Math.imul(a, parse_f()); - continue; - case "/" : - _a = Caml_int32.div(a, parse_f()); - continue; - default: - Queue.push(t, look_ahead); - return a; - } - } else { - Queue.push(t, look_ahead); - return a; - } - }; - }; - let parse_t_aux = function (_a) { - while(true) { - let a = _a; - let t = token$1(); - if (t.TAG === "Kwd") { - switch (t._0) { - case "+" : - _a = a + parse_f_aux(parse_f()) | 0; - continue; - case "-" : - _a = a - parse_f_aux(parse_f()) | 0; - continue; - default: - Queue.push(t, look_ahead); - return a; - } - } else { - Queue.push(t, look_ahead); - return a; - } - }; - }; - let r = parse_t_aux(parse_f_aux(parse_f())); + let r = parse_e(); return [ r, Queue.fold((function (acc, x) { @@ -279,7 +282,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/string_bound_get_test.js b/jscomp/test/string_bound_get_test.js index 9069c1c482..3cb61d01e2 100644 --- a/jscomp/test/string_bound_get_test.js +++ b/jscomp/test/string_bound_get_test.js @@ -8,13 +8,13 @@ let v = "ghos"; let u_a = Caml_string.get(v, 0); -function u_b(param) { +function u_b() { return Caml_string.get(v, -1); } let u_c = Caml_string.get("ghos", 0); -function u_d(param) { +function u_d() { return Caml_string.get("ghos", -1); } @@ -22,7 +22,7 @@ let u_e = Caml_bytes.create(32); let u_f = Caml_bytes.get(u_e, 0); -function u_g(param) { +function u_g() { return Caml_bytes.get(u_e, -1); } diff --git a/jscomp/test/string_get_set_test.js b/jscomp/test/string_get_set_test.js index 61a871034d..c2281c7193 100644 --- a/jscomp/test/string_get_set_test.js +++ b/jscomp/test/string_get_set_test.js @@ -7,7 +7,7 @@ let Caml_string = require("../../lib/js/caml_string.js"); Mt.from_pair_suites("string_get_set_test.res", { hd: [ "File \"string_get_set_test.res\", line 4, characters 36-43", - (function (param) { + (function () { return { TAG: "Eq", _0: Caml_string.get("h", 0), diff --git a/jscomp/test/string_runtime_test.js b/jscomp/test/string_runtime_test.js index f63935b895..e875088074 100644 --- a/jscomp/test/string_runtime_test.js +++ b/jscomp/test/string_runtime_test.js @@ -4,6 +4,7 @@ let Mt = require("./mt.js"); let List = require("../../lib/js/list.js"); let Bytes = require("../../lib/js/bytes.js"); +let $$String = require("../../lib/js/string.js"); let Test_char = require("./test_char.js"); let Caml_bytes = require("../../lib/js/caml_bytes.js"); @@ -27,9 +28,9 @@ let suites_1 = { Bytes.fill(b, 0, x, /* 'c' */99); return [ Bytes.to_string(b), - Bytes.unsafe_to_string(Bytes.init(x, (function (param) { + $$String.init(x, (function (param) { return /* 'c' */99; - }))) + })) ]; }), { hd: 1000, diff --git a/jscomp/test/string_set.js b/jscomp/test/string_set.js index 7103bdbfba..985bc64571 100644 --- a/jscomp/test/string_set.js +++ b/jscomp/test/string_set.js @@ -165,7 +165,7 @@ function compare(s1, s2) { } function equal(s1, s2) { - return Set_gen.compare($$String.compare, s1, s2) === 0; + return compare(s1, s2) === 0; } function subset(_s1, _s2) { diff --git a/jscomp/test/string_set_test.js b/jscomp/test/string_set_test.js index 459762c5b7..17bf8448c9 100644 --- a/jscomp/test/string_set_test.js +++ b/jscomp/test/string_set_test.js @@ -17,7 +17,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/string_test.js b/jscomp/test/string_test.js index 3bbfc4e23a..b26b614d53 100644 --- a/jscomp/test/string_test.js +++ b/jscomp/test/string_test.js @@ -3,7 +3,6 @@ let Mt = require("./mt.js"); let List = require("../../lib/js/list.js"); -let $$Array = require("../../lib/js/array.js"); let Bytes = require("../../lib/js/bytes.js"); let $$String = require("../../lib/js/string.js"); let Ext_string_test = require("./ext_string_test.js"); @@ -127,16 +126,16 @@ function xsplit(delim, s) { } function string_of_chars(x) { - let xs = List.map((function (prim) { + let extra = List.map((function (prim) { return String.fromCharCode(prim); }), x); - return $$Array.of_list(xs).join(""); + return $$String.concat("", extra); } Mt.from_pair_suites("String_test", { hd: [ "mutliple switch", - (function (param) { + (function () { return { TAG: "Eq", _0: 9, @@ -147,7 +146,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "int switch", - (function (param) { + (function () { return { TAG: "Eq", _0: 9, @@ -158,7 +157,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "escape_normal", - (function (param) { + (function () { return { TAG: "Eq", _0: "haha", @@ -169,7 +168,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "escape_bytes", - (function (param) { + (function () { return { TAG: "Eq", _0: Bytes.of_string("haha"), @@ -180,7 +179,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "escape_quote", - (function (param) { + (function () { return { TAG: "Eq", _0: "\\\"\\\"", @@ -191,7 +190,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "rev_split_by_char", - (function (param) { + (function () { return { TAG: "Eq", _0: { @@ -211,7 +210,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "File \"string_test.res\", line 86, characters 5-12", - (function (param) { + (function () { return { TAG: "Eq", _0: { @@ -225,7 +224,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "xsplit", - (function (param) { + (function () { return { TAG: "Eq", _0: { @@ -245,7 +244,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "split_empty", - (function (param) { + (function () { return { TAG: "Eq", _0: /* [] */0, @@ -256,7 +255,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "split_empty2", - (function (param) { + (function () { return { TAG: "Eq", _0: { @@ -270,7 +269,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "rfind", - (function (param) { + (function () { return { TAG: "Eq", _0: 7, @@ -281,7 +280,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "rfind_2", - (function (param) { + (function () { return { TAG: "Eq", _0: 0, @@ -292,7 +291,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "rfind_3", - (function (param) { + (function () { return { TAG: "Eq", _0: -1, @@ -303,7 +302,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "find", - (function (param) { + (function () { return { TAG: "Eq", _0: 0, @@ -314,7 +313,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "find_2", - (function (param) { + (function () { return { TAG: "Eq", _0: 6, @@ -325,7 +324,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "find_3", - (function (param) { + (function () { return { TAG: "Eq", _0: -1, @@ -336,7 +335,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "of_char", - (function (param) { + (function () { return { TAG: "Eq", _0: String.fromCharCode(/* '0' */48), @@ -347,7 +346,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "of_chars", - (function (param) { + (function () { return { TAG: "Eq", _0: string_of_chars({ diff --git a/jscomp/test/string_unicode_test.js b/jscomp/test/string_unicode_test.js index 386b171876..aadbe7c0f7 100644 --- a/jscomp/test/string_unicode_test.js +++ b/jscomp/test/string_unicode_test.js @@ -16,7 +16,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/submodule.js b/jscomp/test/submodule.js index 838015f6b9..ed6c208606 100644 --- a/jscomp/test/submodule.js +++ b/jscomp/test/submodule.js @@ -56,6 +56,8 @@ let A0 = { A1: A1 }; +let v0 = 4; + let v1 = a1(1, 2); let v2 = a2(1, 2); @@ -64,8 +66,6 @@ let v3 = a3(1, 2); let v4 = a4(1, 2); -let v0 = 4; - exports.A0 = A0; exports.v0 = v0; exports.v1 = v1; diff --git a/jscomp/test/submodule_call.js b/jscomp/test/submodule_call.js index abc1e34326..6bbfb22c22 100644 --- a/jscomp/test/submodule_call.js +++ b/jscomp/test/submodule_call.js @@ -1,18 +1,17 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let Submodule = require("./submodule.js"); let a0 = Submodule.A0.a0(1, 2); -let a1 = Curry._2(Submodule.A0.A1.a1, 1, 2); +let a1 = Submodule.A0.A1.a1(1, 2); -let a2 = Curry._2(Submodule.A0.A1.A2.a2, 1, 2); +let a2 = Submodule.A0.A1.A2.a2(1, 2); -let a3 = Curry._2(Submodule.A0.A1.A2.A3.a3, 1, 2); +let a3 = Submodule.A0.A1.A2.A3.a3(1, 2); -let a4 = Curry._2(Submodule.A0.A1.A2.A3.A4.a4, 1, 2); +let a4 = Submodule.A0.A1.A2.A3.A4.a4(1, 2); exports.a0 = a0; exports.a1 = a1; diff --git a/jscomp/test/switch_case_test.js b/jscomp/test/switch_case_test.js index b91ac0d327..110f8d48d7 100644 --- a/jscomp/test/switch_case_test.js +++ b/jscomp/test/switch_case_test.js @@ -16,7 +16,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/tagged_template_test.js b/jscomp/test/tagged_template_test.js index 5b5507f1fb..02226e62b1 100644 --- a/jscomp/test/tagged_template_test.js +++ b/jscomp/test/tagged_template_test.js @@ -44,7 +44,7 @@ let res = foo([ Mt.from_pair_suites("tagged templates", { hd: [ "with externals, it should return a string with the correct interpolations", - (function (param) { + (function () { return { TAG: "Eq", _0: query, @@ -55,7 +55,7 @@ Mt.from_pair_suites("tagged templates", { tl: { hd: [ "with module scoped externals, it should also return a string with the correct interpolations", - (function (param) { + (function () { return { TAG: "Eq", _0: queryWithModule, @@ -66,7 +66,7 @@ Mt.from_pair_suites("tagged templates", { tl: { hd: [ "with externals, it should return the result of the function", - (function (param) { + (function () { return { TAG: "Eq", _0: length, @@ -77,7 +77,7 @@ Mt.from_pair_suites("tagged templates", { tl: { hd: [ "with rescript function, it should return a string with the correct encoding and interpolations", - (function (param) { + (function () { return { TAG: "Eq", _0: res, @@ -88,7 +88,7 @@ Mt.from_pair_suites("tagged templates", { tl: { hd: [ "a template literal tagged with json should generate a regular string interpolation for now", - (function (param) { + (function () { return { TAG: "Eq", _0: "some random " + "string", @@ -99,7 +99,7 @@ Mt.from_pair_suites("tagged templates", { tl: { hd: [ "a regular string interpolation should continue working", - (function (param) { + (function () { return { TAG: "Eq", _0: "some random string interpolation", diff --git a/jscomp/test/tailcall_inline_test.js b/jscomp/test/tailcall_inline_test.js index 6e1903a607..820658b385 100644 --- a/jscomp/test/tailcall_inline_test.js +++ b/jscomp/test/tailcall_inline_test.js @@ -5,7 +5,7 @@ let Mt = require("./mt.js"); let $$Array = require("../../lib/js/array.js"); let Caml_array = require("../../lib/js/caml_array.js"); -function f(param) { +function f() { let f$1 = function (_acc, _n) { while(true) { let n = _n; diff --git a/jscomp/test/template.js b/jscomp/test/template.js index 9c787fb134..c869a3b5b2 100644 --- a/jscomp/test/template.js +++ b/jscomp/test/template.js @@ -4,7 +4,7 @@ let bla2 = ""; -function concat(param) { +function concat() { return "\n display:\r flex;\n " + bla2; } diff --git a/jscomp/test/test_ari.js b/jscomp/test/test_ari.js index f229b97fd6..32407d6233 100644 --- a/jscomp/test/test_ari.js +++ b/jscomp/test/test_ari.js @@ -4,7 +4,6 @@ let U = require("U"); let VV = require("VV"); let List = require("../../lib/js/list.js"); -let Curry = require("../../lib/js/curry.js"); function f(x, y) { return x + y | 0; @@ -15,15 +14,17 @@ function f1(x, y) { } function f3(g, x) { - return Curry._1(g, x); + return g(x); } -function f2(param) { - return 3 + param | 0; +function f2(extra) { + return 3 + extra | 0; } -function ff(param) { - return U.test_primit(3, param); +let g = 7; + +function ff(extra) { + return U.test_primit(3, extra); } let fff = VV.test_primit2(3); @@ -41,8 +42,6 @@ function length_aux(_len, _x) { }; } -let g = 7; - let length = List.length; let compare_lengths = List.compare_lengths; diff --git a/jscomp/test/test_array_primitive.js b/jscomp/test/test_array_primitive.js index d1dc53858d..69819d9239 100644 --- a/jscomp/test/test_array_primitive.js +++ b/jscomp/test/test_array_primitive.js @@ -12,27 +12,27 @@ function caml_array_sub(x, offset, len) { } function caml_array_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" - } - }); + if (!(index < 0 || index >= xs.length)) { + return Caml_array.set(xs, index, newval); } - Caml_array.set(xs, index, newval); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds" + } + }); } function caml_array_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" - } - }); + if (!(index < 0 || index >= xs.length)) { + return Caml_array.get(xs, index); } - return Caml_array.get(xs, index); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds" + } + }); } function caml_make_vect(len, init) { diff --git a/jscomp/test/test_bool_equal.js b/jscomp/test/test_bool_equal.js index 7ba6649e5b..e5b824d6e7 100644 --- a/jscomp/test/test_bool_equal.js +++ b/jscomp/test/test_bool_equal.js @@ -16,7 +16,7 @@ function bool_equal(x, y) { } } -function assertions(param) { +function assertions() { if (!bool_equal(true, true)) { throw new Error("Assert_failure", { cause: { diff --git a/jscomp/test/test_bs_this.js b/jscomp/test/test_bs_this.js index 0a1b918fd5..a2890643aa 100644 --- a/jscomp/test/test_bs_this.js +++ b/jscomp/test/test_bs_this.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); function uux_this(x, y) { let o = this ; @@ -13,7 +12,7 @@ function even(x) { return x + o | 0; } -function bark(param) { +function bark() { return function (x, y) { let o = this ; console.log([ @@ -40,7 +39,7 @@ function f(x) { let o = this ; console.log(o); }); - return Curry._2(x.addEventListener, "onload", (function () { + return x.addEventListener("onload", (function () { let o = this ; console.log(o.response); })); diff --git a/jscomp/test/test_bytes.js b/jscomp/test/test_bytes.js index 9d625d0f65..b48ab6d8c8 100644 --- a/jscomp/test/test_bytes.js +++ b/jscomp/test/test_bytes.js @@ -3,7 +3,9 @@ let Bytes = require("../../lib/js/bytes.js"); -let f = Bytes.unsafe_to_string; +function f(v) { + return Bytes.unsafe_to_string(v); +} let ff = Bytes.to_string; diff --git a/jscomp/test/test_case_set.js b/jscomp/test/test_case_set.js index 418dcc977e..7b74291121 100644 --- a/jscomp/test/test_case_set.js +++ b/jscomp/test/test_case_set.js @@ -1,14 +1,13 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); function f(x) { x.case = 3; } function g(x) { - return Curry._1(x.item, 3); + return x.item(3); } exports.f = f; diff --git a/jscomp/test/test_closure.js b/jscomp/test/test_closure.js index 96cd4f8993..d19b24cb89 100644 --- a/jscomp/test/test_closure.js +++ b/jscomp/test/test_closure.js @@ -2,14 +2,13 @@ 'use strict'; let $$Array = require("../../lib/js/array.js"); -let Curry = require("../../lib/js/curry.js"); let Caml_array = require("../../lib/js/caml_array.js"); let v = { contents: 0 }; -function f(param) { +function f() { let arr = Caml_array.make(10, (function (param) { })); @@ -24,7 +23,7 @@ function f(param) { let u = f(); $$Array.iter((function (x) { - Curry._1(x, undefined); + x(); }), u); if (v.contents !== 45) { diff --git a/jscomp/test/test_cps.js b/jscomp/test/test_cps.js index cdcf252937..f1dff037ec 100644 --- a/jscomp/test/test_cps.js +++ b/jscomp/test/test_cps.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let Caml_array = require("../../lib/js/caml_array.js"); function f(_n, _acc) { @@ -9,18 +8,18 @@ function f(_n, _acc) { let acc = _acc; let n = _n; if (n === 0) { - return Curry._1(acc, undefined); + return acc(); } - _acc = (function (param) { + _acc = (function () { console.log(String(n)); - return Curry._1(acc, undefined); + return acc(); }); _n = n - 1 | 0; continue; }; } -function test_closure(param) { +function test_closure() { let arr = Caml_array.make(6, (function (x) { return x; })); @@ -32,7 +31,7 @@ function test_closure(param) { return arr; } -f(10, (function (param) { +f(10, (function () { })); diff --git a/jscomp/test/test_demo.js b/jscomp/test/test_demo.js index da34385e5b..0724edaa9a 100644 --- a/jscomp/test/test_demo.js +++ b/jscomp/test/test_demo.js @@ -2,7 +2,6 @@ 'use strict'; let List = require("../../lib/js/list.js"); -let Curry = require("../../lib/js/curry.js"); function fib(x) { if (x === 2 || x === 1) { @@ -26,7 +25,7 @@ function map(f, x) { } else { return { TAG: "Cons", - _0: Curry._1(f, x._0), + _0: f(x._0), _1: map(f, x._1) }; } @@ -60,12 +59,14 @@ function g1(x, y) { let u = 8; -let x = u + 6 | 0; +let x = (function (z) { + return u + z | 0; +})(6); -let u$1 = 7; - -function v(param) { - return (6 + param | 0) + u$1 | 0; +function v(extra) { + let u = 7; + let xx = 6; + return (xx + extra | 0) + u | 0; } let nil = "Nil"; @@ -83,4 +84,4 @@ exports.g = g; exports.g1 = g1; exports.x = x; exports.v = v; -/* No side effect */ +/* x Not a pure module */ diff --git a/jscomp/test/test_exception.js b/jscomp/test/test_exception.js index c8e8edc719..b050e637b5 100644 --- a/jscomp/test/test_exception.js +++ b/jscomp/test/test_exception.js @@ -6,7 +6,7 @@ let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); let Local = /* @__PURE__ */Caml_exceptions.create("Test_exception.Local"); -function f(param) { +function f() { throw new Error(Local, { cause: { RE_EXN_ID: Local, @@ -15,7 +15,7 @@ function f(param) { }); } -function g(param) { +function g() { throw new Error("Not_found", { cause: { RE_EXN_ID: "Not_found" @@ -23,7 +23,7 @@ function g(param) { }); } -function h(param) { +function h() { throw new Error(Test_common.U, { cause: { RE_EXN_ID: Test_common.U, @@ -32,7 +32,7 @@ function h(param) { }); } -function x(param) { +function x() { throw new Error(Test_common.H, { cause: { RE_EXN_ID: Test_common.H @@ -40,7 +40,7 @@ function x(param) { }); } -function xx(param) { +function xx() { throw new Error("Invalid_argument", { cause: { RE_EXN_ID: "Invalid_argument", diff --git a/jscomp/test/test_external.js b/jscomp/test/test_external.js index 13d3d54156..6267a58ca0 100644 --- a/jscomp/test/test_external.js +++ b/jscomp/test/test_external.js @@ -1,13 +1,12 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let xx = document(); alert("hehha"); -let b = Curry._1(ff("x"), 3); +let b = ff("x")(3); exports.xx = xx; exports.b = b; diff --git a/jscomp/test/test_fib.js b/jscomp/test/test_fib.js index 1b6c660c76..ccc19ec289 100644 --- a/jscomp/test/test_fib.js +++ b/jscomp/test/test_fib.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); function fib(x) { if (x === 0 || x === 1) { @@ -57,7 +56,7 @@ function map(f, x) { } else { return { TAG: "Cons", - _0: Curry._1(f, x._0), + _0: f(x._0), _1: map(f, x._1) }; } diff --git a/jscomp/test/test_for_loop.js b/jscomp/test/test_for_loop.js index b3f53e4e04..343bc858c5 100644 --- a/jscomp/test/test_for_loop.js +++ b/jscomp/test/test_for_loop.js @@ -2,7 +2,6 @@ 'use strict'; let $$Array = require("../../lib/js/array.js"); -let Curry = require("../../lib/js/curry.js"); let Caml_array = require("../../lib/js/caml_array.js"); function for_(x) { @@ -21,17 +20,19 @@ function for_3(x) { let v = { contents: 0 }; - let arr = $$Array.map((function (param, param$1) { - + let arr = $$Array.map((function (param) { + return function () { + + }; }), x); for(let i = 0 ,i_finish = x.length; i <= i_finish; ++i){ let j = (i << 1); - Caml_array.set(arr, i, (function (param) { + Caml_array.set(arr, i, (function () { v.contents = v.contents + j | 0; })); } $$Array.iter((function (x) { - Curry._1(x, undefined); + x(); }), arr); return v.contents; } @@ -40,18 +41,20 @@ function for_4(x) { let v = { contents: 0 }; - let arr = $$Array.map((function (param, param$1) { - + let arr = $$Array.map((function (param) { + return function () { + + }; }), x); for(let i = 0 ,i_finish = x.length; i <= i_finish; ++i){ let j = (i << 1); let k = (j << 1); - Caml_array.set(arr, i, (function (param) { + Caml_array.set(arr, i, (function () { v.contents = v.contents + k | 0; })); } $$Array.iter((function (x) { - Curry._1(x, undefined); + x(); }), arr); return v.contents; } @@ -60,17 +63,19 @@ function for_5(x, u) { let v = { contents: 0 }; - let arr = $$Array.map((function (param, param$1) { - + let arr = $$Array.map((function (param) { + return function () { + + }; }), x); for(let i = 0 ,i_finish = x.length; i <= i_finish; ++i){ let k = Math.imul((u << 1), u); - Caml_array.set(arr, i, (function (param) { + Caml_array.set(arr, i, (function () { v.contents = v.contents + k | 0; })); } $$Array.iter((function (x) { - Curry._1(x, undefined); + x(); }), arr); return v.contents; } @@ -79,8 +84,10 @@ function for_6(x, u) { let v = { contents: 0 }; - let arr = $$Array.map((function (param, param$1) { - + let arr = $$Array.map((function (param) { + return function () { + + }; }), x); let v4 = { contents: 0 @@ -98,13 +105,13 @@ function for_6(x, u) { let k = Math.imul((u << 1), u); let h = (v5.contents << 1); v2.contents = v2.contents + 1 | 0; - Caml_array.set(arr, i, (function (param) { + Caml_array.set(arr, i, (function () { v.contents = (((((v.contents + k | 0) + v2.contents | 0) + u | 0) + v4.contents | 0) + v5.contents | 0) + h | 0; })); } } $$Array.iter((function (x) { - Curry._1(x, undefined); + x(); }), arr); return v.contents; } diff --git a/jscomp/test/test_for_map.js b/jscomp/test/test_for_map.js index b8c3075fa4..6c0aa0b9e9 100644 --- a/jscomp/test/test_for_map.js +++ b/jscomp/test/test_for_map.js @@ -2,7 +2,6 @@ 'use strict'; let Caml = require("../../lib/js/caml.js"); -let Curry = require("../../lib/js/curry.js"); let Caml_option = require("../../lib/js/caml_option.js"); function height(param) { @@ -188,7 +187,7 @@ function find_first(f, _param) { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _d0 = param.d; let _param$1 = param.l; @@ -203,7 +202,7 @@ function find_first(f, _param) { ]; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.l; _d0 = param$1.d; _v0 = v$1; @@ -225,7 +224,7 @@ function find_first_opt(f, _param) { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _d0 = param.d; let _param$1 = param.l; @@ -240,7 +239,7 @@ function find_first_opt(f, _param) { ]; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.l; _d0 = param$1.d; _v0 = v$1; @@ -266,7 +265,7 @@ function find_last(f, _param) { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _d0 = param.d; let _param$1 = param.r; @@ -281,7 +280,7 @@ function find_last(f, _param) { ]; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.r; _d0 = param$1.d; _v0 = v$1; @@ -303,7 +302,7 @@ function find_last_opt(f, _param) { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _d0 = param.d; let _param$1 = param.r; @@ -318,7 +317,7 @@ function find_last_opt(f, _param) { ]; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.r; _d0 = param$1.d; _v0 = v$1; @@ -501,7 +500,7 @@ function remove(x, param) { function update(x, f, param) { if (typeof param !== "object") { - let data = Curry._1(f, undefined); + let data = f(undefined); if (data !== undefined) { return { TAG: "Node", @@ -521,7 +520,7 @@ function update(x, f, param) { let l = param.l; let c = Caml.int_compare(x, v); if (c === 0) { - let data$1 = Curry._1(f, Caml_option.some(d)); + let data$1 = f(Caml_option.some(d)); if (data$1 === undefined) { return merge(l, r); } @@ -562,7 +561,7 @@ function iter(f, _param) { return; } iter(f, param.l); - Curry._2(f, param.v, param.d); + f(param.v, param.d); _param = param.r; continue; }; @@ -573,7 +572,7 @@ function map(f, param) { return "Empty"; } let l$p = map(f, param.l); - let d$p = Curry._1(f, param.d); + let d$p = f(param.d); let r$p = map(f, param.r); return { TAG: "Node", @@ -591,7 +590,7 @@ function mapi(f, param) { } let v = param.v; let l$p = mapi(f, param.l); - let d$p = Curry._2(f, v, param.d); + let d$p = f(v, param.d); let r$p = mapi(f, param.r); return { TAG: "Node", @@ -610,7 +609,7 @@ function fold(f, _m, _accu) { if (typeof m !== "object") { return accu; } - _accu = Curry._3(f, m.v, m.d, fold(f, m.l, accu)); + _accu = f(m.v, m.d, fold(f, m.l, accu)); _m = m.r; continue; }; @@ -622,7 +621,7 @@ function for_all(p, _param) { if (typeof param !== "object") { return true; } - if (!Curry._2(p, param.v, param.d)) { + if (!p(param.v, param.d)) { return false; } if (!for_all(p, param.l)) { @@ -639,7 +638,7 @@ function exists(p, _param) { if (typeof param !== "object") { return false; } - if (Curry._2(p, param.v, param.d)) { + if (p(param.v, param.d)) { return true; } if (exists(p, param.l)) { @@ -749,7 +748,7 @@ function merge$1(f, s1, s2) { let v1 = s1.v; if (s1.h >= height(s2)) { let match = split(v1, s2); - return concat_or_join(merge$1(f, s1.l, match[0]), v1, Curry._3(f, v1, Caml_option.some(s1.d), match[1]), merge$1(f, s1.r, match[2])); + return concat_or_join(merge$1(f, s1.l, match[0]), v1, f(v1, Caml_option.some(s1.d), match[1]), merge$1(f, s1.r, match[2])); } } @@ -767,7 +766,7 @@ function merge$1(f, s1, s2) { } let v2 = s2.v; let match$1 = split(v2, s1); - return concat_or_join(merge$1(f, match$1[0], s2.l), v2, Curry._3(f, v2, match$1[1], Caml_option.some(s2.d)), merge$1(f, match$1[2], s2.r)); + return concat_or_join(merge$1(f, match$1[0], s2.l), v2, f(v2, match$1[1], Caml_option.some(s2.d)), merge$1(f, match$1[2], s2.r)); } function union(f, s1, s2) { @@ -787,7 +786,7 @@ function union(f, s1, s2) { let l = union(f, s1.l, match[0]); let r = union(f, s1.r, match[2]); if (d2$1 !== undefined) { - return concat_or_join(l, v1, Curry._3(f, v1, d1, Caml_option.valFromOption(d2$1)), r); + return concat_or_join(l, v1, f(v1, d1, Caml_option.valFromOption(d2$1)), r); } else { return join(l, v1, d1, r); } @@ -797,7 +796,7 @@ function union(f, s1, s2) { let l$1 = union(f, match$1[0], s2.l); let r$1 = union(f, match$1[2], s2.r); if (d1$1 !== undefined) { - return concat_or_join(l$1, v2, Curry._3(f, v2, Caml_option.valFromOption(d1$1), d2), r$1); + return concat_or_join(l$1, v2, f(v2, Caml_option.valFromOption(d1$1), d2), r$1); } else { return join(l$1, v2, d2, r$1); } @@ -812,7 +811,7 @@ function filter(p, param) { let v = param.v; let l = param.l; let l$p = filter(p, l); - let pvd = Curry._2(p, v, d); + let pvd = p(v, d); let r$p = filter(p, r); if (pvd) { if (l === l$p && r === r$p) { @@ -837,7 +836,7 @@ function partition(p, param) { let match = partition(p, param.l); let lf = match[1]; let lt = match[0]; - let pvd = Curry._2(p, v, d); + let pvd = p(v, d); let match$1 = partition(p, param.r); let rf = match$1[1]; let rt = match$1[0]; @@ -893,7 +892,7 @@ function compare(cmp, m1, m2) { if (c !== 0) { return c; } - let c$1 = Curry._2(cmp, e1._1, e2._1); + let c$1 = cmp(e1._1, e2._1); if (c$1 !== 0) { return c$1; } @@ -922,7 +921,7 @@ function equal(cmp, m1, m2) { if (e1._0 !== e2._0) { return false; } - if (!Curry._2(cmp, e1._1, e2._1)) { + if (!cmp(e1._1, e2._1)) { return false; } _e2 = cons_enum(e2._2, e2._3); @@ -999,7 +998,7 @@ let IntMap = { mapi: mapi }; -function assertion_test(param) { +function assertion_test() { let m = "Empty"; for(let i = 0; i <= 1000000; ++i){ m = add(i, i, m); diff --git a/jscomp/test/test_google_closure.js b/jscomp/test/test_google_closure.js index 77f3725de3..4867382b5a 100644 --- a/jscomp/test/test_google_closure.js +++ b/jscomp/test/test_google_closure.js @@ -9,21 +9,26 @@ function f(a, b, param) { } function f2(a) { - return function (param) { + return function (extra) { return a + 1 | 0; }; } let a = String(3); -let b = 101; +function f3(extra) { + return 101; +} + +let b = f3(2); let arr = $$Array.init(2, (function (param) { return 0; })); for(let i = 0; i <= 1; ++i){ - Caml_array.set(arr, i, i + 1 | 0); + let f3$1 = f2(i); + Caml_array.set(arr, i, f3$1(2)); } console.log([ diff --git a/jscomp/test/test_list.js b/jscomp/test/test_list.js index 2822fd6b14..c92b992af0 100644 --- a/jscomp/test/test_list.js +++ b/jscomp/test/test_list.js @@ -2,9 +2,8 @@ 'use strict'; let List = require("../../lib/js/list.js"); -let Curry = require("../../lib/js/curry.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); -let Pervasives = require("../../lib/js/pervasives.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); function length_aux(_len, _x) { while(true) { @@ -100,7 +99,7 @@ function rev(l) { function flatten(x) { if (x) { - return Pervasives.$at(x.hd, flatten(x.tl)); + return PervasivesU.$at(x.hd, flatten(x.tl)); } else { return /* [] */0; } @@ -110,7 +109,7 @@ function map(f, x) { if (!x) { return /* [] */0; } - let r = Curry._1(f, x.hd); + let r = f(x.hd); return { hd: r, tl: map(f, x.tl) @@ -121,7 +120,7 @@ function mapi(i, f, x) { if (!x) { return /* [] */0; } - let r = Curry._2(f, i, x.hd); + let r = f(i, x.hd); return { hd: r, tl: mapi(i + 1 | 0, f, x.tl) @@ -143,7 +142,7 @@ function rev_map(f, l) { } _x = x.tl; _accu = { - hd: Curry._1(f, x.hd), + hd: f(x.hd), tl: accu }; continue; @@ -156,7 +155,7 @@ function iter(f, _x) { if (!x) { return; } - Curry._1(f, x.hd); + f(x.hd); _x = x.tl; continue; }; @@ -171,7 +170,7 @@ function iteri(f, l) { if (!x) { return; } - Curry._2(f, i, x.hd); + f(i, x.hd); _x = x.tl; _i = i + 1 | 0; continue; @@ -186,14 +185,14 @@ function fold_left(f, _accu, _l) { return accu; } _l = l.tl; - _accu = Curry._2(f, accu, l.hd); + _accu = f(accu, l.hd); continue; }; } function fold_right(f, l, accu) { if (l) { - return Curry._2(f, l.hd, fold_right(f, l.tl, accu)); + return f(l.hd, fold_right(f, l.tl, accu)); } else { return accu; } @@ -202,7 +201,7 @@ function fold_right(f, l, accu) { function map2(f, l1, l2) { if (l1) { if (l2) { - let r = Curry._2(f, l1.hd, l2.hd); + let r = f(l1.hd, l2.hd); return { hd: r, tl: map2(f, l1.tl, l2.tl) @@ -239,7 +238,7 @@ function rev_map2(f, l1, l2) { _l2 = l2$1.tl; _l1 = l1$1.tl; _accu = { - hd: Curry._2(f, l1$1.hd, l2$1.hd), + hd: f(l1$1.hd, l2$1.hd), tl: accu }; continue; @@ -251,15 +250,15 @@ function rev_map2(f, l1, l2) { } }); } - if (l2$1) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2" - } - }); + if (!l2$1) { + return accu; } - return accu; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2" + } + }); }; } @@ -269,7 +268,7 @@ function iter2(f, _l1, _l2) { let l1 = _l1; if (l1) { if (l2) { - Curry._2(f, l1.hd, l2.hd); + f(l1.hd, l2.hd); _l2 = l2.tl; _l1 = l1.tl; continue; @@ -302,7 +301,7 @@ function fold_left2(f, _accu, _l1, _l2) { if (l2) { _l2 = l2.tl; _l1 = l1.tl; - _accu = Curry._3(f, accu, l1.hd, l2.hd); + _accu = f(accu, l1.hd, l2.hd); continue; } throw new Error("Invalid_argument", { @@ -312,22 +311,22 @@ function fold_left2(f, _accu, _l1, _l2) { } }); } - if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_left2" - } - }); + if (!l2) { + return accu; } - return accu; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2" + } + }); }; } function fold_right2(f, l1, l2, accu) { if (l1) { if (l2) { - return Curry._3(f, l1.hd, l2.hd, fold_right2(f, l1.tl, l2.tl, accu)); + return f(l1.hd, l2.hd, fold_right2(f, l1.tl, l2.tl, accu)); } throw new Error("Invalid_argument", { cause: { @@ -336,15 +335,15 @@ function fold_right2(f, l1, l2, accu) { } }); } - if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2" - } - }); + if (!l2) { + return accu; } - return accu; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2" + } + }); } function for_all(p, _x) { @@ -353,7 +352,7 @@ function for_all(p, _x) { if (!x) { return true; } - if (!Curry._1(p, x.hd)) { + if (!p(x.hd)) { return false; } _x = x.tl; @@ -367,7 +366,7 @@ function exists(p, _x) { if (!x) { return false; } - if (Curry._1(p, x.hd)) { + if (p(x.hd)) { return true; } _x = x.tl; @@ -381,7 +380,7 @@ function for_all2(p, _l1, _l2) { let l1 = _l1; if (l1) { if (l2) { - if (!Curry._2(p, l1.hd, l2.hd)) { + if (!p(l1.hd, l2.hd)) { return false; } _l2 = l2.tl; @@ -413,7 +412,7 @@ function exists2(p, _l1, _l2) { let l1 = _l1; if (l1) { if (l2) { - if (Curry._2(p, l1.hd, l2.hd)) { + if (p(l1.hd, l2.hd)) { return true; } _l2 = l2.tl; @@ -570,7 +569,7 @@ function find(p, _x) { let x = _x; if (x) { let x$1 = x.hd; - if (Curry._1(p, x$1)) { + if (p(x$1)) { return x$1; } _x = x.tl; @@ -596,7 +595,7 @@ function find_all(p) { } let l = x.tl; let x$1 = x.hd; - if (Curry._1(p, x$1)) { + if (p(x$1)) { _x = l; _accu = { hd: x$1, @@ -626,7 +625,7 @@ function partition(p, l) { } let l$1 = x.tl; let x$1 = x.hd; - if (Curry._1(p, x$1)) { + if (p(x$1)) { _x = l$1; _yes = { hd: x$1, @@ -702,7 +701,7 @@ function merge(cmp, l1, l2) { } let h2 = l2.hd; let h1 = l1.hd; - if (Curry._2(cmp, h1, h2) <= 0) { + if (cmp(h1, h2) <= 0) { return { hd: h1, tl: merge(cmp, l1.tl, l2) @@ -751,8 +750,8 @@ function stable_sort(cmp, l) { let x3 = match$1.hd; let x2 = match.hd; let x1 = l.hd; - if (Curry._2(cmp, x1, x2) <= 0) { - if (Curry._2(cmp, x2, x3) <= 0) { + if (cmp(x1, x2) <= 0) { + if (cmp(x2, x3) <= 0) { return { hd: x1, tl: { @@ -763,7 +762,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x1, x3) <= 0) { + } else if (cmp(x1, x3) <= 0) { return { hd: x1, tl: { @@ -786,7 +785,7 @@ function stable_sort(cmp, l) { } }; } - } else if (Curry._2(cmp, x1, x3) <= 0) { + } else if (cmp(x1, x3) <= 0) { return { hd: x2, tl: { @@ -797,7 +796,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x2, x3) <= 0) { + } else if (cmp(x2, x3) <= 0) { return { hd: x2, tl: { @@ -831,7 +830,7 @@ function stable_sort(cmp, l) { if (match$2) { let x2$1 = match$2.hd; let x1$1 = l.hd; - if (Curry._2(cmp, x1$1, x2$1) <= 0) { + if (cmp(x1$1, x2$1) <= 0) { return { hd: x1$1, tl: { @@ -871,7 +870,7 @@ function stable_sort(cmp, l) { } let h2 = l2$1.hd; let h1 = l1.hd; - if (Curry._2(cmp, h1, h2) > 0) { + if (cmp(h1, h2) > 0) { _accu = { hd: h1, tl: accu @@ -897,8 +896,8 @@ function stable_sort(cmp, l) { let x3 = match$1.hd; let x2 = match.hd; let x1 = l.hd; - if (Curry._2(cmp, x1, x2) > 0) { - if (Curry._2(cmp, x2, x3) > 0) { + if (cmp(x1, x2) > 0) { + if (cmp(x2, x3) > 0) { return { hd: x1, tl: { @@ -909,7 +908,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x1, x3) > 0) { + } else if (cmp(x1, x3) > 0) { return { hd: x1, tl: { @@ -932,7 +931,7 @@ function stable_sort(cmp, l) { } }; } - } else if (Curry._2(cmp, x1, x3) > 0) { + } else if (cmp(x1, x3) > 0) { return { hd: x2, tl: { @@ -943,7 +942,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x2, x3) > 0) { + } else if (cmp(x2, x3) > 0) { return { hd: x2, tl: { @@ -977,7 +976,7 @@ function stable_sort(cmp, l) { if (match$2) { let x2$1 = match$2.hd; let x1$1 = l.hd; - if (Curry._2(cmp, x1$1, x2$1) > 0) { + if (cmp(x1$1, x2$1) > 0) { return { hd: x1$1, tl: { @@ -1017,7 +1016,7 @@ function stable_sort(cmp, l) { } let h2 = l2$1.hd; let h1 = l1.hd; - if (Curry._2(cmp, h1, h2) <= 0) { + if (cmp(h1, h2) <= 0) { _accu = { hd: h1, tl: accu @@ -1052,9 +1051,9 @@ function sort_uniq(cmp, l) { let x3 = match$1.hd; let x2 = match.hd; let x1 = l.hd; - let c = Curry._2(cmp, x1, x2); + let c = cmp(x1, x2); if (c === 0) { - let c$1 = Curry._2(cmp, x2, x3); + let c$1 = cmp(x2, x3); if (c$1 === 0) { return { hd: x2, @@ -1079,7 +1078,7 @@ function sort_uniq(cmp, l) { } } if (c < 0) { - let c$2 = Curry._2(cmp, x2, x3); + let c$2 = cmp(x2, x3); if (c$2 === 0) { return { hd: x1, @@ -1101,7 +1100,7 @@ function sort_uniq(cmp, l) { } }; } - let c$3 = Curry._2(cmp, x1, x3); + let c$3 = cmp(x1, x3); if (c$3 === 0) { return { hd: x1, @@ -1134,7 +1133,7 @@ function sort_uniq(cmp, l) { }; } } - let c$4 = Curry._2(cmp, x1, x3); + let c$4 = cmp(x1, x3); if (c$4 === 0) { return { hd: x2, @@ -1156,7 +1155,7 @@ function sort_uniq(cmp, l) { } }; } - let c$5 = Curry._2(cmp, x2, x3); + let c$5 = cmp(x2, x3); if (c$5 === 0) { return { hd: x2, @@ -1199,7 +1198,7 @@ function sort_uniq(cmp, l) { if (match$2) { let x2$1 = match$2.hd; let x1$1 = l.hd; - let c$6 = Curry._2(cmp, x1$1, x2$1); + let c$6 = cmp(x1$1, x2$1); if (c$6 === 0) { return { hd: x1$1, @@ -1247,7 +1246,7 @@ function sort_uniq(cmp, l) { let h2 = l2$1.hd; let t1 = l1.tl; let h1 = l1.hd; - let c$7 = Curry._2(cmp, h1, h2); + let c$7 = cmp(h1, h2); if (c$7 === 0) { _accu = { hd: h1, @@ -1283,9 +1282,9 @@ function sort_uniq(cmp, l) { let x3 = match$1.hd; let x2 = match.hd; let x1 = l.hd; - let c = Curry._2(cmp, x1, x2); + let c = cmp(x1, x2); if (c === 0) { - let c$1 = Curry._2(cmp, x2, x3); + let c$1 = cmp(x2, x3); if (c$1 === 0) { return { hd: x2, @@ -1310,7 +1309,7 @@ function sort_uniq(cmp, l) { } } if (c > 0) { - let c$2 = Curry._2(cmp, x2, x3); + let c$2 = cmp(x2, x3); if (c$2 === 0) { return { hd: x1, @@ -1332,7 +1331,7 @@ function sort_uniq(cmp, l) { } }; } - let c$3 = Curry._2(cmp, x1, x3); + let c$3 = cmp(x1, x3); if (c$3 === 0) { return { hd: x1, @@ -1365,7 +1364,7 @@ function sort_uniq(cmp, l) { }; } } - let c$4 = Curry._2(cmp, x1, x3); + let c$4 = cmp(x1, x3); if (c$4 === 0) { return { hd: x2, @@ -1387,7 +1386,7 @@ function sort_uniq(cmp, l) { } }; } - let c$5 = Curry._2(cmp, x2, x3); + let c$5 = cmp(x2, x3); if (c$5 === 0) { return { hd: x2, @@ -1430,7 +1429,7 @@ function sort_uniq(cmp, l) { if (match$2) { let x2$1 = match$2.hd; let x1$1 = l.hd; - let c$6 = Curry._2(cmp, x1$1, x2$1); + let c$6 = cmp(x1$1, x2$1); if (c$6 === 0) { return { hd: x1$1, @@ -1478,7 +1477,7 @@ function sort_uniq(cmp, l) { let h2 = l2$1.hd; let t1 = l1.tl; let h1 = l1.hd; - let c$7 = Curry._2(cmp, h1, h2); + let c$7 = cmp(h1, h2); if (c$7 === 0) { _accu = { hd: h1, @@ -1514,7 +1513,7 @@ function sort_uniq(cmp, l) { let u = List.length; -let append = Pervasives.$at; +let append = PervasivesU.$at; let concat = flatten; diff --git a/jscomp/test/test_match_exception.js b/jscomp/test/test_match_exception.js index 3e2ab2cf40..4fa365dee3 100644 --- a/jscomp/test/test_match_exception.js +++ b/jscomp/test/test_match_exception.js @@ -1,12 +1,11 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function f(g, x) { try { - return Curry._1(g, x); + return g(x); } catch (raw_exn){ let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); diff --git a/jscomp/test/test_nested_print.js b/jscomp/test/test_nested_print.js index a7e5bfb8d1..d74ed08696 100644 --- a/jscomp/test/test_nested_print.js +++ b/jscomp/test/test_nested_print.js @@ -1,14 +1,13 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); function u(x, x$1) { return x$1 + x$1 | 0; } function f(g, x) { - let u = Curry._1(g, x); + let u = g(x); return u + u | 0; } diff --git a/jscomp/test/test_per.js b/jscomp/test/test_per.js index a966844427..0f46ead324 100644 --- a/jscomp/test/test_per.js +++ b/jscomp/test/test_per.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); let Caml_sys = require("../../lib/js/caml_sys.js"); let Caml_bytes = require("../../lib/js/caml_bytes.js"); @@ -220,7 +219,7 @@ function open_out_bin(name) { }, 438, name); } -function flush_all(param) { +function flush_all() { let _x = Caml_external_polyfill.resolve("ml_out_channels_list")(); while(true) { let x = _x; @@ -442,18 +441,18 @@ let exit_function = { function at_exit(f) { let g = exit_function.contents; - exit_function.contents = (function (param) { - Curry._1(f, undefined); - Curry._1(g, undefined); + exit_function.contents = (function () { + f(); + g(); }); } -function do_at_exit(param) { - Curry._1(exit_function.contents, undefined); +function do_at_exit() { + exit_function.contents(); } function exit(retcode) { - Curry._1(exit_function.contents, undefined); + exit_function.contents(); return Caml_sys.sys_exit(retcode); } diff --git a/jscomp/test/test_primitive.js b/jscomp/test/test_primitive.js index a61a29b06b..7ac5a138b3 100644 --- a/jscomp/test/test_primitive.js +++ b/jscomp/test/test_primitive.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let Caml_array = require("../../lib/js/caml_array.js"); let Caml_string = require("../../lib/js/caml_string.js"); let CamlinternalLazy = require("../../lib/js/camlinternalLazy.js"); @@ -55,7 +54,7 @@ function u(b) { } function f2(h, b, param) { - return Curry._1(h, b ? 32 : 7); + return h(b ? 32 : 7); } Caml_array.set(v, 1, 3.0); diff --git a/jscomp/test/test_react.js b/jscomp/test/test_react.js index b932f17e10..445d1d00ab 100644 --- a/jscomp/test/test_react.js +++ b/jscomp/test/test_react.js @@ -11,14 +11,14 @@ let ReactDom = require("react-dom"); console.log(32); ReactDom.render(React.createClass({ - render: (function (param) { + render: (function () { return React.DOM.div({ alt: "pic" }, React.DOM.h1(undefined, "hello react"), React.DOM.h2(undefined, "type safe!"), React.DOM.h3(undefined, "type safe!")); }) }), document.getElementById("hi")); -function f(param) { +function f() { Xxx(); Xxx.xx(); Xxx.xxx(); diff --git a/jscomp/test/test_seq.js b/jscomp/test/test_seq.js index 98b33eeab9..81e28520d9 100644 --- a/jscomp/test/test_seq.js +++ b/jscomp/test/test_seq.js @@ -1,9 +1,8 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); -let Pervasives = require("../../lib/js/pervasives.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); @@ -32,7 +31,7 @@ function assoc3(x, _l) { }; } -function help_action(param) { +function help_action() { throw new Error(Stop, { cause: { RE_EXN_ID: Stop, @@ -50,7 +49,7 @@ function v(speclist) { } function f(g, speclist) { - return Curry._1(g, assoc3("-help", speclist)); + return g(assoc3("-help", speclist)); } function add_help(speclist) { @@ -104,7 +103,7 @@ function add_help(speclist) { }); } } - return Pervasives.$at(speclist, Pervasives.$at(add1, add2)); + return PervasivesU.$at(speclist, PervasivesU.$at(add1, add2)); } exports.Bad = Bad; diff --git a/jscomp/test/test_set.js b/jscomp/test/test_set.js index 064c3ee923..b20f62893c 100644 --- a/jscomp/test/test_set.js +++ b/jscomp/test/test_set.js @@ -2,7 +2,6 @@ 'use strict'; let List = require("../../lib/js/list.js"); -let Curry = require("../../lib/js/curry.js"); function Make(Ord) { let height = function (x) { @@ -101,7 +100,7 @@ function Make(Ord) { let r = x_._2; let v = x_._1; let l = x_._0; - let c = Curry._2(Ord.compare, x, v); + let c = Ord.compare(x, v); if (c === 0) { return x_; } else if (c < 0) { @@ -231,7 +230,7 @@ function Make(Ord) { let r = x_._2; let v = x_._1; let l = x_._0; - let c = Curry._2(Ord.compare, x, v); + let c = Ord.compare(x, v); if (c === 0) { return [ l, @@ -267,7 +266,7 @@ function Make(Ord) { if (typeof x_ !== "object") { return false; } - let c = Curry._2(Ord.compare, x, x_._1); + let c = Ord.compare(x, x_._1); if (c === 0) { return true; } @@ -282,7 +281,7 @@ function Make(Ord) { let r = x_._2; let v = x_._1; let l = x_._0; - let c = Curry._2(Ord.compare, x, v); + let c = Ord.compare(x, v); if (c === 0) { return merge(l, r); } else if (c < 0) { @@ -382,7 +381,7 @@ function Make(Ord) { if (typeof e2 !== "object") { return 1; } - let c = Curry._2(Ord.compare, e1._0, e2._0); + let c = Ord.compare(e1._0, e2._0); if (c !== 0) { return c; } @@ -412,7 +411,7 @@ function Make(Ord) { } let r2 = s2._2; let l2 = s2._0; - let c = Curry._2(Ord.compare, v1, s2._1); + let c = Ord.compare(v1, s2._1); if (c === 0) { if (!subset(l1, l2)) { return false; @@ -454,7 +453,7 @@ function Make(Ord) { return; } iter(f, x_._0); - Curry._1(f, x_._1); + f(x_._1); _x_ = x_._2; continue; }; @@ -466,7 +465,7 @@ function Make(Ord) { if (typeof s !== "object") { return accu; } - _accu = Curry._2(f, s._1, fold(f, s._0, accu)); + _accu = f(s._1, fold(f, s._0, accu)); _s = s._2; continue; }; @@ -477,7 +476,7 @@ function Make(Ord) { if (typeof x !== "object") { return true; } - if (!Curry._1(p, x._1)) { + if (!p(x._1)) { return false; } if (!for_all(p, x._0)) { @@ -493,7 +492,7 @@ function Make(Ord) { if (typeof x !== "object") { return false; } - if (Curry._1(p, x._1)) { + if (p(x._1)) { return true; } if (exists(p, x._0)) { @@ -509,7 +508,7 @@ function Make(Ord) { } let v = x._1; let l$p = filter(p, x._0); - let pv = Curry._1(p, v); + let pv = p(v); let r$p = filter(p, x._2); if (pv) { return join(l$p, v, r$p); @@ -528,7 +527,7 @@ function Make(Ord) { let match = partition(p, x._0); let lf = match[1]; let lt = match[0]; - let pv = Curry._1(p, v); + let pv = p(v); let match$1 = partition(p, x._2); let rf = match$1[1]; let rt = match$1[0]; @@ -580,7 +579,7 @@ function Make(Ord) { }); } let v = x_._1; - let c = Curry._2(Ord.compare, x, v); + let c = Ord.compare(x, v); if (c === 0) { return v; } diff --git a/jscomp/test/test_side_effect_functor.js b/jscomp/test/test_side_effect_functor.js index 10d3460d95..360f364740 100644 --- a/jscomp/test/test_side_effect_functor.js +++ b/jscomp/test/test_side_effect_functor.js @@ -8,7 +8,7 @@ v = v + 1 | 0; console.log(String(v)); -function unuse_v(param) { +function unuse_v() { return 35; } diff --git a/jscomp/test/test_simple_ref.js b/jscomp/test/test_simple_ref.js index a340698803..3fd4056ff3 100644 --- a/jscomp/test/test_simple_ref.js +++ b/jscomp/test/test_simple_ref.js @@ -1,13 +1,12 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let v = { contents: 0 }; -function gen(param) { +function gen() { v.contents = v.contents + 1 | 0; return v.contents; } @@ -25,7 +24,7 @@ let c = { let not_real_escape = a; function real_escape(f, v) { - return Curry._1(f, c); + return f(c); } let u = h; diff --git a/jscomp/test/test_string_map.js b/jscomp/test/test_string_map.js index 3dbd98deb4..9aa866bb25 100644 --- a/jscomp/test/test_string_map.js +++ b/jscomp/test/test_string_map.js @@ -2,7 +2,6 @@ 'use strict'; let Caml = require("../../lib/js/caml.js"); -let Curry = require("../../lib/js/curry.js"); function height(param) { if (typeof param !== "object") { @@ -159,20 +158,20 @@ function find(x, _param) { function timing(label, f) { console.time(label); - Curry._1(f, undefined); + f(); console.timeEnd(label); } -function assertion_test(param) { +function assertion_test() { let m = { contents: "Empty" }; - timing("building", (function (param) { + timing("building", (function () { for(let i = 0; i <= 1000000; ++i){ m.contents = add(String(i), String(i), m.contents); } })); - timing("querying", (function (param) { + timing("querying", (function () { for(let i = 0; i <= 1000000; ++i){ find(String(i), m.contents); } diff --git a/jscomp/test/test_switch.js b/jscomp/test/test_switch.js index 6cd0bab8e5..cf69436849 100644 --- a/jscomp/test/test_switch.js +++ b/jscomp/test/test_switch.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); function f(x) { if (typeof x !== "object") { @@ -28,7 +27,7 @@ function bind(x, f) { if (x.TAG === "Left") { return { TAG: "Left", - _0: Curry._1(f, x._0) + _0: f(x._0) }; } else { return x; diff --git a/jscomp/test/test_trywith.js b/jscomp/test/test_trywith.js index bb6e7279c0..1f81560003 100644 --- a/jscomp/test/test_trywith.js +++ b/jscomp/test/test_trywith.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); @@ -15,7 +14,7 @@ let Sys_blocked_io = /* @__PURE__ */Caml_exceptions.create("Test_trywith.Sys_blo function ff(g, x) { try { - Curry._1(g, x); + g(x); } catch (raw_exn){ let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); @@ -27,7 +26,7 @@ function ff(g, x) { } try { - Curry._1(g, x); + g(x); } catch (raw_exn$1){ let exn$1 = Caml_js_exceptions.internalToOCamlException(raw_exn$1); @@ -39,7 +38,7 @@ function ff(g, x) { } try { - Curry._1(g, x); + g(x); } catch (raw_exn$2){ let exn$2 = Caml_js_exceptions.internalToOCamlException(raw_exn$2); @@ -51,7 +50,7 @@ function ff(g, x) { } try { - Curry._1(g, x); + g(x); } catch (raw_exn$3){ let exn$3 = Caml_js_exceptions.internalToOCamlException(raw_exn$3); @@ -63,7 +62,7 @@ function ff(g, x) { } try { - Curry._1(g, x); + g(x); } catch (raw_exn$4){ let exn$4 = Caml_js_exceptions.internalToOCamlException(raw_exn$4); @@ -75,7 +74,7 @@ function ff(g, x) { } try { - Curry._1(g, x); + g(x); } catch (raw_exn$5){ let exn$5 = Caml_js_exceptions.internalToOCamlException(raw_exn$5); @@ -87,7 +86,7 @@ function ff(g, x) { } try { - Curry._1(g, x); + g(x); } catch (raw_exn$6){ let exn$6 = Caml_js_exceptions.internalToOCamlException(raw_exn$6); @@ -99,7 +98,7 @@ function ff(g, x) { } try { - Curry._1(g, x); + g(x); } catch (raw_exn$7){ let exn$7 = Caml_js_exceptions.internalToOCamlException(raw_exn$7); @@ -111,7 +110,7 @@ function ff(g, x) { } try { - Curry._1(g, x); + g(x); } catch (raw_exn$8){ let exn$8 = Caml_js_exceptions.internalToOCamlException(raw_exn$8); @@ -123,7 +122,7 @@ function ff(g, x) { } try { - return Curry._1(g, x); + return g(x); } catch (raw_exn$9){ let exn$9 = Caml_js_exceptions.internalToOCamlException(raw_exn$9); @@ -136,7 +135,7 @@ function ff(g, x) { } } -function u(param) { +function u() { throw new Error("Not_found", { cause: { RE_EXN_ID: "Not_found" diff --git a/jscomp/test/test_type_based_arity.js b/jscomp/test/test_type_based_arity.js index eb66db3e62..89fd9368c5 100644 --- a/jscomp/test/test_type_based_arity.js +++ b/jscomp/test/test_type_based_arity.js @@ -1,66 +1,65 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); function f0(g, x) { - return Curry._1(g, x); + return g(x); } function f1(g, x) { - Curry._1(g, x); + g(x); } let X = {}; function f2(g, x) { - return Curry._1(g, x); + return g(x); } function f3(g, x) { - Curry._1(g, x); + g(x); } function f4(g, x) { - return Curry._1(g, x); + return g(x); } function f5(g, x) { - return Curry._1(g, x); + return g(x); } function f6(g, x) { - return Curry._1(g, x); + return g(x); } function f7(g, x) { - return Curry._1(g, x); + return g(x); } let X0 = {}; function f8(g, x) { - return Curry._1(g, x); + return g(x); } function f9(g, x) { - return Curry._1(g, x); + return g(x); } function f10(g, x) { - return Curry._1(g, x); + return g(x); } function f11(g, x) { - return Curry._1(g, x); + return g(x); } function f12(g, x) { - return Curry._1(g, x); + return g(x); } function f13(g, x) { - return Curry._1(g, x); + return g(x); } let X2 = { @@ -68,7 +67,7 @@ let X2 = { }; function f14(h, g, x) { - Curry._2(h, g, x); + h(g, x); } exports.f0 = f0; diff --git a/jscomp/test/test_unsupported_primitive.js b/jscomp/test/test_unsupported_primitive.js index ac85e30558..9de4f418a1 100644 --- a/jscomp/test/test_unsupported_primitive.js +++ b/jscomp/test/test_unsupported_primitive.js @@ -4,15 +4,15 @@ let Caml_external_polyfill = require("../../lib/js/caml_external_polyfill.js"); function to_buffer(buff, ofs, len, v, flags) { - if (ofs < 0 || len < 0 || ofs > (buff.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Marshal.to_buffer: substring out of bounds" - } - }); + if (!(ofs < 0 || len < 0 || ofs > (buff.length - len | 0))) { + return Caml_external_polyfill.resolve("caml_output_value_to_buffer")(buff, ofs, len, v, flags); } - return Caml_external_polyfill.resolve("caml_output_value_to_buffer")(buff, ofs, len, v, flags); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Marshal.to_buffer: substring out of bounds" + } + }); } exports.to_buffer = to_buffer; diff --git a/jscomp/test/test_while_closure.js b/jscomp/test/test_while_closure.js index 096c86a68f..ebca37f982 100644 --- a/jscomp/test/test_while_closure.js +++ b/jscomp/test/test_while_closure.js @@ -2,22 +2,21 @@ 'use strict'; let $$Array = require("../../lib/js/array.js"); -let Curry = require("../../lib/js/curry.js"); let Caml_array = require("../../lib/js/caml_array.js"); let v = { contents: 0 }; -let arr = Caml_array.make(10, (function (param) { +let arr = Caml_array.make(10, (function () { })); -function f(param) { +function f() { let n = 0; while(n < 10) { let j = n; - Caml_array.set(arr, j, (function (param) { + Caml_array.set(arr, j, (function () { v.contents = v.contents + j | 0; })); n = n + 1 | 0; @@ -27,7 +26,7 @@ function f(param) { f(); $$Array.iter((function (x) { - Curry._1(x, undefined); + x(); }), arr); console.log(String(v.contents)); diff --git a/jscomp/test/test_zero_nullable.js b/jscomp/test/test_zero_nullable.js index c8a337ca3f..72737d80b0 100644 --- a/jscomp/test/test_zero_nullable.js +++ b/jscomp/test/test_zero_nullable.js @@ -2,7 +2,6 @@ 'use strict'; let Mt = require("./mt.js"); -let Curry = require("../../lib/js/curry.js"); let Caml_option = require("../../lib/js/caml_option.js"); let suites = { @@ -18,7 +17,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -47,7 +46,7 @@ function f2(x) { } function f5(h, x) { - let u = Curry._1(h, 32); + let u = h(32); if (u !== null) { return u + 1 | 0; } else { @@ -56,7 +55,7 @@ function f5(h, x) { } function f4(h, x) { - let u = Curry._1(h, 32); + let u = h(32); let v = 32 + x | 0; if (u !== null) { return u + 1 | 0; @@ -132,7 +131,7 @@ function f2$1(x) { } function f5$1(h, x) { - let u = Curry._1(h, 32); + let u = h(32); if (u !== undefined) { return u + 1 | 0; } else { @@ -141,7 +140,7 @@ function f5$1(h, x) { } function f4$1(h, x) { - let u = Curry._1(h, 32); + let u = h(32); let v = 32 + x | 0; if (u !== undefined) { return u + 1 | 0; @@ -217,7 +216,7 @@ function f2$2(x) { } function f5$2(h, x) { - let u = Curry._1(h, 32); + let u = h(32); if (u == null) { return 3; } else { @@ -226,7 +225,7 @@ function f5$2(h, x) { } function f4$2(h, x) { - let u = Curry._1(h, 32); + let u = h(32); let v = 32 + x | 0; if (u == null) { return 1 + v | 0; diff --git a/jscomp/test/ticker.js b/jscomp/test/ticker.js index 58c91f9fd1..51a6827b93 100644 --- a/jscomp/test/ticker.js +++ b/jscomp/test/ticker.js @@ -3,12 +3,11 @@ let Caml = require("../../lib/js/caml.js"); let List = require("../../lib/js/list.js"); -let Curry = require("../../lib/js/curry.js"); let $$String = require("../../lib/js/string.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); -let Pervasives = require("../../lib/js/pervasives.js"); let Caml_format = require("../../lib/js/caml_format.js"); let Caml_option = require("../../lib/js/caml_option.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function split(delim, s) { @@ -58,7 +57,7 @@ function split(delim, s) { function string_of_float_option(x) { if (x !== undefined) { - return Pervasives.string_of_float(x); + return PervasivesU.string_of_float(x); } else { return "nan"; } @@ -280,7 +279,7 @@ function find_first(f, _param) { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _d0 = param.d; let _param$1 = param.l; @@ -295,7 +294,7 @@ function find_first(f, _param) { ]; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.l; _d0 = param$1.d; _v0 = v$1; @@ -317,7 +316,7 @@ function find_first_opt(f, _param) { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _d0 = param.d; let _param$1 = param.l; @@ -332,7 +331,7 @@ function find_first_opt(f, _param) { ]; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.l; _d0 = param$1.d; _v0 = v$1; @@ -358,7 +357,7 @@ function find_last(f, _param) { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _d0 = param.d; let _param$1 = param.r; @@ -373,7 +372,7 @@ function find_last(f, _param) { ]; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.r; _d0 = param$1.d; _v0 = v$1; @@ -395,7 +394,7 @@ function find_last_opt(f, _param) { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _d0 = param.d; let _param$1 = param.r; @@ -410,7 +409,7 @@ function find_last_opt(f, _param) { ]; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.r; _d0 = param$1.d; _v0 = v$1; @@ -593,7 +592,7 @@ function remove(x, param) { function update(x, f, param) { if (typeof param !== "object") { - let data = Curry._1(f, undefined); + let data = f(undefined); if (data !== undefined) { return { TAG: "Node", @@ -613,7 +612,7 @@ function update(x, f, param) { let l = param.l; let c = Caml_obj.compare(x, v); if (c === 0) { - let data$1 = Curry._1(f, Caml_option.some(d)); + let data$1 = f(Caml_option.some(d)); if (data$1 === undefined) { return merge(l, r); } @@ -654,7 +653,7 @@ function iter(f, _param) { return; } iter(f, param.l); - Curry._2(f, param.v, param.d); + f(param.v, param.d); _param = param.r; continue; }; @@ -665,7 +664,7 @@ function map(f, param) { return "Empty"; } let l$p = map(f, param.l); - let d$p = Curry._1(f, param.d); + let d$p = f(param.d); let r$p = map(f, param.r); return { TAG: "Node", @@ -683,7 +682,7 @@ function mapi(f, param) { } let v = param.v; let l$p = mapi(f, param.l); - let d$p = Curry._2(f, v, param.d); + let d$p = f(v, param.d); let r$p = mapi(f, param.r); return { TAG: "Node", @@ -702,7 +701,7 @@ function fold(f, _m, _accu) { if (typeof m !== "object") { return accu; } - _accu = Curry._3(f, m.v, m.d, fold(f, m.l, accu)); + _accu = f(m.v, m.d, fold(f, m.l, accu)); _m = m.r; continue; }; @@ -714,7 +713,7 @@ function for_all(p, _param) { if (typeof param !== "object") { return true; } - if (!Curry._2(p, param.v, param.d)) { + if (!p(param.v, param.d)) { return false; } if (!for_all(p, param.l)) { @@ -731,7 +730,7 @@ function exists(p, _param) { if (typeof param !== "object") { return false; } - if (Curry._2(p, param.v, param.d)) { + if (p(param.v, param.d)) { return true; } if (exists(p, param.l)) { @@ -841,7 +840,7 @@ function merge$1(f, s1, s2) { let v1 = s1.v; if (s1.h >= height(s2)) { let match = split$1(v1, s2); - return concat_or_join(merge$1(f, s1.l, match[0]), v1, Curry._3(f, v1, Caml_option.some(s1.d), match[1]), merge$1(f, s1.r, match[2])); + return concat_or_join(merge$1(f, s1.l, match[0]), v1, f(v1, Caml_option.some(s1.d), match[1]), merge$1(f, s1.r, match[2])); } } @@ -859,7 +858,7 @@ function merge$1(f, s1, s2) { } let v2 = s2.v; let match$1 = split$1(v2, s1); - return concat_or_join(merge$1(f, match$1[0], s2.l), v2, Curry._3(f, v2, match$1[1], Caml_option.some(s2.d)), merge$1(f, match$1[2], s2.r)); + return concat_or_join(merge$1(f, match$1[0], s2.l), v2, f(v2, match$1[1], Caml_option.some(s2.d)), merge$1(f, match$1[2], s2.r)); } function union(f, s1, s2) { @@ -879,7 +878,7 @@ function union(f, s1, s2) { let l = union(f, s1.l, match[0]); let r = union(f, s1.r, match[2]); if (d2$1 !== undefined) { - return concat_or_join(l, v1, Curry._3(f, v1, d1, Caml_option.valFromOption(d2$1)), r); + return concat_or_join(l, v1, f(v1, d1, Caml_option.valFromOption(d2$1)), r); } else { return join(l, v1, d1, r); } @@ -889,7 +888,7 @@ function union(f, s1, s2) { let l$1 = union(f, match$1[0], s2.l); let r$1 = union(f, match$1[2], s2.r); if (d1$1 !== undefined) { - return concat_or_join(l$1, v2, Curry._3(f, v2, Caml_option.valFromOption(d1$1), d2), r$1); + return concat_or_join(l$1, v2, f(v2, Caml_option.valFromOption(d1$1), d2), r$1); } else { return join(l$1, v2, d2, r$1); } @@ -904,7 +903,7 @@ function filter(p, param) { let v = param.v; let l = param.l; let l$p = filter(p, l); - let pvd = Curry._2(p, v, d); + let pvd = p(v, d); let r$p = filter(p, r); if (pvd) { if (l === l$p && r === r$p) { @@ -929,7 +928,7 @@ function partition(p, param) { let match = partition(p, param.l); let lf = match[1]; let lt = match[0]; - let pvd = Curry._2(p, v, d); + let pvd = p(v, d); let match$1 = partition(p, param.r); let rf = match$1[1]; let rt = match$1[0]; @@ -985,7 +984,7 @@ function compare(cmp, m1, m2) { if (c !== 0) { return c; } - let c$1 = Curry._2(cmp, e1._1, e2._1); + let c$1 = cmp(e1._1, e2._1); if (c$1 !== 0) { return c$1; } @@ -1014,7 +1013,7 @@ function equal(cmp, m1, m2) { if (!Caml_obj.equal(e1._0, e2._0)) { return false; } - if (!Curry._2(cmp, e1._1, e2._1)) { + if (!cmp(e1._1, e2._1)) { return false; } _e2 = cons_enum(e2._2, e2._3); @@ -1140,7 +1139,7 @@ function compute_update_sequences(all_tickers) { let ticker_name = ticker.ticker_name; if (typeof type_ !== "object") { let l = find(ticker_name, map); - return add(ticker_name, Pervasives.$at(up, l), map); + return add(ticker_name, PervasivesU.$at(up, l), map); } let match = type_._0; let map$1 = loop({ @@ -1294,21 +1293,21 @@ function process_input_line(ticker_map, all_tickers, line) { if (match$4) { let match$5 = match$4.tl; if (match$5) { - if (match$5.tl) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "Invalid input line" - } - }); + if (!match$5.tl) { + return [ + { + hd: make_binary_op(ticker_name, match$4.hd, match$5.hd, "PLUS"), + tl: all_tickers + }, + ticker_map + ]; } - return [ - { - hd: make_binary_op(ticker_name, match$4.hd, match$5.hd, "PLUS"), - tl: all_tickers - }, - ticker_map - ]; + throw new Error("Failure", { + cause: { + RE_EXN_ID: "Failure", + _1: "Invalid input line" + } + }); } throw new Error("Failure", { cause: { @@ -1328,21 +1327,21 @@ function process_input_line(ticker_map, all_tickers, line) { if (match$6) { let match$7 = match$6.tl; if (match$7) { - if (match$7.tl) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "Invalid input line" - } - }); + if (!match$7.tl) { + return [ + { + hd: make_binary_op(ticker_name, match$6.hd, match$7.hd, "MINUS"), + tl: all_tickers + }, + ticker_map + ]; } - return [ - { - hd: make_binary_op(ticker_name, match$6.hd, match$7.hd, "MINUS"), - tl: all_tickers - }, - ticker_map - ]; + throw new Error("Failure", { + cause: { + RE_EXN_ID: "Failure", + _1: "Invalid input line" + } + }); } throw new Error("Failure", { cause: { @@ -1358,26 +1357,26 @@ function process_input_line(ticker_map, all_tickers, line) { } }); case "S" : - if (match$3.tl) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "Invalid input line" - } - }); - } - return [ - { - hd: { - value: undefined, - rank: "Uninitialized", - ticker_name: ticker_name, - type_: "Market" + if (!match$3.tl) { + return [ + { + hd: { + value: undefined, + rank: "Uninitialized", + ticker_name: ticker_name, + type_: "Market" + }, + tl: all_tickers }, - tl: all_tickers - }, - ticker_map - ]; + ticker_map + ]; + } + throw new Error("Failure", { + cause: { + RE_EXN_ID: "Failure", + _1: "Invalid input line" + } + }); default: throw new Error("Failure", { cause: { diff --git a/jscomp/test/to_string_test.js b/jscomp/test/to_string_test.js index e6fc68e9db..6c388c6ff2 100644 --- a/jscomp/test/to_string_test.js +++ b/jscomp/test/to_string_test.js @@ -2,9 +2,11 @@ 'use strict'; let Mt = require("./mt.js"); -let Pervasives = require("../../lib/js/pervasives.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); -let ff = Pervasives.string_of_float; +function ff(v) { + return PervasivesU.string_of_float(v); +} function f(v) { return String(v); @@ -13,10 +15,10 @@ function f(v) { Mt.from_pair_suites("To_string_test", { hd: [ "File \"to_string_test.res\", line 6, characters 8-15", - (function (param) { + (function () { return { TAG: "Eq", - _0: Pervasives.string_of_float(Pervasives.infinity), + _0: PervasivesU.string_of_float(PervasivesU.infinity), _1: "inf" }; }) @@ -24,10 +26,10 @@ Mt.from_pair_suites("To_string_test", { tl: { hd: [ "File \"to_string_test.res\", line 6, characters 49-56", - (function (param) { + (function () { return { TAG: "Eq", - _0: Pervasives.string_of_float(Pervasives.neg_infinity), + _0: PervasivesU.string_of_float(PervasivesU.neg_infinity), _1: "-inf" }; }) diff --git a/jscomp/test/topsort_test.js b/jscomp/test/topsort_test.js index e624fc366f..edfcd11ba6 100644 --- a/jscomp/test/topsort_test.js +++ b/jscomp/test/topsort_test.js @@ -3,11 +3,10 @@ let Caml = require("../../lib/js/caml.js"); let List = require("../../lib/js/list.js"); -let Curry = require("../../lib/js/curry.js"); let $$String = require("../../lib/js/string.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); -let Pervasives = require("../../lib/js/pervasives.js"); let Caml_option = require("../../lib/js/caml_option.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); @@ -92,7 +91,7 @@ function dfs1(_nodes, graph, _visited) { hd: x, tl: visited }; - _nodes = Pervasives.$at(nexts(x, graph), xs); + _nodes = PervasivesU.$at(nexts(x, graph), xs); continue; }; } @@ -410,16 +409,21 @@ function unsafe_topsort(graph) { let visited = { contents: /* [] */0 }; + let sort_nodes = function (nodes) { + List.iter((function (node) { + sort_node(node); + }), nodes); + }; let sort_node = function (node) { - if (List.mem(node, visited.contents)) { + if (!List.mem(node, visited.contents)) { + sort_nodes(nexts(node, graph)); + visited.contents = { + hd: node, + tl: visited.contents + }; return; } - let nodes = nexts(node, graph); - List.iter(sort_node, nodes); - visited.contents = { - hd: node, - tl: visited.contents - }; + }; List.iter((function (param) { sort_node(param[0]); @@ -976,7 +980,7 @@ function iter(f, _param) { return; } iter(f, param.l); - Curry._1(f, param.v); + f(param.v); _param = param.r; continue; }; @@ -989,7 +993,7 @@ function fold(f, _s, _accu) { if (typeof s !== "object") { return accu; } - _accu = Curry._2(f, s.v, fold(f, s.l, accu)); + _accu = f(s.v, fold(f, s.l, accu)); _s = s.r; continue; }; @@ -1001,7 +1005,7 @@ function for_all(p, _param) { if (typeof param !== "object") { return true; } - if (!Curry._1(p, param.v)) { + if (!p(param.v)) { return false; } if (!for_all(p, param.l)) { @@ -1018,7 +1022,7 @@ function exists(p, _param) { if (typeof param !== "object") { return false; } - if (Curry._1(p, param.v)) { + if (p(param.v)) { return true; } if (exists(p, param.l)) { @@ -1037,7 +1041,7 @@ function filter(p, param) { let v = param.v; let l = param.l; let l$p = filter(p, l); - let pv = Curry._1(p, v); + let pv = p(v); let r$p = filter(p, r); if (pv) { if (l === l$p && r === r$p) { @@ -1061,7 +1065,7 @@ function partition(p, param) { let match = partition(p, param.l); let lf = match[1]; let lt = match[0]; - let pv = Curry._1(p, v); + let pv = p(v); let match$1 = partition(p, param.r); let rf = match$1[1]; let rt = match$1[0]; @@ -1137,7 +1141,7 @@ function find_first(f, _param) { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _param$1 = param.l; while(true) { @@ -1147,7 +1151,7 @@ function find_first(f, _param) { return v0; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.l; _v0 = v$1; continue; @@ -1168,7 +1172,7 @@ function find_first_opt(f, _param) { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _param$1 = param.l; while(true) { @@ -1178,7 +1182,7 @@ function find_first_opt(f, _param) { return Caml_option.some(v0); } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.l; _v0 = v$1; continue; @@ -1203,7 +1207,7 @@ function find_last(f, _param) { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _param$1 = param.r; while(true) { @@ -1213,7 +1217,7 @@ function find_last(f, _param) { return v0; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.r; _v0 = v$1; continue; @@ -1234,7 +1238,7 @@ function find_last_opt(f, _param) { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _param$1 = param.r; while(true) { @@ -1244,7 +1248,7 @@ function find_last_opt(f, _param) { return Caml_option.some(v0); } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.r; _v0 = v$1; continue; @@ -1282,7 +1286,7 @@ function map(f, param) { let v = param.v; let l = param.l; let l$p = map(f, l); - let v$p = Curry._1(f, v); + let v$p = f(v); let r$p = map(f, r); if (l === l$p && v === v$p && r === r$p) { return param; diff --git a/jscomp/test/tuple_alloc.js b/jscomp/test/tuple_alloc.js index 19fc3755d4..412bddc78b 100644 --- a/jscomp/test/tuple_alloc.js +++ b/jscomp/test/tuple_alloc.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let v = { contents: 0 @@ -19,23 +18,23 @@ let vv = { contents: 0 }; -function reset2(param) { +function reset2() { vv.contents = 0; } -function incr2(param) { +function incr2() { v.contents = v.contents + 1 | 0; } function f(a, b, d, e) { - let h = Curry._1(a, b); - let u = Curry._1(d, h); - let v = Curry._1(e, h); + let h = a(b); + let u = d(h); + let v = e(h); return u + v | 0; } function kf(cb, v) { - Curry._1(cb, v); + cb(v); return v + v | 0; } diff --git a/jscomp/test/unboxed_crash.js b/jscomp/test/unboxed_crash.js index 96af2b0708..f556f3b58a 100644 --- a/jscomp/test/unboxed_crash.js +++ b/jscomp/test/unboxed_crash.js @@ -1,10 +1,9 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); function g(x) { - return Curry._1(x, x); + return x(x); } let loop = g(g); diff --git a/jscomp/test/unboxed_use_case.js b/jscomp/test/unboxed_use_case.js index 45124f4231..a4b2d91ae6 100644 --- a/jscomp/test/unboxed_use_case.js +++ b/jscomp/test/unboxed_use_case.js @@ -1,13 +1,12 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); function map_pair(r, param) { return [ - Curry._1(r, param[0]), - Curry._1(r, param[1]) + r(param[0]), + r(param[1]) ]; } diff --git a/jscomp/test/uncurried_cast.js b/jscomp/test/uncurried_cast.js index 0efea9a2bd..486ea7e6cc 100644 --- a/jscomp/test/uncurried_cast.js +++ b/jscomp/test/uncurried_cast.js @@ -10,7 +10,9 @@ function raise(e) { }); } -let map = Belt_List.mapU; +function map(l, f) { + return Belt_List.mapU(l, f); +} let List = { map: map @@ -23,7 +25,7 @@ let Uncurried = { let E = /* @__PURE__ */Caml_exceptions.create("Uncurried_cast.E"); -function testRaise(param) { +function testRaise() { throw new Error(E, { cause: { RE_EXN_ID: E @@ -69,7 +71,7 @@ let StandardNotation = { withOpts: withOpts }; -function testRaise$1(param) { +function testRaise$1() { throw new Error(E, { cause: { RE_EXN_ID: E diff --git a/jscomp/test/uncurried_default.args.js b/jscomp/test/uncurried_default.args.js index 815a210e66..21822c00fe 100644 --- a/jscomp/test/uncurried_default.args.js +++ b/jscomp/test/uncurried_default.args.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); function withOpt(xOpt, y) { let x = xOpt !== undefined ? xOpt : 1; @@ -55,24 +54,26 @@ let StandardNotation = { r3: r3 }; -function withOpt$1(xOpt, y, zOpt, w) { +function withOpt$1(xOpt, y) { let x = xOpt !== undefined ? xOpt : 1; - let z = zOpt !== undefined ? zOpt : 1; - return ((x + y | 0) + z | 0) + w | 0; + return function (zOpt, w) { + let z = zOpt !== undefined ? zOpt : 1; + return ((x + y | 0) + z | 0) + w | 0; + }; } -let testWithOpt$1 = withOpt$1(undefined, 3, undefined, 4); +let testWithOpt$1 = withOpt$1(undefined, 3)(undefined, 4); -let total$1 = withOpt$1(10, 3, 4, 11); +let total$1 = withOpt$1(10, 3)(4, 11); function foo1$1(xOpt, y) { let x = xOpt !== undefined ? xOpt : 3; return x + y | 0; } -function r1$1(param) { - return foo1$1(param, 11); -} +let x$1 = 3; + +let r1$1 = x$1 + 11 | 0; function foo2$1(y, xOpt, zOpt, param) { let x = xOpt !== undefined ? xOpt : 3; @@ -80,8 +81,8 @@ function foo2$1(y, xOpt, zOpt, param) { return (x + y | 0) + z | 0; } -function r2$1(param, param$1, param$2) { - return foo2$1(11, param, param$1, param$2); +function r2$1(extra, extra$1, extra$2) { + return foo2$1(11, extra, extra$1, extra$2); } function foo3$1(xOpt, yOpt, param) { @@ -91,7 +92,7 @@ function foo3$1(xOpt, yOpt, param) { } function foo(func) { - return Curry._1(func, undefined) + 1 | 0; + return func() + 1 | 0; } let M = { diff --git a/jscomp/test/uncurry_external_test.js b/jscomp/test/uncurry_external_test.js index 57141e2d66..85094358a6 100644 --- a/jscomp/test/uncurry_external_test.js +++ b/jscomp/test/uncurry_external_test.js @@ -16,7 +16,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/undef_regression2_test.js b/jscomp/test/undef_regression2_test.js index c534601ce0..0ecff1d352 100644 --- a/jscomp/test/undef_regression2_test.js +++ b/jscomp/test/undef_regression2_test.js @@ -17,7 +17,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -34,7 +34,7 @@ function ok(loc, x) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Ok", _0: x @@ -49,7 +49,7 @@ let match = typeof ___undefined_value === "undefined" ? undefined : ___undefined let a = match !== undefined ? 2 : 1; -function test(param) { +function test() { let match = typeof __DEV__ === "undefined" ? undefined : __DEV__; if (match !== undefined) { console.log("dev mode"); @@ -58,7 +58,7 @@ function test(param) { } } -function test2(param) { +function test2() { let f = typeof __filename === "undefined" ? undefined : __filename; if (f !== undefined) { console.log(f); @@ -67,7 +67,7 @@ function test2(param) { } } -function test3(param) { +function test3() { if (Caml_option.undefined_to_opt(typeof __DEV__ === "undefined" ? undefined : __DEV__) === undefined) { console.log("production mode"); return; diff --git a/jscomp/test/unit_undefined_test.js b/jscomp/test/unit_undefined_test.js index 72ca85f67d..255d5ff4c1 100644 --- a/jscomp/test/unit_undefined_test.js +++ b/jscomp/test/unit_undefined_test.js @@ -16,7 +16,7 @@ function eq(loc, x, y) { Mt.eq_suites(test_id, suites, loc, x, y); } -function f_01(param) { +function f_01() { return hi(function (x) { if (x === undefined) { console.log("x"); @@ -38,7 +38,7 @@ function u(x) { } } -function fx(param) { +function fx() { } diff --git a/jscomp/test/unsafe_ppx_test.js b/jscomp/test/unsafe_ppx_test.js index d36a9fe128..f7bb84b9f4 100644 --- a/jscomp/test/unsafe_ppx_test.js +++ b/jscomp/test/unsafe_ppx_test.js @@ -2,9 +2,8 @@ 'use strict'; let Mt = require("./mt.js"); -let Curry = require("../../lib/js/curry.js"); -let Pervasives = require("../../lib/js/pervasives.js"); let Ffi_js_test = require("./ffi_js_test.js"); +let PervasivesU = require("../../lib/js/pervasivesU.js"); let x = "\\x01\\x02\\x03"; @@ -24,8 +23,8 @@ function g(a) { return "" }); let regression2 = Math.max; - regression(a, Pervasives.failwith); - Curry._2(regression2, 3, 2); + regression(a, PervasivesU.failwith); + regression2(3, 2); regression3(3, 2); regression4(3, (function (x) { return x; @@ -55,7 +54,7 @@ let v = $$test(1, 2); Mt.from_pair_suites("Unsafe_ppx_test", { hd: [ "unsafe_max", - (function (param) { + (function () { return { TAG: "Eq", _0: 2, @@ -66,7 +65,7 @@ Mt.from_pair_suites("Unsafe_ppx_test", { tl: { hd: [ "unsafe_test", - (function (param) { + (function () { return { TAG: "Eq", _0: 3, @@ -77,7 +76,7 @@ Mt.from_pair_suites("Unsafe_ppx_test", { tl: { hd: [ "unsafe_max2", - (function (param) { + (function () { return { TAG: "Eq", _0: 2, @@ -88,7 +87,7 @@ Mt.from_pair_suites("Unsafe_ppx_test", { tl: { hd: [ "ffi_keys", - (function (param) { + (function () { return { TAG: "Eq", _0: ["a"], diff --git a/jscomp/test/update_record_test.js b/jscomp/test/update_record_test.js index c5959d818f..c81dfc91d6 100644 --- a/jscomp/test/update_record_test.js +++ b/jscomp/test/update_record_test.js @@ -21,7 +21,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, diff --git a/jscomp/test/variant.js b/jscomp/test/variant.js index 27a8b3a8d2..40c6abea1f 100644 --- a/jscomp/test/variant.js +++ b/jscomp/test/variant.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); @@ -116,7 +115,7 @@ let ED = /* @__PURE__ */Caml_exceptions.create("Variant.ED"); function fooExn(f) { try { - return Curry._1(f, undefined); + return f(); } catch (raw_n){ let n = Caml_js_exceptions.internalToOCamlException(raw_n); diff --git a/jscomp/test/webpack_config.js b/jscomp/test/webpack_config.js index 78d2b3ec79..132cb37835 100644 --- a/jscomp/test/webpack_config.js +++ b/jscomp/test/webpack_config.js @@ -37,7 +37,7 @@ let A = {}; let B = {}; -function f(param) { +function f() { return [ (function (prim) { List$3.ff(); diff --git a/lib/es6/arg.js b/lib/es6/arg.js index 929b1abbfd..81a83d525b 100644 --- a/lib/es6/arg.js +++ b/lib/es6/arg.js @@ -4,14 +4,13 @@ import * as Sys from "./sys.js"; import * as Caml from "./caml.js"; import * as List from "./list.js"; import * as $$Array from "./array.js"; -import * as Curry from "./curry.js"; import * as Buffer from "./buffer.js"; import * as $$String from "./string.js"; import * as Caml_obj from "./caml_obj.js"; import * as Caml_array from "./caml_array.js"; -import * as Pervasives from "./pervasives.js"; import * as Caml_format from "./caml_format.js"; import * as Caml_string from "./caml_string.js"; +import * as PervasivesU from "./pervasivesU.js"; import * as Caml_exceptions from "./caml_exceptions.js"; import * as Caml_js_exceptions from "./caml_js_exceptions.js"; @@ -59,7 +58,7 @@ function make_symlist(prefix, sep, suffix, l) { } } -function help_action(param) { +function help_action() { throw new Error(Stop, { cause: { RE_EXN_ID: Stop, @@ -122,7 +121,7 @@ function add_help(speclist) { }); } } - return Pervasives.$at(speclist, Pervasives.$at(add1, add2)); + return PervasivesU.$at(speclist, PervasivesU.$at(add1, add2)); } function usage_b(buf, speclist, errmsg) { @@ -158,7 +157,7 @@ let current = { function bool_of_string_opt(x) { try { - return Pervasives.bool_of_string(x); + return PervasivesU.bool_of_string(x); } catch (raw_exn){ let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); @@ -293,7 +292,7 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist } } let follow = match[1]; - let no_arg = function (param) { + let no_arg = function () { if (follow === undefined) { return; } @@ -309,7 +308,7 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist } }); }; - let get_arg = function (param) { + let get_arg = function () { if (follow !== undefined) { return follow; } @@ -326,7 +325,7 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist } }); }; - let consume_arg = function (param) { + let consume_arg = function () { if (follow !== undefined) { return; } else { @@ -337,12 +336,12 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist let treat_action = function (f) { switch (f.TAG) { case "Unit" : - return Curry._1(f._0, undefined); + return f._0(); case "Bool" : let arg = get_arg(); let s$1 = bool_of_string_opt(arg); if (s$1 !== undefined) { - Curry._1(f._0, s$1); + f._0(s$1); } else { throw new Error(Stop, { cause: { @@ -367,7 +366,7 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist return; case "String" : let arg$1 = get_arg(); - Curry._1(f._0, arg$1); + f._0(arg$1); return consume_arg(); case "Set_string" : f._0.contents = get_arg(); @@ -376,7 +375,7 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist let arg$2 = get_arg(); let x = int_of_string_opt(arg$2); if (x !== undefined) { - Curry._1(f._0, x); + f._0(x); } else { throw new Error(Stop, { cause: { @@ -414,7 +413,7 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist let arg$4 = get_arg(); let x$2 = float_of_string_opt(arg$4); if (x$2 !== undefined) { - Curry._1(f._0, x$2); + f._0(x$2); } else { throw new Error(Stop, { cause: { @@ -454,7 +453,7 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist let symb = f._0; let arg$6 = get_arg(); if (List.mem(arg$6, symb)) { - Curry._1(f._1, arg$6); + f._1(arg$6); return consume_arg(); } throw new Error(Stop, { @@ -471,7 +470,7 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist case "Rest" : let f$1 = f._0; while(current.contents < (argv.contents.length - 1 | 0)) { - Curry._1(f$1, Caml_array.get(argv.contents, current.contents + 1 | 0)); + f$1(Caml_array.get(argv.contents, current.contents + 1 | 0)); consume_arg(); }; return; @@ -485,7 +484,7 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist }); } let arg$7 = get_arg(); - let newarg = Curry._1(f._0, arg$7); + let newarg = f._0(arg$7); consume_arg(); let before = $$Array.sub(argv.contents, 0, current.contents + 1 | 0); let after = $$Array.sub(argv.contents, current.contents + 1 | 0, (argv.contents.length - current.contents | 0) - 1 | 0); @@ -505,7 +504,7 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist }; treat_action(match[0]); } else { - Curry._1(anonfun, s); + anonfun(s); } } catch (raw_m){ @@ -560,11 +559,11 @@ function parse(l, f, msg) { let msg$1 = Caml_js_exceptions.internalToOCamlException(raw_msg); if (msg$1.RE_EXN_ID === Bad) { console.log(msg$1._1); - return Pervasives.exit(2); + return PervasivesU.exit(2); } if (msg$1.RE_EXN_ID === Help) { console.log(msg$1._1); - return Pervasives.exit(0); + return PervasivesU.exit(0); } throw new Error(msg$1.RE_EXN_ID, { cause: msg$1 @@ -580,11 +579,11 @@ function parse_dynamic(l, f, msg) { let msg$1 = Caml_js_exceptions.internalToOCamlException(raw_msg); if (msg$1.RE_EXN_ID === Bad) { console.log(msg$1._1); - return Pervasives.exit(2); + return PervasivesU.exit(2); } if (msg$1.RE_EXN_ID === Help) { console.log(msg$1._1); - return Pervasives.exit(0); + return PervasivesU.exit(0); } throw new Error(msg$1.RE_EXN_ID, { cause: msg$1 @@ -609,11 +608,11 @@ function parse_expand(l, f, msg) { let msg$1 = Caml_js_exceptions.internalToOCamlException(raw_msg); if (msg$1.RE_EXN_ID === Bad) { console.log(msg$1._1); - return Pervasives.exit(2); + return PervasivesU.exit(2); } if (msg$1.RE_EXN_ID === Help) { console.log(msg$1._1); - return Pervasives.exit(0); + return PervasivesU.exit(0); } throw new Error(msg$1.RE_EXN_ID, { cause: msg$1 @@ -695,7 +694,7 @@ function replace_leading_tab(s) { } function align(limitOpt, speclist) { - let limit = limitOpt !== undefined ? limitOpt : Pervasives.max_int; + let limit = limitOpt !== undefined ? limitOpt : PervasivesU.max_int; let completed = add_help(speclist); let len = List.fold_left(max_arg_len, 0, completed); let len$1 = len < limit ? len : limit; diff --git a/lib/es6/array.js b/lib/es6/array.js index 9ca9bf4969..01edc6755a 100644 --- a/lib/es6/array.js +++ b/lib/es6/array.js @@ -1,6 +1,5 @@ -import * as Curry from "./curry.js"; import * as Caml_obj from "./caml_obj.js"; import * as Caml_array from "./caml_array.js"; import * as Caml_exceptions from "./caml_exceptions.js"; @@ -22,9 +21,9 @@ function init(l, f) { } }); } - let res = Caml_array.make(l, Curry._1(f, 0)); + let res = Caml_array.make(l, f(0)); for(let i = 1; i < l; ++i){ - res[i] = Curry._1(f, i); + res[i] = f(i); } return res; } @@ -58,15 +57,15 @@ function append(a1, a2) { } function sub(a, ofs, len) { - if (ofs < 0 || len < 0 || ofs > (a.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.sub" - } - }); + if (!(ofs < 0 || len < 0 || ofs > (a.length - len | 0))) { + return Caml_array.sub(a, ofs, len); } - return Caml_array.sub(a, ofs, len); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Array.sub" + } + }); } function fill(a, ofs, len, v) { @@ -84,20 +83,20 @@ function fill(a, ofs, len, v) { } function blit(a1, ofs1, a2, ofs2, len) { - if (len < 0 || ofs1 < 0 || ofs1 > (a1.length - len | 0) || ofs2 < 0 || ofs2 > (a2.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.blit" - } - }); + if (!(len < 0 || ofs1 < 0 || ofs1 > (a1.length - len | 0) || ofs2 < 0 || ofs2 > (a2.length - len | 0))) { + return Caml_array.blit(a1, ofs1, a2, ofs2, len); } - Caml_array.blit(a1, ofs1, a2, ofs2, len); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Array.blit" + } + }); } function iter(f, a) { for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ - Curry._1(f, a[i]); + f(a[i]); } } @@ -111,7 +110,7 @@ function iter2(f, a, b) { }); } for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ - Curry._2(f, a[i], b[i]); + f(a[i], b[i]); } } @@ -120,9 +119,9 @@ function map(f, a) { if (l === 0) { return []; } - let r = Caml_array.make(l, Curry._1(f, a[0])); + let r = Caml_array.make(l, f(a[0])); for(let i = 1; i < l; ++i){ - r[i] = Curry._1(f, a[i]); + r[i] = f(a[i]); } return r; } @@ -141,16 +140,16 @@ function map2(f, a, b) { if (la === 0) { return []; } - let r = Caml_array.make(la, Curry._2(f, a[0], b[0])); + let r = Caml_array.make(la, f(a[0], b[0])); for(let i = 1; i < la; ++i){ - r[i] = Curry._2(f, a[i], b[i]); + r[i] = f(a[i], b[i]); } return r; } function iteri(f, a) { for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ - Curry._2(f, i, a[i]); + f(i, a[i]); } } @@ -159,9 +158,9 @@ function mapi(f, a) { if (l === 0) { return []; } - let r = Caml_array.make(l, Curry._2(f, 0, a[0])); + let r = Caml_array.make(l, f(0, a[0])); for(let i = 1; i < l; ++i){ - r[i] = Curry._2(f, i, a[i]); + r[i] = f(i, a[i]); } return r; } @@ -220,7 +219,7 @@ function of_list(param) { function fold_left(f, x, a) { let r = x; for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ - r = Curry._2(f, r, a[i]); + r = f(r, a[i]); } return r; } @@ -228,7 +227,7 @@ function fold_left(f, x, a) { function fold_right(f, a, x) { let r = x; for(let i = a.length - 1 | 0; i >= 0; --i){ - r = Curry._2(f, a[i], r); + r = f(a[i], r); } return r; } @@ -241,7 +240,7 @@ function exists(p, a) { if (i === n) { return false; } - if (Curry._1(p, a[i])) { + if (p(a[i])) { return true; } _i = i + 1 | 0; @@ -257,7 +256,7 @@ function for_all(p, a) { if (i === n) { return true; } - if (!Curry._1(p, a[i])) { + if (!p(a[i])) { return false; } _i = i + 1 | 0; @@ -304,15 +303,15 @@ function sort(cmp, a) { let i31 = ((i + i | 0) + i | 0) + 1 | 0; let x = i31; if ((i31 + 2 | 0) < l) { - if (Curry._2(cmp, Caml_array.get(a, i31), Caml_array.get(a, i31 + 1 | 0)) < 0) { + if (cmp(Caml_array.get(a, i31), Caml_array.get(a, i31 + 1 | 0)) < 0) { x = i31 + 1 | 0; } - if (Curry._2(cmp, Caml_array.get(a, x), Caml_array.get(a, i31 + 2 | 0)) < 0) { + if (cmp(Caml_array.get(a, x), Caml_array.get(a, i31 + 2 | 0)) < 0) { x = i31 + 2 | 0; } return x; } - if ((i31 + 1 | 0) < l && Curry._2(cmp, Caml_array.get(a, i31), Caml_array.get(a, i31 + 1 | 0)) < 0) { + if ((i31 + 1 | 0) < l && cmp(Caml_array.get(a, i31), Caml_array.get(a, i31 + 1 | 0)) < 0) { return i31 + 1 | 0; } if (i31 < l) { @@ -331,7 +330,7 @@ function sort(cmp, a) { while(true) { let i$1 = _i; let j = maxson(l, i$1); - if (Curry._2(cmp, Caml_array.get(a, j), e) <= 0) { + if (cmp(Caml_array.get(a, j), e) <= 0) { return Caml_array.set(a, i$1, e); } Caml_array.set(a, i$1, Caml_array.get(a, j)); @@ -386,7 +385,7 @@ function sort(cmp, a) { } }); } - if (Curry._2(cmp, Caml_array.get(a, father), e) >= 0) { + if (cmp(Caml_array.get(a, father), e) >= 0) { return Caml_array.set(a, i, e); } Caml_array.set(a, i, Caml_array.get(a, father)); @@ -429,7 +428,7 @@ function stable_sort(cmp, a) { let i2 = _i2; let s1 = _s1; let i1 = _i1; - if (Curry._2(cmp, s1, s2) <= 0) { + if (cmp(s1, s2) <= 0) { Caml_array.set(dst, d, s1); let i1$1 = i1 + 1 | 0; if (i1$1 >= src1r) { @@ -455,7 +454,7 @@ function stable_sort(cmp, a) { for(let i = 0; i < len; ++i){ let e = Caml_array.get(a, srcofs + i | 0); let j = (dstofs + i | 0) - 1 | 0; - while(j >= dstofs && Curry._2(cmp, Caml_array.get(dst, j), e) > 0) { + while(j >= dstofs && cmp(Caml_array.get(dst, j), e) > 0) { Caml_array.set(dst, j + 1 | 0, Caml_array.get(dst, j)); j = j - 1 | 0; }; diff --git a/lib/es6/arrayLabels.js b/lib/es6/arrayLabels.js index c938c3b9b1..a0d1264e04 100644 --- a/lib/es6/arrayLabels.js +++ b/lib/es6/arrayLabels.js @@ -1,6 +1,5 @@ -import * as Curry from "./curry.js"; import * as Caml_obj from "./caml_obj.js"; import * as Caml_array from "./caml_array.js"; import * as Caml_exceptions from "./caml_exceptions.js"; @@ -22,9 +21,9 @@ function init(l, f) { } }); } - let res = Caml_array.make(l, Curry._1(f, 0)); + let res = Caml_array.make(l, f(0)); for(let i = 1; i < l; ++i){ - res[i] = Curry._1(f, i); + res[i] = f(i); } return res; } @@ -58,15 +57,15 @@ function append(a1, a2) { } function sub(a, ofs, len) { - if (ofs < 0 || len < 0 || ofs > (a.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.sub" - } - }); + if (!(ofs < 0 || len < 0 || ofs > (a.length - len | 0))) { + return Caml_array.sub(a, ofs, len); } - return Caml_array.sub(a, ofs, len); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Array.sub" + } + }); } function fill(a, ofs, len, v) { @@ -84,20 +83,20 @@ function fill(a, ofs, len, v) { } function blit(a1, ofs1, a2, ofs2, len) { - if (len < 0 || ofs1 < 0 || ofs1 > (a1.length - len | 0) || ofs2 < 0 || ofs2 > (a2.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.blit" - } - }); + if (!(len < 0 || ofs1 < 0 || ofs1 > (a1.length - len | 0) || ofs2 < 0 || ofs2 > (a2.length - len | 0))) { + return Caml_array.blit(a1, ofs1, a2, ofs2, len); } - Caml_array.blit(a1, ofs1, a2, ofs2, len); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Array.blit" + } + }); } function iter(f, a) { for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ - Curry._1(f, a[i]); + f(a[i]); } } @@ -111,7 +110,7 @@ function iter2(f, a, b) { }); } for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ - Curry._2(f, a[i], b[i]); + f(a[i], b[i]); } } @@ -120,9 +119,9 @@ function map(f, a) { if (l === 0) { return []; } - let r = Caml_array.make(l, Curry._1(f, a[0])); + let r = Caml_array.make(l, f(a[0])); for(let i = 1; i < l; ++i){ - r[i] = Curry._1(f, a[i]); + r[i] = f(a[i]); } return r; } @@ -141,16 +140,16 @@ function map2(f, a, b) { if (la === 0) { return []; } - let r = Caml_array.make(la, Curry._2(f, a[0], b[0])); + let r = Caml_array.make(la, f(a[0], b[0])); for(let i = 1; i < la; ++i){ - r[i] = Curry._2(f, a[i], b[i]); + r[i] = f(a[i], b[i]); } return r; } function iteri(f, a) { for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ - Curry._2(f, i, a[i]); + f(i, a[i]); } } @@ -159,9 +158,9 @@ function mapi(f, a) { if (l === 0) { return []; } - let r = Caml_array.make(l, Curry._2(f, 0, a[0])); + let r = Caml_array.make(l, f(0, a[0])); for(let i = 1; i < l; ++i){ - r[i] = Curry._2(f, i, a[i]); + r[i] = f(i, a[i]); } return r; } @@ -220,7 +219,7 @@ function of_list(param) { function fold_left(f, x, a) { let r = x; for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ - r = Curry._2(f, r, a[i]); + r = f(r, a[i]); } return r; } @@ -228,7 +227,7 @@ function fold_left(f, x, a) { function fold_right(f, a, x) { let r = x; for(let i = a.length - 1 | 0; i >= 0; --i){ - r = Curry._2(f, a[i], r); + r = f(a[i], r); } return r; } @@ -241,7 +240,7 @@ function exists(p, a) { if (i === n) { return false; } - if (Curry._1(p, a[i])) { + if (p(a[i])) { return true; } _i = i + 1 | 0; @@ -257,7 +256,7 @@ function for_all(p, a) { if (i === n) { return true; } - if (!Curry._1(p, a[i])) { + if (!p(a[i])) { return false; } _i = i + 1 | 0; @@ -304,15 +303,15 @@ function sort(cmp, a) { let i31 = ((i + i | 0) + i | 0) + 1 | 0; let x = i31; if ((i31 + 2 | 0) < l) { - if (Curry._2(cmp, Caml_array.get(a, i31), Caml_array.get(a, i31 + 1 | 0)) < 0) { + if (cmp(Caml_array.get(a, i31), Caml_array.get(a, i31 + 1 | 0)) < 0) { x = i31 + 1 | 0; } - if (Curry._2(cmp, Caml_array.get(a, x), Caml_array.get(a, i31 + 2 | 0)) < 0) { + if (cmp(Caml_array.get(a, x), Caml_array.get(a, i31 + 2 | 0)) < 0) { x = i31 + 2 | 0; } return x; } - if ((i31 + 1 | 0) < l && Curry._2(cmp, Caml_array.get(a, i31), Caml_array.get(a, i31 + 1 | 0)) < 0) { + if ((i31 + 1 | 0) < l && cmp(Caml_array.get(a, i31), Caml_array.get(a, i31 + 1 | 0)) < 0) { return i31 + 1 | 0; } if (i31 < l) { @@ -331,7 +330,7 @@ function sort(cmp, a) { while(true) { let i$1 = _i; let j = maxson(l, i$1); - if (Curry._2(cmp, Caml_array.get(a, j), e) <= 0) { + if (cmp(Caml_array.get(a, j), e) <= 0) { return Caml_array.set(a, i$1, e); } Caml_array.set(a, i$1, Caml_array.get(a, j)); @@ -386,7 +385,7 @@ function sort(cmp, a) { } }); } - if (Curry._2(cmp, Caml_array.get(a, father), e) >= 0) { + if (cmp(Caml_array.get(a, father), e) >= 0) { return Caml_array.set(a, i, e); } Caml_array.set(a, i, Caml_array.get(a, father)); @@ -429,7 +428,7 @@ function stable_sort(cmp, a) { let i2 = _i2; let s1 = _s1; let i1 = _i1; - if (Curry._2(cmp, s1, s2) <= 0) { + if (cmp(s1, s2) <= 0) { Caml_array.set(dst, d, s1); let i1$1 = i1 + 1 | 0; if (i1$1 >= src1r) { @@ -455,7 +454,7 @@ function stable_sort(cmp, a) { for(let i = 0; i < len; ++i){ let e = Caml_array.get(a, srcofs + i | 0); let j = (dstofs + i | 0) - 1 | 0; - while(j >= dstofs && Curry._2(cmp, Caml_array.get(dst, j), e) > 0) { + while(j >= dstofs && cmp(Caml_array.get(dst, j), e) > 0) { Caml_array.set(dst, j + 1 | 0, Caml_array.get(dst, j)); j = j - 1 | 0; }; diff --git a/lib/es6/belt_Array.js b/lib/es6/belt_Array.js index 7f5f88b640..8a0069be35 100644 --- a/lib/es6/belt_Array.js +++ b/lib/es6/belt_Array.js @@ -1,7 +1,6 @@ import * as Caml from "./caml.js"; -import * as Curry from "./curry.js"; import * as Caml_option from "./caml_option.js"; function get(arr, i) { @@ -114,7 +113,9 @@ function makeByU(l, f) { } function makeBy(l, f) { - return makeByU(l, Curry.__1(f)); + return makeByU(l, (function (a) { + return f(a); + })); } function makeByAndShuffleU(l, f) { @@ -124,7 +125,9 @@ function makeByAndShuffleU(l, f) { } function makeByAndShuffle(l, f) { - return makeByAndShuffleU(l, Curry.__1(f)); + return makeByAndShuffleU(l, (function (a) { + return f(a); + })); } function range(start, finish) { @@ -180,7 +183,9 @@ function zipByU(xs, ys, f) { } function zipBy(xs, ys, f) { - return zipByU(xs, ys, Curry.__2(f)); + return zipByU(xs, ys, (function (a, b) { + return f(a, b); + })); } function concat(a1, a2) { @@ -295,7 +300,9 @@ function forEachU(a, f) { } function forEach(a, f) { - forEachU(a, Curry.__1(f)); + forEachU(a, (function (a) { + f(a); + })); } function mapU(a, f) { @@ -308,7 +315,9 @@ function mapU(a, f) { } function map(a, f) { - return mapU(a, Curry.__1(f)); + return mapU(a, (function (a) { + return f(a); + })); } function flatMapU(a, f) { @@ -316,7 +325,9 @@ function flatMapU(a, f) { } function flatMap(a, f) { - return concatMany(mapU(a, Curry.__1(f))); + return flatMapU(a, (function (a) { + return f(a); + })); } function getByU(a, p) { @@ -334,7 +345,9 @@ function getByU(a, p) { } function getBy(a, p) { - return getByU(a, Curry.__1(p)); + return getByU(a, (function (a) { + return p(a); + })); } function getIndexByU(a, p) { @@ -352,7 +365,9 @@ function getIndexByU(a, p) { } function getIndexBy(a, p) { - return getIndexByU(a, Curry.__1(p)); + return getIndexByU(a, (function (a) { + return p(a); + })); } function keepU(a, f) { @@ -372,7 +387,9 @@ function keepU(a, f) { } function keep(a, f) { - return keepU(a, Curry.__1(f)); + return keepU(a, (function (a) { + return f(a); + })); } function keepWithIndexU(a, f) { @@ -392,7 +409,9 @@ function keepWithIndexU(a, f) { } function keepWithIndex(a, f) { - return keepWithIndexU(a, Curry.__2(f)); + return keepWithIndexU(a, (function (a, i) { + return f(a, i); + })); } function keepMapU(a, f) { @@ -413,7 +432,9 @@ function keepMapU(a, f) { } function keepMap(a, f) { - return keepMapU(a, Curry.__1(f)); + return keepMapU(a, (function (a) { + return f(a); + })); } function forEachWithIndexU(a, f) { @@ -423,7 +444,9 @@ function forEachWithIndexU(a, f) { } function forEachWithIndex(a, f) { - forEachWithIndexU(a, Curry.__2(f)); + forEachWithIndexU(a, (function (a, b) { + f(a, b); + })); } function mapWithIndexU(a, f) { @@ -436,7 +459,9 @@ function mapWithIndexU(a, f) { } function mapWithIndex(a, f) { - return mapWithIndexU(a, Curry.__2(f)); + return mapWithIndexU(a, (function (a, b) { + return f(a, b); + })); } function reduceU(a, x, f) { @@ -448,7 +473,9 @@ function reduceU(a, x, f) { } function reduce(a, x, f) { - return reduceU(a, x, Curry.__2(f)); + return reduceU(a, x, (function (a, b) { + return f(a, b); + })); } function reduceReverseU(a, x, f) { @@ -460,7 +487,9 @@ function reduceReverseU(a, x, f) { } function reduceReverse(a, x, f) { - return reduceReverseU(a, x, Curry.__2(f)); + return reduceReverseU(a, x, (function (a, b) { + return f(a, b); + })); } function reduceReverse2U(a, b, x, f) { @@ -473,7 +502,9 @@ function reduceReverse2U(a, b, x, f) { } function reduceReverse2(a, b, x, f) { - return reduceReverse2U(a, b, x, Curry.__3(f)); + return reduceReverse2U(a, b, x, (function (a, b, c) { + return f(a, b, c); + })); } function reduceWithIndexU(a, x, f) { @@ -485,7 +516,9 @@ function reduceWithIndexU(a, x, f) { } function reduceWithIndex(a, x, f) { - return reduceWithIndexU(a, x, Curry.__3(f)); + return reduceWithIndexU(a, x, (function (a, b, c) { + return f(a, b, c); + })); } function everyU(arr, b) { @@ -505,7 +538,9 @@ function everyU(arr, b) { } function every(arr, f) { - return everyU(arr, Curry.__1(f)); + return everyU(arr, (function (b) { + return f(b); + })); } function someU(arr, b) { @@ -525,7 +560,9 @@ function someU(arr, b) { } function some(arr, f) { - return someU(arr, Curry.__1(f)); + return someU(arr, (function (b) { + return f(b); + })); } function everyAux2(arr1, arr2, _i, b, len) { @@ -547,7 +584,9 @@ function every2U(a, b, p) { } function every2(a, b, p) { - return every2U(a, b, Curry.__2(p)); + return every2U(a, b, (function (a, b) { + return p(a, b); + })); } function some2U(a, b, p) { @@ -567,7 +606,9 @@ function some2U(a, b, p) { } function some2(a, b, p) { - return some2U(a, b, Curry.__2(p)); + return some2U(a, b, (function (a, b) { + return p(a, b); + })); } function eqU(a, b, p) { @@ -581,7 +622,9 @@ function eqU(a, b, p) { } function eq(a, b, p) { - return eqU(a, b, Curry.__2(p)); + return eqU(a, b, (function (a, b) { + return p(a, b); + })); } function cmpU(a, b, p) { @@ -609,7 +652,9 @@ function cmpU(a, b, p) { } function cmp(a, b, p) { - return cmpU(a, b, Curry.__2(p)); + return cmpU(a, b, (function (a, b) { + return p(a, b); + })); } function partitionU(a, f) { @@ -637,7 +682,9 @@ function partitionU(a, f) { } function partition(a, f) { - return partitionU(a, Curry.__1(f)); + return partitionU(a, (function (x) { + return f(x); + })); } function unzip(a) { @@ -676,7 +723,9 @@ function joinWithU(a, sep, toString) { } function joinWith(a, sep, toString) { - return joinWithU(a, sep, Curry.__1(toString)); + return joinWithU(a, sep, (function (x) { + return toString(x); + })); } function initU(n, f) { @@ -688,7 +737,9 @@ function initU(n, f) { } function init(n, f) { - return initU(n, Curry.__1(f)); + return initU(n, (function (i) { + return f(i); + })); } export { diff --git a/lib/es6/belt_HashMapInt.js b/lib/es6/belt_HashMapInt.js index 2d1d6c8537..905f88bcd7 100644 --- a/lib/es6/belt_HashMapInt.js +++ b/lib/es6/belt_HashMapInt.js @@ -193,7 +193,7 @@ function size(h) { function fromArray(arr) { let len = arr.length; - let v = Belt_internalBucketsType.make(undefined, undefined, len); + let v = make(len); for(let i = 0; i < len; ++i){ let match = arr[i]; set(v, match[0], match[1]); diff --git a/lib/es6/belt_HashMapString.js b/lib/es6/belt_HashMapString.js index c4352164cb..041b2e8ace 100644 --- a/lib/es6/belt_HashMapString.js +++ b/lib/es6/belt_HashMapString.js @@ -193,7 +193,7 @@ function size(h) { function fromArray(arr) { let len = arr.length; - let v = Belt_internalBucketsType.make(undefined, undefined, len); + let v = make(len); for(let i = 0; i < len; ++i){ let match = arr[i]; set(v, match[0], match[1]); diff --git a/lib/es6/belt_Id.js b/lib/es6/belt_Id.js index ff1ebbb299..562e578fb4 100644 --- a/lib/es6/belt_Id.js +++ b/lib/es6/belt_Id.js @@ -1,6 +1,5 @@ -import * as Curry from "./curry.js"; function MakeComparableU(M) { return M; @@ -8,7 +7,9 @@ function MakeComparableU(M) { function MakeComparable(M) { let cmp = M.cmp; - let cmp$1 = Curry.__2(cmp); + let cmp$1 = function (a, b) { + return cmp(a, b); + }; return { cmp: cmp$1 }; @@ -21,7 +22,9 @@ function comparableU(cmp) { } function comparable(cmp) { - let cmp$1 = Curry.__2(cmp); + let cmp$1 = function (a, b) { + return cmp(a, b); + }; return { cmp: cmp$1 }; @@ -33,9 +36,13 @@ function MakeHashableU(M) { function MakeHashable(M) { let hash = M.hash; - let hash$1 = Curry.__1(hash); + let hash$1 = function (a) { + return hash(a); + }; let eq = M.eq; - let eq$1 = Curry.__2(eq); + let eq$1 = function (a, b) { + return eq(a, b); + }; return { hash: hash$1, eq: eq$1 @@ -50,8 +57,12 @@ function hashableU(hash, eq) { } function hashable(hash, eq) { - let hash$1 = Curry.__1(hash); - let eq$1 = Curry.__2(eq); + let hash$1 = function (a) { + return hash(a); + }; + let eq$1 = function (a, b) { + return eq(a, b); + }; return { hash: hash$1, eq: eq$1 diff --git a/lib/es6/belt_List.js b/lib/es6/belt_List.js index c65babf3e6..e55399c63a 100644 --- a/lib/es6/belt_List.js +++ b/lib/es6/belt_List.js @@ -1,6 +1,5 @@ -import * as Curry from "./curry.js"; import * as Belt_Array from "./belt_Array.js"; import * as Caml_option from "./caml_option.js"; import * as Belt_SortArray from "./belt_SortArray.js"; @@ -527,7 +526,9 @@ function mapU(xs, f) { } function map(xs, f) { - return mapU(xs, Curry.__1(f)); + return mapU(xs, (function (x) { + return f(x); + })); } function zipByU(l1, l2, f) { @@ -546,7 +547,9 @@ function zipByU(l1, l2, f) { } function zipBy(l1, l2, f) { - return zipByU(l1, l2, Curry.__2(f)); + return zipByU(l1, l2, (function (x, y) { + return f(x, y); + })); } function mapWithIndexU(xs, f) { @@ -562,7 +565,9 @@ function mapWithIndexU(xs, f) { } function mapWithIndex(xs, f) { - return mapWithIndexU(xs, Curry.__2(f)); + return mapWithIndexU(xs, (function (i, x) { + return f(i, x); + })); } function makeByU(n, f) { @@ -588,7 +593,9 @@ function makeByU(n, f) { } function makeBy(n, f) { - return makeByU(n, Curry.__1(f)); + return makeByU(n, (function (x) { + return f(x); + })); } function make(n, v) { @@ -762,7 +769,9 @@ function mapReverseU(l, f) { } function mapReverse(l, f) { - return mapReverseU(l, Curry.__1(f)); + return mapReverseU(l, (function (x) { + return f(x); + })); } function forEachU(_xs, f) { @@ -778,7 +787,9 @@ function forEachU(_xs, f) { } function forEach(xs, f) { - forEachU(xs, Curry.__1(f)); + forEachU(xs, (function (x) { + return f(x); + })); } function forEachWithIndexU(l, f) { @@ -798,7 +809,9 @@ function forEachWithIndexU(l, f) { } function forEachWithIndex(l, f) { - forEachWithIndexU(l, Curry.__2(f)); + forEachWithIndexU(l, (function (i, x) { + return f(i, x); + })); } function reduceU(_l, _accu, f) { @@ -815,7 +828,9 @@ function reduceU(_l, _accu, f) { } function reduce(l, accu, f) { - return reduceU(l, accu, Curry.__2(f)); + return reduceU(l, accu, (function (acc, x) { + return f(acc, x); + })); } function reduceReverseUnsafeU(l, accu, f) { @@ -836,7 +851,9 @@ function reduceReverseU(l, acc, f) { } function reduceReverse(l, accu, f) { - return reduceReverseU(l, accu, Curry.__2(f)); + return reduceReverseU(l, accu, (function (a, b) { + return f(a, b); + })); } function reduceWithIndexU(l, acc, f) { @@ -858,7 +875,9 @@ function reduceWithIndexU(l, acc, f) { } function reduceWithIndex(l, acc, f) { - return reduceWithIndexU(l, acc, Curry.__3(f)); + return reduceWithIndexU(l, acc, (function (acc, x, i) { + return f(acc, x, i); + })); } function mapReverse2U(l1, l2, f) { @@ -886,7 +905,9 @@ function mapReverse2U(l1, l2, f) { } function mapReverse2(l1, l2, f) { - return mapReverse2U(l1, l2, Curry.__2(f)); + return mapReverse2U(l1, l2, (function (a, b) { + return f(a, b); + })); } function forEach2U(_l1, _l2, f) { @@ -907,7 +928,9 @@ function forEach2U(_l1, _l2, f) { } function forEach2(l1, l2, f) { - forEach2U(l1, l2, Curry.__2(f)); + forEach2U(l1, l2, (function (a, b) { + return f(a, b); + })); } function reduce2U(_l1, _l2, _accu, f) { @@ -929,7 +952,9 @@ function reduce2U(_l1, _l2, _accu, f) { } function reduce2(l1, l2, acc, f) { - return reduce2U(l1, l2, acc, Curry.__3(f)); + return reduce2U(l1, l2, acc, (function (a, b, c) { + return f(a, b, c); + })); } function reduceReverse2UnsafeU(l1, l2, accu, f) { @@ -950,7 +975,9 @@ function reduceReverse2U(l1, l2, acc, f) { } function reduceReverse2(l1, l2, acc, f) { - return reduceReverse2U(l1, l2, acc, Curry.__3(f)); + return reduceReverse2U(l1, l2, acc, (function (a, b, c) { + return f(a, b, c); + })); } function everyU(_xs, p) { @@ -968,7 +995,9 @@ function everyU(_xs, p) { } function every(xs, p) { - return everyU(xs, Curry.__1(p)); + return everyU(xs, (function (x) { + return p(x); + })); } function someU(_xs, p) { @@ -986,7 +1015,9 @@ function someU(_xs, p) { } function some(xs, p) { - return someU(xs, Curry.__1(p)); + return someU(xs, (function (x) { + return p(x); + })); } function every2U(_l1, _l2, p) { @@ -1009,7 +1040,9 @@ function every2U(_l1, _l2, p) { } function every2(l1, l2, p) { - return every2U(l1, l2, Curry.__2(p)); + return every2U(l1, l2, (function (a, b) { + return p(a, b); + })); } function cmpByLength(_l1, _l2) { @@ -1057,7 +1090,9 @@ function cmpU(_l1, _l2, p) { } function cmp(l1, l2, f) { - return cmpU(l1, l2, Curry.__2(f)); + return cmpU(l1, l2, (function (x, y) { + return f(x, y); + })); } function eqU(_l1, _l2, p) { @@ -1084,7 +1119,9 @@ function eqU(_l1, _l2, p) { } function eq(l1, l2, f) { - return eqU(l1, l2, Curry.__2(f)); + return eqU(l1, l2, (function (x, y) { + return f(x, y); + })); } function some2U(_l1, _l2, p) { @@ -1107,7 +1144,9 @@ function some2U(_l1, _l2, p) { } function some2(l1, l2, p) { - return some2U(l1, l2, Curry.__2(p)); + return some2U(l1, l2, (function (a, b) { + return p(a, b); + })); } function hasU(_xs, x, eq) { @@ -1125,7 +1164,9 @@ function hasU(_xs, x, eq) { } function has(xs, x, eq) { - return hasU(xs, x, Curry.__2(eq)); + return hasU(xs, x, (function (a, b) { + return eq(a, b); + })); } function getAssocU(_xs, x, eq) { @@ -1144,7 +1185,9 @@ function getAssocU(_xs, x, eq) { } function getAssoc(xs, x, eq) { - return getAssocU(xs, x, Curry.__2(eq)); + return getAssocU(xs, x, (function (a, b) { + return eq(a, b); + })); } function hasAssocU(_xs, x, eq) { @@ -1162,7 +1205,9 @@ function hasAssocU(_xs, x, eq) { } function hasAssoc(xs, x, eq) { - return hasAssocU(xs, x, Curry.__2(eq)); + return hasAssocU(xs, x, (function (a, b) { + return eq(a, b); + })); } function removeAssocU(xs, x, eq) { @@ -1187,7 +1232,9 @@ function removeAssocU(xs, x, eq) { } function removeAssoc(xs, x, eq) { - return removeAssocU(xs, x, Curry.__2(eq)); + return removeAssocU(xs, x, (function (a, b) { + return eq(a, b); + })); } function setAssocU(xs, x, k, eq) { @@ -1230,7 +1277,9 @@ function setAssocU(xs, x, k, eq) { } function setAssoc(xs, x, k, eq) { - return setAssocU(xs, x, k, Curry.__2(eq)); + return setAssocU(xs, x, k, (function (a, b) { + return eq(a, b); + })); } function sortU(xs, cmp) { @@ -1240,7 +1289,9 @@ function sortU(xs, cmp) { } function sort(xs, cmp) { - return sortU(xs, Curry.__2(cmp)); + return sortU(xs, (function (x, y) { + return cmp(x, y); + })); } function getByU(_xs, p) { @@ -1259,7 +1310,9 @@ function getByU(_xs, p) { } function getBy(xs, p) { - return getByU(xs, Curry.__1(p)); + return getByU(xs, (function (a) { + return p(a); + })); } function keepU(_xs, p) { @@ -1284,7 +1337,9 @@ function keepU(_xs, p) { } function keep(xs, p) { - return keepU(xs, Curry.__1(p)); + return keepU(xs, (function (x) { + return p(x); + })); } function keepWithIndexU(xs, p) { @@ -1313,7 +1368,9 @@ function keepWithIndexU(xs, p) { } function keepWithIndex(xs, p) { - return keepWithIndexU(xs, Curry.__2(p)); + return keepWithIndexU(xs, (function (x, i) { + return p(x, i); + })); } function keepMapU(_xs, p) { @@ -1338,7 +1395,9 @@ function keepMapU(_xs, p) { } function keepMap(xs, p) { - return keepMapU(xs, Curry.__1(p)); + return keepMapU(xs, (function (x) { + return p(x); + })); } function partitionU(l, p) { @@ -1373,7 +1432,9 @@ function partitionU(l, p) { } function partition(l, p) { - return partitionU(l, Curry.__1(p)); + return partitionU(l, (function (x) { + return p(x); + })); } function unzip(xs) { diff --git a/lib/es6/belt_Map.js b/lib/es6/belt_Map.js index 8234a5b949..9c811ba7fe 100644 --- a/lib/es6/belt_Map.js +++ b/lib/es6/belt_Map.js @@ -1,6 +1,5 @@ -import * as Curry from "./curry.js"; import * as Belt_MapDict from "./belt_MapDict.js"; function fromArray(data, id) { @@ -59,7 +58,9 @@ function updateU(m, key, f) { } function update(m, key, f) { - return updateU(m, key, Curry.__1(f)); + return updateU(m, key, (function (a) { + return f(a); + })); } function split(m, x) { @@ -90,7 +91,9 @@ function mergeU(s1, s2, f) { } function merge(s1, s2, f) { - return mergeU(s1, s2, Curry.__3(f)); + return mergeU(s1, s2, (function (a, b, c) { + return f(a, b, c); + })); } function make(id) { @@ -109,7 +112,9 @@ function findFirstByU(m, f) { } function findFirstBy(m, f) { - return Belt_MapDict.findFirstByU(m.data, Curry.__2(f)); + return findFirstByU(m, (function (a, b) { + return f(a, b); + })); } function forEachU(m, f) { @@ -117,7 +122,9 @@ function forEachU(m, f) { } function forEach(m, f) { - Belt_MapDict.forEachU(m.data, Curry.__2(f)); + forEachU(m, (function (a, b) { + f(a, b); + })); } function reduceU(m, acc, f) { @@ -125,7 +132,9 @@ function reduceU(m, acc, f) { } function reduce(m, acc, f) { - return reduceU(m, acc, Curry.__3(f)); + return reduceU(m, acc, (function (a, b, c) { + return f(a, b, c); + })); } function everyU(m, f) { @@ -133,7 +142,9 @@ function everyU(m, f) { } function every(m, f) { - return Belt_MapDict.everyU(m.data, Curry.__2(f)); + return everyU(m, (function (a, b) { + return f(a, b); + })); } function someU(m, f) { @@ -141,7 +152,9 @@ function someU(m, f) { } function some(m, f) { - return Belt_MapDict.someU(m.data, Curry.__2(f)); + return someU(m, (function (a, b) { + return f(a, b); + })); } function keepU(m, f) { @@ -152,7 +165,9 @@ function keepU(m, f) { } function keep(m, f) { - return keepU(m, Curry.__2(f)); + return keepU(m, (function (a, b) { + return f(a, b); + })); } function partitionU(m, p) { @@ -171,7 +186,9 @@ function partitionU(m, p) { } function partition(m, p) { - return partitionU(m, Curry.__2(p)); + return partitionU(m, (function (a, b) { + return p(a, b); + })); } function mapU(m, f) { @@ -182,7 +199,9 @@ function mapU(m, f) { } function map(m, f) { - return mapU(m, Curry.__1(f)); + return mapU(m, (function (a) { + return f(a); + })); } function mapWithKeyU(m, f) { @@ -193,7 +212,9 @@ function mapWithKeyU(m, f) { } function mapWithKey(m, f) { - return mapWithKeyU(m, Curry.__2(f)); + return mapWithKeyU(m, (function (a, b) { + return f(a, b); + })); } function size(map) { @@ -277,7 +298,9 @@ function eqU(m1, m2, veq) { } function eq(m1, m2, veq) { - return eqU(m1, m2, Curry.__2(veq)); + return eqU(m1, m2, (function (a, b) { + return veq(a, b); + })); } function cmpU(m1, m2, vcmp) { @@ -285,7 +308,9 @@ function cmpU(m1, m2, vcmp) { } function cmp(m1, m2, vcmp) { - return cmpU(m1, m2, Curry.__2(vcmp)); + return cmpU(m1, m2, (function (a, b) { + return vcmp(a, b); + })); } function getData(m) { diff --git a/lib/es6/belt_MapDict.js b/lib/es6/belt_MapDict.js index c2fa88f3c7..ad544897de 100644 --- a/lib/es6/belt_MapDict.js +++ b/lib/es6/belt_MapDict.js @@ -1,6 +1,5 @@ -import * as Curry from "./curry.js"; import * as Caml_option from "./caml_option.js"; import * as Belt_internalAVLtree from "./belt_internalAVLtree.js"; @@ -76,7 +75,9 @@ function updateU(t, newK, f, cmp) { } function update(t, newK, f, cmp) { - return updateU(t, newK, Curry.__1(f), cmp); + return updateU(t, newK, (function (a) { + return f(a); + }), cmp); } function removeAux0(n, x, cmp) { @@ -244,7 +245,9 @@ function mergeU(s1, s2, f, cmp) { } function merge(s1, s2, f, cmp) { - return mergeU(s1, s2, Curry.__3(f), cmp); + return mergeU(s1, s2, (function (a, b, c) { + return f(a, b, c); + }), cmp); } function removeMany(t, keys, cmp) { diff --git a/lib/es6/belt_MapInt.js b/lib/es6/belt_MapInt.js index 69c1a3dbc5..ced1b1814e 100644 --- a/lib/es6/belt_MapInt.js +++ b/lib/es6/belt_MapInt.js @@ -1,6 +1,5 @@ -import * as Curry from "./curry.js"; import * as Caml_option from "./caml_option.js"; import * as Belt_internalMapInt from "./belt_internalMapInt.js"; import * as Belt_internalAVLtree from "./belt_internalAVLtree.js"; @@ -73,7 +72,9 @@ function updateU(t, x, f) { } function update(t, x, f) { - return updateU(t, x, Curry.__1(f)); + return updateU(t, x, (function (a) { + return f(a); + })); } function removeAux(n, x) { diff --git a/lib/es6/belt_MapString.js b/lib/es6/belt_MapString.js index d2201ef572..0880dca3cd 100644 --- a/lib/es6/belt_MapString.js +++ b/lib/es6/belt_MapString.js @@ -1,6 +1,5 @@ -import * as Curry from "./curry.js"; import * as Caml_option from "./caml_option.js"; import * as Belt_internalAVLtree from "./belt_internalAVLtree.js"; import * as Belt_internalMapString from "./belt_internalMapString.js"; @@ -73,7 +72,9 @@ function updateU(t, x, f) { } function update(t, x, f) { - return updateU(t, x, Curry.__1(f)); + return updateU(t, x, (function (a) { + return f(a); + })); } function removeAux(n, x) { diff --git a/lib/es6/belt_MutableMap.js b/lib/es6/belt_MutableMap.js index 1c88e14fc3..df575d99d5 100644 --- a/lib/es6/belt_MutableMap.js +++ b/lib/es6/belt_MutableMap.js @@ -1,6 +1,5 @@ -import * as Curry from "./curry.js"; import * as Caml_option from "./caml_option.js"; import * as Belt_internalAVLtree from "./belt_internalAVLtree.js"; @@ -137,7 +136,9 @@ function updateU(t, x, f) { } function update(t, x, f) { - updateU(t, x, Curry.__1(f)); + updateU(t, x, (function (a) { + return f(a); + })); } function make(id) { @@ -152,8 +153,7 @@ function clear(m) { } function isEmpty(d) { - let x = d.data; - return x === undefined; + return d.data === undefined; } function minKey(m) { @@ -193,7 +193,9 @@ function forEachU(d, f) { } function forEach(d, f) { - Belt_internalAVLtree.forEachU(d.data, Curry.__2(f)); + forEachU(d, (function (a, b) { + f(a, b); + })); } function reduceU(d, acc, cb) { @@ -201,7 +203,9 @@ function reduceU(d, acc, cb) { } function reduce(d, acc, cb) { - return reduceU(d, acc, Curry.__3(cb)); + return reduceU(d, acc, (function (a, b, c) { + return cb(a, b, c); + })); } function everyU(d, p) { @@ -209,7 +213,9 @@ function everyU(d, p) { } function every(d, p) { - return Belt_internalAVLtree.everyU(d.data, Curry.__2(p)); + return everyU(d, (function (a, b) { + return p(a, b); + })); } function someU(d, p) { @@ -217,7 +223,9 @@ function someU(d, p) { } function some(d, p) { - return Belt_internalAVLtree.someU(d.data, Curry.__2(p)); + return someU(d, (function (a, b) { + return p(a, b); + })); } function size(d) { @@ -249,7 +257,9 @@ function cmpU(m1, m2, cmp) { } function cmp(m1, m2, cmp$1) { - return cmpU(m1, m2, Curry.__2(cmp$1)); + return cmpU(m1, m2, (function (a, b) { + return cmp$1(a, b); + })); } function eqU(m1, m2, cmp) { @@ -257,7 +267,9 @@ function eqU(m1, m2, cmp) { } function eq(m1, m2, cmp) { - return eqU(m1, m2, Curry.__2(cmp)); + return eqU(m1, m2, (function (a, b) { + return cmp(a, b); + })); } function mapU(m, f) { @@ -268,7 +280,9 @@ function mapU(m, f) { } function map(m, f) { - return mapU(m, Curry.__1(f)); + return mapU(m, (function (a) { + return f(a); + })); } function mapWithKeyU(m, f) { @@ -279,7 +293,9 @@ function mapWithKeyU(m, f) { } function mapWithKey(m, f) { - return mapWithKeyU(m, Curry.__2(f)); + return mapWithKeyU(m, (function (a, b) { + return f(a, b); + })); } function get(m, x) { diff --git a/lib/es6/belt_MutableMapInt.js b/lib/es6/belt_MutableMapInt.js index e3155c0fa2..dc792430ed 100644 --- a/lib/es6/belt_MutableMapInt.js +++ b/lib/es6/belt_MutableMapInt.js @@ -1,19 +1,17 @@ -import * as Curry from "./curry.js"; import * as Caml_option from "./caml_option.js"; import * as Belt_internalMapInt from "./belt_internalMapInt.js"; import * as Belt_internalAVLtree from "./belt_internalAVLtree.js"; -function make(param) { +function make() { return { data: undefined }; } function isEmpty(m) { - let x = m.data; - return x === undefined; + return m.data === undefined; } function clear(m) { @@ -67,7 +65,9 @@ function forEachU(d, f) { } function forEach(d, f) { - Belt_internalAVLtree.forEachU(d.data, Curry.__2(f)); + forEachU(d, (function (a, b) { + f(a, b); + })); } function mapU(d, f) { @@ -77,7 +77,9 @@ function mapU(d, f) { } function map(d, f) { - return mapU(d, Curry.__1(f)); + return mapU(d, (function (a) { + return f(a); + })); } function mapWithKeyU(d, f) { @@ -87,7 +89,9 @@ function mapWithKeyU(d, f) { } function mapWithKey(d, f) { - return mapWithKeyU(d, Curry.__2(f)); + return mapWithKeyU(d, (function (a, b) { + return f(a, b); + })); } function reduceU(d, acc, f) { @@ -95,7 +99,9 @@ function reduceU(d, acc, f) { } function reduce(d, acc, f) { - return reduceU(d, acc, Curry.__3(f)); + return reduceU(d, acc, (function (a, b, c) { + return f(a, b, c); + })); } function everyU(d, f) { @@ -103,7 +109,9 @@ function everyU(d, f) { } function every(d, f) { - return Belt_internalAVLtree.everyU(d.data, Curry.__2(f)); + return everyU(d, (function (a, b) { + return f(a, b); + })); } function someU(d, f) { @@ -111,7 +119,9 @@ function someU(d, f) { } function some(d, f) { - return Belt_internalAVLtree.someU(d.data, Curry.__2(f)); + return someU(d, (function (a, b) { + return f(a, b); + })); } function size(d) { @@ -240,7 +250,9 @@ function updateU(t, x, f) { } function update(t, x, f) { - updateU(t, x, Curry.__1(f)); + updateU(t, x, (function (a) { + return f(a); + })); } function removeArrayMutateAux(_t, xs, _i, len) { @@ -286,7 +298,9 @@ function cmpU(d0, d1, f) { } function cmp(d0, d1, f) { - return cmpU(d0, d1, Curry.__2(f)); + return cmpU(d0, d1, (function (a, b) { + return f(a, b); + })); } function eqU(d0, d1, f) { @@ -294,7 +308,9 @@ function eqU(d0, d1, f) { } function eq(d0, d1, f) { - return eqU(d0, d1, Curry.__2(f)); + return eqU(d0, d1, (function (a, b) { + return f(a, b); + })); } function get(d, x) { diff --git a/lib/es6/belt_MutableMapString.js b/lib/es6/belt_MutableMapString.js index ed42d2cf98..b0d77bb7e7 100644 --- a/lib/es6/belt_MutableMapString.js +++ b/lib/es6/belt_MutableMapString.js @@ -1,19 +1,17 @@ -import * as Curry from "./curry.js"; import * as Caml_option from "./caml_option.js"; import * as Belt_internalAVLtree from "./belt_internalAVLtree.js"; import * as Belt_internalMapString from "./belt_internalMapString.js"; -function make(param) { +function make() { return { data: undefined }; } function isEmpty(m) { - let x = m.data; - return x === undefined; + return m.data === undefined; } function clear(m) { @@ -67,7 +65,9 @@ function forEachU(d, f) { } function forEach(d, f) { - Belt_internalAVLtree.forEachU(d.data, Curry.__2(f)); + forEachU(d, (function (a, b) { + f(a, b); + })); } function mapU(d, f) { @@ -77,7 +77,9 @@ function mapU(d, f) { } function map(d, f) { - return mapU(d, Curry.__1(f)); + return mapU(d, (function (a) { + return f(a); + })); } function mapWithKeyU(d, f) { @@ -87,7 +89,9 @@ function mapWithKeyU(d, f) { } function mapWithKey(d, f) { - return mapWithKeyU(d, Curry.__2(f)); + return mapWithKeyU(d, (function (a, b) { + return f(a, b); + })); } function reduceU(d, acc, f) { @@ -95,7 +99,9 @@ function reduceU(d, acc, f) { } function reduce(d, acc, f) { - return reduceU(d, acc, Curry.__3(f)); + return reduceU(d, acc, (function (a, b, c) { + return f(a, b, c); + })); } function everyU(d, f) { @@ -103,7 +109,9 @@ function everyU(d, f) { } function every(d, f) { - return Belt_internalAVLtree.everyU(d.data, Curry.__2(f)); + return everyU(d, (function (a, b) { + return f(a, b); + })); } function someU(d, f) { @@ -111,7 +119,9 @@ function someU(d, f) { } function some(d, f) { - return Belt_internalAVLtree.someU(d.data, Curry.__2(f)); + return someU(d, (function (a, b) { + return f(a, b); + })); } function size(d) { @@ -240,7 +250,9 @@ function updateU(t, x, f) { } function update(t, x, f) { - updateU(t, x, Curry.__1(f)); + updateU(t, x, (function (a) { + return f(a); + })); } function removeArrayMutateAux(_t, xs, _i, len) { @@ -286,7 +298,9 @@ function cmpU(d0, d1, f) { } function cmp(d0, d1, f) { - return cmpU(d0, d1, Curry.__2(f)); + return cmpU(d0, d1, (function (a, b) { + return f(a, b); + })); } function eqU(d0, d1, f) { @@ -294,7 +308,9 @@ function eqU(d0, d1, f) { } function eq(d0, d1, f) { - return eqU(d0, d1, Curry.__2(f)); + return eqU(d0, d1, (function (a, b) { + return f(a, b); + })); } function get(d, x) { diff --git a/lib/es6/belt_MutableQueue.js b/lib/es6/belt_MutableQueue.js index fc8edbfafb..792e610d4b 100644 --- a/lib/es6/belt_MutableQueue.js +++ b/lib/es6/belt_MutableQueue.js @@ -1,9 +1,8 @@ -import * as Curry from "./curry.js"; import * as Caml_option from "./caml_option.js"; -function make(param) { +function make() { return { length: 0, first: undefined, @@ -177,7 +176,9 @@ function mapU(q, f) { } function map(q, f) { - return mapU(q, Curry.__1(f)); + return mapU(q, (function (a) { + return f(a); + })); } function isEmpty(q) { @@ -202,7 +203,9 @@ function forEachU(q, f) { } function forEach(q, f) { - forEachU(q, Curry.__1(f)); + forEachU(q, (function (a) { + f(a); + })); } function reduceU(q, accu, f) { @@ -222,7 +225,9 @@ function reduceU(q, accu, f) { } function reduce(q, accu, f) { - return reduceU(q, accu, Curry.__2(f)); + return reduceU(q, accu, (function (a, b) { + return f(a, b); + })); } function transfer(q1, q2) { diff --git a/lib/es6/belt_MutableSet.js b/lib/es6/belt_MutableSet.js index 982de5b409..05ed011852 100644 --- a/lib/es6/belt_MutableSet.js +++ b/lib/es6/belt_MutableSet.js @@ -1,6 +1,5 @@ -import * as Curry from "./curry.js"; import * as Belt_SortArray from "./belt_SortArray.js"; import * as Belt_internalAVLset from "./belt_internalAVLset.js"; @@ -193,8 +192,7 @@ function make(id) { } function isEmpty(d) { - let n = d.data; - return n === undefined; + return d.data === undefined; } function minimum(d) { @@ -218,7 +216,9 @@ function forEachU(d, f) { } function forEach(d, f) { - Belt_internalAVLset.forEachU(d.data, Curry.__1(f)); + forEachU(d, (function (a) { + f(a); + })); } function reduceU(d, acc, cb) { @@ -226,7 +226,9 @@ function reduceU(d, acc, cb) { } function reduce(d, acc, cb) { - return reduceU(d, acc, Curry.__2(cb)); + return reduceU(d, acc, (function (a, b) { + return cb(a, b); + })); } function everyU(d, p) { @@ -234,7 +236,9 @@ function everyU(d, p) { } function every(d, p) { - return Belt_internalAVLset.everyU(d.data, Curry.__1(p)); + return everyU(d, (function (a) { + return p(a); + })); } function someU(d, p) { @@ -242,7 +246,9 @@ function someU(d, p) { } function some(d, p) { - return Belt_internalAVLset.someU(d.data, Curry.__1(p)); + return someU(d, (function (a) { + return p(a); + })); } function size(d) { @@ -340,7 +346,9 @@ function keepU(d, p) { } function keep(d, p) { - return keepU(d, Curry.__1(p)); + return keepU(d, (function (a) { + return p(a); + })); } function partitionU(d, p) { @@ -359,7 +367,9 @@ function partitionU(d, p) { } function partition(d, p) { - return partitionU(d, Curry.__1(p)); + return partitionU(d, (function (a) { + return p(a); + })); } function subset(a, b) { diff --git a/lib/es6/belt_MutableSetInt.js b/lib/es6/belt_MutableSetInt.js index 77eb5949fe..47ff473614 100644 --- a/lib/es6/belt_MutableSetInt.js +++ b/lib/es6/belt_MutableSetInt.js @@ -1,6 +1,5 @@ -import * as Curry from "./curry.js"; import * as Belt_SortArrayInt from "./belt_SortArrayInt.js"; import * as Belt_internalAVLset from "./belt_internalAVLset.js"; import * as Belt_internalSetInt from "./belt_internalSetInt.js"; @@ -183,15 +182,14 @@ function mergeMany(d, arr) { d.data = addArrayMutate(d.data, arr); } -function make(param) { +function make() { return { data: undefined }; } function isEmpty(d) { - let n = d.data; - return n === undefined; + return d.data === undefined; } function minimum(d) { @@ -215,7 +213,9 @@ function forEachU(d, f) { } function forEach(d, f) { - Belt_internalAVLset.forEachU(d.data, Curry.__1(f)); + forEachU(d, (function (a) { + f(a); + })); } function reduceU(d, acc, cb) { @@ -223,7 +223,9 @@ function reduceU(d, acc, cb) { } function reduce(d, acc, cb) { - return reduceU(d, acc, Curry.__2(cb)); + return reduceU(d, acc, (function (a, b) { + return cb(a, b); + })); } function everyU(d, p) { @@ -231,7 +233,9 @@ function everyU(d, p) { } function every(d, p) { - return Belt_internalAVLset.everyU(d.data, Curry.__1(p)); + return everyU(d, (function (a) { + return p(a); + })); } function someU(d, p) { @@ -239,7 +243,9 @@ function someU(d, p) { } function some(d, p) { - return Belt_internalAVLset.someU(d.data, Curry.__1(p)); + return someU(d, (function (a) { + return p(a); + })); } function size(d) { @@ -328,7 +334,9 @@ function keepU(d, p) { } function keep(d, p) { - return keepU(d, Curry.__1(p)); + return keepU(d, (function (a) { + return p(a); + })); } function partitionU(d, p) { @@ -344,7 +352,9 @@ function partitionU(d, p) { } function partition(d, p) { - return partitionU(d, Curry.__1(p)); + return partitionU(d, (function (a) { + return p(a); + })); } function subset(a, b) { diff --git a/lib/es6/belt_MutableSetString.js b/lib/es6/belt_MutableSetString.js index a39db395c8..d8a217d1ef 100644 --- a/lib/es6/belt_MutableSetString.js +++ b/lib/es6/belt_MutableSetString.js @@ -1,6 +1,5 @@ -import * as Curry from "./curry.js"; import * as Belt_internalAVLset from "./belt_internalAVLset.js"; import * as Belt_SortArrayString from "./belt_SortArrayString.js"; import * as Belt_internalSetString from "./belt_internalSetString.js"; @@ -183,15 +182,14 @@ function mergeMany(d, arr) { d.data = addArrayMutate(d.data, arr); } -function make(param) { +function make() { return { data: undefined }; } function isEmpty(d) { - let n = d.data; - return n === undefined; + return d.data === undefined; } function minimum(d) { @@ -215,7 +213,9 @@ function forEachU(d, f) { } function forEach(d, f) { - Belt_internalAVLset.forEachU(d.data, Curry.__1(f)); + forEachU(d, (function (a) { + f(a); + })); } function reduceU(d, acc, cb) { @@ -223,7 +223,9 @@ function reduceU(d, acc, cb) { } function reduce(d, acc, cb) { - return reduceU(d, acc, Curry.__2(cb)); + return reduceU(d, acc, (function (a, b) { + return cb(a, b); + })); } function everyU(d, p) { @@ -231,7 +233,9 @@ function everyU(d, p) { } function every(d, p) { - return Belt_internalAVLset.everyU(d.data, Curry.__1(p)); + return everyU(d, (function (a) { + return p(a); + })); } function someU(d, p) { @@ -239,7 +243,9 @@ function someU(d, p) { } function some(d, p) { - return Belt_internalAVLset.someU(d.data, Curry.__1(p)); + return someU(d, (function (a) { + return p(a); + })); } function size(d) { @@ -328,7 +334,9 @@ function keepU(d, p) { } function keep(d, p) { - return keepU(d, Curry.__1(p)); + return keepU(d, (function (a) { + return p(a); + })); } function partitionU(d, p) { @@ -344,7 +352,9 @@ function partitionU(d, p) { } function partition(d, p) { - return partitionU(d, Curry.__1(p)); + return partitionU(d, (function (a) { + return p(a); + })); } function subset(a, b) { diff --git a/lib/es6/belt_MutableStack.js b/lib/es6/belt_MutableStack.js index 93650f0b49..1197f56c81 100644 --- a/lib/es6/belt_MutableStack.js +++ b/lib/es6/belt_MutableStack.js @@ -1,9 +1,8 @@ -import * as Curry from "./curry.js"; import * as Caml_option from "./caml_option.js"; -function make(param) { +function make() { return { root: undefined }; @@ -99,7 +98,9 @@ function forEachU(s, f) { } function forEach(s, f) { - forEachU(s, Curry.__1(f)); + forEachU(s, (function (x) { + f(x); + })); } function dynamicPopIterU(s, f) { @@ -115,7 +116,9 @@ function dynamicPopIterU(s, f) { } function dynamicPopIter(s, f) { - dynamicPopIterU(s, Curry.__1(f)); + dynamicPopIterU(s, (function (x) { + f(x); + })); } export { diff --git a/lib/es6/belt_Option.js b/lib/es6/belt_Option.js index 906493c689..840279441c 100644 --- a/lib/es6/belt_Option.js +++ b/lib/es6/belt_Option.js @@ -1,6 +1,5 @@ -import * as Curry from "./curry.js"; import * as Caml_option from "./caml_option.js"; function keepU(opt, p) { @@ -11,7 +10,9 @@ function keepU(opt, p) { } function keep(opt, p) { - return keepU(opt, Curry.__1(p)); + return keepU(opt, (function (x) { + return p(x); + })); } function forEachU(opt, f) { @@ -22,7 +23,9 @@ function forEachU(opt, f) { } function forEach(opt, f) { - forEachU(opt, Curry.__1(f)); + forEachU(opt, (function (x) { + f(x); + })); } function getExn(x) { @@ -45,7 +48,9 @@ function mapWithDefaultU(opt, $$default, f) { } function mapWithDefault(opt, $$default, f) { - return mapWithDefaultU(opt, $$default, Curry.__1(f)); + return mapWithDefaultU(opt, $$default, (function (x) { + return f(x); + })); } function mapU(opt, f) { @@ -56,7 +61,9 @@ function mapU(opt, f) { } function map(opt, f) { - return mapU(opt, Curry.__1(f)); + return mapU(opt, (function (x) { + return f(x); + })); } function flatMapU(opt, f) { @@ -67,7 +74,9 @@ function flatMapU(opt, f) { } function flatMap(opt, f) { - return flatMapU(opt, Curry.__1(f)); + return flatMapU(opt, (function (x) { + return f(x); + })); } function getWithDefault(opt, $$default) { @@ -107,7 +116,9 @@ function eqU(a, b, f) { } function eq(a, b, f) { - return eqU(a, b, Curry.__2(f)); + return eqU(a, b, (function (x, y) { + return f(x, y); + })); } function cmpU(a, b, f) { @@ -125,7 +136,9 @@ function cmpU(a, b, f) { } function cmp(a, b, f) { - return cmpU(a, b, Curry.__2(f)); + return cmpU(a, b, (function (x, y) { + return f(x, y); + })); } export { diff --git a/lib/es6/belt_Range.js b/lib/es6/belt_Range.js index 19919e7847..6dc8c014d2 100644 --- a/lib/es6/belt_Range.js +++ b/lib/es6/belt_Range.js @@ -1,6 +1,5 @@ -import * as Curry from "./curry.js"; function forEachU(s, f, action) { for(let i = s; i <= f; ++i){ @@ -9,7 +8,9 @@ function forEachU(s, f, action) { } function forEach(s, f, action) { - forEachU(s, f, Curry.__1(action)); + forEachU(s, f, (function (a) { + action(a); + })); } function everyU(_s, f, p) { @@ -27,7 +28,9 @@ function everyU(_s, f, p) { } function every(s, f, p) { - return everyU(s, f, Curry.__1(p)); + return everyU(s, f, (function (a) { + return p(a); + })); } function everyByU(s, f, step, p) { @@ -50,7 +53,9 @@ function everyByU(s, f, step, p) { } function everyBy(s, f, step, p) { - return everyByU(s, f, step, Curry.__1(p)); + return everyByU(s, f, step, (function (a) { + return p(a); + })); } function someU(_s, f, p) { @@ -68,7 +73,9 @@ function someU(_s, f, p) { } function some(s, f, p) { - return someU(s, f, Curry.__1(p)); + return someU(s, f, (function (a) { + return p(a); + })); } function someByU(s, f, step, p) { @@ -91,7 +98,9 @@ function someByU(s, f, step, p) { } function someBy(s, f, step, p) { - return someByU(s, f, step, Curry.__1(p)); + return someByU(s, f, step, (function (a) { + return p(a); + })); } export { diff --git a/lib/es6/belt_Result.js b/lib/es6/belt_Result.js index cbc8be85dd..e3594b9633 100644 --- a/lib/es6/belt_Result.js +++ b/lib/es6/belt_Result.js @@ -1,6 +1,5 @@ -import * as Curry from "./curry.js"; function getExn(x) { if (x.TAG === "Ok") { @@ -22,7 +21,9 @@ function mapWithDefaultU(opt, $$default, f) { } function mapWithDefault(opt, $$default, f) { - return mapWithDefaultU(opt, $$default, Curry.__1(f)); + return mapWithDefaultU(opt, $$default, (function (x) { + return f(x); + })); } function mapU(opt, f) { @@ -40,7 +41,9 @@ function mapU(opt, f) { } function map(opt, f) { - return mapU(opt, Curry.__1(f)); + return mapU(opt, (function (x) { + return f(x); + })); } function flatMapU(opt, f) { @@ -55,7 +58,9 @@ function flatMapU(opt, f) { } function flatMap(opt, f) { - return flatMapU(opt, Curry.__1(f)); + return flatMapU(opt, (function (x) { + return f(x); + })); } function getWithDefault(opt, $$default) { @@ -97,7 +102,9 @@ function eqU(a, b, f) { } function eq(a, b, f) { - return eqU(a, b, Curry.__2(f)); + return eqU(a, b, (function (x, y) { + return f(x, y); + })); } function cmpU(a, b, f) { @@ -115,7 +122,9 @@ function cmpU(a, b, f) { } function cmp(a, b, f) { - return cmpU(a, b, Curry.__2(f)); + return cmpU(a, b, (function (x, y) { + return f(x, y); + })); } export { diff --git a/lib/es6/belt_Set.js b/lib/es6/belt_Set.js index 816c874348..c68c9f5b85 100644 --- a/lib/es6/belt_Set.js +++ b/lib/es6/belt_Set.js @@ -1,6 +1,5 @@ -import * as Curry from "./curry.js"; import * as Belt_SetDict from "./belt_SetDict.js"; function fromArray(data, id) { @@ -128,7 +127,9 @@ function forEachU(m, f) { } function forEach(m, f) { - Belt_SetDict.forEachU(m.data, Curry.__1(f)); + forEachU(m, (function (a) { + f(a); + })); } function reduceU(m, acc, f) { @@ -136,7 +137,9 @@ function reduceU(m, acc, f) { } function reduce(m, acc, f) { - return reduceU(m, acc, Curry.__2(f)); + return reduceU(m, acc, (function (a, b) { + return f(a, b); + })); } function everyU(m, f) { @@ -144,7 +147,9 @@ function everyU(m, f) { } function every(m, f) { - return Belt_SetDict.everyU(m.data, Curry.__1(f)); + return everyU(m, (function (a) { + return f(a); + })); } function someU(m, f) { @@ -152,7 +157,9 @@ function someU(m, f) { } function some(m, f) { - return Belt_SetDict.someU(m.data, Curry.__1(f)); + return someU(m, (function (a) { + return f(a); + })); } function keepU(m, f) { @@ -163,7 +170,9 @@ function keepU(m, f) { } function keep(m, f) { - return keepU(m, Curry.__1(f)); + return keepU(m, (function (a) { + return f(a); + })); } function partitionU(m, f) { @@ -182,7 +191,9 @@ function partitionU(m, f) { } function partition(m, f) { - return partitionU(m, Curry.__1(f)); + return partitionU(m, (function (a) { + return f(a); + })); } function size(m) { diff --git a/lib/es6/belt_SortArray.js b/lib/es6/belt_SortArray.js index 8cb252b911..11810837e4 100644 --- a/lib/es6/belt_SortArray.js +++ b/lib/es6/belt_SortArray.js @@ -1,6 +1,5 @@ -import * as Curry from "./curry.js"; import * as Belt_Array from "./belt_Array.js"; function sortedLengthAuxMore(xs, _prec, _acc, len, lt) { @@ -52,7 +51,9 @@ function strictlySortedLengthU(xs, lt) { } function strictlySortedLength(xs, lt) { - return strictlySortedLengthU(xs, Curry.__2(lt)); + return strictlySortedLengthU(xs, (function (x, y) { + return lt(x, y); + })); } function isSortedU(a, cmp) { @@ -77,7 +78,9 @@ function isSortedU(a, cmp) { } function isSorted(a, cmp) { - return isSortedU(a, Curry.__2(cmp)); + return isSortedU(a, (function (x, y) { + return cmp(x, y); + })); } function merge(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, cmp) { @@ -181,7 +184,9 @@ function unionU(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, cmp) } function union(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, cmp) { - return unionU(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, Curry.__2(cmp)); + return unionU(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, (function (x, y) { + return cmp(x, y); + })); } function intersectU(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, cmp) { @@ -234,7 +239,9 @@ function intersectU(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, } function intersect(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, cmp) { - return intersectU(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, Curry.__2(cmp)); + return intersectU(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, (function (x, y) { + return cmp(x, y); + })); } function diffU(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, cmp) { @@ -293,7 +300,9 @@ function diffU(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, cmp) } function diff(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, cmp) { - return diffU(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, Curry.__2(cmp)); + return diffU(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, (function (x, y) { + return cmp(x, y); + })); } function insertionSort(src, srcofs, dst, dstofs, len, cmp) { @@ -333,7 +342,9 @@ function stableSortInPlaceByU(a, cmp) { } function stableSortInPlaceBy(a, cmp) { - stableSortInPlaceByU(a, Curry.__2(cmp)); + stableSortInPlaceByU(a, (function (x, y) { + return cmp(x, y); + })); } function stableSortByU(a, cmp) { @@ -343,7 +354,9 @@ function stableSortByU(a, cmp) { } function stableSortBy(a, cmp) { - return stableSortByU(a, Curry.__2(cmp)); + return stableSortByU(a, (function (x, y) { + return cmp(x, y); + })); } function binarySearchByU(sorted, key, cmp) { @@ -397,7 +410,9 @@ function binarySearchByU(sorted, key, cmp) { } function binarySearchBy(sorted, key, cmp) { - return binarySearchByU(sorted, key, Curry.__2(cmp)); + return binarySearchByU(sorted, key, (function (x, y) { + return cmp(x, y); + })); } let Int; diff --git a/lib/es6/belt_internalAVLset.js b/lib/es6/belt_internalAVLset.js index 809d4269a0..6f6efe8a31 100644 --- a/lib/es6/belt_internalAVLset.js +++ b/lib/es6/belt_internalAVLset.js @@ -1,6 +1,5 @@ -import * as Curry from "./curry.js"; import * as Caml_option from "./caml_option.js"; import * as Belt_SortArray from "./belt_SortArray.js"; @@ -178,7 +177,9 @@ function forEachU(_n, f) { } function forEach(n, f) { - forEachU(n, Curry.__1(f)); + forEachU(n, (function (a) { + f(a); + })); } function reduceU(_s, _accu, f) { @@ -195,7 +196,9 @@ function reduceU(_s, _accu, f) { } function reduce(s, accu, f) { - return reduceU(s, accu, Curry.__2(f)); + return reduceU(s, accu, (function (a, b) { + return f(a, b); + })); } function everyU(_n, p) { @@ -216,7 +219,9 @@ function everyU(_n, p) { } function every(n, p) { - return everyU(n, Curry.__1(p)); + return everyU(n, (function (a) { + return p(a); + })); } function someU(_n, p) { @@ -237,7 +242,9 @@ function someU(_n, p) { } function some(n, p) { - return someU(n, Curry.__1(p)); + return someU(n, (function (a) { + return p(a); + })); } function addMinElement(n, v) { @@ -317,7 +324,9 @@ function partitionSharedU(n, p) { } function partitionShared(n, p) { - return partitionSharedU(n, Curry.__1(p)); + return partitionSharedU(n, (function (a) { + return p(a); + })); } function lengthNode(n) { @@ -554,7 +563,9 @@ function keepSharedU(n, p) { } function keepShared(n, p) { - return keepSharedU(n, Curry.__1(p)); + return keepSharedU(n, (function (a) { + return p(a); + })); } function keepCopyU(n, p) { @@ -568,7 +579,9 @@ function keepCopyU(n, p) { } function keepCopy(n, p) { - return keepCopyU(n, Curry.__1(p)); + return keepCopyU(n, (function (x) { + return p(x); + })); } function partitionCopyU(n, p) { @@ -594,7 +607,9 @@ function partitionCopyU(n, p) { } function partitionCopy(n, p) { - return partitionCopyU(n, Curry.__1(p)); + return partitionCopyU(n, (function (a) { + return p(a); + })); } function has(_t, x, cmp) { diff --git a/lib/es6/belt_internalAVLtree.js b/lib/es6/belt_internalAVLtree.js index b9820a6952..b2406181e3 100644 --- a/lib/es6/belt_internalAVLtree.js +++ b/lib/es6/belt_internalAVLtree.js @@ -1,6 +1,5 @@ -import * as Curry from "./curry.js"; import * as Caml_option from "./caml_option.js"; import * as Belt_SortArray from "./belt_SortArray.js"; @@ -270,7 +269,9 @@ function findFirstByU(n, p) { } function findFirstBy(n, p) { - return findFirstByU(n, Curry.__2(p)); + return findFirstByU(n, (function (a, b) { + return p(a, b); + })); } function forEachU(_n, f) { @@ -287,7 +288,9 @@ function forEachU(_n, f) { } function forEach(n, f) { - forEachU(n, Curry.__2(f)); + forEachU(n, (function (a, b) { + f(a, b); + })); } function mapU(n, f) { @@ -307,7 +310,9 @@ function mapU(n, f) { } function map(n, f) { - return mapU(n, Curry.__1(f)); + return mapU(n, (function (a) { + return f(a); + })); } function mapWithKeyU(n, f) { @@ -328,7 +333,9 @@ function mapWithKeyU(n, f) { } function mapWithKey(n, f) { - return mapWithKeyU(n, Curry.__2(f)); + return mapWithKeyU(n, (function (a, b) { + return f(a, b); + })); } function reduceU(_m, _accu, f) { @@ -349,7 +356,9 @@ function reduceU(_m, _accu, f) { } function reduce(m, accu, f) { - return reduceU(m, accu, Curry.__3(f)); + return reduceU(m, accu, (function (a, b, c) { + return f(a, b, c); + })); } function everyU(_n, p) { @@ -370,7 +379,9 @@ function everyU(_n, p) { } function every(n, p) { - return everyU(n, Curry.__2(p)); + return everyU(n, (function (a, b) { + return p(a, b); + })); } function someU(_n, p) { @@ -391,7 +402,9 @@ function someU(_n, p) { } function some(n, p) { - return someU(n, Curry.__2(p)); + return someU(n, (function (a, b) { + return p(a, b); + })); } function addMinElement(n, k, v) { @@ -478,7 +491,9 @@ function keepSharedU(n, p) { } function keepShared(n, p) { - return keepSharedU(n, Curry.__2(p)); + return keepSharedU(n, (function (a, b) { + return p(a, b); + })); } function keepMapU(n, p) { @@ -498,7 +513,9 @@ function keepMapU(n, p) { } function keepMap(n, p) { - return keepMapU(n, Curry.__2(p)); + return keepMapU(n, (function (a, b) { + return p(a, b); + })); } function partitionSharedU(n, p) { @@ -531,7 +548,9 @@ function partitionSharedU(n, p) { } function partitionShared(n, p) { - return partitionSharedU(n, Curry.__2(p)); + return partitionSharedU(n, (function (a, b) { + return p(a, b); + })); } function lengthNode(n) { @@ -818,7 +837,9 @@ function cmpU(s1, s2, kcmp, vcmp) { } function cmp(s1, s2, kcmp, vcmp) { - return cmpU(s1, s2, kcmp, Curry.__2(vcmp)); + return cmpU(s1, s2, kcmp, (function (a, b) { + return vcmp(a, b); + })); } function eqU(s1, s2, kcmp, veq) { @@ -851,7 +872,9 @@ function eqU(s1, s2, kcmp, veq) { } function eq(s1, s2, kcmp, veq) { - return eqU(s1, s2, kcmp, Curry.__2(veq)); + return eqU(s1, s2, kcmp, (function (a, b) { + return veq(a, b); + })); } function get(_n, x, cmp) { diff --git a/lib/es6/belt_internalBuckets.js b/lib/es6/belt_internalBuckets.js index c78b17f237..43299a9adc 100644 --- a/lib/es6/belt_internalBuckets.js +++ b/lib/es6/belt_internalBuckets.js @@ -1,6 +1,5 @@ -import * as Curry from "./curry.js"; import * as Belt_Array from "./belt_Array.js"; import * as Caml_option from "./caml_option.js"; @@ -87,7 +86,9 @@ function forEachU(h, f) { } function forEach(h, f) { - forEachU(h, Curry.__2(f)); + forEachU(h, (function (a, b) { + return f(a, b); + })); } function do_bucket_fold(f, _b, _accu) { @@ -113,7 +114,9 @@ function reduceU(h, init, f) { } function reduce(h, init, f) { - return reduceU(h, init, Curry.__3(f)); + return reduceU(h, init, (function (a, b, c) { + return f(a, b, c); + })); } function getMaxBucketLength(h) { @@ -195,7 +198,9 @@ function keepMapInPlaceU(h, f) { } function keepMapInPlace(h, f) { - keepMapInPlaceU(h, Curry.__2(f)); + keepMapInPlaceU(h, (function (a, b) { + return f(a, b); + })); } function fillArray(_i, arr, _cell) { diff --git a/lib/es6/belt_internalMapInt.js b/lib/es6/belt_internalMapInt.js index fb14cb3c03..845b33e8f4 100644 --- a/lib/es6/belt_internalMapInt.js +++ b/lib/es6/belt_internalMapInt.js @@ -1,7 +1,6 @@ import * as Caml from "./caml.js"; -import * as Curry from "./curry.js"; import * as Caml_option from "./caml_option.js"; import * as Belt_SortArray from "./belt_SortArray.js"; import * as Belt_internalAVLtree from "./belt_internalAVLtree.js"; @@ -210,7 +209,9 @@ function mergeU(s1, s2, f) { } function merge(s1, s2, f) { - return mergeU(s1, s2, Curry.__3(f)); + return mergeU(s1, s2, (function (a, b, c) { + return f(a, b, c); + })); } function compareAux(_e1, _e2, vcmp) { @@ -252,7 +253,9 @@ function cmpU(s1, s2, cmp) { } function cmp(s1, s2, f) { - return cmpU(s1, s2, Curry.__2(f)); + return cmpU(s1, s2, (function (a, b) { + return f(a, b); + })); } function eqAux(_e1, _e2, eq) { @@ -287,7 +290,9 @@ function eqU(s1, s2, eq) { } function eq(s1, s2, f) { - return eqU(s1, s2, Curry.__2(f)); + return eqU(s1, s2, (function (a, b) { + return f(a, b); + })); } function addMutate(t, x, data) { diff --git a/lib/es6/belt_internalMapString.js b/lib/es6/belt_internalMapString.js index a32c628f21..d264f68795 100644 --- a/lib/es6/belt_internalMapString.js +++ b/lib/es6/belt_internalMapString.js @@ -1,7 +1,6 @@ import * as Caml from "./caml.js"; -import * as Curry from "./curry.js"; import * as Caml_option from "./caml_option.js"; import * as Belt_SortArray from "./belt_SortArray.js"; import * as Belt_internalAVLtree from "./belt_internalAVLtree.js"; @@ -210,7 +209,9 @@ function mergeU(s1, s2, f) { } function merge(s1, s2, f) { - return mergeU(s1, s2, Curry.__3(f)); + return mergeU(s1, s2, (function (a, b, c) { + return f(a, b, c); + })); } function compareAux(_e1, _e2, vcmp) { @@ -252,7 +253,9 @@ function cmpU(s1, s2, cmp) { } function cmp(s1, s2, f) { - return cmpU(s1, s2, Curry.__2(f)); + return cmpU(s1, s2, (function (a, b) { + return f(a, b); + })); } function eqAux(_e1, _e2, eq) { @@ -287,7 +290,9 @@ function eqU(s1, s2, eq) { } function eq(s1, s2, f) { - return eqU(s1, s2, Curry.__2(f)); + return eqU(s1, s2, (function (a, b) { + return f(a, b); + })); } function addMutate(t, x, data) { diff --git a/lib/es6/belt_internalSetBuckets.js b/lib/es6/belt_internalSetBuckets.js index 191dcb2d82..e4b289dd09 100644 --- a/lib/es6/belt_internalSetBuckets.js +++ b/lib/es6/belt_internalSetBuckets.js @@ -1,6 +1,5 @@ -import * as Curry from "./curry.js"; import * as Belt_Array from "./belt_Array.js"; function copyAuxCont(_c, _prec) { @@ -84,7 +83,9 @@ function forEachU(h, f) { } function forEach(h, f) { - forEachU(h, Curry.__1(f)); + forEachU(h, (function (a) { + f(a); + })); } function fillArray(_i, arr, _cell) { @@ -139,7 +140,9 @@ function reduceU(h, init, f) { } function reduce(h, init, f) { - return reduceU(h, init, Curry.__2(f)); + return reduceU(h, init, (function (a, b) { + return f(a, b); + })); } function getMaxBucketLength(h) { diff --git a/lib/es6/buffer.js b/lib/es6/buffer.js index 034ec0ea08..5a3d7c2b44 100644 --- a/lib/es6/buffer.js +++ b/lib/es6/buffer.js @@ -1,7 +1,6 @@ import * as Bytes from "./bytes.js"; -import * as Curry from "./curry.js"; import * as $$String from "./string.js"; import * as Caml_bytes from "./caml_bytes.js"; import * as Caml_string from "./caml_string.js"; @@ -26,39 +25,39 @@ function to_bytes(b) { } function sub(b, ofs, len) { - if (ofs < 0 || len < 0 || ofs > (b.position - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Buffer.sub" - } - }); + if (!(ofs < 0 || len < 0 || ofs > (b.position - len | 0))) { + return Bytes.sub_string(b.buffer, ofs, len); } - return Bytes.sub_string(b.buffer, ofs, len); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.sub" + } + }); } function blit(src, srcoff, dst, dstoff, len) { - if (len < 0 || srcoff < 0 || srcoff > (src.position - len | 0) || dstoff < 0 || dstoff > (dst.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Buffer.blit" - } - }); + if (!(len < 0 || srcoff < 0 || srcoff > (src.position - len | 0) || dstoff < 0 || dstoff > (dst.length - len | 0))) { + return Bytes.blit(src.buffer, srcoff, dst, dstoff, len); } - Bytes.blit(src.buffer, srcoff, dst, dstoff, len); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.blit" + } + }); } function nth(b, ofs) { - if (ofs < 0 || ofs >= b.position) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Buffer.nth" - } - }); + if (!(ofs < 0 || ofs >= b.position)) { + return b.buffer[ofs]; } - return b.buffer[ofs]; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.nth" + } + }); } function length(b) { @@ -447,7 +446,7 @@ function add_substitute(b, f, s) { } let j = i + 1 | 0; let match = find_ident(s, j, lim); - add_string(b, Curry._1(f, match[0])); + add_string(b, f(match[0])); _i = match[1]; _previous = /* ' ' */32; continue; @@ -455,15 +454,16 @@ function add_substitute(b, f, s) { } function truncate(b, len) { - if (len < 0 || len > b.position) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Buffer.truncate" - } - }); + if (!(len < 0 || len > b.position)) { + b.position = len; + return; } - b.position = len; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.truncate" + } + }); } export { diff --git a/lib/es6/bytes.js b/lib/es6/bytes.js index c47cca3ffb..c0ae45e111 100644 --- a/lib/es6/bytes.js +++ b/lib/es6/bytes.js @@ -2,7 +2,6 @@ import * as Caml from "./caml.js"; import * as Char from "./char.js"; -import * as Curry from "./curry.js"; import * as Caml_bytes from "./caml_bytes.js"; import * as Caml_js_exceptions from "./caml_js_exceptions.js"; @@ -64,7 +63,7 @@ function make(n, c) { function init(n, f) { let s = Caml_bytes.create(n); for(let i = 0; i < n; ++i){ - s[i] = Curry._1(f, i); + s[i] = f(i); } return s; } @@ -149,15 +148,15 @@ function $plus$plus(a, b) { if (match$1) { return c; } - if (match$2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.extend" - } - }); + if (!match$2) { + return c; } - return c; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.extend" + } + }); } function extend(s, left, right) { @@ -180,65 +179,66 @@ function extend(s, left, right) { } function fill(s, ofs, len, c) { - if (ofs < 0 || len < 0 || ofs > (s.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.fill / Bytes.fill" - } - }); + if (!(ofs < 0 || len < 0 || ofs > (s.length - len | 0))) { + return unsafe_fill(s, ofs, len, c); } - unsafe_fill(s, ofs, len, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.fill / Bytes.fill" + } + }); } function blit(s1, ofs1, s2, ofs2, len) { - if (len < 0 || ofs1 < 0 || ofs1 > (s1.length - len | 0) || ofs2 < 0 || ofs2 > (s2.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.blit" - } - }); + if (!(len < 0 || ofs1 < 0 || ofs1 > (s1.length - len | 0) || ofs2 < 0 || ofs2 > (s2.length - len | 0))) { + return unsafe_blit(s1, ofs1, s2, ofs2, len); } - unsafe_blit(s1, ofs1, s2, ofs2, len); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.blit" + } + }); } function blit_string(s1, ofs1, s2, ofs2, len) { - if (len < 0 || ofs1 < 0 || ofs1 > (s1.length - len | 0) || ofs2 < 0 || ofs2 > (s2.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.blit / Bytes.blit_string" - } - }); - } - if (len <= 0) { - return; - } - let off1 = s1.length - ofs1 | 0; - if (len <= off1) { - for(let i = 0; i < len; ++i){ - s2[ofs2 + i | 0] = s1.codePointAt(ofs1 + i | 0); + if (!(len < 0 || ofs1 < 0 || ofs1 > (s1.length - len | 0) || ofs2 < 0 || ofs2 > (s2.length - len | 0))) { + if (len <= 0) { + return; + } + let off1 = s1.length - ofs1 | 0; + if (len <= off1) { + for(let i = 0; i < len; ++i){ + s2[ofs2 + i | 0] = s1.codePointAt(ofs1 + i | 0); + } + return; + } + for(let i$1 = 0; i$1 < off1; ++i$1){ + s2[ofs2 + i$1 | 0] = s1.codePointAt(ofs1 + i$1 | 0); + } + for(let i$2 = off1; i$2 < len; ++i$2){ + s2[ofs2 + i$2 | 0] = /* '\000' */0; } return; } - for(let i$1 = 0; i$1 < off1; ++i$1){ - s2[ofs2 + i$1 | 0] = s1.codePointAt(ofs1 + i$1 | 0); - } - for(let i$2 = off1; i$2 < len; ++i$2){ - s2[ofs2 + i$2 | 0] = /* '\000' */0; - } + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.blit / Bytes.blit_string" + } + }); } function iter(f, a) { for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ - Curry._1(f, a[i]); + f(a[i]); } } function iteri(f, a) { for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ - Curry._2(f, i, a[i]); + f(i, a[i]); } } @@ -446,7 +446,7 @@ function map(f, s) { } let r = Caml_bytes.create(l); for(let i = 0; i < l; ++i){ - r[i] = Curry._1(f, s[i]); + r[i] = f(s[i]); } return r; } @@ -458,7 +458,7 @@ function mapi(f, s) { } let r = Caml_bytes.create(l); for(let i = 0; i < l; ++i){ - r[i] = Curry._2(f, i, s[i]); + r[i] = f(i, s[i]); } return r; } @@ -476,7 +476,7 @@ function apply1(f, s) { return s; } let r = copy(s); - r[0] = Curry._1(f, s[0]); + r[0] = f(s[0]); return r; } @@ -530,28 +530,28 @@ function index_opt(s, c) { function index_from(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from / Bytes.index_from" - } - }); + if (!(i < 0 || i > l)) { + return index_rec(s, l, i, c); } - return index_rec(s, l, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from" + } + }); } function index_from_opt(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from_opt / Bytes.index_from_opt" - } - }); + if (!(i < 0 || i > l)) { + return index_rec_opt(s, l, i, c); } - return index_rec_opt(s, l, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt" + } + }); } function rindex_rec(s, _i, c) { @@ -577,15 +577,15 @@ function rindex(s, c) { } function rindex_from(s, i, c) { - if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from / Bytes.rindex_from" - } - }); + if (!(i < -1 || i >= s.length)) { + return rindex_rec(s, i, c); } - return rindex_rec(s, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from" + } + }); } function rindex_rec_opt(s, _i, c) { @@ -607,15 +607,15 @@ function rindex_opt(s, c) { } function rindex_from_opt(s, i, c) { - if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from_opt / Bytes.rindex_from_opt" - } - }); + if (!(i < -1 || i >= s.length)) { + return rindex_rec_opt(s, i, c); } - return rindex_rec_opt(s, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt" + } + }); } function contains_from(s, i, c) { diff --git a/lib/es6/bytesLabels.js b/lib/es6/bytesLabels.js index c47cca3ffb..c0ae45e111 100644 --- a/lib/es6/bytesLabels.js +++ b/lib/es6/bytesLabels.js @@ -2,7 +2,6 @@ import * as Caml from "./caml.js"; import * as Char from "./char.js"; -import * as Curry from "./curry.js"; import * as Caml_bytes from "./caml_bytes.js"; import * as Caml_js_exceptions from "./caml_js_exceptions.js"; @@ -64,7 +63,7 @@ function make(n, c) { function init(n, f) { let s = Caml_bytes.create(n); for(let i = 0; i < n; ++i){ - s[i] = Curry._1(f, i); + s[i] = f(i); } return s; } @@ -149,15 +148,15 @@ function $plus$plus(a, b) { if (match$1) { return c; } - if (match$2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.extend" - } - }); + if (!match$2) { + return c; } - return c; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.extend" + } + }); } function extend(s, left, right) { @@ -180,65 +179,66 @@ function extend(s, left, right) { } function fill(s, ofs, len, c) { - if (ofs < 0 || len < 0 || ofs > (s.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.fill / Bytes.fill" - } - }); + if (!(ofs < 0 || len < 0 || ofs > (s.length - len | 0))) { + return unsafe_fill(s, ofs, len, c); } - unsafe_fill(s, ofs, len, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.fill / Bytes.fill" + } + }); } function blit(s1, ofs1, s2, ofs2, len) { - if (len < 0 || ofs1 < 0 || ofs1 > (s1.length - len | 0) || ofs2 < 0 || ofs2 > (s2.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.blit" - } - }); + if (!(len < 0 || ofs1 < 0 || ofs1 > (s1.length - len | 0) || ofs2 < 0 || ofs2 > (s2.length - len | 0))) { + return unsafe_blit(s1, ofs1, s2, ofs2, len); } - unsafe_blit(s1, ofs1, s2, ofs2, len); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.blit" + } + }); } function blit_string(s1, ofs1, s2, ofs2, len) { - if (len < 0 || ofs1 < 0 || ofs1 > (s1.length - len | 0) || ofs2 < 0 || ofs2 > (s2.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.blit / Bytes.blit_string" - } - }); - } - if (len <= 0) { - return; - } - let off1 = s1.length - ofs1 | 0; - if (len <= off1) { - for(let i = 0; i < len; ++i){ - s2[ofs2 + i | 0] = s1.codePointAt(ofs1 + i | 0); + if (!(len < 0 || ofs1 < 0 || ofs1 > (s1.length - len | 0) || ofs2 < 0 || ofs2 > (s2.length - len | 0))) { + if (len <= 0) { + return; + } + let off1 = s1.length - ofs1 | 0; + if (len <= off1) { + for(let i = 0; i < len; ++i){ + s2[ofs2 + i | 0] = s1.codePointAt(ofs1 + i | 0); + } + return; + } + for(let i$1 = 0; i$1 < off1; ++i$1){ + s2[ofs2 + i$1 | 0] = s1.codePointAt(ofs1 + i$1 | 0); + } + for(let i$2 = off1; i$2 < len; ++i$2){ + s2[ofs2 + i$2 | 0] = /* '\000' */0; } return; } - for(let i$1 = 0; i$1 < off1; ++i$1){ - s2[ofs2 + i$1 | 0] = s1.codePointAt(ofs1 + i$1 | 0); - } - for(let i$2 = off1; i$2 < len; ++i$2){ - s2[ofs2 + i$2 | 0] = /* '\000' */0; - } + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.blit / Bytes.blit_string" + } + }); } function iter(f, a) { for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ - Curry._1(f, a[i]); + f(a[i]); } } function iteri(f, a) { for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ - Curry._2(f, i, a[i]); + f(i, a[i]); } } @@ -446,7 +446,7 @@ function map(f, s) { } let r = Caml_bytes.create(l); for(let i = 0; i < l; ++i){ - r[i] = Curry._1(f, s[i]); + r[i] = f(s[i]); } return r; } @@ -458,7 +458,7 @@ function mapi(f, s) { } let r = Caml_bytes.create(l); for(let i = 0; i < l; ++i){ - r[i] = Curry._2(f, i, s[i]); + r[i] = f(i, s[i]); } return r; } @@ -476,7 +476,7 @@ function apply1(f, s) { return s; } let r = copy(s); - r[0] = Curry._1(f, s[0]); + r[0] = f(s[0]); return r; } @@ -530,28 +530,28 @@ function index_opt(s, c) { function index_from(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from / Bytes.index_from" - } - }); + if (!(i < 0 || i > l)) { + return index_rec(s, l, i, c); } - return index_rec(s, l, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from" + } + }); } function index_from_opt(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from_opt / Bytes.index_from_opt" - } - }); + if (!(i < 0 || i > l)) { + return index_rec_opt(s, l, i, c); } - return index_rec_opt(s, l, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt" + } + }); } function rindex_rec(s, _i, c) { @@ -577,15 +577,15 @@ function rindex(s, c) { } function rindex_from(s, i, c) { - if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from / Bytes.rindex_from" - } - }); + if (!(i < -1 || i >= s.length)) { + return rindex_rec(s, i, c); } - return rindex_rec(s, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from" + } + }); } function rindex_rec_opt(s, _i, c) { @@ -607,15 +607,15 @@ function rindex_opt(s, c) { } function rindex_from_opt(s, i, c) { - if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from_opt / Bytes.rindex_from_opt" - } - }); + if (!(i < -1 || i >= s.length)) { + return rindex_rec_opt(s, i, c); } - return rindex_rec_opt(s, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt" + } + }); } function contains_from(s, i, c) { diff --git a/lib/es6/caml.js b/lib/es6/caml.js index a85e2555f3..65242212b2 100644 --- a/lib/es6/caml.js +++ b/lib/es6/caml.js @@ -166,10 +166,10 @@ function i64_le(x, y) { } function i64_min(x, y) { - if (i64_ge(x, y)) { - return y; - } else { + if (i64_lt(x, y)) { return x; + } else { + return y; } } diff --git a/lib/es6/caml_sys.js b/lib/es6/caml_sys.js index 3cc823d755..d0a2aa2bea 100644 --- a/lib/es6/caml_sys.js +++ b/lib/es6/caml_sys.js @@ -29,7 +29,7 @@ let os_type = (function(_){ } }); -function sys_time(param) { +function sys_time() { if (typeof process === "undefined" || process.uptime === undefined) { return -1; } else { @@ -44,7 +44,7 @@ let sys_getcwd = (function(param){ return process.cwd() }); -function sys_get_argv(param) { +function sys_get_argv() { if (typeof process === "undefined") { return [ "", diff --git a/lib/es6/char.js b/lib/es6/char.js index 3e41fcddf6..3c49e01262 100644 --- a/lib/es6/char.js +++ b/lib/es6/char.js @@ -3,15 +3,15 @@ import * as Bytes from "./bytes.js"; function chr(n) { - if (n < 0 || n > 255) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Char.chr" - } - }); + if (!(n < 0 || n > 255)) { + return n; } - return n; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Char.chr" + } + }); } function escaped(param) { diff --git a/lib/es6/digest.js b/lib/es6/digest.js index d321133827..8025c68591 100644 --- a/lib/es6/digest.js +++ b/lib/es6/digest.js @@ -16,15 +16,15 @@ function bytes(b) { } function substring(str, ofs, len) { - if (ofs < 0 || len < 0 || ofs > (str.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Digest.substring" - } - }); + if (!(ofs < 0 || len < 0 || ofs > (str.length - len | 0))) { + return Caml_md5.md5_string(str, ofs, len); } - return Caml_md5.md5_string(str, ofs, len); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Digest.substring" + } + }); } function subbytes(b, ofs, len) { diff --git a/lib/es6/filename.js b/lib/es6/filename.js index 6460aeb646..f894484288 100644 --- a/lib/es6/filename.js +++ b/lib/es6/filename.js @@ -1,8 +1,6 @@ import * as Sys from "./sys.js"; -import * as Bytes from "./bytes.js"; -import * as Curry from "./curry.js"; import * as Buffer from "./buffer.js"; import * as $$String from "./string.js"; import * as Caml_sys from "./caml_sys.js"; @@ -19,7 +17,7 @@ function generic_basename(is_dir_sep, current_dir_name, name) { if (n < 0) { return $$String.sub(name, 0, 1); } - if (!Curry._2(is_dir_sep, name, n)) { + if (!is_dir_sep(name, n)) { let _n$1 = n; let p = n + 1 | 0; while(true) { @@ -27,7 +25,7 @@ function generic_basename(is_dir_sep, current_dir_name, name) { if (n$1 < 0) { return $$String.sub(name, 0, p); } - if (Curry._2(is_dir_sep, name, n$1)) { + if (is_dir_sep(name, n$1)) { return $$String.sub(name, n$1 + 1 | 0, (p - n$1 | 0) - 1 | 0); } _n$1 = n$1 - 1 | 0; @@ -50,21 +48,21 @@ function generic_dirname(is_dir_sep, current_dir_name, name) { if (n < 0) { return $$String.sub(name, 0, 1); } - if (!Curry._2(is_dir_sep, name, n)) { + if (!is_dir_sep(name, n)) { let _n$1 = n; while(true) { let n$1 = _n$1; if (n$1 < 0) { return current_dir_name; } - if (Curry._2(is_dir_sep, name, n$1)) { + if (is_dir_sep(name, n$1)) { let _n$2 = n$1; while(true) { let n$2 = _n$2; if (n$2 < 0) { return $$String.sub(name, 0, 1); } - if (!Curry._2(is_dir_sep, name, n$2)) { + if (!is_dir_sep(name, n$2)) { return $$String.sub(name, 0, n$2 + 1 | 0); } _n$2 = n$2 - 1 | 0; @@ -195,7 +193,7 @@ function check_suffix$1(name, suff) { return false; } let s = $$String.sub(name, name.length - suff.length | 0, suff.length); - return Bytes.unsafe_to_string(Bytes.lowercase_ascii(Bytes.unsafe_of_string(s))) === Bytes.unsafe_to_string(Bytes.lowercase_ascii(Bytes.unsafe_of_string(suff))); + return $$String.lowercase_ascii(s) === $$String.lowercase_ascii(suff); } let temp_dir_name$1; @@ -375,7 +373,7 @@ let dir_sep = match[2]; function concat(dirname, filename) { let l = dirname.length; - if (l === 0 || Curry._2(is_dir_sep$2, dirname, l - 1 | 0)) { + if (l === 0 || is_dir_sep$2(dirname, l - 1 | 0)) { return dirname + filename; } else { return dirname + (dir_sep + filename); @@ -384,29 +382,29 @@ function concat(dirname, filename) { function chop_suffix(name, suff) { let n = name.length - suff.length | 0; - if (n < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Filename.chop_suffix" - } - }); + if (n >= 0) { + return $$String.sub(name, 0, n); } - return $$String.sub(name, 0, n); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Filename.chop_suffix" + } + }); } function extension_len(name) { let _i = name.length - 1 | 0; while(true) { let i = _i; - if (i < 0 || Curry._2(is_dir_sep$2, name, i)) { + if (i < 0 || is_dir_sep$2(name, i)) { return 0; } if (Caml_string.get(name, i) === /* '.' */46) { let _i$1 = i - 1 | 0; while(true) { let i$1 = _i$1; - if (i$1 < 0 || Curry._2(is_dir_sep$2, name, i$1)) { + if (i$1 < 0 || is_dir_sep$2(name, i$1)) { return 0; } if (Caml_string.get(name, i$1) !== /* '.' */46) { @@ -432,15 +430,15 @@ function extension(name) { function chop_extension(name) { let l = extension_len(name); - if (l === 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Filename.chop_extension" - } - }); + if (l !== 0) { + return $$String.sub(name, 0, name.length - l | 0); } - return $$String.sub(name, 0, name.length - l | 0); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Filename.chop_extension" + } + }); } function remove_extension(name) { @@ -460,7 +458,7 @@ function set_temp_dir_name(s) { current_temp_dir_name.contents = s; } -function get_temp_dir_name(param) { +function get_temp_dir_name() { return current_temp_dir_name.contents; } diff --git a/lib/es6/genlex.js b/lib/es6/genlex.js index 0771228c63..5a0b8ed711 100644 --- a/lib/es6/genlex.js +++ b/lib/es6/genlex.js @@ -20,7 +20,7 @@ let bufpos = { contents: 0 }; -function reset_buffer(param) { +function reset_buffer() { buffer.contents = initial_buffer; bufpos.contents = 0; } @@ -35,7 +35,7 @@ function store(c) { bufpos.contents = bufpos.contents + 1 | 0; } -function get_string(param) { +function get_string() { let s = Bytes.sub_string(buffer.contents, 0, bufpos.contents); buffer.contents = initial_buffer; return s; @@ -105,8 +105,8 @@ function make_lexer(keywords) { case 13 : case 26 : case 32 : - Stream.junk(strm__); - continue; + exit = 2; + break; case 34 : Stream.junk(strm__); reset_buffer(); @@ -175,11 +175,10 @@ function make_lexer(keywords) { store(/* '-' */45); store(c$2); return number(strm__); - } else { - reset_buffer(); - store(/* '-' */45); - return ident2(strm__); } + reset_buffer(); + store(/* '-' */45); + return ident2(strm__); case 48 : case 49 : case 50 : @@ -190,7 +189,7 @@ function make_lexer(keywords) { case 55 : case 56 : case 57 : - exit = 4; + exit = 5; break; case 0 : case 1 : @@ -239,7 +238,7 @@ function make_lexer(keywords) { case 62 : case 63 : case 64 : - exit = 3; + exit = 4; break; } @@ -248,7 +247,7 @@ function make_lexer(keywords) { switch (c) { case 92 : case 94 : - exit = 3; + exit = 4; break; case 91 : case 93 : @@ -256,14 +255,14 @@ function make_lexer(keywords) { exit = 1; break; default: - exit = 2; + exit = 3; } } } else { exit = c >= 127 ? ( - c > 255 || c < 192 ? 1 : 2 + c > 255 || c < 192 ? 1 : 3 ) : ( - c !== 125 ? 3 : 1 + c !== 125 ? 4 : 1 ); } switch (exit) { @@ -271,42 +270,49 @@ function make_lexer(keywords) { Stream.junk(strm__); return keyword_or_error(c); case 2 : + Stream.junk(strm__); + continue; + case 3 : Stream.junk(strm__); reset_buffer(); store(c); while(true) { let c$3 = Stream.peek(strm__); - if (c$3 === undefined) { - return ident_or_keyword(get_string()); - } - if (c$3 >= 91) { - if (c$3 > 122 || c$3 < 95) { - if (c$3 > 255 || c$3 < 192) { - return ident_or_keyword(get_string()); + if (c$3 !== undefined) { + let exit$1 = 0; + if (c$3 >= 91) { + if (c$3 > 122 || c$3 < 95) { + if (!(c$3 > 255 || c$3 < 192)) { + exit$1 = 2; + } + + } else if (c$3 !== 96) { + exit$1 = 2; } - } else if (c$3 === 96) { - return ident_or_keyword(get_string()); + } else if (c$3 >= 48) { + if (c$3 > 64 || c$3 < 58) { + exit$1 = 2; + } + + } else if (c$3 === 39) { + exit$1 = 2; } - - } else if (c$3 >= 48) { - if (!(c$3 > 64 || c$3 < 58)) { - return ident_or_keyword(get_string()); + if (exit$1 === 2) { + Stream.junk(strm__); + store(c$3); + continue; } - } else if (c$3 !== 39) { - return ident_or_keyword(get_string()); } - Stream.junk(strm__); - store(c$3); - continue; + return ident_or_keyword(get_string()); }; - case 3 : + case 4 : Stream.junk(strm__); reset_buffer(); store(c); return ident2(strm__); - case 4 : + case 5 : Stream.junk(strm__); reset_buffer(); store(c); @@ -318,80 +324,81 @@ function make_lexer(keywords) { let ident2 = function (strm__) { while(true) { let c = Stream.peek(strm__); - if (c === undefined) { - return ident_or_keyword(get_string()); - } - if (c >= 94) { - if (c > 125 || c < 95) { - if (c >= 127) { - return ident_or_keyword(get_string()); + if (c !== undefined) { + let exit = 0; + if (c >= 94) { + if (c > 125 || c < 95) { + if (c < 127) { + exit = 2; + } + + } else if (c === 124) { + exit = 2; + } + + } else if (c >= 65) { + if (c === 92) { + exit = 2; } - } else if (c !== 124) { - return ident_or_keyword(get_string()); + } else if (c >= 33) { + switch (c) { + case 34 : + case 39 : + case 40 : + case 41 : + case 44 : + case 46 : + case 48 : + case 49 : + case 50 : + case 51 : + case 52 : + case 53 : + case 54 : + case 55 : + case 56 : + case 57 : + case 59 : + break; + case 33 : + case 35 : + case 36 : + case 37 : + case 38 : + case 42 : + case 43 : + case 45 : + case 47 : + case 58 : + case 60 : + case 61 : + case 62 : + case 63 : + case 64 : + exit = 2; + break; + + } } - - } else if (c >= 65) { - if (c !== 92) { - return ident_or_keyword(get_string()); + if (exit === 2) { + Stream.junk(strm__); + store(c); + continue; } - } else { - if (c < 33) { - return ident_or_keyword(get_string()); - } - switch (c) { - case 34 : - case 39 : - case 40 : - case 41 : - case 44 : - case 46 : - case 48 : - case 49 : - case 50 : - case 51 : - case 52 : - case 53 : - case 54 : - case 55 : - case 56 : - case 57 : - case 59 : - return ident_or_keyword(get_string()); - case 33 : - case 35 : - case 36 : - case 37 : - case 38 : - case 42 : - case 43 : - case 45 : - case 47 : - case 58 : - case 60 : - case 61 : - case 62 : - case 63 : - case 64 : - break; - - } } - Stream.junk(strm__); - store(c); - continue; + return ident_or_keyword(get_string()); }; }; let number = function (strm__) { while(true) { let c = Stream.peek(strm__); if (c !== undefined) { + let exit = 0; if (c >= 58) { if (!(c !== 69 && c !== 101)) { - Stream.junk(strm__); - store(/* 'E' */69); - return exponent_part(strm__); + exit = 2; } } else if (c !== 46) { @@ -427,6 +434,12 @@ function make_lexer(keywords) { }; }; } + if (exit === 2) { + Stream.junk(strm__); + store(/* 'E' */69); + return exponent_part(strm__); + } + } return { TAG: "Int", @@ -436,13 +449,15 @@ function make_lexer(keywords) { }; let exponent_part = function (strm__) { let c = Stream.peek(strm__); - if (c !== undefined && !(c !== 43 && c !== 45)) { - Stream.junk(strm__); - store(c); + if (c === undefined) { return end_exponent_part(strm__); - } else { + } + if (c !== 43 && c !== 45) { return end_exponent_part(strm__); } + Stream.junk(strm__); + store(c); + return end_exponent_part(strm__); }; let end_exponent_part = function (strm__) { while(true) { @@ -677,4 +692,4 @@ function make_lexer(keywords) { export { make_lexer, } -/* No side effect */ +/* Hashtbl Not a pure module */ diff --git a/lib/es6/hashtbl.js b/lib/es6/hashtbl.js index 2c8e299fc1..a409284a6d 100644 --- a/lib/es6/hashtbl.js +++ b/lib/es6/hashtbl.js @@ -1,14 +1,14 @@ import * as Caml from "./caml.js"; +import * as Lazy from "./lazy.js"; import * as $$Array from "./array.js"; -import * as Curry from "./curry.js"; import * as Random from "./random.js"; import * as Caml_obj from "./caml_obj.js"; import * as Caml_hash from "./caml_hash.js"; import * as Caml_array from "./caml_array.js"; -import * as Pervasives from "./pervasives.js"; import * as Caml_option from "./caml_option.js"; +import * as PervasivesU from "./pervasivesU.js"; import * as CamlinternalLazy from "./camlinternalLazy.js"; function hash(x) { @@ -31,15 +31,15 @@ let randomized = { contents: false }; -function randomize(param) { +function randomize() { randomized.contents = true; } -function is_randomized(param) { +function is_randomized() { return randomized.contents; } -let prng = CamlinternalLazy.from_fun(function () { +let prng = Lazy.from_fun(function () { return Random.State.make_self_init(); }); @@ -79,11 +79,11 @@ function clear(h) { function reset(h) { let len = h.data.length; - if (len === Pervasives.abs(h.initial_size)) { + if (len === PervasivesU.abs(h.initial_size)) { return clear(h); } else { h.size = 0; - h.data = Caml_array.make(Pervasives.abs(h.initial_size), "Empty"); + h.data = Caml_array.make(PervasivesU.abs(h.initial_size), "Empty"); return; } } @@ -178,7 +178,7 @@ function resize(indexfun, h) { data: data, next: "Empty" }); - let nidx = Curry._2(indexfun, h, key); + let nidx = indexfun(h, key); let tail = Caml_array.get(ndata_tail, nidx); if (typeof tail !== "object") { Caml_array.set(ndata, nidx, cell); @@ -450,7 +450,7 @@ function iter(f, h) { let key = param.key; let data = param.data; let next = param.next; - Curry._2(f, key, data); + f(key, data); _param = next; continue; }; @@ -498,7 +498,7 @@ function filter_map_inplace_bucket(f, h, i, _prec, _param) { let key = param.key; let data = param.data; let next = param.next; - let data$1 = Curry._2(f, key, data); + let data$1 = f(key, data); if (data$1 !== undefined) { if (typeof prec !== "object") { Caml_array.set(h.data, i, param); @@ -552,7 +552,7 @@ function fold(f, h, init) { let key = b.key; let data = b.data; let next = b.next; - _accu = Curry._3(f, key, data, accu); + _accu = f(key, data, accu); _b = next; continue; }; @@ -618,7 +618,7 @@ function stats(h) { function MakeSeeded(H) { let key_index = function (h, key) { - return Curry._2(H.hash, h.seed, key) & (h.data.length - 1 | 0); + return H.hash(h.seed, key) & (h.data.length - 1 | 0); }; let add = function (h, key, data) { let i = key_index(h, key); @@ -647,7 +647,7 @@ function MakeSeeded(H) { } let k = param.key; let next = param.next; - if (Curry._2(H.equal, k, key)) { + if (H.equal(k, key)) { h.size = h.size - 1 | 0; if (typeof prec !== "object") { return Caml_array.set(h.data, i, next); @@ -673,7 +673,7 @@ function MakeSeeded(H) { let k1 = match.key; let d1 = match.data; let next1 = match.next; - if (Curry._2(H.equal, key, k1)) { + if (H.equal(key, k1)) { return d1; } if (typeof next1 !== "object") { @@ -686,7 +686,7 @@ function MakeSeeded(H) { let k2 = next1.key; let d2 = next1.data; let next2 = next1.next; - if (Curry._2(H.equal, key, k2)) { + if (H.equal(key, k2)) { return d2; } if (typeof next2 !== "object") { @@ -699,7 +699,7 @@ function MakeSeeded(H) { let k3 = next2.key; let d3 = next2.data; let next3 = next2.next; - if (Curry._2(H.equal, key, k3)) { + if (H.equal(key, k3)) { return d3; } else { let _param = next3; @@ -715,7 +715,7 @@ function MakeSeeded(H) { let k = param.key; let data = param.data; let next = param.next; - if (Curry._2(H.equal, key, k)) { + if (H.equal(key, k)) { return data; } _param = next; @@ -731,7 +731,7 @@ function MakeSeeded(H) { let k1 = match.key; let d1 = match.data; let next1 = match.next; - if (Curry._2(H.equal, key, k1)) { + if (H.equal(key, k1)) { return Caml_option.some(d1); } if (typeof next1 !== "object") { @@ -740,7 +740,7 @@ function MakeSeeded(H) { let k2 = next1.key; let d2 = next1.data; let next2 = next1.next; - if (Curry._2(H.equal, key, k2)) { + if (H.equal(key, k2)) { return Caml_option.some(d2); } if (typeof next2 !== "object") { @@ -749,7 +749,7 @@ function MakeSeeded(H) { let k3 = next2.key; let d3 = next2.data; let next3 = next2.next; - if (Curry._2(H.equal, key, k3)) { + if (H.equal(key, k3)) { return Caml_option.some(d3); } else { let _param = next3; @@ -761,7 +761,7 @@ function MakeSeeded(H) { let k = param.key; let data = param.data; let next = param.next; - if (Curry._2(H.equal, key, k)) { + if (H.equal(key, k)) { return Caml_option.some(data); } _param = next; @@ -779,7 +779,7 @@ function MakeSeeded(H) { let k = param.key; let d = param.data; let next = param.next; - if (Curry._2(H.equal, k, key)) { + if (H.equal(k, key)) { return { hd: d, tl: find_in_bucket(next) @@ -799,7 +799,7 @@ function MakeSeeded(H) { } let k = param.key; let next = param.next; - if (Curry._2(H.equal, k, key)) { + if (H.equal(k, key)) { param.key = key; param.data = data; return false; @@ -836,7 +836,7 @@ function MakeSeeded(H) { } let k = param.key; let next = param.next; - if (Curry._2(H.equal, k, key)) { + if (H.equal(k, key)) { return true; } _param = next; @@ -866,7 +866,7 @@ function MakeSeeded(H) { function Make(H) { let equal = H.equal; let key_index = function (h, key) { - return Curry._1(H.hash, key) & (h.data.length - 1 | 0); + return H.hash(key) & (h.data.length - 1 | 0); }; let add = function (h, key, data) { let i = key_index(h, key); @@ -895,7 +895,7 @@ function Make(H) { } let k = param.key; let next = param.next; - if (Curry._2(equal, k, key)) { + if (equal(k, key)) { h.size = h.size - 1 | 0; if (typeof prec !== "object") { return Caml_array.set(h.data, i, next); @@ -921,7 +921,7 @@ function Make(H) { let k1 = match.key; let d1 = match.data; let next1 = match.next; - if (Curry._2(equal, key, k1)) { + if (equal(key, k1)) { return d1; } if (typeof next1 !== "object") { @@ -934,7 +934,7 @@ function Make(H) { let k2 = next1.key; let d2 = next1.data; let next2 = next1.next; - if (Curry._2(equal, key, k2)) { + if (equal(key, k2)) { return d2; } if (typeof next2 !== "object") { @@ -947,7 +947,7 @@ function Make(H) { let k3 = next2.key; let d3 = next2.data; let next3 = next2.next; - if (Curry._2(equal, key, k3)) { + if (equal(key, k3)) { return d3; } else { let _param = next3; @@ -963,7 +963,7 @@ function Make(H) { let k = param.key; let data = param.data; let next = param.next; - if (Curry._2(equal, key, k)) { + if (equal(key, k)) { return data; } _param = next; @@ -979,7 +979,7 @@ function Make(H) { let k1 = match.key; let d1 = match.data; let next1 = match.next; - if (Curry._2(equal, key, k1)) { + if (equal(key, k1)) { return Caml_option.some(d1); } if (typeof next1 !== "object") { @@ -988,7 +988,7 @@ function Make(H) { let k2 = next1.key; let d2 = next1.data; let next2 = next1.next; - if (Curry._2(equal, key, k2)) { + if (equal(key, k2)) { return Caml_option.some(d2); } if (typeof next2 !== "object") { @@ -997,7 +997,7 @@ function Make(H) { let k3 = next2.key; let d3 = next2.data; let next3 = next2.next; - if (Curry._2(equal, key, k3)) { + if (equal(key, k3)) { return Caml_option.some(d3); } else { let _param = next3; @@ -1009,7 +1009,7 @@ function Make(H) { let k = param.key; let data = param.data; let next = param.next; - if (Curry._2(equal, key, k)) { + if (equal(key, k)) { return Caml_option.some(data); } _param = next; @@ -1027,7 +1027,7 @@ function Make(H) { let k = param.key; let d = param.data; let next = param.next; - if (Curry._2(equal, k, key)) { + if (equal(k, key)) { return { hd: d, tl: find_in_bucket(next) @@ -1047,7 +1047,7 @@ function Make(H) { } let k = param.key; let next = param.next; - if (Curry._2(equal, k, key)) { + if (equal(k, key)) { param.key = key; param.data = data; return false; @@ -1084,7 +1084,7 @@ function Make(H) { } let k = param.key; let next = param.next; - if (Curry._2(equal, k, key)) { + if (equal(k, key)) { return true; } _param = next; @@ -1142,4 +1142,4 @@ export { hash_param, seeded_hash_param, } -/* No side effect */ +/* prng Not a pure module */ diff --git a/lib/es6/hashtblLabels.js b/lib/es6/hashtblLabels.js index 168edfb9c1..9b3a3844a1 100644 --- a/lib/es6/hashtblLabels.js +++ b/lib/es6/hashtblLabels.js @@ -1,22 +1,31 @@ -import * as Curry from "./curry.js"; import * as Hashtbl from "./hashtbl.js"; -let add = Hashtbl.add; +function add(tbl, key, data) { + Hashtbl.add(tbl, key, data); +} -let replace = Hashtbl.replace; +function replace(tbl, key, data) { + Hashtbl.replace(tbl, key, data); +} function iter(f, tbl) { - Hashtbl.iter(Curry.__2(f), tbl); + Hashtbl.iter((function (key, data) { + f(key, data); + }), tbl); } function filter_map_inplace(f, tbl) { - Hashtbl.filter_map_inplace(Curry.__2(f), tbl); + Hashtbl.filter_map_inplace((function (key, data) { + return f(key, data); + }), tbl); } function fold(f, tbl, init) { - return Hashtbl.fold(Curry.__3(f), tbl, init); + return Hashtbl.fold((function (key, data, acc) { + return f(key, data, acc); + }), tbl, init); } function MakeSeeded(H) { @@ -26,16 +35,26 @@ function MakeSeeded(H) { let iter = include.iter; let filter_map_inplace = include.filter_map_inplace; let fold = include.fold; - let add$1 = Curry.__3(add); - let replace$1 = Curry.__3(replace); + let add$1 = function (tbl, key, data) { + add(tbl, key, data); + }; + let replace$1 = function (tbl, key, data) { + replace(tbl, key, data); + }; let iter$1 = function (f, tbl) { - Curry._2(iter, Curry.__2(f), tbl); + iter((function (key, data) { + f(key, data); + }), tbl); }; let filter_map_inplace$1 = function (f, tbl) { - Curry._2(filter_map_inplace, Curry.__2(f), tbl); + filter_map_inplace((function (key, data) { + return f(key, data); + }), tbl); }; let fold$1 = function (f, tbl, init) { - return Curry._3(fold, Curry.__3(f), tbl, init); + return fold((function (key, data, acc) { + return f(key, data, acc); + }), tbl, init); }; return { create: include.create, @@ -59,7 +78,7 @@ function MakeSeeded(H) { function Make(H) { let hash = function (_seed, x) { - return Curry._1(H.hash, x); + return H.hash(x); }; let H_equal = H.equal; let H$1 = { @@ -73,19 +92,29 @@ function Make(H) { let iter = include.iter; let filter_map_inplace = include.filter_map_inplace; let fold = include.fold; - let add$1 = Curry.__3(add); - let replace$1 = Curry.__3(replace); + let add$1 = function (tbl, key, data) { + add(tbl, key, data); + }; + let replace$1 = function (tbl, key, data) { + replace(tbl, key, data); + }; let iter$1 = function (f, tbl) { - Curry._2(iter, Curry.__2(f), tbl); + iter((function (key, data) { + f(key, data); + }), tbl); }; let filter_map_inplace$1 = function (f, tbl) { - Curry._2(filter_map_inplace, Curry.__2(f), tbl); + filter_map_inplace((function (key, data) { + return f(key, data); + }), tbl); }; let fold$1 = function (f, tbl, init) { - return Curry._3(fold, Curry.__3(f), tbl, init); + return fold((function (key, data, acc) { + return f(key, data, acc); + }), tbl, init); }; let create$1 = function (sz) { - return Curry._2(create, false, sz); + return create(false, sz); }; return { create: create$1, @@ -167,4 +196,4 @@ export { MakeSeeded, Make, } -/* No side effect */ +/* Hashtbl Not a pure module */ diff --git a/lib/es6/js_array.js b/lib/es6/js_array.js index 9a90149cb2..83191f169c 100644 --- a/lib/es6/js_array.js +++ b/lib/es6/js_array.js @@ -1,6 +1,5 @@ -import * as Curry from "./curry.js"; import * as Caml_option from "./caml_option.js"; import * as Caml_splice_call from "./caml_splice_call.js"; @@ -37,7 +36,7 @@ function pushMany(arg1, obj) { } function sortInPlaceWith(arg1, obj) { - return obj.sort(Curry.__2(arg1)); + return obj.sort(arg1); } function spliceInPlace(pos, remove, add, obj) { @@ -105,75 +104,75 @@ function sliceFrom(arg1, obj) { } function every(arg1, obj) { - return obj.every(Curry.__1(arg1)); + return obj.every(arg1); } function everyi(arg1, obj) { - return obj.every(Curry.__2(arg1)); + return obj.every(arg1); } function filter(arg1, obj) { - return obj.filter(Curry.__1(arg1)); + return obj.filter(arg1); } function filteri(arg1, obj) { - return obj.filter(Curry.__2(arg1)); + return obj.filter(arg1); } function find(arg1, obj) { - return Caml_option.undefined_to_opt(obj.find(Curry.__1(arg1))); + return Caml_option.undefined_to_opt(obj.find(arg1)); } function findi(arg1, obj) { - return Caml_option.undefined_to_opt(obj.find(Curry.__2(arg1))); + return Caml_option.undefined_to_opt(obj.find(arg1)); } function findIndex(arg1, obj) { - return obj.findIndex(Curry.__1(arg1)); + return obj.findIndex(arg1); } function findIndexi(arg1, obj) { - return obj.findIndex(Curry.__2(arg1)); + return obj.findIndex(arg1); } function forEach(arg1, obj) { - obj.forEach(Curry.__1(arg1)); + obj.forEach(arg1); } function forEachi(arg1, obj) { - obj.forEach(Curry.__2(arg1)); + obj.forEach(arg1); } function map(arg1, obj) { - return obj.map(Curry.__1(arg1)); + return obj.map(arg1); } function mapi(arg1, obj) { - return obj.map(Curry.__2(arg1)); + return obj.map(arg1); } function reduce(arg1, arg2, obj) { - return obj.reduce(Curry.__2(arg1), arg2); + return obj.reduce(arg1, arg2); } function reducei(arg1, arg2, obj) { - return obj.reduce(Curry.__3(arg1), arg2); + return obj.reduce(arg1, arg2); } function reduceRight(arg1, arg2, obj) { - return obj.reduceRight(Curry.__2(arg1), arg2); + return obj.reduceRight(arg1, arg2); } function reduceRighti(arg1, arg2, obj) { - return obj.reduceRight(Curry.__3(arg1), arg2); + return obj.reduceRight(arg1, arg2); } function some(arg1, obj) { - return obj.some(Curry.__1(arg1)); + return obj.some(arg1); } function somei(arg1, obj) { - return obj.some(Curry.__2(arg1)); + return obj.some(arg1); } export { diff --git a/lib/es6/js_string.js b/lib/es6/js_string.js index 22c26408bb..0346faf3c4 100644 --- a/lib/es6/js_string.js +++ b/lib/es6/js_string.js @@ -1,6 +1,5 @@ -import * as Curry from "./curry.js"; import * as Caml_option from "./caml_option.js"; import * as Caml_splice_call from "./caml_splice_call.js"; @@ -81,19 +80,19 @@ function replaceByRe(arg1, arg2, obj) { } function unsafeReplaceBy0(arg1, arg2, obj) { - return obj.replace(arg1, Curry.__3(arg2)); + return obj.replace(arg1, arg2); } function unsafeReplaceBy1(arg1, arg2, obj) { - return obj.replace(arg1, Curry.__4(arg2)); + return obj.replace(arg1, arg2); } function unsafeReplaceBy2(arg1, arg2, obj) { - return obj.replace(arg1, Curry.__5(arg2)); + return obj.replace(arg1, arg2); } function unsafeReplaceBy3(arg1, arg2, obj) { - return obj.replace(arg1, Curry.__6(arg2)); + return obj.replace(arg1, arg2); } function search(arg1, obj) { diff --git a/lib/es6/lazy.js b/lib/es6/lazy.js index 1adb9d296b..9153ac974b 100644 --- a/lib/es6/lazy.js +++ b/lib/es6/lazy.js @@ -1,15 +1,16 @@ -import * as Curry from "./curry.js"; import * as CamlinternalLazy from "./camlinternalLazy.js"; function from_fun(f) { return CamlinternalLazy.from_fun(function () { - return Curry._1(f, undefined); + return f(); }); } -let from_val = CamlinternalLazy.from_val; +function from_val(v) { + return CamlinternalLazy.from_val(v); +} let Undefined = CamlinternalLazy.Undefined; diff --git a/lib/es6/lexing.js b/lib/es6/lexing.js index 68c6aedf48..e2f6ccdb75 100644 --- a/lib/es6/lexing.js +++ b/lib/es6/lexing.js @@ -1,7 +1,6 @@ import * as Bytes from "./bytes.js"; -import * as Curry from "./curry.js"; import * as Caml_array from "./caml_array.js"; import * as Caml_bytes from "./caml_bytes.js"; import * as Caml_lexer from "./caml_lexer.js"; @@ -47,7 +46,7 @@ function from_function(f) { return { refill_buff: (function (x) { let aux_buffer = Caml_bytes.create(512); - let read = Curry._2(f, aux_buffer, aux_buffer.length); + let read = f(aux_buffer, aux_buffer.length); let n = read > 0 ? read : (x.lex_eof_reached = true, 0); if ((x.lex_buffer_len + n | 0) > x.lex_buffer.length) { if (((x.lex_buffer_len - x.lex_start_pos | 0) + n | 0) <= x.lex_buffer.length) { diff --git a/lib/es6/list.js b/lib/es6/list.js index 679fc2fd40..929512878e 100644 --- a/lib/es6/list.js +++ b/lib/es6/list.js @@ -1,9 +1,8 @@ -import * as Curry from "./curry.js"; import * as Caml_obj from "./caml_obj.js"; -import * as Pervasives from "./pervasives.js"; import * as Caml_option from "./caml_option.js"; +import * as PervasivesU from "./pervasivesU.js"; function length(l) { let _len = 0; @@ -137,7 +136,7 @@ function init_tailrec_aux(_acc, _i, n, f) { } _i = i + 1 | 0; _acc = { - hd: Curry._1(f, i), + hd: f(i), tl: acc }; continue; @@ -148,7 +147,7 @@ function init_aux(i, n, f) { if (i >= n) { return /* [] */0; } - let r = Curry._1(f, i); + let r = f(i); return { hd: r, tl: init_aux(i + 1 | 0, n, f) @@ -156,24 +155,24 @@ function init_aux(i, n, f) { } function init(len, f) { - if (len < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.init" - } - }); - } - if (len > 10000) { - return rev_append(init_tailrec_aux(/* [] */0, 0, len, f), /* [] */0); - } else { - return init_aux(0, len, f); + if (len >= 0) { + if (len > 10000) { + return rev_append(init_tailrec_aux(/* [] */0, 0, len, f), /* [] */0); + } else { + return init_aux(0, len, f); + } } + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "List.init" + } + }); } function flatten(param) { if (param) { - return Pervasives.$at(param.hd, flatten(param.tl)); + return PervasivesU.$at(param.hd, flatten(param.tl)); } else { return /* [] */0; } @@ -183,7 +182,7 @@ function map(f, param) { if (!param) { return /* [] */0; } - let r = Curry._1(f, param.hd); + let r = f(param.hd); return { hd: r, tl: map(f, param.tl) @@ -194,7 +193,7 @@ function mapi(i, f, param) { if (!param) { return /* [] */0; } - let r = Curry._2(f, i, param.hd); + let r = f(i, param.hd); return { hd: r, tl: mapi(i + 1 | 0, f, param.tl) @@ -216,7 +215,7 @@ function rev_map(f, l) { } _param = param.tl; _accu = { - hd: Curry._1(f, param.hd), + hd: f(param.hd), tl: accu }; continue; @@ -229,7 +228,7 @@ function iter(f, _param) { if (!param) { return; } - Curry._1(f, param.hd); + f(param.hd); _param = param.tl; continue; }; @@ -244,7 +243,7 @@ function iteri(f, l) { if (!param) { return; } - Curry._2(f, i, param.hd); + f(i, param.hd); _param = param.tl; _i = i + 1 | 0; continue; @@ -259,14 +258,14 @@ function fold_left(f, _accu, _l) { return accu; } _l = l.tl; - _accu = Curry._2(f, accu, l.hd); + _accu = f(accu, l.hd); continue; }; } function fold_right(f, l, accu) { if (l) { - return Curry._2(f, l.hd, fold_right(f, l.tl, accu)); + return f(l.hd, fold_right(f, l.tl, accu)); } else { return accu; } @@ -275,7 +274,7 @@ function fold_right(f, l, accu) { function map2(f, l1, l2) { if (l1) { if (l2) { - let r = Curry._2(f, l1.hd, l2.hd); + let r = f(l1.hd, l2.hd); return { hd: r, tl: map2(f, l1.tl, l2.tl) @@ -312,7 +311,7 @@ function rev_map2(f, l1, l2) { _l2 = l2$1.tl; _l1 = l1$1.tl; _accu = { - hd: Curry._2(f, l1$1.hd, l2$1.hd), + hd: f(l1$1.hd, l2$1.hd), tl: accu }; continue; @@ -324,15 +323,15 @@ function rev_map2(f, l1, l2) { } }); } - if (l2$1) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2" - } - }); + if (!l2$1) { + return accu; } - return accu; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2" + } + }); }; } @@ -342,7 +341,7 @@ function iter2(f, _l1, _l2) { let l1 = _l1; if (l1) { if (l2) { - Curry._2(f, l1.hd, l2.hd); + f(l1.hd, l2.hd); _l2 = l2.tl; _l1 = l1.tl; continue; @@ -375,7 +374,7 @@ function fold_left2(f, _accu, _l1, _l2) { if (l2) { _l2 = l2.tl; _l1 = l1.tl; - _accu = Curry._3(f, accu, l1.hd, l2.hd); + _accu = f(accu, l1.hd, l2.hd); continue; } throw new Error("Invalid_argument", { @@ -385,22 +384,22 @@ function fold_left2(f, _accu, _l1, _l2) { } }); } - if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_left2" - } - }); + if (!l2) { + return accu; } - return accu; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2" + } + }); }; } function fold_right2(f, l1, l2, accu) { if (l1) { if (l2) { - return Curry._3(f, l1.hd, l2.hd, fold_right2(f, l1.tl, l2.tl, accu)); + return f(l1.hd, l2.hd, fold_right2(f, l1.tl, l2.tl, accu)); } throw new Error("Invalid_argument", { cause: { @@ -409,15 +408,15 @@ function fold_right2(f, l1, l2, accu) { } }); } - if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2" - } - }); + if (!l2) { + return accu; } - return accu; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2" + } + }); } function for_all(p, _param) { @@ -426,7 +425,7 @@ function for_all(p, _param) { if (!param) { return true; } - if (!Curry._1(p, param.hd)) { + if (!p(param.hd)) { return false; } _param = param.tl; @@ -440,7 +439,7 @@ function exists(p, _param) { if (!param) { return false; } - if (Curry._1(p, param.hd)) { + if (p(param.hd)) { return true; } _param = param.tl; @@ -454,7 +453,7 @@ function for_all2(p, _l1, _l2) { let l1 = _l1; if (l1) { if (l2) { - if (!Curry._2(p, l1.hd, l2.hd)) { + if (!p(l1.hd, l2.hd)) { return false; } _l2 = l2.tl; @@ -486,7 +485,7 @@ function exists2(p, _l1, _l2) { let l1 = _l1; if (l1) { if (l2) { - if (Curry._2(p, l1.hd, l2.hd)) { + if (p(l1.hd, l2.hd)) { return true; } _l2 = l2.tl; @@ -673,7 +672,7 @@ function find(p, _param) { let param = _param; if (param) { let x = param.hd; - if (Curry._1(p, x)) { + if (p(x)) { return x; } _param = param.tl; @@ -694,7 +693,7 @@ function find_opt(p, _param) { return; } let x = param.hd; - if (Curry._1(p, x)) { + if (p(x)) { return Caml_option.some(x); } _param = param.tl; @@ -713,7 +712,7 @@ function find_all(p, l) { } let l$1 = param.tl; let x = param.hd; - if (Curry._1(p, x)) { + if (p(x)) { _param = l$1; _accu = { hd: x, @@ -742,7 +741,7 @@ function partition(p, l) { } let l$1 = param.tl; let x = param.hd; - if (Curry._1(p, x)) { + if (p(x)) { _param = l$1; _yes = { hd: x, @@ -818,7 +817,7 @@ function merge(cmp, l1, l2) { } let h2 = l2.hd; let h1 = l1.hd; - if (Curry._2(cmp, h1, h2) <= 0) { + if (cmp(h1, h2) <= 0) { return { hd: h1, tl: merge(cmp, l1.tl, l2) @@ -867,8 +866,8 @@ function stable_sort(cmp, l) { let x3 = match$1.hd; let x2 = match.hd; let x1 = l.hd; - if (Curry._2(cmp, x1, x2) <= 0) { - if (Curry._2(cmp, x2, x3) <= 0) { + if (cmp(x1, x2) <= 0) { + if (cmp(x2, x3) <= 0) { return { hd: x1, tl: { @@ -879,7 +878,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x1, x3) <= 0) { + } else if (cmp(x1, x3) <= 0) { return { hd: x1, tl: { @@ -902,7 +901,7 @@ function stable_sort(cmp, l) { } }; } - } else if (Curry._2(cmp, x1, x3) <= 0) { + } else if (cmp(x1, x3) <= 0) { return { hd: x2, tl: { @@ -913,7 +912,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x2, x3) <= 0) { + } else if (cmp(x2, x3) <= 0) { return { hd: x2, tl: { @@ -947,7 +946,7 @@ function stable_sort(cmp, l) { if (match$2) { let x2$1 = match$2.hd; let x1$1 = l.hd; - if (Curry._2(cmp, x1$1, x2$1) <= 0) { + if (cmp(x1$1, x2$1) <= 0) { return { hd: x1$1, tl: { @@ -987,7 +986,7 @@ function stable_sort(cmp, l) { } let h2 = l2$1.hd; let h1 = l1.hd; - if (Curry._2(cmp, h1, h2) > 0) { + if (cmp(h1, h2) > 0) { _accu = { hd: h1, tl: accu @@ -1013,8 +1012,8 @@ function stable_sort(cmp, l) { let x3 = match$1.hd; let x2 = match.hd; let x1 = l.hd; - if (Curry._2(cmp, x1, x2) > 0) { - if (Curry._2(cmp, x2, x3) > 0) { + if (cmp(x1, x2) > 0) { + if (cmp(x2, x3) > 0) { return { hd: x1, tl: { @@ -1025,7 +1024,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x1, x3) > 0) { + } else if (cmp(x1, x3) > 0) { return { hd: x1, tl: { @@ -1048,7 +1047,7 @@ function stable_sort(cmp, l) { } }; } - } else if (Curry._2(cmp, x1, x3) > 0) { + } else if (cmp(x1, x3) > 0) { return { hd: x2, tl: { @@ -1059,7 +1058,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x2, x3) > 0) { + } else if (cmp(x2, x3) > 0) { return { hd: x2, tl: { @@ -1093,7 +1092,7 @@ function stable_sort(cmp, l) { if (match$2) { let x2$1 = match$2.hd; let x1$1 = l.hd; - if (Curry._2(cmp, x1$1, x2$1) > 0) { + if (cmp(x1$1, x2$1) > 0) { return { hd: x1$1, tl: { @@ -1133,7 +1132,7 @@ function stable_sort(cmp, l) { } let h2 = l2$1.hd; let h1 = l1.hd; - if (Curry._2(cmp, h1, h2) <= 0) { + if (cmp(h1, h2) <= 0) { _accu = { hd: h1, tl: accu @@ -1168,9 +1167,9 @@ function sort_uniq(cmp, l) { let x3 = match$1.hd; let x2 = match.hd; let x1 = l.hd; - let c = Curry._2(cmp, x1, x2); + let c = cmp(x1, x2); if (c === 0) { - let c$1 = Curry._2(cmp, x2, x3); + let c$1 = cmp(x2, x3); if (c$1 === 0) { return { hd: x2, @@ -1195,7 +1194,7 @@ function sort_uniq(cmp, l) { } } if (c < 0) { - let c$2 = Curry._2(cmp, x2, x3); + let c$2 = cmp(x2, x3); if (c$2 === 0) { return { hd: x1, @@ -1217,7 +1216,7 @@ function sort_uniq(cmp, l) { } }; } - let c$3 = Curry._2(cmp, x1, x3); + let c$3 = cmp(x1, x3); if (c$3 === 0) { return { hd: x1, @@ -1250,7 +1249,7 @@ function sort_uniq(cmp, l) { }; } } - let c$4 = Curry._2(cmp, x1, x3); + let c$4 = cmp(x1, x3); if (c$4 === 0) { return { hd: x2, @@ -1272,7 +1271,7 @@ function sort_uniq(cmp, l) { } }; } - let c$5 = Curry._2(cmp, x2, x3); + let c$5 = cmp(x2, x3); if (c$5 === 0) { return { hd: x2, @@ -1315,7 +1314,7 @@ function sort_uniq(cmp, l) { if (match$2) { let x2$1 = match$2.hd; let x1$1 = l.hd; - let c$6 = Curry._2(cmp, x1$1, x2$1); + let c$6 = cmp(x1$1, x2$1); if (c$6 === 0) { return { hd: x1$1, @@ -1363,7 +1362,7 @@ function sort_uniq(cmp, l) { let h2 = l2$1.hd; let t1 = l1.tl; let h1 = l1.hd; - let c$7 = Curry._2(cmp, h1, h2); + let c$7 = cmp(h1, h2); if (c$7 === 0) { _accu = { hd: h1, @@ -1399,9 +1398,9 @@ function sort_uniq(cmp, l) { let x3 = match$1.hd; let x2 = match.hd; let x1 = l.hd; - let c = Curry._2(cmp, x1, x2); + let c = cmp(x1, x2); if (c === 0) { - let c$1 = Curry._2(cmp, x2, x3); + let c$1 = cmp(x2, x3); if (c$1 === 0) { return { hd: x2, @@ -1426,7 +1425,7 @@ function sort_uniq(cmp, l) { } } if (c > 0) { - let c$2 = Curry._2(cmp, x2, x3); + let c$2 = cmp(x2, x3); if (c$2 === 0) { return { hd: x1, @@ -1448,7 +1447,7 @@ function sort_uniq(cmp, l) { } }; } - let c$3 = Curry._2(cmp, x1, x3); + let c$3 = cmp(x1, x3); if (c$3 === 0) { return { hd: x1, @@ -1481,7 +1480,7 @@ function sort_uniq(cmp, l) { }; } } - let c$4 = Curry._2(cmp, x1, x3); + let c$4 = cmp(x1, x3); if (c$4 === 0) { return { hd: x2, @@ -1503,7 +1502,7 @@ function sort_uniq(cmp, l) { } }; } - let c$5 = Curry._2(cmp, x2, x3); + let c$5 = cmp(x2, x3); if (c$5 === 0) { return { hd: x2, @@ -1546,7 +1545,7 @@ function sort_uniq(cmp, l) { if (match$2) { let x2$1 = match$2.hd; let x1$1 = l.hd; - let c$6 = Curry._2(cmp, x1$1, x2$1); + let c$6 = cmp(x1$1, x2$1); if (c$6 === 0) { return { hd: x1$1, @@ -1594,7 +1593,7 @@ function sort_uniq(cmp, l) { let h2 = l2$1.hd; let t1 = l1.tl; let h1 = l1.hd; - let c$7 = Curry._2(cmp, h1, h2); + let c$7 = cmp(h1, h2); if (c$7 === 0) { _accu = { hd: h1, @@ -1670,7 +1669,7 @@ function compare_length_with(_l, _n) { }; } -let append = Pervasives.$at; +let append = PervasivesU.$at; let concat = flatten; diff --git a/lib/es6/listLabels.js b/lib/es6/listLabels.js index 78e516c64d..60c1eafb66 100644 --- a/lib/es6/listLabels.js +++ b/lib/es6/listLabels.js @@ -1,9 +1,8 @@ -import * as Curry from "./curry.js"; import * as Caml_obj from "./caml_obj.js"; -import * as Pervasives from "./pervasives.js"; import * as Caml_option from "./caml_option.js"; +import * as PervasivesU from "./pervasivesU.js"; function length(l) { let _len = 0; @@ -137,7 +136,7 @@ function init_tailrec_aux(_acc, _i, n, f) { } _i = i + 1 | 0; _acc = { - hd: Curry._1(f, i), + hd: f(i), tl: acc }; continue; @@ -148,7 +147,7 @@ function init_aux(i, n, f) { if (i >= n) { return /* [] */0; } - let r = Curry._1(f, i); + let r = f(i); return { hd: r, tl: init_aux(i + 1 | 0, n, f) @@ -156,24 +155,24 @@ function init_aux(i, n, f) { } function init(len, f) { - if (len < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.init" - } - }); - } - if (len > 10000) { - return rev_append(init_tailrec_aux(/* [] */0, 0, len, f), /* [] */0); - } else { - return init_aux(0, len, f); + if (len >= 0) { + if (len > 10000) { + return rev_append(init_tailrec_aux(/* [] */0, 0, len, f), /* [] */0); + } else { + return init_aux(0, len, f); + } } + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "List.init" + } + }); } function flatten(param) { if (param) { - return Pervasives.$at(param.hd, flatten(param.tl)); + return PervasivesU.$at(param.hd, flatten(param.tl)); } else { return /* [] */0; } @@ -183,7 +182,7 @@ function map(f, param) { if (!param) { return /* [] */0; } - let r = Curry._1(f, param.hd); + let r = f(param.hd); return { hd: r, tl: map(f, param.tl) @@ -194,7 +193,7 @@ function mapi(i, f, param) { if (!param) { return /* [] */0; } - let r = Curry._2(f, i, param.hd); + let r = f(i, param.hd); return { hd: r, tl: mapi(i + 1 | 0, f, param.tl) @@ -216,7 +215,7 @@ function rev_map(f, l) { } _param = param.tl; _accu = { - hd: Curry._1(f, param.hd), + hd: f(param.hd), tl: accu }; continue; @@ -229,7 +228,7 @@ function iter(f, _param) { if (!param) { return; } - Curry._1(f, param.hd); + f(param.hd); _param = param.tl; continue; }; @@ -244,7 +243,7 @@ function iteri(f, l) { if (!param) { return; } - Curry._2(f, i, param.hd); + f(i, param.hd); _param = param.tl; _i = i + 1 | 0; continue; @@ -259,14 +258,14 @@ function fold_left(f, _accu, _l) { return accu; } _l = l.tl; - _accu = Curry._2(f, accu, l.hd); + _accu = f(accu, l.hd); continue; }; } function fold_right(f, l, accu) { if (l) { - return Curry._2(f, l.hd, fold_right(f, l.tl, accu)); + return f(l.hd, fold_right(f, l.tl, accu)); } else { return accu; } @@ -275,7 +274,7 @@ function fold_right(f, l, accu) { function map2(f, l1, l2) { if (l1) { if (l2) { - let r = Curry._2(f, l1.hd, l2.hd); + let r = f(l1.hd, l2.hd); return { hd: r, tl: map2(f, l1.tl, l2.tl) @@ -312,7 +311,7 @@ function rev_map2(f, l1, l2) { _l2 = l2$1.tl; _l1 = l1$1.tl; _accu = { - hd: Curry._2(f, l1$1.hd, l2$1.hd), + hd: f(l1$1.hd, l2$1.hd), tl: accu }; continue; @@ -324,15 +323,15 @@ function rev_map2(f, l1, l2) { } }); } - if (l2$1) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2" - } - }); + if (!l2$1) { + return accu; } - return accu; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2" + } + }); }; } @@ -342,7 +341,7 @@ function iter2(f, _l1, _l2) { let l1 = _l1; if (l1) { if (l2) { - Curry._2(f, l1.hd, l2.hd); + f(l1.hd, l2.hd); _l2 = l2.tl; _l1 = l1.tl; continue; @@ -375,7 +374,7 @@ function fold_left2(f, _accu, _l1, _l2) { if (l2) { _l2 = l2.tl; _l1 = l1.tl; - _accu = Curry._3(f, accu, l1.hd, l2.hd); + _accu = f(accu, l1.hd, l2.hd); continue; } throw new Error("Invalid_argument", { @@ -385,22 +384,22 @@ function fold_left2(f, _accu, _l1, _l2) { } }); } - if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_left2" - } - }); + if (!l2) { + return accu; } - return accu; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2" + } + }); }; } function fold_right2(f, l1, l2, accu) { if (l1) { if (l2) { - return Curry._3(f, l1.hd, l2.hd, fold_right2(f, l1.tl, l2.tl, accu)); + return f(l1.hd, l2.hd, fold_right2(f, l1.tl, l2.tl, accu)); } throw new Error("Invalid_argument", { cause: { @@ -409,15 +408,15 @@ function fold_right2(f, l1, l2, accu) { } }); } - if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2" - } - }); + if (!l2) { + return accu; } - return accu; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2" + } + }); } function for_all(p, _param) { @@ -426,7 +425,7 @@ function for_all(p, _param) { if (!param) { return true; } - if (!Curry._1(p, param.hd)) { + if (!p(param.hd)) { return false; } _param = param.tl; @@ -440,7 +439,7 @@ function exists(p, _param) { if (!param) { return false; } - if (Curry._1(p, param.hd)) { + if (p(param.hd)) { return true; } _param = param.tl; @@ -454,7 +453,7 @@ function for_all2(p, _l1, _l2) { let l1 = _l1; if (l1) { if (l2) { - if (!Curry._2(p, l1.hd, l2.hd)) { + if (!p(l1.hd, l2.hd)) { return false; } _l2 = l2.tl; @@ -486,7 +485,7 @@ function exists2(p, _l1, _l2) { let l1 = _l1; if (l1) { if (l2) { - if (Curry._2(p, l1.hd, l2.hd)) { + if (p(l1.hd, l2.hd)) { return true; } _l2 = l2.tl; @@ -673,7 +672,7 @@ function find(p, _param) { let param = _param; if (param) { let x = param.hd; - if (Curry._1(p, x)) { + if (p(x)) { return x; } _param = param.tl; @@ -694,7 +693,7 @@ function find_opt(p, _param) { return; } let x = param.hd; - if (Curry._1(p, x)) { + if (p(x)) { return Caml_option.some(x); } _param = param.tl; @@ -713,7 +712,7 @@ function find_all(p, l) { } let l$1 = param.tl; let x = param.hd; - if (Curry._1(p, x)) { + if (p(x)) { _param = l$1; _accu = { hd: x, @@ -742,7 +741,7 @@ function partition(p, l) { } let l$1 = param.tl; let x = param.hd; - if (Curry._1(p, x)) { + if (p(x)) { _param = l$1; _yes = { hd: x, @@ -818,7 +817,7 @@ function merge(cmp, l1, l2) { } let h2 = l2.hd; let h1 = l1.hd; - if (Curry._2(cmp, h1, h2) <= 0) { + if (cmp(h1, h2) <= 0) { return { hd: h1, tl: merge(cmp, l1.tl, l2) @@ -867,8 +866,8 @@ function stable_sort(cmp, l) { let x3 = match$1.hd; let x2 = match.hd; let x1 = l.hd; - if (Curry._2(cmp, x1, x2) <= 0) { - if (Curry._2(cmp, x2, x3) <= 0) { + if (cmp(x1, x2) <= 0) { + if (cmp(x2, x3) <= 0) { return { hd: x1, tl: { @@ -879,7 +878,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x1, x3) <= 0) { + } else if (cmp(x1, x3) <= 0) { return { hd: x1, tl: { @@ -902,7 +901,7 @@ function stable_sort(cmp, l) { } }; } - } else if (Curry._2(cmp, x1, x3) <= 0) { + } else if (cmp(x1, x3) <= 0) { return { hd: x2, tl: { @@ -913,7 +912,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x2, x3) <= 0) { + } else if (cmp(x2, x3) <= 0) { return { hd: x2, tl: { @@ -947,7 +946,7 @@ function stable_sort(cmp, l) { if (match$2) { let x2$1 = match$2.hd; let x1$1 = l.hd; - if (Curry._2(cmp, x1$1, x2$1) <= 0) { + if (cmp(x1$1, x2$1) <= 0) { return { hd: x1$1, tl: { @@ -987,7 +986,7 @@ function stable_sort(cmp, l) { } let h2 = l2$1.hd; let h1 = l1.hd; - if (Curry._2(cmp, h1, h2) > 0) { + if (cmp(h1, h2) > 0) { _accu = { hd: h1, tl: accu @@ -1013,8 +1012,8 @@ function stable_sort(cmp, l) { let x3 = match$1.hd; let x2 = match.hd; let x1 = l.hd; - if (Curry._2(cmp, x1, x2) > 0) { - if (Curry._2(cmp, x2, x3) > 0) { + if (cmp(x1, x2) > 0) { + if (cmp(x2, x3) > 0) { return { hd: x1, tl: { @@ -1025,7 +1024,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x1, x3) > 0) { + } else if (cmp(x1, x3) > 0) { return { hd: x1, tl: { @@ -1048,7 +1047,7 @@ function stable_sort(cmp, l) { } }; } - } else if (Curry._2(cmp, x1, x3) > 0) { + } else if (cmp(x1, x3) > 0) { return { hd: x2, tl: { @@ -1059,7 +1058,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x2, x3) > 0) { + } else if (cmp(x2, x3) > 0) { return { hd: x2, tl: { @@ -1093,7 +1092,7 @@ function stable_sort(cmp, l) { if (match$2) { let x2$1 = match$2.hd; let x1$1 = l.hd; - if (Curry._2(cmp, x1$1, x2$1) > 0) { + if (cmp(x1$1, x2$1) > 0) { return { hd: x1$1, tl: { @@ -1133,7 +1132,7 @@ function stable_sort(cmp, l) { } let h2 = l2$1.hd; let h1 = l1.hd; - if (Curry._2(cmp, h1, h2) <= 0) { + if (cmp(h1, h2) <= 0) { _accu = { hd: h1, tl: accu @@ -1168,9 +1167,9 @@ function sort_uniq(cmp, l) { let x3 = match$1.hd; let x2 = match.hd; let x1 = l.hd; - let c = Curry._2(cmp, x1, x2); + let c = cmp(x1, x2); if (c === 0) { - let c$1 = Curry._2(cmp, x2, x3); + let c$1 = cmp(x2, x3); if (c$1 === 0) { return { hd: x2, @@ -1195,7 +1194,7 @@ function sort_uniq(cmp, l) { } } if (c < 0) { - let c$2 = Curry._2(cmp, x2, x3); + let c$2 = cmp(x2, x3); if (c$2 === 0) { return { hd: x1, @@ -1217,7 +1216,7 @@ function sort_uniq(cmp, l) { } }; } - let c$3 = Curry._2(cmp, x1, x3); + let c$3 = cmp(x1, x3); if (c$3 === 0) { return { hd: x1, @@ -1250,7 +1249,7 @@ function sort_uniq(cmp, l) { }; } } - let c$4 = Curry._2(cmp, x1, x3); + let c$4 = cmp(x1, x3); if (c$4 === 0) { return { hd: x2, @@ -1272,7 +1271,7 @@ function sort_uniq(cmp, l) { } }; } - let c$5 = Curry._2(cmp, x2, x3); + let c$5 = cmp(x2, x3); if (c$5 === 0) { return { hd: x2, @@ -1315,7 +1314,7 @@ function sort_uniq(cmp, l) { if (match$2) { let x2$1 = match$2.hd; let x1$1 = l.hd; - let c$6 = Curry._2(cmp, x1$1, x2$1); + let c$6 = cmp(x1$1, x2$1); if (c$6 === 0) { return { hd: x1$1, @@ -1363,7 +1362,7 @@ function sort_uniq(cmp, l) { let h2 = l2$1.hd; let t1 = l1.tl; let h1 = l1.hd; - let c$7 = Curry._2(cmp, h1, h2); + let c$7 = cmp(h1, h2); if (c$7 === 0) { _accu = { hd: h1, @@ -1399,9 +1398,9 @@ function sort_uniq(cmp, l) { let x3 = match$1.hd; let x2 = match.hd; let x1 = l.hd; - let c = Curry._2(cmp, x1, x2); + let c = cmp(x1, x2); if (c === 0) { - let c$1 = Curry._2(cmp, x2, x3); + let c$1 = cmp(x2, x3); if (c$1 === 0) { return { hd: x2, @@ -1426,7 +1425,7 @@ function sort_uniq(cmp, l) { } } if (c > 0) { - let c$2 = Curry._2(cmp, x2, x3); + let c$2 = cmp(x2, x3); if (c$2 === 0) { return { hd: x1, @@ -1448,7 +1447,7 @@ function sort_uniq(cmp, l) { } }; } - let c$3 = Curry._2(cmp, x1, x3); + let c$3 = cmp(x1, x3); if (c$3 === 0) { return { hd: x1, @@ -1481,7 +1480,7 @@ function sort_uniq(cmp, l) { }; } } - let c$4 = Curry._2(cmp, x1, x3); + let c$4 = cmp(x1, x3); if (c$4 === 0) { return { hd: x2, @@ -1503,7 +1502,7 @@ function sort_uniq(cmp, l) { } }; } - let c$5 = Curry._2(cmp, x2, x3); + let c$5 = cmp(x2, x3); if (c$5 === 0) { return { hd: x2, @@ -1546,7 +1545,7 @@ function sort_uniq(cmp, l) { if (match$2) { let x2$1 = match$2.hd; let x1$1 = l.hd; - let c$6 = Curry._2(cmp, x1$1, x2$1); + let c$6 = cmp(x1$1, x2$1); if (c$6 === 0) { return { hd: x1$1, @@ -1594,7 +1593,7 @@ function sort_uniq(cmp, l) { let h2 = l2$1.hd; let t1 = l1.tl; let h1 = l1.hd; - let c$7 = Curry._2(cmp, h1, h2); + let c$7 = cmp(h1, h2); if (c$7 === 0) { _accu = { hd: h1, @@ -1670,7 +1669,7 @@ function compare_length_with(_l, _n) { }; } -let append = Pervasives.$at; +let append = PervasivesU.$at; let concat = flatten; diff --git a/lib/es6/map.js b/lib/es6/map.js index 0f78c18808..9add13e742 100644 --- a/lib/es6/map.js +++ b/lib/es6/map.js @@ -1,6 +1,5 @@ -import * as Curry from "./curry.js"; import * as Caml_option from "./caml_option.js"; function Make(funarg) { @@ -121,7 +120,7 @@ function Make(funarg) { let d = param.d; let v = param.v; let l = param.l; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { if (d === data) { return param; @@ -161,7 +160,7 @@ function Make(funarg) { } }); } - let c = Curry._2(funarg.compare, x, param.v); + let c = funarg.compare(x, param.v); if (c === 0) { return param.d; } @@ -180,7 +179,7 @@ function Make(funarg) { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _d0 = param.d; let _param$1 = param.l; @@ -195,7 +194,7 @@ function Make(funarg) { ]; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.l; _d0 = param$1.d; _v0 = v$1; @@ -216,7 +215,7 @@ function Make(funarg) { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _d0 = param.d; let _param$1 = param.l; @@ -231,7 +230,7 @@ function Make(funarg) { ]; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.l; _d0 = param$1.d; _v0 = v$1; @@ -256,7 +255,7 @@ function Make(funarg) { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _d0 = param.d; let _param$1 = param.r; @@ -271,7 +270,7 @@ function Make(funarg) { ]; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.r; _d0 = param$1.d; _v0 = v$1; @@ -292,7 +291,7 @@ function Make(funarg) { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _d0 = param.d; let _param$1 = param.r; @@ -307,7 +306,7 @@ function Make(funarg) { ]; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.r; _d0 = param$1.d; _v0 = v$1; @@ -327,7 +326,7 @@ function Make(funarg) { if (typeof param !== "object") { return; } - let c = Curry._2(funarg.compare, x, param.v); + let c = funarg.compare(x, param.v); if (c === 0) { return Caml_option.some(param.d); } @@ -341,7 +340,7 @@ function Make(funarg) { if (typeof param !== "object") { return false; } - let c = Curry._2(funarg.compare, x, param.v); + let c = funarg.compare(x, param.v); if (c === 0) { return true; } @@ -459,7 +458,7 @@ function Make(funarg) { let d = param.d; let v = param.v; let l = param.l; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { return merge(l, r); } @@ -480,7 +479,7 @@ function Make(funarg) { }; let update = function (x, f, param) { if (typeof param !== "object") { - let data = Curry._1(f, undefined); + let data = f(undefined); if (data !== undefined) { return { TAG: "Node", @@ -498,9 +497,9 @@ function Make(funarg) { let d = param.d; let v = param.v; let l = param.l; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { - let data$1 = Curry._1(f, Caml_option.some(d)); + let data$1 = f(Caml_option.some(d)); if (data$1 === undefined) { return merge(l, r); } @@ -540,7 +539,7 @@ function Make(funarg) { return; } iter(f, param.l); - Curry._2(f, param.v, param.d); + f(param.v, param.d); _param = param.r; continue; }; @@ -550,7 +549,7 @@ function Make(funarg) { return "Empty"; } let l$p = map(f, param.l); - let d$p = Curry._1(f, param.d); + let d$p = f(param.d); let r$p = map(f, param.r); return { TAG: "Node", @@ -567,7 +566,7 @@ function Make(funarg) { } let v = param.v; let l$p = mapi(f, param.l); - let d$p = Curry._2(f, v, param.d); + let d$p = f(v, param.d); let r$p = mapi(f, param.r); return { TAG: "Node", @@ -585,7 +584,7 @@ function Make(funarg) { if (typeof m !== "object") { return accu; } - _accu = Curry._3(f, m.v, m.d, fold(f, m.l, accu)); + _accu = f(m.v, m.d, fold(f, m.l, accu)); _m = m.r; continue; }; @@ -596,7 +595,7 @@ function Make(funarg) { if (typeof param !== "object") { return true; } - if (!Curry._2(p, param.v, param.d)) { + if (!p(param.v, param.d)) { return false; } if (!for_all(p, param.l)) { @@ -612,7 +611,7 @@ function Make(funarg) { if (typeof param !== "object") { return false; } - if (Curry._2(p, param.v, param.d)) { + if (p(param.v, param.d)) { return true; } if (exists(p, param.l)) { @@ -682,7 +681,7 @@ function Make(funarg) { let d = param.d; let v = param.v; let l = param.l; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { return [ l, @@ -715,7 +714,7 @@ function Make(funarg) { let v1 = s1.v; if (s1.h >= height(s2)) { let match = split(v1, s2); - return concat_or_join(merge$1(f, s1.l, match[0]), v1, Curry._3(f, v1, Caml_option.some(s1.d), match[1]), merge$1(f, s1.r, match[2])); + return concat_or_join(merge$1(f, s1.l, match[0]), v1, f(v1, Caml_option.some(s1.d), match[1]), merge$1(f, s1.r, match[2])); } } @@ -733,7 +732,7 @@ function Make(funarg) { } let v2 = s2.v; let match$1 = split(v2, s1); - return concat_or_join(merge$1(f, match$1[0], s2.l), v2, Curry._3(f, v2, match$1[1], Caml_option.some(s2.d)), merge$1(f, match$1[2], s2.r)); + return concat_or_join(merge$1(f, match$1[0], s2.l), v2, f(v2, match$1[1], Caml_option.some(s2.d)), merge$1(f, match$1[2], s2.r)); }; let union = function (f, s1, s2) { if (typeof s1 !== "object") { @@ -752,7 +751,7 @@ function Make(funarg) { let l = union(f, s1.l, match[0]); let r = union(f, s1.r, match[2]); if (d2$1 !== undefined) { - return concat_or_join(l, v1, Curry._3(f, v1, d1, Caml_option.valFromOption(d2$1)), r); + return concat_or_join(l, v1, f(v1, d1, Caml_option.valFromOption(d2$1)), r); } else { return join(l, v1, d1, r); } @@ -762,7 +761,7 @@ function Make(funarg) { let l$1 = union(f, match$1[0], s2.l); let r$1 = union(f, match$1[2], s2.r); if (d1$1 !== undefined) { - return concat_or_join(l$1, v2, Curry._3(f, v2, Caml_option.valFromOption(d1$1), d2), r$1); + return concat_or_join(l$1, v2, f(v2, Caml_option.valFromOption(d1$1), d2), r$1); } else { return join(l$1, v2, d2, r$1); } @@ -776,7 +775,7 @@ function Make(funarg) { let v = param.v; let l = param.l; let l$p = filter(p, l); - let pvd = Curry._2(p, v, d); + let pvd = p(v, d); let r$p = filter(p, r); if (pvd) { if (l === l$p && r === r$p) { @@ -800,7 +799,7 @@ function Make(funarg) { let match = partition(p, param.l); let lf = match[1]; let lt = match[0]; - let pvd = Curry._2(p, v, d); + let pvd = p(v, d); let match$1 = partition(p, param.r); let rf = match$1[1]; let rt = match$1[0]; @@ -850,11 +849,11 @@ function Make(funarg) { if (typeof e2 !== "object") { return 1; } - let c = Curry._2(funarg.compare, e1._0, e2._0); + let c = funarg.compare(e1._0, e2._0); if (c !== 0) { return c; } - let c$1 = Curry._2(cmp, e1._1, e2._1); + let c$1 = cmp(e1._1, e2._1); if (c$1 !== 0) { return c$1; } @@ -879,10 +878,10 @@ function Make(funarg) { if (typeof e2 !== "object") { return false; } - if (Curry._2(funarg.compare, e1._0, e2._0) !== 0) { + if (funarg.compare(e1._0, e2._0) !== 0) { return false; } - if (!Curry._2(cmp, e1._1, e2._1)) { + if (!cmp(e1._1, e2._1)) { return false; } _e2 = cons_enum(e2._2, e2._3); diff --git a/lib/es6/mapLabels.js b/lib/es6/mapLabels.js index 0706caa57b..d6fe21fdf5 100644 --- a/lib/es6/mapLabels.js +++ b/lib/es6/mapLabels.js @@ -1,6 +1,5 @@ -import * as Curry from "./curry.js"; import * as Caml_option from "./caml_option.js"; function Make(Ord) { @@ -121,7 +120,7 @@ function Make(Ord) { let d = param.d; let v = param.v; let l = param.l; - let c = Curry._2(Ord.compare, x, v); + let c = Ord.compare(x, v); if (c === 0) { if (d === data) { return param; @@ -161,7 +160,7 @@ function Make(Ord) { } }); } - let c = Curry._2(Ord.compare, x, param.v); + let c = Ord.compare(x, param.v); if (c === 0) { return param.d; } @@ -181,7 +180,7 @@ function Make(Ord) { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.l; _d0 = param.d; _v0 = v; @@ -202,7 +201,7 @@ function Make(Ord) { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_first_aux(v, param.d, f, param.l); } _param = param.r; @@ -221,7 +220,7 @@ function Make(Ord) { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.l; _d0 = param.d; _v0 = v; @@ -238,7 +237,7 @@ function Make(Ord) { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_first_opt_aux(v, param.d, f, param.l); } _param = param.r; @@ -257,7 +256,7 @@ function Make(Ord) { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.r; _d0 = param.d; _v0 = v; @@ -278,7 +277,7 @@ function Make(Ord) { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_last_aux(v, param.d, f, param.r); } _param = param.l; @@ -297,7 +296,7 @@ function Make(Ord) { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.r; _d0 = param.d; _v0 = v; @@ -314,7 +313,7 @@ function Make(Ord) { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_last_opt_aux(v, param.d, f, param.r); } _param = param.l; @@ -327,7 +326,7 @@ function Make(Ord) { if (typeof param !== "object") { return; } - let c = Curry._2(Ord.compare, x, param.v); + let c = Ord.compare(x, param.v); if (c === 0) { return Caml_option.some(param.d); } @@ -341,7 +340,7 @@ function Make(Ord) { if (typeof param !== "object") { return false; } - let c = Curry._2(Ord.compare, x, param.v); + let c = Ord.compare(x, param.v); if (c === 0) { return true; } @@ -459,7 +458,7 @@ function Make(Ord) { let d = param.d; let v = param.v; let l = param.l; - let c = Curry._2(Ord.compare, x, v); + let c = Ord.compare(x, v); if (c === 0) { return merge(l, r); } @@ -480,7 +479,7 @@ function Make(Ord) { }; let update = function (x, f, param) { if (typeof param !== "object") { - let data = Curry._1(f, undefined); + let data = f(undefined); if (data !== undefined) { return { TAG: "Node", @@ -498,9 +497,9 @@ function Make(Ord) { let d = param.d; let v = param.v; let l = param.l; - let c = Curry._2(Ord.compare, x, v); + let c = Ord.compare(x, v); if (c === 0) { - let data$1 = Curry._1(f, Caml_option.some(d)); + let data$1 = f(Caml_option.some(d)); if (data$1 === undefined) { return merge(l, r); } @@ -540,7 +539,7 @@ function Make(Ord) { return; } iter(f, param.l); - Curry._2(f, param.v, param.d); + f(param.v, param.d); _param = param.r; continue; }; @@ -550,7 +549,7 @@ function Make(Ord) { return "Empty"; } let l$p = map(f, param.l); - let d$p = Curry._1(f, param.d); + let d$p = f(param.d); let r$p = map(f, param.r); return { TAG: "Node", @@ -567,7 +566,7 @@ function Make(Ord) { } let v = param.v; let l$p = mapi(f, param.l); - let d$p = Curry._2(f, v, param.d); + let d$p = f(v, param.d); let r$p = mapi(f, param.r); return { TAG: "Node", @@ -585,7 +584,7 @@ function Make(Ord) { if (typeof m !== "object") { return accu; } - _accu = Curry._3(f, m.v, m.d, fold(f, m.l, accu)); + _accu = f(m.v, m.d, fold(f, m.l, accu)); _m = m.r; continue; }; @@ -596,7 +595,7 @@ function Make(Ord) { if (typeof param !== "object") { return true; } - if (!Curry._2(p, param.v, param.d)) { + if (!p(param.v, param.d)) { return false; } if (!for_all(p, param.l)) { @@ -612,7 +611,7 @@ function Make(Ord) { if (typeof param !== "object") { return false; } - if (Curry._2(p, param.v, param.d)) { + if (p(param.v, param.d)) { return true; } if (exists(p, param.l)) { @@ -682,7 +681,7 @@ function Make(Ord) { let d = param.d; let v = param.v; let l = param.l; - let c = Curry._2(Ord.compare, x, v); + let c = Ord.compare(x, v); if (c === 0) { return [ l, @@ -715,7 +714,7 @@ function Make(Ord) { let v1 = s1.v; if (s1.h >= height(s2)) { let match = split(v1, s2); - return concat_or_join(merge$1(f, s1.l, match[0]), v1, Curry._3(f, v1, Caml_option.some(s1.d), match[1]), merge$1(f, s1.r, match[2])); + return concat_or_join(merge$1(f, s1.l, match[0]), v1, f(v1, Caml_option.some(s1.d), match[1]), merge$1(f, s1.r, match[2])); } } @@ -733,7 +732,7 @@ function Make(Ord) { } let v2 = s2.v; let match$1 = split(v2, s1); - return concat_or_join(merge$1(f, match$1[0], s2.l), v2, Curry._3(f, v2, match$1[1], Caml_option.some(s2.d)), merge$1(f, match$1[2], s2.r)); + return concat_or_join(merge$1(f, match$1[0], s2.l), v2, f(v2, match$1[1], Caml_option.some(s2.d)), merge$1(f, match$1[2], s2.r)); }; let union = function (f, s1, s2) { if (typeof s1 !== "object") { @@ -752,7 +751,7 @@ function Make(Ord) { let l = union(f, s1.l, match[0]); let r = union(f, s1.r, match[2]); if (d2$1 !== undefined) { - return concat_or_join(l, v1, Curry._3(f, v1, d1, Caml_option.valFromOption(d2$1)), r); + return concat_or_join(l, v1, f(v1, d1, Caml_option.valFromOption(d2$1)), r); } else { return join(l, v1, d1, r); } @@ -762,7 +761,7 @@ function Make(Ord) { let l$1 = union(f, match$1[0], s2.l); let r$1 = union(f, match$1[2], s2.r); if (d1$1 !== undefined) { - return concat_or_join(l$1, v2, Curry._3(f, v2, Caml_option.valFromOption(d1$1), d2), r$1); + return concat_or_join(l$1, v2, f(v2, Caml_option.valFromOption(d1$1), d2), r$1); } else { return join(l$1, v2, d2, r$1); } @@ -776,7 +775,7 @@ function Make(Ord) { let v = param.v; let l = param.l; let l$p = filter(p, l); - let pvd = Curry._2(p, v, d); + let pvd = p(v, d); let r$p = filter(p, r); if (pvd) { if (l === l$p && r === r$p) { @@ -800,7 +799,7 @@ function Make(Ord) { let match = partition(p, param.l); let lf = match[1]; let lt = match[0]; - let pvd = Curry._2(p, v, d); + let pvd = p(v, d); let match$1 = partition(p, param.r); let rf = match$1[1]; let rt = match$1[0]; @@ -850,11 +849,11 @@ function Make(Ord) { if (typeof e2 !== "object") { return 1; } - let c = Curry._2(Ord.compare, e1._0, e2._0); + let c = Ord.compare(e1._0, e2._0); if (c !== 0) { return c; } - let c$1 = Curry._2(cmp, e1._1, e2._1); + let c$1 = cmp(e1._1, e2._1); if (c$1 !== 0) { return c$1; } @@ -879,10 +878,10 @@ function Make(Ord) { if (typeof e2 !== "object") { return false; } - if (Curry._2(Ord.compare, e1._0, e2._0) !== 0) { + if (Ord.compare(e1._0, e2._0) !== 0) { return false; } - if (!Curry._2(cmp, e1._1, e2._1)) { + if (!cmp(e1._1, e2._1)) { return false; } _e2 = cons_enum(e2._2, e2._3); diff --git a/lib/es6/moreLabels.js b/lib/es6/moreLabels.js index 2e3a589459..bb08f475a0 100644 --- a/lib/es6/moreLabels.js +++ b/lib/es6/moreLabels.js @@ -1,7 +1,6 @@ import * as List from "./list.js"; -import * as Curry from "./curry.js"; import * as Caml_option from "./caml_option.js"; import * as HashtblLabels from "./hashtblLabels.js"; @@ -151,7 +150,7 @@ let $$Map = { let d = param.d; let v = param.v; let l = param.l; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { if (d === data) { return param; @@ -191,7 +190,7 @@ let $$Map = { } }); } - let c = Curry._2(funarg.compare, x, param.v); + let c = funarg.compare(x, param.v); if (c === 0) { return param.d; } @@ -211,7 +210,7 @@ let $$Map = { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.l; _d0 = param.d; _v0 = v; @@ -232,7 +231,7 @@ let $$Map = { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_first_aux(v, param.d, f, param.l); } _param = param.r; @@ -251,7 +250,7 @@ let $$Map = { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.l; _d0 = param.d; _v0 = v; @@ -268,7 +267,7 @@ let $$Map = { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_first_opt_aux(v, param.d, f, param.l); } _param = param.r; @@ -287,7 +286,7 @@ let $$Map = { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.r; _d0 = param.d; _v0 = v; @@ -308,7 +307,7 @@ let $$Map = { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_last_aux(v, param.d, f, param.r); } _param = param.l; @@ -327,7 +326,7 @@ let $$Map = { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.r; _d0 = param.d; _v0 = v; @@ -344,7 +343,7 @@ let $$Map = { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_last_opt_aux(v, param.d, f, param.r); } _param = param.l; @@ -357,7 +356,7 @@ let $$Map = { if (typeof param !== "object") { return; } - let c = Curry._2(funarg.compare, x, param.v); + let c = funarg.compare(x, param.v); if (c === 0) { return Caml_option.some(param.d); } @@ -371,7 +370,7 @@ let $$Map = { if (typeof param !== "object") { return false; } - let c = Curry._2(funarg.compare, x, param.v); + let c = funarg.compare(x, param.v); if (c === 0) { return true; } @@ -489,7 +488,7 @@ let $$Map = { let d = param.d; let v = param.v; let l = param.l; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { return merge(l, r); } @@ -510,7 +509,7 @@ let $$Map = { }; let update = function (x, f, param) { if (typeof param !== "object") { - let data = Curry._1(f, undefined); + let data = f(undefined); if (data !== undefined) { return { TAG: "Node", @@ -528,9 +527,9 @@ let $$Map = { let d = param.d; let v = param.v; let l = param.l; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { - let data$1 = Curry._1(f, Caml_option.some(d)); + let data$1 = f(Caml_option.some(d)); if (data$1 === undefined) { return merge(l, r); } @@ -570,7 +569,7 @@ let $$Map = { return; } iter(f, param.l); - Curry._2(f, param.v, param.d); + f(param.v, param.d); _param = param.r; continue; }; @@ -580,7 +579,7 @@ let $$Map = { return "Empty"; } let l$p = map(f, param.l); - let d$p = Curry._1(f, param.d); + let d$p = f(param.d); let r$p = map(f, param.r); return { TAG: "Node", @@ -597,7 +596,7 @@ let $$Map = { } let v = param.v; let l$p = mapi(f, param.l); - let d$p = Curry._2(f, v, param.d); + let d$p = f(v, param.d); let r$p = mapi(f, param.r); return { TAG: "Node", @@ -615,7 +614,7 @@ let $$Map = { if (typeof m !== "object") { return accu; } - _accu = Curry._3(f, m.v, m.d, fold(f, m.l, accu)); + _accu = f(m.v, m.d, fold(f, m.l, accu)); _m = m.r; continue; }; @@ -626,7 +625,7 @@ let $$Map = { if (typeof param !== "object") { return true; } - if (!Curry._2(p, param.v, param.d)) { + if (!p(param.v, param.d)) { return false; } if (!for_all(p, param.l)) { @@ -642,7 +641,7 @@ let $$Map = { if (typeof param !== "object") { return false; } - if (Curry._2(p, param.v, param.d)) { + if (p(param.v, param.d)) { return true; } if (exists(p, param.l)) { @@ -712,7 +711,7 @@ let $$Map = { let d = param.d; let v = param.v; let l = param.l; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { return [ l, @@ -745,7 +744,7 @@ let $$Map = { let v1 = s1.v; if (s1.h >= height(s2)) { let match = split(v1, s2); - return concat_or_join(merge$1(f, s1.l, match[0]), v1, Curry._3(f, v1, Caml_option.some(s1.d), match[1]), merge$1(f, s1.r, match[2])); + return concat_or_join(merge$1(f, s1.l, match[0]), v1, f(v1, Caml_option.some(s1.d), match[1]), merge$1(f, s1.r, match[2])); } } @@ -763,7 +762,7 @@ let $$Map = { } let v2 = s2.v; let match$1 = split(v2, s1); - return concat_or_join(merge$1(f, match$1[0], s2.l), v2, Curry._3(f, v2, match$1[1], Caml_option.some(s2.d)), merge$1(f, match$1[2], s2.r)); + return concat_or_join(merge$1(f, match$1[0], s2.l), v2, f(v2, match$1[1], Caml_option.some(s2.d)), merge$1(f, match$1[2], s2.r)); }; let union = function (f, s1, s2) { if (typeof s1 !== "object") { @@ -782,7 +781,7 @@ let $$Map = { let l = union(f, s1.l, match[0]); let r = union(f, s1.r, match[2]); if (d2$1 !== undefined) { - return concat_or_join(l, v1, Curry._3(f, v1, d1, Caml_option.valFromOption(d2$1)), r); + return concat_or_join(l, v1, f(v1, d1, Caml_option.valFromOption(d2$1)), r); } else { return join(l, v1, d1, r); } @@ -792,7 +791,7 @@ let $$Map = { let l$1 = union(f, match$1[0], s2.l); let r$1 = union(f, match$1[2], s2.r); if (d1$1 !== undefined) { - return concat_or_join(l$1, v2, Curry._3(f, v2, Caml_option.valFromOption(d1$1), d2), r$1); + return concat_or_join(l$1, v2, f(v2, Caml_option.valFromOption(d1$1), d2), r$1); } else { return join(l$1, v2, d2, r$1); } @@ -806,7 +805,7 @@ let $$Map = { let v = param.v; let l = param.l; let l$p = filter(p, l); - let pvd = Curry._2(p, v, d); + let pvd = p(v, d); let r$p = filter(p, r); if (pvd) { if (l === l$p && r === r$p) { @@ -830,7 +829,7 @@ let $$Map = { let match = partition(p, param.l); let lf = match[1]; let lt = match[0]; - let pvd = Curry._2(p, v, d); + let pvd = p(v, d); let match$1 = partition(p, param.r); let rf = match$1[1]; let rt = match$1[0]; @@ -880,11 +879,11 @@ let $$Map = { if (typeof e2 !== "object") { return 1; } - let c = Curry._2(funarg.compare, e1._0, e2._0); + let c = funarg.compare(e1._0, e2._0); if (c !== 0) { return c; } - let c$1 = Curry._2(cmp, e1._1, e2._1); + let c$1 = cmp(e1._1, e2._1); if (c$1 !== 0) { return c$1; } @@ -909,10 +908,10 @@ let $$Map = { if (typeof e2 !== "object") { return false; } - if (Curry._2(funarg.compare, e1._0, e2._0) !== 0) { + if (funarg.compare(e1._0, e2._0) !== 0) { return false; } - if (!Curry._2(cmp, e1._1, e2._1)) { + if (!cmp(e1._1, e2._1)) { return false; } _e2 = cons_enum(e2._2, e2._3); @@ -1085,7 +1084,7 @@ let $$Set = { let r = param.r; let v = param.v; let l = param.l; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { return param; } @@ -1253,7 +1252,7 @@ let $$Set = { let r = param.r; let v = param.v; let l = param.l; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { return [ l, @@ -1289,7 +1288,7 @@ let $$Set = { if (typeof param !== "object") { return false; } - let c = Curry._2(funarg.compare, x, param.v); + let c = funarg.compare(x, param.v); if (c === 0) { return true; } @@ -1304,7 +1303,7 @@ let $$Set = { let r = param.r; let v = param.v; let l = param.l; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { return merge(l, r); } @@ -1414,7 +1413,7 @@ let $$Set = { if (typeof e2 !== "object") { return 1; } - let c = Curry._2(funarg.compare, e1._0, e2._0); + let c = funarg.compare(e1._0, e2._0); if (c !== 0) { return c; } @@ -1444,7 +1443,7 @@ let $$Set = { } let r2 = s2.r; let l2 = s2.l; - let c = Curry._2(funarg.compare, v1, s2.v); + let c = funarg.compare(v1, s2.v); if (c === 0) { if (!subset(l1, l2)) { return false; @@ -1486,7 +1485,7 @@ let $$Set = { return; } iter(f, param.l); - Curry._1(f, param.v); + f(param.v); _param = param.r; continue; }; @@ -1498,7 +1497,7 @@ let $$Set = { if (typeof s !== "object") { return accu; } - _accu = Curry._2(f, s.v, fold(f, s.l, accu)); + _accu = f(s.v, fold(f, s.l, accu)); _s = s.r; continue; }; @@ -1509,7 +1508,7 @@ let $$Set = { if (typeof param !== "object") { return true; } - if (!Curry._1(p, param.v)) { + if (!p(param.v)) { return false; } if (!for_all(p, param.l)) { @@ -1525,7 +1524,7 @@ let $$Set = { if (typeof param !== "object") { return false; } - if (Curry._1(p, param.v)) { + if (p(param.v)) { return true; } if (exists(p, param.l)) { @@ -1543,7 +1542,7 @@ let $$Set = { let v = param.v; let l = param.l; let l$p = filter(p, l); - let pv = Curry._1(p, v); + let pv = p(v); let r$p = filter(p, r); if (pv) { if (l === l$p && r === r$p) { @@ -1566,7 +1565,7 @@ let $$Set = { let match = partition(p, param.l); let lf = match[1]; let lt = match[0]; - let pv = Curry._1(p, v); + let pv = p(v); let match$1 = partition(p, param.r); let rf = match$1[1]; let rt = match$1[0]; @@ -1618,7 +1617,7 @@ let $$Set = { }); } let v = param.v; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { return v; } @@ -1634,7 +1633,7 @@ let $$Set = { return v0; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.l; _v0 = v; continue; @@ -1654,7 +1653,7 @@ let $$Set = { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_first_aux(v, f, param.l); } _param = param.r; @@ -1669,7 +1668,7 @@ let $$Set = { return Caml_option.some(v0); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.l; _v0 = v; continue; @@ -1685,7 +1684,7 @@ let $$Set = { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_first_opt_aux(v, f, param.l); } _param = param.r; @@ -1700,7 +1699,7 @@ let $$Set = { return v0; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.r; _v0 = v; continue; @@ -1720,7 +1719,7 @@ let $$Set = { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_last_aux(v, f, param.r); } _param = param.l; @@ -1735,7 +1734,7 @@ let $$Set = { return Caml_option.some(v0); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.r; _v0 = v; continue; @@ -1751,7 +1750,7 @@ let $$Set = { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_last_opt_aux(v, f, param.r); } _param = param.l; @@ -1765,7 +1764,7 @@ let $$Set = { return; } let v = param.v; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { return Caml_option.some(v); } @@ -1774,7 +1773,7 @@ let $$Set = { }; }; let try_join = function (l, v, r) { - if ((l === "Empty" || Curry._2(funarg.compare, max_elt(l), v) < 0) && (r === "Empty" || Curry._2(funarg.compare, v, min_elt(r)) < 0)) { + if ((l === "Empty" || funarg.compare(max_elt(l), v) < 0) && (r === "Empty" || funarg.compare(v, min_elt(r)) < 0)) { return join(l, v, r); } else { return union(l, add(v, r)); @@ -1788,7 +1787,7 @@ let $$Set = { let v = param.v; let l = param.l; let l$p = map(f, l); - let v$p = Curry._1(f, v); + let v$p = f(v); let r$p = map(f, r); if (l === l$p && v === v$p && r === r$p) { return param; @@ -1978,4 +1977,4 @@ export { $$Map, $$Set, } -/* No side effect */ +/* HashtblLabels Not a pure module */ diff --git a/lib/es6/parsing.js b/lib/es6/parsing.js index 3bf33e7dad..a17af3f6e4 100644 --- a/lib/es6/parsing.js +++ b/lib/es6/parsing.js @@ -1,7 +1,6 @@ import * as $$Array from "./array.js"; -import * as Curry from "./curry.js"; import * as Lexing from "./lexing.js"; import * as Caml_obj from "./caml_obj.js"; import * as Caml_array from "./caml_array.js"; @@ -32,7 +31,7 @@ let env = { errflag: 0 }; -function grow_stacks(param) { +function grow_stacks() { let oldsize = env.stacksize; let newsize = (oldsize << 1); let new_s = Caml_array.make(newsize, 0); @@ -50,7 +49,7 @@ function grow_stacks(param) { env.stacksize = newsize; } -function clear_parser(param) { +function clear_parser() { $$Array.fill(env.v_stack, 0, env.stacksize, undefined); env.lval = undefined; } @@ -81,7 +80,7 @@ function yyparse(tables, start, lexer, lexbuf) { let match = Caml_parser.parse_engine(tables, env, cmd, arg); switch (match) { case "Read_token" : - let t = Curry._1(lexer, lexbuf); + let t = lexer(lexbuf); env.symb_start = lexbuf.lex_start_p; env.symb_end = lexbuf.lex_curr_p; _arg = t; @@ -108,7 +107,7 @@ function yyparse(tables, start, lexer, lexbuf) { try { match$1 = [ "Semantic_action_computed", - Curry._1(Caml_array.get(tables.actions, env.rule_number), env) + Caml_array.get(tables.actions, env.rule_number)(env) ]; } catch (raw_exn){ @@ -128,7 +127,7 @@ function yyparse(tables, start, lexer, lexbuf) { _cmd = match$1[0]; continue; case "Call_error_function" : - Curry._1(tables.error_function, "syntax error"); + tables.error_function("syntax error"); _arg = undefined; _cmd = "Error_detected"; continue; @@ -166,7 +165,7 @@ function peek_val(env, n) { return Caml_array.get(env.v_stack, env.asp - n | 0); } -function symbol_start_pos(param) { +function symbol_start_pos() { let _i = env.rule_len; while(true) { let i = _i; @@ -183,7 +182,7 @@ function symbol_start_pos(param) { }; } -function symbol_end_pos(param) { +function symbol_end_pos() { return Caml_array.get(env.symb_end_stack, env.asp); } @@ -195,11 +194,11 @@ function rhs_end_pos(n) { return Caml_array.get(env.symb_end_stack, env.asp - (env.rule_len - n | 0) | 0); } -function symbol_start(param) { +function symbol_start() { return symbol_start_pos().pos_cnum; } -function symbol_end(param) { +function symbol_end() { return symbol_end_pos().pos_cnum; } @@ -212,7 +211,7 @@ function rhs_end(n) { } function is_current_lookahead(tok) { - return Curry._1(current_lookahead_fun.contents, tok); + return current_lookahead_fun.contents(tok); } function parse_error(param) { diff --git a/lib/es6/pervasives.js b/lib/es6/pervasives.js index a64b28e66d..24be030c16 100644 --- a/lib/es6/pervasives.js +++ b/lib/es6/pervasives.js @@ -1,6 +1,5 @@ -import * as Curry from "./curry.js"; import * as Caml_sys from "./caml_sys.js"; import * as Caml_format from "./caml_format.js"; import * as Caml_string from "./caml_string.js"; @@ -179,11 +178,11 @@ function $at(l1, l2) { } } -function print_newline(param) { +function print_newline() { console.log(""); } -function prerr_newline(param) { +function prerr_newline() { console.error(""); } @@ -192,7 +191,7 @@ function print_int(i) { } function print_float(i) { - console.log(valid_float_lexem(Caml_format.format_float("%.12g", i))); + console.log(string_of_float(i)); } function print_string(prim) { @@ -207,14 +206,14 @@ let exit_function = { function at_exit(f) { let g = exit_function.contents; - exit_function.contents = (function (param) { - Curry._1(f, undefined); - Curry._1(g, undefined); + exit_function.contents = (function () { + f(); + g(); }); } function exit(retcode) { - Curry._1(exit_function.contents, undefined); + exit_function.contents(); return Caml_sys.sys_exit(retcode); } diff --git a/lib/es6/queue.js b/lib/es6/queue.js index fc70970728..36d67dbb71 100644 --- a/lib/es6/queue.js +++ b/lib/es6/queue.js @@ -1,11 +1,10 @@ -import * as Curry from "./curry.js"; import * as Caml_exceptions from "./caml_exceptions.js"; let Empty = /* @__PURE__ */Caml_exceptions.create("Queue.Empty"); -function create(param) { +function create() { return { length: 0, first: "Nil", @@ -117,7 +116,7 @@ function iter(f, q) { return; } let next = cell.next; - Curry._1(f, cell.content); + f(cell.content); _cell = next; continue; }; @@ -133,7 +132,7 @@ function fold(f, accu, q) { return accu$1; } let next = cell.next; - let accu$2 = Curry._2(f, accu$1, cell.content); + let accu$2 = f(accu$1, cell.content); _cell = next; _accu = accu$2; continue; diff --git a/lib/es6/random.js b/lib/es6/random.js index 21cff477be..c0e7284cf1 100644 --- a/lib/es6/random.js +++ b/lib/es6/random.js @@ -9,7 +9,7 @@ import * as Caml_array from "./caml_array.js"; import * as Caml_int64 from "./caml_int64.js"; import * as Caml_string from "./caml_string.js"; -function random_seed(param) { +function random_seed() { return [(Math.floor(Math.random()*0x7fffffff))]; } @@ -51,7 +51,7 @@ function make(seed) { return result; } -function make_self_init(param) { +function make_self_init() { return make(random_seed()); } @@ -74,65 +74,65 @@ function bits(s) { } function int(s, bound) { - if (bound > 1073741823 || bound <= 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Random.int" - } - }); + if (!(bound > 1073741823 || bound <= 0)) { + while(true) { + let r = bits(s); + let v = r % bound; + if ((r - v | 0) <= ((1073741823 - bound | 0) + 1 | 0)) { + return v; + } + continue; + }; } - while(true) { - let r = bits(s); - let v = r % bound; - if ((r - v | 0) <= ((1073741823 - bound | 0) + 1 | 0)) { - return v; - } - continue; - }; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Random.int" + } + }); } function int32(s, bound) { - if (bound <= 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Random.int32" - } - }); + if (bound > 0) { + while(true) { + let b1 = bits(s); + let b2 = ((bits(s) & 1) << 30); + let r = b1 | b2; + let v = r % bound; + if ((r - v | 0) <= ((Int32.max_int - bound | 0) + 1 | 0)) { + return v; + } + continue; + }; } - while(true) { - let b1 = bits(s); - let b2 = ((bits(s) & 1) << 30); - let r = b1 | b2; - let v = r % bound; - if ((r - v | 0) <= ((Int32.max_int - bound | 0) + 1 | 0)) { - return v; - } - continue; - }; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Random.int32" + } + }); } function int64(s, bound) { - if (Caml.i64_le(bound, Caml_int64.zero)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Random.int64" - } - }); + if (!Caml.i64_le(bound, Caml_int64.zero)) { + while(true) { + let b1 = Caml_int64.of_int32(bits(s)); + let b2 = Caml_int64.lsl_(Caml_int64.of_int32(bits(s)), 30); + let b3 = Caml_int64.lsl_(Caml_int64.of_int32(bits(s) & 7), 60); + let r = Caml_int64.or_(b1, Caml_int64.or_(b2, b3)); + let v = Caml_int64.mod_(r, bound); + if (!Caml.i64_gt(Caml_int64.sub(r, v), Caml_int64.add(Caml_int64.sub(Int64.max_int, bound), Caml_int64.one))) { + return v; + } + continue; + }; } - while(true) { - let b1 = Caml_int64.of_int32(bits(s)); - let b2 = Caml_int64.lsl_(Caml_int64.of_int32(bits(s)), 30); - let b3 = Caml_int64.lsl_(Caml_int64.of_int32(bits(s) & 7), 60); - let r = Caml_int64.or_(b1, Caml_int64.or_(b2, b3)); - let v = Caml_int64.mod_(r, bound); - if (!Caml.i64_gt(Caml_int64.sub(r, v), Caml_int64.add(Caml_int64.sub(Int64.max_int, bound), Caml_int64.one))) { - return v; - } - continue; - }; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Random.int64" + } + }); } function rawfloat(s) { @@ -210,7 +210,7 @@ let $$default = { idx: 0 }; -function bits$1(param) { +function bits$1() { return bits($$default); } @@ -227,10 +227,10 @@ function int64$1(bound) { } function float$1(scale) { - return rawfloat($$default) * scale; + return float($$default, scale); } -function bool$1(param) { +function bool$1() { return bool($$default); } @@ -242,11 +242,11 @@ function init(seed) { full_init($$default, [seed]); } -function self_init(param) { +function self_init() { full_init$1(random_seed()); } -function get_state(param) { +function get_state() { return copy($$default); } diff --git a/lib/es6/set.js b/lib/es6/set.js index de5d2c054c..2808ee5d78 100644 --- a/lib/es6/set.js +++ b/lib/es6/set.js @@ -1,7 +1,6 @@ import * as List from "./list.js"; -import * as Curry from "./curry.js"; import * as Caml_option from "./caml_option.js"; function Make(funarg) { @@ -101,7 +100,7 @@ function Make(funarg) { let r = param.r; let v = param.v; let l = param.l; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { return param; } @@ -260,7 +259,7 @@ function Make(funarg) { let r = param.r; let v = param.v; let l = param.l; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { return [ l, @@ -296,7 +295,7 @@ function Make(funarg) { if (typeof param !== "object") { return false; } - let c = Curry._2(funarg.compare, x, param.v); + let c = funarg.compare(x, param.v); if (c === 0) { return true; } @@ -311,7 +310,7 @@ function Make(funarg) { let r = param.r; let v = param.v; let l = param.l; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { if (typeof l !== "object") { return r; @@ -429,7 +428,7 @@ function Make(funarg) { if (typeof e2 !== "object") { return 1; } - let c = Curry._2(funarg.compare, e1._0, e2._0); + let c = funarg.compare(e1._0, e2._0); if (c !== 0) { return c; } @@ -456,7 +455,7 @@ function Make(funarg) { } let r2 = s2.r; let l2 = s2.l; - let c = Curry._2(funarg.compare, v1, s2.v); + let c = funarg.compare(v1, s2.v); if (c === 0) { if (!subset(l1, l2)) { return false; @@ -498,7 +497,7 @@ function Make(funarg) { return; } iter(f, param.l); - Curry._1(f, param.v); + f(param.v); _param = param.r; continue; }; @@ -510,7 +509,7 @@ function Make(funarg) { if (typeof s !== "object") { return accu; } - _accu = Curry._2(f, s.v, fold(f, s.l, accu)); + _accu = f(s.v, fold(f, s.l, accu)); _s = s.r; continue; }; @@ -521,7 +520,7 @@ function Make(funarg) { if (typeof param !== "object") { return true; } - if (!Curry._1(p, param.v)) { + if (!p(param.v)) { return false; } if (!for_all(p, param.l)) { @@ -537,7 +536,7 @@ function Make(funarg) { if (typeof param !== "object") { return false; } - if (Curry._1(p, param.v)) { + if (p(param.v)) { return true; } if (exists(p, param.l)) { @@ -555,7 +554,7 @@ function Make(funarg) { let v = param.v; let l = param.l; let l$p = filter(p, l); - let pv = Curry._1(p, v); + let pv = p(v); let r$p = filter(p, r); if (pv) { if (l === l$p && r === r$p) { @@ -578,7 +577,7 @@ function Make(funarg) { let match = partition(p, param.l); let lf = match[1]; let lt = match[0]; - let pv = Curry._1(p, v); + let pv = p(v); let match$1 = partition(p, param.r); let rf = match$1[1]; let rt = match$1[0]; @@ -630,7 +629,7 @@ function Make(funarg) { }); } let v = param.v; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { return v; } @@ -649,7 +648,7 @@ function Make(funarg) { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _param$1 = param.l; while(true) { @@ -659,7 +658,7 @@ function Make(funarg) { return v0; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.l; _v0 = v$1; continue; @@ -679,7 +678,7 @@ function Make(funarg) { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _param$1 = param.l; while(true) { @@ -689,7 +688,7 @@ function Make(funarg) { return Caml_option.some(v0); } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.l; _v0 = v$1; continue; @@ -713,7 +712,7 @@ function Make(funarg) { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _param$1 = param.r; while(true) { @@ -723,7 +722,7 @@ function Make(funarg) { return v0; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.r; _v0 = v$1; continue; @@ -743,7 +742,7 @@ function Make(funarg) { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _param$1 = param.r; while(true) { @@ -753,7 +752,7 @@ function Make(funarg) { return Caml_option.some(v0); } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.r; _v0 = v$1; continue; @@ -773,7 +772,7 @@ function Make(funarg) { return; } let v = param.v; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { return Caml_option.some(v); } @@ -789,11 +788,11 @@ function Make(funarg) { let v = param.v; let l = param.l; let l$p = map(f, l); - let v$p = Curry._1(f, v); + let v$p = f(v); let r$p = map(f, r); if (l === l$p && v === v$p && r === r$p) { return param; - } else if ((l$p === "Empty" || Curry._2(funarg.compare, max_elt(l$p), v$p) < 0) && (r$p === "Empty" || Curry._2(funarg.compare, v$p, min_elt(r$p)) < 0)) { + } else if ((l$p === "Empty" || funarg.compare(max_elt(l$p), v$p) < 0) && (r$p === "Empty" || funarg.compare(v$p, min_elt(r$p)) < 0)) { return join(l$p, v$p, r$p); } else { return union(l$p, add(v$p, r$p)); diff --git a/lib/es6/setLabels.js b/lib/es6/setLabels.js index 8900080d49..3097a1f8f3 100644 --- a/lib/es6/setLabels.js +++ b/lib/es6/setLabels.js @@ -1,7 +1,6 @@ import * as List from "./list.js"; -import * as Curry from "./curry.js"; import * as Caml_option from "./caml_option.js"; function Make(Ord) { @@ -101,7 +100,7 @@ function Make(Ord) { let r = param.r; let v = param.v; let l = param.l; - let c = Curry._2(Ord.compare, x, v); + let c = Ord.compare(x, v); if (c === 0) { return param; } @@ -269,7 +268,7 @@ function Make(Ord) { let r = param.r; let v = param.v; let l = param.l; - let c = Curry._2(Ord.compare, x, v); + let c = Ord.compare(x, v); if (c === 0) { return [ l, @@ -305,7 +304,7 @@ function Make(Ord) { if (typeof param !== "object") { return false; } - let c = Curry._2(Ord.compare, x, param.v); + let c = Ord.compare(x, param.v); if (c === 0) { return true; } @@ -320,7 +319,7 @@ function Make(Ord) { let r = param.r; let v = param.v; let l = param.l; - let c = Curry._2(Ord.compare, x, v); + let c = Ord.compare(x, v); if (c === 0) { return merge(l, r); } @@ -430,7 +429,7 @@ function Make(Ord) { if (typeof e2 !== "object") { return 1; } - let c = Curry._2(Ord.compare, e1._0, e2._0); + let c = Ord.compare(e1._0, e2._0); if (c !== 0) { return c; } @@ -460,7 +459,7 @@ function Make(Ord) { } let r2 = s2.r; let l2 = s2.l; - let c = Curry._2(Ord.compare, v1, s2.v); + let c = Ord.compare(v1, s2.v); if (c === 0) { if (!subset(l1, l2)) { return false; @@ -502,7 +501,7 @@ function Make(Ord) { return; } iter(f, param.l); - Curry._1(f, param.v); + f(param.v); _param = param.r; continue; }; @@ -514,7 +513,7 @@ function Make(Ord) { if (typeof s !== "object") { return accu; } - _accu = Curry._2(f, s.v, fold(f, s.l, accu)); + _accu = f(s.v, fold(f, s.l, accu)); _s = s.r; continue; }; @@ -525,7 +524,7 @@ function Make(Ord) { if (typeof param !== "object") { return true; } - if (!Curry._1(p, param.v)) { + if (!p(param.v)) { return false; } if (!for_all(p, param.l)) { @@ -541,7 +540,7 @@ function Make(Ord) { if (typeof param !== "object") { return false; } - if (Curry._1(p, param.v)) { + if (p(param.v)) { return true; } if (exists(p, param.l)) { @@ -559,7 +558,7 @@ function Make(Ord) { let v = param.v; let l = param.l; let l$p = filter(p, l); - let pv = Curry._1(p, v); + let pv = p(v); let r$p = filter(p, r); if (pv) { if (l === l$p && r === r$p) { @@ -582,7 +581,7 @@ function Make(Ord) { let match = partition(p, param.l); let lf = match[1]; let lt = match[0]; - let pv = Curry._1(p, v); + let pv = p(v); let match$1 = partition(p, param.r); let rf = match$1[1]; let rt = match$1[0]; @@ -634,7 +633,7 @@ function Make(Ord) { }); } let v = param.v; - let c = Curry._2(Ord.compare, x, v); + let c = Ord.compare(x, v); if (c === 0) { return v; } @@ -650,7 +649,7 @@ function Make(Ord) { return v0; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.l; _v0 = v; continue; @@ -670,7 +669,7 @@ function Make(Ord) { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_first_aux(v, f, param.l); } _param = param.r; @@ -685,7 +684,7 @@ function Make(Ord) { return Caml_option.some(v0); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.l; _v0 = v; continue; @@ -701,7 +700,7 @@ function Make(Ord) { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_first_opt_aux(v, f, param.l); } _param = param.r; @@ -716,7 +715,7 @@ function Make(Ord) { return v0; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.r; _v0 = v; continue; @@ -736,7 +735,7 @@ function Make(Ord) { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_last_aux(v, f, param.r); } _param = param.l; @@ -751,7 +750,7 @@ function Make(Ord) { return Caml_option.some(v0); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.r; _v0 = v; continue; @@ -767,7 +766,7 @@ function Make(Ord) { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_last_opt_aux(v, f, param.r); } _param = param.l; @@ -781,7 +780,7 @@ function Make(Ord) { return; } let v = param.v; - let c = Curry._2(Ord.compare, x, v); + let c = Ord.compare(x, v); if (c === 0) { return Caml_option.some(v); } @@ -790,7 +789,7 @@ function Make(Ord) { }; }; let try_join = function (l, v, r) { - if ((l === "Empty" || Curry._2(Ord.compare, max_elt(l), v) < 0) && (r === "Empty" || Curry._2(Ord.compare, v, min_elt(r)) < 0)) { + if ((l === "Empty" || Ord.compare(max_elt(l), v) < 0) && (r === "Empty" || Ord.compare(v, min_elt(r)) < 0)) { return join(l, v, r); } else { return union(l, add(v, r)); @@ -804,7 +803,7 @@ function Make(Ord) { let v = param.v; let l = param.l; let l$p = map(f, l); - let v$p = Curry._1(f, v); + let v$p = f(v); let r$p = map(f, r); if (l === l$p && v === v$p && r === r$p) { return param; diff --git a/lib/es6/sort.js b/lib/es6/sort.js index 00b5fec14a..64395cfd55 100644 --- a/lib/es6/sort.js +++ b/lib/es6/sort.js @@ -1,6 +1,5 @@ -import * as Curry from "./curry.js"; function merge(order, l1, l2) { if (!l1) { @@ -11,7 +10,7 @@ function merge(order, l1, l2) { } let h2 = l2.hd; let h1 = l1.hd; - if (Curry._2(order, h1, h2)) { + if (order(h1, h2)) { return { hd: h1, tl: merge(order, l1.tl, l2) @@ -42,7 +41,7 @@ function list(order, l) { } let e2 = match.hd; return { - hd: Curry._2(order, e, e2) ? ({ + hd: order(e, e2) ? ({ hd: e, tl: { hd: e2, @@ -101,12 +100,12 @@ function array(cmp, arr) { return; } let mid = ((lo + hi | 0) >>> 1); - if (Curry._2(cmp, arr[mid], arr[lo])) { + if (cmp(arr[mid], arr[lo])) { swap(arr, mid, lo); } - if (Curry._2(cmp, arr[hi], arr[mid])) { + if (cmp(arr[hi], arr[mid])) { swap(arr, mid, hi); - if (Curry._2(cmp, arr[mid], arr[lo])) { + if (cmp(arr[mid], arr[lo])) { swap(arr, mid, lo); } @@ -114,7 +113,7 @@ function array(cmp, arr) { let pivot = arr[mid]; let i = lo + 1 | 0; let j = hi - 1 | 0; - if (!Curry._2(cmp, pivot, arr[hi]) || !Curry._2(cmp, arr[lo], pivot)) { + if (!cmp(pivot, arr[hi]) || !cmp(arr[lo], pivot)) { throw new Error("Invalid_argument", { cause: { RE_EXN_ID: "Invalid_argument", @@ -123,10 +122,10 @@ function array(cmp, arr) { }); } while(i < j) { - while(!Curry._2(cmp, pivot, arr[i])) { + while(!cmp(pivot, arr[i])) { i = i + 1 | 0; }; - while(!Curry._2(cmp, arr[j], pivot)) { + while(!cmp(arr[j], pivot)) { j = j - 1 | 0; }; if (i < j) { @@ -148,10 +147,10 @@ function array(cmp, arr) { qsort(0, arr.length - 1 | 0); for(let i = 1 ,i_finish = arr.length; i < i_finish; ++i){ let val_i = arr[i]; - if (!Curry._2(cmp, arr[i - 1 | 0], val_i)) { + if (!cmp(arr[i - 1 | 0], val_i)) { arr[i] = arr[i - 1 | 0]; let j = i - 1 | 0; - while(j >= 1 && !Curry._2(cmp, arr[j - 1 | 0], val_i)) { + while(j >= 1 && !cmp(arr[j - 1 | 0], val_i)) { arr[j] = arr[j - 1 | 0]; j = j - 1 | 0; }; diff --git a/lib/es6/stack.js b/lib/es6/stack.js index 3074c57087..dd86dd733d 100644 --- a/lib/es6/stack.js +++ b/lib/es6/stack.js @@ -5,7 +5,7 @@ import * as Caml_exceptions from "./caml_exceptions.js"; let Empty = /* @__PURE__ */Caml_exceptions.create("Stack.Empty"); -function create(param) { +function create() { return { c: /* [] */0, len: 0 diff --git a/lib/es6/stream.js b/lib/es6/stream.js index f56923cd8f..c1fffd51dc 100644 --- a/lib/es6/stream.js +++ b/lib/es6/stream.js @@ -1,7 +1,7 @@ +import * as Lazy from "./lazy.js"; import * as List from "./list.js"; -import * as Curry from "./curry.js"; import * as Caml_bytes from "./caml_bytes.js"; import * as Caml_option from "./caml_option.js"; import * as Caml_string from "./caml_string.js"; @@ -84,7 +84,7 @@ function get_data(count, _d) { return "Sempty"; } } - let a$1 = Curry._1(g.func, count); + let a$1 = g.func(count); if (a$1 !== undefined) { return { TAG: "Scons", @@ -137,7 +137,7 @@ function peek_data(s) { if (a !== undefined) { return Caml_option.valFromOption(a); } - let x = Curry._1(g.func, s.count); + let x = g.func(s.count); g.curr = Caml_option.some(x); return x; @@ -259,17 +259,19 @@ function empty(s) { } function iter(f, strm) { - let _param; - while(true) { - let a = peek(strm); - if (a === undefined) { - return; - } - junk(strm); - Curry._1(f, Caml_option.valFromOption(a)); - _param = undefined; - continue; + let do_rec = function () { + while(true) { + let a = peek(strm); + if (a === undefined) { + return; + } + junk(strm); + f(Caml_option.valFromOption(a)); + _param = undefined; + continue; + }; }; + do_rec(); } function from(f) { @@ -364,10 +366,10 @@ function lapp(f, s) { count: 0, data: { TAG: "Slazy", - _0: CamlinternalLazy.from_fun(function () { + _0: Lazy.from_fun(function () { return { TAG: "Sapp", - _0: data(Curry._1(f, undefined)), + _0: data(f()), _1: data(s) }; }) @@ -380,10 +382,10 @@ function lcons(f, s) { count: 0, data: { TAG: "Slazy", - _0: CamlinternalLazy.from_fun(function () { + _0: Lazy.from_fun(function () { return { TAG: "Scons", - _0: Curry._1(f, undefined), + _0: f(), _1: data(s) }; }) @@ -396,10 +398,10 @@ function lsing(f) { count: 0, data: { TAG: "Slazy", - _0: CamlinternalLazy.from_fun(function () { + _0: Lazy.from_fun(function () { return { TAG: "Scons", - _0: Curry._1(f, undefined), + _0: f(), _1: "Sempty" }; }) @@ -412,8 +414,8 @@ function slazy(f) { count: 0, data: { TAG: "Slazy", - _0: CamlinternalLazy.from_fun(function () { - return data(Curry._1(f, undefined)); + _0: Lazy.from_fun(function () { + return data(f()); }) } }; @@ -427,7 +429,7 @@ function dump_data(f, param) { switch (param.TAG) { case "Scons" : console.log("Scons ("); - Curry._1(f, param._0); + f(param._0); console.log(", "); dump_data(f, param._1); console.log(")"); diff --git a/lib/es6/string.js b/lib/es6/string.js index 9ac0eb8bab..8fd3ca5035 100644 --- a/lib/es6/string.js +++ b/lib/es6/string.js @@ -3,7 +3,6 @@ import * as Caml from "./caml.js"; import * as $$Array from "./array.js"; import * as Bytes from "./bytes.js"; -import * as Curry from "./curry.js"; import * as Caml_string from "./caml_string.js"; import * as Caml_js_exceptions from "./caml_js_exceptions.js"; @@ -21,13 +20,13 @@ function concat(sep, xs) { function iter(f, s) { for(let i = 0 ,i_finish = s.length; i < i_finish; ++i){ - Curry._1(f, s.codePointAt(i)); + f(s.codePointAt(i)); } } function iteri(f, s) { for(let i = 0 ,i_finish = s.length; i < i_finish; ++i){ - Curry._2(f, i, s.codePointAt(i)); + f(i, s.codePointAt(i)); } } @@ -129,28 +128,28 @@ function index_opt(s, c) { function index_from(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from / Bytes.index_from" - } - }); + if (!(i < 0 || i > l)) { + return index_rec(s, l, i, c); } - return index_rec(s, l, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from" + } + }); } function index_from_opt(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from_opt / Bytes.index_from_opt" - } - }); + if (!(i < 0 || i > l)) { + return index_rec_opt(s, l, i, c); } - return index_rec_opt(s, l, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt" + } + }); } function rindex_rec(s, _i, c) { @@ -176,15 +175,15 @@ function rindex(s, c) { } function rindex_from(s, i, c) { - if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from / Bytes.rindex_from" - } - }); + if (!(i < -1 || i >= s.length)) { + return rindex_rec(s, i, c); } - return rindex_rec(s, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from" + } + }); } function rindex_rec_opt(s, _i, c) { @@ -206,15 +205,15 @@ function rindex_opt(s, c) { } function rindex_from_opt(s, i, c) { - if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from_opt / Bytes.rindex_from_opt" - } - }); + if (!(i < -1 || i >= s.length)) { + return rindex_rec_opt(s, i, c); } - return rindex_rec_opt(s, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt" + } + }); } function contains_from(s, i, c) { diff --git a/lib/es6/stringLabels.js b/lib/es6/stringLabels.js index 9df2847bb4..3db2216ab3 100644 --- a/lib/es6/stringLabels.js +++ b/lib/es6/stringLabels.js @@ -3,7 +3,6 @@ import * as Caml from "./caml.js"; import * as $$Array from "./array.js"; import * as Bytes from "./bytes.js"; -import * as Curry from "./curry.js"; import * as Caml_string from "./caml_string.js"; import * as Caml_js_exceptions from "./caml_js_exceptions.js"; @@ -15,7 +14,9 @@ function sub(s, ofs, len) { return Bytes.unsafe_to_string(Bytes.sub(Bytes.unsafe_of_string(s), ofs, len)); } -let blit = Bytes.blit_string; +function blit(src, src_pos, dst, dst_pos, len) { + Bytes.blit_string(src, src_pos, dst, dst_pos, len); +} function concat(sep, xs) { return $$Array.of_list(xs).join(sep); @@ -23,13 +24,13 @@ function concat(sep, xs) { function iter(f, s) { for(let i = 0 ,i_finish = s.length; i < i_finish; ++i){ - Curry._1(f, s.codePointAt(i)); + f(s.codePointAt(i)); } } function iteri(f, s) { for(let i = 0 ,i_finish = s.length; i < i_finish; ++i){ - Curry._2(f, i, s.codePointAt(i)); + f(i, s.codePointAt(i)); } } @@ -131,28 +132,28 @@ function index_opt(s, c) { function index_from(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from / Bytes.index_from" - } - }); + if (!(i < 0 || i > l)) { + return index_rec(s, l, i, c); } - return index_rec(s, l, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from" + } + }); } function index_from_opt(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from_opt / Bytes.index_from_opt" - } - }); + if (!(i < 0 || i > l)) { + return index_rec_opt(s, l, i, c); } - return index_rec_opt(s, l, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt" + } + }); } function rindex_rec(s, _i, c) { @@ -178,15 +179,15 @@ function rindex(s, c) { } function rindex_from(s, i, c) { - if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from / Bytes.rindex_from" - } - }); + if (!(i < -1 || i >= s.length)) { + return rindex_rec(s, i, c); } - return rindex_rec(s, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from" + } + }); } function rindex_rec_opt(s, _i, c) { @@ -208,15 +209,15 @@ function rindex_opt(s, c) { } function rindex_from_opt(s, i, c) { - if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from_opt / Bytes.rindex_from_opt" - } - }); + if (!(i < -1 || i >= s.length)) { + return rindex_rec_opt(s, i, c); } - return rindex_rec_opt(s, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt" + } + }); } function contains_from(s, i, c) { diff --git a/lib/es6/sys.js b/lib/es6/sys.js index 4560a77f53..7ddb3c3ddd 100644 --- a/lib/es6/sys.js +++ b/lib/es6/sys.js @@ -45,14 +45,27 @@ function set_signal(sig_num, sig_beh) { let Break = /* @__PURE__ */Caml_exceptions.create("Sys.Break"); function catch_break(on) { - + if (on) { + return set_signal(-6, { + TAG: "Signal_handle", + _0: (function (param) { + throw new Error(Break, { + cause: { + RE_EXN_ID: Break + } + }); + }) + }); + } else { + return set_signal(-6, "Signal_default"); + } } function enable_runtime_warnings(param) { } -function runtime_warnings_enabled(param) { +function runtime_warnings_enabled() { return false; } diff --git a/lib/es6/uchar.js b/lib/es6/uchar.js index f98c218a31..cfb8c42324 100644 --- a/lib/es6/uchar.js +++ b/lib/es6/uchar.js @@ -15,30 +15,30 @@ function succ(u) { if (u === 55295) { return 57344; } - if (u === 1114111) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "U+10FFFF has no successor" - } - }); + if (u !== 1114111) { + return u + 1 | 0; } - return u + 1 | 0; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "U+10FFFF has no successor" + } + }); } function pred(u) { if (u === 57344) { return 55295; } - if (u === 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "U+0000 has no predecessor" - } - }); + if (u !== 0) { + return u - 1 | 0; } - return u - 1 | 0; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "U+0000 has no predecessor" + } + }); } function is_valid(i) { diff --git a/lib/js/arg.js b/lib/js/arg.js index 04386fd044..6adf5e61c8 100644 --- a/lib/js/arg.js +++ b/lib/js/arg.js @@ -4,14 +4,13 @@ let Sys = require("./sys.js"); let Caml = require("./caml.js"); let List = require("./list.js"); let $$Array = require("./array.js"); -let Curry = require("./curry.js"); let Buffer = require("./buffer.js"); let $$String = require("./string.js"); let Caml_obj = require("./caml_obj.js"); let Caml_array = require("./caml_array.js"); -let Pervasives = require("./pervasives.js"); let Caml_format = require("./caml_format.js"); let Caml_string = require("./caml_string.js"); +let PervasivesU = require("./pervasivesU.js"); let Caml_exceptions = require("./caml_exceptions.js"); let Caml_js_exceptions = require("./caml_js_exceptions.js"); @@ -59,7 +58,7 @@ function make_symlist(prefix, sep, suffix, l) { } } -function help_action(param) { +function help_action() { throw new Error(Stop, { cause: { RE_EXN_ID: Stop, @@ -122,7 +121,7 @@ function add_help(speclist) { }); } } - return Pervasives.$at(speclist, Pervasives.$at(add1, add2)); + return PervasivesU.$at(speclist, PervasivesU.$at(add1, add2)); } function usage_b(buf, speclist, errmsg) { @@ -158,7 +157,7 @@ let current = { function bool_of_string_opt(x) { try { - return Pervasives.bool_of_string(x); + return PervasivesU.bool_of_string(x); } catch (raw_exn){ let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); @@ -293,7 +292,7 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist } } let follow = match[1]; - let no_arg = function (param) { + let no_arg = function () { if (follow === undefined) { return; } @@ -309,7 +308,7 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist } }); }; - let get_arg = function (param) { + let get_arg = function () { if (follow !== undefined) { return follow; } @@ -326,7 +325,7 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist } }); }; - let consume_arg = function (param) { + let consume_arg = function () { if (follow !== undefined) { return; } else { @@ -337,12 +336,12 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist let treat_action = function (f) { switch (f.TAG) { case "Unit" : - return Curry._1(f._0, undefined); + return f._0(); case "Bool" : let arg = get_arg(); let s$1 = bool_of_string_opt(arg); if (s$1 !== undefined) { - Curry._1(f._0, s$1); + f._0(s$1); } else { throw new Error(Stop, { cause: { @@ -367,7 +366,7 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist return; case "String" : let arg$1 = get_arg(); - Curry._1(f._0, arg$1); + f._0(arg$1); return consume_arg(); case "Set_string" : f._0.contents = get_arg(); @@ -376,7 +375,7 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist let arg$2 = get_arg(); let x = int_of_string_opt(arg$2); if (x !== undefined) { - Curry._1(f._0, x); + f._0(x); } else { throw new Error(Stop, { cause: { @@ -414,7 +413,7 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist let arg$4 = get_arg(); let x$2 = float_of_string_opt(arg$4); if (x$2 !== undefined) { - Curry._1(f._0, x$2); + f._0(x$2); } else { throw new Error(Stop, { cause: { @@ -454,7 +453,7 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist let symb = f._0; let arg$6 = get_arg(); if (List.mem(arg$6, symb)) { - Curry._1(f._1, arg$6); + f._1(arg$6); return consume_arg(); } throw new Error(Stop, { @@ -471,7 +470,7 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist case "Rest" : let f$1 = f._0; while(current.contents < (argv.contents.length - 1 | 0)) { - Curry._1(f$1, Caml_array.get(argv.contents, current.contents + 1 | 0)); + f$1(Caml_array.get(argv.contents, current.contents + 1 | 0)); consume_arg(); }; return; @@ -485,7 +484,7 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist }); } let arg$7 = get_arg(); - let newarg = Curry._1(f._0, arg$7); + let newarg = f._0(arg$7); consume_arg(); let before = $$Array.sub(argv.contents, 0, current.contents + 1 | 0); let after = $$Array.sub(argv.contents, current.contents + 1 | 0, (argv.contents.length - current.contents | 0) - 1 | 0); @@ -505,7 +504,7 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist }; treat_action(match[0]); } else { - Curry._1(anonfun, s); + anonfun(s); } } catch (raw_m){ @@ -560,11 +559,11 @@ function parse(l, f, msg) { let msg$1 = Caml_js_exceptions.internalToOCamlException(raw_msg); if (msg$1.RE_EXN_ID === Bad) { console.log(msg$1._1); - return Pervasives.exit(2); + return PervasivesU.exit(2); } if (msg$1.RE_EXN_ID === Help) { console.log(msg$1._1); - return Pervasives.exit(0); + return PervasivesU.exit(0); } throw new Error(msg$1.RE_EXN_ID, { cause: msg$1 @@ -580,11 +579,11 @@ function parse_dynamic(l, f, msg) { let msg$1 = Caml_js_exceptions.internalToOCamlException(raw_msg); if (msg$1.RE_EXN_ID === Bad) { console.log(msg$1._1); - return Pervasives.exit(2); + return PervasivesU.exit(2); } if (msg$1.RE_EXN_ID === Help) { console.log(msg$1._1); - return Pervasives.exit(0); + return PervasivesU.exit(0); } throw new Error(msg$1.RE_EXN_ID, { cause: msg$1 @@ -609,11 +608,11 @@ function parse_expand(l, f, msg) { let msg$1 = Caml_js_exceptions.internalToOCamlException(raw_msg); if (msg$1.RE_EXN_ID === Bad) { console.log(msg$1._1); - return Pervasives.exit(2); + return PervasivesU.exit(2); } if (msg$1.RE_EXN_ID === Help) { console.log(msg$1._1); - return Pervasives.exit(0); + return PervasivesU.exit(0); } throw new Error(msg$1.RE_EXN_ID, { cause: msg$1 @@ -695,7 +694,7 @@ function replace_leading_tab(s) { } function align(limitOpt, speclist) { - let limit = limitOpt !== undefined ? limitOpt : Pervasives.max_int; + let limit = limitOpt !== undefined ? limitOpt : PervasivesU.max_int; let completed = add_help(speclist); let len = List.fold_left(max_arg_len, 0, completed); let len$1 = len < limit ? len : limit; diff --git a/lib/js/array.js b/lib/js/array.js index 7fc81c11d0..5580be4143 100644 --- a/lib/js/array.js +++ b/lib/js/array.js @@ -1,6 +1,5 @@ 'use strict'; -let Curry = require("./curry.js"); let Caml_obj = require("./caml_obj.js"); let Caml_array = require("./caml_array.js"); let Caml_exceptions = require("./caml_exceptions.js"); @@ -22,9 +21,9 @@ function init(l, f) { } }); } - let res = Caml_array.make(l, Curry._1(f, 0)); + let res = Caml_array.make(l, f(0)); for(let i = 1; i < l; ++i){ - res[i] = Curry._1(f, i); + res[i] = f(i); } return res; } @@ -58,15 +57,15 @@ function append(a1, a2) { } function sub(a, ofs, len) { - if (ofs < 0 || len < 0 || ofs > (a.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.sub" - } - }); + if (!(ofs < 0 || len < 0 || ofs > (a.length - len | 0))) { + return Caml_array.sub(a, ofs, len); } - return Caml_array.sub(a, ofs, len); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Array.sub" + } + }); } function fill(a, ofs, len, v) { @@ -84,20 +83,20 @@ function fill(a, ofs, len, v) { } function blit(a1, ofs1, a2, ofs2, len) { - if (len < 0 || ofs1 < 0 || ofs1 > (a1.length - len | 0) || ofs2 < 0 || ofs2 > (a2.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.blit" - } - }); + if (!(len < 0 || ofs1 < 0 || ofs1 > (a1.length - len | 0) || ofs2 < 0 || ofs2 > (a2.length - len | 0))) { + return Caml_array.blit(a1, ofs1, a2, ofs2, len); } - Caml_array.blit(a1, ofs1, a2, ofs2, len); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Array.blit" + } + }); } function iter(f, a) { for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ - Curry._1(f, a[i]); + f(a[i]); } } @@ -111,7 +110,7 @@ function iter2(f, a, b) { }); } for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ - Curry._2(f, a[i], b[i]); + f(a[i], b[i]); } } @@ -120,9 +119,9 @@ function map(f, a) { if (l === 0) { return []; } - let r = Caml_array.make(l, Curry._1(f, a[0])); + let r = Caml_array.make(l, f(a[0])); for(let i = 1; i < l; ++i){ - r[i] = Curry._1(f, a[i]); + r[i] = f(a[i]); } return r; } @@ -141,16 +140,16 @@ function map2(f, a, b) { if (la === 0) { return []; } - let r = Caml_array.make(la, Curry._2(f, a[0], b[0])); + let r = Caml_array.make(la, f(a[0], b[0])); for(let i = 1; i < la; ++i){ - r[i] = Curry._2(f, a[i], b[i]); + r[i] = f(a[i], b[i]); } return r; } function iteri(f, a) { for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ - Curry._2(f, i, a[i]); + f(i, a[i]); } } @@ -159,9 +158,9 @@ function mapi(f, a) { if (l === 0) { return []; } - let r = Caml_array.make(l, Curry._2(f, 0, a[0])); + let r = Caml_array.make(l, f(0, a[0])); for(let i = 1; i < l; ++i){ - r[i] = Curry._2(f, i, a[i]); + r[i] = f(i, a[i]); } return r; } @@ -220,7 +219,7 @@ function of_list(param) { function fold_left(f, x, a) { let r = x; for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ - r = Curry._2(f, r, a[i]); + r = f(r, a[i]); } return r; } @@ -228,7 +227,7 @@ function fold_left(f, x, a) { function fold_right(f, a, x) { let r = x; for(let i = a.length - 1 | 0; i >= 0; --i){ - r = Curry._2(f, a[i], r); + r = f(a[i], r); } return r; } @@ -241,7 +240,7 @@ function exists(p, a) { if (i === n) { return false; } - if (Curry._1(p, a[i])) { + if (p(a[i])) { return true; } _i = i + 1 | 0; @@ -257,7 +256,7 @@ function for_all(p, a) { if (i === n) { return true; } - if (!Curry._1(p, a[i])) { + if (!p(a[i])) { return false; } _i = i + 1 | 0; @@ -304,15 +303,15 @@ function sort(cmp, a) { let i31 = ((i + i | 0) + i | 0) + 1 | 0; let x = i31; if ((i31 + 2 | 0) < l) { - if (Curry._2(cmp, Caml_array.get(a, i31), Caml_array.get(a, i31 + 1 | 0)) < 0) { + if (cmp(Caml_array.get(a, i31), Caml_array.get(a, i31 + 1 | 0)) < 0) { x = i31 + 1 | 0; } - if (Curry._2(cmp, Caml_array.get(a, x), Caml_array.get(a, i31 + 2 | 0)) < 0) { + if (cmp(Caml_array.get(a, x), Caml_array.get(a, i31 + 2 | 0)) < 0) { x = i31 + 2 | 0; } return x; } - if ((i31 + 1 | 0) < l && Curry._2(cmp, Caml_array.get(a, i31), Caml_array.get(a, i31 + 1 | 0)) < 0) { + if ((i31 + 1 | 0) < l && cmp(Caml_array.get(a, i31), Caml_array.get(a, i31 + 1 | 0)) < 0) { return i31 + 1 | 0; } if (i31 < l) { @@ -331,7 +330,7 @@ function sort(cmp, a) { while(true) { let i$1 = _i; let j = maxson(l, i$1); - if (Curry._2(cmp, Caml_array.get(a, j), e) <= 0) { + if (cmp(Caml_array.get(a, j), e) <= 0) { return Caml_array.set(a, i$1, e); } Caml_array.set(a, i$1, Caml_array.get(a, j)); @@ -386,7 +385,7 @@ function sort(cmp, a) { } }); } - if (Curry._2(cmp, Caml_array.get(a, father), e) >= 0) { + if (cmp(Caml_array.get(a, father), e) >= 0) { return Caml_array.set(a, i, e); } Caml_array.set(a, i, Caml_array.get(a, father)); @@ -429,7 +428,7 @@ function stable_sort(cmp, a) { let i2 = _i2; let s1 = _s1; let i1 = _i1; - if (Curry._2(cmp, s1, s2) <= 0) { + if (cmp(s1, s2) <= 0) { Caml_array.set(dst, d, s1); let i1$1 = i1 + 1 | 0; if (i1$1 >= src1r) { @@ -455,7 +454,7 @@ function stable_sort(cmp, a) { for(let i = 0; i < len; ++i){ let e = Caml_array.get(a, srcofs + i | 0); let j = (dstofs + i | 0) - 1 | 0; - while(j >= dstofs && Curry._2(cmp, Caml_array.get(dst, j), e) > 0) { + while(j >= dstofs && cmp(Caml_array.get(dst, j), e) > 0) { Caml_array.set(dst, j + 1 | 0, Caml_array.get(dst, j)); j = j - 1 | 0; }; diff --git a/lib/js/arrayLabels.js b/lib/js/arrayLabels.js index b1dd65cc0f..961b8f8729 100644 --- a/lib/js/arrayLabels.js +++ b/lib/js/arrayLabels.js @@ -1,6 +1,5 @@ 'use strict'; -let Curry = require("./curry.js"); let Caml_obj = require("./caml_obj.js"); let Caml_array = require("./caml_array.js"); let Caml_exceptions = require("./caml_exceptions.js"); @@ -22,9 +21,9 @@ function init(l, f) { } }); } - let res = Caml_array.make(l, Curry._1(f, 0)); + let res = Caml_array.make(l, f(0)); for(let i = 1; i < l; ++i){ - res[i] = Curry._1(f, i); + res[i] = f(i); } return res; } @@ -58,15 +57,15 @@ function append(a1, a2) { } function sub(a, ofs, len) { - if (ofs < 0 || len < 0 || ofs > (a.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.sub" - } - }); + if (!(ofs < 0 || len < 0 || ofs > (a.length - len | 0))) { + return Caml_array.sub(a, ofs, len); } - return Caml_array.sub(a, ofs, len); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Array.sub" + } + }); } function fill(a, ofs, len, v) { @@ -84,20 +83,20 @@ function fill(a, ofs, len, v) { } function blit(a1, ofs1, a2, ofs2, len) { - if (len < 0 || ofs1 < 0 || ofs1 > (a1.length - len | 0) || ofs2 < 0 || ofs2 > (a2.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.blit" - } - }); + if (!(len < 0 || ofs1 < 0 || ofs1 > (a1.length - len | 0) || ofs2 < 0 || ofs2 > (a2.length - len | 0))) { + return Caml_array.blit(a1, ofs1, a2, ofs2, len); } - Caml_array.blit(a1, ofs1, a2, ofs2, len); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Array.blit" + } + }); } function iter(f, a) { for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ - Curry._1(f, a[i]); + f(a[i]); } } @@ -111,7 +110,7 @@ function iter2(f, a, b) { }); } for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ - Curry._2(f, a[i], b[i]); + f(a[i], b[i]); } } @@ -120,9 +119,9 @@ function map(f, a) { if (l === 0) { return []; } - let r = Caml_array.make(l, Curry._1(f, a[0])); + let r = Caml_array.make(l, f(a[0])); for(let i = 1; i < l; ++i){ - r[i] = Curry._1(f, a[i]); + r[i] = f(a[i]); } return r; } @@ -141,16 +140,16 @@ function map2(f, a, b) { if (la === 0) { return []; } - let r = Caml_array.make(la, Curry._2(f, a[0], b[0])); + let r = Caml_array.make(la, f(a[0], b[0])); for(let i = 1; i < la; ++i){ - r[i] = Curry._2(f, a[i], b[i]); + r[i] = f(a[i], b[i]); } return r; } function iteri(f, a) { for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ - Curry._2(f, i, a[i]); + f(i, a[i]); } } @@ -159,9 +158,9 @@ function mapi(f, a) { if (l === 0) { return []; } - let r = Caml_array.make(l, Curry._2(f, 0, a[0])); + let r = Caml_array.make(l, f(0, a[0])); for(let i = 1; i < l; ++i){ - r[i] = Curry._2(f, i, a[i]); + r[i] = f(i, a[i]); } return r; } @@ -220,7 +219,7 @@ function of_list(param) { function fold_left(f, x, a) { let r = x; for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ - r = Curry._2(f, r, a[i]); + r = f(r, a[i]); } return r; } @@ -228,7 +227,7 @@ function fold_left(f, x, a) { function fold_right(f, a, x) { let r = x; for(let i = a.length - 1 | 0; i >= 0; --i){ - r = Curry._2(f, a[i], r); + r = f(a[i], r); } return r; } @@ -241,7 +240,7 @@ function exists(p, a) { if (i === n) { return false; } - if (Curry._1(p, a[i])) { + if (p(a[i])) { return true; } _i = i + 1 | 0; @@ -257,7 +256,7 @@ function for_all(p, a) { if (i === n) { return true; } - if (!Curry._1(p, a[i])) { + if (!p(a[i])) { return false; } _i = i + 1 | 0; @@ -304,15 +303,15 @@ function sort(cmp, a) { let i31 = ((i + i | 0) + i | 0) + 1 | 0; let x = i31; if ((i31 + 2 | 0) < l) { - if (Curry._2(cmp, Caml_array.get(a, i31), Caml_array.get(a, i31 + 1 | 0)) < 0) { + if (cmp(Caml_array.get(a, i31), Caml_array.get(a, i31 + 1 | 0)) < 0) { x = i31 + 1 | 0; } - if (Curry._2(cmp, Caml_array.get(a, x), Caml_array.get(a, i31 + 2 | 0)) < 0) { + if (cmp(Caml_array.get(a, x), Caml_array.get(a, i31 + 2 | 0)) < 0) { x = i31 + 2 | 0; } return x; } - if ((i31 + 1 | 0) < l && Curry._2(cmp, Caml_array.get(a, i31), Caml_array.get(a, i31 + 1 | 0)) < 0) { + if ((i31 + 1 | 0) < l && cmp(Caml_array.get(a, i31), Caml_array.get(a, i31 + 1 | 0)) < 0) { return i31 + 1 | 0; } if (i31 < l) { @@ -331,7 +330,7 @@ function sort(cmp, a) { while(true) { let i$1 = _i; let j = maxson(l, i$1); - if (Curry._2(cmp, Caml_array.get(a, j), e) <= 0) { + if (cmp(Caml_array.get(a, j), e) <= 0) { return Caml_array.set(a, i$1, e); } Caml_array.set(a, i$1, Caml_array.get(a, j)); @@ -386,7 +385,7 @@ function sort(cmp, a) { } }); } - if (Curry._2(cmp, Caml_array.get(a, father), e) >= 0) { + if (cmp(Caml_array.get(a, father), e) >= 0) { return Caml_array.set(a, i, e); } Caml_array.set(a, i, Caml_array.get(a, father)); @@ -429,7 +428,7 @@ function stable_sort(cmp, a) { let i2 = _i2; let s1 = _s1; let i1 = _i1; - if (Curry._2(cmp, s1, s2) <= 0) { + if (cmp(s1, s2) <= 0) { Caml_array.set(dst, d, s1); let i1$1 = i1 + 1 | 0; if (i1$1 >= src1r) { @@ -455,7 +454,7 @@ function stable_sort(cmp, a) { for(let i = 0; i < len; ++i){ let e = Caml_array.get(a, srcofs + i | 0); let j = (dstofs + i | 0) - 1 | 0; - while(j >= dstofs && Curry._2(cmp, Caml_array.get(dst, j), e) > 0) { + while(j >= dstofs && cmp(Caml_array.get(dst, j), e) > 0) { Caml_array.set(dst, j + 1 | 0, Caml_array.get(dst, j)); j = j - 1 | 0; }; diff --git a/lib/js/belt_Array.js b/lib/js/belt_Array.js index 2f1ab345bf..905ed7fa04 100644 --- a/lib/js/belt_Array.js +++ b/lib/js/belt_Array.js @@ -1,7 +1,6 @@ 'use strict'; let Caml = require("./caml.js"); -let Curry = require("./curry.js"); let Caml_option = require("./caml_option.js"); function get(arr, i) { @@ -114,7 +113,9 @@ function makeByU(l, f) { } function makeBy(l, f) { - return makeByU(l, Curry.__1(f)); + return makeByU(l, (function (a) { + return f(a); + })); } function makeByAndShuffleU(l, f) { @@ -124,7 +125,9 @@ function makeByAndShuffleU(l, f) { } function makeByAndShuffle(l, f) { - return makeByAndShuffleU(l, Curry.__1(f)); + return makeByAndShuffleU(l, (function (a) { + return f(a); + })); } function range(start, finish) { @@ -180,7 +183,9 @@ function zipByU(xs, ys, f) { } function zipBy(xs, ys, f) { - return zipByU(xs, ys, Curry.__2(f)); + return zipByU(xs, ys, (function (a, b) { + return f(a, b); + })); } function concat(a1, a2) { @@ -295,7 +300,9 @@ function forEachU(a, f) { } function forEach(a, f) { - forEachU(a, Curry.__1(f)); + forEachU(a, (function (a) { + f(a); + })); } function mapU(a, f) { @@ -308,7 +315,9 @@ function mapU(a, f) { } function map(a, f) { - return mapU(a, Curry.__1(f)); + return mapU(a, (function (a) { + return f(a); + })); } function flatMapU(a, f) { @@ -316,7 +325,9 @@ function flatMapU(a, f) { } function flatMap(a, f) { - return concatMany(mapU(a, Curry.__1(f))); + return flatMapU(a, (function (a) { + return f(a); + })); } function getByU(a, p) { @@ -334,7 +345,9 @@ function getByU(a, p) { } function getBy(a, p) { - return getByU(a, Curry.__1(p)); + return getByU(a, (function (a) { + return p(a); + })); } function getIndexByU(a, p) { @@ -352,7 +365,9 @@ function getIndexByU(a, p) { } function getIndexBy(a, p) { - return getIndexByU(a, Curry.__1(p)); + return getIndexByU(a, (function (a) { + return p(a); + })); } function keepU(a, f) { @@ -372,7 +387,9 @@ function keepU(a, f) { } function keep(a, f) { - return keepU(a, Curry.__1(f)); + return keepU(a, (function (a) { + return f(a); + })); } function keepWithIndexU(a, f) { @@ -392,7 +409,9 @@ function keepWithIndexU(a, f) { } function keepWithIndex(a, f) { - return keepWithIndexU(a, Curry.__2(f)); + return keepWithIndexU(a, (function (a, i) { + return f(a, i); + })); } function keepMapU(a, f) { @@ -413,7 +432,9 @@ function keepMapU(a, f) { } function keepMap(a, f) { - return keepMapU(a, Curry.__1(f)); + return keepMapU(a, (function (a) { + return f(a); + })); } function forEachWithIndexU(a, f) { @@ -423,7 +444,9 @@ function forEachWithIndexU(a, f) { } function forEachWithIndex(a, f) { - forEachWithIndexU(a, Curry.__2(f)); + forEachWithIndexU(a, (function (a, b) { + f(a, b); + })); } function mapWithIndexU(a, f) { @@ -436,7 +459,9 @@ function mapWithIndexU(a, f) { } function mapWithIndex(a, f) { - return mapWithIndexU(a, Curry.__2(f)); + return mapWithIndexU(a, (function (a, b) { + return f(a, b); + })); } function reduceU(a, x, f) { @@ -448,7 +473,9 @@ function reduceU(a, x, f) { } function reduce(a, x, f) { - return reduceU(a, x, Curry.__2(f)); + return reduceU(a, x, (function (a, b) { + return f(a, b); + })); } function reduceReverseU(a, x, f) { @@ -460,7 +487,9 @@ function reduceReverseU(a, x, f) { } function reduceReverse(a, x, f) { - return reduceReverseU(a, x, Curry.__2(f)); + return reduceReverseU(a, x, (function (a, b) { + return f(a, b); + })); } function reduceReverse2U(a, b, x, f) { @@ -473,7 +502,9 @@ function reduceReverse2U(a, b, x, f) { } function reduceReverse2(a, b, x, f) { - return reduceReverse2U(a, b, x, Curry.__3(f)); + return reduceReverse2U(a, b, x, (function (a, b, c) { + return f(a, b, c); + })); } function reduceWithIndexU(a, x, f) { @@ -485,7 +516,9 @@ function reduceWithIndexU(a, x, f) { } function reduceWithIndex(a, x, f) { - return reduceWithIndexU(a, x, Curry.__3(f)); + return reduceWithIndexU(a, x, (function (a, b, c) { + return f(a, b, c); + })); } function everyU(arr, b) { @@ -505,7 +538,9 @@ function everyU(arr, b) { } function every(arr, f) { - return everyU(arr, Curry.__1(f)); + return everyU(arr, (function (b) { + return f(b); + })); } function someU(arr, b) { @@ -525,7 +560,9 @@ function someU(arr, b) { } function some(arr, f) { - return someU(arr, Curry.__1(f)); + return someU(arr, (function (b) { + return f(b); + })); } function everyAux2(arr1, arr2, _i, b, len) { @@ -547,7 +584,9 @@ function every2U(a, b, p) { } function every2(a, b, p) { - return every2U(a, b, Curry.__2(p)); + return every2U(a, b, (function (a, b) { + return p(a, b); + })); } function some2U(a, b, p) { @@ -567,7 +606,9 @@ function some2U(a, b, p) { } function some2(a, b, p) { - return some2U(a, b, Curry.__2(p)); + return some2U(a, b, (function (a, b) { + return p(a, b); + })); } function eqU(a, b, p) { @@ -581,7 +622,9 @@ function eqU(a, b, p) { } function eq(a, b, p) { - return eqU(a, b, Curry.__2(p)); + return eqU(a, b, (function (a, b) { + return p(a, b); + })); } function cmpU(a, b, p) { @@ -609,7 +652,9 @@ function cmpU(a, b, p) { } function cmp(a, b, p) { - return cmpU(a, b, Curry.__2(p)); + return cmpU(a, b, (function (a, b) { + return p(a, b); + })); } function partitionU(a, f) { @@ -637,7 +682,9 @@ function partitionU(a, f) { } function partition(a, f) { - return partitionU(a, Curry.__1(f)); + return partitionU(a, (function (x) { + return f(x); + })); } function unzip(a) { @@ -676,7 +723,9 @@ function joinWithU(a, sep, toString) { } function joinWith(a, sep, toString) { - return joinWithU(a, sep, Curry.__1(toString)); + return joinWithU(a, sep, (function (x) { + return toString(x); + })); } function initU(n, f) { @@ -688,7 +737,9 @@ function initU(n, f) { } function init(n, f) { - return initU(n, Curry.__1(f)); + return initU(n, (function (i) { + return f(i); + })); } exports.get = get; diff --git a/lib/js/belt_HashMapInt.js b/lib/js/belt_HashMapInt.js index 7c91e287d5..69e651f5a1 100644 --- a/lib/js/belt_HashMapInt.js +++ b/lib/js/belt_HashMapInt.js @@ -193,7 +193,7 @@ function size(h) { function fromArray(arr) { let len = arr.length; - let v = Belt_internalBucketsType.make(undefined, undefined, len); + let v = make(len); for(let i = 0; i < len; ++i){ let match = arr[i]; set(v, match[0], match[1]); diff --git a/lib/js/belt_HashMapString.js b/lib/js/belt_HashMapString.js index 258b989a29..ee4a0d8f31 100644 --- a/lib/js/belt_HashMapString.js +++ b/lib/js/belt_HashMapString.js @@ -193,7 +193,7 @@ function size(h) { function fromArray(arr) { let len = arr.length; - let v = Belt_internalBucketsType.make(undefined, undefined, len); + let v = make(len); for(let i = 0; i < len; ++i){ let match = arr[i]; set(v, match[0], match[1]); diff --git a/lib/js/belt_Id.js b/lib/js/belt_Id.js index 2a855d8e40..04d2ce0b37 100644 --- a/lib/js/belt_Id.js +++ b/lib/js/belt_Id.js @@ -1,6 +1,5 @@ 'use strict'; -let Curry = require("./curry.js"); function MakeComparableU(M) { return M; @@ -8,7 +7,9 @@ function MakeComparableU(M) { function MakeComparable(M) { let cmp = M.cmp; - let cmp$1 = Curry.__2(cmp); + let cmp$1 = function (a, b) { + return cmp(a, b); + }; return { cmp: cmp$1 }; @@ -21,7 +22,9 @@ function comparableU(cmp) { } function comparable(cmp) { - let cmp$1 = Curry.__2(cmp); + let cmp$1 = function (a, b) { + return cmp(a, b); + }; return { cmp: cmp$1 }; @@ -33,9 +36,13 @@ function MakeHashableU(M) { function MakeHashable(M) { let hash = M.hash; - let hash$1 = Curry.__1(hash); + let hash$1 = function (a) { + return hash(a); + }; let eq = M.eq; - let eq$1 = Curry.__2(eq); + let eq$1 = function (a, b) { + return eq(a, b); + }; return { hash: hash$1, eq: eq$1 @@ -50,8 +57,12 @@ function hashableU(hash, eq) { } function hashable(hash, eq) { - let hash$1 = Curry.__1(hash); - let eq$1 = Curry.__2(eq); + let hash$1 = function (a) { + return hash(a); + }; + let eq$1 = function (a, b) { + return eq(a, b); + }; return { hash: hash$1, eq: eq$1 diff --git a/lib/js/belt_List.js b/lib/js/belt_List.js index f7dfff3494..069df3dc72 100644 --- a/lib/js/belt_List.js +++ b/lib/js/belt_List.js @@ -1,6 +1,5 @@ 'use strict'; -let Curry = require("./curry.js"); let Belt_Array = require("./belt_Array.js"); let Caml_option = require("./caml_option.js"); let Belt_SortArray = require("./belt_SortArray.js"); @@ -527,7 +526,9 @@ function mapU(xs, f) { } function map(xs, f) { - return mapU(xs, Curry.__1(f)); + return mapU(xs, (function (x) { + return f(x); + })); } function zipByU(l1, l2, f) { @@ -546,7 +547,9 @@ function zipByU(l1, l2, f) { } function zipBy(l1, l2, f) { - return zipByU(l1, l2, Curry.__2(f)); + return zipByU(l1, l2, (function (x, y) { + return f(x, y); + })); } function mapWithIndexU(xs, f) { @@ -562,7 +565,9 @@ function mapWithIndexU(xs, f) { } function mapWithIndex(xs, f) { - return mapWithIndexU(xs, Curry.__2(f)); + return mapWithIndexU(xs, (function (i, x) { + return f(i, x); + })); } function makeByU(n, f) { @@ -588,7 +593,9 @@ function makeByU(n, f) { } function makeBy(n, f) { - return makeByU(n, Curry.__1(f)); + return makeByU(n, (function (x) { + return f(x); + })); } function make(n, v) { @@ -762,7 +769,9 @@ function mapReverseU(l, f) { } function mapReverse(l, f) { - return mapReverseU(l, Curry.__1(f)); + return mapReverseU(l, (function (x) { + return f(x); + })); } function forEachU(_xs, f) { @@ -778,7 +787,9 @@ function forEachU(_xs, f) { } function forEach(xs, f) { - forEachU(xs, Curry.__1(f)); + forEachU(xs, (function (x) { + return f(x); + })); } function forEachWithIndexU(l, f) { @@ -798,7 +809,9 @@ function forEachWithIndexU(l, f) { } function forEachWithIndex(l, f) { - forEachWithIndexU(l, Curry.__2(f)); + forEachWithIndexU(l, (function (i, x) { + return f(i, x); + })); } function reduceU(_l, _accu, f) { @@ -815,7 +828,9 @@ function reduceU(_l, _accu, f) { } function reduce(l, accu, f) { - return reduceU(l, accu, Curry.__2(f)); + return reduceU(l, accu, (function (acc, x) { + return f(acc, x); + })); } function reduceReverseUnsafeU(l, accu, f) { @@ -836,7 +851,9 @@ function reduceReverseU(l, acc, f) { } function reduceReverse(l, accu, f) { - return reduceReverseU(l, accu, Curry.__2(f)); + return reduceReverseU(l, accu, (function (a, b) { + return f(a, b); + })); } function reduceWithIndexU(l, acc, f) { @@ -858,7 +875,9 @@ function reduceWithIndexU(l, acc, f) { } function reduceWithIndex(l, acc, f) { - return reduceWithIndexU(l, acc, Curry.__3(f)); + return reduceWithIndexU(l, acc, (function (acc, x, i) { + return f(acc, x, i); + })); } function mapReverse2U(l1, l2, f) { @@ -886,7 +905,9 @@ function mapReverse2U(l1, l2, f) { } function mapReverse2(l1, l2, f) { - return mapReverse2U(l1, l2, Curry.__2(f)); + return mapReverse2U(l1, l2, (function (a, b) { + return f(a, b); + })); } function forEach2U(_l1, _l2, f) { @@ -907,7 +928,9 @@ function forEach2U(_l1, _l2, f) { } function forEach2(l1, l2, f) { - forEach2U(l1, l2, Curry.__2(f)); + forEach2U(l1, l2, (function (a, b) { + return f(a, b); + })); } function reduce2U(_l1, _l2, _accu, f) { @@ -929,7 +952,9 @@ function reduce2U(_l1, _l2, _accu, f) { } function reduce2(l1, l2, acc, f) { - return reduce2U(l1, l2, acc, Curry.__3(f)); + return reduce2U(l1, l2, acc, (function (a, b, c) { + return f(a, b, c); + })); } function reduceReverse2UnsafeU(l1, l2, accu, f) { @@ -950,7 +975,9 @@ function reduceReverse2U(l1, l2, acc, f) { } function reduceReverse2(l1, l2, acc, f) { - return reduceReverse2U(l1, l2, acc, Curry.__3(f)); + return reduceReverse2U(l1, l2, acc, (function (a, b, c) { + return f(a, b, c); + })); } function everyU(_xs, p) { @@ -968,7 +995,9 @@ function everyU(_xs, p) { } function every(xs, p) { - return everyU(xs, Curry.__1(p)); + return everyU(xs, (function (x) { + return p(x); + })); } function someU(_xs, p) { @@ -986,7 +1015,9 @@ function someU(_xs, p) { } function some(xs, p) { - return someU(xs, Curry.__1(p)); + return someU(xs, (function (x) { + return p(x); + })); } function every2U(_l1, _l2, p) { @@ -1009,7 +1040,9 @@ function every2U(_l1, _l2, p) { } function every2(l1, l2, p) { - return every2U(l1, l2, Curry.__2(p)); + return every2U(l1, l2, (function (a, b) { + return p(a, b); + })); } function cmpByLength(_l1, _l2) { @@ -1057,7 +1090,9 @@ function cmpU(_l1, _l2, p) { } function cmp(l1, l2, f) { - return cmpU(l1, l2, Curry.__2(f)); + return cmpU(l1, l2, (function (x, y) { + return f(x, y); + })); } function eqU(_l1, _l2, p) { @@ -1084,7 +1119,9 @@ function eqU(_l1, _l2, p) { } function eq(l1, l2, f) { - return eqU(l1, l2, Curry.__2(f)); + return eqU(l1, l2, (function (x, y) { + return f(x, y); + })); } function some2U(_l1, _l2, p) { @@ -1107,7 +1144,9 @@ function some2U(_l1, _l2, p) { } function some2(l1, l2, p) { - return some2U(l1, l2, Curry.__2(p)); + return some2U(l1, l2, (function (a, b) { + return p(a, b); + })); } function hasU(_xs, x, eq) { @@ -1125,7 +1164,9 @@ function hasU(_xs, x, eq) { } function has(xs, x, eq) { - return hasU(xs, x, Curry.__2(eq)); + return hasU(xs, x, (function (a, b) { + return eq(a, b); + })); } function getAssocU(_xs, x, eq) { @@ -1144,7 +1185,9 @@ function getAssocU(_xs, x, eq) { } function getAssoc(xs, x, eq) { - return getAssocU(xs, x, Curry.__2(eq)); + return getAssocU(xs, x, (function (a, b) { + return eq(a, b); + })); } function hasAssocU(_xs, x, eq) { @@ -1162,7 +1205,9 @@ function hasAssocU(_xs, x, eq) { } function hasAssoc(xs, x, eq) { - return hasAssocU(xs, x, Curry.__2(eq)); + return hasAssocU(xs, x, (function (a, b) { + return eq(a, b); + })); } function removeAssocU(xs, x, eq) { @@ -1187,7 +1232,9 @@ function removeAssocU(xs, x, eq) { } function removeAssoc(xs, x, eq) { - return removeAssocU(xs, x, Curry.__2(eq)); + return removeAssocU(xs, x, (function (a, b) { + return eq(a, b); + })); } function setAssocU(xs, x, k, eq) { @@ -1230,7 +1277,9 @@ function setAssocU(xs, x, k, eq) { } function setAssoc(xs, x, k, eq) { - return setAssocU(xs, x, k, Curry.__2(eq)); + return setAssocU(xs, x, k, (function (a, b) { + return eq(a, b); + })); } function sortU(xs, cmp) { @@ -1240,7 +1289,9 @@ function sortU(xs, cmp) { } function sort(xs, cmp) { - return sortU(xs, Curry.__2(cmp)); + return sortU(xs, (function (x, y) { + return cmp(x, y); + })); } function getByU(_xs, p) { @@ -1259,7 +1310,9 @@ function getByU(_xs, p) { } function getBy(xs, p) { - return getByU(xs, Curry.__1(p)); + return getByU(xs, (function (a) { + return p(a); + })); } function keepU(_xs, p) { @@ -1284,7 +1337,9 @@ function keepU(_xs, p) { } function keep(xs, p) { - return keepU(xs, Curry.__1(p)); + return keepU(xs, (function (x) { + return p(x); + })); } function keepWithIndexU(xs, p) { @@ -1313,7 +1368,9 @@ function keepWithIndexU(xs, p) { } function keepWithIndex(xs, p) { - return keepWithIndexU(xs, Curry.__2(p)); + return keepWithIndexU(xs, (function (x, i) { + return p(x, i); + })); } function keepMapU(_xs, p) { @@ -1338,7 +1395,9 @@ function keepMapU(_xs, p) { } function keepMap(xs, p) { - return keepMapU(xs, Curry.__1(p)); + return keepMapU(xs, (function (x) { + return p(x); + })); } function partitionU(l, p) { @@ -1373,7 +1432,9 @@ function partitionU(l, p) { } function partition(l, p) { - return partitionU(l, Curry.__1(p)); + return partitionU(l, (function (x) { + return p(x); + })); } function unzip(xs) { diff --git a/lib/js/belt_Map.js b/lib/js/belt_Map.js index eb96116851..3db312ce0c 100644 --- a/lib/js/belt_Map.js +++ b/lib/js/belt_Map.js @@ -1,6 +1,5 @@ 'use strict'; -let Curry = require("./curry.js"); let Belt_MapDict = require("./belt_MapDict.js"); function fromArray(data, id) { @@ -59,7 +58,9 @@ function updateU(m, key, f) { } function update(m, key, f) { - return updateU(m, key, Curry.__1(f)); + return updateU(m, key, (function (a) { + return f(a); + })); } function split(m, x) { @@ -90,7 +91,9 @@ function mergeU(s1, s2, f) { } function merge(s1, s2, f) { - return mergeU(s1, s2, Curry.__3(f)); + return mergeU(s1, s2, (function (a, b, c) { + return f(a, b, c); + })); } function make(id) { @@ -109,7 +112,9 @@ function findFirstByU(m, f) { } function findFirstBy(m, f) { - return Belt_MapDict.findFirstByU(m.data, Curry.__2(f)); + return findFirstByU(m, (function (a, b) { + return f(a, b); + })); } function forEachU(m, f) { @@ -117,7 +122,9 @@ function forEachU(m, f) { } function forEach(m, f) { - Belt_MapDict.forEachU(m.data, Curry.__2(f)); + forEachU(m, (function (a, b) { + f(a, b); + })); } function reduceU(m, acc, f) { @@ -125,7 +132,9 @@ function reduceU(m, acc, f) { } function reduce(m, acc, f) { - return reduceU(m, acc, Curry.__3(f)); + return reduceU(m, acc, (function (a, b, c) { + return f(a, b, c); + })); } function everyU(m, f) { @@ -133,7 +142,9 @@ function everyU(m, f) { } function every(m, f) { - return Belt_MapDict.everyU(m.data, Curry.__2(f)); + return everyU(m, (function (a, b) { + return f(a, b); + })); } function someU(m, f) { @@ -141,7 +152,9 @@ function someU(m, f) { } function some(m, f) { - return Belt_MapDict.someU(m.data, Curry.__2(f)); + return someU(m, (function (a, b) { + return f(a, b); + })); } function keepU(m, f) { @@ -152,7 +165,9 @@ function keepU(m, f) { } function keep(m, f) { - return keepU(m, Curry.__2(f)); + return keepU(m, (function (a, b) { + return f(a, b); + })); } function partitionU(m, p) { @@ -171,7 +186,9 @@ function partitionU(m, p) { } function partition(m, p) { - return partitionU(m, Curry.__2(p)); + return partitionU(m, (function (a, b) { + return p(a, b); + })); } function mapU(m, f) { @@ -182,7 +199,9 @@ function mapU(m, f) { } function map(m, f) { - return mapU(m, Curry.__1(f)); + return mapU(m, (function (a) { + return f(a); + })); } function mapWithKeyU(m, f) { @@ -193,7 +212,9 @@ function mapWithKeyU(m, f) { } function mapWithKey(m, f) { - return mapWithKeyU(m, Curry.__2(f)); + return mapWithKeyU(m, (function (a, b) { + return f(a, b); + })); } function size(map) { @@ -277,7 +298,9 @@ function eqU(m1, m2, veq) { } function eq(m1, m2, veq) { - return eqU(m1, m2, Curry.__2(veq)); + return eqU(m1, m2, (function (a, b) { + return veq(a, b); + })); } function cmpU(m1, m2, vcmp) { @@ -285,7 +308,9 @@ function cmpU(m1, m2, vcmp) { } function cmp(m1, m2, vcmp) { - return cmpU(m1, m2, Curry.__2(vcmp)); + return cmpU(m1, m2, (function (a, b) { + return vcmp(a, b); + })); } function getData(m) { diff --git a/lib/js/belt_MapDict.js b/lib/js/belt_MapDict.js index 6109ffbccf..f906153838 100644 --- a/lib/js/belt_MapDict.js +++ b/lib/js/belt_MapDict.js @@ -1,6 +1,5 @@ 'use strict'; -let Curry = require("./curry.js"); let Caml_option = require("./caml_option.js"); let Belt_internalAVLtree = require("./belt_internalAVLtree.js"); @@ -76,7 +75,9 @@ function updateU(t, newK, f, cmp) { } function update(t, newK, f, cmp) { - return updateU(t, newK, Curry.__1(f), cmp); + return updateU(t, newK, (function (a) { + return f(a); + }), cmp); } function removeAux0(n, x, cmp) { @@ -244,7 +245,9 @@ function mergeU(s1, s2, f, cmp) { } function merge(s1, s2, f, cmp) { - return mergeU(s1, s2, Curry.__3(f), cmp); + return mergeU(s1, s2, (function (a, b, c) { + return f(a, b, c); + }), cmp); } function removeMany(t, keys, cmp) { diff --git a/lib/js/belt_MapInt.js b/lib/js/belt_MapInt.js index e0b7e488e7..9143413026 100644 --- a/lib/js/belt_MapInt.js +++ b/lib/js/belt_MapInt.js @@ -1,6 +1,5 @@ 'use strict'; -let Curry = require("./curry.js"); let Caml_option = require("./caml_option.js"); let Belt_internalMapInt = require("./belt_internalMapInt.js"); let Belt_internalAVLtree = require("./belt_internalAVLtree.js"); @@ -73,7 +72,9 @@ function updateU(t, x, f) { } function update(t, x, f) { - return updateU(t, x, Curry.__1(f)); + return updateU(t, x, (function (a) { + return f(a); + })); } function removeAux(n, x) { diff --git a/lib/js/belt_MapString.js b/lib/js/belt_MapString.js index 8503c91b0d..d5f2530092 100644 --- a/lib/js/belt_MapString.js +++ b/lib/js/belt_MapString.js @@ -1,6 +1,5 @@ 'use strict'; -let Curry = require("./curry.js"); let Caml_option = require("./caml_option.js"); let Belt_internalAVLtree = require("./belt_internalAVLtree.js"); let Belt_internalMapString = require("./belt_internalMapString.js"); @@ -73,7 +72,9 @@ function updateU(t, x, f) { } function update(t, x, f) { - return updateU(t, x, Curry.__1(f)); + return updateU(t, x, (function (a) { + return f(a); + })); } function removeAux(n, x) { diff --git a/lib/js/belt_MutableMap.js b/lib/js/belt_MutableMap.js index e08b10898c..13e20ff3c9 100644 --- a/lib/js/belt_MutableMap.js +++ b/lib/js/belt_MutableMap.js @@ -1,6 +1,5 @@ 'use strict'; -let Curry = require("./curry.js"); let Caml_option = require("./caml_option.js"); let Belt_internalAVLtree = require("./belt_internalAVLtree.js"); @@ -137,7 +136,9 @@ function updateU(t, x, f) { } function update(t, x, f) { - updateU(t, x, Curry.__1(f)); + updateU(t, x, (function (a) { + return f(a); + })); } function make(id) { @@ -152,8 +153,7 @@ function clear(m) { } function isEmpty(d) { - let x = d.data; - return x === undefined; + return d.data === undefined; } function minKey(m) { @@ -193,7 +193,9 @@ function forEachU(d, f) { } function forEach(d, f) { - Belt_internalAVLtree.forEachU(d.data, Curry.__2(f)); + forEachU(d, (function (a, b) { + f(a, b); + })); } function reduceU(d, acc, cb) { @@ -201,7 +203,9 @@ function reduceU(d, acc, cb) { } function reduce(d, acc, cb) { - return reduceU(d, acc, Curry.__3(cb)); + return reduceU(d, acc, (function (a, b, c) { + return cb(a, b, c); + })); } function everyU(d, p) { @@ -209,7 +213,9 @@ function everyU(d, p) { } function every(d, p) { - return Belt_internalAVLtree.everyU(d.data, Curry.__2(p)); + return everyU(d, (function (a, b) { + return p(a, b); + })); } function someU(d, p) { @@ -217,7 +223,9 @@ function someU(d, p) { } function some(d, p) { - return Belt_internalAVLtree.someU(d.data, Curry.__2(p)); + return someU(d, (function (a, b) { + return p(a, b); + })); } function size(d) { @@ -249,7 +257,9 @@ function cmpU(m1, m2, cmp) { } function cmp(m1, m2, cmp$1) { - return cmpU(m1, m2, Curry.__2(cmp$1)); + return cmpU(m1, m2, (function (a, b) { + return cmp$1(a, b); + })); } function eqU(m1, m2, cmp) { @@ -257,7 +267,9 @@ function eqU(m1, m2, cmp) { } function eq(m1, m2, cmp) { - return eqU(m1, m2, Curry.__2(cmp)); + return eqU(m1, m2, (function (a, b) { + return cmp(a, b); + })); } function mapU(m, f) { @@ -268,7 +280,9 @@ function mapU(m, f) { } function map(m, f) { - return mapU(m, Curry.__1(f)); + return mapU(m, (function (a) { + return f(a); + })); } function mapWithKeyU(m, f) { @@ -279,7 +293,9 @@ function mapWithKeyU(m, f) { } function mapWithKey(m, f) { - return mapWithKeyU(m, Curry.__2(f)); + return mapWithKeyU(m, (function (a, b) { + return f(a, b); + })); } function get(m, x) { diff --git a/lib/js/belt_MutableMapInt.js b/lib/js/belt_MutableMapInt.js index 273d4d634c..abc68b02b1 100644 --- a/lib/js/belt_MutableMapInt.js +++ b/lib/js/belt_MutableMapInt.js @@ -1,19 +1,17 @@ 'use strict'; -let Curry = require("./curry.js"); let Caml_option = require("./caml_option.js"); let Belt_internalMapInt = require("./belt_internalMapInt.js"); let Belt_internalAVLtree = require("./belt_internalAVLtree.js"); -function make(param) { +function make() { return { data: undefined }; } function isEmpty(m) { - let x = m.data; - return x === undefined; + return m.data === undefined; } function clear(m) { @@ -67,7 +65,9 @@ function forEachU(d, f) { } function forEach(d, f) { - Belt_internalAVLtree.forEachU(d.data, Curry.__2(f)); + forEachU(d, (function (a, b) { + f(a, b); + })); } function mapU(d, f) { @@ -77,7 +77,9 @@ function mapU(d, f) { } function map(d, f) { - return mapU(d, Curry.__1(f)); + return mapU(d, (function (a) { + return f(a); + })); } function mapWithKeyU(d, f) { @@ -87,7 +89,9 @@ function mapWithKeyU(d, f) { } function mapWithKey(d, f) { - return mapWithKeyU(d, Curry.__2(f)); + return mapWithKeyU(d, (function (a, b) { + return f(a, b); + })); } function reduceU(d, acc, f) { @@ -95,7 +99,9 @@ function reduceU(d, acc, f) { } function reduce(d, acc, f) { - return reduceU(d, acc, Curry.__3(f)); + return reduceU(d, acc, (function (a, b, c) { + return f(a, b, c); + })); } function everyU(d, f) { @@ -103,7 +109,9 @@ function everyU(d, f) { } function every(d, f) { - return Belt_internalAVLtree.everyU(d.data, Curry.__2(f)); + return everyU(d, (function (a, b) { + return f(a, b); + })); } function someU(d, f) { @@ -111,7 +119,9 @@ function someU(d, f) { } function some(d, f) { - return Belt_internalAVLtree.someU(d.data, Curry.__2(f)); + return someU(d, (function (a, b) { + return f(a, b); + })); } function size(d) { @@ -240,7 +250,9 @@ function updateU(t, x, f) { } function update(t, x, f) { - updateU(t, x, Curry.__1(f)); + updateU(t, x, (function (a) { + return f(a); + })); } function removeArrayMutateAux(_t, xs, _i, len) { @@ -286,7 +298,9 @@ function cmpU(d0, d1, f) { } function cmp(d0, d1, f) { - return cmpU(d0, d1, Curry.__2(f)); + return cmpU(d0, d1, (function (a, b) { + return f(a, b); + })); } function eqU(d0, d1, f) { @@ -294,7 +308,9 @@ function eqU(d0, d1, f) { } function eq(d0, d1, f) { - return eqU(d0, d1, Curry.__2(f)); + return eqU(d0, d1, (function (a, b) { + return f(a, b); + })); } function get(d, x) { diff --git a/lib/js/belt_MutableMapString.js b/lib/js/belt_MutableMapString.js index ac8297c272..0db5237044 100644 --- a/lib/js/belt_MutableMapString.js +++ b/lib/js/belt_MutableMapString.js @@ -1,19 +1,17 @@ 'use strict'; -let Curry = require("./curry.js"); let Caml_option = require("./caml_option.js"); let Belt_internalAVLtree = require("./belt_internalAVLtree.js"); let Belt_internalMapString = require("./belt_internalMapString.js"); -function make(param) { +function make() { return { data: undefined }; } function isEmpty(m) { - let x = m.data; - return x === undefined; + return m.data === undefined; } function clear(m) { @@ -67,7 +65,9 @@ function forEachU(d, f) { } function forEach(d, f) { - Belt_internalAVLtree.forEachU(d.data, Curry.__2(f)); + forEachU(d, (function (a, b) { + f(a, b); + })); } function mapU(d, f) { @@ -77,7 +77,9 @@ function mapU(d, f) { } function map(d, f) { - return mapU(d, Curry.__1(f)); + return mapU(d, (function (a) { + return f(a); + })); } function mapWithKeyU(d, f) { @@ -87,7 +89,9 @@ function mapWithKeyU(d, f) { } function mapWithKey(d, f) { - return mapWithKeyU(d, Curry.__2(f)); + return mapWithKeyU(d, (function (a, b) { + return f(a, b); + })); } function reduceU(d, acc, f) { @@ -95,7 +99,9 @@ function reduceU(d, acc, f) { } function reduce(d, acc, f) { - return reduceU(d, acc, Curry.__3(f)); + return reduceU(d, acc, (function (a, b, c) { + return f(a, b, c); + })); } function everyU(d, f) { @@ -103,7 +109,9 @@ function everyU(d, f) { } function every(d, f) { - return Belt_internalAVLtree.everyU(d.data, Curry.__2(f)); + return everyU(d, (function (a, b) { + return f(a, b); + })); } function someU(d, f) { @@ -111,7 +119,9 @@ function someU(d, f) { } function some(d, f) { - return Belt_internalAVLtree.someU(d.data, Curry.__2(f)); + return someU(d, (function (a, b) { + return f(a, b); + })); } function size(d) { @@ -240,7 +250,9 @@ function updateU(t, x, f) { } function update(t, x, f) { - updateU(t, x, Curry.__1(f)); + updateU(t, x, (function (a) { + return f(a); + })); } function removeArrayMutateAux(_t, xs, _i, len) { @@ -286,7 +298,9 @@ function cmpU(d0, d1, f) { } function cmp(d0, d1, f) { - return cmpU(d0, d1, Curry.__2(f)); + return cmpU(d0, d1, (function (a, b) { + return f(a, b); + })); } function eqU(d0, d1, f) { @@ -294,7 +308,9 @@ function eqU(d0, d1, f) { } function eq(d0, d1, f) { - return eqU(d0, d1, Curry.__2(f)); + return eqU(d0, d1, (function (a, b) { + return f(a, b); + })); } function get(d, x) { diff --git a/lib/js/belt_MutableQueue.js b/lib/js/belt_MutableQueue.js index 8765924aa2..6f4af135ad 100644 --- a/lib/js/belt_MutableQueue.js +++ b/lib/js/belt_MutableQueue.js @@ -1,9 +1,8 @@ 'use strict'; -let Curry = require("./curry.js"); let Caml_option = require("./caml_option.js"); -function make(param) { +function make() { return { length: 0, first: undefined, @@ -177,7 +176,9 @@ function mapU(q, f) { } function map(q, f) { - return mapU(q, Curry.__1(f)); + return mapU(q, (function (a) { + return f(a); + })); } function isEmpty(q) { @@ -202,7 +203,9 @@ function forEachU(q, f) { } function forEach(q, f) { - forEachU(q, Curry.__1(f)); + forEachU(q, (function (a) { + f(a); + })); } function reduceU(q, accu, f) { @@ -222,7 +225,9 @@ function reduceU(q, accu, f) { } function reduce(q, accu, f) { - return reduceU(q, accu, Curry.__2(f)); + return reduceU(q, accu, (function (a, b) { + return f(a, b); + })); } function transfer(q1, q2) { diff --git a/lib/js/belt_MutableSet.js b/lib/js/belt_MutableSet.js index a1c57a4c22..6b94e54528 100644 --- a/lib/js/belt_MutableSet.js +++ b/lib/js/belt_MutableSet.js @@ -1,6 +1,5 @@ 'use strict'; -let Curry = require("./curry.js"); let Belt_SortArray = require("./belt_SortArray.js"); let Belt_internalAVLset = require("./belt_internalAVLset.js"); @@ -193,8 +192,7 @@ function make(id) { } function isEmpty(d) { - let n = d.data; - return n === undefined; + return d.data === undefined; } function minimum(d) { @@ -218,7 +216,9 @@ function forEachU(d, f) { } function forEach(d, f) { - Belt_internalAVLset.forEachU(d.data, Curry.__1(f)); + forEachU(d, (function (a) { + f(a); + })); } function reduceU(d, acc, cb) { @@ -226,7 +226,9 @@ function reduceU(d, acc, cb) { } function reduce(d, acc, cb) { - return reduceU(d, acc, Curry.__2(cb)); + return reduceU(d, acc, (function (a, b) { + return cb(a, b); + })); } function everyU(d, p) { @@ -234,7 +236,9 @@ function everyU(d, p) { } function every(d, p) { - return Belt_internalAVLset.everyU(d.data, Curry.__1(p)); + return everyU(d, (function (a) { + return p(a); + })); } function someU(d, p) { @@ -242,7 +246,9 @@ function someU(d, p) { } function some(d, p) { - return Belt_internalAVLset.someU(d.data, Curry.__1(p)); + return someU(d, (function (a) { + return p(a); + })); } function size(d) { @@ -340,7 +346,9 @@ function keepU(d, p) { } function keep(d, p) { - return keepU(d, Curry.__1(p)); + return keepU(d, (function (a) { + return p(a); + })); } function partitionU(d, p) { @@ -359,7 +367,9 @@ function partitionU(d, p) { } function partition(d, p) { - return partitionU(d, Curry.__1(p)); + return partitionU(d, (function (a) { + return p(a); + })); } function subset(a, b) { diff --git a/lib/js/belt_MutableSetInt.js b/lib/js/belt_MutableSetInt.js index bca51950bb..691e015f3e 100644 --- a/lib/js/belt_MutableSetInt.js +++ b/lib/js/belt_MutableSetInt.js @@ -1,6 +1,5 @@ 'use strict'; -let Curry = require("./curry.js"); let Belt_SortArrayInt = require("./belt_SortArrayInt.js"); let Belt_internalAVLset = require("./belt_internalAVLset.js"); let Belt_internalSetInt = require("./belt_internalSetInt.js"); @@ -183,15 +182,14 @@ function mergeMany(d, arr) { d.data = addArrayMutate(d.data, arr); } -function make(param) { +function make() { return { data: undefined }; } function isEmpty(d) { - let n = d.data; - return n === undefined; + return d.data === undefined; } function minimum(d) { @@ -215,7 +213,9 @@ function forEachU(d, f) { } function forEach(d, f) { - Belt_internalAVLset.forEachU(d.data, Curry.__1(f)); + forEachU(d, (function (a) { + f(a); + })); } function reduceU(d, acc, cb) { @@ -223,7 +223,9 @@ function reduceU(d, acc, cb) { } function reduce(d, acc, cb) { - return reduceU(d, acc, Curry.__2(cb)); + return reduceU(d, acc, (function (a, b) { + return cb(a, b); + })); } function everyU(d, p) { @@ -231,7 +233,9 @@ function everyU(d, p) { } function every(d, p) { - return Belt_internalAVLset.everyU(d.data, Curry.__1(p)); + return everyU(d, (function (a) { + return p(a); + })); } function someU(d, p) { @@ -239,7 +243,9 @@ function someU(d, p) { } function some(d, p) { - return Belt_internalAVLset.someU(d.data, Curry.__1(p)); + return someU(d, (function (a) { + return p(a); + })); } function size(d) { @@ -328,7 +334,9 @@ function keepU(d, p) { } function keep(d, p) { - return keepU(d, Curry.__1(p)); + return keepU(d, (function (a) { + return p(a); + })); } function partitionU(d, p) { @@ -344,7 +352,9 @@ function partitionU(d, p) { } function partition(d, p) { - return partitionU(d, Curry.__1(p)); + return partitionU(d, (function (a) { + return p(a); + })); } function subset(a, b) { diff --git a/lib/js/belt_MutableSetString.js b/lib/js/belt_MutableSetString.js index 90bc7b9b06..c13ba1c2dc 100644 --- a/lib/js/belt_MutableSetString.js +++ b/lib/js/belt_MutableSetString.js @@ -1,6 +1,5 @@ 'use strict'; -let Curry = require("./curry.js"); let Belt_internalAVLset = require("./belt_internalAVLset.js"); let Belt_SortArrayString = require("./belt_SortArrayString.js"); let Belt_internalSetString = require("./belt_internalSetString.js"); @@ -183,15 +182,14 @@ function mergeMany(d, arr) { d.data = addArrayMutate(d.data, arr); } -function make(param) { +function make() { return { data: undefined }; } function isEmpty(d) { - let n = d.data; - return n === undefined; + return d.data === undefined; } function minimum(d) { @@ -215,7 +213,9 @@ function forEachU(d, f) { } function forEach(d, f) { - Belt_internalAVLset.forEachU(d.data, Curry.__1(f)); + forEachU(d, (function (a) { + f(a); + })); } function reduceU(d, acc, cb) { @@ -223,7 +223,9 @@ function reduceU(d, acc, cb) { } function reduce(d, acc, cb) { - return reduceU(d, acc, Curry.__2(cb)); + return reduceU(d, acc, (function (a, b) { + return cb(a, b); + })); } function everyU(d, p) { @@ -231,7 +233,9 @@ function everyU(d, p) { } function every(d, p) { - return Belt_internalAVLset.everyU(d.data, Curry.__1(p)); + return everyU(d, (function (a) { + return p(a); + })); } function someU(d, p) { @@ -239,7 +243,9 @@ function someU(d, p) { } function some(d, p) { - return Belt_internalAVLset.someU(d.data, Curry.__1(p)); + return someU(d, (function (a) { + return p(a); + })); } function size(d) { @@ -328,7 +334,9 @@ function keepU(d, p) { } function keep(d, p) { - return keepU(d, Curry.__1(p)); + return keepU(d, (function (a) { + return p(a); + })); } function partitionU(d, p) { @@ -344,7 +352,9 @@ function partitionU(d, p) { } function partition(d, p) { - return partitionU(d, Curry.__1(p)); + return partitionU(d, (function (a) { + return p(a); + })); } function subset(a, b) { diff --git a/lib/js/belt_MutableStack.js b/lib/js/belt_MutableStack.js index c7e373880e..aa95d97032 100644 --- a/lib/js/belt_MutableStack.js +++ b/lib/js/belt_MutableStack.js @@ -1,9 +1,8 @@ 'use strict'; -let Curry = require("./curry.js"); let Caml_option = require("./caml_option.js"); -function make(param) { +function make() { return { root: undefined }; @@ -99,7 +98,9 @@ function forEachU(s, f) { } function forEach(s, f) { - forEachU(s, Curry.__1(f)); + forEachU(s, (function (x) { + f(x); + })); } function dynamicPopIterU(s, f) { @@ -115,7 +116,9 @@ function dynamicPopIterU(s, f) { } function dynamicPopIter(s, f) { - dynamicPopIterU(s, Curry.__1(f)); + dynamicPopIterU(s, (function (x) { + f(x); + })); } exports.make = make; diff --git a/lib/js/belt_Option.js b/lib/js/belt_Option.js index 35bc09a45c..699dfdbf58 100644 --- a/lib/js/belt_Option.js +++ b/lib/js/belt_Option.js @@ -1,6 +1,5 @@ 'use strict'; -let Curry = require("./curry.js"); let Caml_option = require("./caml_option.js"); function keepU(opt, p) { @@ -11,7 +10,9 @@ function keepU(opt, p) { } function keep(opt, p) { - return keepU(opt, Curry.__1(p)); + return keepU(opt, (function (x) { + return p(x); + })); } function forEachU(opt, f) { @@ -22,7 +23,9 @@ function forEachU(opt, f) { } function forEach(opt, f) { - forEachU(opt, Curry.__1(f)); + forEachU(opt, (function (x) { + f(x); + })); } function getExn(x) { @@ -45,7 +48,9 @@ function mapWithDefaultU(opt, $$default, f) { } function mapWithDefault(opt, $$default, f) { - return mapWithDefaultU(opt, $$default, Curry.__1(f)); + return mapWithDefaultU(opt, $$default, (function (x) { + return f(x); + })); } function mapU(opt, f) { @@ -56,7 +61,9 @@ function mapU(opt, f) { } function map(opt, f) { - return mapU(opt, Curry.__1(f)); + return mapU(opt, (function (x) { + return f(x); + })); } function flatMapU(opt, f) { @@ -67,7 +74,9 @@ function flatMapU(opt, f) { } function flatMap(opt, f) { - return flatMapU(opt, Curry.__1(f)); + return flatMapU(opt, (function (x) { + return f(x); + })); } function getWithDefault(opt, $$default) { @@ -107,7 +116,9 @@ function eqU(a, b, f) { } function eq(a, b, f) { - return eqU(a, b, Curry.__2(f)); + return eqU(a, b, (function (x, y) { + return f(x, y); + })); } function cmpU(a, b, f) { @@ -125,7 +136,9 @@ function cmpU(a, b, f) { } function cmp(a, b, f) { - return cmpU(a, b, Curry.__2(f)); + return cmpU(a, b, (function (x, y) { + return f(x, y); + })); } exports.keepU = keepU; diff --git a/lib/js/belt_Range.js b/lib/js/belt_Range.js index d269d3cc4a..f5b60d1289 100644 --- a/lib/js/belt_Range.js +++ b/lib/js/belt_Range.js @@ -1,6 +1,5 @@ 'use strict'; -let Curry = require("./curry.js"); function forEachU(s, f, action) { for(let i = s; i <= f; ++i){ @@ -9,7 +8,9 @@ function forEachU(s, f, action) { } function forEach(s, f, action) { - forEachU(s, f, Curry.__1(action)); + forEachU(s, f, (function (a) { + action(a); + })); } function everyU(_s, f, p) { @@ -27,7 +28,9 @@ function everyU(_s, f, p) { } function every(s, f, p) { - return everyU(s, f, Curry.__1(p)); + return everyU(s, f, (function (a) { + return p(a); + })); } function everyByU(s, f, step, p) { @@ -50,7 +53,9 @@ function everyByU(s, f, step, p) { } function everyBy(s, f, step, p) { - return everyByU(s, f, step, Curry.__1(p)); + return everyByU(s, f, step, (function (a) { + return p(a); + })); } function someU(_s, f, p) { @@ -68,7 +73,9 @@ function someU(_s, f, p) { } function some(s, f, p) { - return someU(s, f, Curry.__1(p)); + return someU(s, f, (function (a) { + return p(a); + })); } function someByU(s, f, step, p) { @@ -91,7 +98,9 @@ function someByU(s, f, step, p) { } function someBy(s, f, step, p) { - return someByU(s, f, step, Curry.__1(p)); + return someByU(s, f, step, (function (a) { + return p(a); + })); } exports.forEachU = forEachU; diff --git a/lib/js/belt_Result.js b/lib/js/belt_Result.js index b2c8866775..24ac6ac449 100644 --- a/lib/js/belt_Result.js +++ b/lib/js/belt_Result.js @@ -1,6 +1,5 @@ 'use strict'; -let Curry = require("./curry.js"); function getExn(x) { if (x.TAG === "Ok") { @@ -22,7 +21,9 @@ function mapWithDefaultU(opt, $$default, f) { } function mapWithDefault(opt, $$default, f) { - return mapWithDefaultU(opt, $$default, Curry.__1(f)); + return mapWithDefaultU(opt, $$default, (function (x) { + return f(x); + })); } function mapU(opt, f) { @@ -40,7 +41,9 @@ function mapU(opt, f) { } function map(opt, f) { - return mapU(opt, Curry.__1(f)); + return mapU(opt, (function (x) { + return f(x); + })); } function flatMapU(opt, f) { @@ -55,7 +58,9 @@ function flatMapU(opt, f) { } function flatMap(opt, f) { - return flatMapU(opt, Curry.__1(f)); + return flatMapU(opt, (function (x) { + return f(x); + })); } function getWithDefault(opt, $$default) { @@ -97,7 +102,9 @@ function eqU(a, b, f) { } function eq(a, b, f) { - return eqU(a, b, Curry.__2(f)); + return eqU(a, b, (function (x, y) { + return f(x, y); + })); } function cmpU(a, b, f) { @@ -115,7 +122,9 @@ function cmpU(a, b, f) { } function cmp(a, b, f) { - return cmpU(a, b, Curry.__2(f)); + return cmpU(a, b, (function (x, y) { + return f(x, y); + })); } exports.getExn = getExn; diff --git a/lib/js/belt_Set.js b/lib/js/belt_Set.js index a48d9ad746..f159790896 100644 --- a/lib/js/belt_Set.js +++ b/lib/js/belt_Set.js @@ -1,6 +1,5 @@ 'use strict'; -let Curry = require("./curry.js"); let Belt_SetDict = require("./belt_SetDict.js"); function fromArray(data, id) { @@ -128,7 +127,9 @@ function forEachU(m, f) { } function forEach(m, f) { - Belt_SetDict.forEachU(m.data, Curry.__1(f)); + forEachU(m, (function (a) { + f(a); + })); } function reduceU(m, acc, f) { @@ -136,7 +137,9 @@ function reduceU(m, acc, f) { } function reduce(m, acc, f) { - return reduceU(m, acc, Curry.__2(f)); + return reduceU(m, acc, (function (a, b) { + return f(a, b); + })); } function everyU(m, f) { @@ -144,7 +147,9 @@ function everyU(m, f) { } function every(m, f) { - return Belt_SetDict.everyU(m.data, Curry.__1(f)); + return everyU(m, (function (a) { + return f(a); + })); } function someU(m, f) { @@ -152,7 +157,9 @@ function someU(m, f) { } function some(m, f) { - return Belt_SetDict.someU(m.data, Curry.__1(f)); + return someU(m, (function (a) { + return f(a); + })); } function keepU(m, f) { @@ -163,7 +170,9 @@ function keepU(m, f) { } function keep(m, f) { - return keepU(m, Curry.__1(f)); + return keepU(m, (function (a) { + return f(a); + })); } function partitionU(m, f) { @@ -182,7 +191,9 @@ function partitionU(m, f) { } function partition(m, f) { - return partitionU(m, Curry.__1(f)); + return partitionU(m, (function (a) { + return f(a); + })); } function size(m) { diff --git a/lib/js/belt_SortArray.js b/lib/js/belt_SortArray.js index c925c261ba..2ae3650d58 100644 --- a/lib/js/belt_SortArray.js +++ b/lib/js/belt_SortArray.js @@ -1,6 +1,5 @@ 'use strict'; -let Curry = require("./curry.js"); let Belt_Array = require("./belt_Array.js"); function sortedLengthAuxMore(xs, _prec, _acc, len, lt) { @@ -52,7 +51,9 @@ function strictlySortedLengthU(xs, lt) { } function strictlySortedLength(xs, lt) { - return strictlySortedLengthU(xs, Curry.__2(lt)); + return strictlySortedLengthU(xs, (function (x, y) { + return lt(x, y); + })); } function isSortedU(a, cmp) { @@ -77,7 +78,9 @@ function isSortedU(a, cmp) { } function isSorted(a, cmp) { - return isSortedU(a, Curry.__2(cmp)); + return isSortedU(a, (function (x, y) { + return cmp(x, y); + })); } function merge(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, cmp) { @@ -181,7 +184,9 @@ function unionU(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, cmp) } function union(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, cmp) { - return unionU(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, Curry.__2(cmp)); + return unionU(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, (function (x, y) { + return cmp(x, y); + })); } function intersectU(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, cmp) { @@ -234,7 +239,9 @@ function intersectU(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, } function intersect(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, cmp) { - return intersectU(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, Curry.__2(cmp)); + return intersectU(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, (function (x, y) { + return cmp(x, y); + })); } function diffU(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, cmp) { @@ -293,7 +300,9 @@ function diffU(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, cmp) } function diff(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, cmp) { - return diffU(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, Curry.__2(cmp)); + return diffU(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, (function (x, y) { + return cmp(x, y); + })); } function insertionSort(src, srcofs, dst, dstofs, len, cmp) { @@ -333,7 +342,9 @@ function stableSortInPlaceByU(a, cmp) { } function stableSortInPlaceBy(a, cmp) { - stableSortInPlaceByU(a, Curry.__2(cmp)); + stableSortInPlaceByU(a, (function (x, y) { + return cmp(x, y); + })); } function stableSortByU(a, cmp) { @@ -343,7 +354,9 @@ function stableSortByU(a, cmp) { } function stableSortBy(a, cmp) { - return stableSortByU(a, Curry.__2(cmp)); + return stableSortByU(a, (function (x, y) { + return cmp(x, y); + })); } function binarySearchByU(sorted, key, cmp) { @@ -397,7 +410,9 @@ function binarySearchByU(sorted, key, cmp) { } function binarySearchBy(sorted, key, cmp) { - return binarySearchByU(sorted, key, Curry.__2(cmp)); + return binarySearchByU(sorted, key, (function (x, y) { + return cmp(x, y); + })); } let Int; diff --git a/lib/js/belt_internalAVLset.js b/lib/js/belt_internalAVLset.js index 3ae7223b02..aa3c4de016 100644 --- a/lib/js/belt_internalAVLset.js +++ b/lib/js/belt_internalAVLset.js @@ -1,6 +1,5 @@ 'use strict'; -let Curry = require("./curry.js"); let Caml_option = require("./caml_option.js"); let Belt_SortArray = require("./belt_SortArray.js"); @@ -178,7 +177,9 @@ function forEachU(_n, f) { } function forEach(n, f) { - forEachU(n, Curry.__1(f)); + forEachU(n, (function (a) { + f(a); + })); } function reduceU(_s, _accu, f) { @@ -195,7 +196,9 @@ function reduceU(_s, _accu, f) { } function reduce(s, accu, f) { - return reduceU(s, accu, Curry.__2(f)); + return reduceU(s, accu, (function (a, b) { + return f(a, b); + })); } function everyU(_n, p) { @@ -216,7 +219,9 @@ function everyU(_n, p) { } function every(n, p) { - return everyU(n, Curry.__1(p)); + return everyU(n, (function (a) { + return p(a); + })); } function someU(_n, p) { @@ -237,7 +242,9 @@ function someU(_n, p) { } function some(n, p) { - return someU(n, Curry.__1(p)); + return someU(n, (function (a) { + return p(a); + })); } function addMinElement(n, v) { @@ -317,7 +324,9 @@ function partitionSharedU(n, p) { } function partitionShared(n, p) { - return partitionSharedU(n, Curry.__1(p)); + return partitionSharedU(n, (function (a) { + return p(a); + })); } function lengthNode(n) { @@ -554,7 +563,9 @@ function keepSharedU(n, p) { } function keepShared(n, p) { - return keepSharedU(n, Curry.__1(p)); + return keepSharedU(n, (function (a) { + return p(a); + })); } function keepCopyU(n, p) { @@ -568,7 +579,9 @@ function keepCopyU(n, p) { } function keepCopy(n, p) { - return keepCopyU(n, Curry.__1(p)); + return keepCopyU(n, (function (x) { + return p(x); + })); } function partitionCopyU(n, p) { @@ -594,7 +607,9 @@ function partitionCopyU(n, p) { } function partitionCopy(n, p) { - return partitionCopyU(n, Curry.__1(p)); + return partitionCopyU(n, (function (a) { + return p(a); + })); } function has(_t, x, cmp) { diff --git a/lib/js/belt_internalAVLtree.js b/lib/js/belt_internalAVLtree.js index bf5e70f13c..70f0d5cc11 100644 --- a/lib/js/belt_internalAVLtree.js +++ b/lib/js/belt_internalAVLtree.js @@ -1,6 +1,5 @@ 'use strict'; -let Curry = require("./curry.js"); let Caml_option = require("./caml_option.js"); let Belt_SortArray = require("./belt_SortArray.js"); @@ -270,7 +269,9 @@ function findFirstByU(n, p) { } function findFirstBy(n, p) { - return findFirstByU(n, Curry.__2(p)); + return findFirstByU(n, (function (a, b) { + return p(a, b); + })); } function forEachU(_n, f) { @@ -287,7 +288,9 @@ function forEachU(_n, f) { } function forEach(n, f) { - forEachU(n, Curry.__2(f)); + forEachU(n, (function (a, b) { + f(a, b); + })); } function mapU(n, f) { @@ -307,7 +310,9 @@ function mapU(n, f) { } function map(n, f) { - return mapU(n, Curry.__1(f)); + return mapU(n, (function (a) { + return f(a); + })); } function mapWithKeyU(n, f) { @@ -328,7 +333,9 @@ function mapWithKeyU(n, f) { } function mapWithKey(n, f) { - return mapWithKeyU(n, Curry.__2(f)); + return mapWithKeyU(n, (function (a, b) { + return f(a, b); + })); } function reduceU(_m, _accu, f) { @@ -349,7 +356,9 @@ function reduceU(_m, _accu, f) { } function reduce(m, accu, f) { - return reduceU(m, accu, Curry.__3(f)); + return reduceU(m, accu, (function (a, b, c) { + return f(a, b, c); + })); } function everyU(_n, p) { @@ -370,7 +379,9 @@ function everyU(_n, p) { } function every(n, p) { - return everyU(n, Curry.__2(p)); + return everyU(n, (function (a, b) { + return p(a, b); + })); } function someU(_n, p) { @@ -391,7 +402,9 @@ function someU(_n, p) { } function some(n, p) { - return someU(n, Curry.__2(p)); + return someU(n, (function (a, b) { + return p(a, b); + })); } function addMinElement(n, k, v) { @@ -478,7 +491,9 @@ function keepSharedU(n, p) { } function keepShared(n, p) { - return keepSharedU(n, Curry.__2(p)); + return keepSharedU(n, (function (a, b) { + return p(a, b); + })); } function keepMapU(n, p) { @@ -498,7 +513,9 @@ function keepMapU(n, p) { } function keepMap(n, p) { - return keepMapU(n, Curry.__2(p)); + return keepMapU(n, (function (a, b) { + return p(a, b); + })); } function partitionSharedU(n, p) { @@ -531,7 +548,9 @@ function partitionSharedU(n, p) { } function partitionShared(n, p) { - return partitionSharedU(n, Curry.__2(p)); + return partitionSharedU(n, (function (a, b) { + return p(a, b); + })); } function lengthNode(n) { @@ -818,7 +837,9 @@ function cmpU(s1, s2, kcmp, vcmp) { } function cmp(s1, s2, kcmp, vcmp) { - return cmpU(s1, s2, kcmp, Curry.__2(vcmp)); + return cmpU(s1, s2, kcmp, (function (a, b) { + return vcmp(a, b); + })); } function eqU(s1, s2, kcmp, veq) { @@ -851,7 +872,9 @@ function eqU(s1, s2, kcmp, veq) { } function eq(s1, s2, kcmp, veq) { - return eqU(s1, s2, kcmp, Curry.__2(veq)); + return eqU(s1, s2, kcmp, (function (a, b) { + return veq(a, b); + })); } function get(_n, x, cmp) { diff --git a/lib/js/belt_internalBuckets.js b/lib/js/belt_internalBuckets.js index eb5269f858..21423c0177 100644 --- a/lib/js/belt_internalBuckets.js +++ b/lib/js/belt_internalBuckets.js @@ -1,6 +1,5 @@ 'use strict'; -let Curry = require("./curry.js"); let Belt_Array = require("./belt_Array.js"); let Caml_option = require("./caml_option.js"); @@ -87,7 +86,9 @@ function forEachU(h, f) { } function forEach(h, f) { - forEachU(h, Curry.__2(f)); + forEachU(h, (function (a, b) { + return f(a, b); + })); } function do_bucket_fold(f, _b, _accu) { @@ -113,7 +114,9 @@ function reduceU(h, init, f) { } function reduce(h, init, f) { - return reduceU(h, init, Curry.__3(f)); + return reduceU(h, init, (function (a, b, c) { + return f(a, b, c); + })); } function getMaxBucketLength(h) { @@ -195,7 +198,9 @@ function keepMapInPlaceU(h, f) { } function keepMapInPlace(h, f) { - keepMapInPlaceU(h, Curry.__2(f)); + keepMapInPlaceU(h, (function (a, b) { + return f(a, b); + })); } function fillArray(_i, arr, _cell) { diff --git a/lib/js/belt_internalMapInt.js b/lib/js/belt_internalMapInt.js index 7287487df7..4130367f1b 100644 --- a/lib/js/belt_internalMapInt.js +++ b/lib/js/belt_internalMapInt.js @@ -1,7 +1,6 @@ 'use strict'; let Caml = require("./caml.js"); -let Curry = require("./curry.js"); let Caml_option = require("./caml_option.js"); let Belt_SortArray = require("./belt_SortArray.js"); let Belt_internalAVLtree = require("./belt_internalAVLtree.js"); @@ -210,7 +209,9 @@ function mergeU(s1, s2, f) { } function merge(s1, s2, f) { - return mergeU(s1, s2, Curry.__3(f)); + return mergeU(s1, s2, (function (a, b, c) { + return f(a, b, c); + })); } function compareAux(_e1, _e2, vcmp) { @@ -252,7 +253,9 @@ function cmpU(s1, s2, cmp) { } function cmp(s1, s2, f) { - return cmpU(s1, s2, Curry.__2(f)); + return cmpU(s1, s2, (function (a, b) { + return f(a, b); + })); } function eqAux(_e1, _e2, eq) { @@ -287,7 +290,9 @@ function eqU(s1, s2, eq) { } function eq(s1, s2, f) { - return eqU(s1, s2, Curry.__2(f)); + return eqU(s1, s2, (function (a, b) { + return f(a, b); + })); } function addMutate(t, x, data) { diff --git a/lib/js/belt_internalMapString.js b/lib/js/belt_internalMapString.js index 47e80346e4..0397f66799 100644 --- a/lib/js/belt_internalMapString.js +++ b/lib/js/belt_internalMapString.js @@ -1,7 +1,6 @@ 'use strict'; let Caml = require("./caml.js"); -let Curry = require("./curry.js"); let Caml_option = require("./caml_option.js"); let Belt_SortArray = require("./belt_SortArray.js"); let Belt_internalAVLtree = require("./belt_internalAVLtree.js"); @@ -210,7 +209,9 @@ function mergeU(s1, s2, f) { } function merge(s1, s2, f) { - return mergeU(s1, s2, Curry.__3(f)); + return mergeU(s1, s2, (function (a, b, c) { + return f(a, b, c); + })); } function compareAux(_e1, _e2, vcmp) { @@ -252,7 +253,9 @@ function cmpU(s1, s2, cmp) { } function cmp(s1, s2, f) { - return cmpU(s1, s2, Curry.__2(f)); + return cmpU(s1, s2, (function (a, b) { + return f(a, b); + })); } function eqAux(_e1, _e2, eq) { @@ -287,7 +290,9 @@ function eqU(s1, s2, eq) { } function eq(s1, s2, f) { - return eqU(s1, s2, Curry.__2(f)); + return eqU(s1, s2, (function (a, b) { + return f(a, b); + })); } function addMutate(t, x, data) { diff --git a/lib/js/belt_internalSetBuckets.js b/lib/js/belt_internalSetBuckets.js index 8e2bf8ff4f..95789558f2 100644 --- a/lib/js/belt_internalSetBuckets.js +++ b/lib/js/belt_internalSetBuckets.js @@ -1,6 +1,5 @@ 'use strict'; -let Curry = require("./curry.js"); let Belt_Array = require("./belt_Array.js"); function copyAuxCont(_c, _prec) { @@ -84,7 +83,9 @@ function forEachU(h, f) { } function forEach(h, f) { - forEachU(h, Curry.__1(f)); + forEachU(h, (function (a) { + f(a); + })); } function fillArray(_i, arr, _cell) { @@ -139,7 +140,9 @@ function reduceU(h, init, f) { } function reduce(h, init, f) { - return reduceU(h, init, Curry.__2(f)); + return reduceU(h, init, (function (a, b) { + return f(a, b); + })); } function getMaxBucketLength(h) { diff --git a/lib/js/buffer.js b/lib/js/buffer.js index c1142a0832..160c5a977f 100644 --- a/lib/js/buffer.js +++ b/lib/js/buffer.js @@ -1,7 +1,6 @@ 'use strict'; let Bytes = require("./bytes.js"); -let Curry = require("./curry.js"); let $$String = require("./string.js"); let Caml_bytes = require("./caml_bytes.js"); let Caml_string = require("./caml_string.js"); @@ -26,39 +25,39 @@ function to_bytes(b) { } function sub(b, ofs, len) { - if (ofs < 0 || len < 0 || ofs > (b.position - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Buffer.sub" - } - }); + if (!(ofs < 0 || len < 0 || ofs > (b.position - len | 0))) { + return Bytes.sub_string(b.buffer, ofs, len); } - return Bytes.sub_string(b.buffer, ofs, len); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.sub" + } + }); } function blit(src, srcoff, dst, dstoff, len) { - if (len < 0 || srcoff < 0 || srcoff > (src.position - len | 0) || dstoff < 0 || dstoff > (dst.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Buffer.blit" - } - }); + if (!(len < 0 || srcoff < 0 || srcoff > (src.position - len | 0) || dstoff < 0 || dstoff > (dst.length - len | 0))) { + return Bytes.blit(src.buffer, srcoff, dst, dstoff, len); } - Bytes.blit(src.buffer, srcoff, dst, dstoff, len); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.blit" + } + }); } function nth(b, ofs) { - if (ofs < 0 || ofs >= b.position) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Buffer.nth" - } - }); + if (!(ofs < 0 || ofs >= b.position)) { + return b.buffer[ofs]; } - return b.buffer[ofs]; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.nth" + } + }); } function length(b) { @@ -447,7 +446,7 @@ function add_substitute(b, f, s) { } let j = i + 1 | 0; let match = find_ident(s, j, lim); - add_string(b, Curry._1(f, match[0])); + add_string(b, f(match[0])); _i = match[1]; _previous = /* ' ' */32; continue; @@ -455,15 +454,16 @@ function add_substitute(b, f, s) { } function truncate(b, len) { - if (len < 0 || len > b.position) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Buffer.truncate" - } - }); + if (!(len < 0 || len > b.position)) { + b.position = len; + return; } - b.position = len; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.truncate" + } + }); } exports.create = create; diff --git a/lib/js/bytes.js b/lib/js/bytes.js index 0a846043cd..c8dd7b3cac 100644 --- a/lib/js/bytes.js +++ b/lib/js/bytes.js @@ -2,7 +2,6 @@ let Caml = require("./caml.js"); let Char = require("./char.js"); -let Curry = require("./curry.js"); let Caml_bytes = require("./caml_bytes.js"); let Caml_js_exceptions = require("./caml_js_exceptions.js"); @@ -64,7 +63,7 @@ function make(n, c) { function init(n, f) { let s = Caml_bytes.create(n); for(let i = 0; i < n; ++i){ - s[i] = Curry._1(f, i); + s[i] = f(i); } return s; } @@ -149,15 +148,15 @@ function $plus$plus(a, b) { if (match$1) { return c; } - if (match$2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.extend" - } - }); + if (!match$2) { + return c; } - return c; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.extend" + } + }); } function extend(s, left, right) { @@ -180,65 +179,66 @@ function extend(s, left, right) { } function fill(s, ofs, len, c) { - if (ofs < 0 || len < 0 || ofs > (s.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.fill / Bytes.fill" - } - }); + if (!(ofs < 0 || len < 0 || ofs > (s.length - len | 0))) { + return unsafe_fill(s, ofs, len, c); } - unsafe_fill(s, ofs, len, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.fill / Bytes.fill" + } + }); } function blit(s1, ofs1, s2, ofs2, len) { - if (len < 0 || ofs1 < 0 || ofs1 > (s1.length - len | 0) || ofs2 < 0 || ofs2 > (s2.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.blit" - } - }); + if (!(len < 0 || ofs1 < 0 || ofs1 > (s1.length - len | 0) || ofs2 < 0 || ofs2 > (s2.length - len | 0))) { + return unsafe_blit(s1, ofs1, s2, ofs2, len); } - unsafe_blit(s1, ofs1, s2, ofs2, len); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.blit" + } + }); } function blit_string(s1, ofs1, s2, ofs2, len) { - if (len < 0 || ofs1 < 0 || ofs1 > (s1.length - len | 0) || ofs2 < 0 || ofs2 > (s2.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.blit / Bytes.blit_string" - } - }); - } - if (len <= 0) { - return; - } - let off1 = s1.length - ofs1 | 0; - if (len <= off1) { - for(let i = 0; i < len; ++i){ - s2[ofs2 + i | 0] = s1.codePointAt(ofs1 + i | 0); + if (!(len < 0 || ofs1 < 0 || ofs1 > (s1.length - len | 0) || ofs2 < 0 || ofs2 > (s2.length - len | 0))) { + if (len <= 0) { + return; + } + let off1 = s1.length - ofs1 | 0; + if (len <= off1) { + for(let i = 0; i < len; ++i){ + s2[ofs2 + i | 0] = s1.codePointAt(ofs1 + i | 0); + } + return; + } + for(let i$1 = 0; i$1 < off1; ++i$1){ + s2[ofs2 + i$1 | 0] = s1.codePointAt(ofs1 + i$1 | 0); + } + for(let i$2 = off1; i$2 < len; ++i$2){ + s2[ofs2 + i$2 | 0] = /* '\000' */0; } return; } - for(let i$1 = 0; i$1 < off1; ++i$1){ - s2[ofs2 + i$1 | 0] = s1.codePointAt(ofs1 + i$1 | 0); - } - for(let i$2 = off1; i$2 < len; ++i$2){ - s2[ofs2 + i$2 | 0] = /* '\000' */0; - } + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.blit / Bytes.blit_string" + } + }); } function iter(f, a) { for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ - Curry._1(f, a[i]); + f(a[i]); } } function iteri(f, a) { for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ - Curry._2(f, i, a[i]); + f(i, a[i]); } } @@ -446,7 +446,7 @@ function map(f, s) { } let r = Caml_bytes.create(l); for(let i = 0; i < l; ++i){ - r[i] = Curry._1(f, s[i]); + r[i] = f(s[i]); } return r; } @@ -458,7 +458,7 @@ function mapi(f, s) { } let r = Caml_bytes.create(l); for(let i = 0; i < l; ++i){ - r[i] = Curry._2(f, i, s[i]); + r[i] = f(i, s[i]); } return r; } @@ -476,7 +476,7 @@ function apply1(f, s) { return s; } let r = copy(s); - r[0] = Curry._1(f, s[0]); + r[0] = f(s[0]); return r; } @@ -530,28 +530,28 @@ function index_opt(s, c) { function index_from(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from / Bytes.index_from" - } - }); + if (!(i < 0 || i > l)) { + return index_rec(s, l, i, c); } - return index_rec(s, l, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from" + } + }); } function index_from_opt(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from_opt / Bytes.index_from_opt" - } - }); + if (!(i < 0 || i > l)) { + return index_rec_opt(s, l, i, c); } - return index_rec_opt(s, l, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt" + } + }); } function rindex_rec(s, _i, c) { @@ -577,15 +577,15 @@ function rindex(s, c) { } function rindex_from(s, i, c) { - if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from / Bytes.rindex_from" - } - }); + if (!(i < -1 || i >= s.length)) { + return rindex_rec(s, i, c); } - return rindex_rec(s, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from" + } + }); } function rindex_rec_opt(s, _i, c) { @@ -607,15 +607,15 @@ function rindex_opt(s, c) { } function rindex_from_opt(s, i, c) { - if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from_opt / Bytes.rindex_from_opt" - } - }); + if (!(i < -1 || i >= s.length)) { + return rindex_rec_opt(s, i, c); } - return rindex_rec_opt(s, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt" + } + }); } function contains_from(s, i, c) { diff --git a/lib/js/bytesLabels.js b/lib/js/bytesLabels.js index 0a846043cd..c8dd7b3cac 100644 --- a/lib/js/bytesLabels.js +++ b/lib/js/bytesLabels.js @@ -2,7 +2,6 @@ let Caml = require("./caml.js"); let Char = require("./char.js"); -let Curry = require("./curry.js"); let Caml_bytes = require("./caml_bytes.js"); let Caml_js_exceptions = require("./caml_js_exceptions.js"); @@ -64,7 +63,7 @@ function make(n, c) { function init(n, f) { let s = Caml_bytes.create(n); for(let i = 0; i < n; ++i){ - s[i] = Curry._1(f, i); + s[i] = f(i); } return s; } @@ -149,15 +148,15 @@ function $plus$plus(a, b) { if (match$1) { return c; } - if (match$2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.extend" - } - }); + if (!match$2) { + return c; } - return c; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.extend" + } + }); } function extend(s, left, right) { @@ -180,65 +179,66 @@ function extend(s, left, right) { } function fill(s, ofs, len, c) { - if (ofs < 0 || len < 0 || ofs > (s.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.fill / Bytes.fill" - } - }); + if (!(ofs < 0 || len < 0 || ofs > (s.length - len | 0))) { + return unsafe_fill(s, ofs, len, c); } - unsafe_fill(s, ofs, len, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.fill / Bytes.fill" + } + }); } function blit(s1, ofs1, s2, ofs2, len) { - if (len < 0 || ofs1 < 0 || ofs1 > (s1.length - len | 0) || ofs2 < 0 || ofs2 > (s2.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.blit" - } - }); + if (!(len < 0 || ofs1 < 0 || ofs1 > (s1.length - len | 0) || ofs2 < 0 || ofs2 > (s2.length - len | 0))) { + return unsafe_blit(s1, ofs1, s2, ofs2, len); } - unsafe_blit(s1, ofs1, s2, ofs2, len); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.blit" + } + }); } function blit_string(s1, ofs1, s2, ofs2, len) { - if (len < 0 || ofs1 < 0 || ofs1 > (s1.length - len | 0) || ofs2 < 0 || ofs2 > (s2.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.blit / Bytes.blit_string" - } - }); - } - if (len <= 0) { - return; - } - let off1 = s1.length - ofs1 | 0; - if (len <= off1) { - for(let i = 0; i < len; ++i){ - s2[ofs2 + i | 0] = s1.codePointAt(ofs1 + i | 0); + if (!(len < 0 || ofs1 < 0 || ofs1 > (s1.length - len | 0) || ofs2 < 0 || ofs2 > (s2.length - len | 0))) { + if (len <= 0) { + return; + } + let off1 = s1.length - ofs1 | 0; + if (len <= off1) { + for(let i = 0; i < len; ++i){ + s2[ofs2 + i | 0] = s1.codePointAt(ofs1 + i | 0); + } + return; + } + for(let i$1 = 0; i$1 < off1; ++i$1){ + s2[ofs2 + i$1 | 0] = s1.codePointAt(ofs1 + i$1 | 0); + } + for(let i$2 = off1; i$2 < len; ++i$2){ + s2[ofs2 + i$2 | 0] = /* '\000' */0; } return; } - for(let i$1 = 0; i$1 < off1; ++i$1){ - s2[ofs2 + i$1 | 0] = s1.codePointAt(ofs1 + i$1 | 0); - } - for(let i$2 = off1; i$2 < len; ++i$2){ - s2[ofs2 + i$2 | 0] = /* '\000' */0; - } + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.blit / Bytes.blit_string" + } + }); } function iter(f, a) { for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ - Curry._1(f, a[i]); + f(a[i]); } } function iteri(f, a) { for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ - Curry._2(f, i, a[i]); + f(i, a[i]); } } @@ -446,7 +446,7 @@ function map(f, s) { } let r = Caml_bytes.create(l); for(let i = 0; i < l; ++i){ - r[i] = Curry._1(f, s[i]); + r[i] = f(s[i]); } return r; } @@ -458,7 +458,7 @@ function mapi(f, s) { } let r = Caml_bytes.create(l); for(let i = 0; i < l; ++i){ - r[i] = Curry._2(f, i, s[i]); + r[i] = f(i, s[i]); } return r; } @@ -476,7 +476,7 @@ function apply1(f, s) { return s; } let r = copy(s); - r[0] = Curry._1(f, s[0]); + r[0] = f(s[0]); return r; } @@ -530,28 +530,28 @@ function index_opt(s, c) { function index_from(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from / Bytes.index_from" - } - }); + if (!(i < 0 || i > l)) { + return index_rec(s, l, i, c); } - return index_rec(s, l, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from" + } + }); } function index_from_opt(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from_opt / Bytes.index_from_opt" - } - }); + if (!(i < 0 || i > l)) { + return index_rec_opt(s, l, i, c); } - return index_rec_opt(s, l, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt" + } + }); } function rindex_rec(s, _i, c) { @@ -577,15 +577,15 @@ function rindex(s, c) { } function rindex_from(s, i, c) { - if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from / Bytes.rindex_from" - } - }); + if (!(i < -1 || i >= s.length)) { + return rindex_rec(s, i, c); } - return rindex_rec(s, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from" + } + }); } function rindex_rec_opt(s, _i, c) { @@ -607,15 +607,15 @@ function rindex_opt(s, c) { } function rindex_from_opt(s, i, c) { - if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from_opt / Bytes.rindex_from_opt" - } - }); + if (!(i < -1 || i >= s.length)) { + return rindex_rec_opt(s, i, c); } - return rindex_rec_opt(s, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt" + } + }); } function contains_from(s, i, c) { diff --git a/lib/js/caml.js b/lib/js/caml.js index c3729dc091..15e8b80485 100644 --- a/lib/js/caml.js +++ b/lib/js/caml.js @@ -166,10 +166,10 @@ function i64_le(x, y) { } function i64_min(x, y) { - if (i64_ge(x, y)) { - return y; - } else { + if (i64_lt(x, y)) { return x; + } else { + return y; } } diff --git a/lib/js/caml_sys.js b/lib/js/caml_sys.js index d1859c692c..621591c386 100644 --- a/lib/js/caml_sys.js +++ b/lib/js/caml_sys.js @@ -29,7 +29,7 @@ let os_type = (function(_){ } }); -function sys_time(param) { +function sys_time() { if (typeof process === "undefined" || process.uptime === undefined) { return -1; } else { @@ -44,7 +44,7 @@ let sys_getcwd = (function(param){ return process.cwd() }); -function sys_get_argv(param) { +function sys_get_argv() { if (typeof process === "undefined") { return [ "", diff --git a/lib/js/char.js b/lib/js/char.js index 2ae5bbaca9..d4dd8308c7 100644 --- a/lib/js/char.js +++ b/lib/js/char.js @@ -3,15 +3,15 @@ let Bytes = require("./bytes.js"); function chr(n) { - if (n < 0 || n > 255) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Char.chr" - } - }); + if (!(n < 0 || n > 255)) { + return n; } - return n; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Char.chr" + } + }); } function escaped(param) { diff --git a/lib/js/digest.js b/lib/js/digest.js index 51307ddf23..d62b9b57a8 100644 --- a/lib/js/digest.js +++ b/lib/js/digest.js @@ -16,15 +16,15 @@ function bytes(b) { } function substring(str, ofs, len) { - if (ofs < 0 || len < 0 || ofs > (str.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Digest.substring" - } - }); + if (!(ofs < 0 || len < 0 || ofs > (str.length - len | 0))) { + return Caml_md5.md5_string(str, ofs, len); } - return Caml_md5.md5_string(str, ofs, len); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Digest.substring" + } + }); } function subbytes(b, ofs, len) { diff --git a/lib/js/filename.js b/lib/js/filename.js index cdf5e59646..8b1245ba55 100644 --- a/lib/js/filename.js +++ b/lib/js/filename.js @@ -1,8 +1,6 @@ 'use strict'; let Sys = require("./sys.js"); -let Bytes = require("./bytes.js"); -let Curry = require("./curry.js"); let Buffer = require("./buffer.js"); let $$String = require("./string.js"); let Caml_sys = require("./caml_sys.js"); @@ -19,7 +17,7 @@ function generic_basename(is_dir_sep, current_dir_name, name) { if (n < 0) { return $$String.sub(name, 0, 1); } - if (!Curry._2(is_dir_sep, name, n)) { + if (!is_dir_sep(name, n)) { let _n$1 = n; let p = n + 1 | 0; while(true) { @@ -27,7 +25,7 @@ function generic_basename(is_dir_sep, current_dir_name, name) { if (n$1 < 0) { return $$String.sub(name, 0, p); } - if (Curry._2(is_dir_sep, name, n$1)) { + if (is_dir_sep(name, n$1)) { return $$String.sub(name, n$1 + 1 | 0, (p - n$1 | 0) - 1 | 0); } _n$1 = n$1 - 1 | 0; @@ -50,21 +48,21 @@ function generic_dirname(is_dir_sep, current_dir_name, name) { if (n < 0) { return $$String.sub(name, 0, 1); } - if (!Curry._2(is_dir_sep, name, n)) { + if (!is_dir_sep(name, n)) { let _n$1 = n; while(true) { let n$1 = _n$1; if (n$1 < 0) { return current_dir_name; } - if (Curry._2(is_dir_sep, name, n$1)) { + if (is_dir_sep(name, n$1)) { let _n$2 = n$1; while(true) { let n$2 = _n$2; if (n$2 < 0) { return $$String.sub(name, 0, 1); } - if (!Curry._2(is_dir_sep, name, n$2)) { + if (!is_dir_sep(name, n$2)) { return $$String.sub(name, 0, n$2 + 1 | 0); } _n$2 = n$2 - 1 | 0; @@ -195,7 +193,7 @@ function check_suffix$1(name, suff) { return false; } let s = $$String.sub(name, name.length - suff.length | 0, suff.length); - return Bytes.unsafe_to_string(Bytes.lowercase_ascii(Bytes.unsafe_of_string(s))) === Bytes.unsafe_to_string(Bytes.lowercase_ascii(Bytes.unsafe_of_string(suff))); + return $$String.lowercase_ascii(s) === $$String.lowercase_ascii(suff); } let temp_dir_name$1; @@ -375,7 +373,7 @@ let dir_sep = match[2]; function concat(dirname, filename) { let l = dirname.length; - if (l === 0 || Curry._2(is_dir_sep$2, dirname, l - 1 | 0)) { + if (l === 0 || is_dir_sep$2(dirname, l - 1 | 0)) { return dirname + filename; } else { return dirname + (dir_sep + filename); @@ -384,29 +382,29 @@ function concat(dirname, filename) { function chop_suffix(name, suff) { let n = name.length - suff.length | 0; - if (n < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Filename.chop_suffix" - } - }); + if (n >= 0) { + return $$String.sub(name, 0, n); } - return $$String.sub(name, 0, n); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Filename.chop_suffix" + } + }); } function extension_len(name) { let _i = name.length - 1 | 0; while(true) { let i = _i; - if (i < 0 || Curry._2(is_dir_sep$2, name, i)) { + if (i < 0 || is_dir_sep$2(name, i)) { return 0; } if (Caml_string.get(name, i) === /* '.' */46) { let _i$1 = i - 1 | 0; while(true) { let i$1 = _i$1; - if (i$1 < 0 || Curry._2(is_dir_sep$2, name, i$1)) { + if (i$1 < 0 || is_dir_sep$2(name, i$1)) { return 0; } if (Caml_string.get(name, i$1) !== /* '.' */46) { @@ -432,15 +430,15 @@ function extension(name) { function chop_extension(name) { let l = extension_len(name); - if (l === 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Filename.chop_extension" - } - }); + if (l !== 0) { + return $$String.sub(name, 0, name.length - l | 0); } - return $$String.sub(name, 0, name.length - l | 0); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Filename.chop_extension" + } + }); } function remove_extension(name) { @@ -460,7 +458,7 @@ function set_temp_dir_name(s) { current_temp_dir_name.contents = s; } -function get_temp_dir_name(param) { +function get_temp_dir_name() { return current_temp_dir_name.contents; } diff --git a/lib/js/genlex.js b/lib/js/genlex.js index c3be339c5a..d7603a2256 100644 --- a/lib/js/genlex.js +++ b/lib/js/genlex.js @@ -20,7 +20,7 @@ let bufpos = { contents: 0 }; -function reset_buffer(param) { +function reset_buffer() { buffer.contents = initial_buffer; bufpos.contents = 0; } @@ -35,7 +35,7 @@ function store(c) { bufpos.contents = bufpos.contents + 1 | 0; } -function get_string(param) { +function get_string() { let s = Bytes.sub_string(buffer.contents, 0, bufpos.contents); buffer.contents = initial_buffer; return s; @@ -105,8 +105,8 @@ function make_lexer(keywords) { case 13 : case 26 : case 32 : - Stream.junk(strm__); - continue; + exit = 2; + break; case 34 : Stream.junk(strm__); reset_buffer(); @@ -175,11 +175,10 @@ function make_lexer(keywords) { store(/* '-' */45); store(c$2); return number(strm__); - } else { - reset_buffer(); - store(/* '-' */45); - return ident2(strm__); } + reset_buffer(); + store(/* '-' */45); + return ident2(strm__); case 48 : case 49 : case 50 : @@ -190,7 +189,7 @@ function make_lexer(keywords) { case 55 : case 56 : case 57 : - exit = 4; + exit = 5; break; case 0 : case 1 : @@ -239,7 +238,7 @@ function make_lexer(keywords) { case 62 : case 63 : case 64 : - exit = 3; + exit = 4; break; } @@ -248,7 +247,7 @@ function make_lexer(keywords) { switch (c) { case 92 : case 94 : - exit = 3; + exit = 4; break; case 91 : case 93 : @@ -256,14 +255,14 @@ function make_lexer(keywords) { exit = 1; break; default: - exit = 2; + exit = 3; } } } else { exit = c >= 127 ? ( - c > 255 || c < 192 ? 1 : 2 + c > 255 || c < 192 ? 1 : 3 ) : ( - c !== 125 ? 3 : 1 + c !== 125 ? 4 : 1 ); } switch (exit) { @@ -271,42 +270,49 @@ function make_lexer(keywords) { Stream.junk(strm__); return keyword_or_error(c); case 2 : + Stream.junk(strm__); + continue; + case 3 : Stream.junk(strm__); reset_buffer(); store(c); while(true) { let c$3 = Stream.peek(strm__); - if (c$3 === undefined) { - return ident_or_keyword(get_string()); - } - if (c$3 >= 91) { - if (c$3 > 122 || c$3 < 95) { - if (c$3 > 255 || c$3 < 192) { - return ident_or_keyword(get_string()); + if (c$3 !== undefined) { + let exit$1 = 0; + if (c$3 >= 91) { + if (c$3 > 122 || c$3 < 95) { + if (!(c$3 > 255 || c$3 < 192)) { + exit$1 = 2; + } + + } else if (c$3 !== 96) { + exit$1 = 2; } - } else if (c$3 === 96) { - return ident_or_keyword(get_string()); + } else if (c$3 >= 48) { + if (c$3 > 64 || c$3 < 58) { + exit$1 = 2; + } + + } else if (c$3 === 39) { + exit$1 = 2; } - - } else if (c$3 >= 48) { - if (!(c$3 > 64 || c$3 < 58)) { - return ident_or_keyword(get_string()); + if (exit$1 === 2) { + Stream.junk(strm__); + store(c$3); + continue; } - } else if (c$3 !== 39) { - return ident_or_keyword(get_string()); } - Stream.junk(strm__); - store(c$3); - continue; + return ident_or_keyword(get_string()); }; - case 3 : + case 4 : Stream.junk(strm__); reset_buffer(); store(c); return ident2(strm__); - case 4 : + case 5 : Stream.junk(strm__); reset_buffer(); store(c); @@ -318,80 +324,81 @@ function make_lexer(keywords) { let ident2 = function (strm__) { while(true) { let c = Stream.peek(strm__); - if (c === undefined) { - return ident_or_keyword(get_string()); - } - if (c >= 94) { - if (c > 125 || c < 95) { - if (c >= 127) { - return ident_or_keyword(get_string()); + if (c !== undefined) { + let exit = 0; + if (c >= 94) { + if (c > 125 || c < 95) { + if (c < 127) { + exit = 2; + } + + } else if (c === 124) { + exit = 2; + } + + } else if (c >= 65) { + if (c === 92) { + exit = 2; } - } else if (c !== 124) { - return ident_or_keyword(get_string()); + } else if (c >= 33) { + switch (c) { + case 34 : + case 39 : + case 40 : + case 41 : + case 44 : + case 46 : + case 48 : + case 49 : + case 50 : + case 51 : + case 52 : + case 53 : + case 54 : + case 55 : + case 56 : + case 57 : + case 59 : + break; + case 33 : + case 35 : + case 36 : + case 37 : + case 38 : + case 42 : + case 43 : + case 45 : + case 47 : + case 58 : + case 60 : + case 61 : + case 62 : + case 63 : + case 64 : + exit = 2; + break; + + } } - - } else if (c >= 65) { - if (c !== 92) { - return ident_or_keyword(get_string()); + if (exit === 2) { + Stream.junk(strm__); + store(c); + continue; } - } else { - if (c < 33) { - return ident_or_keyword(get_string()); - } - switch (c) { - case 34 : - case 39 : - case 40 : - case 41 : - case 44 : - case 46 : - case 48 : - case 49 : - case 50 : - case 51 : - case 52 : - case 53 : - case 54 : - case 55 : - case 56 : - case 57 : - case 59 : - return ident_or_keyword(get_string()); - case 33 : - case 35 : - case 36 : - case 37 : - case 38 : - case 42 : - case 43 : - case 45 : - case 47 : - case 58 : - case 60 : - case 61 : - case 62 : - case 63 : - case 64 : - break; - - } } - Stream.junk(strm__); - store(c); - continue; + return ident_or_keyword(get_string()); }; }; let number = function (strm__) { while(true) { let c = Stream.peek(strm__); if (c !== undefined) { + let exit = 0; if (c >= 58) { if (!(c !== 69 && c !== 101)) { - Stream.junk(strm__); - store(/* 'E' */69); - return exponent_part(strm__); + exit = 2; } } else if (c !== 46) { @@ -427,6 +434,12 @@ function make_lexer(keywords) { }; }; } + if (exit === 2) { + Stream.junk(strm__); + store(/* 'E' */69); + return exponent_part(strm__); + } + } return { TAG: "Int", @@ -436,13 +449,15 @@ function make_lexer(keywords) { }; let exponent_part = function (strm__) { let c = Stream.peek(strm__); - if (c !== undefined && !(c !== 43 && c !== 45)) { - Stream.junk(strm__); - store(c); + if (c === undefined) { return end_exponent_part(strm__); - } else { + } + if (c !== 43 && c !== 45) { return end_exponent_part(strm__); } + Stream.junk(strm__); + store(c); + return end_exponent_part(strm__); }; let end_exponent_part = function (strm__) { while(true) { @@ -675,4 +690,4 @@ function make_lexer(keywords) { } exports.make_lexer = make_lexer; -/* No side effect */ +/* Hashtbl Not a pure module */ diff --git a/lib/js/hashtbl.js b/lib/js/hashtbl.js index 3699a1b4e7..21d29fbb69 100644 --- a/lib/js/hashtbl.js +++ b/lib/js/hashtbl.js @@ -1,14 +1,14 @@ 'use strict'; let Caml = require("./caml.js"); +let Lazy = require("./lazy.js"); let $$Array = require("./array.js"); -let Curry = require("./curry.js"); let Random = require("./random.js"); let Caml_obj = require("./caml_obj.js"); let Caml_hash = require("./caml_hash.js"); let Caml_array = require("./caml_array.js"); -let Pervasives = require("./pervasives.js"); let Caml_option = require("./caml_option.js"); +let PervasivesU = require("./pervasivesU.js"); let CamlinternalLazy = require("./camlinternalLazy.js"); function hash(x) { @@ -31,15 +31,15 @@ let randomized = { contents: false }; -function randomize(param) { +function randomize() { randomized.contents = true; } -function is_randomized(param) { +function is_randomized() { return randomized.contents; } -let prng = CamlinternalLazy.from_fun(function () { +let prng = Lazy.from_fun(function () { return Random.State.make_self_init(); }); @@ -79,11 +79,11 @@ function clear(h) { function reset(h) { let len = h.data.length; - if (len === Pervasives.abs(h.initial_size)) { + if (len === PervasivesU.abs(h.initial_size)) { return clear(h); } else { h.size = 0; - h.data = Caml_array.make(Pervasives.abs(h.initial_size), "Empty"); + h.data = Caml_array.make(PervasivesU.abs(h.initial_size), "Empty"); return; } } @@ -178,7 +178,7 @@ function resize(indexfun, h) { data: data, next: "Empty" }); - let nidx = Curry._2(indexfun, h, key); + let nidx = indexfun(h, key); let tail = Caml_array.get(ndata_tail, nidx); if (typeof tail !== "object") { Caml_array.set(ndata, nidx, cell); @@ -450,7 +450,7 @@ function iter(f, h) { let key = param.key; let data = param.data; let next = param.next; - Curry._2(f, key, data); + f(key, data); _param = next; continue; }; @@ -498,7 +498,7 @@ function filter_map_inplace_bucket(f, h, i, _prec, _param) { let key = param.key; let data = param.data; let next = param.next; - let data$1 = Curry._2(f, key, data); + let data$1 = f(key, data); if (data$1 !== undefined) { if (typeof prec !== "object") { Caml_array.set(h.data, i, param); @@ -552,7 +552,7 @@ function fold(f, h, init) { let key = b.key; let data = b.data; let next = b.next; - _accu = Curry._3(f, key, data, accu); + _accu = f(key, data, accu); _b = next; continue; }; @@ -618,7 +618,7 @@ function stats(h) { function MakeSeeded(H) { let key_index = function (h, key) { - return Curry._2(H.hash, h.seed, key) & (h.data.length - 1 | 0); + return H.hash(h.seed, key) & (h.data.length - 1 | 0); }; let add = function (h, key, data) { let i = key_index(h, key); @@ -647,7 +647,7 @@ function MakeSeeded(H) { } let k = param.key; let next = param.next; - if (Curry._2(H.equal, k, key)) { + if (H.equal(k, key)) { h.size = h.size - 1 | 0; if (typeof prec !== "object") { return Caml_array.set(h.data, i, next); @@ -673,7 +673,7 @@ function MakeSeeded(H) { let k1 = match.key; let d1 = match.data; let next1 = match.next; - if (Curry._2(H.equal, key, k1)) { + if (H.equal(key, k1)) { return d1; } if (typeof next1 !== "object") { @@ -686,7 +686,7 @@ function MakeSeeded(H) { let k2 = next1.key; let d2 = next1.data; let next2 = next1.next; - if (Curry._2(H.equal, key, k2)) { + if (H.equal(key, k2)) { return d2; } if (typeof next2 !== "object") { @@ -699,7 +699,7 @@ function MakeSeeded(H) { let k3 = next2.key; let d3 = next2.data; let next3 = next2.next; - if (Curry._2(H.equal, key, k3)) { + if (H.equal(key, k3)) { return d3; } else { let _param = next3; @@ -715,7 +715,7 @@ function MakeSeeded(H) { let k = param.key; let data = param.data; let next = param.next; - if (Curry._2(H.equal, key, k)) { + if (H.equal(key, k)) { return data; } _param = next; @@ -731,7 +731,7 @@ function MakeSeeded(H) { let k1 = match.key; let d1 = match.data; let next1 = match.next; - if (Curry._2(H.equal, key, k1)) { + if (H.equal(key, k1)) { return Caml_option.some(d1); } if (typeof next1 !== "object") { @@ -740,7 +740,7 @@ function MakeSeeded(H) { let k2 = next1.key; let d2 = next1.data; let next2 = next1.next; - if (Curry._2(H.equal, key, k2)) { + if (H.equal(key, k2)) { return Caml_option.some(d2); } if (typeof next2 !== "object") { @@ -749,7 +749,7 @@ function MakeSeeded(H) { let k3 = next2.key; let d3 = next2.data; let next3 = next2.next; - if (Curry._2(H.equal, key, k3)) { + if (H.equal(key, k3)) { return Caml_option.some(d3); } else { let _param = next3; @@ -761,7 +761,7 @@ function MakeSeeded(H) { let k = param.key; let data = param.data; let next = param.next; - if (Curry._2(H.equal, key, k)) { + if (H.equal(key, k)) { return Caml_option.some(data); } _param = next; @@ -779,7 +779,7 @@ function MakeSeeded(H) { let k = param.key; let d = param.data; let next = param.next; - if (Curry._2(H.equal, k, key)) { + if (H.equal(k, key)) { return { hd: d, tl: find_in_bucket(next) @@ -799,7 +799,7 @@ function MakeSeeded(H) { } let k = param.key; let next = param.next; - if (Curry._2(H.equal, k, key)) { + if (H.equal(k, key)) { param.key = key; param.data = data; return false; @@ -836,7 +836,7 @@ function MakeSeeded(H) { } let k = param.key; let next = param.next; - if (Curry._2(H.equal, k, key)) { + if (H.equal(k, key)) { return true; } _param = next; @@ -866,7 +866,7 @@ function MakeSeeded(H) { function Make(H) { let equal = H.equal; let key_index = function (h, key) { - return Curry._1(H.hash, key) & (h.data.length - 1 | 0); + return H.hash(key) & (h.data.length - 1 | 0); }; let add = function (h, key, data) { let i = key_index(h, key); @@ -895,7 +895,7 @@ function Make(H) { } let k = param.key; let next = param.next; - if (Curry._2(equal, k, key)) { + if (equal(k, key)) { h.size = h.size - 1 | 0; if (typeof prec !== "object") { return Caml_array.set(h.data, i, next); @@ -921,7 +921,7 @@ function Make(H) { let k1 = match.key; let d1 = match.data; let next1 = match.next; - if (Curry._2(equal, key, k1)) { + if (equal(key, k1)) { return d1; } if (typeof next1 !== "object") { @@ -934,7 +934,7 @@ function Make(H) { let k2 = next1.key; let d2 = next1.data; let next2 = next1.next; - if (Curry._2(equal, key, k2)) { + if (equal(key, k2)) { return d2; } if (typeof next2 !== "object") { @@ -947,7 +947,7 @@ function Make(H) { let k3 = next2.key; let d3 = next2.data; let next3 = next2.next; - if (Curry._2(equal, key, k3)) { + if (equal(key, k3)) { return d3; } else { let _param = next3; @@ -963,7 +963,7 @@ function Make(H) { let k = param.key; let data = param.data; let next = param.next; - if (Curry._2(equal, key, k)) { + if (equal(key, k)) { return data; } _param = next; @@ -979,7 +979,7 @@ function Make(H) { let k1 = match.key; let d1 = match.data; let next1 = match.next; - if (Curry._2(equal, key, k1)) { + if (equal(key, k1)) { return Caml_option.some(d1); } if (typeof next1 !== "object") { @@ -988,7 +988,7 @@ function Make(H) { let k2 = next1.key; let d2 = next1.data; let next2 = next1.next; - if (Curry._2(equal, key, k2)) { + if (equal(key, k2)) { return Caml_option.some(d2); } if (typeof next2 !== "object") { @@ -997,7 +997,7 @@ function Make(H) { let k3 = next2.key; let d3 = next2.data; let next3 = next2.next; - if (Curry._2(equal, key, k3)) { + if (equal(key, k3)) { return Caml_option.some(d3); } else { let _param = next3; @@ -1009,7 +1009,7 @@ function Make(H) { let k = param.key; let data = param.data; let next = param.next; - if (Curry._2(equal, key, k)) { + if (equal(key, k)) { return Caml_option.some(data); } _param = next; @@ -1027,7 +1027,7 @@ function Make(H) { let k = param.key; let d = param.data; let next = param.next; - if (Curry._2(equal, k, key)) { + if (equal(k, key)) { return { hd: d, tl: find_in_bucket(next) @@ -1047,7 +1047,7 @@ function Make(H) { } let k = param.key; let next = param.next; - if (Curry._2(equal, k, key)) { + if (equal(k, key)) { param.key = key; param.data = data; return false; @@ -1084,7 +1084,7 @@ function Make(H) { } let k = param.key; let next = param.next; - if (Curry._2(equal, k, key)) { + if (equal(k, key)) { return true; } _param = next; @@ -1140,4 +1140,4 @@ exports.hash = hash; exports.seeded_hash = seeded_hash; exports.hash_param = hash_param; exports.seeded_hash_param = seeded_hash_param; -/* No side effect */ +/* prng Not a pure module */ diff --git a/lib/js/hashtblLabels.js b/lib/js/hashtblLabels.js index ea6f6504c1..57c37b4f41 100644 --- a/lib/js/hashtblLabels.js +++ b/lib/js/hashtblLabels.js @@ -1,22 +1,31 @@ 'use strict'; -let Curry = require("./curry.js"); let Hashtbl = require("./hashtbl.js"); -let add = Hashtbl.add; +function add(tbl, key, data) { + Hashtbl.add(tbl, key, data); +} -let replace = Hashtbl.replace; +function replace(tbl, key, data) { + Hashtbl.replace(tbl, key, data); +} function iter(f, tbl) { - Hashtbl.iter(Curry.__2(f), tbl); + Hashtbl.iter((function (key, data) { + f(key, data); + }), tbl); } function filter_map_inplace(f, tbl) { - Hashtbl.filter_map_inplace(Curry.__2(f), tbl); + Hashtbl.filter_map_inplace((function (key, data) { + return f(key, data); + }), tbl); } function fold(f, tbl, init) { - return Hashtbl.fold(Curry.__3(f), tbl, init); + return Hashtbl.fold((function (key, data, acc) { + return f(key, data, acc); + }), tbl, init); } function MakeSeeded(H) { @@ -26,16 +35,26 @@ function MakeSeeded(H) { let iter = include.iter; let filter_map_inplace = include.filter_map_inplace; let fold = include.fold; - let add$1 = Curry.__3(add); - let replace$1 = Curry.__3(replace); + let add$1 = function (tbl, key, data) { + add(tbl, key, data); + }; + let replace$1 = function (tbl, key, data) { + replace(tbl, key, data); + }; let iter$1 = function (f, tbl) { - Curry._2(iter, Curry.__2(f), tbl); + iter((function (key, data) { + f(key, data); + }), tbl); }; let filter_map_inplace$1 = function (f, tbl) { - Curry._2(filter_map_inplace, Curry.__2(f), tbl); + filter_map_inplace((function (key, data) { + return f(key, data); + }), tbl); }; let fold$1 = function (f, tbl, init) { - return Curry._3(fold, Curry.__3(f), tbl, init); + return fold((function (key, data, acc) { + return f(key, data, acc); + }), tbl, init); }; return { create: include.create, @@ -59,7 +78,7 @@ function MakeSeeded(H) { function Make(H) { let hash = function (_seed, x) { - return Curry._1(H.hash, x); + return H.hash(x); }; let H_equal = H.equal; let H$1 = { @@ -73,19 +92,29 @@ function Make(H) { let iter = include.iter; let filter_map_inplace = include.filter_map_inplace; let fold = include.fold; - let add$1 = Curry.__3(add); - let replace$1 = Curry.__3(replace); + let add$1 = function (tbl, key, data) { + add(tbl, key, data); + }; + let replace$1 = function (tbl, key, data) { + replace(tbl, key, data); + }; let iter$1 = function (f, tbl) { - Curry._2(iter, Curry.__2(f), tbl); + iter((function (key, data) { + f(key, data); + }), tbl); }; let filter_map_inplace$1 = function (f, tbl) { - Curry._2(filter_map_inplace, Curry.__2(f), tbl); + filter_map_inplace((function (key, data) { + return f(key, data); + }), tbl); }; let fold$1 = function (f, tbl, init) { - return Curry._3(fold, Curry.__3(f), tbl, init); + return fold((function (key, data, acc) { + return f(key, data, acc); + }), tbl, init); }; let create$1 = function (sz) { - return Curry._2(create, false, sz); + return create(false, sz); }; return { create: create$1, @@ -165,4 +194,4 @@ exports.filter_map_inplace = filter_map_inplace; exports.fold = fold; exports.MakeSeeded = MakeSeeded; exports.Make = Make; -/* No side effect */ +/* Hashtbl Not a pure module */ diff --git a/lib/js/js_array.js b/lib/js/js_array.js index 8da31ce1cf..889ea1c35e 100644 --- a/lib/js/js_array.js +++ b/lib/js/js_array.js @@ -1,6 +1,5 @@ 'use strict'; -let Curry = require("./curry.js"); let Caml_option = require("./caml_option.js"); let Caml_splice_call = require("./caml_splice_call.js"); @@ -37,7 +36,7 @@ function pushMany(arg1, obj) { } function sortInPlaceWith(arg1, obj) { - return obj.sort(Curry.__2(arg1)); + return obj.sort(arg1); } function spliceInPlace(pos, remove, add, obj) { @@ -105,75 +104,75 @@ function sliceFrom(arg1, obj) { } function every(arg1, obj) { - return obj.every(Curry.__1(arg1)); + return obj.every(arg1); } function everyi(arg1, obj) { - return obj.every(Curry.__2(arg1)); + return obj.every(arg1); } function filter(arg1, obj) { - return obj.filter(Curry.__1(arg1)); + return obj.filter(arg1); } function filteri(arg1, obj) { - return obj.filter(Curry.__2(arg1)); + return obj.filter(arg1); } function find(arg1, obj) { - return Caml_option.undefined_to_opt(obj.find(Curry.__1(arg1))); + return Caml_option.undefined_to_opt(obj.find(arg1)); } function findi(arg1, obj) { - return Caml_option.undefined_to_opt(obj.find(Curry.__2(arg1))); + return Caml_option.undefined_to_opt(obj.find(arg1)); } function findIndex(arg1, obj) { - return obj.findIndex(Curry.__1(arg1)); + return obj.findIndex(arg1); } function findIndexi(arg1, obj) { - return obj.findIndex(Curry.__2(arg1)); + return obj.findIndex(arg1); } function forEach(arg1, obj) { - obj.forEach(Curry.__1(arg1)); + obj.forEach(arg1); } function forEachi(arg1, obj) { - obj.forEach(Curry.__2(arg1)); + obj.forEach(arg1); } function map(arg1, obj) { - return obj.map(Curry.__1(arg1)); + return obj.map(arg1); } function mapi(arg1, obj) { - return obj.map(Curry.__2(arg1)); + return obj.map(arg1); } function reduce(arg1, arg2, obj) { - return obj.reduce(Curry.__2(arg1), arg2); + return obj.reduce(arg1, arg2); } function reducei(arg1, arg2, obj) { - return obj.reduce(Curry.__3(arg1), arg2); + return obj.reduce(arg1, arg2); } function reduceRight(arg1, arg2, obj) { - return obj.reduceRight(Curry.__2(arg1), arg2); + return obj.reduceRight(arg1, arg2); } function reduceRighti(arg1, arg2, obj) { - return obj.reduceRight(Curry.__3(arg1), arg2); + return obj.reduceRight(arg1, arg2); } function some(arg1, obj) { - return obj.some(Curry.__1(arg1)); + return obj.some(arg1); } function somei(arg1, obj) { - return obj.some(Curry.__2(arg1)); + return obj.some(arg1); } exports.copyWithin = copyWithin; diff --git a/lib/js/js_string.js b/lib/js/js_string.js index 74854d2836..52e683195e 100644 --- a/lib/js/js_string.js +++ b/lib/js/js_string.js @@ -1,6 +1,5 @@ 'use strict'; -let Curry = require("./curry.js"); let Caml_option = require("./caml_option.js"); let Caml_splice_call = require("./caml_splice_call.js"); @@ -81,19 +80,19 @@ function replaceByRe(arg1, arg2, obj) { } function unsafeReplaceBy0(arg1, arg2, obj) { - return obj.replace(arg1, Curry.__3(arg2)); + return obj.replace(arg1, arg2); } function unsafeReplaceBy1(arg1, arg2, obj) { - return obj.replace(arg1, Curry.__4(arg2)); + return obj.replace(arg1, arg2); } function unsafeReplaceBy2(arg1, arg2, obj) { - return obj.replace(arg1, Curry.__5(arg2)); + return obj.replace(arg1, arg2); } function unsafeReplaceBy3(arg1, arg2, obj) { - return obj.replace(arg1, Curry.__6(arg2)); + return obj.replace(arg1, arg2); } function search(arg1, obj) { diff --git a/lib/js/lazy.js b/lib/js/lazy.js index 4172877d98..30aefe8c5e 100644 --- a/lib/js/lazy.js +++ b/lib/js/lazy.js @@ -1,15 +1,16 @@ 'use strict'; -let Curry = require("./curry.js"); let CamlinternalLazy = require("./camlinternalLazy.js"); function from_fun(f) { return CamlinternalLazy.from_fun(function () { - return Curry._1(f, undefined); + return f(); }); } -let from_val = CamlinternalLazy.from_val; +function from_val(v) { + return CamlinternalLazy.from_val(v); +} let Undefined = CamlinternalLazy.Undefined; diff --git a/lib/js/lexing.js b/lib/js/lexing.js index bb9e821aac..fc24dc97ac 100644 --- a/lib/js/lexing.js +++ b/lib/js/lexing.js @@ -1,7 +1,6 @@ 'use strict'; let Bytes = require("./bytes.js"); -let Curry = require("./curry.js"); let Caml_array = require("./caml_array.js"); let Caml_bytes = require("./caml_bytes.js"); let Caml_lexer = require("./caml_lexer.js"); @@ -47,7 +46,7 @@ function from_function(f) { return { refill_buff: (function (x) { let aux_buffer = Caml_bytes.create(512); - let read = Curry._2(f, aux_buffer, aux_buffer.length); + let read = f(aux_buffer, aux_buffer.length); let n = read > 0 ? read : (x.lex_eof_reached = true, 0); if ((x.lex_buffer_len + n | 0) > x.lex_buffer.length) { if (((x.lex_buffer_len - x.lex_start_pos | 0) + n | 0) <= x.lex_buffer.length) { diff --git a/lib/js/list.js b/lib/js/list.js index 29e7ac19f9..3794a4fc25 100644 --- a/lib/js/list.js +++ b/lib/js/list.js @@ -1,9 +1,8 @@ 'use strict'; -let Curry = require("./curry.js"); let Caml_obj = require("./caml_obj.js"); -let Pervasives = require("./pervasives.js"); let Caml_option = require("./caml_option.js"); +let PervasivesU = require("./pervasivesU.js"); function length(l) { let _len = 0; @@ -137,7 +136,7 @@ function init_tailrec_aux(_acc, _i, n, f) { } _i = i + 1 | 0; _acc = { - hd: Curry._1(f, i), + hd: f(i), tl: acc }; continue; @@ -148,7 +147,7 @@ function init_aux(i, n, f) { if (i >= n) { return /* [] */0; } - let r = Curry._1(f, i); + let r = f(i); return { hd: r, tl: init_aux(i + 1 | 0, n, f) @@ -156,24 +155,24 @@ function init_aux(i, n, f) { } function init(len, f) { - if (len < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.init" - } - }); - } - if (len > 10000) { - return rev_append(init_tailrec_aux(/* [] */0, 0, len, f), /* [] */0); - } else { - return init_aux(0, len, f); + if (len >= 0) { + if (len > 10000) { + return rev_append(init_tailrec_aux(/* [] */0, 0, len, f), /* [] */0); + } else { + return init_aux(0, len, f); + } } + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "List.init" + } + }); } function flatten(param) { if (param) { - return Pervasives.$at(param.hd, flatten(param.tl)); + return PervasivesU.$at(param.hd, flatten(param.tl)); } else { return /* [] */0; } @@ -183,7 +182,7 @@ function map(f, param) { if (!param) { return /* [] */0; } - let r = Curry._1(f, param.hd); + let r = f(param.hd); return { hd: r, tl: map(f, param.tl) @@ -194,7 +193,7 @@ function mapi(i, f, param) { if (!param) { return /* [] */0; } - let r = Curry._2(f, i, param.hd); + let r = f(i, param.hd); return { hd: r, tl: mapi(i + 1 | 0, f, param.tl) @@ -216,7 +215,7 @@ function rev_map(f, l) { } _param = param.tl; _accu = { - hd: Curry._1(f, param.hd), + hd: f(param.hd), tl: accu }; continue; @@ -229,7 +228,7 @@ function iter(f, _param) { if (!param) { return; } - Curry._1(f, param.hd); + f(param.hd); _param = param.tl; continue; }; @@ -244,7 +243,7 @@ function iteri(f, l) { if (!param) { return; } - Curry._2(f, i, param.hd); + f(i, param.hd); _param = param.tl; _i = i + 1 | 0; continue; @@ -259,14 +258,14 @@ function fold_left(f, _accu, _l) { return accu; } _l = l.tl; - _accu = Curry._2(f, accu, l.hd); + _accu = f(accu, l.hd); continue; }; } function fold_right(f, l, accu) { if (l) { - return Curry._2(f, l.hd, fold_right(f, l.tl, accu)); + return f(l.hd, fold_right(f, l.tl, accu)); } else { return accu; } @@ -275,7 +274,7 @@ function fold_right(f, l, accu) { function map2(f, l1, l2) { if (l1) { if (l2) { - let r = Curry._2(f, l1.hd, l2.hd); + let r = f(l1.hd, l2.hd); return { hd: r, tl: map2(f, l1.tl, l2.tl) @@ -312,7 +311,7 @@ function rev_map2(f, l1, l2) { _l2 = l2$1.tl; _l1 = l1$1.tl; _accu = { - hd: Curry._2(f, l1$1.hd, l2$1.hd), + hd: f(l1$1.hd, l2$1.hd), tl: accu }; continue; @@ -324,15 +323,15 @@ function rev_map2(f, l1, l2) { } }); } - if (l2$1) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2" - } - }); + if (!l2$1) { + return accu; } - return accu; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2" + } + }); }; } @@ -342,7 +341,7 @@ function iter2(f, _l1, _l2) { let l1 = _l1; if (l1) { if (l2) { - Curry._2(f, l1.hd, l2.hd); + f(l1.hd, l2.hd); _l2 = l2.tl; _l1 = l1.tl; continue; @@ -375,7 +374,7 @@ function fold_left2(f, _accu, _l1, _l2) { if (l2) { _l2 = l2.tl; _l1 = l1.tl; - _accu = Curry._3(f, accu, l1.hd, l2.hd); + _accu = f(accu, l1.hd, l2.hd); continue; } throw new Error("Invalid_argument", { @@ -385,22 +384,22 @@ function fold_left2(f, _accu, _l1, _l2) { } }); } - if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_left2" - } - }); + if (!l2) { + return accu; } - return accu; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2" + } + }); }; } function fold_right2(f, l1, l2, accu) { if (l1) { if (l2) { - return Curry._3(f, l1.hd, l2.hd, fold_right2(f, l1.tl, l2.tl, accu)); + return f(l1.hd, l2.hd, fold_right2(f, l1.tl, l2.tl, accu)); } throw new Error("Invalid_argument", { cause: { @@ -409,15 +408,15 @@ function fold_right2(f, l1, l2, accu) { } }); } - if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2" - } - }); + if (!l2) { + return accu; } - return accu; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2" + } + }); } function for_all(p, _param) { @@ -426,7 +425,7 @@ function for_all(p, _param) { if (!param) { return true; } - if (!Curry._1(p, param.hd)) { + if (!p(param.hd)) { return false; } _param = param.tl; @@ -440,7 +439,7 @@ function exists(p, _param) { if (!param) { return false; } - if (Curry._1(p, param.hd)) { + if (p(param.hd)) { return true; } _param = param.tl; @@ -454,7 +453,7 @@ function for_all2(p, _l1, _l2) { let l1 = _l1; if (l1) { if (l2) { - if (!Curry._2(p, l1.hd, l2.hd)) { + if (!p(l1.hd, l2.hd)) { return false; } _l2 = l2.tl; @@ -486,7 +485,7 @@ function exists2(p, _l1, _l2) { let l1 = _l1; if (l1) { if (l2) { - if (Curry._2(p, l1.hd, l2.hd)) { + if (p(l1.hd, l2.hd)) { return true; } _l2 = l2.tl; @@ -673,7 +672,7 @@ function find(p, _param) { let param = _param; if (param) { let x = param.hd; - if (Curry._1(p, x)) { + if (p(x)) { return x; } _param = param.tl; @@ -694,7 +693,7 @@ function find_opt(p, _param) { return; } let x = param.hd; - if (Curry._1(p, x)) { + if (p(x)) { return Caml_option.some(x); } _param = param.tl; @@ -713,7 +712,7 @@ function find_all(p, l) { } let l$1 = param.tl; let x = param.hd; - if (Curry._1(p, x)) { + if (p(x)) { _param = l$1; _accu = { hd: x, @@ -742,7 +741,7 @@ function partition(p, l) { } let l$1 = param.tl; let x = param.hd; - if (Curry._1(p, x)) { + if (p(x)) { _param = l$1; _yes = { hd: x, @@ -818,7 +817,7 @@ function merge(cmp, l1, l2) { } let h2 = l2.hd; let h1 = l1.hd; - if (Curry._2(cmp, h1, h2) <= 0) { + if (cmp(h1, h2) <= 0) { return { hd: h1, tl: merge(cmp, l1.tl, l2) @@ -867,8 +866,8 @@ function stable_sort(cmp, l) { let x3 = match$1.hd; let x2 = match.hd; let x1 = l.hd; - if (Curry._2(cmp, x1, x2) <= 0) { - if (Curry._2(cmp, x2, x3) <= 0) { + if (cmp(x1, x2) <= 0) { + if (cmp(x2, x3) <= 0) { return { hd: x1, tl: { @@ -879,7 +878,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x1, x3) <= 0) { + } else if (cmp(x1, x3) <= 0) { return { hd: x1, tl: { @@ -902,7 +901,7 @@ function stable_sort(cmp, l) { } }; } - } else if (Curry._2(cmp, x1, x3) <= 0) { + } else if (cmp(x1, x3) <= 0) { return { hd: x2, tl: { @@ -913,7 +912,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x2, x3) <= 0) { + } else if (cmp(x2, x3) <= 0) { return { hd: x2, tl: { @@ -947,7 +946,7 @@ function stable_sort(cmp, l) { if (match$2) { let x2$1 = match$2.hd; let x1$1 = l.hd; - if (Curry._2(cmp, x1$1, x2$1) <= 0) { + if (cmp(x1$1, x2$1) <= 0) { return { hd: x1$1, tl: { @@ -987,7 +986,7 @@ function stable_sort(cmp, l) { } let h2 = l2$1.hd; let h1 = l1.hd; - if (Curry._2(cmp, h1, h2) > 0) { + if (cmp(h1, h2) > 0) { _accu = { hd: h1, tl: accu @@ -1013,8 +1012,8 @@ function stable_sort(cmp, l) { let x3 = match$1.hd; let x2 = match.hd; let x1 = l.hd; - if (Curry._2(cmp, x1, x2) > 0) { - if (Curry._2(cmp, x2, x3) > 0) { + if (cmp(x1, x2) > 0) { + if (cmp(x2, x3) > 0) { return { hd: x1, tl: { @@ -1025,7 +1024,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x1, x3) > 0) { + } else if (cmp(x1, x3) > 0) { return { hd: x1, tl: { @@ -1048,7 +1047,7 @@ function stable_sort(cmp, l) { } }; } - } else if (Curry._2(cmp, x1, x3) > 0) { + } else if (cmp(x1, x3) > 0) { return { hd: x2, tl: { @@ -1059,7 +1058,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x2, x3) > 0) { + } else if (cmp(x2, x3) > 0) { return { hd: x2, tl: { @@ -1093,7 +1092,7 @@ function stable_sort(cmp, l) { if (match$2) { let x2$1 = match$2.hd; let x1$1 = l.hd; - if (Curry._2(cmp, x1$1, x2$1) > 0) { + if (cmp(x1$1, x2$1) > 0) { return { hd: x1$1, tl: { @@ -1133,7 +1132,7 @@ function stable_sort(cmp, l) { } let h2 = l2$1.hd; let h1 = l1.hd; - if (Curry._2(cmp, h1, h2) <= 0) { + if (cmp(h1, h2) <= 0) { _accu = { hd: h1, tl: accu @@ -1168,9 +1167,9 @@ function sort_uniq(cmp, l) { let x3 = match$1.hd; let x2 = match.hd; let x1 = l.hd; - let c = Curry._2(cmp, x1, x2); + let c = cmp(x1, x2); if (c === 0) { - let c$1 = Curry._2(cmp, x2, x3); + let c$1 = cmp(x2, x3); if (c$1 === 0) { return { hd: x2, @@ -1195,7 +1194,7 @@ function sort_uniq(cmp, l) { } } if (c < 0) { - let c$2 = Curry._2(cmp, x2, x3); + let c$2 = cmp(x2, x3); if (c$2 === 0) { return { hd: x1, @@ -1217,7 +1216,7 @@ function sort_uniq(cmp, l) { } }; } - let c$3 = Curry._2(cmp, x1, x3); + let c$3 = cmp(x1, x3); if (c$3 === 0) { return { hd: x1, @@ -1250,7 +1249,7 @@ function sort_uniq(cmp, l) { }; } } - let c$4 = Curry._2(cmp, x1, x3); + let c$4 = cmp(x1, x3); if (c$4 === 0) { return { hd: x2, @@ -1272,7 +1271,7 @@ function sort_uniq(cmp, l) { } }; } - let c$5 = Curry._2(cmp, x2, x3); + let c$5 = cmp(x2, x3); if (c$5 === 0) { return { hd: x2, @@ -1315,7 +1314,7 @@ function sort_uniq(cmp, l) { if (match$2) { let x2$1 = match$2.hd; let x1$1 = l.hd; - let c$6 = Curry._2(cmp, x1$1, x2$1); + let c$6 = cmp(x1$1, x2$1); if (c$6 === 0) { return { hd: x1$1, @@ -1363,7 +1362,7 @@ function sort_uniq(cmp, l) { let h2 = l2$1.hd; let t1 = l1.tl; let h1 = l1.hd; - let c$7 = Curry._2(cmp, h1, h2); + let c$7 = cmp(h1, h2); if (c$7 === 0) { _accu = { hd: h1, @@ -1399,9 +1398,9 @@ function sort_uniq(cmp, l) { let x3 = match$1.hd; let x2 = match.hd; let x1 = l.hd; - let c = Curry._2(cmp, x1, x2); + let c = cmp(x1, x2); if (c === 0) { - let c$1 = Curry._2(cmp, x2, x3); + let c$1 = cmp(x2, x3); if (c$1 === 0) { return { hd: x2, @@ -1426,7 +1425,7 @@ function sort_uniq(cmp, l) { } } if (c > 0) { - let c$2 = Curry._2(cmp, x2, x3); + let c$2 = cmp(x2, x3); if (c$2 === 0) { return { hd: x1, @@ -1448,7 +1447,7 @@ function sort_uniq(cmp, l) { } }; } - let c$3 = Curry._2(cmp, x1, x3); + let c$3 = cmp(x1, x3); if (c$3 === 0) { return { hd: x1, @@ -1481,7 +1480,7 @@ function sort_uniq(cmp, l) { }; } } - let c$4 = Curry._2(cmp, x1, x3); + let c$4 = cmp(x1, x3); if (c$4 === 0) { return { hd: x2, @@ -1503,7 +1502,7 @@ function sort_uniq(cmp, l) { } }; } - let c$5 = Curry._2(cmp, x2, x3); + let c$5 = cmp(x2, x3); if (c$5 === 0) { return { hd: x2, @@ -1546,7 +1545,7 @@ function sort_uniq(cmp, l) { if (match$2) { let x2$1 = match$2.hd; let x1$1 = l.hd; - let c$6 = Curry._2(cmp, x1$1, x2$1); + let c$6 = cmp(x1$1, x2$1); if (c$6 === 0) { return { hd: x1$1, @@ -1594,7 +1593,7 @@ function sort_uniq(cmp, l) { let h2 = l2$1.hd; let t1 = l1.tl; let h1 = l1.hd; - let c$7 = Curry._2(cmp, h1, h2); + let c$7 = cmp(h1, h2); if (c$7 === 0) { _accu = { hd: h1, @@ -1670,7 +1669,7 @@ function compare_length_with(_l, _n) { }; } -let append = Pervasives.$at; +let append = PervasivesU.$at; let concat = flatten; diff --git a/lib/js/listLabels.js b/lib/js/listLabels.js index f63f6bb629..66e84f6859 100644 --- a/lib/js/listLabels.js +++ b/lib/js/listLabels.js @@ -1,9 +1,8 @@ 'use strict'; -let Curry = require("./curry.js"); let Caml_obj = require("./caml_obj.js"); -let Pervasives = require("./pervasives.js"); let Caml_option = require("./caml_option.js"); +let PervasivesU = require("./pervasivesU.js"); function length(l) { let _len = 0; @@ -137,7 +136,7 @@ function init_tailrec_aux(_acc, _i, n, f) { } _i = i + 1 | 0; _acc = { - hd: Curry._1(f, i), + hd: f(i), tl: acc }; continue; @@ -148,7 +147,7 @@ function init_aux(i, n, f) { if (i >= n) { return /* [] */0; } - let r = Curry._1(f, i); + let r = f(i); return { hd: r, tl: init_aux(i + 1 | 0, n, f) @@ -156,24 +155,24 @@ function init_aux(i, n, f) { } function init(len, f) { - if (len < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.init" - } - }); - } - if (len > 10000) { - return rev_append(init_tailrec_aux(/* [] */0, 0, len, f), /* [] */0); - } else { - return init_aux(0, len, f); + if (len >= 0) { + if (len > 10000) { + return rev_append(init_tailrec_aux(/* [] */0, 0, len, f), /* [] */0); + } else { + return init_aux(0, len, f); + } } + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "List.init" + } + }); } function flatten(param) { if (param) { - return Pervasives.$at(param.hd, flatten(param.tl)); + return PervasivesU.$at(param.hd, flatten(param.tl)); } else { return /* [] */0; } @@ -183,7 +182,7 @@ function map(f, param) { if (!param) { return /* [] */0; } - let r = Curry._1(f, param.hd); + let r = f(param.hd); return { hd: r, tl: map(f, param.tl) @@ -194,7 +193,7 @@ function mapi(i, f, param) { if (!param) { return /* [] */0; } - let r = Curry._2(f, i, param.hd); + let r = f(i, param.hd); return { hd: r, tl: mapi(i + 1 | 0, f, param.tl) @@ -216,7 +215,7 @@ function rev_map(f, l) { } _param = param.tl; _accu = { - hd: Curry._1(f, param.hd), + hd: f(param.hd), tl: accu }; continue; @@ -229,7 +228,7 @@ function iter(f, _param) { if (!param) { return; } - Curry._1(f, param.hd); + f(param.hd); _param = param.tl; continue; }; @@ -244,7 +243,7 @@ function iteri(f, l) { if (!param) { return; } - Curry._2(f, i, param.hd); + f(i, param.hd); _param = param.tl; _i = i + 1 | 0; continue; @@ -259,14 +258,14 @@ function fold_left(f, _accu, _l) { return accu; } _l = l.tl; - _accu = Curry._2(f, accu, l.hd); + _accu = f(accu, l.hd); continue; }; } function fold_right(f, l, accu) { if (l) { - return Curry._2(f, l.hd, fold_right(f, l.tl, accu)); + return f(l.hd, fold_right(f, l.tl, accu)); } else { return accu; } @@ -275,7 +274,7 @@ function fold_right(f, l, accu) { function map2(f, l1, l2) { if (l1) { if (l2) { - let r = Curry._2(f, l1.hd, l2.hd); + let r = f(l1.hd, l2.hd); return { hd: r, tl: map2(f, l1.tl, l2.tl) @@ -312,7 +311,7 @@ function rev_map2(f, l1, l2) { _l2 = l2$1.tl; _l1 = l1$1.tl; _accu = { - hd: Curry._2(f, l1$1.hd, l2$1.hd), + hd: f(l1$1.hd, l2$1.hd), tl: accu }; continue; @@ -324,15 +323,15 @@ function rev_map2(f, l1, l2) { } }); } - if (l2$1) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2" - } - }); + if (!l2$1) { + return accu; } - return accu; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2" + } + }); }; } @@ -342,7 +341,7 @@ function iter2(f, _l1, _l2) { let l1 = _l1; if (l1) { if (l2) { - Curry._2(f, l1.hd, l2.hd); + f(l1.hd, l2.hd); _l2 = l2.tl; _l1 = l1.tl; continue; @@ -375,7 +374,7 @@ function fold_left2(f, _accu, _l1, _l2) { if (l2) { _l2 = l2.tl; _l1 = l1.tl; - _accu = Curry._3(f, accu, l1.hd, l2.hd); + _accu = f(accu, l1.hd, l2.hd); continue; } throw new Error("Invalid_argument", { @@ -385,22 +384,22 @@ function fold_left2(f, _accu, _l1, _l2) { } }); } - if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_left2" - } - }); + if (!l2) { + return accu; } - return accu; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2" + } + }); }; } function fold_right2(f, l1, l2, accu) { if (l1) { if (l2) { - return Curry._3(f, l1.hd, l2.hd, fold_right2(f, l1.tl, l2.tl, accu)); + return f(l1.hd, l2.hd, fold_right2(f, l1.tl, l2.tl, accu)); } throw new Error("Invalid_argument", { cause: { @@ -409,15 +408,15 @@ function fold_right2(f, l1, l2, accu) { } }); } - if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2" - } - }); + if (!l2) { + return accu; } - return accu; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2" + } + }); } function for_all(p, _param) { @@ -426,7 +425,7 @@ function for_all(p, _param) { if (!param) { return true; } - if (!Curry._1(p, param.hd)) { + if (!p(param.hd)) { return false; } _param = param.tl; @@ -440,7 +439,7 @@ function exists(p, _param) { if (!param) { return false; } - if (Curry._1(p, param.hd)) { + if (p(param.hd)) { return true; } _param = param.tl; @@ -454,7 +453,7 @@ function for_all2(p, _l1, _l2) { let l1 = _l1; if (l1) { if (l2) { - if (!Curry._2(p, l1.hd, l2.hd)) { + if (!p(l1.hd, l2.hd)) { return false; } _l2 = l2.tl; @@ -486,7 +485,7 @@ function exists2(p, _l1, _l2) { let l1 = _l1; if (l1) { if (l2) { - if (Curry._2(p, l1.hd, l2.hd)) { + if (p(l1.hd, l2.hd)) { return true; } _l2 = l2.tl; @@ -673,7 +672,7 @@ function find(p, _param) { let param = _param; if (param) { let x = param.hd; - if (Curry._1(p, x)) { + if (p(x)) { return x; } _param = param.tl; @@ -694,7 +693,7 @@ function find_opt(p, _param) { return; } let x = param.hd; - if (Curry._1(p, x)) { + if (p(x)) { return Caml_option.some(x); } _param = param.tl; @@ -713,7 +712,7 @@ function find_all(p, l) { } let l$1 = param.tl; let x = param.hd; - if (Curry._1(p, x)) { + if (p(x)) { _param = l$1; _accu = { hd: x, @@ -742,7 +741,7 @@ function partition(p, l) { } let l$1 = param.tl; let x = param.hd; - if (Curry._1(p, x)) { + if (p(x)) { _param = l$1; _yes = { hd: x, @@ -818,7 +817,7 @@ function merge(cmp, l1, l2) { } let h2 = l2.hd; let h1 = l1.hd; - if (Curry._2(cmp, h1, h2) <= 0) { + if (cmp(h1, h2) <= 0) { return { hd: h1, tl: merge(cmp, l1.tl, l2) @@ -867,8 +866,8 @@ function stable_sort(cmp, l) { let x3 = match$1.hd; let x2 = match.hd; let x1 = l.hd; - if (Curry._2(cmp, x1, x2) <= 0) { - if (Curry._2(cmp, x2, x3) <= 0) { + if (cmp(x1, x2) <= 0) { + if (cmp(x2, x3) <= 0) { return { hd: x1, tl: { @@ -879,7 +878,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x1, x3) <= 0) { + } else if (cmp(x1, x3) <= 0) { return { hd: x1, tl: { @@ -902,7 +901,7 @@ function stable_sort(cmp, l) { } }; } - } else if (Curry._2(cmp, x1, x3) <= 0) { + } else if (cmp(x1, x3) <= 0) { return { hd: x2, tl: { @@ -913,7 +912,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x2, x3) <= 0) { + } else if (cmp(x2, x3) <= 0) { return { hd: x2, tl: { @@ -947,7 +946,7 @@ function stable_sort(cmp, l) { if (match$2) { let x2$1 = match$2.hd; let x1$1 = l.hd; - if (Curry._2(cmp, x1$1, x2$1) <= 0) { + if (cmp(x1$1, x2$1) <= 0) { return { hd: x1$1, tl: { @@ -987,7 +986,7 @@ function stable_sort(cmp, l) { } let h2 = l2$1.hd; let h1 = l1.hd; - if (Curry._2(cmp, h1, h2) > 0) { + if (cmp(h1, h2) > 0) { _accu = { hd: h1, tl: accu @@ -1013,8 +1012,8 @@ function stable_sort(cmp, l) { let x3 = match$1.hd; let x2 = match.hd; let x1 = l.hd; - if (Curry._2(cmp, x1, x2) > 0) { - if (Curry._2(cmp, x2, x3) > 0) { + if (cmp(x1, x2) > 0) { + if (cmp(x2, x3) > 0) { return { hd: x1, tl: { @@ -1025,7 +1024,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x1, x3) > 0) { + } else if (cmp(x1, x3) > 0) { return { hd: x1, tl: { @@ -1048,7 +1047,7 @@ function stable_sort(cmp, l) { } }; } - } else if (Curry._2(cmp, x1, x3) > 0) { + } else if (cmp(x1, x3) > 0) { return { hd: x2, tl: { @@ -1059,7 +1058,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x2, x3) > 0) { + } else if (cmp(x2, x3) > 0) { return { hd: x2, tl: { @@ -1093,7 +1092,7 @@ function stable_sort(cmp, l) { if (match$2) { let x2$1 = match$2.hd; let x1$1 = l.hd; - if (Curry._2(cmp, x1$1, x2$1) > 0) { + if (cmp(x1$1, x2$1) > 0) { return { hd: x1$1, tl: { @@ -1133,7 +1132,7 @@ function stable_sort(cmp, l) { } let h2 = l2$1.hd; let h1 = l1.hd; - if (Curry._2(cmp, h1, h2) <= 0) { + if (cmp(h1, h2) <= 0) { _accu = { hd: h1, tl: accu @@ -1168,9 +1167,9 @@ function sort_uniq(cmp, l) { let x3 = match$1.hd; let x2 = match.hd; let x1 = l.hd; - let c = Curry._2(cmp, x1, x2); + let c = cmp(x1, x2); if (c === 0) { - let c$1 = Curry._2(cmp, x2, x3); + let c$1 = cmp(x2, x3); if (c$1 === 0) { return { hd: x2, @@ -1195,7 +1194,7 @@ function sort_uniq(cmp, l) { } } if (c < 0) { - let c$2 = Curry._2(cmp, x2, x3); + let c$2 = cmp(x2, x3); if (c$2 === 0) { return { hd: x1, @@ -1217,7 +1216,7 @@ function sort_uniq(cmp, l) { } }; } - let c$3 = Curry._2(cmp, x1, x3); + let c$3 = cmp(x1, x3); if (c$3 === 0) { return { hd: x1, @@ -1250,7 +1249,7 @@ function sort_uniq(cmp, l) { }; } } - let c$4 = Curry._2(cmp, x1, x3); + let c$4 = cmp(x1, x3); if (c$4 === 0) { return { hd: x2, @@ -1272,7 +1271,7 @@ function sort_uniq(cmp, l) { } }; } - let c$5 = Curry._2(cmp, x2, x3); + let c$5 = cmp(x2, x3); if (c$5 === 0) { return { hd: x2, @@ -1315,7 +1314,7 @@ function sort_uniq(cmp, l) { if (match$2) { let x2$1 = match$2.hd; let x1$1 = l.hd; - let c$6 = Curry._2(cmp, x1$1, x2$1); + let c$6 = cmp(x1$1, x2$1); if (c$6 === 0) { return { hd: x1$1, @@ -1363,7 +1362,7 @@ function sort_uniq(cmp, l) { let h2 = l2$1.hd; let t1 = l1.tl; let h1 = l1.hd; - let c$7 = Curry._2(cmp, h1, h2); + let c$7 = cmp(h1, h2); if (c$7 === 0) { _accu = { hd: h1, @@ -1399,9 +1398,9 @@ function sort_uniq(cmp, l) { let x3 = match$1.hd; let x2 = match.hd; let x1 = l.hd; - let c = Curry._2(cmp, x1, x2); + let c = cmp(x1, x2); if (c === 0) { - let c$1 = Curry._2(cmp, x2, x3); + let c$1 = cmp(x2, x3); if (c$1 === 0) { return { hd: x2, @@ -1426,7 +1425,7 @@ function sort_uniq(cmp, l) { } } if (c > 0) { - let c$2 = Curry._2(cmp, x2, x3); + let c$2 = cmp(x2, x3); if (c$2 === 0) { return { hd: x1, @@ -1448,7 +1447,7 @@ function sort_uniq(cmp, l) { } }; } - let c$3 = Curry._2(cmp, x1, x3); + let c$3 = cmp(x1, x3); if (c$3 === 0) { return { hd: x1, @@ -1481,7 +1480,7 @@ function sort_uniq(cmp, l) { }; } } - let c$4 = Curry._2(cmp, x1, x3); + let c$4 = cmp(x1, x3); if (c$4 === 0) { return { hd: x2, @@ -1503,7 +1502,7 @@ function sort_uniq(cmp, l) { } }; } - let c$5 = Curry._2(cmp, x2, x3); + let c$5 = cmp(x2, x3); if (c$5 === 0) { return { hd: x2, @@ -1546,7 +1545,7 @@ function sort_uniq(cmp, l) { if (match$2) { let x2$1 = match$2.hd; let x1$1 = l.hd; - let c$6 = Curry._2(cmp, x1$1, x2$1); + let c$6 = cmp(x1$1, x2$1); if (c$6 === 0) { return { hd: x1$1, @@ -1594,7 +1593,7 @@ function sort_uniq(cmp, l) { let h2 = l2$1.hd; let t1 = l1.tl; let h1 = l1.hd; - let c$7 = Curry._2(cmp, h1, h2); + let c$7 = cmp(h1, h2); if (c$7 === 0) { _accu = { hd: h1, @@ -1670,7 +1669,7 @@ function compare_length_with(_l, _n) { }; } -let append = Pervasives.$at; +let append = PervasivesU.$at; let concat = flatten; diff --git a/lib/js/map.js b/lib/js/map.js index 5e0b1e1da3..cd35da063b 100644 --- a/lib/js/map.js +++ b/lib/js/map.js @@ -1,6 +1,5 @@ 'use strict'; -let Curry = require("./curry.js"); let Caml_option = require("./caml_option.js"); function Make(funarg) { @@ -121,7 +120,7 @@ function Make(funarg) { let d = param.d; let v = param.v; let l = param.l; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { if (d === data) { return param; @@ -161,7 +160,7 @@ function Make(funarg) { } }); } - let c = Curry._2(funarg.compare, x, param.v); + let c = funarg.compare(x, param.v); if (c === 0) { return param.d; } @@ -180,7 +179,7 @@ function Make(funarg) { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _d0 = param.d; let _param$1 = param.l; @@ -195,7 +194,7 @@ function Make(funarg) { ]; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.l; _d0 = param$1.d; _v0 = v$1; @@ -216,7 +215,7 @@ function Make(funarg) { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _d0 = param.d; let _param$1 = param.l; @@ -231,7 +230,7 @@ function Make(funarg) { ]; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.l; _d0 = param$1.d; _v0 = v$1; @@ -256,7 +255,7 @@ function Make(funarg) { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _d0 = param.d; let _param$1 = param.r; @@ -271,7 +270,7 @@ function Make(funarg) { ]; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.r; _d0 = param$1.d; _v0 = v$1; @@ -292,7 +291,7 @@ function Make(funarg) { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _d0 = param.d; let _param$1 = param.r; @@ -307,7 +306,7 @@ function Make(funarg) { ]; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.r; _d0 = param$1.d; _v0 = v$1; @@ -327,7 +326,7 @@ function Make(funarg) { if (typeof param !== "object") { return; } - let c = Curry._2(funarg.compare, x, param.v); + let c = funarg.compare(x, param.v); if (c === 0) { return Caml_option.some(param.d); } @@ -341,7 +340,7 @@ function Make(funarg) { if (typeof param !== "object") { return false; } - let c = Curry._2(funarg.compare, x, param.v); + let c = funarg.compare(x, param.v); if (c === 0) { return true; } @@ -459,7 +458,7 @@ function Make(funarg) { let d = param.d; let v = param.v; let l = param.l; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { return merge(l, r); } @@ -480,7 +479,7 @@ function Make(funarg) { }; let update = function (x, f, param) { if (typeof param !== "object") { - let data = Curry._1(f, undefined); + let data = f(undefined); if (data !== undefined) { return { TAG: "Node", @@ -498,9 +497,9 @@ function Make(funarg) { let d = param.d; let v = param.v; let l = param.l; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { - let data$1 = Curry._1(f, Caml_option.some(d)); + let data$1 = f(Caml_option.some(d)); if (data$1 === undefined) { return merge(l, r); } @@ -540,7 +539,7 @@ function Make(funarg) { return; } iter(f, param.l); - Curry._2(f, param.v, param.d); + f(param.v, param.d); _param = param.r; continue; }; @@ -550,7 +549,7 @@ function Make(funarg) { return "Empty"; } let l$p = map(f, param.l); - let d$p = Curry._1(f, param.d); + let d$p = f(param.d); let r$p = map(f, param.r); return { TAG: "Node", @@ -567,7 +566,7 @@ function Make(funarg) { } let v = param.v; let l$p = mapi(f, param.l); - let d$p = Curry._2(f, v, param.d); + let d$p = f(v, param.d); let r$p = mapi(f, param.r); return { TAG: "Node", @@ -585,7 +584,7 @@ function Make(funarg) { if (typeof m !== "object") { return accu; } - _accu = Curry._3(f, m.v, m.d, fold(f, m.l, accu)); + _accu = f(m.v, m.d, fold(f, m.l, accu)); _m = m.r; continue; }; @@ -596,7 +595,7 @@ function Make(funarg) { if (typeof param !== "object") { return true; } - if (!Curry._2(p, param.v, param.d)) { + if (!p(param.v, param.d)) { return false; } if (!for_all(p, param.l)) { @@ -612,7 +611,7 @@ function Make(funarg) { if (typeof param !== "object") { return false; } - if (Curry._2(p, param.v, param.d)) { + if (p(param.v, param.d)) { return true; } if (exists(p, param.l)) { @@ -682,7 +681,7 @@ function Make(funarg) { let d = param.d; let v = param.v; let l = param.l; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { return [ l, @@ -715,7 +714,7 @@ function Make(funarg) { let v1 = s1.v; if (s1.h >= height(s2)) { let match = split(v1, s2); - return concat_or_join(merge$1(f, s1.l, match[0]), v1, Curry._3(f, v1, Caml_option.some(s1.d), match[1]), merge$1(f, s1.r, match[2])); + return concat_or_join(merge$1(f, s1.l, match[0]), v1, f(v1, Caml_option.some(s1.d), match[1]), merge$1(f, s1.r, match[2])); } } @@ -733,7 +732,7 @@ function Make(funarg) { } let v2 = s2.v; let match$1 = split(v2, s1); - return concat_or_join(merge$1(f, match$1[0], s2.l), v2, Curry._3(f, v2, match$1[1], Caml_option.some(s2.d)), merge$1(f, match$1[2], s2.r)); + return concat_or_join(merge$1(f, match$1[0], s2.l), v2, f(v2, match$1[1], Caml_option.some(s2.d)), merge$1(f, match$1[2], s2.r)); }; let union = function (f, s1, s2) { if (typeof s1 !== "object") { @@ -752,7 +751,7 @@ function Make(funarg) { let l = union(f, s1.l, match[0]); let r = union(f, s1.r, match[2]); if (d2$1 !== undefined) { - return concat_or_join(l, v1, Curry._3(f, v1, d1, Caml_option.valFromOption(d2$1)), r); + return concat_or_join(l, v1, f(v1, d1, Caml_option.valFromOption(d2$1)), r); } else { return join(l, v1, d1, r); } @@ -762,7 +761,7 @@ function Make(funarg) { let l$1 = union(f, match$1[0], s2.l); let r$1 = union(f, match$1[2], s2.r); if (d1$1 !== undefined) { - return concat_or_join(l$1, v2, Curry._3(f, v2, Caml_option.valFromOption(d1$1), d2), r$1); + return concat_or_join(l$1, v2, f(v2, Caml_option.valFromOption(d1$1), d2), r$1); } else { return join(l$1, v2, d2, r$1); } @@ -776,7 +775,7 @@ function Make(funarg) { let v = param.v; let l = param.l; let l$p = filter(p, l); - let pvd = Curry._2(p, v, d); + let pvd = p(v, d); let r$p = filter(p, r); if (pvd) { if (l === l$p && r === r$p) { @@ -800,7 +799,7 @@ function Make(funarg) { let match = partition(p, param.l); let lf = match[1]; let lt = match[0]; - let pvd = Curry._2(p, v, d); + let pvd = p(v, d); let match$1 = partition(p, param.r); let rf = match$1[1]; let rt = match$1[0]; @@ -850,11 +849,11 @@ function Make(funarg) { if (typeof e2 !== "object") { return 1; } - let c = Curry._2(funarg.compare, e1._0, e2._0); + let c = funarg.compare(e1._0, e2._0); if (c !== 0) { return c; } - let c$1 = Curry._2(cmp, e1._1, e2._1); + let c$1 = cmp(e1._1, e2._1); if (c$1 !== 0) { return c$1; } @@ -879,10 +878,10 @@ function Make(funarg) { if (typeof e2 !== "object") { return false; } - if (Curry._2(funarg.compare, e1._0, e2._0) !== 0) { + if (funarg.compare(e1._0, e2._0) !== 0) { return false; } - if (!Curry._2(cmp, e1._1, e2._1)) { + if (!cmp(e1._1, e2._1)) { return false; } _e2 = cons_enum(e2._2, e2._3); diff --git a/lib/js/mapLabels.js b/lib/js/mapLabels.js index 8949bd1ae3..466d54c7fa 100644 --- a/lib/js/mapLabels.js +++ b/lib/js/mapLabels.js @@ -1,6 +1,5 @@ 'use strict'; -let Curry = require("./curry.js"); let Caml_option = require("./caml_option.js"); function Make(Ord) { @@ -121,7 +120,7 @@ function Make(Ord) { let d = param.d; let v = param.v; let l = param.l; - let c = Curry._2(Ord.compare, x, v); + let c = Ord.compare(x, v); if (c === 0) { if (d === data) { return param; @@ -161,7 +160,7 @@ function Make(Ord) { } }); } - let c = Curry._2(Ord.compare, x, param.v); + let c = Ord.compare(x, param.v); if (c === 0) { return param.d; } @@ -181,7 +180,7 @@ function Make(Ord) { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.l; _d0 = param.d; _v0 = v; @@ -202,7 +201,7 @@ function Make(Ord) { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_first_aux(v, param.d, f, param.l); } _param = param.r; @@ -221,7 +220,7 @@ function Make(Ord) { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.l; _d0 = param.d; _v0 = v; @@ -238,7 +237,7 @@ function Make(Ord) { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_first_opt_aux(v, param.d, f, param.l); } _param = param.r; @@ -257,7 +256,7 @@ function Make(Ord) { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.r; _d0 = param.d; _v0 = v; @@ -278,7 +277,7 @@ function Make(Ord) { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_last_aux(v, param.d, f, param.r); } _param = param.l; @@ -297,7 +296,7 @@ function Make(Ord) { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.r; _d0 = param.d; _v0 = v; @@ -314,7 +313,7 @@ function Make(Ord) { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_last_opt_aux(v, param.d, f, param.r); } _param = param.l; @@ -327,7 +326,7 @@ function Make(Ord) { if (typeof param !== "object") { return; } - let c = Curry._2(Ord.compare, x, param.v); + let c = Ord.compare(x, param.v); if (c === 0) { return Caml_option.some(param.d); } @@ -341,7 +340,7 @@ function Make(Ord) { if (typeof param !== "object") { return false; } - let c = Curry._2(Ord.compare, x, param.v); + let c = Ord.compare(x, param.v); if (c === 0) { return true; } @@ -459,7 +458,7 @@ function Make(Ord) { let d = param.d; let v = param.v; let l = param.l; - let c = Curry._2(Ord.compare, x, v); + let c = Ord.compare(x, v); if (c === 0) { return merge(l, r); } @@ -480,7 +479,7 @@ function Make(Ord) { }; let update = function (x, f, param) { if (typeof param !== "object") { - let data = Curry._1(f, undefined); + let data = f(undefined); if (data !== undefined) { return { TAG: "Node", @@ -498,9 +497,9 @@ function Make(Ord) { let d = param.d; let v = param.v; let l = param.l; - let c = Curry._2(Ord.compare, x, v); + let c = Ord.compare(x, v); if (c === 0) { - let data$1 = Curry._1(f, Caml_option.some(d)); + let data$1 = f(Caml_option.some(d)); if (data$1 === undefined) { return merge(l, r); } @@ -540,7 +539,7 @@ function Make(Ord) { return; } iter(f, param.l); - Curry._2(f, param.v, param.d); + f(param.v, param.d); _param = param.r; continue; }; @@ -550,7 +549,7 @@ function Make(Ord) { return "Empty"; } let l$p = map(f, param.l); - let d$p = Curry._1(f, param.d); + let d$p = f(param.d); let r$p = map(f, param.r); return { TAG: "Node", @@ -567,7 +566,7 @@ function Make(Ord) { } let v = param.v; let l$p = mapi(f, param.l); - let d$p = Curry._2(f, v, param.d); + let d$p = f(v, param.d); let r$p = mapi(f, param.r); return { TAG: "Node", @@ -585,7 +584,7 @@ function Make(Ord) { if (typeof m !== "object") { return accu; } - _accu = Curry._3(f, m.v, m.d, fold(f, m.l, accu)); + _accu = f(m.v, m.d, fold(f, m.l, accu)); _m = m.r; continue; }; @@ -596,7 +595,7 @@ function Make(Ord) { if (typeof param !== "object") { return true; } - if (!Curry._2(p, param.v, param.d)) { + if (!p(param.v, param.d)) { return false; } if (!for_all(p, param.l)) { @@ -612,7 +611,7 @@ function Make(Ord) { if (typeof param !== "object") { return false; } - if (Curry._2(p, param.v, param.d)) { + if (p(param.v, param.d)) { return true; } if (exists(p, param.l)) { @@ -682,7 +681,7 @@ function Make(Ord) { let d = param.d; let v = param.v; let l = param.l; - let c = Curry._2(Ord.compare, x, v); + let c = Ord.compare(x, v); if (c === 0) { return [ l, @@ -715,7 +714,7 @@ function Make(Ord) { let v1 = s1.v; if (s1.h >= height(s2)) { let match = split(v1, s2); - return concat_or_join(merge$1(f, s1.l, match[0]), v1, Curry._3(f, v1, Caml_option.some(s1.d), match[1]), merge$1(f, s1.r, match[2])); + return concat_or_join(merge$1(f, s1.l, match[0]), v1, f(v1, Caml_option.some(s1.d), match[1]), merge$1(f, s1.r, match[2])); } } @@ -733,7 +732,7 @@ function Make(Ord) { } let v2 = s2.v; let match$1 = split(v2, s1); - return concat_or_join(merge$1(f, match$1[0], s2.l), v2, Curry._3(f, v2, match$1[1], Caml_option.some(s2.d)), merge$1(f, match$1[2], s2.r)); + return concat_or_join(merge$1(f, match$1[0], s2.l), v2, f(v2, match$1[1], Caml_option.some(s2.d)), merge$1(f, match$1[2], s2.r)); }; let union = function (f, s1, s2) { if (typeof s1 !== "object") { @@ -752,7 +751,7 @@ function Make(Ord) { let l = union(f, s1.l, match[0]); let r = union(f, s1.r, match[2]); if (d2$1 !== undefined) { - return concat_or_join(l, v1, Curry._3(f, v1, d1, Caml_option.valFromOption(d2$1)), r); + return concat_or_join(l, v1, f(v1, d1, Caml_option.valFromOption(d2$1)), r); } else { return join(l, v1, d1, r); } @@ -762,7 +761,7 @@ function Make(Ord) { let l$1 = union(f, match$1[0], s2.l); let r$1 = union(f, match$1[2], s2.r); if (d1$1 !== undefined) { - return concat_or_join(l$1, v2, Curry._3(f, v2, Caml_option.valFromOption(d1$1), d2), r$1); + return concat_or_join(l$1, v2, f(v2, Caml_option.valFromOption(d1$1), d2), r$1); } else { return join(l$1, v2, d2, r$1); } @@ -776,7 +775,7 @@ function Make(Ord) { let v = param.v; let l = param.l; let l$p = filter(p, l); - let pvd = Curry._2(p, v, d); + let pvd = p(v, d); let r$p = filter(p, r); if (pvd) { if (l === l$p && r === r$p) { @@ -800,7 +799,7 @@ function Make(Ord) { let match = partition(p, param.l); let lf = match[1]; let lt = match[0]; - let pvd = Curry._2(p, v, d); + let pvd = p(v, d); let match$1 = partition(p, param.r); let rf = match$1[1]; let rt = match$1[0]; @@ -850,11 +849,11 @@ function Make(Ord) { if (typeof e2 !== "object") { return 1; } - let c = Curry._2(Ord.compare, e1._0, e2._0); + let c = Ord.compare(e1._0, e2._0); if (c !== 0) { return c; } - let c$1 = Curry._2(cmp, e1._1, e2._1); + let c$1 = cmp(e1._1, e2._1); if (c$1 !== 0) { return c$1; } @@ -879,10 +878,10 @@ function Make(Ord) { if (typeof e2 !== "object") { return false; } - if (Curry._2(Ord.compare, e1._0, e2._0) !== 0) { + if (Ord.compare(e1._0, e2._0) !== 0) { return false; } - if (!Curry._2(cmp, e1._1, e2._1)) { + if (!cmp(e1._1, e2._1)) { return false; } _e2 = cons_enum(e2._2, e2._3); diff --git a/lib/js/moreLabels.js b/lib/js/moreLabels.js index 2fb37caea2..aec5317d26 100644 --- a/lib/js/moreLabels.js +++ b/lib/js/moreLabels.js @@ -1,7 +1,6 @@ 'use strict'; let List = require("./list.js"); -let Curry = require("./curry.js"); let Caml_option = require("./caml_option.js"); let HashtblLabels = require("./hashtblLabels.js"); @@ -151,7 +150,7 @@ let $$Map = { let d = param.d; let v = param.v; let l = param.l; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { if (d === data) { return param; @@ -191,7 +190,7 @@ let $$Map = { } }); } - let c = Curry._2(funarg.compare, x, param.v); + let c = funarg.compare(x, param.v); if (c === 0) { return param.d; } @@ -211,7 +210,7 @@ let $$Map = { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.l; _d0 = param.d; _v0 = v; @@ -232,7 +231,7 @@ let $$Map = { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_first_aux(v, param.d, f, param.l); } _param = param.r; @@ -251,7 +250,7 @@ let $$Map = { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.l; _d0 = param.d; _v0 = v; @@ -268,7 +267,7 @@ let $$Map = { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_first_opt_aux(v, param.d, f, param.l); } _param = param.r; @@ -287,7 +286,7 @@ let $$Map = { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.r; _d0 = param.d; _v0 = v; @@ -308,7 +307,7 @@ let $$Map = { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_last_aux(v, param.d, f, param.r); } _param = param.l; @@ -327,7 +326,7 @@ let $$Map = { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.r; _d0 = param.d; _v0 = v; @@ -344,7 +343,7 @@ let $$Map = { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_last_opt_aux(v, param.d, f, param.r); } _param = param.l; @@ -357,7 +356,7 @@ let $$Map = { if (typeof param !== "object") { return; } - let c = Curry._2(funarg.compare, x, param.v); + let c = funarg.compare(x, param.v); if (c === 0) { return Caml_option.some(param.d); } @@ -371,7 +370,7 @@ let $$Map = { if (typeof param !== "object") { return false; } - let c = Curry._2(funarg.compare, x, param.v); + let c = funarg.compare(x, param.v); if (c === 0) { return true; } @@ -489,7 +488,7 @@ let $$Map = { let d = param.d; let v = param.v; let l = param.l; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { return merge(l, r); } @@ -510,7 +509,7 @@ let $$Map = { }; let update = function (x, f, param) { if (typeof param !== "object") { - let data = Curry._1(f, undefined); + let data = f(undefined); if (data !== undefined) { return { TAG: "Node", @@ -528,9 +527,9 @@ let $$Map = { let d = param.d; let v = param.v; let l = param.l; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { - let data$1 = Curry._1(f, Caml_option.some(d)); + let data$1 = f(Caml_option.some(d)); if (data$1 === undefined) { return merge(l, r); } @@ -570,7 +569,7 @@ let $$Map = { return; } iter(f, param.l); - Curry._2(f, param.v, param.d); + f(param.v, param.d); _param = param.r; continue; }; @@ -580,7 +579,7 @@ let $$Map = { return "Empty"; } let l$p = map(f, param.l); - let d$p = Curry._1(f, param.d); + let d$p = f(param.d); let r$p = map(f, param.r); return { TAG: "Node", @@ -597,7 +596,7 @@ let $$Map = { } let v = param.v; let l$p = mapi(f, param.l); - let d$p = Curry._2(f, v, param.d); + let d$p = f(v, param.d); let r$p = mapi(f, param.r); return { TAG: "Node", @@ -615,7 +614,7 @@ let $$Map = { if (typeof m !== "object") { return accu; } - _accu = Curry._3(f, m.v, m.d, fold(f, m.l, accu)); + _accu = f(m.v, m.d, fold(f, m.l, accu)); _m = m.r; continue; }; @@ -626,7 +625,7 @@ let $$Map = { if (typeof param !== "object") { return true; } - if (!Curry._2(p, param.v, param.d)) { + if (!p(param.v, param.d)) { return false; } if (!for_all(p, param.l)) { @@ -642,7 +641,7 @@ let $$Map = { if (typeof param !== "object") { return false; } - if (Curry._2(p, param.v, param.d)) { + if (p(param.v, param.d)) { return true; } if (exists(p, param.l)) { @@ -712,7 +711,7 @@ let $$Map = { let d = param.d; let v = param.v; let l = param.l; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { return [ l, @@ -745,7 +744,7 @@ let $$Map = { let v1 = s1.v; if (s1.h >= height(s2)) { let match = split(v1, s2); - return concat_or_join(merge$1(f, s1.l, match[0]), v1, Curry._3(f, v1, Caml_option.some(s1.d), match[1]), merge$1(f, s1.r, match[2])); + return concat_or_join(merge$1(f, s1.l, match[0]), v1, f(v1, Caml_option.some(s1.d), match[1]), merge$1(f, s1.r, match[2])); } } @@ -763,7 +762,7 @@ let $$Map = { } let v2 = s2.v; let match$1 = split(v2, s1); - return concat_or_join(merge$1(f, match$1[0], s2.l), v2, Curry._3(f, v2, match$1[1], Caml_option.some(s2.d)), merge$1(f, match$1[2], s2.r)); + return concat_or_join(merge$1(f, match$1[0], s2.l), v2, f(v2, match$1[1], Caml_option.some(s2.d)), merge$1(f, match$1[2], s2.r)); }; let union = function (f, s1, s2) { if (typeof s1 !== "object") { @@ -782,7 +781,7 @@ let $$Map = { let l = union(f, s1.l, match[0]); let r = union(f, s1.r, match[2]); if (d2$1 !== undefined) { - return concat_or_join(l, v1, Curry._3(f, v1, d1, Caml_option.valFromOption(d2$1)), r); + return concat_or_join(l, v1, f(v1, d1, Caml_option.valFromOption(d2$1)), r); } else { return join(l, v1, d1, r); } @@ -792,7 +791,7 @@ let $$Map = { let l$1 = union(f, match$1[0], s2.l); let r$1 = union(f, match$1[2], s2.r); if (d1$1 !== undefined) { - return concat_or_join(l$1, v2, Curry._3(f, v2, Caml_option.valFromOption(d1$1), d2), r$1); + return concat_or_join(l$1, v2, f(v2, Caml_option.valFromOption(d1$1), d2), r$1); } else { return join(l$1, v2, d2, r$1); } @@ -806,7 +805,7 @@ let $$Map = { let v = param.v; let l = param.l; let l$p = filter(p, l); - let pvd = Curry._2(p, v, d); + let pvd = p(v, d); let r$p = filter(p, r); if (pvd) { if (l === l$p && r === r$p) { @@ -830,7 +829,7 @@ let $$Map = { let match = partition(p, param.l); let lf = match[1]; let lt = match[0]; - let pvd = Curry._2(p, v, d); + let pvd = p(v, d); let match$1 = partition(p, param.r); let rf = match$1[1]; let rt = match$1[0]; @@ -880,11 +879,11 @@ let $$Map = { if (typeof e2 !== "object") { return 1; } - let c = Curry._2(funarg.compare, e1._0, e2._0); + let c = funarg.compare(e1._0, e2._0); if (c !== 0) { return c; } - let c$1 = Curry._2(cmp, e1._1, e2._1); + let c$1 = cmp(e1._1, e2._1); if (c$1 !== 0) { return c$1; } @@ -909,10 +908,10 @@ let $$Map = { if (typeof e2 !== "object") { return false; } - if (Curry._2(funarg.compare, e1._0, e2._0) !== 0) { + if (funarg.compare(e1._0, e2._0) !== 0) { return false; } - if (!Curry._2(cmp, e1._1, e2._1)) { + if (!cmp(e1._1, e2._1)) { return false; } _e2 = cons_enum(e2._2, e2._3); @@ -1085,7 +1084,7 @@ let $$Set = { let r = param.r; let v = param.v; let l = param.l; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { return param; } @@ -1253,7 +1252,7 @@ let $$Set = { let r = param.r; let v = param.v; let l = param.l; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { return [ l, @@ -1289,7 +1288,7 @@ let $$Set = { if (typeof param !== "object") { return false; } - let c = Curry._2(funarg.compare, x, param.v); + let c = funarg.compare(x, param.v); if (c === 0) { return true; } @@ -1304,7 +1303,7 @@ let $$Set = { let r = param.r; let v = param.v; let l = param.l; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { return merge(l, r); } @@ -1414,7 +1413,7 @@ let $$Set = { if (typeof e2 !== "object") { return 1; } - let c = Curry._2(funarg.compare, e1._0, e2._0); + let c = funarg.compare(e1._0, e2._0); if (c !== 0) { return c; } @@ -1444,7 +1443,7 @@ let $$Set = { } let r2 = s2.r; let l2 = s2.l; - let c = Curry._2(funarg.compare, v1, s2.v); + let c = funarg.compare(v1, s2.v); if (c === 0) { if (!subset(l1, l2)) { return false; @@ -1486,7 +1485,7 @@ let $$Set = { return; } iter(f, param.l); - Curry._1(f, param.v); + f(param.v); _param = param.r; continue; }; @@ -1498,7 +1497,7 @@ let $$Set = { if (typeof s !== "object") { return accu; } - _accu = Curry._2(f, s.v, fold(f, s.l, accu)); + _accu = f(s.v, fold(f, s.l, accu)); _s = s.r; continue; }; @@ -1509,7 +1508,7 @@ let $$Set = { if (typeof param !== "object") { return true; } - if (!Curry._1(p, param.v)) { + if (!p(param.v)) { return false; } if (!for_all(p, param.l)) { @@ -1525,7 +1524,7 @@ let $$Set = { if (typeof param !== "object") { return false; } - if (Curry._1(p, param.v)) { + if (p(param.v)) { return true; } if (exists(p, param.l)) { @@ -1543,7 +1542,7 @@ let $$Set = { let v = param.v; let l = param.l; let l$p = filter(p, l); - let pv = Curry._1(p, v); + let pv = p(v); let r$p = filter(p, r); if (pv) { if (l === l$p && r === r$p) { @@ -1566,7 +1565,7 @@ let $$Set = { let match = partition(p, param.l); let lf = match[1]; let lt = match[0]; - let pv = Curry._1(p, v); + let pv = p(v); let match$1 = partition(p, param.r); let rf = match$1[1]; let rt = match$1[0]; @@ -1618,7 +1617,7 @@ let $$Set = { }); } let v = param.v; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { return v; } @@ -1634,7 +1633,7 @@ let $$Set = { return v0; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.l; _v0 = v; continue; @@ -1654,7 +1653,7 @@ let $$Set = { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_first_aux(v, f, param.l); } _param = param.r; @@ -1669,7 +1668,7 @@ let $$Set = { return Caml_option.some(v0); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.l; _v0 = v; continue; @@ -1685,7 +1684,7 @@ let $$Set = { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_first_opt_aux(v, f, param.l); } _param = param.r; @@ -1700,7 +1699,7 @@ let $$Set = { return v0; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.r; _v0 = v; continue; @@ -1720,7 +1719,7 @@ let $$Set = { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_last_aux(v, f, param.r); } _param = param.l; @@ -1735,7 +1734,7 @@ let $$Set = { return Caml_option.some(v0); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.r; _v0 = v; continue; @@ -1751,7 +1750,7 @@ let $$Set = { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_last_opt_aux(v, f, param.r); } _param = param.l; @@ -1765,7 +1764,7 @@ let $$Set = { return; } let v = param.v; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { return Caml_option.some(v); } @@ -1774,7 +1773,7 @@ let $$Set = { }; }; let try_join = function (l, v, r) { - if ((l === "Empty" || Curry._2(funarg.compare, max_elt(l), v) < 0) && (r === "Empty" || Curry._2(funarg.compare, v, min_elt(r)) < 0)) { + if ((l === "Empty" || funarg.compare(max_elt(l), v) < 0) && (r === "Empty" || funarg.compare(v, min_elt(r)) < 0)) { return join(l, v, r); } else { return union(l, add(v, r)); @@ -1788,7 +1787,7 @@ let $$Set = { let v = param.v; let l = param.l; let l$p = map(f, l); - let v$p = Curry._1(f, v); + let v$p = f(v); let r$p = map(f, r); if (l === l$p && v === v$p && r === r$p) { return param; @@ -1976,4 +1975,4 @@ let $$Set = { exports.Hashtbl = Hashtbl; exports.$$Map = $$Map; exports.$$Set = $$Set; -/* No side effect */ +/* HashtblLabels Not a pure module */ diff --git a/lib/js/parsing.js b/lib/js/parsing.js index 49f2b0b20f..a5da32f420 100644 --- a/lib/js/parsing.js +++ b/lib/js/parsing.js @@ -1,7 +1,6 @@ 'use strict'; let $$Array = require("./array.js"); -let Curry = require("./curry.js"); let Lexing = require("./lexing.js"); let Caml_obj = require("./caml_obj.js"); let Caml_array = require("./caml_array.js"); @@ -32,7 +31,7 @@ let env = { errflag: 0 }; -function grow_stacks(param) { +function grow_stacks() { let oldsize = env.stacksize; let newsize = (oldsize << 1); let new_s = Caml_array.make(newsize, 0); @@ -50,7 +49,7 @@ function grow_stacks(param) { env.stacksize = newsize; } -function clear_parser(param) { +function clear_parser() { $$Array.fill(env.v_stack, 0, env.stacksize, undefined); env.lval = undefined; } @@ -81,7 +80,7 @@ function yyparse(tables, start, lexer, lexbuf) { let match = Caml_parser.parse_engine(tables, env, cmd, arg); switch (match) { case "Read_token" : - let t = Curry._1(lexer, lexbuf); + let t = lexer(lexbuf); env.symb_start = lexbuf.lex_start_p; env.symb_end = lexbuf.lex_curr_p; _arg = t; @@ -108,7 +107,7 @@ function yyparse(tables, start, lexer, lexbuf) { try { match$1 = [ "Semantic_action_computed", - Curry._1(Caml_array.get(tables.actions, env.rule_number), env) + Caml_array.get(tables.actions, env.rule_number)(env) ]; } catch (raw_exn){ @@ -128,7 +127,7 @@ function yyparse(tables, start, lexer, lexbuf) { _cmd = match$1[0]; continue; case "Call_error_function" : - Curry._1(tables.error_function, "syntax error"); + tables.error_function("syntax error"); _arg = undefined; _cmd = "Error_detected"; continue; @@ -166,7 +165,7 @@ function peek_val(env, n) { return Caml_array.get(env.v_stack, env.asp - n | 0); } -function symbol_start_pos(param) { +function symbol_start_pos() { let _i = env.rule_len; while(true) { let i = _i; @@ -183,7 +182,7 @@ function symbol_start_pos(param) { }; } -function symbol_end_pos(param) { +function symbol_end_pos() { return Caml_array.get(env.symb_end_stack, env.asp); } @@ -195,11 +194,11 @@ function rhs_end_pos(n) { return Caml_array.get(env.symb_end_stack, env.asp - (env.rule_len - n | 0) | 0); } -function symbol_start(param) { +function symbol_start() { return symbol_start_pos().pos_cnum; } -function symbol_end(param) { +function symbol_end() { return symbol_end_pos().pos_cnum; } @@ -212,7 +211,7 @@ function rhs_end(n) { } function is_current_lookahead(tok) { - return Curry._1(current_lookahead_fun.contents, tok); + return current_lookahead_fun.contents(tok); } function parse_error(param) { diff --git a/lib/js/pervasives.js b/lib/js/pervasives.js index b63eb38ca5..66a21474ce 100644 --- a/lib/js/pervasives.js +++ b/lib/js/pervasives.js @@ -1,6 +1,5 @@ 'use strict'; -let Curry = require("./curry.js"); let Caml_sys = require("./caml_sys.js"); let Caml_format = require("./caml_format.js"); let Caml_string = require("./caml_string.js"); @@ -179,11 +178,11 @@ function $at(l1, l2) { } } -function print_newline(param) { +function print_newline() { console.log(""); } -function prerr_newline(param) { +function prerr_newline() { console.error(""); } @@ -192,7 +191,7 @@ function print_int(i) { } function print_float(i) { - console.log(valid_float_lexem(Caml_format.format_float("%.12g", i))); + console.log(string_of_float(i)); } function print_string(prim) { @@ -207,14 +206,14 @@ let exit_function = { function at_exit(f) { let g = exit_function.contents; - exit_function.contents = (function (param) { - Curry._1(f, undefined); - Curry._1(g, undefined); + exit_function.contents = (function () { + f(); + g(); }); } function exit(retcode) { - Curry._1(exit_function.contents, undefined); + exit_function.contents(); return Caml_sys.sys_exit(retcode); } diff --git a/lib/js/queue.js b/lib/js/queue.js index dfc4acf8e5..ca975f36f1 100644 --- a/lib/js/queue.js +++ b/lib/js/queue.js @@ -1,11 +1,10 @@ 'use strict'; -let Curry = require("./curry.js"); let Caml_exceptions = require("./caml_exceptions.js"); let Empty = /* @__PURE__ */Caml_exceptions.create("Queue.Empty"); -function create(param) { +function create() { return { length: 0, first: "Nil", @@ -117,7 +116,7 @@ function iter(f, q) { return; } let next = cell.next; - Curry._1(f, cell.content); + f(cell.content); _cell = next; continue; }; @@ -133,7 +132,7 @@ function fold(f, accu, q) { return accu$1; } let next = cell.next; - let accu$2 = Curry._2(f, accu$1, cell.content); + let accu$2 = f(accu$1, cell.content); _cell = next; _accu = accu$2; continue; diff --git a/lib/js/random.js b/lib/js/random.js index d4a9d9002d..68552595f8 100644 --- a/lib/js/random.js +++ b/lib/js/random.js @@ -9,7 +9,7 @@ let Caml_array = require("./caml_array.js"); let Caml_int64 = require("./caml_int64.js"); let Caml_string = require("./caml_string.js"); -function random_seed(param) { +function random_seed() { return [(Math.floor(Math.random()*0x7fffffff))]; } @@ -51,7 +51,7 @@ function make(seed) { return result; } -function make_self_init(param) { +function make_self_init() { return make(random_seed()); } @@ -74,65 +74,65 @@ function bits(s) { } function int(s, bound) { - if (bound > 1073741823 || bound <= 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Random.int" - } - }); + if (!(bound > 1073741823 || bound <= 0)) { + while(true) { + let r = bits(s); + let v = r % bound; + if ((r - v | 0) <= ((1073741823 - bound | 0) + 1 | 0)) { + return v; + } + continue; + }; } - while(true) { - let r = bits(s); - let v = r % bound; - if ((r - v | 0) <= ((1073741823 - bound | 0) + 1 | 0)) { - return v; - } - continue; - }; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Random.int" + } + }); } function int32(s, bound) { - if (bound <= 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Random.int32" - } - }); + if (bound > 0) { + while(true) { + let b1 = bits(s); + let b2 = ((bits(s) & 1) << 30); + let r = b1 | b2; + let v = r % bound; + if ((r - v | 0) <= ((Int32.max_int - bound | 0) + 1 | 0)) { + return v; + } + continue; + }; } - while(true) { - let b1 = bits(s); - let b2 = ((bits(s) & 1) << 30); - let r = b1 | b2; - let v = r % bound; - if ((r - v | 0) <= ((Int32.max_int - bound | 0) + 1 | 0)) { - return v; - } - continue; - }; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Random.int32" + } + }); } function int64(s, bound) { - if (Caml.i64_le(bound, Caml_int64.zero)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Random.int64" - } - }); + if (!Caml.i64_le(bound, Caml_int64.zero)) { + while(true) { + let b1 = Caml_int64.of_int32(bits(s)); + let b2 = Caml_int64.lsl_(Caml_int64.of_int32(bits(s)), 30); + let b3 = Caml_int64.lsl_(Caml_int64.of_int32(bits(s) & 7), 60); + let r = Caml_int64.or_(b1, Caml_int64.or_(b2, b3)); + let v = Caml_int64.mod_(r, bound); + if (!Caml.i64_gt(Caml_int64.sub(r, v), Caml_int64.add(Caml_int64.sub(Int64.max_int, bound), Caml_int64.one))) { + return v; + } + continue; + }; } - while(true) { - let b1 = Caml_int64.of_int32(bits(s)); - let b2 = Caml_int64.lsl_(Caml_int64.of_int32(bits(s)), 30); - let b3 = Caml_int64.lsl_(Caml_int64.of_int32(bits(s) & 7), 60); - let r = Caml_int64.or_(b1, Caml_int64.or_(b2, b3)); - let v = Caml_int64.mod_(r, bound); - if (!Caml.i64_gt(Caml_int64.sub(r, v), Caml_int64.add(Caml_int64.sub(Int64.max_int, bound), Caml_int64.one))) { - return v; - } - continue; - }; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "Random.int64" + } + }); } function rawfloat(s) { @@ -210,7 +210,7 @@ let $$default = { idx: 0 }; -function bits$1(param) { +function bits$1() { return bits($$default); } @@ -227,10 +227,10 @@ function int64$1(bound) { } function float$1(scale) { - return rawfloat($$default) * scale; + return float($$default, scale); } -function bool$1(param) { +function bool$1() { return bool($$default); } @@ -242,11 +242,11 @@ function init(seed) { full_init($$default, [seed]); } -function self_init(param) { +function self_init() { full_init$1(random_seed()); } -function get_state(param) { +function get_state() { return copy($$default); } diff --git a/lib/js/set.js b/lib/js/set.js index c7d617b2e5..de2d6b2629 100644 --- a/lib/js/set.js +++ b/lib/js/set.js @@ -1,7 +1,6 @@ 'use strict'; let List = require("./list.js"); -let Curry = require("./curry.js"); let Caml_option = require("./caml_option.js"); function Make(funarg) { @@ -101,7 +100,7 @@ function Make(funarg) { let r = param.r; let v = param.v; let l = param.l; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { return param; } @@ -260,7 +259,7 @@ function Make(funarg) { let r = param.r; let v = param.v; let l = param.l; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { return [ l, @@ -296,7 +295,7 @@ function Make(funarg) { if (typeof param !== "object") { return false; } - let c = Curry._2(funarg.compare, x, param.v); + let c = funarg.compare(x, param.v); if (c === 0) { return true; } @@ -311,7 +310,7 @@ function Make(funarg) { let r = param.r; let v = param.v; let l = param.l; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { if (typeof l !== "object") { return r; @@ -429,7 +428,7 @@ function Make(funarg) { if (typeof e2 !== "object") { return 1; } - let c = Curry._2(funarg.compare, e1._0, e2._0); + let c = funarg.compare(e1._0, e2._0); if (c !== 0) { return c; } @@ -456,7 +455,7 @@ function Make(funarg) { } let r2 = s2.r; let l2 = s2.l; - let c = Curry._2(funarg.compare, v1, s2.v); + let c = funarg.compare(v1, s2.v); if (c === 0) { if (!subset(l1, l2)) { return false; @@ -498,7 +497,7 @@ function Make(funarg) { return; } iter(f, param.l); - Curry._1(f, param.v); + f(param.v); _param = param.r; continue; }; @@ -510,7 +509,7 @@ function Make(funarg) { if (typeof s !== "object") { return accu; } - _accu = Curry._2(f, s.v, fold(f, s.l, accu)); + _accu = f(s.v, fold(f, s.l, accu)); _s = s.r; continue; }; @@ -521,7 +520,7 @@ function Make(funarg) { if (typeof param !== "object") { return true; } - if (!Curry._1(p, param.v)) { + if (!p(param.v)) { return false; } if (!for_all(p, param.l)) { @@ -537,7 +536,7 @@ function Make(funarg) { if (typeof param !== "object") { return false; } - if (Curry._1(p, param.v)) { + if (p(param.v)) { return true; } if (exists(p, param.l)) { @@ -555,7 +554,7 @@ function Make(funarg) { let v = param.v; let l = param.l; let l$p = filter(p, l); - let pv = Curry._1(p, v); + let pv = p(v); let r$p = filter(p, r); if (pv) { if (l === l$p && r === r$p) { @@ -578,7 +577,7 @@ function Make(funarg) { let match = partition(p, param.l); let lf = match[1]; let lt = match[0]; - let pv = Curry._1(p, v); + let pv = p(v); let match$1 = partition(p, param.r); let rf = match$1[1]; let rt = match$1[0]; @@ -630,7 +629,7 @@ function Make(funarg) { }); } let v = param.v; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { return v; } @@ -649,7 +648,7 @@ function Make(funarg) { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _param$1 = param.l; while(true) { @@ -659,7 +658,7 @@ function Make(funarg) { return v0; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.l; _v0 = v$1; continue; @@ -679,7 +678,7 @@ function Make(funarg) { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _param$1 = param.l; while(true) { @@ -689,7 +688,7 @@ function Make(funarg) { return Caml_option.some(v0); } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.l; _v0 = v$1; continue; @@ -713,7 +712,7 @@ function Make(funarg) { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _param$1 = param.r; while(true) { @@ -723,7 +722,7 @@ function Make(funarg) { return v0; } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.r; _v0 = v$1; continue; @@ -743,7 +742,7 @@ function Make(funarg) { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { let _v0 = v; let _param$1 = param.r; while(true) { @@ -753,7 +752,7 @@ function Make(funarg) { return Caml_option.some(v0); } let v$1 = param$1.v; - if (Curry._1(f, v$1)) { + if (f(v$1)) { _param$1 = param$1.r; _v0 = v$1; continue; @@ -773,7 +772,7 @@ function Make(funarg) { return; } let v = param.v; - let c = Curry._2(funarg.compare, x, v); + let c = funarg.compare(x, v); if (c === 0) { return Caml_option.some(v); } @@ -789,11 +788,11 @@ function Make(funarg) { let v = param.v; let l = param.l; let l$p = map(f, l); - let v$p = Curry._1(f, v); + let v$p = f(v); let r$p = map(f, r); if (l === l$p && v === v$p && r === r$p) { return param; - } else if ((l$p === "Empty" || Curry._2(funarg.compare, max_elt(l$p), v$p) < 0) && (r$p === "Empty" || Curry._2(funarg.compare, v$p, min_elt(r$p)) < 0)) { + } else if ((l$p === "Empty" || funarg.compare(max_elt(l$p), v$p) < 0) && (r$p === "Empty" || funarg.compare(v$p, min_elt(r$p)) < 0)) { return join(l$p, v$p, r$p); } else { return union(l$p, add(v$p, r$p)); diff --git a/lib/js/setLabels.js b/lib/js/setLabels.js index aa0a8f097b..9cbf5ee04b 100644 --- a/lib/js/setLabels.js +++ b/lib/js/setLabels.js @@ -1,7 +1,6 @@ 'use strict'; let List = require("./list.js"); -let Curry = require("./curry.js"); let Caml_option = require("./caml_option.js"); function Make(Ord) { @@ -101,7 +100,7 @@ function Make(Ord) { let r = param.r; let v = param.v; let l = param.l; - let c = Curry._2(Ord.compare, x, v); + let c = Ord.compare(x, v); if (c === 0) { return param; } @@ -269,7 +268,7 @@ function Make(Ord) { let r = param.r; let v = param.v; let l = param.l; - let c = Curry._2(Ord.compare, x, v); + let c = Ord.compare(x, v); if (c === 0) { return [ l, @@ -305,7 +304,7 @@ function Make(Ord) { if (typeof param !== "object") { return false; } - let c = Curry._2(Ord.compare, x, param.v); + let c = Ord.compare(x, param.v); if (c === 0) { return true; } @@ -320,7 +319,7 @@ function Make(Ord) { let r = param.r; let v = param.v; let l = param.l; - let c = Curry._2(Ord.compare, x, v); + let c = Ord.compare(x, v); if (c === 0) { return merge(l, r); } @@ -430,7 +429,7 @@ function Make(Ord) { if (typeof e2 !== "object") { return 1; } - let c = Curry._2(Ord.compare, e1._0, e2._0); + let c = Ord.compare(e1._0, e2._0); if (c !== 0) { return c; } @@ -460,7 +459,7 @@ function Make(Ord) { } let r2 = s2.r; let l2 = s2.l; - let c = Curry._2(Ord.compare, v1, s2.v); + let c = Ord.compare(v1, s2.v); if (c === 0) { if (!subset(l1, l2)) { return false; @@ -502,7 +501,7 @@ function Make(Ord) { return; } iter(f, param.l); - Curry._1(f, param.v); + f(param.v); _param = param.r; continue; }; @@ -514,7 +513,7 @@ function Make(Ord) { if (typeof s !== "object") { return accu; } - _accu = Curry._2(f, s.v, fold(f, s.l, accu)); + _accu = f(s.v, fold(f, s.l, accu)); _s = s.r; continue; }; @@ -525,7 +524,7 @@ function Make(Ord) { if (typeof param !== "object") { return true; } - if (!Curry._1(p, param.v)) { + if (!p(param.v)) { return false; } if (!for_all(p, param.l)) { @@ -541,7 +540,7 @@ function Make(Ord) { if (typeof param !== "object") { return false; } - if (Curry._1(p, param.v)) { + if (p(param.v)) { return true; } if (exists(p, param.l)) { @@ -559,7 +558,7 @@ function Make(Ord) { let v = param.v; let l = param.l; let l$p = filter(p, l); - let pv = Curry._1(p, v); + let pv = p(v); let r$p = filter(p, r); if (pv) { if (l === l$p && r === r$p) { @@ -582,7 +581,7 @@ function Make(Ord) { let match = partition(p, param.l); let lf = match[1]; let lt = match[0]; - let pv = Curry._1(p, v); + let pv = p(v); let match$1 = partition(p, param.r); let rf = match$1[1]; let rt = match$1[0]; @@ -634,7 +633,7 @@ function Make(Ord) { }); } let v = param.v; - let c = Curry._2(Ord.compare, x, v); + let c = Ord.compare(x, v); if (c === 0) { return v; } @@ -650,7 +649,7 @@ function Make(Ord) { return v0; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.l; _v0 = v; continue; @@ -670,7 +669,7 @@ function Make(Ord) { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_first_aux(v, f, param.l); } _param = param.r; @@ -685,7 +684,7 @@ function Make(Ord) { return Caml_option.some(v0); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.l; _v0 = v; continue; @@ -701,7 +700,7 @@ function Make(Ord) { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_first_opt_aux(v, f, param.l); } _param = param.r; @@ -716,7 +715,7 @@ function Make(Ord) { return v0; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.r; _v0 = v; continue; @@ -736,7 +735,7 @@ function Make(Ord) { }); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_last_aux(v, f, param.r); } _param = param.l; @@ -751,7 +750,7 @@ function Make(Ord) { return Caml_option.some(v0); } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.r; _v0 = v; continue; @@ -767,7 +766,7 @@ function Make(Ord) { return; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { return find_last_opt_aux(v, f, param.r); } _param = param.l; @@ -781,7 +780,7 @@ function Make(Ord) { return; } let v = param.v; - let c = Curry._2(Ord.compare, x, v); + let c = Ord.compare(x, v); if (c === 0) { return Caml_option.some(v); } @@ -790,7 +789,7 @@ function Make(Ord) { }; }; let try_join = function (l, v, r) { - if ((l === "Empty" || Curry._2(Ord.compare, max_elt(l), v) < 0) && (r === "Empty" || Curry._2(Ord.compare, v, min_elt(r)) < 0)) { + if ((l === "Empty" || Ord.compare(max_elt(l), v) < 0) && (r === "Empty" || Ord.compare(v, min_elt(r)) < 0)) { return join(l, v, r); } else { return union(l, add(v, r)); @@ -804,7 +803,7 @@ function Make(Ord) { let v = param.v; let l = param.l; let l$p = map(f, l); - let v$p = Curry._1(f, v); + let v$p = f(v); let r$p = map(f, r); if (l === l$p && v === v$p && r === r$p) { return param; diff --git a/lib/js/sort.js b/lib/js/sort.js index fe40df1d29..b67fc300e9 100644 --- a/lib/js/sort.js +++ b/lib/js/sort.js @@ -1,6 +1,5 @@ 'use strict'; -let Curry = require("./curry.js"); function merge(order, l1, l2) { if (!l1) { @@ -11,7 +10,7 @@ function merge(order, l1, l2) { } let h2 = l2.hd; let h1 = l1.hd; - if (Curry._2(order, h1, h2)) { + if (order(h1, h2)) { return { hd: h1, tl: merge(order, l1.tl, l2) @@ -42,7 +41,7 @@ function list(order, l) { } let e2 = match.hd; return { - hd: Curry._2(order, e, e2) ? ({ + hd: order(e, e2) ? ({ hd: e, tl: { hd: e2, @@ -101,12 +100,12 @@ function array(cmp, arr) { return; } let mid = ((lo + hi | 0) >>> 1); - if (Curry._2(cmp, arr[mid], arr[lo])) { + if (cmp(arr[mid], arr[lo])) { swap(arr, mid, lo); } - if (Curry._2(cmp, arr[hi], arr[mid])) { + if (cmp(arr[hi], arr[mid])) { swap(arr, mid, hi); - if (Curry._2(cmp, arr[mid], arr[lo])) { + if (cmp(arr[mid], arr[lo])) { swap(arr, mid, lo); } @@ -114,7 +113,7 @@ function array(cmp, arr) { let pivot = arr[mid]; let i = lo + 1 | 0; let j = hi - 1 | 0; - if (!Curry._2(cmp, pivot, arr[hi]) || !Curry._2(cmp, arr[lo], pivot)) { + if (!cmp(pivot, arr[hi]) || !cmp(arr[lo], pivot)) { throw new Error("Invalid_argument", { cause: { RE_EXN_ID: "Invalid_argument", @@ -123,10 +122,10 @@ function array(cmp, arr) { }); } while(i < j) { - while(!Curry._2(cmp, pivot, arr[i])) { + while(!cmp(pivot, arr[i])) { i = i + 1 | 0; }; - while(!Curry._2(cmp, arr[j], pivot)) { + while(!cmp(arr[j], pivot)) { j = j - 1 | 0; }; if (i < j) { @@ -148,10 +147,10 @@ function array(cmp, arr) { qsort(0, arr.length - 1 | 0); for(let i = 1 ,i_finish = arr.length; i < i_finish; ++i){ let val_i = arr[i]; - if (!Curry._2(cmp, arr[i - 1 | 0], val_i)) { + if (!cmp(arr[i - 1 | 0], val_i)) { arr[i] = arr[i - 1 | 0]; let j = i - 1 | 0; - while(j >= 1 && !Curry._2(cmp, arr[j - 1 | 0], val_i)) { + while(j >= 1 && !cmp(arr[j - 1 | 0], val_i)) { arr[j] = arr[j - 1 | 0]; j = j - 1 | 0; }; diff --git a/lib/js/stack.js b/lib/js/stack.js index efff0038d5..f46a7c700a 100644 --- a/lib/js/stack.js +++ b/lib/js/stack.js @@ -5,7 +5,7 @@ let Caml_exceptions = require("./caml_exceptions.js"); let Empty = /* @__PURE__ */Caml_exceptions.create("Stack.Empty"); -function create(param) { +function create() { return { c: /* [] */0, len: 0 diff --git a/lib/js/stream.js b/lib/js/stream.js index 5c67f92987..8912267e9e 100644 --- a/lib/js/stream.js +++ b/lib/js/stream.js @@ -1,7 +1,7 @@ 'use strict'; +let Lazy = require("./lazy.js"); let List = require("./list.js"); -let Curry = require("./curry.js"); let Caml_bytes = require("./caml_bytes.js"); let Caml_option = require("./caml_option.js"); let Caml_string = require("./caml_string.js"); @@ -84,7 +84,7 @@ function get_data(count, _d) { return "Sempty"; } } - let a$1 = Curry._1(g.func, count); + let a$1 = g.func(count); if (a$1 !== undefined) { return { TAG: "Scons", @@ -137,7 +137,7 @@ function peek_data(s) { if (a !== undefined) { return Caml_option.valFromOption(a); } - let x = Curry._1(g.func, s.count); + let x = g.func(s.count); g.curr = Caml_option.some(x); return x; @@ -259,17 +259,19 @@ function empty(s) { } function iter(f, strm) { - let _param; - while(true) { - let a = peek(strm); - if (a === undefined) { - return; - } - junk(strm); - Curry._1(f, Caml_option.valFromOption(a)); - _param = undefined; - continue; + let do_rec = function () { + while(true) { + let a = peek(strm); + if (a === undefined) { + return; + } + junk(strm); + f(Caml_option.valFromOption(a)); + _param = undefined; + continue; + }; }; + do_rec(); } function from(f) { @@ -364,10 +366,10 @@ function lapp(f, s) { count: 0, data: { TAG: "Slazy", - _0: CamlinternalLazy.from_fun(function () { + _0: Lazy.from_fun(function () { return { TAG: "Sapp", - _0: data(Curry._1(f, undefined)), + _0: data(f()), _1: data(s) }; }) @@ -380,10 +382,10 @@ function lcons(f, s) { count: 0, data: { TAG: "Slazy", - _0: CamlinternalLazy.from_fun(function () { + _0: Lazy.from_fun(function () { return { TAG: "Scons", - _0: Curry._1(f, undefined), + _0: f(), _1: data(s) }; }) @@ -396,10 +398,10 @@ function lsing(f) { count: 0, data: { TAG: "Slazy", - _0: CamlinternalLazy.from_fun(function () { + _0: Lazy.from_fun(function () { return { TAG: "Scons", - _0: Curry._1(f, undefined), + _0: f(), _1: "Sempty" }; }) @@ -412,8 +414,8 @@ function slazy(f) { count: 0, data: { TAG: "Slazy", - _0: CamlinternalLazy.from_fun(function () { - return data(Curry._1(f, undefined)); + _0: Lazy.from_fun(function () { + return data(f()); }) } }; @@ -427,7 +429,7 @@ function dump_data(f, param) { switch (param.TAG) { case "Scons" : console.log("Scons ("); - Curry._1(f, param._0); + f(param._0); console.log(", "); dump_data(f, param._1); console.log(")"); diff --git a/lib/js/string.js b/lib/js/string.js index aa7d5dc456..75ba5054f7 100644 --- a/lib/js/string.js +++ b/lib/js/string.js @@ -3,7 +3,6 @@ let Caml = require("./caml.js"); let $$Array = require("./array.js"); let Bytes = require("./bytes.js"); -let Curry = require("./curry.js"); let Caml_string = require("./caml_string.js"); let Caml_js_exceptions = require("./caml_js_exceptions.js"); @@ -21,13 +20,13 @@ function concat(sep, xs) { function iter(f, s) { for(let i = 0 ,i_finish = s.length; i < i_finish; ++i){ - Curry._1(f, s.codePointAt(i)); + f(s.codePointAt(i)); } } function iteri(f, s) { for(let i = 0 ,i_finish = s.length; i < i_finish; ++i){ - Curry._2(f, i, s.codePointAt(i)); + f(i, s.codePointAt(i)); } } @@ -129,28 +128,28 @@ function index_opt(s, c) { function index_from(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from / Bytes.index_from" - } - }); + if (!(i < 0 || i > l)) { + return index_rec(s, l, i, c); } - return index_rec(s, l, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from" + } + }); } function index_from_opt(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from_opt / Bytes.index_from_opt" - } - }); + if (!(i < 0 || i > l)) { + return index_rec_opt(s, l, i, c); } - return index_rec_opt(s, l, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt" + } + }); } function rindex_rec(s, _i, c) { @@ -176,15 +175,15 @@ function rindex(s, c) { } function rindex_from(s, i, c) { - if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from / Bytes.rindex_from" - } - }); + if (!(i < -1 || i >= s.length)) { + return rindex_rec(s, i, c); } - return rindex_rec(s, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from" + } + }); } function rindex_rec_opt(s, _i, c) { @@ -206,15 +205,15 @@ function rindex_opt(s, c) { } function rindex_from_opt(s, i, c) { - if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from_opt / Bytes.rindex_from_opt" - } - }); + if (!(i < -1 || i >= s.length)) { + return rindex_rec_opt(s, i, c); } - return rindex_rec_opt(s, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt" + } + }); } function contains_from(s, i, c) { diff --git a/lib/js/stringLabels.js b/lib/js/stringLabels.js index d1b13c3144..af81310fe7 100644 --- a/lib/js/stringLabels.js +++ b/lib/js/stringLabels.js @@ -3,7 +3,6 @@ let Caml = require("./caml.js"); let $$Array = require("./array.js"); let Bytes = require("./bytes.js"); -let Curry = require("./curry.js"); let Caml_string = require("./caml_string.js"); let Caml_js_exceptions = require("./caml_js_exceptions.js"); @@ -15,7 +14,9 @@ function sub(s, ofs, len) { return Bytes.unsafe_to_string(Bytes.sub(Bytes.unsafe_of_string(s), ofs, len)); } -let blit = Bytes.blit_string; +function blit(src, src_pos, dst, dst_pos, len) { + Bytes.blit_string(src, src_pos, dst, dst_pos, len); +} function concat(sep, xs) { return $$Array.of_list(xs).join(sep); @@ -23,13 +24,13 @@ function concat(sep, xs) { function iter(f, s) { for(let i = 0 ,i_finish = s.length; i < i_finish; ++i){ - Curry._1(f, s.codePointAt(i)); + f(s.codePointAt(i)); } } function iteri(f, s) { for(let i = 0 ,i_finish = s.length; i < i_finish; ++i){ - Curry._2(f, i, s.codePointAt(i)); + f(i, s.codePointAt(i)); } } @@ -131,28 +132,28 @@ function index_opt(s, c) { function index_from(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from / Bytes.index_from" - } - }); + if (!(i < 0 || i > l)) { + return index_rec(s, l, i, c); } - return index_rec(s, l, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from" + } + }); } function index_from_opt(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from_opt / Bytes.index_from_opt" - } - }); + if (!(i < 0 || i > l)) { + return index_rec_opt(s, l, i, c); } - return index_rec_opt(s, l, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt" + } + }); } function rindex_rec(s, _i, c) { @@ -178,15 +179,15 @@ function rindex(s, c) { } function rindex_from(s, i, c) { - if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from / Bytes.rindex_from" - } - }); + if (!(i < -1 || i >= s.length)) { + return rindex_rec(s, i, c); } - return rindex_rec(s, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from" + } + }); } function rindex_rec_opt(s, _i, c) { @@ -208,15 +209,15 @@ function rindex_opt(s, c) { } function rindex_from_opt(s, i, c) { - if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from_opt / Bytes.rindex_from_opt" - } - }); + if (!(i < -1 || i >= s.length)) { + return rindex_rec_opt(s, i, c); } - return rindex_rec_opt(s, i, c); + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt" + } + }); } function contains_from(s, i, c) { diff --git a/lib/js/sys.js b/lib/js/sys.js index 38e33bb84a..8239622f87 100644 --- a/lib/js/sys.js +++ b/lib/js/sys.js @@ -45,14 +45,27 @@ function set_signal(sig_num, sig_beh) { let Break = /* @__PURE__ */Caml_exceptions.create("Sys.Break"); function catch_break(on) { - + if (on) { + return set_signal(-6, { + TAG: "Signal_handle", + _0: (function (param) { + throw new Error(Break, { + cause: { + RE_EXN_ID: Break + } + }); + }) + }); + } else { + return set_signal(-6, "Signal_default"); + } } function enable_runtime_warnings(param) { } -function runtime_warnings_enabled(param) { +function runtime_warnings_enabled() { return false; } diff --git a/lib/js/uchar.js b/lib/js/uchar.js index 87523c8fb6..27e3a6e7ac 100644 --- a/lib/js/uchar.js +++ b/lib/js/uchar.js @@ -15,30 +15,30 @@ function succ(u) { if (u === 55295) { return 57344; } - if (u === 1114111) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "U+10FFFF has no successor" - } - }); + if (u !== 1114111) { + return u + 1 | 0; } - return u + 1 | 0; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "U+10FFFF has no successor" + } + }); } function pred(u) { if (u === 57344) { return 55295; } - if (u === 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "U+0000 has no predecessor" - } - }); + if (u !== 0) { + return u - 1 | 0; } - return u - 1 | 0; + throw new Error("Invalid_argument", { + cause: { + RE_EXN_ID: "Invalid_argument", + _1: "U+0000 has no predecessor" + } + }); } function is_valid(i) { From 217500476c1e416c08cc5525b745b4537b22c60d Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Sun, 14 Jul 2024 08:41:19 +0200 Subject: [PATCH 7/8] Remove temporary `-curried` option. --- jscomp/bsc/rescript_compiler_main.ml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/jscomp/bsc/rescript_compiler_main.ml b/jscomp/bsc/rescript_compiler_main.ml index 1200b22f9c..e0da2d6364 100644 --- a/jscomp/bsc/rescript_compiler_main.ml +++ b/jscomp/bsc/rescript_compiler_main.ml @@ -34,8 +34,6 @@ let setup_runtime_path path = Bs_version.package_name := std); Js_config.customize_runtime := Some path -let curry_specified = ref false - let process_file sourcefile ?(kind ) ppf = (* This is a better default then "", it will be changed later @@ -48,11 +46,6 @@ let process_file sourcefile ?(kind ) ppf = match kind with | None -> Ext_file_extensions.classify_input (Ext_filename.get_extension_maybe sourcefile) | Some kind -> kind in - (if !curry_specified = false && !Clflags.dump_source = false && !Js_config.syntax_only = false && List.mem kind [Res; Resi] then - let _ = Printf.eprintf "XXX curry not specified %s\n%!" sourcefile in - let _ = assert false in - () - ); let res = match kind with | Res -> let sourcefile = set_abs_input_name sourcefile in @@ -413,10 +406,8 @@ let buckle_script_flags : (string * Bsc_args.spec * string) array = "-nopervasives", set Clflags.nopervasives, "*internal*"; - "-uncurried", unit_call (fun () -> curry_specified := true; Config.uncurried := Uncurried), - "*internal*"; - "-curried", unit_call (fun () -> curry_specified := true; Config.uncurried := Legacy), - "*internal*"; + "-uncurried", unit_call (fun () -> Config.uncurried := Uncurried), + "*internal* Set jsx module"; "-v", unit_call print_version_string, "Print compiler version and location of standard library and exit"; From 49ac039f35ea302406af38a06f93f8248c8923ec Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Sun, 14 Jul 2024 08:44:59 +0200 Subject: [PATCH 8/8] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e76730088..14300453a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,6 +65,7 @@ - Ignore `@uncurry` attribute in uncurried mode, to avoid generating calls to `Curry` at runtime. https://github.com/rescript-lang/rescript-compiler/pull/6869 - Avoid generating calls to Curry when adjusting arity of uncurried functions. https://github.com/rescript-lang/rescript-compiler/pull/6870 - Remove `@@uncurried.swap`, which was used for internal tests. https://github.com/rescript-lang/rescript-compiler/pull/6875 +- Build the compiler libraries/tests in uncurried mode. https://github.com/rescript-lang/rescript-compiler/pull/6864 #### :nail_care: Polish