diff --git a/jscomp/build_tests/uncurried_printer/src/a.res b/jscomp/build_tests/uncurried_printer/src/a.res index 568bcab521..4701a99410 100644 --- a/jscomp/build_tests/uncurried_printer/src/a.res +++ b/jscomp/build_tests/uncurried_printer/src/a.res @@ -1 +1 @@ -let a = (. b) => b +let a = b => b diff --git a/jscomp/core/res_compmisc.ml b/jscomp/core/res_compmisc.ml index 1c7f3974e3..b36e171b02 100644 --- a/jscomp/core/res_compmisc.ml +++ b/jscomp/core/res_compmisc.ml @@ -51,7 +51,7 @@ let initial_env ?(modulename) () = let initial = Env.initial_safe_string in let env = if !Clflags.nopervasives then initial - else open_implicit_module (if !Config.uncurried = Uncurried then "PervasivesU" else "Pervasives") initial + else open_implicit_module ("Pervasives") initial in List.fold_left (fun env m -> open_implicit_module m env) diff --git a/jscomp/ext/config.ml b/jscomp/ext/config.ml index 35040eaa5a..934b5a9166 100644 --- a/jscomp/ext/config.ml +++ b/jscomp/ext/config.ml @@ -14,7 +14,7 @@ let bs_only = ref true let unsafe_empty_array = ref false type uncurried = Legacy | Uncurried | Swap -let uncurried = ref Legacy +let uncurried = ref Uncurried and cmi_magic_number = "Caml1999I022" diff --git a/jscomp/ml/printtyp.ml b/jscomp/ml/printtyp.ml index 38fe28a7e4..9546365e09 100644 --- a/jscomp/ml/printtyp.ml +++ b/jscomp/ml/printtyp.ml @@ -51,11 +51,10 @@ let ident ppf id = pp_print_string ppf (ident_name id) (* Print a path *) let ident_pervasives = Ident.create_persistent "Pervasives" -let ident_pervasives_u = Ident.create_persistent "PervasivesU" let printing_env = ref Env.empty let non_shadowed_pervasive = function | Pdot(Pident id, s, _pos) as path -> - (Ident.same id ident_pervasives || Ident.same id ident_pervasives_u) && + (Ident.same id ident_pervasives) && (try Path.same path (Env.lookup_type (Lident s) !printing_env) with Not_found -> true) | _ -> false diff --git a/jscomp/others/js.ml b/jscomp/others/js.ml deleted file mode 100644 index 081a4a2037..0000000000 --- a/jscomp/others/js.ml +++ /dev/null @@ -1,290 +0,0 @@ -(* Copyright (C) 2015-2016 Bloomberg Finance L.P. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * In addition to the permissions granted to you by the LGPL, you may combine - * or link a "work that uses the Library" with a publicly distributed version - * of this file to produce a combined library or application, then distribute - * that combined work under the terms of your choosing, with no requirement - * to comply with the obligations normally placed on you by section 4 of the - * LGPL version 3 (or the corresponding section of a later version of the LGPL - * should you choose to use a later version). - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) - -[@@@config {flags = [|"-unboxed-types"; "-w"; "-49"|]}] -(* DESIGN: - - It does not have any code, all its code will be inlined so that - there will never be - {[ require('js')]} - - Its interface should be minimal -*) - -(** -The Js module mostly contains ReScript bindings to _standard JavaScript APIs_ -like [console.log](https://developer.mozilla.org/en-US/docs/Web/API/Console/log), -or the JavaScript -[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String), -[Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date), and -[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) -classes. - -It is meant as a zero-abstraction interop layer and directly exposes JavaScript functions as they are. If you can find your API in this module, prefer this over an equivalent Belt helper. For example, prefer [Js.Array2](js/array2) over [Belt.Array](belt/array) - -## Argument Order - -For historical reasons, some APIs in the Js namespace (e.g. [Js.String](js/string)) are -using the data-last argument order whereas others (e.g. [Js.Date](js/date)) are using data-first. - -For more information about these argument orders and the trade-offs between them, see -[this blog post](https://www.javierchavarri.com/data-first-and-data-last-a-comparison/). - -_Eventually, all modules in the Js namespace are going to be migrated to data-first though._ - -In the meantime, there are several options for dealing with the data-last APIs: - -## Examples - -```rescript -/* Js.String (data-last API used with pipe last operator) */ -Js.log("2019-11-10" |> Js.String.split("-")) -Js.log("ReScript" |> Js.String.startsWith("Re")) - -/* Js.String (data-last API used with pipe first operator) */ -Js.log("2019-11-10"->Js.String.split("-", _)) -Js.log("ReScript"->Js.String.startsWith("Re", _)) - -/* Js.String (data-last API used without any piping) */ -Js.log(Js.String.split("-", "2019-11-10")) -Js.log(Js.String.startsWith("Re", "ReScript")) -``` -## Js.Xxx2 Modules - -Prefer `Js.Array2` over `Js.Array`, `Js.String2` over `Js.String`, etc. The latters are old modules. -*) - -type 'a t = < .. > as 'a -(** JS object type *) - -module MapperRt = Js_mapperRt - -module Internal = struct - external opaqueFullApply : 'a -> 'a = "%uncurried_apply" - - (* Use opaque instead of [._n] to prevent some optimizations happening *) - external run : ((unit -> 'a)[@bs]) -> 'a = "#run" - external opaque : 'a -> 'a = "%opaque" -end - -(**/**) - -(** - Nullable value of this type can be either null or 'a. This type is equivalent to Js.Null.t. -*) -type +'a null = Value of 'a | Null [@as null] [@@unboxed] - -type +'a undefined -(** - A value of this type can be either undefined or 'a. This type is equivalent to Js.Undefined.t. -*) - -type +'a nullable = Value of 'a | Null [@as null] | Undefined [@as undefined] -[@@unboxed] - -(** - A value of this type can be undefined, null or 'a. This type is equivalent to Js.Null_undefined.t. -*) - -type +'a null_undefined = 'a nullable - -external toOption : 'a nullable -> 'a option = "#nullable_to_opt" -external undefinedToOption : 'a undefined -> 'a option = "#undefined_to_opt" -external nullToOption : 'a null -> 'a option = "#null_to_opt" -external isNullable : 'a nullable -> bool = "#is_nullable" -external import : 'a -> 'a promise = "#import" - -external testAny : 'a -> bool = "#is_nullable" -(** The same as {!test} except that it is more permissive on the types of input *) - -type (+'a, +'e) promise -(** - The promise type, defined here for interoperation across packages. -*) - -external null : 'a null = "#null" -(** - The same as empty in `Js.Null`. Compiles to `null`. -*) - -external undefined : 'a undefined = "#undefined" -(** - The same as empty `Js.Undefined`. Compiles to `undefined`. -*) - -external typeof : 'a -> string = "#typeof" -(** -`typeof x` will be compiled as `typeof x` in JS. Please consider functions in -`Js.Types` for a type safe way of reflection. -*) - -external log : 'a -> unit = "log" -[@@val] [@@scope "console"] -(** Equivalent to console.log any value. *) - -external log2 : 'a -> 'b -> unit = "log" [@@val] [@@scope "console"] -external log3 : 'a -> 'b -> 'c -> unit = "log" [@@val] [@@scope "console"] - -external log4 : 'a -> 'b -> 'c -> 'd -> unit = "log" [@@val] [@@scope "console"] - -external logMany : 'a array -> unit = "log" -[@@val] [@@scope "console"] [@@variadic] -(** A convenience function to console.log more than 4 arguments *) - -external eqNull : 'a -> 'a null -> bool = "%bs_equal_null" -external eqUndefined : 'a -> 'a undefined -> bool = "%bs_equal_undefined" -external eqNullable : 'a -> 'a nullable -> bool = "%bs_equal_nullable" - -(** ## Operators *) - -external unsafe_lt : 'a -> 'a -> bool = "#unsafe_lt" -(** - `unsafe_lt(a, b)` will be compiled as `a < b`. - It is marked as unsafe, since it is impossible - to give a proper semantics for comparision which applies to any type -*) - -external unsafe_le : 'a -> 'a -> bool = "#unsafe_le" -(** - `unsafe_le(a, b)` will be compiled as `a <= b`. - See also `Js.unsafe_lt`. -*) - -external unsafe_gt : 'a -> 'a -> bool = "#unsafe_gt" -(** - `unsafe_gt(a, b)` will be compiled as `a > b`. - See also `Js.unsafe_lt`. -*) - -external unsafe_ge : 'a -> 'a -> bool = "#unsafe_ge" -(** - `unsafe_ge(a, b)` will be compiled as `a >= b`. - See also `Js.unsafe_lt`. -*) - -(** ## Nested Modules *) - -module Null = Js_null -(** Provide utilities for `Js.null<'a>` *) - -module Undefined = Js_undefined -(** Provide utilities for `Js.undefined<'a>` *) - -module Nullable = Js_null_undefined -(** Provide utilities for `Js.null_undefined` *) - -module Null_undefined = - Js_null_undefined - [@deprecated "Please use `Js.Nullable`"] - -module Exn = Js_exn -(** Provide utilities for dealing with Js exceptions *) - -module Array = Js_array -(** Provide bindings to JS array*) - -module Array2 = Js_array2 -(** Provide bindings to JS array*) - -module String = Js_string -(** Provide bindings to JS string *) - -module String2 = Js_string2 -(** Provide bindings to JS string *) - -module Re = Js_re -(** Provide bindings to JS regex expression *) - -module Promise = Js_promise -(** Provide bindings to JS Promise *) - -module Promise2 = Js_promise2 -(** Provide bindings to JS Promise *) - -module Date = Js_date -(** Provide bindings for JS Date *) - -module Dict = Js_dict -(** Provide utilities for JS dictionary object *) - -module Global = Js_global -(** Provide bindings to JS global functions in global namespace*) - -module Json = Js_json -(** Provide utilities for json *) - -module Math = Js_math -(** Provide bindings for JS `Math` object *) - -module Obj = Js_obj -(** Provide utilities for `Js.t` *) - -module Typed_array = Js_typed_array -(** Provide bindings for JS typed array *) - -module TypedArray2 = Js_typed_array2 -(** Provide bindings for JS typed array *) - -module Types = Js_types -(** Provide utilities for manipulating JS types *) - -module Float = Js_float -(** Provide utilities for JS float *) - -module Int = Js_int -(** Provide utilities for int *) - -module BigInt = Js_bigint -(** Provide utilities for bigint *) - -module File = Js_file -(** Provide utilities for File *) - -module Blob = Js_blob -(** Provide utilities for Blob *) - -module Option = Js_option -(** Provide utilities for option *) - -module Result = Js_result -(** Define the interface for result *) - -module List = Js_list -(** Provide utilities for list *) - -module Vector = Js_vector -(** Provides bindings for JS Vector *) - -module Console = Js_console -(** Provides bindings for console *) - -module Set = Js_set -(** Provides bindings for ES6 Set *) - -module WeakSet = Js_weakset -(** Provides bindings for ES6 WeakSet *) - -module Map = Js_map -(** Provides bindings for ES6 Map *) - -module WeakMap = Js_weakmap -(** Provides bindings for ES6 WeakMap *) diff --git a/jscomp/others/js.res b/jscomp/others/js.res new file mode 100644 index 0000000000..406c3937c7 --- /dev/null +++ b/jscomp/others/js.res @@ -0,0 +1,219 @@ +/* Copyright (C) 2015-2016 Bloomberg Finance L.P. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * In addition to the permissions granted to you by the LGPL, you may combine + * or link a "work that uses the Library" with a publicly distributed version + * of this file to produce a combined library or application, then distribute + * that combined work under the terms of your choosing, with no requirement + * to comply with the obligations normally placed on you by section 4 of the + * LGPL version 3 (or the corresponding section of a later version of the LGPL + * should you choose to use a later version). + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +@@config({flags: ["-unboxed-types", "-w", "-49"]}) + +/* DESIGN: + - It does not have any code, all its code will be inlined so that + there will never be + {[ require('js')]} + - Its interface should be minimal +*/ + +/** + This library provides bindings and necessary support for JS FFI. + It contains all bindings into [Js] namespace. + + @example {[ + [| 1;2;3;4|] + |. Js.Array2.map (fun x -> x + 1 ) + |. Js.Array2.reduce (+) 0 + |. Js.log + ]} +*/ + +type t<'a> = {..} as 'a +/** Types for JS objects */ + +module MapperRt = Js_mapperRt +module Internal = { + external opaqueFullApply : 'a => 'a = "%uncurried_apply" + + /* Use opaque instead of [._n] to prevent some optimizations happening */ + external run : ((unit => 'a)) => 'a = "#run" + external opaque : 'a => 'a = "%opaque" +} + + +/** nullable, value of this type can be either [null] or ['a] + this type is the same as type [t] in {!Null} +*/ +@unboxed +type null<+'a> = Value('a) | @as(null) Null + +type undefined<+'a> +/** value of this type can be either [undefined] or ['a] + this type is the same as type [t] in {!Undefined} */ + +/** value of this type can be [undefined], [null] or ['a] + this type is the same as type [t] n {!Null_undefined} */ +@unboxed +type nullable<+'a> = Value('a) | @as(null) Null| @as(undefined) Undefined + +type null_undefined<+'a> = nullable<'a> + +external toOption: nullable<'a> => option<'a> = "#nullable_to_opt" +external undefinedToOption: undefined<'a> => option<'a> = "#undefined_to_opt" +external nullToOption: null<'a> => option<'a> = "#null_to_opt" + +external isNullable: nullable<'a> => bool = "#is_nullable" + +external import: 'a => promise<'a> = "#import" + +external testAny: 'a => bool = "#is_nullable" +/** The same as {!test} except that it is more permissive on the types of input */ + +type promise<+'a, +'e> +/** The promise type, defined here for interoperation across packages + @deprecated please use {!Js.Promise} +*/ + +external null: null<'a> = "#null" +/** The same as [empty] in {!Js.Null} will be compiled as [null]*/ + +external undefined: undefined<'a> = "#undefined" +/** The same as [empty] {!Js.Undefined} will be compiled as [undefined]*/ + +external typeof: 'a => string = "#typeof" +/** [typeof x] will be compiled as [typeof x] in JS + Please consider functions in {!Types} for a type safe way of reflection +*/ + +@val @scope("console") +external log: 'a => unit = "log" +/** A convenience function to log everything */ + +@val @scope("console") +external log2: ('a, 'b) => unit = "log" +@val @scope("console") +external log3: ('a, 'b, 'c) => unit = "log" +@val @scope("console") +external log4: ('a, 'b, 'c, 'd) => unit = "log" + +@val @scope("console") @variadic +external logMany: array<'a> => unit = "log" +/** A convenience function to log more than 4 arguments */ + +external eqNull : ('a, null<'a>) => bool = "%bs_equal_null" +external eqUndefined : ('a, undefined<'a>) => bool = "%bs_equal_undefined" +external eqNullable : ('a, nullable<'a>) => bool = "%bs_equal_nullable" + +/** {4 operators }*/ + +external unsafe_lt: ('a, 'a) => bool = "#unsafe_lt" +/** [unsafe_lt a b] will be compiled as [a < b]. + It is marked as unsafe, since it is impossible + to give a proper semantics for comparision which applies to any type +*/ + +external unsafe_le: ('a, 'a) => bool = "#unsafe_le" +/** [unsafe_le a b] will be compiled as [a <= b]. + See also {!unsafe_lt} +*/ + +external unsafe_gt: ('a, 'a) => bool = "#unsafe_gt" +/** [unsafe_gt a b] will be compiled as [a > b]. + See also {!unsafe_lt} +*/ + +external unsafe_ge: ('a, 'a) => bool = "#unsafe_ge" +/** [unsafe_ge a b] will be compiled as [a >= b]. + See also {!unsafe_lt} +*/ + +/** {12 nested modules}*/ + +module Null = Js_null +/** Provide utilities around ['a null] */ + +module Undefined = Js_undefined +/** Provide utilities around {!undefined} */ + +module Nullable = Js_null_undefined +/** Provide utilities around {!null_undefined} */ + +module Null_undefined = Js_null_undefined +/** @deprecated please use {!Js.Nullable} */ + +module Exn = Js_exn + +module Array = Js_array + +module Array2 = Js_array2 + +module String = Js_string + +module String2 = Js_string2 + +module Re = Js_re + +module Promise = Js_promise + +module Promise2 = Js_promise2 + +module Date = Js_date + +module Dict = Js_dict + +module Global = Js_global + +module Json = Js_json + +module Math = Js_math + +module Obj = Js_obj + +module Typed_array = Js_typed_array + +module TypedArray2 = Js_typed_array2 + +module Types = Js_types + +module Float = Js_float + +module Int = Js_int + +module BigInt = Js_bigint + +module File = Js_file + +module Blob = Js_blob + +module Option = Js_option + +module Result = Js_result + +module List = Js_list + +module Vector = Js_vector + +module Console = Js_console + +module Set = Js_set + +module WeakSet = Js_weakset + +module Map = Js_map + +module WeakMap = Js_weakmap diff --git a/jscomp/others/js_array.res b/jscomp/others/js_array.res deleted file mode 100644 index caf332fdc4..0000000000 --- a/jscomp/others/js_array.res +++ /dev/null @@ -1,1087 +0,0 @@ -/* Copyright (C) 2015-2016 Bloomberg Finance L.P. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * In addition to the permissions granted to you by the LGPL, you may combine - * or link a "work that uses the Library" with a publicly distributed version - * of this file to produce a combined library or application, then distribute - * that combined work under the terms of your choosing, with no requirement - * to comply with the obligations normally placed on you by section 4 of the - * LGPL version 3 (or the corresponding section of a later version of the LGPL - * should you choose to use a later version). - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/*** -Provides bindings to JavaScript’s `Array` functions. These bindings are -optimized for pipe-last (`|>`), where the array to be processed is the last -parameter in the function. - -Here is an example to find the sum of squares of all even numbers in an array. -Without pipe last, we must call the functions in reverse order: - -## Examples - -```rescript -let isEven = x => mod(x, 2) == 0 -let square = x => x * x -let result = { - open Js.Array - reduce(\"+", 0, map(square, filter(isEven, [5, 2, 3, 4, 1]))) -} -``` - -With pipe last, we call the functions in the “natural” order: - -```rescript -let isEven = x => mod(x, 2) == 0 -let square = x => x * x -let result = { - open Js.Array - [5, 2, 3, 4, 1] |> filter(isEven) |> map(square) |> reduce("+", 0) -} -``` -*/ - -@@warning("-103") - -/** -The type used to describe a JavaScript array. -*/ -type t<'a> = array<'a> - -/** -A type used to describe JavaScript objects that are like an array or are iterable. -*/ -type array_like<'a> = Js_array2.array_like<'a> - -/* commented out until bs has a plan for iterators - type 'a array_iter = 'a array_like -*/ - -@val -/** -Creates a shallow copy of an array from an array-like object. See [`Array.from`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from) on MDN. - -## Examples - -```rescript -let strArr = Js.String.castToArrayLike("abcd") -Js.Array.from(strArr) == ["a", "b", "c", "d"] -``` -*/ -external from: array_like<'a> => array<'a> = "Array.from" - -/* ES2015 */ - -@val -/** -Creates a new array by applying a function (the second argument) to each item -in the `array_like` first argument. See -[`Array.from`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from) -on MDN. - -## Examples - -```rescript -let strArr = Js.String.castToArrayLike("abcd") -let code = s => Js.String.charCodeAt(0, s) -Js.Array.fromMap(strArr, code) == [97.0, 98.0, 99.0, 100.0] -``` -*/ -external fromMap: (array_like<'a>, @uncurry ('a => 'b)) => array<'b> = "Array.from" - -/* ES2015 */ - -@val external isArray: 'a => bool = "Array.isArray" -/* ES2015 */ -/* -Returns `true` if its argument is an array; `false` otherwise. This is a -runtime check, which is why the second example returns `true` — a list is -internally represented as a nested JavaScript array. - -## Examples - -```rescript -Js.Array.isArray([5, 2, 3, 1, 4]) == true -Js.Array.isArray(list{5, 2, 3, 1, 4}) == true -Js.Array.isArray("abcd") == false -``` -*/ - -@get -/** -Returns the number of elements in the array. See [`Array.length`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/length) on MDN. -*/ -external length: array<'a> => int = "length" - -/* Mutator functions */ - -@bs.send.pipe(: t<'a> as 'this) -/** -Copies from the first element in the given array to the designated `~to_` position, returning the resulting array. *This function modifies the original array.* See [`Array.copyWithin`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin) on MDN. - -## Examples - -```rescript -let arr = [100, 101, 102, 103, 104] -Js.Array.copyWithin(~to_=2, arr) == [100, 101, 100, 101, 102] -arr == [100, 101, 100, 101, 102] -``` -*/ -external copyWithin: (~to_: int) => 'this = "copyWithin" - -/* ES2015 */ - -@bs.send.pipe(: t<'a> as 'this) -/** -Copies starting at element `~from` in the given array to the designated `~to_` position, returning the resulting array. *This function modifies the original array.* See [`Array.copyWithin`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin) on MDN. - -## Examples - -```rescript -let arr = [100, 101, 102, 103, 104] -Js.Array.copyWithinFrom(~from=2, ~to_=0, arr) == [102, 103, 104, 103, 104] -arr == [102, 103, 104, 103, 104] -``` -*/ -external copyWithinFrom: (~to_: int, ~from: int) => 'this = "copyWithin" - -/* ES2015 */ - -@bs.send.pipe(: t<'a> as 'this) -/** -Copies starting at element `~start` in the given array up to but not including `~end_` to the designated `~to_` position, returning the resulting array. *This function modifies the original array.* See [`Array.copyWithin`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin) on MDN. - -## Examples - -```rescript -let arr = [100, 101, 102, 103, 104, 105] -Js.Array.copyWithinFromRange(~start=2, ~end_=5, ~to_=1, arr) == [100, 102, 103, 104, 104, 105] -arr == [100, 102, 103, 104, 104, 105] -``` -*/ -external copyWithinFromRange: (~to_: int, ~start: int, ~end_: int) => 'this = "copyWithin" - -/* ES2015 */ - -@bs.send.pipe(: t<'a> as 'this) -/** -Sets all elements of the given array (the second arumgent) to the designated value (the first argument), returning the resulting array. *This function modifies the original array.* See [`Array.fill`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill) on MDN. - -## Examples - -```rescript -let arr = [100, 101, 102, 103, 104] -Js.Array.fillInPlace(99, arr) == [99, 99, 99, 99, 99] -arr == [99, 99, 99, 99, 99] -``` -*/ -external fillInPlace: 'a => 'this = "fill" - -/* ES2015 */ - -@bs.send.pipe(: t<'a> as 'this) -/** -Sets all elements of the given array (the last arumgent) from position `~from` to the end to the designated value (the first argument), returning the resulting array. *This function modifies the original array.* See [`Array.fill`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill) on MDN. - -## Examples - -```rescript -let arr = [100, 101, 102, 103, 104] -Js.Array.fillFromInPlace(99, ~from=2, arr) == [100, 101, 99, 99, 99] -arr == [100, 101, 99, 99, 99] -``` -*/ -external fillFromInPlace: ('a, ~from: int) => 'this = "fill" - -/* ES2015 */ - -@bs.send.pipe(: t<'a> as 'this) -/** -Sets the elements of the given array (the last arumgent) from position `~start` up to but not including position `~end_` to the designated value (the first argument), returning the resulting array. *This function modifies the original array.* See [`Array.fill`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill) on MDN. - -## Examples - -```rescript -let arr = [100, 101, 102, 103, 104] -Js.Array.fillRangeInPlace(99, ~start=1, ~end_=4, arr) == [100, 99, 99, 99, 104] -arr == [100, 99, 99, 99, 104] -``` -*/ -external fillRangeInPlace: ('a, ~start: int, ~end_: int) => 'this = "fill" - -/* ES2015 */ - -@bs.send.pipe(: t<'a> as 'this) -@return(undefined_to_opt) -/** -If the array is not empty, removes the last element and returns it as `Some(value)`; returns `None` if the array is empty. *This function modifies the original array.* See [`Array.pop`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop) on MDN. - -## Examples - -```rescript -let arr = [100, 101, 102, 103, 104] -Js.Array.pop(arr) == Some(104) -arr == [100, 101, 102, 103] - -let empty: array = [] -Js.Array.pop(empty) == None -``` -*/ -external pop: option<'a> = "pop" - -@bs.send.pipe(: t<'a> as 'this) -/** -Appends the given value to the array, returning the number of elements in the updated array. *This function modifies the original array.* See [`Array.push`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push) on MDN. - -## Examples - -```rescript -let arr = ["ant", "bee", "cat"] -Js.Array.push("dog", arr) == 4 -arr == ["ant", "bee", "cat", "dog"] -``` -*/ -external push: 'a => int = "push" - -@bs.send.pipe(: t<'a> as 'this) -@variadic -/** -Appends the values from one array (the first argument) to another (the second argument), returning the number of elements in the updated array. *This function modifies the original array.* See [`Array.push`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push) on MDN. - -## Examples - -```rescript -let arr = ["ant", "bee", "cat"] -Js.Array.pushMany(["dog", "elk"], arr) == 5 -arr == ["ant", "bee", "cat", "dog", "elk"] -``` -*/ -external pushMany: array<'a> => int = "push" - -@bs.send.pipe(: t<'a> as 'this) -/** -Returns an array with the elements of the input array in reverse order. *This function modifies the original array.* See [`Array.reverse`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse) on MDN. - -## Examples - -```rescript -let arr = ["ant", "bee", "cat"] -Js.Array.reverseInPlace(arr) == ["cat", "bee", "ant"] -arr == ["cat", "bee", "ant"] -``` -*/ -external reverseInPlace: 'this = "reverse" - -@bs.send.pipe(: t<'a> as 'this) -@return({undefined_to_opt: undefined_to_opt}) -/** -If the array is not empty, removes the first element and returns it as `Some(value)`; returns `None` if the array is empty. *This function modifies the original array.* See [`Array.shift`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift) on MDN. - -## Examples - -```rescript -let arr = [100, 101, 102, 103, 104] -Js.Array.shift(arr) == Some(100) -arr == [101, 102, 103, 104] - -let empty: array = [] -Js.Array.shift(empty) == None -``` -*/ -external shift: option<'a> = "shift" - -@bs.send.pipe(: t<'a> as 'this) -/** -Sorts the given array in place and returns the sorted array. JavaScript sorts the array by converting the arguments to UTF-16 strings and sorting them. See the second example with sorting numbers, which does not do a numeric sort. *This function modifies the original array.* See [`Array.sort`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) on MDN. - -## Examples - -```rescript -let words = ["bee", "dog", "ant", "cat"] -Js.Array.sortInPlace(words) == ["ant", "bee", "cat", "dog"] -words == ["ant", "bee", "cat", "dog"] - -let numbers = [3, 30, 10, 1, 20, 2] -Js.Array.sortInPlace(numbers) == [1, 10, 2, 20, 3, 30] -numbers == [1, 10, 2, 20, 3, 30] -``` -*/ -external sortInPlace: 'this = "sort" - -@bs.send.pipe(: t<'a> as 'this) -/** -Sorts the given array in place and returns the sorted array. *This function modifies the original array.* - -The first argument to `sortInPlaceWith()` is a function that compares two items from the array and returns: - -* an integer less than zero if the first item is less than the second item -* zero if the items are equal -* an integer greater than zero if the first item is greater than the second item - -See [`Array.sort`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) on MDN. - -## Examples - -```rescript -// sort by word length -let words = ["horse", "aardvark", "dog", "camel"] -let byLength = (s1, s2) => Js.String.length(s1) - Js.String.length(s2) - -Js.Array.sortInPlaceWith(byLength, words) == ["dog", "horse", "camel", "aardvark"] - -// sort in reverse numeric order -let numbers = [3, 30, 10, 1, 20, 2] -let reverseNumeric = (n1, n2) => n2 - n1 -Js.Array.sortInPlaceWith(reverseNumeric, numbers) == [30, 20, 10, 3, 2, 1] -``` -*/ -external sortInPlaceWith: (@uncurry ('a, 'a) => int) => 'this = "sort" - -@bs.send.pipe(: t<'a> as 'this) -@variadic -/** -Starting at position `~pos`, remove `~remove` elements and then add the -elements from the `~add` array. Returns an array consisting of the removed -items. *This function modifies the original array.* See -[`Array.splice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice) -on MDN. - -## Examples - -```rescript -let arr = ["a", "b", "c", "d", "e", "f"] -Js.Array.spliceInPlace(~pos=2, ~remove=2, ~add=["x", "y", "z"], arr) == ["c", "d"] -arr == ["a", "b", "x", "y", "z", "e", "f"] - -let arr2 = ["a", "b", "c", "d"] -Js.Array.spliceInPlace(~pos=3, ~remove=0, ~add=["x", "y"], arr2) == [] -arr2 == ["a", "b", "c", "x", "y", "d"] - -let arr3 = ["a", "b", "c", "d", "e", "f"] -Js.Array.spliceInPlace(~pos=9, ~remove=2, ~add=["x", "y", "z"], arr3) == [] -arr3 == ["a", "b", "c", "d", "e", "f", "x", "y", "z"] -``` -*/ -external spliceInPlace: (~pos: int, ~remove: int, ~add: array<'a>) => 'this = "splice" - -@bs.send.pipe(: t<'a> as 'this) -/** -Removes elements from the given array starting at position `~pos` to the end -of the array, returning the removed elements. *This function modifies the -original array.* See -[`Array.splice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice) -on MDN. - -## Examples - -```rescript -let arr = ["a", "b", "c", "d", "e", "f"] -Js.Array.removeFromInPlace(~pos=4, arr) == ["e", "f"] -arr == ["a", "b", "c", "d"] -``` -*/ -external removeFromInPlace: (~pos: int) => 'this = "splice" - -@bs.send.pipe(: t<'a> as 'this) -/** -Removes `~count` elements from the given array starting at position `~pos`, -returning the removed elements. *This function modifies the original array.* -See -[`Array.splice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice) -on MDN. - -## Examples - -```rescript -let arr = ["a", "b", "c", "d", "e", "f"] -Js.Array.removeCountInPlace(~pos=2, ~count=3, arr) == ["c", "d", "e"] -arr == ["a", "b", "f"] -``` -*/ -external removeCountInPlace: (~pos: int, ~count: int) => 'this = "splice" - -@bs.send.pipe(: t<'a> as 'this) -/** -Adds the given element to the array, returning the new number of elements in -the array. *This function modifies the original array.* See -[`Array.unshift`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift) -on MDN. - -## Examples - -```rescript -let arr = ["b", "c", "d"] -Js.Array.unshift("a", arr) == 4 -arr == ["a", "b", "c", "d"] -``` -*/ -external unshift: 'a => int = "unshift" - -@bs.send.pipe(: t<'a> as 'this) -@variadic -/** -Adds the elements in the first array argument at the beginning of the second -array argument, returning the new number of elements in the array. *This -function modifies the original array.* See -[`Array.unshift`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift) -on MDN. - -## Examples - -```rescript -let arr = ["d", "e"] -Js.Array.unshiftMany(["a", "b", "c"], arr) == 5 -arr == ["a", "b", "c", "d", "e"] -``` -*/ -external unshiftMany: array<'a> => int = "unshift" - -/* Accessor functions - */ -@bs.send.pipe(: t<'a> as 'this) -/** -Concatenates the first array argument to the second array argument, returning -a new array. The original arrays are not modified. See -[`Array.concat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat) -on MDN. - -## Examples - -```rescript -Js.Array.concat(["c", "d", "e"], ["a", "b"]) == ["a", "b", "c", "d", "e"] -``` -*/ -external concat: 'this => 'this = "concat" - -@bs.send.pipe(: t<'a> as 'this) -@variadic -/** -The first argument to `concatMany()` is an array of arrays; these are added -at the end of the second argument, returning a new array. See -[`Array.concat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat) -on MDN. - -## Examples - -```rescript -Js.Array.concatMany([["d", "e"], ["f", "g", "h"]], ["a", "b", "c"]) == [ - "a", - "b", - "c", - "d", - "e", - "f", - "g", - "h", - ] -``` -*/ -external concatMany: array<'this> => 'this = "concat" - -/* ES2016 */ -@bs.send.pipe(: t<'a> as 'this) -/** -Returns true if the given value is in the array, `false` otherwise. See -[`Array.includes`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes) -on MDN. - -## Examples - -```rescript -Js.Array.includes("b", ["a", "b", "c"]) == true -Js.Array.includes("x", ["a", "b", "c"]) == false -``` -*/ -external includes: 'a => bool = "includes" - -@bs.send.pipe(: t<'a> as 'this) -/** -Returns the index of the first element in the array that has the given value. -If the value is not in the array, returns -1. See -[`Array.indexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf) -on MDN. - -## Examples - -```rescript -Js.Array.indexOf(102, [100, 101, 102, 103]) == 2 -Js.Array.indexOf(999, [100, 101, 102, 103]) == -1 -``` -*/ -external indexOf: 'a => int = "indexOf" - -@bs.send.pipe(: t<'a> as 'this) -/** -Returns the index of the first element in the array with the given value. The -search starts at position `~from`. See -[`Array.indexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf) -on MDN. - -## Examples - -```rescript -Js.Array.indexOfFrom("a", ~from=2, ["a", "b", "a", "c", "a"]) == 2 -Js.Array.indexOfFrom("a", ~from=3, ["a", "b", "a", "c", "a"]) == 4 -Js.Array.indexOfFrom("b", ~from=2, ["a", "b", "a", "c", "a"]) == -1 -``` -*/ -external indexOfFrom: ('a, ~from: int) => int = "indexOf" - -@send @deprecated("please use joinWith instead") -external join: t<'a> => string = "join" - -@bs.send.pipe(: t<'a> as 'this) -/** -This function converts each element of the array to a string (via JavaScript) -and concatenates them, separated by the string given in the first argument, -into a single string. See -[`Array.join`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join) -on MDN. - -## Examples - -```rescript -Js.Array.joinWith("--", ["ant", "bee", "cat"]) == "ant--bee--cat" -Js.Array.joinWith("", ["door", "bell"]) == "doorbell" -Js.Array.joinWith("/", [2020, 9, 4]) == "2020/9/4" -Js.Array.joinWith(";", [2.5, 3.6, 3e-2]) == "2.5;3.6;0.03" -``` -*/ -external joinWith: string => string = "join" - -@bs.send.pipe(: t<'a> as 'this) -/** -Returns the index of the last element in the array that has the given value. -If the value is not in the array, returns -1. See -[`Array.lastIndexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf) -on MDN. - -## Examples - -```rescript -Js.Array.lastIndexOf("a", ["a", "b", "a", "c"]) == 2 -Js.Array.lastIndexOf("x", ["a", "b", "a", "c"]) == -1 -``` -*/ -external lastIndexOf: 'a => int = "lastIndexOf" - -@bs.send.pipe(: t<'a> as 'this) -/** -Returns the index of the last element in the array that has the given value, -searching from position `~from` down to the start of the array. If the value -is not in the array, returns -1. See -[`Array.lastIndexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf) -on MDN. - -## Examples - -```rescript -Js.Array.lastIndexOfFrom("a", ~from=3, ["a", "b", "a", "c", "a", "d"]) == 2 -Js.Array.lastIndexOfFrom("c", ~from=2, ["a", "b", "a", "c", "a", "d"]) == -1 -``` -*/ -external lastIndexOfFrom: ('a, ~from: int) => int = "lastIndexOf" - -@bs.send.pipe(: t<'a> as 'this) -/** -Returns a shallow copy of the given array from the `~start` index up to but -not including the `~end_` position. Negative numbers indicate an offset from -the end of the array. See -[`Array.slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice) -on MDN. - -## Examples - -```rescript -let arr = [100, 101, 102, 103, 104, 105, 106] -Js.Array.slice(~start=2, ~end_=5, arr) == [102, 103, 104] -Js.Array.slice(~start=-3, ~end_=-1, arr) == [104, 105] -Js.Array.slice(~start=9, ~end_=10, arr) == [] -``` -*/ -external slice: (~start: int, ~end_: int) => 'this = "slice" - -@bs.send.pipe(: t<'a> as 'this) -/** -Returns a copy of the entire array. Same as `Js.Array.Slice(~start=0, -~end_=Js.Array.length(arr), arr)`. See -[`Array.slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice) -on MDN. -*/ -external copy: 'this = "slice" - -@bs.send.pipe(: t<'a> as 'this) -/** -Returns a shallow copy of the given array from the given index to the end. -See [`Array.slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice) on MDN. - -## Examples - -```rescript -Js.Array.sliceFrom(2, [100, 101, 102, 103, 104]) == [102, 103, 104] -``` -*/ -external sliceFrom: int => 'this = "slice" - -@bs.send.pipe(: t<'a> as 'this) -/** -Converts the array to a string. Each element is converted to a string using -JavaScript. Unlike the JavaScript `Array.toString()`, all elements in a -ReasonML array must have the same type. See -[`Array.toString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString) -on MDN. - -## Examples - -```rescript -Js.Array.toString([3.5, 4.6, 7.8]) == "3.5,4.6,7.8" -Js.Array.toString(["a", "b", "c"]) == "a,b,c" -``` -*/ -external toString: string = "toString" - -@bs.send.pipe(: t<'a> as 'this) -/** -Converts the array to a string using the conventions of the current locale. -Each element is converted to a string using JavaScript. Unlike the JavaScript -`Array.toLocaleString()`, all elements in a ReasonML array must have the same -type. See -[`Array.toLocaleString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toLocaleString) -on MDN. - -## Examples - -```rescript -Js.Array.toLocaleString([Js.Date.make()]) -// returns "3/19/2020, 10:52:11 AM" for locale en_US.utf8 -// returns "2020-3-19 10:52:11" for locale de_DE.utf8 -``` -*/ -external toLocaleString: string = "toLocaleString" - -/* Iteration functions - */ -/* commented out until bs has a plan for iterators - external entries : (int * 'a) array_iter = "" [@@bs.send.pipe: 'a t as 'this] (* ES2015 *) -*/ - -@bs.send.pipe(: t<'a> as 'this) -/** -The first argument to `every()` is a predicate function that returns a boolean. The `every()` function returns `true` if the predicate function is true for all items in the given array. If given an empty array, returns `true`. See [`Array.every`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every) on MDN. - -## Examples - -```rescript -let isEven = x => mod(x, 2) == 0 -Js.Array.every(isEven, [6, 22, 8, 4]) == true -Js.Array.every(isEven, [6, 22, 7, 4]) == false -``` -*/ -external every: (@uncurry ('a => bool)) => bool = "every" - -@bs.send.pipe(: t<'a> as 'this) -/** -The first argument to `everyi()` is a predicate function with two arguments: an array element and that element’s index; it returns a boolean. The `everyi()` function returns `true` if the predicate function is true for all items in the given array. If given an empty array, returns `true`. See [`Array.every`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every) on MDN. - -## Examples - -```rescript -// determine if all even-index items are positive -let evenIndexPositive = (item, index) => mod(index, 2) == 0 ? item > 0 : true - -Js.Array.everyi(evenIndexPositive, [6, -3, 5, 8]) == true -Js.Array.everyi(evenIndexPositive, [6, 3, -5, 8]) == false -``` -*/ -external everyi: (@uncurry ('a, int) => bool) => bool = "every" - -@bs.send.pipe(: t<'a> as 'this) -/** -Applies the given predicate function to each element in the array; the result is an array of those elements for which the predicate function returned `true`. See [`Array.filter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) on MDN. - -## Examples - -```rescript -let nonEmpty = s => s != "" -Js.Array.filter(nonEmpty, ["abc", "", "", "def", "ghi"]) == ["abc", "def", "ghi"] -``` -*/ -external filter: (@uncurry ('a => bool)) => 'this = "filter" - -@bs.send.pipe(: t<'a> as 'this) -/** -Each element of the given array are passed to the predicate function. The -return value is an array of all those elements for which the predicate -function returned `true`. See -[`Array.filter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) -on MDN. - -## Examples - -```rescript -// keep only positive elements at odd indices -let positiveOddElement = (item, index) => mod(index, 2) == 1 && item > 0 - -Js.Array.filteri(positiveOddElement, [6, 3, 5, 8, 7, -4, 1]) == [3, 8] -``` -*/ -external filteri: (@uncurry ('a, int) => bool) => 'this = "filter" - -@bs.send.pipe(: t<'a> as 'this) -@return({undefined_to_opt: undefined_to_opt}) -/** -Returns `Some(value)` for the first element in the array that satisifies the -given predicate function, or `None` if no element satisifies the predicate. -See -[`Array.find`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find) -on MDN. - -## Examples - -```rescript -// find first negative element -Js.Array.find(x => x < 0, [33, 22, -55, 77, -44]) == Some(-55) -Js.Array.find(x => x < 0, [33, 22, 55, 77, 44]) == None -``` -*/ -external find: (@uncurry ('a => bool)) => option<'a> = "find" - -@bs.send.pipe(: t<'a> as 'this) -@return({undefined_to_opt: undefined_to_opt}) -/** -Returns `Some(value)` for the first element in the array that satisifies the given predicate function, or `None` if no element satisifies the predicate. The predicate function takes an array element and an index as its parameters. See [`Array.find`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find) on MDN. - -## Examples - -```rescript -// find first positive item at an odd index -let positiveOddElement = (item, index) => mod(index, 2) == 1 && item > 0 - -Js.Array.findi(positiveOddElement, [66, -33, 55, 88, 22]) == Some(88) -Js.Array.findi(positiveOddElement, [66, -33, 55, -88, 22]) == None -``` -*/ -external findi: (@uncurry ('a, int) => bool) => option<'a> = "find" - -@bs.send.pipe(: t<'a> as 'this) -/** -Returns the index of the first element in the array that satisifies the given predicate function, or -1 if no element satisifies the predicate. See [`Array.find`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find) on MDN. - -## Examples - -```rescript -Js.Array.findIndex(x => x < 0, [33, 22, -55, 77, -44]) == 2 -Js.Array.findIndex(x => x < 0, [33, 22, 55, 77, 44]) == -1 -``` -*/ -external findIndex: (@uncurry ('a => bool)) => int = "findIndex" - -@bs.send.pipe(: t<'a> as 'this) -/** -Returns `Some(value)` for the first element in the array that satisifies the given predicate function, or `None` if no element satisifies the predicate. The predicate function takes an array element and an index as its parameters. See [`Array.find`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find) on MDN. - -## Examples - -```rescript -// find index of first positive item at an odd index -let positiveOddElement = (item, index) => mod(index, 2) == 1 && item > 0 - -Js.Array.findIndexi(positiveOddElement, [66, -33, 55, 88, 22]) == 3 -Js.Array.findIndexi(positiveOddElement, [66, -33, 55, -88, 22]) == -1 -``` -*/ -external findIndexi: (@uncurry ('a, int) => bool) => int = "findIndex" - -@bs.send.pipe(: t<'a> as 'this) -/** -The `forEach()` function applies the function given as the first argument to each element in the array. The function you provide returns `unit`, and the `forEach()` function also returns `unit`. You use `forEach()` when you need to process each element in the array but not return any new array or value; for example, to print the items in an array. See [`Array.forEach`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) on MDN. - -## Examples - -```rescript -// display all elements in an array -Js.Array.forEach(x => Js.log(x), ["a", "b", "c"]) == () -``` -*/ -external forEach: (@uncurry ('a => unit)) => unit = "forEach" - -@bs.send.pipe(: t<'a> as 'this) -/** -The `forEachi()` function applies the function given as the first argument to each element in the array. The function you provide takes an item in the array and its index number, and returns `unit`. The `forEachi()` function also returns `unit`. You use `forEachi()` when you need to process each element in the array but not return any new array or value; for example, to print the items in an array. See [`Array.forEach`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) on MDN. - -## Examples - -```rescript -// display all elements in an array as a numbered list -Js.Array.forEachi((item, index) => Js.log2(index + 1, item), ["a", "b", "c"]) == () -``` -*/ -external forEachi: (@uncurry ('a, int) => unit) => unit = "forEach" - -/* commented out until bs has a plan for iterators - external keys : int array_iter = "" [@@bs.send.pipe: 'a t as 'this] (* ES2015 *) -*/ - -@bs.send.pipe(: t<'a> as 'this) -/** -Applies the function (given as the first argument) to each item in the array, -returning a new array. The result array does not have to have elements of the -same type as the input array. See -[`Array.map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) -on MDN. - -## Examples - -```rescript -Js.Array.map(x => x * x, [12, 4, 8]) == [144, 16, 64] -Js.Array.map(Js.String.length, ["animal", "vegetable", "mineral"]) == [6, 9, 7] -``` -*/ -external map: (@uncurry ('a => 'b)) => t<'b> = "map" - -@bs.send.pipe(: t<'a> as 'this) -/** -Applies the function (given as the first argument) to each item in the array, -returning a new array. The function acceps two arguments: an item from the -array and its index number. The result array does not have to have elements -of the same type as the input array. See -[`Array.map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) -on MDN. - -## Examples - -```rescript -// multiply each item in array by its position -let product = (item, index) => item * index -Js.Array.mapi(product, [10, 11, 12]) == [0, 11, 24] -``` -*/ -external mapi: (@uncurry ('a, int) => 'b) => t<'b> = "map" - -@bs.send.pipe(: t<'a> as 'this) -/** -The `reduce()` function takes three parameters: a *reducer function*, a -beginning accumulator value, and an array. The reducer function has two -parameters: an accumulated value and an element of the array. - -`reduce()` first calls the reducer function with the beginning value and the -first element in the array. The result becomes the new accumulator value, which -is passed in to the reducer function along with the second element in the -array. `reduce()` proceeds through the array, passing in the result of each -stage as the accumulator to the reducer function. - -When all array elements are processed, the final value of the accumulator -becomes the return value of `reduce()`. See -[`Array.reduce`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce) -on MDN. - -## Examples - -```rescript -let sumOfSquares = (accumulator, item) => accumulator + item * item - -Js.Array.reduce(sumOfSquares, 0, [10, 2, 4]) == 120 -Js.Array.reduce(\"*", 1, [10, 2, 4]) == 80 -Js.Array.reduce( - (acc, item) => acc + Js.String.length(item), - 0, - ["animal", "vegetable", "mineral"], -) == 22 // 6 + 9 + 7 -Js.Array.reduce((acc, item) => item /. acc, 1.0, [2.0, 4.0]) == 2.0 // 4.0 / (2.0 / 1.0) -``` -*/ -external reduce: (@uncurry ('b, 'a) => 'b, 'b) => 'b = "reduce" - -@bs.send.pipe(: t<'a> as 'this) -/** -The `reducei()` function takes three parameters: a *reducer function*, a -beginning accumulator value, and an array. The reducer function has three -parameters: an accumulated value, an element of the array, and the index of -that element. - -`reducei()` first calls the reducer function with the beginning value, the -first element in the array, and zero (its index). The result becomes the new -accumulator value, which is passed to the reducer function along with the -second element in the array and one (its index). `reducei()` proceeds from left -to right through the array, passing in the result of each stage as the -accumulator to the reducer function. - -When all array elements are processed, the final value of the accumulator -becomes the return value of `reducei()`. See -[`Array.reduce`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce) -on MDN. - -## Examples - -```rescript -// find sum of even-index elements in array -let sumOfEvens = (accumulator, item, index) => - if mod(index, 2) == 0 { - accumulator + item - } else { - accumulator - } - -Js.Array.reducei(sumOfEvens, 0, [2, 5, 1, 4, 3]) == 6 -``` -*/ -external reducei: (@uncurry ('b, 'a, int) => 'b, 'b) => 'b = "reduce" - -@bs.send.pipe(: t<'a> as 'this) -/** -The `reduceRight()` function takes three parameters: a *reducer function*, a -beginning accumulator value, and an array. The reducer function has two -parameters: an accumulated value and an element of the array. - -`reduceRight()` first calls the reducer function with the beginning value and -the last element in the array. The result becomes the new accumulator value, -which is passed in to the reducer function along with the next-to-last element -in the array. `reduceRight()` proceeds from right to left through the array, -passing in the result of each stage as the accumulator to the reducer function. - -When all array elements are processed, the final value of the accumulator -becomes the return value of `reduceRight()`. See -[`Array.reduceRight`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight) -on MDN. - -**NOTE:** In many cases, `reduce()` and `reduceRight()` give the same result. However, see the last example here and compare it to the example from `reduce()`, where order makes a difference. - -## Examples - -```rescript -let sumOfSquares = (accumulator, item) => accumulator + item * item - -Js.Array.reduceRight(sumOfSquares, 0, [10, 2, 4]) == 120 -Js.Array.reduceRight((acc, item) => item /. acc, 1.0, [2.0, 4.0]) == 0.5 // 2.0 / (4.0 / 1.0) -``` -*/ -external reduceRight: (@uncurry ('b, 'a) => 'b, 'b) => 'b = "reduceRight" - -@bs.send.pipe(: t<'a> as 'this) -/** -The `reduceRighti()` function takes three parameters: a *reducer function*, a -beginning accumulator value, and an array. The reducer function has three -parameters: an accumulated value, an element of the array, and the index of -that element. `reduceRighti()` first calls the reducer function with the -beginning value, the last element in the array, and its index (length of array -minus one). The result becomes the new accumulator value, which is passed in to -the reducer function along with the second element in the array and one (its -index). `reduceRighti()` proceeds from right to left through the array, passing -in the result of each stage as the accumulator to the reducer function. - -When all array elements are processed, the final value of the accumulator -becomes the return value of `reduceRighti()`. See -[`Array.reduceRight`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight) -on MDN. - -**NOTE:** In many cases, `reducei()` and `reduceRighti()` give the same result. -However, there are cases where the order in which items are processed makes a -difference. - -## Examples - -```rescript -// find sum of even-index elements in array -let sumOfEvens = (accumulator, item, index) => - if mod(index, 2) == 0 { - accumulator + item - } else { - accumulator - } - -Js.Array.reduceRighti(sumOfEvens, 0, [2, 5, 1, 4, 3]) == 6 -``` -*/ -external reduceRighti: (@uncurry ('b, 'a, int) => 'b, 'b) => 'b = "reduceRight" - -@bs.send.pipe(: t<'a> as 'this) -/** -Returns `true` if the predicate function given as the first argument to -`some()` returns `true` for any element in the array; `false` otherwise. - -## Examples - -```rescript -let isEven = x => mod(x, 2) == 0 - -Js.Array.some(isEven, [3, 7, 5, 2, 9]) == true -Js.Array.some(isEven, [3, 7, 5, 1, 9]) == false -``` -*/ -external some: (@uncurry ('a => bool)) => bool = "some" - -@bs.send.pipe(: t<'a> as 'this) -/** -Returns `true` if the predicate function given as the first argument to -`somei()` returns `true` for any element in the array; `false` otherwise. The -predicate function has two arguments: an item from the array and the index -value - -## Examples - -```rescript -// Does any string in the array -// have the same length as its index? - -let sameLength = (str, index) => Js.String.length(str) == index - -// "ef" has length 2 and is it at index 2 -Js.Array.somei(sameLength, ["ab", "cd", "ef", "gh"]) == true -// no item has the same length as its index -Js.Array.somei(sameLength, ["a", "bc", "def", "gh"]) == false -``` -*/ -external somei: (@uncurry ('a, int) => bool) => bool = "some" - -/* commented out until bs has a plan for iterators - external values : 'a array_iter = "" [@@bs.send.pipe: 'a t as 'this] (* ES2015 *) -*/ -/** -Returns the value at the given position in the array if the position is in -bounds; returns the JavaScript value `undefined` otherwise. - -## Examples - -```rescript -let arr = [100, 101, 102, 103] -Js.Array.unsafe_get(arr, 3) == 103 -Js.Array.unsafe_get(arr, 4) // returns undefined -``` -*/ -external unsafe_get: (array<'a>, int) => 'a = "%array_unsafe_get" - -/** -Sets the value at the given position in the array if the position is in bounds. -If the index is out of bounds, well, “here there be dragons.“ *This function - modifies the original array.* - -## Examples - -```rescript -let arr = [100, 101, 102, 103] -Js.Array.unsafe_set(arr, 3, 99) -// result is [100, 101, 102, 99] - -Js.Array.unsafe_set(arr, 4, 88) -// result is [100, 101, 102, 99, 88] - -Js.Array.unsafe_set(arr, 6, 77) -// result is [100, 101, 102, 99, 88, <1 empty item>, 77] - -Js.Array.unsafe_set(arr, -1, 66) -// you don't want to know. -``` -*/ -external unsafe_set: (array<'a>, int, 'a) => unit = "%array_unsafe_set" diff --git a/jscomp/others/js_json.res b/jscomp/others/js_json.res index 47ea235e60..017c6a3642 100644 --- a/jscomp/others/js_json.res +++ b/jscomp/others/js_json.res @@ -36,7 +36,7 @@ type rec t = module Kind = { type json = t type rec t<_> = - | String: t + | String: t | Number: t | Object: t> | Array: t> diff --git a/jscomp/others/js_json.resi b/jscomp/others/js_json.resi index 218d5f5626..f54f0a437a 100644 --- a/jscomp/others/js_json.resi +++ b/jscomp/others/js_json.resi @@ -43,7 +43,7 @@ module Kind: { type json = t /** Underlying type of a JSON value */ type rec t<_> = - | String: t + | String: t | Number: t | Object: t> | Array: t> @@ -72,7 +72,7 @@ let test: ('a, Kind.t<'b>) => bool /** `decodeString(json)` returns `Some(s)` if `json` is a `string`, `None` otherwise. */ -let decodeString: t => option +let decodeString: t => option /** `decodeNumber(json)` returns `Some(n)` if `json` is a `number`, `None` otherwise. diff --git a/jscomp/others/js_promise.res b/jscomp/others/js_promise.res index 7268e1e37b..b31eb3ca73 100644 --- a/jscomp/others/js_promise.res +++ b/jscomp/others/js_promise.res @@ -44,9 +44,7 @@ type error */ @new -external make: ((@uncurry ~resolve: (. 'a) => unit, ~reject: (. exn) => unit) => unit) => promise< - 'a, -> = "Promise" +external make: ((~resolve: 'a => unit, ~reject: exn => unit) => unit) => promise<'a> = "Promise" /* `make (fun resolve reject -> .. )` */ @val @scope("Promise") external resolve: 'a => promise<'a> = "resolve" @@ -83,10 +81,12 @@ external all6: ( @val @scope("Promise") external race: array> => promise<'a> = "race" -@bs.send.pipe(: promise<'a>) external then_: (@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) -@bs.send.pipe(: promise<'a>) -external catch: (@uncurry (error => promise<'a>)) => promise<'a> = "catch" +@send +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, if promise is rejected, it will pick the `handler` otherwise the original promise, diff --git a/jscomp/others/js_promise2.res b/jscomp/others/js_promise2.res index 4fa6778aa3..5b99b9b9f4 100644 --- a/jscomp/others/js_promise2.res +++ b/jscomp/others/js_promise2.res @@ -16,9 +16,7 @@ let catch: (promise<'a>, error => promise<'a>) => promise<'a> = %raw(` `) @new -external make: ((@uncurry ~resolve: (. 'a) => unit, ~reject: (. exn) => unit) => unit) => promise< - 'a, -> = "Promise" +external make: ((~resolve: 'a => unit, ~reject: exn => unit) => unit) => promise<'a> = "Promise" @val @scope("Promise") external resolve: 'a => promise<'a> = "resolve" @val @scope("Promise") external reject: exn => promise<'a> = "reject" diff --git a/jscomp/others/js_string.res b/jscomp/others/js_string.res deleted file mode 100644 index 811d1b2b00..0000000000 --- a/jscomp/others/js_string.res +++ /dev/null @@ -1,1006 +0,0 @@ -/* Copyright (C) 2015-2016 Bloomberg Finance L.P. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * In addition to the permissions granted to you by the LGPL, you may combine - * or link a "work that uses the Library" with a publicly distributed version - * of this file to produce a combined library or application, then distribute - * that combined work under the terms of your choosing, with no requirement - * to comply with the obligations normally placed on you by section 4 of the - * LGPL version 3 (or the corresponding section of a later version of the LGPL - * should you choose to use a later version). - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/*** JavaScript String API */ - -@@warning("-103") - -type t = string - -@val -/** -`make(value)` converts the given value to a `string`. - -## Examples - -```rescript -Js.String2.make(3.5) == "3.5" -Js.String2.make([1, 2, 3]) == "1,2,3" -``` -*/ -external make: 'a => t = "String" - -@val -/** -`fromCharCode(n)` creates a `string` containing the character corresponding to that number; `n` ranges from 0 to 65535. -If out of range, the lower 16 bits of the value are used. Thus, `fromCharCode(0x1F63A)` gives the same result as `fromCharCode(0xF63A)`. See [`String.fromCharCode`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode) on MDN. - -## Examples - -```rescript -Js.String2.fromCharCode(65) == "A" -Js.String2.fromCharCode(0x3c8) == `ψ` -Js.String2.fromCharCode(0xd55c) == `한` -Js.String2.fromCharCode(-64568) == `ψ` -``` -*/ -external fromCharCode: int => t = "String.fromCharCode" - -@val -@variadic -/** -`fromCharCodeMany([n1, n2, n3])` creates a `string` from the characters -corresponding to the given numbers, using the same rules as `fromCharCode`. See -[`String.fromCharCode`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode) -on MDN. -*/ -external fromCharCodeMany: array => t = "String.fromCharCode" - -@val -/** -`fromCodePoint(n)` creates a `string` containing the character corresponding to -that numeric code point. If the number is not a valid code point, it raises -`RangeError`.Thus, `fromCodePoint(0x1F63A)` will produce a correct value, -unlike `fromCharCode(0x1F63A)`, and `fromCodePoint(-5)` will raise a -`RangeError`. - -See [`String.fromCodePoint`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCodePoint) -on MDN. - -## Examples - -```rescript -Js.String2.fromCodePoint(65) == "A" -Js.String2.fromCodePoint(0x3c8) == `ψ` -Js.String2.fromCodePoint(0xd55c) == `한` -Js.String2.fromCodePoint(0x1f63a) == `😺` -``` -*/ -external fromCodePoint: int => t = "String.fromCodePoint" - -@val -@variadic -/** -`fromCodePointMany([n1, n2, n3])` creates a `string` from the characters -corresponding to the given code point numbers, using the same rules as -`fromCodePoint`. - -See [`String.fromCodePoint`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCodePoint) -on MDN. - -## Examples - -```rescript -Js.String2.fromCodePointMany([0xd55c, 0xae00, 0x1f63a]) == `한글😺` -``` -*/ -external fromCodePointMany: array => t = "String.fromCodePoint" - -/* String.raw: ES2015, meant to be used with template strings, not directly */ - -@get -/** -`length(s)` returns the length of the given `string`. See -[`String.length`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length) -on MDN. - -## Examples - -```rescript -Js.String2.length("abcd") == 4 -``` -*/ -external length: t => int = "length" - -@get_index -/** -`get(s, n)` returns as a `string` the character at the given index number. If -`n` is out of range, this function returns `undefined`, so at some point this -function may be modified to return `option`. - -## Examples - -```rescript -Js.String2.get("Reason", 0) == "R" -Js.String2.get("Reason", 4) == "o" -Js.String2.get(`Rẽasöń`, 5) == `ń` -``` -*/ -external get: (t, int) => t = "" - -@bs.send.pipe(: t) -/** -`charAt(n, s)` gets the character at index `n` within string `s`. If `n` is -negative or greater than the length of `s`, it returns the empty string. If the -string contains characters outside the range \u0000-\uffff, it will return the -first 16-bit value at that position in the string. - -See [`String.charAt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charAt) -on MDN. - -## Examples - -```rescript -Js.String.charAt(0, "Reason") == "R" -Js.String.charAt(12, "Reason") == "" -Js.String.charAt(5, `Rẽasöń`) == `ń` -``` -*/ -external charAt: int => t = "charAt" - -@bs.send.pipe(: t) -/** -`charCodeAt(n, s)` returns the character code at position `n` in string `s`; -the result is in the range 0-65535, unlke `codePointAt`, so it will not work -correctly for characters with code points greater than or equal to 0x10000. The -return type is `float` because this function returns NaN if `n` is less than -zero or greater than the length of the string. - -See [`String.charCodeAt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt) -on MDN. - -## Examples - -```rescript -Js.String.charCodeAt(0, `😺`) == 0xd83d->Belt.Int.toFloat -Js.String.codePointAt(0, `😺`) == Some(0x1f63a) -``` -*/ -external charCodeAt: int => float = "charCodeAt" - -@bs.send.pipe(: t) -/** -`codePointAt(n, s)` returns the code point at position `n` within string `s` as -a `Some(value)`. The return value handles code points greater than or equal to -0x10000. If there is no code point at the given position, the function returns -`None`. - -See [`String.codePointAt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/codePointAt) -on MDN. - -## Examples - -```rescript -Js.String.codePointAt(1, `¿😺?`) == Some(0x1f63a) -Js.String.codePointAt(5, "abc") == None -``` -*/ -external codePointAt: int => option = "codePointAt" - -@bs.send.pipe(: t) -/** -`concat(append, original)` returns a new `string` with `append` added after -`original`. - -See [`String.concat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/concat) -on MDN. - -## Examples - -```rescript -Js.String.concat("bell", "cow") == "cowbell" -``` -*/ -external concat: t => t = "concat" - -@bs.send.pipe(: t) -@variadic -/** -`concat(arr, original)` returns a new `string` consisting of each item of an -array of strings added to the `original` string. - -See [`String.concat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/concat) -on MDN. - -## Examples - -```rescript -Js.String.concatMany(["2nd", "3rd", "4th"], "1st") == "1st2nd3rd4th" -``` -*/ -external concatMany: array => t = "concat" - -@bs.send.pipe(: t) -/** -ES2015: `endsWith(substr, str)` returns `true` if the `str` ends with `substr`, -`false` otherwise. - -See [`String.endsWith`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith) -on MDN. - -## Examples - -```rescript -Js.String.endsWith("Script", "ReScript") == true -Js.String.endsWith("Script", "C++") == false -``` -*/ -external endsWith: t => bool = "endsWith" - -@bs.send.pipe(: t) -/** -`endsWithFrom(ending, len, str)` returns `true` if the first len characters of -`str` end with `ending`, `false` otherwise. If `len` is greater than or equal -to the length of `str`, then it works like `endsWith`. (Honestly, this should -have been named endsWithAt, but oh well.) - -See [`String.endsWith`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith) -on MDN. - -## Examples - -```rescript -Js.String.endsWithFrom("cd", 4, "abcd") == true -Js.String.endsWithFrom("cd", 3, "abcde") == false -Js.String.endsWithFrom("cde", 99, "abcde") == true -Js.String.endsWithFrom("ple", 7, "example.dat") == true -``` -*/ -external endsWithFrom: (t, int) => bool = "endsWith" - -@bs.send.pipe(: t) -/** -ES2015: `includes(searchValue, str)` returns `true` if `searchValue` is found -anywhere within `str`, false otherwise. - -See [`String.includes`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes) -on MDN. - -## Examples - -```rescript -Js.String.includes("gram", "programmer") == true -Js.String.includes("er", "programmer") == true -Js.String.includes("pro", "programmer") == true -Js.String.includes("xyz", "programmer.dat") == false -``` -*/ -external includes: t => bool = "includes" - -@bs.send.pipe(: t) -/** -ES2015: `includes(searchValue start, str)` returns `true` if `searchValue` is -found anywhere within `str` starting at character number `start` (where 0 is -the first character), `false` otherwise. - -See [`String.includes`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes) -on MDN. - -## Examples - -```rescript -Js.String.includesFrom("gram", 1, "programmer") == true -Js.String.includesFrom("gram", 4, "programmer") == false -Js.String.includesFrom(`한`, 1, `대한민국`) == true -``` -*/ -external includesFrom: (t, int) => bool = "includes" - -@bs.send.pipe(: t) -/** -ES2015: `indexOf(searchValue, str)` returns the position at which `searchValue` -was first found within `str`, or -1 if `searchValue` is not in `str`. - -See [`String.indexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf) -on MDN. - -## Examples - -```rescript -Js.String.indexOf("ok", "bookseller") == 2 -Js.String.indexOf("sell", "bookseller") == 4 -Js.String.indexOf("ee", "beekeeper") == 1 -Js.String.indexOf("xyz", "bookseller") == -1 -``` -*/ -external indexOf: t => int = "indexOf" - -@bs.send.pipe(: t) -/** -`indexOfFrom(searchValue, start, str)` returns the position at which -`searchValue` was found within `str` starting at character position `start`, or --1 if `searchValue` is not found in that portion of `str`. The return value is -relative to the beginning of the string, no matter where the search started -from. - -See [`String.indexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf) -on MDN. - -## Examples - -```rescript -Js.String.indexOfFrom("ok", 1, "bookseller") == 2 -Js.String.indexOfFrom("sell", 2, "bookseller") == 4 -Js.String.indexOfFrom("sell", 5, "bookseller") == -1 -``` -*/ -external indexOfFrom: (t, int) => int = "indexOf" - -@bs.send.pipe(: t) -/** -`lastIndexOf(searchValue, str)` returns the position of the last occurrence of -`searchValue` within `str`, searching backwards from the end of the string. -Returns -1 if `searchValue` is not in `str`. The return value is always -relative to the beginning of the string. - -See [`String.lastIndexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf) -on MDN. - -## Examples - -```rescript -Js.String.lastIndexOf("ok", "bookseller") == 2 -Js.String.lastIndexOf("ee", "beekeeper") == 4 -Js.String.lastIndexOf("xyz", "abcdefg") == -1 -``` -*/ -external lastIndexOf: t => int = "lastIndexOf" - -@bs.send.pipe(: t) -/** -`lastIndexOfFrom(searchValue, start, str)` returns the position of the last -occurrence of `searchValue` within `str`, searching backwards from the given -start position. Returns -1 if `searchValue` is not in `str`. The return value -is always relative to the beginning of the string. - -See [`String.lastIndexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf) -on MDN. - -## Examples - -```rescript -Js.String.lastIndexOfFrom("ok", 6, "bookseller") == 2 -Js.String.lastIndexOfFrom("ee", 8, "beekeeper") == 4 -Js.String.lastIndexOfFrom("ee", 3, "beekeeper") == 1 -Js.String.lastIndexOfFrom("xyz", 4, "abcdefg") == -1 -``` -*/ -external lastIndexOfFrom: (t, int) => int = "lastIndexOf" - -/* extended by ECMA-402 */ - -@bs.send.pipe(: t) -/** -`localeCompare(comparison, reference)` returns -- a negative value if reference comes before comparison in sort order -- zero if reference and comparison have the same sort order -- a positive value if reference comes after comparison in sort order - -See [`String.localeCompare`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare) on MDN. - -## Examples - -```rescript -Js.String.localeCompare("ant", "zebra") > 0.0 -Js.String.localeCompare("zebra", "ant") < 0.0 -Js.String.localeCompare("cat", "cat") == 0.0 -Js.String.localeCompare("cat", "CAT") > 0.0 -``` -*/ -external localeCompare: t => float = "localeCompare" - -@bs.send.pipe(: t) -@return({null_to_opt: null_to_opt}) -/** -`match(regexp, str)` matches a `string` against the given `regexp`. If there is -no match, it returns `None`. For regular expressions without the g modifier, if - there is a match, the return value is `Some(array)` where the array contains: -- The entire matched string -- Any capture groups if the regexp had parentheses - -For regular expressions with the g modifier, a matched expression returns -`Some(array)` with all the matched substrings and no capture groups. - -See [`String.match`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match) -on MDN. - -## Examples - -```rescript -Js.String.match_(%re("/b[aeiou]t/"), "The better bats") == Some(["bet"]) -Js.String.match_(%re("/b[aeiou]t/g"), "The better bats") == Some(["bet", "bat"]) -Js.String.match_(%re("/(\d+)-(\d+)-(\d+)/"), "Today is 2018-04-05.") == - Some(["2018-04-05", "2018", "04", "05"]) -Js.String.match_(%re("/b[aeiou]g/"), "The large container.") == None -``` -*/ -external match_: Js_re.t => option>> = "match" - -@bs.send.pipe(: t) -/** -`normalize(str)` returns the normalized Unicode string using Normalization Form -Canonical (NFC) Composition. Consider the character ã, which can be represented -as the single codepoint \u00e3 or the combination of a lower case letter A -\u0061 and a combining tilde \u0303. Normalization ensures that both can be -stored in an equivalent binary representation. - -See [`String.normalize`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize) -on MDN. - -See also [Unicode technical report #15](https://unicode.org/reports/tr15/) for -details. -*/ -external normalize: t = "normalize" - -@bs.send.pipe(: t) -/** -ES2015: `normalize(form, str)` returns the normalized Unicode string using the specified form of normalization, which may be one of: -- "NFC" — Normalization Form Canonical Composition. -- "NFD" — Normalization Form Canonical Decomposition. -- "NFKC" — Normalization Form Compatibility Composition. -- "NFKD" — Normalization Form Compatibility Decomposition. - -See [`String.normalize`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize) on MDN. - -See also [Unicode technical report #15](https://unicode.org/reports/tr15/) for details. -*/ -external normalizeByForm: t => t = "normalize" - -@bs.send.pipe(: t) -/** -`repeat(n, str)` returns a `string` that consists of `n` repetitions of `str`. -Raises `RangeError` if `n` is negative. - -See [`String.repeat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat) -on MDN. - -## Examples - -```rescript -Js.String.repeat(3, "ha") == "hahaha" -Js.String.repeat(0, "empty") == "" -``` -*/ -external repeat: int => t = "repeat" - -@bs.send.pipe(: t) -/** -ES2015: `replace(substr, newSubstr, str)` returns a new `string` which is -identical to `str` except with the first matching instance of `substr` replaced -by `newSubstr`. `substr` is treated as a verbatim string to match, not a -regular expression. - -See [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) -on MDN. - -## Examples - -```rescript -Js.String.replace("old", "new", "old string") == "new string" -Js.String.replace("the", "this", "the cat and the dog") == "this cat and the dog" -``` -*/ -external replace: (t, t) => t = "replace" - -@bs.send.pipe(: t) -/** -`replaceByRe(regex, replacement, str)` returns a new `string` where occurrences -matching regex have been replaced by `replacement`. - -See [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) -on MDN. - -## Examples - -```rescript -Js.String.replaceByRe(%re("/[aeiou]/g"), "x", "vowels be gone") == "vxwxls bx gxnx" -Js.String.replaceByRe(%re("/(\w+) (\w+)/"), "$2, $1", "Juan Fulano") == "Fulano, Juan" -``` -*/ -external replaceByRe: (Js_re.t, t) => t = "replace" - -@bs.send.pipe(: t) -/** -Returns a new `string` with some or all matches of a pattern with no capturing -parentheses replaced by the value returned from the given function. The -function receives as its parameters the matched string, the offset at which the -match begins, and the whole string being matched. - -See [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) -on MDN. - -## Examples - -```rescript -let str = "beautiful vowels" -let re = %re("/[aeiou]/g") -let matchFn = (matchPart, _offset, _wholeString) => Js.String.toUpperCase(matchPart) - -Js.String.unsafeReplaceBy0(re, matchFn, str) == "bEAUtIfUl vOwEls" -``` -*/ -external unsafeReplaceBy0: (Js_re.t, @uncurry (t, int, t) => t) => t = "replace" - -@bs.send.pipe(: t) -/** -Returns a new `string` with some or all matches of a pattern with one set of -capturing parentheses replaced by the value returned from the given function. -The function receives as its parameters the matched string, the captured -string, the offset at which the match begins, and the whole string being -matched. - -See [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) -on MDN. - -## Examples - -```rescript -let str = "Jony is 40" -let re = %re("/(Jony is )\d+/g") -let matchFn = (_match, part1, _offset, _wholeString) => { - part1 ++ "41" -} - -Js.String.unsafeReplaceBy1(re, matchFn, str) == "Jony is 41" -``` -*/ -external unsafeReplaceBy1: (Js_re.t, @uncurry (t, t, int, t) => t) => t = "replace" - -@bs.send.pipe(: t) -/** -Returns a new `string` with some or all matches of a pattern with two sets of -capturing parentheses replaced by the value returned from the given function. -The function receives as its parameters the matched string, the captured -strings, the offset at which the match begins, and the whole string being -matched. - -See [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) -on MDN. - -## Examples - -```rescript -let str = "7 times 6" -let re = %re("/(\d+) times (\d+)/") -let matchFn = (_match, p1, p2, _offset, _wholeString) => { - switch (Belt.Int.fromString(p1), Belt.Int.fromString(p2)) { - | (Some(x), Some(y)) => Belt.Int.toString(x * y) - | _ => "???" - } -} - -Js.String.unsafeReplaceBy2(re, matchFn, str) == "42" -``` -*/ -external unsafeReplaceBy2: (Js_re.t, @uncurry (t, t, t, int, t) => t) => t = "replace" - -@bs.send.pipe(: t) -/** -Returns a new `string` with some or all matches of a pattern with three sets of -capturing parentheses replaced by the value returned from the given function. -The function receives as its parameters the matched string, the captured -strings, the offset at which the match begins, and the whole string being -matched. - -See [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) -on MDN. -*/ -external unsafeReplaceBy3: (Js_re.t, @uncurry (t, t, t, t, int, t) => t) => t = "replace" - -@bs.send.pipe(: t) -/** -`search(regexp, str)` returns the starting position of the first match of -`regexp` in the given `str`, or -1 if there is no match. - -See [`String.search`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/search) -on MDN. - -## Examples - -```rescript -Js.String.search(%re("/\d+/"), "testing 1 2 3") == 8 -Js.String.search(%re("/\d+/"), "no numbers") == -1 -``` -*/ -external search: Js_re.t => int = "search" - -@bs.send.pipe(: t) -/** -`slice(from:n1, to_:n2, str)` returns the substring of `str` starting at -character `n1` up to but not including `n2`. -- If either `n1` or `n2` is negative, then it is evaluated as `length(str - n1)` or `length(str - n2)`. -- If `n2` is greater than the length of `str`, then it is treated as `length(str)`. -- If `n1` is greater than `n2`, slice returns the empty string. - -See [`String.slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice) on MDN. - -## Examples - -```rescript -Js.String.slice(~from=2, ~to_=5, "abcdefg") == "cde" -Js.String.slice(~from=2, ~to_=9, "abcdefg") == "cdefg" -Js.String.slice(~from=-4, ~to_=-2, "abcdefg") == "de" -Js.String.slice(~from=5, ~to_=1, "abcdefg") == "" -``` -*/ -external slice: (~from: int, ~to_: int) => t = "slice" - -@bs.send.pipe(: t) -/** -`sliceToEnd(str, from:n)` returns the substring of `str` starting at character -`n` to the end of the string. -- If `n` is negative, then it is evaluated as `length(str - n)`. -- If `n` is greater than the length of `str`, then sliceToEnd returns the empty string. - -See [`String.slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice) on MDN. - -## Examples - -```rescript -Js.String.sliceToEnd(~from=4, "abcdefg") == "efg" -Js.String.sliceToEnd(~from=-2, "abcdefg") == "fg" -Js.String.sliceToEnd(~from=7, "abcdefg") == "" -``` -*/ -external sliceToEnd: (~from: int) => t = "slice" - -@bs.send.pipe(: t) -/** -`split(delimiter, str)` splits the given `str` at every occurrence of -`delimiter` and returns an array of the resulting substrings. - -See [`String.split`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split) -on MDN. - -## Examples - -```rescript -Js.String.split("-", "2018-01-02") == ["2018", "01", "02"] -Js.String.split(",", "a,b,,c") == ["a", "b", "", "c"] -Js.String.split("::", "good::bad as great::awful") == ["good", "bad as great", "awful"] -Js.String.split(";", "has-no-delimiter") == ["has-no-delimiter"] -``` -*/ -external split: t => array = "split" - -@bs.send.pipe(: t) -/** -`splitAtMost(delimiter, ~limit:n, str)` splits the given `str` at every -occurrence of `delimiter` and returns an array of the first `n` resulting -substrings. If `n` is negative or greater than the number of substrings, the -array will contain all the substrings. - -See [`String.split`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split) -on MDN. - -## Examples - -```rescript -Js.String.splitAtMost("/", ~limit=3, "ant/bee/cat/dog/elk") == ["ant", "bee", "cat"] -Js.String.splitAtMost("/", ~limit=0, "ant/bee/cat/dog/elk") == [] -Js.String.splitAtMost("/", ~limit=9, "ant/bee/cat/dog/elk") == ["ant", "bee", "cat", "dog", "elk"] -``` -*/ -external splitAtMost: (t, ~limit: int) => array = "split" - -@bs.send.pipe(: t) -@ocaml.doc(" -`splitByRe(regex, str)` splits the given `str` at every occurrence of `regex` -and returns an array of the resulting substrings. - -See [`String.split`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split) -on MDN. - -## Examples - -```rescript -Js.String.splitByRe(%re(\"/\s*[,;]\s*/\"), \"art; bed , cog ;dad\") == [ - Some(\"art\"), - Some(\"bed\"), - Some(\"cog\"), - Some(\"dad\"), - ] -``` -") -external splitByRe: Js_re.t => array> = "split" - -@bs.send.pipe(: t) -@ocaml.doc(" -`splitByReAtMost(regex, ~limit:n, str)` splits the given `str` at every -occurrence of `regex` and returns an array of the first `n` resulting -substrings. If `n` is negative or greater than the number of substrings, the -array will contain all the substrings. - -See [`String.split`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split) -on MDN. - -## Examples - -```rescript -Js.String.splitByReAtMost(%re(\"/\s*:\s*/\"), ~limit=3, \"one: two: three: four\") == [ - Some(\"one\"), - Some(\"two\"), - Some(\"three\"), - ] - -Js.String.splitByReAtMost(%re(\"/\s*:\s*/\"), ~limit=0, \"one: two: three: four\") == [] - -Js.String.splitByReAtMost(%re(\"/\s*:\s*/\"), ~limit=8, \"one: two: three: four\") == [ - Some(\"one\"), - Some(\"two\"), - Some(\"three\"), - Some(\"four\"), - ] -``` -") -external splitByReAtMost: (Js_re.t, ~limit: int) => array> = "split" - -@bs.send.pipe(: t) -/** -ES2015: `startsWith(substr, str)` returns `true` if the `str` starts with -`substr`, `false` otherwise. - -See [`String.startsWith`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith) -on MDN. - -## Examples - -```rescript -Js.String.startsWith("Re", "ReScript") == true -Js.String.startsWith("", "ReScript") == true -Js.String.startsWith("Re", "JavaScript") == false -``` -*/ -external startsWith: t => bool = "startsWith" - -@bs.send.pipe(: t) -/** -ES2015: `startsWithFrom(substr, n, str)` returns `true` if the `str` starts -with `substr` starting at position `n`, false otherwise. If `n` is negative, -the search starts at the beginning of `str`. - -See [`String.startsWith`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith) -on MDN. - -## Examples - -```rescript -Js.String.startsWithFrom("Scri", 2, "ReScript") == true -Js.String.startsWithFrom("", 2, "ReScript") == true -Js.String.startsWithFrom("Scri", 2, "JavaScript") == false -``` -*/ -external startsWithFrom: (t, int) => bool = "startsWith" - -@bs.send.pipe(: t) -/** -`substr(~from:n, str)` returns the substring of `str` from position `n` to the -end of the string. -- If `n` is less than zero, the starting position is the length of `str - n`. -- If `n` is greater than or equal to the length of `str`, returns the empty string. - -JavaScript’s `String.substr()` is a legacy function. When possible, use -`substring()` instead. - -See [`String.substr`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr) -on MDN. - -## Examples - -```rescript -Js.String.substr(~from=3, "abcdefghij") == "defghij" -Js.String.substr(~from=-3, "abcdefghij") == "hij" -Js.String.substr(~from=12, "abcdefghij") == "" -``` -*/ -external substr: (~from: int) => t = "substr" - -@bs.send.pipe(: t) -/** -`substrAtMost(~from: pos, ~length: n, str)` returns the substring of `str` of -length `n` starting at position `pos`. -- If `pos` is less than zero, the starting position is the length of `str - pos`. -- If `pos` is greater than or equal to the length of `str`, returns the empty string. -- If `n` is less than or equal to zero, returns the empty string. - -JavaScript’s `String.substr()` is a legacy function. When possible, use -`substring()` instead. - -See [`String.substr`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr) -on MDN. - -## Examples - -```rescript -Js.String.substrAtMost(~from=3, ~length=4, "abcdefghij") == "defg" -Js.String.substrAtMost(~from=-3, ~length=4, "abcdefghij") == "hij" -Js.String.substrAtMost(~from=12, ~length=2, "abcdefghij") == "" -``` -*/ -external substrAtMost: (~from: int, ~length: int) => t = "substr" - -@bs.send.pipe(: t) -/** -`substring(~from: start, ~to_: finish, str)` returns characters `start` up to -but not including finish from `str`. -- If `start` is less than zero, it is treated as zero. -- If `finish` is zero or negative, the empty string is returned. -- If `start` is greater than `finish`, the `start` and `finish` points are swapped. - -See [`String.substring`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring) on MDN. - -## Examples - -```rescript -Js.String.substring(~from=3, ~to_=6, "playground") == "ygr" -Js.String.substring(~from=6, ~to_=3, "playground") == "ygr" -Js.String.substring(~from=4, ~to_=12, "playground") == "ground" -``` -*/ -external substring: (~from: int, ~to_: int) => t = "substring" - -@bs.send.pipe(: t) -/** -`substringToEnd(~from: start, str)` returns the substring of `str` from -position `start` to the end. -- If `start` is less than or equal to zero, the entire string is returned. -- If `start` is greater than or equal to the length of `str`, the empty string is returned. - -See [`String.substring`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring) on MDN. - -## Examples - -```rescript -Js.String.substringToEnd(~from=4, "playground") == "ground" -Js.String.substringToEnd(~from=-3, "playground") == "playground" -Js.String.substringToEnd(~from=12, "playground") == "" -``` -*/ -external substringToEnd: (~from: int) => t = "substring" - -@bs.send.pipe(: t) -/** -`toLowerCase(str)` converts `str` to lower case using the locale-insensitive -case mappings in the Unicode Character Database. Notice that the conversion can -give different results depending upon context, for example with the Greek -letter sigma, which has two different lower case forms; one when it is the last -character in a string and another when it is not. - -See [`String.toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase) -on MDN. - -## Examples - -```rescript -Js.String.toLowerCase("ABC") == "abc" -Js.String.toLowerCase(`ΣΠ`) == `σπ` -Js.String.toLowerCase(`ΠΣ`) == `πς` -``` -*/ -external toLowerCase: t = "toLowerCase" - -@bs.send.pipe(: t) -/** -`toLocaleLowerCase(str)` converts `str` to lower case using the current locale. - -See [`String.toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase) -on MDN. -*/ -external toLocaleLowerCase: t = "toLocaleLowerCase" - -@bs.send.pipe(: t) -/** -`toUpperCase(str)` converts `str` to upper case using the locale-insensitive -case mappings in the Unicode Character Database. Notice that the conversion can -expand the number of letters in the result; for example the German ß -capitalizes to two Ses in a row. - -See [`String.toUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase) -on MDN. - -## Examples - -```rescript -Js.String.toUpperCase("abc") == "ABC" -Js.String.toUpperCase(`Straße`) == `STRASSE` -Js.String.toUpperCase(`πς`) == `ΠΣ` -``` -*/ -external toUpperCase: t = "toUpperCase" - -@bs.send.pipe(: t) -/** -`toLocaleUpperCase(str)` converts `str` to upper case using the current locale. - -See [`String.to:LocaleUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase) -on MDN. -*/ -external toLocaleUpperCase: t = "toLocaleUpperCase" - -@bs.send.pipe(: t) -/** -`trim(str)` returns a string that is `str` with whitespace stripped from both -ends. Internal whitespace is not removed. - -See [`String.trim`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim) -on MDN. - -## Examples - -```rescript -Js.String.trim(" abc def ") == "abc def" -Js.String.trim("\n\r\t abc def \n\n\t\r ") == "abc def" -``` -*/ -external trim: t = "trim" - -/* HTML wrappers */ - -@bs.send.pipe(: t) -/** -`anchor(anchorName, anchorText)` creates a string with an HTML `` element -with name attribute of `anchorName` and `anchorText` as its content. Please do -not use this method, as it has been removed from the relevant web standards. - -See [`String.anchor`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/anchor) -on MDN. - -## Examples - -```rescript -Js.String.anchor("page1", "Page One") == "Page One" -``` -*/ -external anchor: t => t = "anchor" - -@bs.send.pipe(: t) -/** -ES2015: `link(urlText, linkText)` creates a string with an HTML `` element -with href attribute of `urlText` and `linkText` as its content. Please do not -use this method, as it has been removed from the relevant web standards. - -See [`String.link`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/link) -on MDN. - -## Examples - -```rescript -Js.String.link("page2.html", "Go to page two") == "Go to page two" -``` -*/ -external link: t => t = "link" - -/** -Casts its argument to an `array_like` entity that can be processed by functions -such as `Js.Array2.fromMap()` - -## Examples - -```rescript -let s = "abcde" -let arr = Js.Array2.fromMap(Js.String.castToArrayLike(s), x => x) -arr == ["a", "b", "c", "d", "e"] -``` -*/ -external castToArrayLike: t => Js_array2.array_like = "%identity" diff --git a/jscomp/others/js_typed_array.res b/jscomp/others/js_typed_array.res deleted file mode 100644 index bd0728fb68..0000000000 --- a/jscomp/others/js_typed_array.res +++ /dev/null @@ -1,1353 +0,0 @@ -/* Copyright (C) 2015-2016 Bloomberg Finance L.P. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * In addition to the permissions granted to you by the LGPL, you may combine - * or link a "work that uses the Library" with a publicly distributed version - * of this file to produce a combined library or application, then distribute - * that combined work under the terms of your choosing, with no requirement - * to comply with the obligations normally placed on you by section 4 of the - * LGPL version 3 (or the corresponding section of a later version of the LGPL - * should you choose to use a later version). - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/*** -JavaScript Typed Array API - -**see** [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) -*/ - -@@warning("-103") - -type array_buffer = Js_typed_array2.array_buffer -type array_like<'a> = Js_typed_array2.array_like<'a> - -module type Type = { - type t -} -module ArrayBuffer = { - /*** - The underlying buffer that the typed arrays provide views of - - **see** [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) - */ - - type t = array_buffer - - @new /** takes length. initializes elements to 0 */ - external make: int => t = "ArrayBuffer" - - /* ArrayBuffer.isView: seems pointless with a type system */ - /* experimental - external transfer : array_buffer -> t = "ArrayBuffer.transfer" [@@val] - external transferWithLength : array_buffer -> int -> t = "ArrayBuffer.transfer" [@@val] - */ - - @get external byteLength: t => int = "byteLength" - - @bs.send.pipe(: t) external slice: (~start: int, ~end_: int) => array_buffer = "slice" /* FIXME */ - @bs.send.pipe(: t) external sliceFrom: int => array_buffer = "slice" -} -module type S = { - /*** Implements functionality common to all the typed arrays */ - - type elt - type typed_array<'a> - type t = typed_array - - @get_index external unsafe_get: (t, int) => elt = "" - @set_index external unsafe_set: (t, int, elt) => unit = "" - - @get external buffer: t => array_buffer = "buffer" - @get external byteLength: t => int = "byteLength" - @get external byteOffset: t => int = "byteOffset" - - @bs.send.pipe(: t) external setArray: array => unit = "set" - @bs.send.pipe(: t) external setArrayOffset: (array, int) => unit = "set" - /* There's also an overload for typed arrays, but don't know how to model that without subtyping */ - - /* Array interface(-ish) - * --- - */ - @get external length: t => int = "length" - - /* Mutator functions - */ - @bs.send.pipe(: t) external copyWithin: (~to_: int) => t = "copyWithin" - @bs.send.pipe(: t) external copyWithinFrom: (~to_: int, ~from: int) => t = "copyWithin" - @bs.send.pipe(: t) - external copyWithinFromRange: (~to_: int, ~start: int, ~end_: int) => t = "copyWithin" - - @bs.send.pipe(: t) external fillInPlace: elt => t = "fill" - @bs.send.pipe(: t) external fillFromInPlace: (elt, ~from: int) => t = "fill" - @bs.send.pipe(: t) external fillRangeInPlace: (elt, ~start: int, ~end_: int) => t = "fill" - - @bs.send.pipe(: t) external reverseInPlace: t = "reverse" - - @bs.send.pipe(: t) external sortInPlace: t = "sort" - @bs.send.pipe(: t) external sortInPlaceWith: ((. elt, elt) => int) => t = "sort" - - /* Accessor functions - */ - @bs.send.pipe(: t) /** ES2016 */ - external includes: elt => bool = "includes" - - @bs.send.pipe(: t) external indexOf: elt => int = "indexOf" - @bs.send.pipe(: t) external indexOfFrom: (elt, ~from: int) => int = "indexOf" - - @bs.send.pipe(: t) external join: string = "join" - @bs.send.pipe(: t) external joinWith: string => string = "join" - - @bs.send.pipe(: t) external lastIndexOf: elt => int = "lastIndexOf" - @bs.send.pipe(: t) external lastIndexOfFrom: (elt, ~from: int) => int = "lastIndexOf" - - @bs.send.pipe(: t) external slice: (~start: int, ~end_: int) => t = "slice" - @bs.send.pipe(: t) external copy: t = "slice" - @bs.send.pipe(: t) external sliceFrom: int => t = "slice" - - @bs.send.pipe(: t) external subarray: (~start: int, ~end_: int) => t = "subarray" - @bs.send.pipe(: t) external subarrayFrom: int => t = "subarray" - - @bs.send.pipe(: t) external toString: string = "toString" - @bs.send.pipe(: t) external toLocaleString: string = "toLocaleString" - - /* Iteration functions - */ - /* commented out until bs has a plan for iterators - external entries : (int * elt) array_iter = "" [@@bs.send.pipe: t] - */ - - @bs.send.pipe(: t) external every: ((. elt) => bool) => bool = "every" - @bs.send.pipe(: t) external everyi: ((. elt, int) => bool) => bool = "every" - - /** should we use `bool` or `boolean` seems they are intechangeable here */ - @bs.send.pipe(: t) - external filter: ((. elt) => bool) => t = "filter" - @bs.send.pipe(: t) external filteri: ((. elt, int) => bool) => t = "filter" - - @bs.send.pipe(: t) external find: ((. elt) => bool) => Js.undefined = "find" - @bs.send.pipe(: t) external findi: ((. elt, int) => bool) => Js.undefined = "find" - - @bs.send.pipe(: t) external findIndex: ((. elt) => bool) => int = "findIndex" - @bs.send.pipe(: t) external findIndexi: ((. elt, int) => bool) => int = "findIndex" - - @bs.send.pipe(: t) external forEach: ((. elt) => unit) => unit = "forEach" - @bs.send.pipe(: t) external forEachi: ((. elt, int) => unit) => unit = "forEach" - - /* commented out until bs has a plan for iterators - external keys : int array_iter = "" [@@bs.send.pipe: t] - */ - - @bs.send.pipe(: t) external map: ((. elt) => 'b) => typed_array<'b> = "map" - @bs.send.pipe(: t) external mapi: ((. elt, int) => 'b) => typed_array<'b> = "map" - - @bs.send.pipe(: t) external reduce: ((. 'b, elt) => 'b, 'b) => 'b = "reduce" - @bs.send.pipe(: t) external reducei: ((. 'b, elt, int) => 'b, 'b) => 'b = "reduce" - - @bs.send.pipe(: t) external reduceRight: ((. 'b, elt) => 'b, 'b) => 'b = "reduceRight" - @bs.send.pipe(: t) external reduceRighti: ((. 'b, elt, int) => 'b, 'b) => 'b = "reduceRight" - - @bs.send.pipe(: t) external some: ((. elt) => bool) => bool = "some" - @bs.send.pipe(: t) external somei: ((. elt, int) => bool) => bool = "some" - - /* commented out until bs has a plan for iterators - external values : elt array_iter = "" [@@bs.send.pipe: t] - */ -} - -/* commented out until bs has a plan for iterators - external values : elt array_iter = "" [@@bs.send.pipe: t] - */ - -module Int8Array = { - /** */ - type elt = int - type typed_array<'a> = Js_typed_array2.Int8Array.typed_array<'a> - type t = typed_array - - @get_index external unsafe_get: (t, int) => elt = "" - @set_index external unsafe_set: (t, int, elt) => unit = "" - - @get external buffer: t => array_buffer = "buffer" - @get external byteLength: t => int = "byteLength" - @get external byteOffset: t => int = "byteOffset" - - @bs.send.pipe(: t) external setArray: array => unit = "set" - @bs.send.pipe(: t) external setArrayOffset: (array, int) => unit = "set" - /* There's also an overload for typed arrays, but don't know how to model that without subtyping */ - - /* Array interface(-ish) */ - @get external length: t => int = "length" - - /* Mutator functions */ - @bs.send.pipe(: t) external copyWithin: (~to_: int) => t = "copyWithin" - @bs.send.pipe(: t) external copyWithinFrom: (~to_: int, ~from: int) => t = "copyWithin" - @bs.send.pipe(: t) - external copyWithinFromRange: (~to_: int, ~start: int, ~end_: int) => t = "copyWithin" - - @bs.send.pipe(: t) external fillInPlace: elt => t = "fill" - @bs.send.pipe(: t) external fillFromInPlace: (elt, ~from: int) => t = "fill" - @bs.send.pipe(: t) external fillRangeInPlace: (elt, ~start: int, ~end_: int) => t = "fill" - - @bs.send.pipe(: t) external reverseInPlace: t = "reverse" - - @bs.send.pipe(: t) external sortInPlace: t = "sort" - @bs.send.pipe(: t) external sortInPlaceWith: ((. elt, elt) => int) => t = "sort" - - /* Accessor functions */ - @bs.send.pipe(: t) external includes: elt => bool = "includes" /* ES2016 */ - - @bs.send.pipe(: t) external indexOf: elt => int = "indexOf" - @bs.send.pipe(: t) external indexOfFrom: (elt, ~from: int) => int = "indexOf" - - @bs.send.pipe(: t) external join: string = "join" - @bs.send.pipe(: t) external joinWith: string => string = "join" - - @bs.send.pipe(: t) external lastIndexOf: elt => int = "lastIndexOf" - @bs.send.pipe(: t) external lastIndexOfFrom: (elt, ~from: int) => int = "lastIndexOf" - - @bs.send.pipe(: t) /** `start` is inclusive, `end_` exclusive */ - external slice: (~start: int, ~end_: int) => t = "slice" - - @bs.send.pipe(: t) external copy: t = "slice" - @bs.send.pipe(: t) external sliceFrom: int => t = "slice" - - @bs.send.pipe(: t) /** `start` is inclusive, `end_` exclusive */ - external subarray: (~start: int, ~end_: int) => t = "subarray" - - @bs.send.pipe(: t) external subarrayFrom: int => t = "subarray" - - @bs.send.pipe(: t) external toString: string = "toString" - @bs.send.pipe(: t) external toLocaleString: string = "toLocaleString" - - /* Iteration functions */ - /* commented out until bs has a plan for iterators - external entries : (int * elt) array_iter = "" [@@bs.send.pipe: t] - */ - @bs.send.pipe(: t) external every: ((. elt) => bool) => bool = "every" - @bs.send.pipe(: t) external everyi: ((. elt, int) => bool) => bool = "every" - - @bs.send.pipe(: t) external filter: ((. elt) => bool) => t = "filter" - @bs.send.pipe(: t) external filteri: ((. elt, int) => bool) => t = "filter" - - @bs.send.pipe(: t) external find: ((. elt) => bool) => Js.undefined = "find" - @bs.send.pipe(: t) external findi: ((. elt, int) => bool) => Js.undefined = "find" - - @bs.send.pipe(: t) external findIndex: ((. elt) => bool) => int = "findIndex" - @bs.send.pipe(: t) external findIndexi: ((. elt, int) => bool) => int = "findIndex" - - @bs.send.pipe(: t) external forEach: ((. elt) => unit) => unit = "forEach" - @bs.send.pipe(: t) external forEachi: ((. elt, int) => unit) => unit = "forEach" - - /* commented out until bs has a plan for iterators - external keys : int array_iter = "" [@@bs.send.pipe: t] - */ - - @bs.send.pipe(: t) external map: ((. elt) => 'b) => typed_array<'b> = "map" - @bs.send.pipe(: t) external mapi: ((. elt, int) => 'b) => typed_array<'b> = "map" - - @bs.send.pipe(: t) external reduce: ((. 'b, elt) => 'b, 'b) => 'b = "reduce" - @bs.send.pipe(: t) external reducei: ((. 'b, elt, int) => 'b, 'b) => 'b = "reduce" - - @bs.send.pipe(: t) external reduceRight: ((. 'b, elt) => 'b, 'b) => 'b = "reduceRight" - @bs.send.pipe(: t) external reduceRighti: ((. 'b, elt, int) => 'b, 'b) => 'b = "reduceRight" - - @bs.send.pipe(: t) external some: ((. elt) => bool) => bool = "some" - @bs.send.pipe(: t) external somei: ((. elt, int) => bool) => bool = "some" - - @val external _BYTES_PER_ELEMENT: int = "Int8Array.BYTES_PER_ELEMENT" - - @new external make: array => t = "Int8Array" - @new /** can throw */ - external fromBuffer: array_buffer => t = "Int8Array" - - /** - raise Js.Exn.Error raise Js exception - - param offset is in bytes - */ - @new - external fromBufferOffset: (array_buffer, int) => t = "Int8Array" - - @new - /** - raise Js.Exn.Error raises Js exception - - param offset is in bytes, length in elements - */ - external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Int8Array" - - @new external fromLength: int => t = "Int8Array" - @val external from: array_like => t = "Int8Array.from" - /* *Array.of is redundant, use make */ -} - -module Uint8Array = { - /** */ - type elt = int - type typed_array<'a> = Js_typed_array2.Uint8Array.typed_array<'a> - type t = typed_array - - @get_index external unsafe_get: (t, int) => elt = "" - @set_index external unsafe_set: (t, int, elt) => unit = "" - - @get external buffer: t => array_buffer = "buffer" - @get external byteLength: t => int = "byteLength" - @get external byteOffset: t => int = "byteOffset" - - @bs.send.pipe(: t) external setArray: array => unit = "set" - @bs.send.pipe(: t) external setArrayOffset: (array, int) => unit = "set" - /* There's also an overload for typed arrays, but don't know how to model that without subtyping */ - - /* Array interface(-ish) */ - @get external length: t => int = "length" - - /* Mutator functions */ - @bs.send.pipe(: t) external copyWithin: (~to_: int) => t = "copyWithin" - @bs.send.pipe(: t) external copyWithinFrom: (~to_: int, ~from: int) => t = "copyWithin" - @bs.send.pipe(: t) - external copyWithinFromRange: (~to_: int, ~start: int, ~end_: int) => t = "copyWithin" - - @bs.send.pipe(: t) external fillInPlace: elt => t = "fill" - @bs.send.pipe(: t) external fillFromInPlace: (elt, ~from: int) => t = "fill" - @bs.send.pipe(: t) external fillRangeInPlace: (elt, ~start: int, ~end_: int) => t = "fill" - - @bs.send.pipe(: t) external reverseInPlace: t = "reverse" - - @bs.send.pipe(: t) external sortInPlace: t = "sort" - @bs.send.pipe(: t) external sortInPlaceWith: ((. elt, elt) => int) => t = "sort" - - /* Accessor functions */ - @bs.send.pipe(: t) external includes: elt => bool = "includes" /* ES2016 */ - - @bs.send.pipe(: t) external indexOf: elt => int = "indexOf" - @bs.send.pipe(: t) external indexOfFrom: (elt, ~from: int) => int = "indexOf" - - @bs.send.pipe(: t) external join: string = "join" - @bs.send.pipe(: t) external joinWith: string => string = "join" - - @bs.send.pipe(: t) external lastIndexOf: elt => int = "lastIndexOf" - @bs.send.pipe(: t) external lastIndexOfFrom: (elt, ~from: int) => int = "lastIndexOf" - - @bs.send.pipe(: t) /** `start` is inclusive, `end_` exclusive */ - external slice: (~start: int, ~end_: int) => t = "slice" - - @bs.send.pipe(: t) external copy: t = "slice" - @bs.send.pipe(: t) external sliceFrom: int => t = "slice" - - @bs.send.pipe(: t) /** `start` is inclusive, `end_` exclusive */ - external subarray: (~start: int, ~end_: int) => t = "subarray" - - @bs.send.pipe(: t) external subarrayFrom: int => t = "subarray" - - @bs.send.pipe(: t) external toString: string = "toString" - @bs.send.pipe(: t) external toLocaleString: string = "toLocaleString" - - /* Iteration functions */ - /* commented out until bs has a plan for iterators - external entries : (int * elt) array_iter = "" [@@bs.send.pipe: t] - */ - @bs.send.pipe(: t) external every: ((. elt) => bool) => bool = "every" - @bs.send.pipe(: t) external everyi: ((. elt, int) => bool) => bool = "every" - - @bs.send.pipe(: t) external filter: ((. elt) => bool) => t = "filter" - @bs.send.pipe(: t) external filteri: ((. elt, int) => bool) => t = "filter" - - @bs.send.pipe(: t) external find: ((. elt) => bool) => Js.undefined = "find" - @bs.send.pipe(: t) external findi: ((. elt, int) => bool) => Js.undefined = "find" - - @bs.send.pipe(: t) external findIndex: ((. elt) => bool) => int = "findIndex" - @bs.send.pipe(: t) external findIndexi: ((. elt, int) => bool) => int = "findIndex" - - @bs.send.pipe(: t) external forEach: ((. elt) => unit) => unit = "forEach" - @bs.send.pipe(: t) external forEachi: ((. elt, int) => unit) => unit = "forEach" - - /* commented out until bs has a plan for iterators - external keys : int array_iter = "" [@@bs.send.pipe: t] - */ - - @bs.send.pipe(: t) external map: ((. elt) => 'b) => typed_array<'b> = "map" - @bs.send.pipe(: t) external mapi: ((. elt, int) => 'b) => typed_array<'b> = "map" - - @bs.send.pipe(: t) external reduce: ((. 'b, elt) => 'b, 'b) => 'b = "reduce" - @bs.send.pipe(: t) external reducei: ((. 'b, elt, int) => 'b, 'b) => 'b = "reduce" - - @bs.send.pipe(: t) external reduceRight: ((. 'b, elt) => 'b, 'b) => 'b = "reduceRight" - @bs.send.pipe(: t) external reduceRighti: ((. 'b, elt, int) => 'b, 'b) => 'b = "reduceRight" - - @bs.send.pipe(: t) external some: ((. elt) => bool) => bool = "some" - @bs.send.pipe(: t) external somei: ((. elt, int) => bool) => bool = "some" - - @val external _BYTES_PER_ELEMENT: int = "Uint8Array.BYTES_PER_ELEMENT" - - @new external make: array => t = "Uint8Array" - @new /** can throw */ - external fromBuffer: array_buffer => t = "Uint8Array" - - @new - /** - **raise** Js.Exn.Error raise Js exception - - **param** offset is in bytes - */ - external fromBufferOffset: (array_buffer, int) => t = "Uint8Array" - - @new - /** - **raise** Js.Exn.Error raises Js exception - - **param** offset is in bytes, length in elements - */ - external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Uint8Array" - - @new external fromLength: int => t = "Uint8Array" - @val external from: array_like => t = "Uint8Array.from" - /* *Array.of is redundant, use make */ -} - -module Uint8ClampedArray = { - /** */ - type elt = int - type typed_array<'a> = Js_typed_array2.Uint8ClampedArray.typed_array<'a> - type t = typed_array - - @get_index external unsafe_get: (t, int) => elt = "" - @set_index external unsafe_set: (t, int, elt) => unit = "" - - @get external buffer: t => array_buffer = "buffer" - @get external byteLength: t => int = "byteLength" - @get external byteOffset: t => int = "byteOffset" - - @bs.send.pipe(: t) external setArray: array => unit = "set" - @bs.send.pipe(: t) external setArrayOffset: (array, int) => unit = "set" - /* There's also an overload for typed arrays, but don't know how to model that without subtyping */ - - /* Array interface(-ish) */ - @get external length: t => int = "length" - - /* Mutator functions */ - @bs.send.pipe(: t) external copyWithin: (~to_: int) => t = "copyWithin" - @bs.send.pipe(: t) external copyWithinFrom: (~to_: int, ~from: int) => t = "copyWithin" - @bs.send.pipe(: t) - external copyWithinFromRange: (~to_: int, ~start: int, ~end_: int) => t = "copyWithin" - - @bs.send.pipe(: t) external fillInPlace: elt => t = "fill" - @bs.send.pipe(: t) external fillFromInPlace: (elt, ~from: int) => t = "fill" - @bs.send.pipe(: t) external fillRangeInPlace: (elt, ~start: int, ~end_: int) => t = "fill" - - @bs.send.pipe(: t) external reverseInPlace: t = "reverse" - - @bs.send.pipe(: t) external sortInPlace: t = "sort" - @bs.send.pipe(: t) external sortInPlaceWith: ((. elt, elt) => int) => t = "sort" - - /* Accessor functions */ - @bs.send.pipe(: t) external includes: elt => bool = "includes" /* ES2016 */ - - @bs.send.pipe(: t) external indexOf: elt => int = "indexOf" - @bs.send.pipe(: t) external indexOfFrom: (elt, ~from: int) => int = "indexOf" - - @bs.send.pipe(: t) external join: string = "join" - @bs.send.pipe(: t) external joinWith: string => string = "join" - - @bs.send.pipe(: t) external lastIndexOf: elt => int = "lastIndexOf" - @bs.send.pipe(: t) external lastIndexOfFrom: (elt, ~from: int) => int = "lastIndexOf" - - @bs.send.pipe(: t) /** `start` is inclusive, `end_` exclusive */ - external slice: (~start: int, ~end_: int) => t = "slice" - - @bs.send.pipe(: t) external copy: t = "slice" - @bs.send.pipe(: t) external sliceFrom: int => t = "slice" - - @bs.send.pipe(: t) /** `start` is inclusive, `end_` exclusive */ - external subarray: (~start: int, ~end_: int) => t = "subarray" - - @bs.send.pipe(: t) external subarrayFrom: int => t = "subarray" - - @bs.send.pipe(: t) external toString: string = "toString" - @bs.send.pipe(: t) external toLocaleString: string = "toLocaleString" - - /* Iteration functions */ - /* commented out until bs has a plan for iterators - external entries : (int * elt) array_iter = "" [@@bs.send.pipe: t] - */ - @bs.send.pipe(: t) external every: ((. elt) => bool) => bool = "every" - @bs.send.pipe(: t) external everyi: ((. elt, int) => bool) => bool = "every" - - @bs.send.pipe(: t) external filter: ((. elt) => bool) => t = "filter" - @bs.send.pipe(: t) external filteri: ((. elt, int) => bool) => t = "filter" - - @bs.send.pipe(: t) external find: ((. elt) => bool) => Js.undefined = "find" - @bs.send.pipe(: t) external findi: ((. elt, int) => bool) => Js.undefined = "find" - - @bs.send.pipe(: t) external findIndex: ((. elt) => bool) => int = "findIndex" - @bs.send.pipe(: t) external findIndexi: ((. elt, int) => bool) => int = "findIndex" - - @bs.send.pipe(: t) external forEach: ((. elt) => unit) => unit = "forEach" - @bs.send.pipe(: t) external forEachi: ((. elt, int) => unit) => unit = "forEach" - - /* commented out until bs has a plan for iterators - external keys : int array_iter = "" [@@bs.send.pipe: t] - */ - - @bs.send.pipe(: t) external map: ((. elt) => 'b) => typed_array<'b> = "map" - @bs.send.pipe(: t) external mapi: ((. elt, int) => 'b) => typed_array<'b> = "map" - - @bs.send.pipe(: t) external reduce: ((. 'b, elt) => 'b, 'b) => 'b = "reduce" - @bs.send.pipe(: t) external reducei: ((. 'b, elt, int) => 'b, 'b) => 'b = "reduce" - - @bs.send.pipe(: t) external reduceRight: ((. 'b, elt) => 'b, 'b) => 'b = "reduceRight" - @bs.send.pipe(: t) external reduceRighti: ((. 'b, elt, int) => 'b, 'b) => 'b = "reduceRight" - - @bs.send.pipe(: t) external some: ((. elt) => bool) => bool = "some" - @bs.send.pipe(: t) external somei: ((. elt, int) => bool) => bool = "some" - - @val external _BYTES_PER_ELEMENT: int = "Uint8ClampedArray.BYTES_PER_ELEMENT" - - @new external make: array => t = "Uint8ClampedArray" - @new /** can throw */ - external fromBuffer: array_buffer => t = "Uint8ClampedArray" - - /** - **raise** Js.Exn.Error raise Js exception - - **param** offset is in bytes - */ - @new - external fromBufferOffset: (array_buffer, int) => t = "Uint8ClampedArray" - - @new - /** - **raise** Js.Exn.Error raises Js exception - - **param** offset is in bytes, length in elements - */ - external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Uint8ClampedArray" - - @new external fromLength: int => t = "Uint8ClampedArray" - @val external from: array_like => t = "Uint8ClampedArray.from" - /* *Array.of is redundant, use make */ -} - -module Int16Array = { - /** */ - type elt = int - type typed_array<'a> = Js_typed_array2.Int16Array.typed_array<'a> - type t = typed_array - - @get_index external unsafe_get: (t, int) => elt = "" - @set_index external unsafe_set: (t, int, elt) => unit = "" - - @get external buffer: t => array_buffer = "buffer" - @get external byteLength: t => int = "byteLength" - @get external byteOffset: t => int = "byteOffset" - - @bs.send.pipe(: t) external setArray: array => unit = "set" - @bs.send.pipe(: t) external setArrayOffset: (array, int) => unit = "set" - /* There's also an overload for typed arrays, but don't know how to model that without subtyping */ - - /* Array interface(-ish) */ - @get external length: t => int = "length" - - /* Mutator functions */ - @bs.send.pipe(: t) external copyWithin: (~to_: int) => t = "copyWithin" - @bs.send.pipe(: t) external copyWithinFrom: (~to_: int, ~from: int) => t = "copyWithin" - @bs.send.pipe(: t) - external copyWithinFromRange: (~to_: int, ~start: int, ~end_: int) => t = "copyWithin" - - @bs.send.pipe(: t) external fillInPlace: elt => t = "fill" - @bs.send.pipe(: t) external fillFromInPlace: (elt, ~from: int) => t = "fill" - @bs.send.pipe(: t) external fillRangeInPlace: (elt, ~start: int, ~end_: int) => t = "fill" - - @bs.send.pipe(: t) external reverseInPlace: t = "reverse" - - @bs.send.pipe(: t) external sortInPlace: t = "sort" - @bs.send.pipe(: t) external sortInPlaceWith: ((. elt, elt) => int) => t = "sort" - - /* Accessor functions */ - @bs.send.pipe(: t) external includes: elt => bool = "includes" /* ES2016 */ - - @bs.send.pipe(: t) external indexOf: elt => int = "indexOf" - @bs.send.pipe(: t) external indexOfFrom: (elt, ~from: int) => int = "indexOf" - - @bs.send.pipe(: t) external join: string = "join" - @bs.send.pipe(: t) external joinWith: string => string = "join" - - @bs.send.pipe(: t) external lastIndexOf: elt => int = "lastIndexOf" - @bs.send.pipe(: t) external lastIndexOfFrom: (elt, ~from: int) => int = "lastIndexOf" - - @bs.send.pipe(: t) /** `start` is inclusive, `end_` exclusive */ - external slice: (~start: int, ~end_: int) => t = "slice" - - @bs.send.pipe(: t) external copy: t = "slice" - @bs.send.pipe(: t) external sliceFrom: int => t = "slice" - - @bs.send.pipe(: t) /** `start` is inclusive, `end_` exclusive */ - external subarray: (~start: int, ~end_: int) => t = "subarray" - - @bs.send.pipe(: t) external subarrayFrom: int => t = "subarray" - - @bs.send.pipe(: t) external toString: string = "toString" - @bs.send.pipe(: t) external toLocaleString: string = "toLocaleString" - - /* Iteration functions */ - /* commented out until bs has a plan for iterators - external entries : (int * elt) array_iter = "" [@@bs.send.pipe: t] - */ - @bs.send.pipe(: t) external every: ((. elt) => bool) => bool = "every" - @bs.send.pipe(: t) external everyi: ((. elt, int) => bool) => bool = "every" - - @bs.send.pipe(: t) external filter: ((. elt) => bool) => t = "filter" - @bs.send.pipe(: t) external filteri: ((. elt, int) => bool) => t = "filter" - - @bs.send.pipe(: t) external find: ((. elt) => bool) => Js.undefined = "find" - @bs.send.pipe(: t) external findi: ((. elt, int) => bool) => Js.undefined = "find" - - @bs.send.pipe(: t) external findIndex: ((. elt) => bool) => int = "findIndex" - @bs.send.pipe(: t) external findIndexi: ((. elt, int) => bool) => int = "findIndex" - - @bs.send.pipe(: t) external forEach: ((. elt) => unit) => unit = "forEach" - @bs.send.pipe(: t) external forEachi: ((. elt, int) => unit) => unit = "forEach" - - /* commented out until bs has a plan for iterators - external keys : int array_iter = "" [@@bs.send.pipe: t] - */ - - @bs.send.pipe(: t) external map: ((. elt) => 'b) => typed_array<'b> = "map" - @bs.send.pipe(: t) external mapi: ((. elt, int) => 'b) => typed_array<'b> = "map" - - @bs.send.pipe(: t) external reduce: ((. 'b, elt) => 'b, 'b) => 'b = "reduce" - @bs.send.pipe(: t) external reducei: ((. 'b, elt, int) => 'b, 'b) => 'b = "reduce" - - @bs.send.pipe(: t) external reduceRight: ((. 'b, elt) => 'b, 'b) => 'b = "reduceRight" - @bs.send.pipe(: t) external reduceRighti: ((. 'b, elt, int) => 'b, 'b) => 'b = "reduceRight" - - @bs.send.pipe(: t) external some: ((. elt) => bool) => bool = "some" - @bs.send.pipe(: t) external somei: ((. elt, int) => bool) => bool = "some" - - @val external _BYTES_PER_ELEMENT: int = "Int16Array.BYTES_PER_ELEMENT" - - @new external make: array => t = "Int16Array" - @new /** can throw */ - external fromBuffer: array_buffer => t = "Int16Array" - - @new - /** - **raise** Js.Exn.Error raise Js exception - - **param** offset is in bytes - */ - external fromBufferOffset: (array_buffer, int) => t = "Int16Array" - - @new - /** - **raise** Js.Exn.Error raises Js exception - - **param** offset is in bytes, length in elements - */ - external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Int16Array" - - @new external fromLength: int => t = "Int16Array" - @val external from: array_like => t = "Int16Array.from" - /* *Array.of is redundant, use make */ -} - -module Uint16Array = { - /** */ - type elt = int - type typed_array<'a> = Js_typed_array2.Uint16Array.typed_array<'a> - type t = typed_array - - @get_index external unsafe_get: (t, int) => elt = "" - @set_index external unsafe_set: (t, int, elt) => unit = "" - - @get external buffer: t => array_buffer = "buffer" - @get external byteLength: t => int = "byteLength" - @get external byteOffset: t => int = "byteOffset" - - @bs.send.pipe(: t) external setArray: array => unit = "set" - @bs.send.pipe(: t) external setArrayOffset: (array, int) => unit = "set" - /* There's also an overload for typed arrays, but don't know how to model that without subtyping */ - - /* Array interface(-ish) */ - @get external length: t => int = "length" - - /* Mutator functions */ - @bs.send.pipe(: t) external copyWithin: (~to_: int) => t = "copyWithin" - @bs.send.pipe(: t) external copyWithinFrom: (~to_: int, ~from: int) => t = "copyWithin" - @bs.send.pipe(: t) - external copyWithinFromRange: (~to_: int, ~start: int, ~end_: int) => t = "copyWithin" - - @bs.send.pipe(: t) external fillInPlace: elt => t = "fill" - @bs.send.pipe(: t) external fillFromInPlace: (elt, ~from: int) => t = "fill" - @bs.send.pipe(: t) external fillRangeInPlace: (elt, ~start: int, ~end_: int) => t = "fill" - - @bs.send.pipe(: t) external reverseInPlace: t = "reverse" - - @bs.send.pipe(: t) external sortInPlace: t = "sort" - @bs.send.pipe(: t) external sortInPlaceWith: ((. elt, elt) => int) => t = "sort" - - /* Accessor functions */ - @bs.send.pipe(: t) external includes: elt => bool = "includes" /* ES2016 */ - - @bs.send.pipe(: t) external indexOf: elt => int = "indexOf" - @bs.send.pipe(: t) external indexOfFrom: (elt, ~from: int) => int = "indexOf" - - @bs.send.pipe(: t) external join: string = "join" - @bs.send.pipe(: t) external joinWith: string => string = "join" - - @bs.send.pipe(: t) external lastIndexOf: elt => int = "lastIndexOf" - @bs.send.pipe(: t) external lastIndexOfFrom: (elt, ~from: int) => int = "lastIndexOf" - - @bs.send.pipe(: t) /** `start` is inclusive, `end_` exclusive */ - external slice: (~start: int, ~end_: int) => t = "slice" - - @bs.send.pipe(: t) external copy: t = "slice" - @bs.send.pipe(: t) external sliceFrom: int => t = "slice" - - @bs.send.pipe(: t) /** `start` is inclusive, `end_` exclusive */ - external subarray: (~start: int, ~end_: int) => t = "subarray" - - @bs.send.pipe(: t) external subarrayFrom: int => t = "subarray" - - @bs.send.pipe(: t) external toString: string = "toString" - @bs.send.pipe(: t) external toLocaleString: string = "toLocaleString" - - /* Iteration functions */ - /* commented out until bs has a plan for iterators - external entries : (int * elt) array_iter = "" [@@bs.send.pipe: t] - */ - @bs.send.pipe(: t) external every: ((. elt) => bool) => bool = "every" - @bs.send.pipe(: t) external everyi: ((. elt, int) => bool) => bool = "every" - - @bs.send.pipe(: t) external filter: ((. elt) => bool) => t = "filter" - @bs.send.pipe(: t) external filteri: ((. elt, int) => bool) => t = "filter" - - @bs.send.pipe(: t) external find: ((. elt) => bool) => Js.undefined = "find" - @bs.send.pipe(: t) external findi: ((. elt, int) => bool) => Js.undefined = "find" - - @bs.send.pipe(: t) external findIndex: ((. elt) => bool) => int = "findIndex" - @bs.send.pipe(: t) external findIndexi: ((. elt, int) => bool) => int = "findIndex" - - @bs.send.pipe(: t) external forEach: ((. elt) => unit) => unit = "forEach" - @bs.send.pipe(: t) external forEachi: ((. elt, int) => unit) => unit = "forEach" - - /* commented out until bs has a plan for iterators - external keys : int array_iter = "" [@@bs.send.pipe: t] - */ - - @bs.send.pipe(: t) external map: ((. elt) => 'b) => typed_array<'b> = "map" - @bs.send.pipe(: t) external mapi: ((. elt, int) => 'b) => typed_array<'b> = "map" - - @bs.send.pipe(: t) external reduce: ((. 'b, elt) => 'b, 'b) => 'b = "reduce" - @bs.send.pipe(: t) external reducei: ((. 'b, elt, int) => 'b, 'b) => 'b = "reduce" - - @bs.send.pipe(: t) external reduceRight: ((. 'b, elt) => 'b, 'b) => 'b = "reduceRight" - @bs.send.pipe(: t) external reduceRighti: ((. 'b, elt, int) => 'b, 'b) => 'b = "reduceRight" - - @bs.send.pipe(: t) external some: ((. elt) => bool) => bool = "some" - @bs.send.pipe(: t) external somei: ((. elt, int) => bool) => bool = "some" - - @val external _BYTES_PER_ELEMENT: int = "Uint16Array.BYTES_PER_ELEMENT" - - @new external make: array => t = "Uint16Array" - @new /** can throw */ - external fromBuffer: array_buffer => t = "Uint16Array" - - @new - /** - **raise** Js.Exn.Error raise Js exception - - **param** offset is in bytes - */ - external fromBufferOffset: (array_buffer, int) => t = "Uint16Array" - - @new - /** - **raise** Js.Exn.Error raises Js exception - - **param** offset is in bytes, length in elements - */ - external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Uint16Array" - - @new external fromLength: int => t = "Uint16Array" - @val external from: array_like => t = "Uint16Array.from" - /* *Array.of is redundant, use make */ -} - -module Int32Array = { - /** */ - type elt = int - type typed_array<'a> = Js_typed_array2.Int32Array.typed_array<'a> - type t = typed_array - - @get_index external unsafe_get: (t, int) => elt = "" - @set_index external unsafe_set: (t, int, elt) => unit = "" - - @get external buffer: t => array_buffer = "buffer" - @get external byteLength: t => int = "byteLength" - @get external byteOffset: t => int = "byteOffset" - - @bs.send.pipe(: t) external setArray: array => unit = "set" - @bs.send.pipe(: t) external setArrayOffset: (array, int) => unit = "set" - /* There's also an overload for typed arrays, but don't know how to model that without subtyping */ - - /* Array interface(-ish) */ - @get external length: t => int = "length" - - /* Mutator functions */ - @bs.send.pipe(: t) external copyWithin: (~to_: int) => t = "copyWithin" - @bs.send.pipe(: t) external copyWithinFrom: (~to_: int, ~from: int) => t = "copyWithin" - @bs.send.pipe(: t) - external copyWithinFromRange: (~to_: int, ~start: int, ~end_: int) => t = "copyWithin" - - @bs.send.pipe(: t) external fillInPlace: elt => t = "fill" - @bs.send.pipe(: t) external fillFromInPlace: (elt, ~from: int) => t = "fill" - @bs.send.pipe(: t) external fillRangeInPlace: (elt, ~start: int, ~end_: int) => t = "fill" - - @bs.send.pipe(: t) external reverseInPlace: t = "reverse" - - @bs.send.pipe(: t) external sortInPlace: t = "sort" - @bs.send.pipe(: t) external sortInPlaceWith: ((. elt, elt) => int) => t = "sort" - - /* Accessor functions */ - @bs.send.pipe(: t) external includes: elt => bool = "includes" /* ES2016 */ - - @bs.send.pipe(: t) external indexOf: elt => int = "indexOf" - @bs.send.pipe(: t) external indexOfFrom: (elt, ~from: int) => int = "indexOf" - - @bs.send.pipe(: t) external join: string = "join" - @bs.send.pipe(: t) external joinWith: string => string = "join" - - @bs.send.pipe(: t) external lastIndexOf: elt => int = "lastIndexOf" - @bs.send.pipe(: t) external lastIndexOfFrom: (elt, ~from: int) => int = "lastIndexOf" - - @bs.send.pipe(: t) /** `start` is inclusive, `end_` exclusive */ - external slice: (~start: int, ~end_: int) => t = "slice" - - @bs.send.pipe(: t) external copy: t = "slice" - @bs.send.pipe(: t) external sliceFrom: int => t = "slice" - - @bs.send.pipe(: t) /** `start` is inclusive, `end_` exclusive */ - external subarray: (~start: int, ~end_: int) => t = "subarray" - - @bs.send.pipe(: t) external subarrayFrom: int => t = "subarray" - - @bs.send.pipe(: t) external toString: string = "toString" - @bs.send.pipe(: t) external toLocaleString: string = "toLocaleString" - - /* Iteration functions */ - /* commented out until bs has a plan for iterators - external entries : (int * elt) array_iter = "" [@@bs.send.pipe: t] - */ - @bs.send.pipe(: t) external every: ((. elt) => bool) => bool = "every" - @bs.send.pipe(: t) external everyi: ((. elt, int) => bool) => bool = "every" - - @bs.send.pipe(: t) external filter: ((. elt) => bool) => t = "filter" - @bs.send.pipe(: t) external filteri: ((. elt, int) => bool) => t = "filter" - - @bs.send.pipe(: t) external find: ((. elt) => bool) => Js.undefined = "find" - @bs.send.pipe(: t) external findi: ((. elt, int) => bool) => Js.undefined = "find" - - @bs.send.pipe(: t) external findIndex: ((. elt) => bool) => int = "findIndex" - @bs.send.pipe(: t) external findIndexi: ((. elt, int) => bool) => int = "findIndex" - - @bs.send.pipe(: t) external forEach: ((. elt) => unit) => unit = "forEach" - @bs.send.pipe(: t) external forEachi: ((. elt, int) => unit) => unit = "forEach" - - /* commented out until bs has a plan for iterators - external keys : int array_iter = "" [@@bs.send.pipe: t] - */ - - @bs.send.pipe(: t) external map: ((. elt) => 'b) => typed_array<'b> = "map" - @bs.send.pipe(: t) external mapi: ((. elt, int) => 'b) => typed_array<'b> = "map" - - @bs.send.pipe(: t) external reduce: ((. 'b, elt) => 'b, 'b) => 'b = "reduce" - @bs.send.pipe(: t) external reducei: ((. 'b, elt, int) => 'b, 'b) => 'b = "reduce" - - @bs.send.pipe(: t) external reduceRight: ((. 'b, elt) => 'b, 'b) => 'b = "reduceRight" - @bs.send.pipe(: t) external reduceRighti: ((. 'b, elt, int) => 'b, 'b) => 'b = "reduceRight" - - @bs.send.pipe(: t) external some: ((. elt) => bool) => bool = "some" - @bs.send.pipe(: t) external somei: ((. elt, int) => bool) => bool = "some" - - @val external _BYTES_PER_ELEMENT: int = "Int32Array.BYTES_PER_ELEMENT" - - @new external make: array => t = "Int32Array" - @new /** can throw */ - external fromBuffer: array_buffer => t = "Int32Array" - - @new - /** - **raise** Js.Exn.Error raise Js exception - - **param** offset is in bytes - */ - external fromBufferOffset: (array_buffer, int) => t = "Int32Array" - - @new - /** - **raise** Js.Exn.Error raises Js exception - - **param** offset is in bytes, length in elements - */ - external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Int32Array" - - @new external fromLength: int => t = "Int32Array" - @val external from: array_like => t = "Int32Array.from" - /* *Array.of is redundant, use make */ - @new @deprecated("use `make` instead") external create: array => t = "Int32Array" - @new @deprecated("use `fromBuffer` instead") external of_buffer: array_buffer => t = "Int32Array" -} -module Int32_array = Int32Array - -module Uint32Array = { - /** */ - type elt = int - type typed_array<'a> = Js_typed_array2.Uint32Array.typed_array<'a> - type t = typed_array - - @get_index external unsafe_get: (t, int) => elt = "" - @set_index external unsafe_set: (t, int, elt) => unit = "" - - @get external buffer: t => array_buffer = "buffer" - @get external byteLength: t => int = "byteLength" - @get external byteOffset: t => int = "byteOffset" - - @bs.send.pipe(: t) external setArray: array => unit = "set" - @bs.send.pipe(: t) external setArrayOffset: (array, int) => unit = "set" - /* There's also an overload for typed arrays, but don't know how to model that without subtyping */ - - /* Array interface(-ish) */ - @get external length: t => int = "length" - - /* Mutator functions */ - @bs.send.pipe(: t) external copyWithin: (~to_: int) => t = "copyWithin" - @bs.send.pipe(: t) external copyWithinFrom: (~to_: int, ~from: int) => t = "copyWithin" - @bs.send.pipe(: t) - external copyWithinFromRange: (~to_: int, ~start: int, ~end_: int) => t = "copyWithin" - - @bs.send.pipe(: t) external fillInPlace: elt => t = "fill" - @bs.send.pipe(: t) external fillFromInPlace: (elt, ~from: int) => t = "fill" - @bs.send.pipe(: t) external fillRangeInPlace: (elt, ~start: int, ~end_: int) => t = "fill" - - @bs.send.pipe(: t) external reverseInPlace: t = "reverse" - - @bs.send.pipe(: t) external sortInPlace: t = "sort" - @bs.send.pipe(: t) external sortInPlaceWith: ((. elt, elt) => int) => t = "sort" - - /* Accessor functions */ - @bs.send.pipe(: t) external includes: elt => bool = "includes" /* ES2016 */ - - @bs.send.pipe(: t) external indexOf: elt => int = "indexOf" - @bs.send.pipe(: t) external indexOfFrom: (elt, ~from: int) => int = "indexOf" - - @bs.send.pipe(: t) external join: string = "join" - @bs.send.pipe(: t) external joinWith: string => string = "join" - - @bs.send.pipe(: t) external lastIndexOf: elt => int = "lastIndexOf" - @bs.send.pipe(: t) external lastIndexOfFrom: (elt, ~from: int) => int = "lastIndexOf" - - @bs.send.pipe(: t) /** `start` is inclusive, `end_` exclusive */ - external slice: (~start: int, ~end_: int) => t = "slice" - - @bs.send.pipe(: t) external copy: t = "slice" - @bs.send.pipe(: t) external sliceFrom: int => t = "slice" - - @bs.send.pipe(: t) /** `start` is inclusive, `end_` exclusive */ - external subarray: (~start: int, ~end_: int) => t = "subarray" - - @bs.send.pipe(: t) external subarrayFrom: int => t = "subarray" - - @bs.send.pipe(: t) external toString: string = "toString" - @bs.send.pipe(: t) external toLocaleString: string = "toLocaleString" - - /* Iteration functions */ - /* commented out until bs has a plan for iterators - external entries : (int * elt) array_iter = "" [@@bs.send.pipe: t] - */ - @bs.send.pipe(: t) external every: ((. elt) => bool) => bool = "every" - @bs.send.pipe(: t) external everyi: ((. elt, int) => bool) => bool = "every" - - @bs.send.pipe(: t) external filter: ((. elt) => bool) => t = "filter" - @bs.send.pipe(: t) external filteri: ((. elt, int) => bool) => t = "filter" - - @bs.send.pipe(: t) external find: ((. elt) => bool) => Js.undefined = "find" - @bs.send.pipe(: t) external findi: ((. elt, int) => bool) => Js.undefined = "find" - - @bs.send.pipe(: t) external findIndex: ((. elt) => bool) => int = "findIndex" - @bs.send.pipe(: t) external findIndexi: ((. elt, int) => bool) => int = "findIndex" - - @bs.send.pipe(: t) external forEach: ((. elt) => unit) => unit = "forEach" - @bs.send.pipe(: t) external forEachi: ((. elt, int) => unit) => unit = "forEach" - - /* commented out until bs has a plan for iterators - external keys : int array_iter = "" [@@bs.send.pipe: t] - */ - - @bs.send.pipe(: t) external map: ((. elt) => 'b) => typed_array<'b> = "map" - @bs.send.pipe(: t) external mapi: ((. elt, int) => 'b) => typed_array<'b> = "map" - - @bs.send.pipe(: t) external reduce: ((. 'b, elt) => 'b, 'b) => 'b = "reduce" - @bs.send.pipe(: t) external reducei: ((. 'b, elt, int) => 'b, 'b) => 'b = "reduce" - - @bs.send.pipe(: t) external reduceRight: ((. 'b, elt) => 'b, 'b) => 'b = "reduceRight" - @bs.send.pipe(: t) external reduceRighti: ((. 'b, elt, int) => 'b, 'b) => 'b = "reduceRight" - - @bs.send.pipe(: t) external some: ((. elt) => bool) => bool = "some" - @bs.send.pipe(: t) external somei: ((. elt, int) => bool) => bool = "some" - - @val external _BYTES_PER_ELEMENT: int = "Uint32Array.BYTES_PER_ELEMENT" - - @new external make: array => t = "Uint32Array" - @new /** can throw */ - external fromBuffer: array_buffer => t = "Uint32Array" - - @new - /** - **raise** Js.Exn.Error raise Js exception - - **param** offset is in bytes - */ - external fromBufferOffset: (array_buffer, int) => t = "Uint32Array" - - @new - /** - **raise** Js.Exn.Error raises Js exception - - **param** offset is in bytes, length in elements - */ - external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Uint32Array" - - @new external fromLength: int => t = "Uint32Array" - @val external from: array_like => t = "Uint32Array.from" - /* *Array.of is redundant, use make */ -} - -/* - it still return number, `float` in this case -*/ -module Float32Array = { - /** */ - type elt = float - type typed_array<'a> = Js_typed_array2.Float32Array.typed_array<'a> - type t = typed_array - - @get_index external unsafe_get: (t, int) => elt = "" - @set_index external unsafe_set: (t, int, elt) => unit = "" - - @get external buffer: t => array_buffer = "buffer" - @get external byteLength: t => int = "byteLength" - @get external byteOffset: t => int = "byteOffset" - - @bs.send.pipe(: t) external setArray: array => unit = "set" - @bs.send.pipe(: t) external setArrayOffset: (array, int) => unit = "set" - /* There's also an overload for typed arrays, but don't know how to model that without subtyping */ - - /* Array interface(-ish) */ - @get external length: t => int = "length" - - /* Mutator functions */ - @bs.send.pipe(: t) external copyWithin: (~to_: int) => t = "copyWithin" - @bs.send.pipe(: t) external copyWithinFrom: (~to_: int, ~from: int) => t = "copyWithin" - @bs.send.pipe(: t) - external copyWithinFromRange: (~to_: int, ~start: int, ~end_: int) => t = "copyWithin" - - @bs.send.pipe(: t) external fillInPlace: elt => t = "fill" - @bs.send.pipe(: t) external fillFromInPlace: (elt, ~from: int) => t = "fill" - @bs.send.pipe(: t) external fillRangeInPlace: (elt, ~start: int, ~end_: int) => t = "fill" - - @bs.send.pipe(: t) external reverseInPlace: t = "reverse" - - @bs.send.pipe(: t) external sortInPlace: t = "sort" - @bs.send.pipe(: t) external sortInPlaceWith: ((. elt, elt) => int) => t = "sort" - - /* Accessor functions */ - @bs.send.pipe(: t) external includes: elt => bool = "includes" /* ES2016 */ - - @bs.send.pipe(: t) external indexOf: elt => int = "indexOf" - @bs.send.pipe(: t) external indexOfFrom: (elt, ~from: int) => int = "indexOf" - - @bs.send.pipe(: t) external join: string = "join" - @bs.send.pipe(: t) external joinWith: string => string = "join" - - @bs.send.pipe(: t) external lastIndexOf: elt => int = "lastIndexOf" - @bs.send.pipe(: t) external lastIndexOfFrom: (elt, ~from: int) => int = "lastIndexOf" - - @bs.send.pipe(: t) /** `start` is inclusive, `end_` exclusive */ - external slice: (~start: int, ~end_: int) => t = "slice" - - @bs.send.pipe(: t) external copy: t = "slice" - @bs.send.pipe(: t) external sliceFrom: int => t = "slice" - - @bs.send.pipe(: t) /** `start` is inclusive, `end_` exclusive */ - external subarray: (~start: int, ~end_: int) => t = "subarray" - - @bs.send.pipe(: t) external subarrayFrom: int => t = "subarray" - - @bs.send.pipe(: t) external toString: string = "toString" - @bs.send.pipe(: t) external toLocaleString: string = "toLocaleString" - - /* Iteration functions */ - /* commented out until bs has a plan for iterators - external entries : (int * elt) array_iter = "" [@@bs.send.pipe: t] - */ - @bs.send.pipe(: t) external every: ((. elt) => bool) => bool = "every" - @bs.send.pipe(: t) external everyi: ((. elt, int) => bool) => bool = "every" - - @bs.send.pipe(: t) external filter: ((. elt) => bool) => t = "filter" - @bs.send.pipe(: t) external filteri: ((. elt, int) => bool) => t = "filter" - - @bs.send.pipe(: t) external find: ((. elt) => bool) => Js.undefined = "find" - @bs.send.pipe(: t) external findi: ((. elt, int) => bool) => Js.undefined = "find" - - @bs.send.pipe(: t) external findIndex: ((. elt) => bool) => int = "findIndex" - @bs.send.pipe(: t) external findIndexi: ((. elt, int) => bool) => int = "findIndex" - - @bs.send.pipe(: t) external forEach: ((. elt) => unit) => unit = "forEach" - @bs.send.pipe(: t) external forEachi: ((. elt, int) => unit) => unit = "forEach" - - /* commented out until bs has a plan for iterators - external keys : int array_iter = "" [@@bs.send.pipe: t] - */ - - @bs.send.pipe(: t) external map: ((. elt) => 'b) => typed_array<'b> = "map" - @bs.send.pipe(: t) external mapi: ((. elt, int) => 'b) => typed_array<'b> = "map" - - @bs.send.pipe(: t) external reduce: ((. 'b, elt) => 'b, 'b) => 'b = "reduce" - @bs.send.pipe(: t) external reducei: ((. 'b, elt, int) => 'b, 'b) => 'b = "reduce" - - @bs.send.pipe(: t) external reduceRight: ((. 'b, elt) => 'b, 'b) => 'b = "reduceRight" - @bs.send.pipe(: t) external reduceRighti: ((. 'b, elt, int) => 'b, 'b) => 'b = "reduceRight" - - @bs.send.pipe(: t) external some: ((. elt) => bool) => bool = "some" - @bs.send.pipe(: t) external somei: ((. elt, int) => bool) => bool = "some" - - @val external _BYTES_PER_ELEMENT: int = "Float32Array.BYTES_PER_ELEMENT" - - @new external make: array => t = "Float32Array" - @new /** can throw */ - external fromBuffer: array_buffer => t = "Float32Array" - - @new - /** - **raise** Js.Exn.Error raise Js exception - - **param** offset is in bytes - */ - external fromBufferOffset: (array_buffer, int) => t = "Float32Array" - - @new - /** - **raise** Js.Exn.Error raises Js exception - - **param** offset is in bytes, length in elements - */ - external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Float32Array" - - @new external fromLength: int => t = "Float32Array" - @val external from: array_like => t = "Float32Array.from" - /* *Array.of is redundant, use make */ - @new @deprecated("use `make` instead") external create: array => t = "Float32Array" - @new @deprecated("use `fromBuffer` instead") - external of_buffer: array_buffer => t = "Float32Array" -} -module Float32_array = Float32Array - -module Float64Array = { - /** */ - type elt = float - type typed_array<'a> = Js_typed_array2.Float64Array.typed_array<'a> - type t = typed_array - - @get_index external unsafe_get: (t, int) => elt = "" - @set_index external unsafe_set: (t, int, elt) => unit = "" - - @get external buffer: t => array_buffer = "buffer" - @get external byteLength: t => int = "byteLength" - @get external byteOffset: t => int = "byteOffset" - - @bs.send.pipe(: t) external setArray: array => unit = "set" - @bs.send.pipe(: t) external setArrayOffset: (array, int) => unit = "set" - /* There's also an overload for typed arrays, but don't know how to model that without subtyping */ - - /* Array interface(-ish) */ - @get external length: t => int = "length" - - /* Mutator functions */ - @bs.send.pipe(: t) external copyWithin: (~to_: int) => t = "copyWithin" - @bs.send.pipe(: t) external copyWithinFrom: (~to_: int, ~from: int) => t = "copyWithin" - @bs.send.pipe(: t) - external copyWithinFromRange: (~to_: int, ~start: int, ~end_: int) => t = "copyWithin" - - @bs.send.pipe(: t) external fillInPlace: elt => t = "fill" - @bs.send.pipe(: t) external fillFromInPlace: (elt, ~from: int) => t = "fill" - @bs.send.pipe(: t) external fillRangeInPlace: (elt, ~start: int, ~end_: int) => t = "fill" - - @bs.send.pipe(: t) external reverseInPlace: t = "reverse" - - @bs.send.pipe(: t) external sortInPlace: t = "sort" - @bs.send.pipe(: t) external sortInPlaceWith: ((. elt, elt) => int) => t = "sort" - - /* Accessor functions */ - @bs.send.pipe(: t) external includes: elt => bool = "includes" /* ES2016 */ - - @bs.send.pipe(: t) external indexOf: elt => int = "indexOf" - @bs.send.pipe(: t) external indexOfFrom: (elt, ~from: int) => int = "indexOf" - - @bs.send.pipe(: t) external join: string = "join" - @bs.send.pipe(: t) external joinWith: string => string = "join" - - @bs.send.pipe(: t) external lastIndexOf: elt => int = "lastIndexOf" - @bs.send.pipe(: t) external lastIndexOfFrom: (elt, ~from: int) => int = "lastIndexOf" - - @bs.send.pipe(: t) /** `start` is inclusive, `end_` exclusive */ - external slice: (~start: int, ~end_: int) => t = "slice" - - @bs.send.pipe(: t) external copy: t = "slice" - @bs.send.pipe(: t) external sliceFrom: int => t = "slice" - - @bs.send.pipe(: t) /** `start` is inclusive, `end_` exclusive */ - external subarray: (~start: int, ~end_: int) => t = "subarray" - - @bs.send.pipe(: t) external subarrayFrom: int => t = "subarray" - - @bs.send.pipe(: t) external toString: string = "toString" - @bs.send.pipe(: t) external toLocaleString: string = "toLocaleString" - - /* Iteration functions */ - /* commented out until bs has a plan for iterators - external entries : (int * elt) array_iter = "" [@@bs.send.pipe: t] - */ - @bs.send.pipe(: t) external every: ((. elt) => bool) => bool = "every" - @bs.send.pipe(: t) external everyi: ((. elt, int) => bool) => bool = "every" - - @bs.send.pipe(: t) external filter: ((. elt) => bool) => t = "filter" - @bs.send.pipe(: t) external filteri: ((. elt, int) => bool) => t = "filter" - - @bs.send.pipe(: t) external find: ((. elt) => bool) => Js.undefined = "find" - @bs.send.pipe(: t) external findi: ((. elt, int) => bool) => Js.undefined = "find" - - @bs.send.pipe(: t) external findIndex: ((. elt) => bool) => int = "findIndex" - @bs.send.pipe(: t) external findIndexi: ((. elt, int) => bool) => int = "findIndex" - - @bs.send.pipe(: t) external forEach: ((. elt) => unit) => unit = "forEach" - @bs.send.pipe(: t) external forEachi: ((. elt, int) => unit) => unit = "forEach" - - /* commented out until bs has a plan for iterators - external keys : int array_iter = "" [@@bs.send.pipe: t] - */ - - @bs.send.pipe(: t) external map: ((. elt) => 'b) => typed_array<'b> = "map" - @bs.send.pipe(: t) external mapi: ((. elt, int) => 'b) => typed_array<'b> = "map" - - @bs.send.pipe(: t) external reduce: ((. 'b, elt) => 'b, 'b) => 'b = "reduce" - @bs.send.pipe(: t) external reducei: ((. 'b, elt, int) => 'b, 'b) => 'b = "reduce" - - @bs.send.pipe(: t) external reduceRight: ((. 'b, elt) => 'b, 'b) => 'b = "reduceRight" - @bs.send.pipe(: t) external reduceRighti: ((. 'b, elt, int) => 'b, 'b) => 'b = "reduceRight" - - @bs.send.pipe(: t) external some: ((. elt) => bool) => bool = "some" - @bs.send.pipe(: t) external somei: ((. elt, int) => bool) => bool = "some" - - @val external _BYTES_PER_ELEMENT: int = "Float64Array.BYTES_PER_ELEMENT" - - @new external make: array => t = "Float64Array" - @new /** can throw */ - external fromBuffer: array_buffer => t = "Float64Array" - - @new - /** - **raise** Js.Exn.Error raise Js exception - - **param** offset is in bytes - */ - external fromBufferOffset: (array_buffer, int) => t = "Float64Array" - - @new - /** - **raise** Js.Exn.Error raises Js exception - - **param** offset is in bytes, length in elements - */ - external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Float64Array" - - @new external fromLength: int => t = "Float64Array" - @val external from: array_like => t = "Float64Array.from" - /* *Array.of is redundant, use make */ - @new @deprecated("use `make` instead") external create: array => t = "Float64Array" - @new @deprecated("use `fromBuffer` instead") - external of_buffer: array_buffer => t = "Float64Array" -} -module Float64_array = Float64Array - -/** -The DataView view provides a low-level interface for reading and writing -multiple number types in an ArrayBuffer irrespective of the platform's endianness. - -**see** [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) -*/ -module DataView = { - type t = Js_typed_array2.DataView.t - - @new external make: array_buffer => t = "DataView" - @new external fromBuffer: array_buffer => t = "DataView" - @new external fromBufferOffset: (array_buffer, int) => t = "DataView" - @new external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "DataView" - - @get external buffer: t => array_buffer = "buffer" - @get external byteLength: t => int = "byteLength" - @get external byteOffset: t => int = "byteOffset" - - @send external getInt8: (t, int) => int = "getInt8" - @send external getUint8: (t, int) => int = "getUint8" - - @send external getInt16: (t, int) => int = "getInt16" - @send external getInt16LittleEndian: (t, int, @as(1) _) => int = "getInt16" - - @send external getUint16: (t, int) => int = "getUint16" - @send external getUint16LittleEndian: (t, int, @as(1) _) => int = "getUint16" - - @send external getInt32: (t, int) => int = "getInt32" - @send external getInt32LittleEndian: (t, int, @as(1) _) => int = "getInt32" - - @send external getUint32: (t, int) => int = "getUint32" - @send external getUint32LittleEndian: (t, int, @as(1) _) => int = "getUint32" - - @send external getFloat32: (t, int) => float = "getFloat32" - @send external getFloat32LittleEndian: (t, int, @as(1) _) => float = "getFloat32" - - @send external getFloat64: (t, int) => float = "getFloat64" - @send external getFloat64LittleEndian: (t, int, @as(1) _) => float = "getFloat64" - - @send external setInt8: (t, int, int) => unit = "setInt8" - @send external setUint8: (t, int, int) => unit = "setUint8" - - @send external setInt16: (t, int, int) => unit = "setInt16" - @send external setInt16LittleEndian: (t, int, int, @as(1) _) => unit = "setInt16" - - @send external setUint16: (t, int, int) => unit = "setUint16" - @send external setUint16LittleEndian: (t, int, int, @as(1) _) => unit = "setUint16" - - @send external setInt32: (t, int, int) => unit = "setInt32" - @send external setInt32LittleEndian: (t, int, int, @as(1) _) => unit = "setInt32" - - @send external setUint32: (t, int, int) => unit = "setUint32" - @send external setUint32LittleEndian: (t, int, int, @as(1) _) => unit = "setUint32" - - @send external setFloat32: (t, int, float) => unit = "setFloat32" - @send external setFloat32LittleEndian: (t, int, float, @as(1) _) => unit = "setFloat32" - - @send external setFloat64: (t, int, float) => unit = "setFloat64" - @send external setFloat64LittleEndian: (t, int, float, @as(1) _) => unit = "setFloat64" -} diff --git a/jscomp/others/jsxU.res b/jscomp/others/jsx.res similarity index 100% rename from jscomp/others/jsxU.res rename to jscomp/others/jsx.res diff --git a/jscomp/others/jsxC.res b/jscomp/others/jsxC.res deleted file mode 100644 index d7e08eb405..0000000000 --- a/jscomp/others/jsxC.res +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (C) 2022- Authors of ReScript - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * In addition to the permissions granted to you by the LGPL, you may combine - * or link a "work that uses the Library" with a publicly distributed version - * of this file to produce a combined library or application, then distribute - * that combined work under the terms of your choosing, with no requirement - * to comply with the obligations normally placed on you by section 4 of the - * LGPL version 3 (or the corresponding section of a later version of the LGPL - * should you choose to use a later version). - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/*** Internal: use Jsx directly. */ - -type element -type ref - -@val external null: element = "null" - -external float: float => element = "%identity" -external int: int => element = "%identity" -external string: string => element = "%identity" - -external array: array => element = "%identity" - -type componentLike<'props, 'return> = 'props => 'return -type component<'props> = componentLike<'props, element> - -/* this function exists to prepare for making `component` abstract */ -external component: componentLike<'props, element> => component<'props> = "%identity" diff --git a/jscomp/others/jsxDOMU.res b/jscomp/others/jsxDOM.res similarity index 80% rename from jscomp/others/jsxDOMU.res rename to jscomp/others/jsxDOM.res index a427376dc5..e474be3c82 100644 --- a/jscomp/others/jsxDOMU.res +++ b/jscomp/others/jsxDOM.res @@ -34,7 +34,7 @@ type domRef */ type domProps = { key?: string, - children?: JsxU.element, + children?: Jsx.element, ref?: domRef, /* accessibility */ /* https://www.w3.org/TR/wai-aria-1.1/ */ @@ -208,7 +208,7 @@ type domProps = { kind?: string /* has a fixed set of possible values */, label?: string, list?: string, - loading?: [#"lazy" | #eager], + loading?: [#lazy | #eager], loop?: bool, low?: int, manifest?: string /* uri */, @@ -264,100 +264,100 @@ type domProps = { width?: string /* in html5 this can only be a number, but in html4 it can ba a percentage as well */, wrap?: string /* "hard" or "soft" */, /* Clipboard events */ - onCopy?: JsxEventU.Clipboard.t => unit, - onCut?: JsxEventU.Clipboard.t => unit, - onPaste?: JsxEventU.Clipboard.t => unit, + onCopy?: JsxEvent.Clipboard.t => unit, + onCut?: JsxEvent.Clipboard.t => unit, + onPaste?: JsxEvent.Clipboard.t => unit, /* Composition events */ - onCompositionEnd?: JsxEventU.Composition.t => unit, - onCompositionStart?: JsxEventU.Composition.t => unit, - onCompositionUpdate?: JsxEventU.Composition.t => unit, + onCompositionEnd?: JsxEvent.Composition.t => unit, + onCompositionStart?: JsxEvent.Composition.t => unit, + onCompositionUpdate?: JsxEvent.Composition.t => unit, /* Keyboard events */ - onKeyDown?: JsxEventU.Keyboard.t => unit, - onKeyPress?: JsxEventU.Keyboard.t => unit, - onKeyUp?: JsxEventU.Keyboard.t => unit, + onKeyDown?: JsxEvent.Keyboard.t => unit, + onKeyPress?: JsxEvent.Keyboard.t => unit, + onKeyUp?: JsxEvent.Keyboard.t => unit, /* Focus events */ - onFocus?: JsxEventU.Focus.t => unit, - onBlur?: JsxEventU.Focus.t => unit, + onFocus?: JsxEvent.Focus.t => unit, + onBlur?: JsxEvent.Focus.t => unit, /* Form events */ - onBeforeInput?: JsxEventU.Form.t => unit, - onChange?: JsxEventU.Form.t => unit, - onInput?: JsxEventU.Form.t => unit, - onReset?: JsxEventU.Form.t => unit, - onSubmit?: JsxEventU.Form.t => unit, - onInvalid?: JsxEventU.Form.t => unit, + onBeforeInput?: JsxEvent.Form.t => unit, + onChange?: JsxEvent.Form.t => unit, + onInput?: JsxEvent.Form.t => unit, + onReset?: JsxEvent.Form.t => unit, + onSubmit?: JsxEvent.Form.t => unit, + onInvalid?: JsxEvent.Form.t => unit, /* Mouse events */ - onClick?: JsxEventU.Mouse.t => unit, - onContextMenu?: JsxEventU.Mouse.t => unit, - onDoubleClick?: JsxEventU.Mouse.t => unit, - onDrag?: JsxEventU.Mouse.t => unit, - onDragEnd?: JsxEventU.Mouse.t => unit, - onDragEnter?: JsxEventU.Mouse.t => unit, - onDragExit?: JsxEventU.Mouse.t => unit, - onDragLeave?: JsxEventU.Mouse.t => unit, - onDragOver?: JsxEventU.Mouse.t => unit, - onDragStart?: JsxEventU.Mouse.t => unit, - onDrop?: JsxEventU.Mouse.t => unit, - onMouseDown?: JsxEventU.Mouse.t => unit, - onMouseEnter?: JsxEventU.Mouse.t => unit, - onMouseLeave?: JsxEventU.Mouse.t => unit, - onMouseMove?: JsxEventU.Mouse.t => unit, - onMouseOut?: JsxEventU.Mouse.t => unit, - onMouseOver?: JsxEventU.Mouse.t => unit, - onMouseUp?: JsxEventU.Mouse.t => unit, + onClick?: JsxEvent.Mouse.t => unit, + onContextMenu?: JsxEvent.Mouse.t => unit, + onDoubleClick?: JsxEvent.Mouse.t => unit, + onDrag?: JsxEvent.Mouse.t => unit, + onDragEnd?: JsxEvent.Mouse.t => unit, + onDragEnter?: JsxEvent.Mouse.t => unit, + onDragExit?: JsxEvent.Mouse.t => unit, + onDragLeave?: JsxEvent.Mouse.t => unit, + onDragOver?: JsxEvent.Mouse.t => unit, + onDragStart?: JsxEvent.Mouse.t => unit, + onDrop?: JsxEvent.Mouse.t => unit, + onMouseDown?: JsxEvent.Mouse.t => unit, + onMouseEnter?: JsxEvent.Mouse.t => unit, + onMouseLeave?: JsxEvent.Mouse.t => unit, + onMouseMove?: JsxEvent.Mouse.t => unit, + onMouseOut?: JsxEvent.Mouse.t => unit, + onMouseOver?: JsxEvent.Mouse.t => unit, + onMouseUp?: JsxEvent.Mouse.t => unit, /* Selection events */ - onSelect?: JsxEventU.Selection.t => unit, + onSelect?: JsxEvent.Selection.t => unit, /* Touch events */ - onTouchCancel?: JsxEventU.Touch.t => unit, - onTouchEnd?: JsxEventU.Touch.t => unit, - onTouchMove?: JsxEventU.Touch.t => unit, - onTouchStart?: JsxEventU.Touch.t => unit, + onTouchCancel?: JsxEvent.Touch.t => unit, + onTouchEnd?: JsxEvent.Touch.t => unit, + onTouchMove?: JsxEvent.Touch.t => unit, + onTouchStart?: JsxEvent.Touch.t => unit, // Pointer events - onPointerOver?: JsxEventU.Pointer.t => unit, - onPointerEnter?: JsxEventU.Pointer.t => unit, - onPointerDown?: JsxEventU.Pointer.t => unit, - onPointerMove?: JsxEventU.Pointer.t => unit, - onPointerUp?: JsxEventU.Pointer.t => unit, - onPointerCancel?: JsxEventU.Pointer.t => unit, - onPointerOut?: JsxEventU.Pointer.t => unit, - onPointerLeave?: JsxEventU.Pointer.t => unit, - onGotPointerCapture?: JsxEventU.Pointer.t => unit, - onLostPointerCapture?: JsxEventU.Pointer.t => unit, + onPointerOver?: JsxEvent.Pointer.t => unit, + onPointerEnter?: JsxEvent.Pointer.t => unit, + onPointerDown?: JsxEvent.Pointer.t => unit, + onPointerMove?: JsxEvent.Pointer.t => unit, + onPointerUp?: JsxEvent.Pointer.t => unit, + onPointerCancel?: JsxEvent.Pointer.t => unit, + onPointerOut?: JsxEvent.Pointer.t => unit, + onPointerLeave?: JsxEvent.Pointer.t => unit, + onGotPointerCapture?: JsxEvent.Pointer.t => unit, + onLostPointerCapture?: JsxEvent.Pointer.t => unit, /* UI events */ - onScroll?: JsxEventU.UI.t => unit, + onScroll?: JsxEvent.UI.t => unit, /* Wheel events */ - onWheel?: JsxEventU.Wheel.t => unit, + onWheel?: JsxEvent.Wheel.t => unit, /* Media events */ - onAbort?: JsxEventU.Media.t => unit, - onCanPlay?: JsxEventU.Media.t => unit, - onCanPlayThrough?: JsxEventU.Media.t => unit, - onDurationChange?: JsxEventU.Media.t => unit, - onEmptied?: JsxEventU.Media.t => unit, - onEncrypted?: JsxEventU.Media.t => unit, - onEnded?: JsxEventU.Media.t => unit, - onError?: JsxEventU.Media.t => unit, - onLoadedData?: JsxEventU.Media.t => unit, - onLoadedMetadata?: JsxEventU.Media.t => unit, - onLoadStart?: JsxEventU.Media.t => unit, - onPause?: JsxEventU.Media.t => unit, - onPlay?: JsxEventU.Media.t => unit, - onPlaying?: JsxEventU.Media.t => unit, - onProgress?: JsxEventU.Media.t => unit, - onRateChange?: JsxEventU.Media.t => unit, - onSeeked?: JsxEventU.Media.t => unit, - onSeeking?: JsxEventU.Media.t => unit, - onStalled?: JsxEventU.Media.t => unit, - onSuspend?: JsxEventU.Media.t => unit, - onTimeUpdate?: JsxEventU.Media.t => unit, - onVolumeChange?: JsxEventU.Media.t => unit, - onWaiting?: JsxEventU.Media.t => unit, + onAbort?: JsxEvent.Media.t => unit, + onCanPlay?: JsxEvent.Media.t => unit, + onCanPlayThrough?: JsxEvent.Media.t => unit, + onDurationChange?: JsxEvent.Media.t => unit, + onEmptied?: JsxEvent.Media.t => unit, + onEncrypted?: JsxEvent.Media.t => unit, + onEnded?: JsxEvent.Media.t => unit, + onError?: JsxEvent.Media.t => unit, + onLoadedData?: JsxEvent.Media.t => unit, + onLoadedMetadata?: JsxEvent.Media.t => unit, + onLoadStart?: JsxEvent.Media.t => unit, + onPause?: JsxEvent.Media.t => unit, + onPlay?: JsxEvent.Media.t => unit, + onPlaying?: JsxEvent.Media.t => unit, + onProgress?: JsxEvent.Media.t => unit, + onRateChange?: JsxEvent.Media.t => unit, + onSeeked?: JsxEvent.Media.t => unit, + onSeeking?: JsxEvent.Media.t => unit, + onStalled?: JsxEvent.Media.t => unit, + onSuspend?: JsxEvent.Media.t => unit, + onTimeUpdate?: JsxEvent.Media.t => unit, + onVolumeChange?: JsxEvent.Media.t => unit, + onWaiting?: JsxEvent.Media.t => unit, /* Image events */ - onLoad?: JsxEventU.Image.t => unit /* duplicate */ /* ~onError: ReactEvent.Image.t => unit=?, */, + onLoad?: JsxEvent.Image.t => unit /* duplicate */ /* ~onError: ReactEvent.Image.t => unit=?, */, /* Animation events */ - onAnimationStart?: JsxEventU.Animation.t => unit, - onAnimationEnd?: JsxEventU.Animation.t => unit, - onAnimationIteration?: JsxEventU.Animation.t => unit, + onAnimationStart?: JsxEvent.Animation.t => unit, + onAnimationEnd?: JsxEvent.Animation.t => unit, + onAnimationIteration?: JsxEvent.Animation.t => unit, /* Transition events */ - onTransitionEnd?: JsxEventU.Transition.t => unit, + onTransitionEnd?: JsxEvent.Transition.t => unit, /* svg */ accentHeight?: string, accumulate?: string, diff --git a/jscomp/others/jsxDOMC.res b/jscomp/others/jsxDOMC.res deleted file mode 100644 index c1d709887b..0000000000 --- a/jscomp/others/jsxDOMC.res +++ /dev/null @@ -1,622 +0,0 @@ -/* Copyright (C) 2022- Authors of ReScript - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * In addition to the permissions granted to you by the LGPL, you may combine - * or link a "work that uses the Library" with a publicly distributed version - * of this file to produce a combined library or application, then distribute - * that combined work under the terms of your choosing, with no requirement - * to comply with the obligations normally placed on you by section 4 of the - * LGPL version 3 (or the corresponding section of a later version of the LGPL - * should you choose to use a later version). - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/*** Internal: use JsxDOM directly. */ - -type style = JsxDOMStyle.t -type domRef - -/* - This list isn't exhaustive. We'll add more as we go. -*/ -type domProps = { - key?: string, - children?: JsxC.element, - ref?: domRef, - /* accessibility */ - /* https://www.w3.org/TR/wai-aria-1.1/ */ - /* https://accessibilityresources.org/ is a great resource for these */ - @as("aria-current") - ariaCurrent?: [#page | #step | #location | #date | #time | #"true" | #"false"], - @as("aria-details") - ariaDetails?: string, - @as("aria-disabled") - ariaDisabled?: bool, - @as("aria-hidden") - ariaHidden?: bool, - @as("aria-invalid") ariaInvalid?: [#grammar | #"false" | #spelling | #"true"], - @as("aria-keyshortcuts") - ariaKeyshortcuts?: string, - @as("aria-label") - ariaLabel?: string, - @as("aria-roledescription") - ariaRoledescription?: string, - /* Widget Attributes */ - @as("aria-autocomplete") ariaAutocomplete?: [#inline | #list | #both | #none], - /* https://www.w3.org/TR/wai-aria-1.1/#valuetype_tristate */ - @as("aria-checked") - ariaChecked?: [#"true" | #"false" | #mixed], - @as("aria-expanded") - ariaExpanded?: bool, - @as("aria-haspopup") - ariaHaspopup?: [#menu | #listbox | #tree | #grid | #dialog | #"true" | #"false"], - @as("aria-level") - ariaLevel?: int, - @as("aria-modal") - ariaModal?: bool, - @as("aria-multiline") - ariaMultiline?: bool, - @as("aria-multiselectable") - ariaMultiselectable?: bool, - @as("aria-orientation") ariaOrientation?: [#horizontal | #vertical | #undefined], - @as("aria-placeholder") - ariaPlaceholder?: string, - /* https://www.w3.org/TR/wai-aria-1.1/#valuetype_tristate */ - @as("aria-pressed") ariaPressed?: [#"true" | #"false" | #mixed], - @as("aria-readonly") - ariaReadonly?: bool, - @as("aria-required") - ariaRequired?: bool, - @as("aria-selected") - ariaSelected?: bool, - @as("aria-sort") - ariaSort?: string, - @as("aria-valuemax") - ariaValuemax?: float, - @as("aria-valuemin") - ariaValuemin?: float, - @as("aria-valuenow") - ariaValuenow?: float, - @as("aria-valuetext") - ariaValuetext?: string, - /* Live Region Attributes */ - @as("aria-atomic") - ariaAtomic?: bool, - @as("aria-busy") - ariaBusy?: bool, - @as("aria-live") ariaLive?: [#off | #polite | #assertive | #rude], - @as("aria-relevant") - ariaRelevant?: string, - /* Drag-and-Drop Attributes */ - @as("aria-dropeffect") ariaDropeffect?: [#copy | #move | #link | #execute | #popup | #none], - @as("aria-grabbed") - ariaGrabbed?: bool, - /* Relationship Attributes */ - @as("aria-activedescendant") - ariaActivedescendant?: string, - @as("aria-colcount") - ariaColcount?: int, - @as("aria-colindex") - ariaColindex?: int, - @as("aria-colspan") - ariaColspan?: int, - @as("aria-controls") - ariaControls?: string, - @as("aria-describedby") - ariaDescribedby?: string, - @as("aria-errormessage") - ariaErrormessage?: string, - @as("aria-flowto") - ariaFlowto?: string, - @as("aria-labelledby") - ariaLabelledby?: string, - @as("aria-owns") - ariaOwns?: string, - @as("aria-posinset") - ariaPosinset?: int, - @as("aria-rowcount") - ariaRowcount?: int, - @as("aria-rowindex") - ariaRowindex?: int, - @as("aria-rowspan") - ariaRowspan?: int, - @as("aria-setsize") - ariaSetsize?: int, - /* react textarea/input */ - defaultChecked?: bool, - defaultValue?: string, - /* global html attributes */ - accessKey?: string, - className?: string /* substitute for "class" */, - contentEditable?: bool, - contextMenu?: string, - @as("data-testid") dataTestId?: string, - dir?: string /* "ltr", "rtl" or "auto" */, - draggable?: bool, - hidden?: bool, - id?: string, - lang?: string, - role?: string /* ARIA role */, - style?: style, - spellCheck?: bool, - tabIndex?: int, - title?: string, - /* html5 microdata */ - itemID?: string, - itemProp?: string, - itemRef?: string, - itemScope?: bool, - itemType?: string /* uri */, - /* tag-specific html attributes */ - accept?: string, - acceptCharset?: string, - action?: string /* uri */, - allowFullScreen?: bool, - alt?: string, - @as("as") - as_?: string, - async?: bool, - autoComplete?: string /* has a fixed, but large-ish, set of possible values */, - autoCapitalize?: string /* Mobile Safari specific */, - autoFocus?: bool, - autoPlay?: bool, - challenge?: string, - charSet?: string, - checked?: bool, - cite?: string /* uri */, - crossOrigin?: string /* anonymous, use-credentials */, - cols?: int, - colSpan?: int, - content?: string, - controls?: bool, - coords?: string /* set of values specifying the coordinates of a region */, - data?: string /* uri */, - dateTime?: string /* "valid date string with optional time" */, - default?: bool, - defer?: bool, - disabled?: bool, - download?: string /* should really be either a boolean, signifying presence, or a string */, - encType?: string /* "application/x-www-form-urlencoded", "multipart/form-data" or "text/plain" */, - form?: string, - formAction?: string /* uri */, - formTarget?: string /* "_blank", "_self", etc. */, - formMethod?: string /* "post", "get", "put" */, - headers?: string, - height?: string /* in html5 this can only be a number, but in html4 it can ba a percentage as well */, - high?: int, - href?: string /* uri */, - hrefLang?: string, - htmlFor?: string /* substitute for "for" */, - httpEquiv?: string /* has a fixed set of possible values */, - icon?: string /* uri? */, - inputMode?: string /* "verbatim", "latin", "numeric", etc. */, - integrity?: string, - keyType?: string, - kind?: string /* has a fixed set of possible values */, - label?: string, - list?: string, - loading?: [#"lazy" | #eager], - loop?: bool, - low?: int, - manifest?: string /* uri */, - max?: string /* should be int or Js.Date.t */, - maxLength?: int, - media?: string /* a valid media query */, - mediaGroup?: string, - method?: string /* "post" or "get" */, - min?: string, - minLength?: int, - multiple?: bool, - muted?: bool, - name?: string, - nonce?: string, - noValidate?: bool, - @as("open") - open_?: bool /* use this one. Previous one is deprecated */, - optimum?: int, - pattern?: string /* valid Js RegExp */, - placeholder?: string, - playsInline?: bool, - poster?: string /* uri */, - preload?: string /* "none", "metadata" or "auto" (and "" as a synonym for "auto") */, - radioGroup?: string, - readOnly?: bool, - rel?: string /* a space- or comma-separated (depending on the element) list of a fixed set of "link types" */, - required?: bool, - reversed?: bool, - rows?: int, - rowSpan?: int, - sandbox?: string /* has a fixed set of possible values */, - scope?: string /* has a fixed set of possible values */, - scoped?: bool, - scrolling?: string /* html4 only, "auto", "yes" or "no" */, - /* seamless - supported by React, but removed from the html5 spec */ - selected?: bool, - shape?: string, - size?: int, - sizes?: string, - span?: int, - src?: string /* uri */, - srcDoc?: string, - srcLang?: string, - srcSet?: string, - start?: int, - step?: float, - summary?: string /* deprecated */, - target?: string, - @as("type") - type_?: string /* has a fixed but large-ish set of possible values */ /* use this one. Previous one is deprecated */, - useMap?: string, - value?: string, - width?: string /* in html5 this can only be a number, but in html4 it can ba a percentage as well */, - wrap?: string /* "hard" or "soft" */, - /* Clipboard events */ - onCopy?: JsxEventC.Clipboard.t => unit, - onCut?: JsxEventC.Clipboard.t => unit, - onPaste?: JsxEventC.Clipboard.t => unit, - /* Composition events */ - onCompositionEnd?: JsxEventC.Composition.t => unit, - onCompositionStart?: JsxEventC.Composition.t => unit, - onCompositionUpdate?: JsxEventC.Composition.t => unit, - /* Keyboard events */ - onKeyDown?: JsxEventC.Keyboard.t => unit, - onKeyPress?: JsxEventC.Keyboard.t => unit, - onKeyUp?: JsxEventC.Keyboard.t => unit, - /* Focus events */ - onFocus?: JsxEventC.Focus.t => unit, - onBlur?: JsxEventC.Focus.t => unit, - /* Form events */ - onBeforeInput?: JsxEventC.Form.t => unit, - onChange?: JsxEventC.Form.t => unit, - onInput?: JsxEventC.Form.t => unit, - onReset?: JsxEventC.Form.t => unit, - onSubmit?: JsxEventC.Form.t => unit, - onInvalid?: JsxEventC.Form.t => unit, - /* Mouse events */ - onClick?: JsxEventC.Mouse.t => unit, - onContextMenu?: JsxEventC.Mouse.t => unit, - onDoubleClick?: JsxEventC.Mouse.t => unit, - onDrag?: JsxEventC.Mouse.t => unit, - onDragEnd?: JsxEventC.Mouse.t => unit, - onDragEnter?: JsxEventC.Mouse.t => unit, - onDragExit?: JsxEventC.Mouse.t => unit, - onDragLeave?: JsxEventC.Mouse.t => unit, - onDragOver?: JsxEventC.Mouse.t => unit, - onDragStart?: JsxEventC.Mouse.t => unit, - onDrop?: JsxEventC.Mouse.t => unit, - onMouseDown?: JsxEventC.Mouse.t => unit, - onMouseEnter?: JsxEventC.Mouse.t => unit, - onMouseLeave?: JsxEventC.Mouse.t => unit, - onMouseMove?: JsxEventC.Mouse.t => unit, - onMouseOut?: JsxEventC.Mouse.t => unit, - onMouseOver?: JsxEventC.Mouse.t => unit, - onMouseUp?: JsxEventC.Mouse.t => unit, - /* Selection events */ - onSelect?: JsxEventC.Selection.t => unit, - /* Touch events */ - onTouchCancel?: JsxEventC.Touch.t => unit, - onTouchEnd?: JsxEventC.Touch.t => unit, - onTouchMove?: JsxEventC.Touch.t => unit, - onTouchStart?: JsxEventC.Touch.t => unit, - // Pointer events - onPointerOver?: JsxEventC.Pointer.t => unit, - onPointerEnter?: JsxEventC.Pointer.t => unit, - onPointerDown?: JsxEventC.Pointer.t => unit, - onPointerMove?: JsxEventC.Pointer.t => unit, - onPointerUp?: JsxEventC.Pointer.t => unit, - onPointerCancel?: JsxEventC.Pointer.t => unit, - onPointerOut?: JsxEventC.Pointer.t => unit, - onPointerLeave?: JsxEventC.Pointer.t => unit, - onGotPointerCapture?: JsxEventC.Pointer.t => unit, - onLostPointerCapture?: JsxEventC.Pointer.t => unit, - /* UI events */ - onScroll?: JsxEventC.UI.t => unit, - /* Wheel events */ - onWheel?: JsxEventC.Wheel.t => unit, - /* Media events */ - onAbort?: JsxEventC.Media.t => unit, - onCanPlay?: JsxEventC.Media.t => unit, - onCanPlayThrough?: JsxEventC.Media.t => unit, - onDurationChange?: JsxEventC.Media.t => unit, - onEmptied?: JsxEventC.Media.t => unit, - onEncrypted?: JsxEventC.Media.t => unit, - onEnded?: JsxEventC.Media.t => unit, - onError?: JsxEventC.Media.t => unit, - onLoadedData?: JsxEventC.Media.t => unit, - onLoadedMetadata?: JsxEventC.Media.t => unit, - onLoadStart?: JsxEventC.Media.t => unit, - onPause?: JsxEventC.Media.t => unit, - onPlay?: JsxEventC.Media.t => unit, - onPlaying?: JsxEventC.Media.t => unit, - onProgress?: JsxEventC.Media.t => unit, - onRateChange?: JsxEventC.Media.t => unit, - onSeeked?: JsxEventC.Media.t => unit, - onSeeking?: JsxEventC.Media.t => unit, - onStalled?: JsxEventC.Media.t => unit, - onSuspend?: JsxEventC.Media.t => unit, - onTimeUpdate?: JsxEventC.Media.t => unit, - onVolumeChange?: JsxEventC.Media.t => unit, - onWaiting?: JsxEventC.Media.t => unit, - /* Image events */ - onLoad?: JsxEventC.Image.t => unit /* duplicate */ /* ~onError: ReactEvent.Image.t => unit=?, */, - /* Animation events */ - onAnimationStart?: JsxEventC.Animation.t => unit, - onAnimationEnd?: JsxEventC.Animation.t => unit, - onAnimationIteration?: JsxEventC.Animation.t => unit, - /* Transition events */ - onTransitionEnd?: JsxEventC.Transition.t => unit, - /* svg */ - accentHeight?: string, - accumulate?: string, - additive?: string, - alignmentBaseline?: string, - allowReorder?: string, - alphabetic?: string, - amplitude?: string, - arabicForm?: string, - ascent?: string, - attributeName?: string, - attributeType?: string, - autoReverse?: string, - azimuth?: string, - baseFrequency?: string, - baseProfile?: string, - baselineShift?: string, - bbox?: string, - begin?: string, - @deprecated("Please use begin") - begin_?: string, - bias?: string, - by?: string, - calcMode?: string, - capHeight?: string, - clip?: string, - clipPath?: string, - clipPathUnits?: string, - clipRule?: string, - colorInterpolation?: string, - colorInterpolationFilters?: string, - colorProfile?: string, - colorRendering?: string, - contentScriptType?: string, - contentStyleType?: string, - cursor?: string, - cx?: string, - cy?: string, - d?: string, - decelerate?: string, - descent?: string, - diffuseConstant?: string, - direction?: string, - display?: string, - divisor?: string, - dominantBaseline?: string, - dur?: string, - dx?: string, - dy?: string, - edgeMode?: string, - elevation?: string, - enableBackground?: string, - end?: string, - @deprecated("Please use end") - end_?: string, - exponent?: string, - externalResourcesRequired?: string, - fill?: string, - fillOpacity?: string, - fillRule?: string, - filter?: string, - filterRes?: string, - filterUnits?: string, - floodColor?: string, - floodOpacity?: string, - focusable?: string, - fontFamily?: string, - fontSize?: string, - fontSizeAdjust?: string, - fontStretch?: string, - fontStyle?: string, - fontVariant?: string, - fontWeight?: string, - fomat?: string, - from?: string, - fx?: string, - fy?: string, - g1?: string, - g2?: string, - glyphName?: string, - glyphOrientationHorizontal?: string, - glyphOrientationVertical?: string, - glyphRef?: string, - gradientTransform?: string, - gradientUnits?: string, - hanging?: string, - horizAdvX?: string, - horizOriginX?: string, - ideographic?: string, - imageRendering?: string, - @as("in") - in_?: string /* use this one. Previous one is deprecated */, - in2?: string, - intercept?: string, - k?: string, - k1?: string, - k2?: string, - k3?: string, - k4?: string, - kernelMatrix?: string, - kernelUnitLength?: string, - kerning?: string, - keyPoints?: string, - keySplines?: string, - keyTimes?: string, - lengthAdjust?: string, - letterSpacing?: string, - lightingColor?: string, - limitingConeAngle?: string, - local?: string, - markerEnd?: string, - markerHeight?: string, - markerMid?: string, - markerStart?: string, - markerUnits?: string, - markerWidth?: string, - mask?: string, - maskContentUnits?: string, - maskUnits?: string, - mathematical?: string, - mode?: string, - numOctaves?: string, - offset?: string, - opacity?: string, - operator?: string, - order?: string, - orient?: string, - orientation?: string, - origin?: string, - overflow?: string, - overflowX?: string, - overflowY?: string, - overlinePosition?: string, - overlineThickness?: string, - paintOrder?: string, - panose1?: string, - pathLength?: string, - patternContentUnits?: string, - patternTransform?: string, - patternUnits?: string, - pointerEvents?: string, - points?: string, - pointsAtX?: string, - pointsAtY?: string, - pointsAtZ?: string, - preserveAlpha?: string, - preserveAspectRatio?: string, - primitiveUnits?: string, - r?: string, - radius?: string, - refX?: string, - refY?: string, - renderingIntent?: string, - repeatCount?: string, - repeatDur?: string, - requiredExtensions?: string, - requiredFeatures?: string, - restart?: string, - result?: string, - rotate?: string, - rx?: string, - ry?: string, - scale?: string, - seed?: string, - shapeRendering?: string, - slope?: string, - spacing?: string, - specularConstant?: string, - specularExponent?: string, - speed?: string, - spreadMethod?: string, - startOffset?: string, - stdDeviation?: string, - stemh?: string, - stemv?: string, - stitchTiles?: string, - stopColor?: string, - stopOpacity?: string, - strikethroughPosition?: string, - strikethroughThickness?: string, - string?: string, - stroke?: string, - strokeDasharray?: string, - strokeDashoffset?: string, - strokeLinecap?: string, - strokeLinejoin?: string, - strokeMiterlimit?: string, - strokeOpacity?: string, - strokeWidth?: string, - surfaceScale?: string, - systemLanguage?: string, - tableValues?: string, - targetX?: string, - targetY?: string, - textAnchor?: string, - textDecoration?: string, - textLength?: string, - textRendering?: string, - to?: string, - @deprecated("Please use to") - to_?: string, - transform?: string, - u1?: string, - u2?: string, - underlinePosition?: string, - underlineThickness?: string, - unicode?: string, - unicodeBidi?: string, - unicodeRange?: string, - unitsPerEm?: string, - vAlphabetic?: string, - vHanging?: string, - vIdeographic?: string, - vMathematical?: string, - values?: string, - vectorEffect?: string, - version?: string, - vertAdvX?: string, - vertAdvY?: string, - vertOriginX?: string, - vertOriginY?: string, - viewBox?: string, - viewTarget?: string, - visibility?: string, - /* width::string? => */ - widths?: string, - wordSpacing?: string, - writingMode?: string, - x?: string, - x1?: string, - x2?: string, - xChannelSelector?: string, - xHeight?: string, - xlinkActuate?: string, - xlinkArcrole?: string, - xlinkHref?: string, - xlinkRole?: string, - xlinkShow?: string, - xlinkTitle?: string, - xlinkType?: string, - xmlns?: string, - xmlnsXlink?: string, - xmlBase?: string, - xmlLang?: string, - xmlSpace?: string, - y?: string, - y1?: string, - y2?: string, - yChannelSelector?: string, - z?: string, - zoomAndPan?: string, - /* RDFa */ - about?: string, - datatype?: string, - inlist?: string, - prefix?: string, - property?: string, - resource?: string, - typeof?: string, - vocab?: string, - /* react-specific */ - dangerouslySetInnerHTML?: {"__html": string}, - suppressContentEditableWarning?: bool, -} diff --git a/jscomp/others/jsxEventU.res b/jscomp/others/jsxEvent.res similarity index 100% rename from jscomp/others/jsxEventU.res rename to jscomp/others/jsxEvent.res diff --git a/jscomp/others/jsxEventC.res b/jscomp/others/jsxEventC.res deleted file mode 100644 index 78c27a2bf0..0000000000 --- a/jscomp/others/jsxEventC.res +++ /dev/null @@ -1,348 +0,0 @@ -/* Copyright (C) 2015-2016 Bloomberg Finance L.P. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * In addition to the permissions granted to you by the LGPL, you may combine - * or link a "work that uses the Library" with a publicly distributed version - * of this file to produce a combined library or application, then distribute - * that combined work under the terms of your choosing, with no requirement - * to comply with the obligations normally placed on you by section 4 of the - * LGPL version 3 (or the corresponding section of a later version of the LGPL - * should you choose to use a later version). - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/*** Internal: use JsxEvent directly. */ - -type synthetic<'a> - -module MakeEventWithType = ( - Type: { - type t - }, -) => { - @get external bubbles: Type.t => bool = "bubbles" - @get external cancelable: Type.t => bool = "cancelable" - @get external currentTarget: Type.t => {..} = "currentTarget" - - /* Should return Dom.eventTarget */ - @get external defaultPrevented: Type.t => bool = "defaultPrevented" - @get external eventPhase: Type.t => int = "eventPhase" - @get external isTrusted: Type.t => bool = "isTrusted" - @get external nativeEvent: Type.t => {..} = "nativeEvent" - - /* Should return Dom.event */ - @send external preventDefault: Type.t => unit = "preventDefault" - - @send external isDefaultPrevented: Type.t => bool = "isDefaultPrevented" - - @send external stopPropagation: Type.t => unit = "stopPropagation" - - @send external isPropagationStopped: Type.t => bool = "isPropagationStopped" - - @get external target: Type.t => {..} = "target" - - /* Should return Dom.eventTarget */ - @get external timeStamp: Type.t => float = "timeStamp" - @get external type_: Type.t => string = "type" - @send external persist: Type.t => unit = "persist" -} - -module Synthetic = { - type tag - type t = synthetic - - @get external bubbles: synthetic<'a> => bool = "bubbles" - @get external cancelable: synthetic<'a> => bool = "cancelable" - @get external currentTarget: synthetic<'a> => {..} = "currentTarget" - /* Should return Dom.eventTarget */ - - @get external defaultPrevented: synthetic<'a> => bool = "defaultPrevented" - - @get external eventPhase: synthetic<'a> => int = "eventPhase" - @get external isTrusted: synthetic<'a> => bool = "isTrusted" - @get external nativeEvent: synthetic<'a> => {..} = "nativeEvent" - - /* Should return Dom.event */ - @send external preventDefault: synthetic<'a> => unit = "preventDefault" - - @send external isDefaultPrevented: synthetic<'a> => bool = "isDefaultPrevented" - - @send external stopPropagation: synthetic<'a> => unit = "stopPropagation" - - @send external isPropagationStopped: synthetic<'a> => bool = "isPropagationStopped" - - @get external target: synthetic<'a> => {..} = "target" - - /* Should return Dom.eventTarget */ - @get external timeStamp: synthetic<'a> => float = "timeStamp" - @get external type_: synthetic<'a> => string = "type" - @send external persist: synthetic<'a> => unit = "persist" -} - -/* Cast any event type to the general synthetic type. This is safe, since synthetic is more general */ -external toSyntheticEvent: synthetic<'a> => Synthetic.t = "%identity" - -module Clipboard = { - type tag - type t = synthetic - - include MakeEventWithType({ - type t = t - }) - - @get external clipboardData: t => {..} = "clipboardData" - /* Should return Dom.dataTransfer */ -} - -module Composition = { - type tag - type t = synthetic - - include MakeEventWithType({ - type t = t - }) - - @get external data: t => string = "data" -} - -module Keyboard = { - type tag - type t = synthetic - - include MakeEventWithType({ - type t = t - }) - - @get external altKey: t => bool = "altKey" - @get external charCode: t => int = "charCode" - @get external ctrlKey: t => bool = "ctrlKey" - - @send external getModifierState: (t, string) => bool = "getModifierState" - - @get external key: t => string = "key" - @get external keyCode: t => int = "keyCode" - @get external locale: t => string = "locale" - @get external location: t => int = "location" - @get external metaKey: t => bool = "metaKey" - @get external repeat: t => bool = "repeat" - @get external shiftKey: t => bool = "shiftKey" - @get external which: t => int = "which" -} - -module Focus = { - type tag - type t = synthetic - - include MakeEventWithType({ - type t = t - }) - - @get @return(nullable) external relatedTarget: t => option<{..}> = "relatedTarget" - /* Should return Dom.eventTarget */ -} - -module Form = { - type tag - type t = synthetic - - include MakeEventWithType({ - type t = t - }) -} - -module Mouse = { - type tag - type t = synthetic - - include MakeEventWithType({ - type t = t - }) - - @get external altKey: t => bool = "altKey" - @get external button: t => int = "button" - @get external buttons: t => int = "buttons" - @get external clientX: t => int = "clientX" - @get external clientY: t => int = "clientY" - @get external ctrlKey: t => bool = "ctrlKey" - - @get external getModifierState: (t => string) => bool = "getModifierState" - - @get external metaKey: t => bool = "metaKey" - @get external movementX: t => int = "movementX" - @get external movementY: t => int = "movementY" - @get external pageX: t => int = "pageX" - @get external pageY: t => int = "pageY" - - @get @return(nullable) external relatedTarget: t => option<{..}> = "relatedTarget" - - /* Should return Dom.eventTarget */ - @get external screenX: t => int = "screenX" - @get external screenY: t => int = "screenY" - @get external shiftKey: t => bool = "shiftKey" -} - -module Pointer = { - type tag - type t = synthetic - - include MakeEventWithType({ - type t = t - }) - - /* UIEvent */ - @get @get - external detail: t => int = "detail" - - /* external view : t -> Dom.window = "view" */ - /* Should return DOMAbstractView/WindowProxy */ - - /* MouseEvent */ - @get external screenX: t => int = "screenX" - @get external screenY: t => int = "screenY" - @get external clientX: t => int = "clientX" - @get external clientY: t => int = "clientY" - @get external pageX: t => int = "pageX" - @get external pageY: t => int = "pageY" - @get external movementX: t => int = "movementX" - @get external movementY: t => int = "movementY" - @get external ctrlKey: t => bool = "ctrlKey" - @get external shiftKey: t => bool = "shiftKey" - @get external altKey: t => bool = "altKey" - @get external metaKey: t => bool = "metaKey" - - @get external getModifierState: (t => string) => bool = "getModifierState" - - @get external button: t => int = "button" - @get external buttons: t => int = "buttons" - - @get @return(nullable) external relatedTarget: t => option<{..}> = "relatedTarget" - /* Should return Dom.eventTarget */ - - /* PointerEvent */ - /* external pointerId : t -> Dom.eventPointerId = "pointerId" [@@get] */ - @get external width: t => float = "width" - @get external height: t => float = "height" - @get external pressure: t => float = "pressure" - @get external tangentialPressure: t => float = "tangentialPressure" - @get external tiltX: t => int = "tiltX" - @get external tiltY: t => int = "tiltY" - @get external twist: t => int = "twist" - @get external pointerType: t => string = "pointerType" - @get external isPrimary: t => bool = "isPrimary" -} - -module Selection = { - type tag - type t = synthetic - - include MakeEventWithType({ - type t = t - }) -} - -module Touch = { - type tag - type t = synthetic - - include MakeEventWithType({ - type t = t - }) - - @get external altKey: t => bool = "altKey" - @get external changedTouches: t => {..} = "changedTouches" - /* Should return Dom.touchList */ - - @get external ctrlKey: t => bool = "ctrlKey" - - @send external getModifierState: (t => string) => bool = "getModifierState" - - @get external metaKey: t => bool = "metaKey" - @get external shiftKey: t => bool = "shiftKey" - @get external targetTouches: t => {..} = "targetTouches" - /* Should return Dom.touchList */ - - @get external touches: t => {..} = "touches" - /* Should return Dom.touchList */ -} - -module UI = { - type tag - type t = synthetic - - include MakeEventWithType({ - type t = t - }) - - @get external detail: t => int = "detail" - /* external view : t -> Dom.window = "view" [@@get] */ - /* Should return DOMAbstractView/WindowProxy */ -} - -module Wheel = { - type tag - type t = synthetic - - include MakeEventWithType({ - type t = t - }) - - @get external deltaMode: t => int = "deltaMode" - @get external deltaX: t => float = "deltaX" - @get external deltaY: t => float = "deltaY" - @get external deltaZ: t => float = "deltaZ" -} - -module Media = { - type tag - type t = synthetic - - include MakeEventWithType({ - type t = t - }) -} - -module Image = { - type tag - type t = synthetic - - include MakeEventWithType({ - type t = t - }) -} - -module Animation = { - type tag - type t = synthetic - - include MakeEventWithType({ - type t = t - }) - - @get external animationName: t => string = "animationName" - @get external pseudoElement: t => string = "pseudoElement" - @get external elapsedTime: t => float = "elapsedTime" -} - -module Transition = { - type tag - type t = synthetic - - include MakeEventWithType({ - type t = t - }) - - @get external propertyName: t => string = "propertyName" - @get external pseudoElement: t => string = "pseudoElement" - @get external elapsedTime: t => float = "elapsedTime" -} diff --git a/jscomp/others/jsxPPXReactSupportU.res b/jscomp/others/jsxPPXReactSupport.res similarity index 99% rename from jscomp/others/jsxPPXReactSupportU.res rename to jscomp/others/jsxPPXReactSupport.res index a850efc120..483b28cbf0 100644 --- a/jscomp/others/jsxPPXReactSupportU.res +++ b/jscomp/others/jsxPPXReactSupport.res @@ -22,8 +22,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -module Jsx = JsxU - %%private( @val external propsWithKey: ({"key": string}, 'props) => 'props = "Object.assign" diff --git a/jscomp/others/jsxPPXReactSupportC.res b/jscomp/others/jsxPPXReactSupportC.res deleted file mode 100644 index a024d44718..0000000000 --- a/jscomp/others/jsxPPXReactSupportC.res +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (C) 2022- Authors of ReScript - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * In addition to the permissions granted to you by the LGPL, you may combine - * or link a "work that uses the Library" with a publicly distributed version - * of this file to produce a combined library or application, then distribute - * that combined work under the terms of your choosing, with no requirement - * to comply with the obligations normally placed on you by section 4 of the - * LGPL version 3 (or the corresponding section of a later version of the LGPL - * should you choose to use a later version). - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -module Jsx = JsxC - -%%private( - @val - external propsWithKey: ({"key": string}, 'props) => 'props = "Object.assign" - - @inline - let addKeyProp = (~key: option=?, p: 'props): 'props => - switch key { - | Some(key) => propsWithKey({"key": key}, p) - | None => p - } -) - -@module("react") -external createElement: (Jsx.component<'props>, 'props) => Jsx.element = "createElement" - -@variadic @module("react") -external createElementVariadic: (Jsx.component<'props>, 'props, array) => Jsx.element = - "createElement" - -let createElementWithKey = (~key=?, component, props) => - createElement(component, addKeyProp(~key?, props)) - -let createElementVariadicWithKey = (~key=?, component, props, elements) => - createElementVariadic(component, addKeyProp(~key?, props), elements) - -external asyncComponent: promise => Jsx.element = "%identity" diff --git a/jscomp/others/release.ninja b/jscomp/others/release.ninja index 21b03b82eb..24a4f60a21 100644 --- a/jscomp/others/release.ninja +++ b/jscomp/others/release.ninja @@ -11,12 +11,11 @@ rule cc_cmi o others/belt.cmj others/belt.cmi : cc others/belt.res | $bsc bsc_flags = $bsc_primitive_flags -o others/js.cmj others/js.cmi : cc others/js.ml | $bsc +o others/js.cmj others/js.cmi : cc others/js.res | $bsc bsc_flags = $bsc_primitive_flags o others/belt_internals.cmi : cc others/belt_internals.resi | $bsc bsc_flags = $bsc_primitive_flags o others/js_OO.cmi others/js_OO.cmj : cc others/js_OO.res | others/belt_internals.cmi others/js.cmi $bsc -o others/js_array.cmi others/js_array.cmj : cc others/js_array.res | others/belt_internals.cmi others/js.cmi others/js_array2.cmj $bsc o others/js_array2.cmi others/js_array2.cmj : cc others/js_array2.res | others/belt_internals.cmi others/js.cmi $bsc o others/js_bigint.cmi others/js_bigint.cmj : cc others/js_bigint.res | others/belt_internals.cmi others/js.cmi $bsc o others/js_blob.cmi others/js_blob.cmj : cc others/js_blob.res | others/belt_internals.cmi others/js.cmi $bsc @@ -32,51 +31,45 @@ o others/js_file.cmi others/js_file.cmj : cc others/js_file.res | others/belt_in o others/js_float.cmi others/js_float.cmj : cc others/js_float.res | others/belt_internals.cmi others/js.cmi $bsc o others/js_global.cmi others/js_global.cmj : cc others/js_global.res | others/belt_internals.cmi others/js.cmi $bsc o others/js_int.cmi others/js_int.cmj : cc others/js_int.res | others/belt_internals.cmi others/js.cmi $bsc -o others/js_json.cmj : cc_cmi others/js_json.res | others/belt_internals.cmi others/js.cmi others/js.cmj others/js_array2.cmj others/js_dict.cmj others/js_json.cmi others/js_string.cmj others/js_types.cmj $bsc -o others/js_json.cmi : cc others/js_json.resi | others/belt_internals.cmi others/js.cmi others/js.cmj others/js_dict.cmi others/js_null.cmi others/js_string.cmj others/js_types.cmi $bsc +o others/js_json.cmj : cc_cmi others/js_json.res | others/belt_internals.cmi others/js.cmi others/js_array2.cmj others/js_dict.cmj others/js_json.cmi others/js_types.cmj $bsc +o others/js_json.cmi : cc others/js_json.resi | others/belt_internals.cmi others/js.cmi others/js_dict.cmi others/js_null.cmi others/js_types.cmi $bsc o others/js_list.cmj : cc_cmi others/js_list.res | others/belt_internals.cmi others/js.cmi others/js_array2.cmj others/js_list.cmi others/js_vector.cmj $bsc o others/js_list.cmi : cc others/js_list.resi | others/belt_internals.cmi others/js.cmi $bsc o others/js_map.cmi others/js_map.cmj : cc others/js_map.res | others/belt_internals.cmi others/js.cmi $bsc -o others/js_mapperRt.cmj : cc_cmi others/js_mapperRt.res | others/belt_internals.cmi others/js.cmi others/js.cmj others/js_mapperRt.cmi $bsc +o others/js_mapperRt.cmj : cc_cmi others/js_mapperRt.res | others/belt_internals.cmi others/js.cmi others/js_mapperRt.cmi $bsc o others/js_mapperRt.cmi : cc others/js_mapperRt.resi | others/belt_internals.cmi others/js.cmi $bsc o others/js_math.cmi others/js_math.cmj : cc others/js_math.ml | others/belt_internals.cmi others/js.cmi others/js_int.cmj $bsc -o others/js_null.cmj : cc_cmi others/js_null.res | others/belt_internals.cmi others/js.cmi others/js.cmj others/js_exn.cmj others/js_null.cmi $bsc -o others/js_null.cmi : cc others/js_null.resi | others/belt_internals.cmi others/js.cmi others/js.cmj $bsc -o others/js_null_undefined.cmj : cc_cmi others/js_null_undefined.res | others/belt_internals.cmi others/js.cmi others/js.cmj others/js_null_undefined.cmi $bsc -o others/js_null_undefined.cmi : cc others/js_null_undefined.resi | others/belt_internals.cmi others/js.cmi others/js.cmj $bsc +o others/js_null.cmj : cc_cmi others/js_null.res | others/belt_internals.cmi others/js.cmi others/js_exn.cmj others/js_null.cmi $bsc +o others/js_null.cmi : cc others/js_null.resi | others/belt_internals.cmi others/js.cmi $bsc +o others/js_null_undefined.cmj : cc_cmi others/js_null_undefined.res | others/belt_internals.cmi others/js.cmi others/js_null_undefined.cmi $bsc +o others/js_null_undefined.cmi : cc others/js_null_undefined.resi | others/belt_internals.cmi others/js.cmi $bsc o others/js_obj.cmi others/js_obj.cmj : cc others/js_obj.res | others/belt_internals.cmi others/js.cmi $bsc o others/js_option.cmj : cc_cmi others/js_option.res | others/belt_internals.cmi others/js.cmi others/js_exn.cmj others/js_option.cmi $bsc o others/js_option.cmi : cc others/js_option.resi | others/belt_internals.cmi others/js.cmi $bsc o others/js_promise.cmi others/js_promise.cmj : cc others/js_promise.res | others/belt_internals.cmi others/js.cmi others/js_promise2.cmj $bsc o others/js_promise2.cmi others/js_promise2.cmj : cc others/js_promise2.res | others/belt_internals.cmi others/js.cmi $bsc -o others/js_re.cmi others/js_re.cmj : cc others/js_re.res | others/belt_internals.cmi others/js.cmi others/js.cmj $bsc +o others/js_re.cmi others/js_re.cmj : cc others/js_re.res | others/belt_internals.cmi others/js.cmi $bsc o others/js_result.cmj : cc_cmi others/js_result.res | others/belt_internals.cmi others/js.cmi others/js_result.cmi $bsc o others/js_result.cmi : cc others/js_result.resi | others/belt_internals.cmi others/js.cmi $bsc o others/js_set.cmi others/js_set.cmj : cc others/js_set.res | others/belt_internals.cmi others/js.cmi $bsc -o others/js_string.cmi others/js_string.cmj : cc others/js_string.res | others/belt_internals.cmi others/js.cmi others/js_array2.cmj others/js_re.cmj $bsc o others/js_string2.cmi others/js_string2.cmj : cc others/js_string2.res | others/belt_internals.cmi others/js.cmi others/js_array2.cmj others/js_re.cmj $bsc -o others/js_typed_array.cmi others/js_typed_array.cmj : cc others/js_typed_array.res | others/belt_internals.cmi others/js.cmi others/js.cmj others/js_typed_array2.cmj $bsc -o others/js_typed_array2.cmi others/js_typed_array2.cmj : cc others/js_typed_array2.res | others/belt_internals.cmi others/js.cmi others/js.cmj $bsc -o others/js_types.cmj : cc_cmi others/js_types.res | others/belt_internals.cmi others/js.cmi others/js.cmj others/js_null.cmj others/js_types.cmi $bsc +o others/js_typed_array2.cmi others/js_typed_array2.cmj : cc others/js_typed_array2.res | others/belt_internals.cmi others/js.cmi $bsc +o others/js_types.cmj : cc_cmi others/js_types.res | others/belt_internals.cmi others/js.cmi others/js_null.cmj others/js_types.cmi $bsc o others/js_types.cmi : cc others/js_types.resi | others/belt_internals.cmi others/js.cmi $bsc -o others/js_undefined.cmj : cc_cmi others/js_undefined.res | others/belt_internals.cmi others/js.cmi others/js.cmj others/js_exn.cmj others/js_undefined.cmi $bsc -o others/js_undefined.cmi : cc others/js_undefined.resi | others/belt_internals.cmi others/js.cmi others/js.cmj $bsc +o others/js_undefined.cmj : cc_cmi others/js_undefined.res | others/belt_internals.cmi others/js.cmi others/js_exn.cmj others/js_undefined.cmi $bsc +o others/js_undefined.cmi : cc others/js_undefined.resi | others/belt_internals.cmi others/js.cmi $bsc o others/js_vector.cmj : cc_cmi others/js_vector.res | others/belt_internals.cmi others/js.cmi others/js_array2.cmj others/js_vector.cmi $bsc o others/js_vector.cmi : cc others/js_vector.resi | others/belt_internals.cmi others/js.cmi $bsc o others/js_weakmap.cmi others/js_weakmap.cmj : cc others/js_weakmap.res | others/belt_internals.cmi others/js.cmi $bsc o others/js_weakset.cmi others/js_weakset.cmj : cc others/js_weakset.res | others/belt_internals.cmi others/js.cmi $bsc -o others/jsxC.cmi others/jsxC.cmj : cc others/jsxC.res | others/belt_internals.cmi others/js.cmi $bsc -o others/jsxDOMC.cmi others/jsxDOMC.cmj : cc others/jsxDOMC.res | others/belt_internals.cmi others/js.cmi others/jsxC.cmj others/jsxDOMStyle.cmj others/jsxEventC.cmj $bsc +o others/jsx.cmi others/jsx.cmj : cc others/jsx.res | others/belt_internals.cmi others/js.cmi $bsc +o others/jsxDOM.cmi others/jsxDOM.cmj : cc others/jsxDOM.res | others/belt_internals.cmi others/js.cmi others/jsx.cmj others/jsxDOMStyle.cmj others/jsxEvent.cmj $bsc o others/jsxDOMStyle.cmi others/jsxDOMStyle.cmj : cc others/jsxDOMStyle.res | others/belt_internals.cmi others/js.cmi $bsc -o others/jsxDOMU.cmi others/jsxDOMU.cmj : cc others/jsxDOMU.res | others/belt_internals.cmi others/js.cmi others/jsxDOMStyle.cmj others/jsxEventU.cmj others/jsxU.cmj $bsc -o others/jsxEventC.cmi others/jsxEventC.cmj : cc others/jsxEventC.res | others/belt_internals.cmi others/js.cmi $bsc -o others/jsxEventU.cmi others/jsxEventU.cmj : cc others/jsxEventU.res | others/belt_internals.cmi others/js.cmi $bsc -o others/jsxPPXReactSupportC.cmi others/jsxPPXReactSupportC.cmj : cc others/jsxPPXReactSupportC.res | others/belt_internals.cmi others/js.cmi others/jsxC.cmj $bsc -o others/jsxPPXReactSupportU.cmi others/jsxPPXReactSupportU.cmj : cc others/jsxPPXReactSupportU.res | others/belt_internals.cmi others/js.cmi others/jsxU.cmj $bsc -o others/jsxU.cmi others/jsxU.cmj : cc others/jsxU.res | others/belt_internals.cmi others/js.cmi $bsc -o js_pkg : phony others/js_OO.cmi others/js_OO.cmj others/js_array.cmi others/js_array.cmj others/js_array2.cmi others/js_array2.cmj others/js_bigint.cmi others/js_bigint.cmj others/js_blob.cmi others/js_blob.cmj others/js_cast.cmi others/js_cast.cmj others/js_console.cmi others/js_console.cmj others/js_date.cmi others/js_date.cmj others/js_dict.cmi others/js_dict.cmj others/js_exn.cmi others/js_exn.cmj others/js_file.cmi others/js_file.cmj others/js_float.cmi others/js_float.cmj others/js_global.cmi others/js_global.cmj others/js_int.cmi others/js_int.cmj others/js_json.cmi others/js_json.cmj others/js_list.cmi others/js_list.cmj others/js_map.cmi others/js_map.cmj others/js_mapperRt.cmi others/js_mapperRt.cmj others/js_math.cmi others/js_math.cmj others/js_null.cmi others/js_null.cmj others/js_null_undefined.cmi others/js_null_undefined.cmj others/js_obj.cmi others/js_obj.cmj others/js_option.cmi others/js_option.cmj others/js_promise.cmi others/js_promise.cmj others/js_promise2.cmi others/js_promise2.cmj others/js_re.cmi others/js_re.cmj others/js_result.cmi others/js_result.cmj others/js_set.cmi others/js_set.cmj others/js_string.cmi others/js_string.cmj others/js_string2.cmi others/js_string2.cmj others/js_typed_array.cmi others/js_typed_array.cmj others/js_typed_array2.cmi others/js_typed_array2.cmj others/js_types.cmi others/js_types.cmj others/js_undefined.cmi others/js_undefined.cmj others/js_vector.cmi others/js_vector.cmj others/js_weakmap.cmi others/js_weakmap.cmj others/js_weakset.cmi others/js_weakset.cmj others/jsxC.cmi others/jsxC.cmj others/jsxDOMC.cmi others/jsxDOMC.cmj others/jsxDOMStyle.cmi others/jsxDOMStyle.cmj others/jsxDOMU.cmi others/jsxDOMU.cmj others/jsxEventC.cmi others/jsxEventC.cmj others/jsxEventU.cmi others/jsxEventU.cmj others/jsxPPXReactSupportC.cmi others/jsxPPXReactSupportC.cmj others/jsxPPXReactSupportU.cmi others/jsxPPXReactSupportU.cmj others/jsxU.cmi others/jsxU.cmj -o others/belt_Array.cmj : cc_cmi others/belt_Array.res | others/belt.cmi others/belt_Array.cmi others/belt_internals.cmi others/js.cmi others/js.cmj others/js_math.cmj $bsc js_pkg -o others/belt_Array.cmi : cc others/belt_Array.resi | others/belt.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg +o others/jsxEvent.cmi others/jsxEvent.cmj : cc others/jsxEvent.res | others/belt_internals.cmi others/js.cmi $bsc +o others/jsxPPXReactSupport.cmi others/jsxPPXReactSupport.cmj : cc others/jsxPPXReactSupport.res | others/belt_internals.cmi others/js.cmi others/jsx.cmj $bsc +o js_pkg : phony others/js_OO.cmi others/js_OO.cmj others/js_array2.cmi others/js_array2.cmj others/js_bigint.cmi others/js_bigint.cmj others/js_blob.cmi others/js_blob.cmj others/js_cast.cmi others/js_cast.cmj others/js_console.cmi others/js_console.cmj others/js_date.cmi others/js_date.cmj others/js_dict.cmi others/js_dict.cmj others/js_exn.cmi others/js_exn.cmj others/js_file.cmi others/js_file.cmj others/js_float.cmi others/js_float.cmj others/js_global.cmi others/js_global.cmj others/js_int.cmi others/js_int.cmj others/js_json.cmi others/js_json.cmj others/js_list.cmi others/js_list.cmj others/js_map.cmi others/js_map.cmj others/js_mapperRt.cmi others/js_mapperRt.cmj others/js_math.cmi others/js_math.cmj others/js_null.cmi others/js_null.cmj others/js_null_undefined.cmi others/js_null_undefined.cmj others/js_obj.cmi others/js_obj.cmj others/js_option.cmi others/js_option.cmj others/js_promise.cmi others/js_promise.cmj others/js_promise2.cmi others/js_promise2.cmj others/js_re.cmi others/js_re.cmj others/js_result.cmi others/js_result.cmj others/js_set.cmi others/js_set.cmj others/js_string2.cmi others/js_string2.cmj others/js_typed_array2.cmi others/js_typed_array2.cmj others/js_types.cmi others/js_types.cmj others/js_undefined.cmi others/js_undefined.cmj others/js_vector.cmi others/js_vector.cmj others/js_weakmap.cmi others/js_weakmap.cmj others/js_weakset.cmi others/js_weakset.cmj others/jsx.cmi others/jsx.cmj others/jsxDOM.cmi others/jsxDOM.cmj others/jsxDOMStyle.cmi others/jsxDOMStyle.cmj others/jsxEvent.cmi others/jsxEvent.cmj others/jsxPPXReactSupport.cmi others/jsxPPXReactSupport.cmj +o others/belt_Array.cmj : cc_cmi others/belt_Array.res | others/belt.cmi others/belt_Array.cmi others/belt_internals.cmi others/js.cmi others/js_math.cmj $bsc js_pkg +o others/belt_Array.cmi : cc others/belt_Array.resi | others/belt_internals.cmi others/js.cmi $bsc o others/belt_Float.cmj : cc_cmi others/belt_Float.res | others/belt.cmi others/belt_Float.cmi others/belt_internals.cmi others/js.cmi $bsc js_pkg o others/belt_Float.cmi : cc others/belt_Float.resi | others/belt_internals.cmi others/js.cmi $bsc o others/belt_HashMap.cmj : cc_cmi others/belt_HashMap.res | others/belt.cmi others/belt_Array.cmj others/belt_HashMap.cmi others/belt_HashMapInt.cmj others/belt_HashMapString.cmj others/belt_Id.cmj others/belt_internalBuckets.cmj others/belt_internalBucketsType.cmj others/belt_internals.cmi others/js.cmi $bsc js_pkg @@ -98,29 +91,29 @@ o others/belt_Int.cmi : cc others/belt_Int.resi | others/belt_internals.cmi othe o others/belt_List.cmj : cc_cmi others/belt_List.res | others/belt.cmi others/belt_Array.cmj others/belt_List.cmi others/belt_SortArray.cmj others/belt_internals.cmi others/js.cmi $bsc js_pkg o others/belt_List.cmi : cc others/belt_List.resi | others/belt_internals.cmi others/js.cmi $bsc o others/belt_Map.cmj : cc_cmi others/belt_Map.res | others/belt.cmi others/belt_Id.cmj others/belt_Map.cmi others/belt_MapDict.cmj others/belt_MapInt.cmj others/belt_MapString.cmj others/belt_internals.cmi others/js.cmi $bsc js_pkg -o others/belt_Map.cmi : cc others/belt_Map.resi | others/belt.cmi others/belt_Id.cmi others/belt_MapDict.cmi others/belt_MapInt.cmi others/belt_MapString.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg +o others/belt_Map.cmi : cc others/belt_Map.resi | others/belt.cmi others/belt_Id.cmi others/belt_MapDict.cmi others/belt_MapInt.cmi others/belt_MapString.cmi others/belt_internals.cmi others/js.cmi $bsc js_pkg o others/belt_MapDict.cmj : cc_cmi others/belt_MapDict.res | others/belt.cmi others/belt_Array.cmj others/belt_Id.cmj others/belt_MapDict.cmi others/belt_internalAVLtree.cmj others/belt_internals.cmi others/js.cmi $bsc js_pkg -o others/belt_MapDict.cmi : cc others/belt_MapDict.resi | others/belt.cmi others/belt_Id.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg +o others/belt_MapDict.cmi : cc others/belt_MapDict.resi | others/belt.cmi others/belt_Id.cmi others/belt_internals.cmi others/js.cmi $bsc js_pkg o others/belt_MapInt.cmj : cc_cmi others/belt_MapInt.res | others/belt.cmi others/belt_Array.cmj others/belt_MapInt.cmi others/belt_internalAVLtree.cmj others/belt_internalMapInt.cmj others/belt_internals.cmi others/js.cmi $bsc js_pkg -o others/belt_MapInt.cmi : cc others/belt_MapInt.resi | others/belt.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg +o others/belt_MapInt.cmi : cc others/belt_MapInt.resi | others/belt_internals.cmi others/js.cmi $bsc o others/belt_MapString.cmj : cc_cmi others/belt_MapString.res | others/belt.cmi others/belt_Array.cmj others/belt_MapString.cmi others/belt_internalAVLtree.cmj others/belt_internalMapString.cmj others/belt_internals.cmi others/js.cmi $bsc js_pkg -o others/belt_MapString.cmi : cc others/belt_MapString.resi | others/belt.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg +o others/belt_MapString.cmi : cc others/belt_MapString.resi | others/belt_internals.cmi others/js.cmi $bsc o others/belt_MutableMap.cmj : cc_cmi others/belt_MutableMap.res | others/belt.cmi others/belt_Array.cmj others/belt_Id.cmj others/belt_MutableMap.cmi others/belt_MutableMapInt.cmj others/belt_MutableMapString.cmj others/belt_internalAVLtree.cmj others/belt_internals.cmi others/js.cmi $bsc js_pkg -o others/belt_MutableMap.cmi : cc others/belt_MutableMap.resi | others/belt.cmi others/belt_Id.cmi others/belt_MutableMapInt.cmi others/belt_MutableMapString.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg +o others/belt_MutableMap.cmi : cc others/belt_MutableMap.resi | others/belt.cmi others/belt_Id.cmi others/belt_MutableMapInt.cmi others/belt_MutableMapString.cmi others/belt_internals.cmi others/js.cmi $bsc js_pkg o others/belt_MutableMapInt.cmj : cc_cmi others/belt_MutableMapInt.res | others/belt.cmi others/belt_Array.cmj others/belt_MutableMapInt.cmi others/belt_internalAVLtree.cmj others/belt_internalMapInt.cmj others/belt_internals.cmi others/js.cmi $bsc js_pkg -o others/belt_MutableMapInt.cmi : cc others/belt_MutableMapInt.resi | others/belt.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg +o others/belt_MutableMapInt.cmi : cc others/belt_MutableMapInt.resi | others/belt_internals.cmi others/js.cmi $bsc o others/belt_MutableMapString.cmj : cc_cmi others/belt_MutableMapString.res | others/belt.cmi others/belt_Array.cmj others/belt_MutableMapString.cmi others/belt_internalAVLtree.cmj others/belt_internalMapString.cmj others/belt_internals.cmi others/js.cmi $bsc js_pkg -o others/belt_MutableMapString.cmi : cc others/belt_MutableMapString.resi | others/belt.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg -o others/belt_MutableQueue.cmj : cc_cmi others/belt_MutableQueue.res | others/belt.cmi others/belt_Array.cmj others/belt_MutableQueue.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg -o others/belt_MutableQueue.cmi : cc others/belt_MutableQueue.resi | others/belt.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg +o others/belt_MutableMapString.cmi : cc others/belt_MutableMapString.resi | others/belt_internals.cmi others/js.cmi $bsc +o others/belt_MutableQueue.cmj : cc_cmi others/belt_MutableQueue.res | others/belt.cmi others/belt_Array.cmj others/belt_MutableQueue.cmi others/belt_internals.cmi others/js.cmi $bsc js_pkg +o others/belt_MutableQueue.cmi : cc others/belt_MutableQueue.resi | others/belt_internals.cmi others/js.cmi $bsc o others/belt_MutableSet.cmj : cc_cmi others/belt_MutableSet.res | others/belt.cmi others/belt_Array.cmj others/belt_Id.cmj others/belt_MutableSet.cmi others/belt_MutableSetInt.cmj others/belt_MutableSetString.cmj others/belt_SortArray.cmj others/belt_internalAVLset.cmj others/belt_internals.cmi others/js.cmi $bsc js_pkg -o others/belt_MutableSet.cmi : cc others/belt_MutableSet.resi | others/belt.cmi others/belt_Id.cmi others/belt_MutableSetInt.cmi others/belt_MutableSetString.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg +o others/belt_MutableSet.cmi : cc others/belt_MutableSet.resi | others/belt.cmi others/belt_Id.cmi others/belt_MutableSetInt.cmi others/belt_MutableSetString.cmi others/belt_internals.cmi others/js.cmi $bsc js_pkg o others/belt_MutableSetInt.cmj : cc_cmi others/belt_MutableSetInt.res | others/belt.cmi others/belt_Array.cmj others/belt_MutableSetInt.cmi others/belt_SortArrayInt.cmj others/belt_internalAVLset.cmj others/belt_internalSetInt.cmj others/belt_internals.cmi others/js.cmi $bsc js_pkg -o others/belt_MutableSetInt.cmi : cc others/belt_MutableSetInt.resi | others/belt.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg +o others/belt_MutableSetInt.cmi : cc others/belt_MutableSetInt.resi | others/belt_internals.cmi others/js.cmi $bsc o others/belt_MutableSetString.cmj : cc_cmi others/belt_MutableSetString.res | others/belt.cmi others/belt_Array.cmj others/belt_MutableSetString.cmi others/belt_SortArrayString.cmj others/belt_internalAVLset.cmj others/belt_internalSetString.cmj others/belt_internals.cmi others/js.cmi $bsc js_pkg -o others/belt_MutableSetString.cmi : cc others/belt_MutableSetString.resi | others/belt.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg -o others/belt_MutableStack.cmj : cc_cmi others/belt_MutableStack.res | others/belt.cmi others/belt_MutableStack.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg -o others/belt_MutableStack.cmi : cc others/belt_MutableStack.resi | others/belt.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg +o others/belt_MutableSetString.cmi : cc others/belt_MutableSetString.resi | others/belt_internals.cmi others/js.cmi $bsc +o others/belt_MutableStack.cmj : cc_cmi others/belt_MutableStack.res | others/belt.cmi others/belt_MutableStack.cmi others/belt_internals.cmi others/js.cmi $bsc js_pkg +o others/belt_MutableStack.cmi : cc others/belt_MutableStack.resi | others/belt_internals.cmi others/js.cmi $bsc o others/belt_Option.cmj : cc_cmi others/belt_Option.res | others/belt.cmi others/belt_Option.cmi others/belt_internals.cmi others/js.cmi $bsc js_pkg o others/belt_Option.cmi : cc others/belt_Option.resi | others/belt_internals.cmi others/js.cmi $bsc o others/belt_Range.cmj : cc_cmi others/belt_Range.res | others/belt.cmi others/belt_Range.cmi others/belt_internals.cmi others/js.cmi $bsc js_pkg @@ -128,33 +121,33 @@ o others/belt_Range.cmi : cc others/belt_Range.resi | others/belt_internals.cmi o others/belt_Result.cmj : cc_cmi others/belt_Result.res | others/belt.cmi others/belt_Result.cmi others/belt_internals.cmi others/js.cmi $bsc js_pkg o others/belt_Result.cmi : cc others/belt_Result.resi | others/belt_internals.cmi others/js.cmi $bsc o others/belt_Set.cmj : cc_cmi others/belt_Set.res | others/belt.cmi others/belt_Id.cmj others/belt_Set.cmi others/belt_SetDict.cmj others/belt_SetInt.cmj others/belt_SetString.cmj others/belt_internals.cmi others/js.cmi $bsc js_pkg -o others/belt_Set.cmi : cc others/belt_Set.resi | others/belt.cmi others/belt_Id.cmi others/belt_SetDict.cmi others/belt_SetInt.cmi others/belt_SetString.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg +o others/belt_Set.cmi : cc others/belt_Set.resi | others/belt.cmi others/belt_Id.cmi others/belt_SetDict.cmi others/belt_SetInt.cmi others/belt_SetString.cmi others/belt_internals.cmi others/js.cmi $bsc js_pkg o others/belt_SetDict.cmj : cc_cmi others/belt_SetDict.res | others/belt.cmi others/belt_Array.cmj others/belt_Id.cmj others/belt_SetDict.cmi others/belt_internalAVLset.cmj others/belt_internals.cmi others/js.cmi $bsc js_pkg -o others/belt_SetDict.cmi : cc others/belt_SetDict.resi | others/belt.cmi others/belt_Id.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg +o others/belt_SetDict.cmi : cc others/belt_SetDict.resi | others/belt.cmi others/belt_Id.cmi others/belt_internals.cmi others/js.cmi $bsc js_pkg o others/belt_SetInt.cmj : cc_cmi others/belt_SetInt.res | others/belt.cmi others/belt_Array.cmj others/belt_SetInt.cmi others/belt_internalAVLset.cmj others/belt_internalSetInt.cmj others/belt_internals.cmi others/js.cmi $bsc js_pkg -o others/belt_SetInt.cmi : cc others/belt_SetInt.resi | others/belt.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg +o others/belt_SetInt.cmi : cc others/belt_SetInt.resi | others/belt_internals.cmi others/js.cmi $bsc o others/belt_SetString.cmj : cc_cmi others/belt_SetString.res | others/belt.cmi others/belt_Array.cmj others/belt_SetString.cmi others/belt_internalAVLset.cmj others/belt_internalSetString.cmj others/belt_internals.cmi others/js.cmi $bsc js_pkg -o others/belt_SetString.cmi : cc others/belt_SetString.resi | others/belt.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg +o others/belt_SetString.cmi : cc others/belt_SetString.resi | others/belt_internals.cmi others/js.cmi $bsc o others/belt_SortArray.cmj : cc_cmi others/belt_SortArray.res | others/belt.cmi others/belt_Array.cmj others/belt_SortArray.cmi others/belt_SortArrayInt.cmj others/belt_SortArrayString.cmj others/belt_internals.cmi others/js.cmi $bsc js_pkg o others/belt_SortArray.cmi : cc others/belt_SortArray.resi | others/belt.cmi others/belt_SortArrayInt.cmi others/belt_SortArrayString.cmi others/belt_internals.cmi others/js.cmi $bsc js_pkg o others/belt_SortArrayInt.cmj : cc_cmi others/belt_SortArrayInt.res | others/belt.cmi others/belt_Array.cmj others/belt_SortArrayInt.cmi others/belt_internals.cmi others/js.cmi $bsc js_pkg o others/belt_SortArrayInt.cmi : cc others/belt_SortArrayInt.resi | others/belt_internals.cmi others/js.cmi $bsc o others/belt_SortArrayString.cmj : cc_cmi others/belt_SortArrayString.res | others/belt.cmi others/belt_Array.cmj others/belt_SortArrayString.cmi others/belt_internals.cmi others/js.cmi $bsc js_pkg o others/belt_SortArrayString.cmi : cc others/belt_SortArrayString.resi | others/belt_internals.cmi others/js.cmi $bsc -o others/belt_internalAVLset.cmj : cc_cmi others/belt_internalAVLset.res | others/belt.cmi others/belt_Array.cmj others/belt_Id.cmj others/belt_SortArray.cmj others/belt_internalAVLset.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg -o others/belt_internalAVLset.cmi : cc others/belt_internalAVLset.resi | others/belt.cmi others/belt_Id.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg -o others/belt_internalAVLtree.cmj : cc_cmi others/belt_internalAVLtree.res | others/belt.cmi others/belt_Array.cmj others/belt_Id.cmj others/belt_SortArray.cmj others/belt_internalAVLtree.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg -o others/belt_internalAVLtree.cmi : cc others/belt_internalAVLtree.resi | others/belt.cmi others/belt_Id.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg -o others/belt_internalBuckets.cmj : cc_cmi others/belt_internalBuckets.res | others/belt.cmi others/belt_Array.cmj others/belt_internalBuckets.cmi others/belt_internalBucketsType.cmj others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg +o others/belt_internalAVLset.cmj : cc_cmi others/belt_internalAVLset.res | others/belt.cmi others/belt_Array.cmj others/belt_Id.cmj others/belt_SortArray.cmj others/belt_internalAVLset.cmi others/belt_internals.cmi others/js.cmi $bsc js_pkg +o others/belt_internalAVLset.cmi : cc others/belt_internalAVLset.resi | others/belt.cmi others/belt_Id.cmi others/belt_internals.cmi others/js.cmi $bsc js_pkg +o others/belt_internalAVLtree.cmj : cc_cmi others/belt_internalAVLtree.res | others/belt.cmi others/belt_Array.cmj others/belt_Id.cmj others/belt_SortArray.cmj others/belt_internalAVLtree.cmi others/belt_internals.cmi others/js.cmi $bsc js_pkg +o others/belt_internalAVLtree.cmi : cc others/belt_internalAVLtree.resi | others/belt.cmi others/belt_Id.cmi others/belt_internals.cmi others/js.cmi $bsc js_pkg +o others/belt_internalBuckets.cmj : cc_cmi others/belt_internalBuckets.res | others/belt.cmi others/belt_Array.cmj others/belt_internalBuckets.cmi others/belt_internalBucketsType.cmj others/belt_internals.cmi others/js.cmi $bsc js_pkg o others/belt_internalBuckets.cmi : cc others/belt_internalBuckets.resi | others/belt.cmi others/belt_internalBucketsType.cmi others/belt_internals.cmi others/js.cmi $bsc js_pkg -o others/belt_internalBucketsType.cmj : cc_cmi others/belt_internalBucketsType.res | others/belt.cmi others/belt_Array.cmj others/belt_internalBucketsType.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg -o others/belt_internalBucketsType.cmi : cc others/belt_internalBucketsType.resi | others/belt.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg -o others/belt_internalMapInt.cmi others/belt_internalMapInt.cmj : cc others/belt_internalMapInt.res | others/belt.cmi others/belt_Array.cmj others/belt_SortArray.cmj others/belt_internalAVLtree.cmj others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg -o others/belt_internalMapString.cmi others/belt_internalMapString.cmj : cc others/belt_internalMapString.res | others/belt.cmi others/belt_Array.cmj others/belt_SortArray.cmj others/belt_internalAVLtree.cmj others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg -o others/belt_internalSetBuckets.cmj : cc_cmi others/belt_internalSetBuckets.res | others/belt.cmi others/belt_Array.cmj others/belt_internalBucketsType.cmj others/belt_internalSetBuckets.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg +o others/belt_internalBucketsType.cmj : cc_cmi others/belt_internalBucketsType.res | others/belt.cmi others/belt_Array.cmj others/belt_internalBucketsType.cmi others/belt_internals.cmi others/js.cmi $bsc js_pkg +o others/belt_internalBucketsType.cmi : cc others/belt_internalBucketsType.resi | others/belt_internals.cmi others/js.cmi $bsc +o others/belt_internalMapInt.cmi others/belt_internalMapInt.cmj : cc others/belt_internalMapInt.res | others/belt.cmi others/belt_Array.cmj others/belt_SortArray.cmj others/belt_internalAVLtree.cmj others/belt_internals.cmi others/js.cmi $bsc js_pkg +o others/belt_internalMapString.cmi others/belt_internalMapString.cmj : cc others/belt_internalMapString.res | others/belt.cmi others/belt_Array.cmj others/belt_SortArray.cmj others/belt_internalAVLtree.cmj others/belt_internals.cmi others/js.cmi $bsc js_pkg +o others/belt_internalSetBuckets.cmj : cc_cmi others/belt_internalSetBuckets.res | others/belt.cmi others/belt_Array.cmj others/belt_internalBucketsType.cmj others/belt_internalSetBuckets.cmi others/belt_internals.cmi others/js.cmi $bsc js_pkg o others/belt_internalSetBuckets.cmi : cc others/belt_internalSetBuckets.resi | others/belt.cmi others/belt_internalBucketsType.cmi others/belt_internals.cmi others/js.cmi $bsc js_pkg -o others/belt_internalSetInt.cmi others/belt_internalSetInt.cmj : cc others/belt_internalSetInt.res | others/belt.cmi others/belt_Array.cmj others/belt_SortArrayInt.cmj others/belt_internalAVLset.cmj others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg -o others/belt_internalSetString.cmi others/belt_internalSetString.cmj : cc others/belt_internalSetString.res | others/belt.cmi others/belt_Array.cmj others/belt_SortArrayString.cmj others/belt_internalAVLset.cmj others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg +o others/belt_internalSetInt.cmi others/belt_internalSetInt.cmj : cc others/belt_internalSetInt.res | others/belt.cmi others/belt_Array.cmj others/belt_SortArrayInt.cmj others/belt_internalAVLset.cmj others/belt_internals.cmi others/js.cmi $bsc js_pkg +o others/belt_internalSetString.cmi others/belt_internalSetString.cmj : cc others/belt_internalSetString.res | others/belt.cmi others/belt_Array.cmj others/belt_SortArrayString.cmj others/belt_internalAVLset.cmj others/belt_internals.cmi others/js.cmi $bsc js_pkg o others/dom.cmi others/dom.cmj : cc others/dom.res | others/belt_internals.cmi others/dom_storage.cmj others/dom_storage2.cmj others/js.cmi $bsc js_pkg o others/dom_storage.cmi others/dom_storage.cmj : cc others/dom_storage.res | others/belt_internals.cmi others/dom_storage2.cmj others/js.cmi $bsc js_pkg o others/dom_storage2.cmi others/dom_storage2.cmj : cc others/dom_storage2.res | others/belt_internals.cmi others/js.cmi $bsc diff --git a/jscomp/runtime/caml_obj.res b/jscomp/runtime/caml_obj.res index cd45d644d2..f9fcff04f0 100644 --- a/jscomp/runtime/caml_obj.res +++ b/jscomp/runtime/caml_obj.res @@ -283,8 +283,8 @@ and aux_obj_compare = (a: Obj.t, b: Obj.t) => { } } - let do_key_a = do_key((a, b, min_key_rhs)) - let do_key_b = do_key((b, a, min_key_lhs)) + let do_key_a = key => do_key((a, b, min_key_rhs), key) + let do_key_b = key => do_key((b, a, min_key_lhs), key) O.for_in(a, do_key_a) O.for_in(b, do_key_b) let res = switch (min_key_lhs.contents, min_key_rhs.contents) { diff --git a/jscomp/runtime/curry.res b/jscomp/runtime/curry.res index 7d2fff69ab..7688186dbc 100644 --- a/jscomp/runtime/curry.res +++ b/jscomp/runtime/curry.res @@ -88,13 +88,13 @@ external apply8: ( %%private( let curry_1 = (o, a0, arity) => switch arity { - | 1 => apply1(Obj.magic(o), a0) - | 2 => apply2(Obj.magic(o), a0) - | 3 => apply3(Obj.magic(o), a0) - | 4 => apply4(Obj.magic(o), a0) - | 5 => apply5(Obj.magic(o), a0) - | 6 => apply6(Obj.magic(o), a0) - | 7 => apply7(Obj.magic(o), a0) + | 1 => Obj.magic(apply1)(Obj.magic(o), a0) + | 2 => Obj.magic(apply2)(Obj.magic(o), a0) + | 3 => Obj.magic(apply3)(Obj.magic(o), a0) + | 4 => Obj.magic(apply4)(Obj.magic(o), a0) + | 5 => Obj.magic(apply5)(Obj.magic(o), a0) + | 6 => Obj.magic(apply6)(Obj.magic(o), a0) + | 7 => Obj.magic(apply7)(Obj.magic(o), a0) | _ => Obj.magic(app(o, [a0])) } ) @@ -122,13 +122,13 @@ let __1 = o => { %%private( let curry_2 = (o, a0, a1, arity) => switch arity { - | 1 => app(apply1(Obj.magic(o), a0), [a1]) - | 2 => apply2(Obj.magic(o), a0, a1) - | 3 => apply3(Obj.magic(o), a0, a1) - | 4 => apply4(Obj.magic(o), a0, a1) - | 5 => apply5(Obj.magic(o), a0, a1) - | 6 => apply6(Obj.magic(o), a0, a1) - | 7 => apply7(Obj.magic(o), a0, a1) + | 1 => Obj.magic(app)(apply1(Obj.magic(o), a0), [a1]) + | 2 => Obj.magic(apply2)(Obj.magic(o), a0, a1) + | 3 => Obj.magic(apply3)(Obj.magic(o), a0, a1) + | 4 => Obj.magic(apply4)(Obj.magic(o), a0, a1) + | 5 => Obj.magic(apply5)(Obj.magic(o), a0, a1) + | 6 => Obj.magic(apply6)(Obj.magic(o), a0, a1) + | 7 => Obj.magic(apply7)(Obj.magic(o), a0, a1) | _ => Obj.magic(app(o, [a0, a1])) } ) @@ -139,7 +139,7 @@ let _2 = (o, a0, a1) => { if arity == 2 { apply2(o, a0, a1) } else { - curry_2(o, a0, a1, arity) + Obj.magic(curry_2)(o, a0, a1, arity) } } @@ -159,10 +159,10 @@ let __2 = o => { | 1 => app(apply1(Obj.magic(o), a0), [a1, a2]) | 2 => app(apply2(Obj.magic(o), a0, a1), [a2]) | 3 => apply3(Obj.magic(o), a0, a1, a2) - | 4 => apply4(Obj.magic(o), a0, a1, a2) - | 5 => apply5(Obj.magic(o), a0, a1, a2) - | 6 => apply6(Obj.magic(o), a0, a1, a2) - | 7 => apply7(Obj.magic(o), a0, a1, a2) + | 4 => Obj.magic(apply4)(Obj.magic(o), a0, a1, a2) + | 5 => Obj.magic(apply5)(Obj.magic(o), a0, a1, a2) + | 6 => Obj.magic(apply6)(Obj.magic(o), a0, a1, a2) + | 7 => Obj.magic(apply7)(Obj.magic(o), a0, a1, a2) | _ => Obj.magic(app(o, [a0, a1, a2])) } ) @@ -173,7 +173,7 @@ let _3 = (o, a0, a1, a2) => { if arity == 3 { apply3(o, a0, a1, a2) } else { - curry_3(o, a0, a1, a2, arity) + Obj.magic(curry_3)(o, a0, a1, a2, arity) } } @@ -194,9 +194,9 @@ let __3 = o => { | 2 => app(apply2(Obj.magic(o), a0, a1), [a2, a3]) | 3 => app(apply3(Obj.magic(o), a0, a1, a2), [a3]) | 4 => apply4(Obj.magic(o), a0, a1, a2, a3) - | 5 => apply5(Obj.magic(o), a0, a1, a2, a3) - | 6 => apply6(Obj.magic(o), a0, a1, a2, a3) - | 7 => apply7(Obj.magic(o), a0, a1, a2, a3) + | 5 => Obj.magic(apply5)(Obj.magic(o), a0, a1, a2, a3) + | 6 => Obj.magic(apply6)(Obj.magic(o), a0, a1, a2, a3) + | 7 => Obj.magic(apply7)(Obj.magic(o), a0, a1, a2, a3) | _ => Obj.magic(app(o, [a0, a1, a2, a3])) } ) @@ -207,7 +207,7 @@ let _4 = (o, a0, a1, a2, a3) => { if arity == 4 { apply4(o, a0, a1, a2, a3) } else { - curry_4(o, a0, a1, a2, a3, arity) + Obj.magic(curry_4)(o, a0, a1, a2, a3, arity) } } @@ -228,9 +228,9 @@ let __4 = o => { | 2 => app(apply2(Obj.magic(o), a0, a1), [a2, a3, a4]) | 3 => app(apply3(Obj.magic(o), a0, a1, a2), [a3, a4]) | 4 => app(apply4(Obj.magic(o), a0, a1, a2, a3), [a4]) - | 5 => apply5(Obj.magic(o), a0, a1, a2, a3, a4) - | 6 => apply6(Obj.magic(o), a0, a1, a2, a3, a4) - | 7 => apply7(Obj.magic(o), a0, a1, a2, a3, a4) + | 5 => Obj.magic(apply5)(Obj.magic(o), a0, a1, a2, a3, a4) + | 6 => Obj.magic(apply6)(Obj.magic(o), a0, a1, a2, a3, a4) + | 7 => Obj.magic(apply7)(Obj.magic(o), a0, a1, a2, a3, a4) | _ => Obj.magic(app(o, [a0, a1, a2, a3, a4])) } ) @@ -241,7 +241,7 @@ let _5 = (o, a0, a1, a2, a3, a4) => { if arity == 5 { apply5(o, a0, a1, a2, a3, a4) } else { - curry_5(o, a0, a1, a2, a3, a4, arity) + Obj.magic(curry_5)(o, a0, a1, a2, a3, a4, arity) } } @@ -263,8 +263,8 @@ let __5 = o => { | 3 => app(apply3(Obj.magic(o), a0, a1, a2), [a3, a4, a5]) | 4 => app(apply4(Obj.magic(o), a0, a1, a2, a3), [a4, a5]) | 5 => app(apply5(Obj.magic(o), a0, a1, a2, a3, a4), [a5]) - | 6 => apply6(Obj.magic(o), a0, a1, a2, a3, a4, a5) - | 7 => apply7(Obj.magic(o), a0, a1, a2, a3, a4, a5) + | 6 => Obj.magic(apply6)(Obj.magic(o), a0, a1, a2, a3, a4, a5) + | 7 => Obj.magic(apply7)(Obj.magic(o), a0, a1, a2, a3, a4, a5) | _ => Obj.magic(app(o, [a0, a1, a2, a3, a4, a5])) } ) @@ -275,7 +275,7 @@ let _6 = (o, a0, a1, a2, a3, a4, a5) => { if arity == 6 { apply6(o, a0, a1, a2, a3, a4, a5) } else { - curry_6(o, a0, a1, a2, a3, a4, a5, arity) + Obj.magic(curry_6)(o, a0, a1, a2, a3, a4, a5, arity) } } @@ -298,7 +298,7 @@ let __6 = o => { | 4 => app(apply4(Obj.magic(o), a0, a1, a2, a3), [a4, a5, a6]) | 5 => app(apply5(Obj.magic(o), a0, a1, a2, a3, a4), [a5, a6]) | 6 => app(apply6(Obj.magic(o), a0, a1, a2, a3, a4, a5), [a6]) - | 7 => apply7(Obj.magic(o), a0, a1, a2, a3, a4, a5, a6) + | 7 => Obj.magic(apply7)(Obj.magic(o), a0, a1, a2, a3, a4, a5, a6) | _ => Obj.magic(app(o, [a0, a1, a2, a3, a4, a5, a6])) } ) @@ -309,7 +309,7 @@ let _7 = (o, a0, a1, a2, a3, a4, a5, a6) => { if arity == 7 { apply7(o, a0, a1, a2, a3, a4, a5, a6) } else { - curry_7(o, a0, a1, a2, a3, a4, a5, a6, arity) + Obj.magic(curry_7)(o, a0, a1, a2, a3, a4, a5, a6, arity) } } @@ -343,7 +343,7 @@ let _8 = (o, a0, a1, a2, a3, a4, a5, a6, a7) => { if arity == 8 { apply8(o, a0, a1, a2, a3, a4, a5, a6, a7) } else { - curry_8(o, a0, a1, a2, a3, a4, a5, a6, a7, arity) + Obj.magic(curry_8)(o, a0, a1, a2, a3, a4, a5, a6, a7, arity) } } diff --git a/jscomp/runtime/js.ml b/jscomp/runtime/js.ml deleted file mode 100644 index 058038750f..0000000000 --- a/jscomp/runtime/js.ml +++ /dev/null @@ -1,245 +0,0 @@ -(* Copyright (C) 2015-2016 Bloomberg Finance L.P. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * In addition to the permissions granted to you by the LGPL, you may combine - * or link a "work that uses the Library" with a publicly distributed version - * of this file to produce a combined library or application, then distribute - * that combined work under the terms of your choosing, with no requirement - * to comply with the obligations normally placed on you by section 4 of the - * LGPL version 3 (or the corresponding section of a later version of the LGPL - * should you choose to use a later version). - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) - -[@@@config {flags = [|"-unboxed-types"; "-w"; "-49"|]}] -(* DESIGN: - - It does not have any code, all its code will be inlined so that - there will never be - {[ require('js')]} - - Its interface should be minimal -*) - -(** This library provides bindings and necessary support for JS FFI. - It contains all bindings into [Js] namespace. - - @example {[ - [| 1;2;3;4|] - |. Js.Array2.map (fun x -> x + 1 ) - |. Js.Array2.reduce (+) 0 - |. Js.log - ]} -*) - -(**/**) - -type 'a t = < .. > as 'a -(** Types for JS objects *) - -module MapperRt = Js_mapperRt -module Internal = struct - external opaqueFullApply : 'a -> 'a = "%uncurried_apply" - - (* Use opaque instead of [._n] to prevent some optimizations happening *) - external run : ((unit -> 'a)[@bs]) -> 'a = "#run" - external opaque : 'a -> 'a = "%opaque" -end - -(**/**) - -(** nullable, value of this type can be either [null] or ['a] - this type is the same as type [t] in {!Null} -*) -type +'a null = Value of 'a | Null [@as null] [@@unboxed] - -type +'a undefined -(** value of this type can be either [undefined] or ['a] - this type is the same as type [t] in {!Undefined} *) - -(** value of this type can be [undefined], [null] or ['a] - this type is the same as type [t] n {!Null_undefined} *) -type +'a nullable = Value of 'a | Null [@as null] | Undefined [@as undefined] -[@@unboxed] - -type +'a null_undefined = 'a nullable - -external toOption : 'a nullable -> 'a option = "#nullable_to_opt" -external undefinedToOption : 'a undefined -> 'a option = "#undefined_to_opt" -external nullToOption : 'a null -> 'a option = "#null_to_opt" - -external isNullable : 'a nullable -> bool = "#is_nullable" - -external import : 'a -> 'a promise = "#import" - -external testAny : 'a -> bool = "#is_nullable" -(** The same as {!test} except that it is more permissive on the types of input *) - -type (+'a, +'e) promise -(** The promise type, defined here for interoperation across packages - @deprecated please use {!Js.Promise} -*) - -external null : 'a null = "#null" -(** The same as [empty] in {!Js.Null} will be compiled as [null]*) - -external undefined : 'a undefined = "#undefined" -(** The same as [empty] {!Js.Undefined} will be compiled as [undefined]*) - -external typeof : 'a -> string = "#typeof" -(** [typeof x] will be compiled as [typeof x] in JS - Please consider functions in {!Types} for a type safe way of reflection -*) - -external log : 'a -> unit = "log" -[@@val] [@@scope "console"] -(** A convenience function to log everything *) - -external log2 : 'a -> 'b -> unit = "log" [@@val] [@@scope "console"] -external log3 : 'a -> 'b -> 'c -> unit = "log" [@@val] [@@scope "console"] -external log4 : 'a -> 'b -> 'c -> 'd -> unit = "log" [@@val] [@@scope "console"] - -external logMany : 'a array -> unit = "log" -[@@val] [@@scope "console"] [@@variadic] -(** A convenience function to log more than 4 arguments *) - -external eqNull : 'a -> 'a null -> bool = "%bs_equal_null" -external eqUndefined : 'a -> 'a undefined -> bool = "%bs_equal_undefined" -external eqNullable : 'a -> 'a nullable -> bool = "%bs_equal_nullable" - -(** {4 operators }*) - -external unsafe_lt : 'a -> 'a -> bool = "#unsafe_lt" -(** [unsafe_lt a b] will be compiled as [a < b]. - It is marked as unsafe, since it is impossible - to give a proper semantics for comparision which applies to any type -*) - -external unsafe_le : 'a -> 'a -> bool = "#unsafe_le" -(** [unsafe_le a b] will be compiled as [a <= b]. - See also {!unsafe_lt} -*) - -external unsafe_gt : 'a -> 'a -> bool = "#unsafe_gt" -(** [unsafe_gt a b] will be compiled as [a > b]. - See also {!unsafe_lt} -*) - -external unsafe_ge : 'a -> 'a -> bool = "#unsafe_ge" -(** [unsafe_ge a b] will be compiled as [a >= b]. - See also {!unsafe_lt} -*) - -(** {12 nested modules}*) - -module Null = Js_null -(** Provide utilities around ['a null] *) - -module Undefined = Js_undefined -(** Provide utilities around {!undefined} *) - -module Nullable = Js_null_undefined -(** Provide utilities around {!null_undefined} *) - -module Null_undefined = Js_null_undefined -(** @deprecated please use {!Js.Nullable} *) - -module Exn = Js_exn -(** Provide utilities for dealing with Js exceptions *) - -module Array = Js_array -(** Provide bindings to Js array*) - -module Array2 = Js_array2 -(** Provide bindings to Js array*) - -module String = Js_string -(** Provide bindings to JS string *) - -module String2 = Js_string2 -(** Provide bindings to JS string *) - -module Re = Js_re -(** Provide bindings to Js regex expression *) - -module Promise = Js_promise -(** Provide bindings to JS promise *) - -module Promise2 = Js_promise2 -(** Provide bindings to JS promise *) - -module Date = Js_date -(** Provide bindings for JS Date *) - -module Dict = Js_dict -(** Provide utilities for JS dictionary object *) - -module Global = Js_global -(** Provide bindings to JS global functions in global namespace*) - -module Json = Js_json -(** Provide utilities for json *) - -module Math = Js_math -(** Provide bindings for JS [Math] object *) - -module Obj = Js_obj -(** Provide utilities for {!Js.t} *) - -module Typed_array = Js_typed_array -(** Provide bindings for JS typed array *) - -module TypedArray2 = Js_typed_array2 -(** Provide bindings for JS typed array *) - -module Types = Js_types -(** Provide utilities for manipulating JS types *) - -module Float = Js_float -(** Provide utilities for JS float *) - -module Int = Js_int -(** Provide utilities for int *) - -module BigInt = Js_bigint -(** Provide utilities for bigint *) - -module File = Js_file -(** Provide utilities for File *) - -module Blob = Js_blob -(** Provide utilities for Blob *) - -module Option = Js_option -(** Provide utilities for option *) - -module Result = Js_result -(** Define the interface for result *) - -module List = Js_list -(** Provide utilities for list *) - -module Vector = Js_vector - -module Console = Js_console - -module Set = Js_set -(** Provides bindings for ES6 Set *) - -module WeakSet = Js_weakset -(** Provides bindings for ES6 WeakSet *) - -module Map = Js_map -(** Provides bindings for ES6 Map *) - -module WeakMap = Js_weakmap -(** Provides bindings for ES6 WeakMap *) diff --git a/jscomp/runtime/js.res b/jscomp/runtime/js.res new file mode 100644 index 0000000000..406c3937c7 --- /dev/null +++ b/jscomp/runtime/js.res @@ -0,0 +1,219 @@ +/* Copyright (C) 2015-2016 Bloomberg Finance L.P. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * In addition to the permissions granted to you by the LGPL, you may combine + * or link a "work that uses the Library" with a publicly distributed version + * of this file to produce a combined library or application, then distribute + * that combined work under the terms of your choosing, with no requirement + * to comply with the obligations normally placed on you by section 4 of the + * LGPL version 3 (or the corresponding section of a later version of the LGPL + * should you choose to use a later version). + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +@@config({flags: ["-unboxed-types", "-w", "-49"]}) + +/* DESIGN: + - It does not have any code, all its code will be inlined so that + there will never be + {[ require('js')]} + - Its interface should be minimal +*/ + +/** + This library provides bindings and necessary support for JS FFI. + It contains all bindings into [Js] namespace. + + @example {[ + [| 1;2;3;4|] + |. Js.Array2.map (fun x -> x + 1 ) + |. Js.Array2.reduce (+) 0 + |. Js.log + ]} +*/ + +type t<'a> = {..} as 'a +/** Types for JS objects */ + +module MapperRt = Js_mapperRt +module Internal = { + external opaqueFullApply : 'a => 'a = "%uncurried_apply" + + /* Use opaque instead of [._n] to prevent some optimizations happening */ + external run : ((unit => 'a)) => 'a = "#run" + external opaque : 'a => 'a = "%opaque" +} + + +/** nullable, value of this type can be either [null] or ['a] + this type is the same as type [t] in {!Null} +*/ +@unboxed +type null<+'a> = Value('a) | @as(null) Null + +type undefined<+'a> +/** value of this type can be either [undefined] or ['a] + this type is the same as type [t] in {!Undefined} */ + +/** value of this type can be [undefined], [null] or ['a] + this type is the same as type [t] n {!Null_undefined} */ +@unboxed +type nullable<+'a> = Value('a) | @as(null) Null| @as(undefined) Undefined + +type null_undefined<+'a> = nullable<'a> + +external toOption: nullable<'a> => option<'a> = "#nullable_to_opt" +external undefinedToOption: undefined<'a> => option<'a> = "#undefined_to_opt" +external nullToOption: null<'a> => option<'a> = "#null_to_opt" + +external isNullable: nullable<'a> => bool = "#is_nullable" + +external import: 'a => promise<'a> = "#import" + +external testAny: 'a => bool = "#is_nullable" +/** The same as {!test} except that it is more permissive on the types of input */ + +type promise<+'a, +'e> +/** The promise type, defined here for interoperation across packages + @deprecated please use {!Js.Promise} +*/ + +external null: null<'a> = "#null" +/** The same as [empty] in {!Js.Null} will be compiled as [null]*/ + +external undefined: undefined<'a> = "#undefined" +/** The same as [empty] {!Js.Undefined} will be compiled as [undefined]*/ + +external typeof: 'a => string = "#typeof" +/** [typeof x] will be compiled as [typeof x] in JS + Please consider functions in {!Types} for a type safe way of reflection +*/ + +@val @scope("console") +external log: 'a => unit = "log" +/** A convenience function to log everything */ + +@val @scope("console") +external log2: ('a, 'b) => unit = "log" +@val @scope("console") +external log3: ('a, 'b, 'c) => unit = "log" +@val @scope("console") +external log4: ('a, 'b, 'c, 'd) => unit = "log" + +@val @scope("console") @variadic +external logMany: array<'a> => unit = "log" +/** A convenience function to log more than 4 arguments */ + +external eqNull : ('a, null<'a>) => bool = "%bs_equal_null" +external eqUndefined : ('a, undefined<'a>) => bool = "%bs_equal_undefined" +external eqNullable : ('a, nullable<'a>) => bool = "%bs_equal_nullable" + +/** {4 operators }*/ + +external unsafe_lt: ('a, 'a) => bool = "#unsafe_lt" +/** [unsafe_lt a b] will be compiled as [a < b]. + It is marked as unsafe, since it is impossible + to give a proper semantics for comparision which applies to any type +*/ + +external unsafe_le: ('a, 'a) => bool = "#unsafe_le" +/** [unsafe_le a b] will be compiled as [a <= b]. + See also {!unsafe_lt} +*/ + +external unsafe_gt: ('a, 'a) => bool = "#unsafe_gt" +/** [unsafe_gt a b] will be compiled as [a > b]. + See also {!unsafe_lt} +*/ + +external unsafe_ge: ('a, 'a) => bool = "#unsafe_ge" +/** [unsafe_ge a b] will be compiled as [a >= b]. + See also {!unsafe_lt} +*/ + +/** {12 nested modules}*/ + +module Null = Js_null +/** Provide utilities around ['a null] */ + +module Undefined = Js_undefined +/** Provide utilities around {!undefined} */ + +module Nullable = Js_null_undefined +/** Provide utilities around {!null_undefined} */ + +module Null_undefined = Js_null_undefined +/** @deprecated please use {!Js.Nullable} */ + +module Exn = Js_exn + +module Array = Js_array + +module Array2 = Js_array2 + +module String = Js_string + +module String2 = Js_string2 + +module Re = Js_re + +module Promise = Js_promise + +module Promise2 = Js_promise2 + +module Date = Js_date + +module Dict = Js_dict + +module Global = Js_global + +module Json = Js_json + +module Math = Js_math + +module Obj = Js_obj + +module Typed_array = Js_typed_array + +module TypedArray2 = Js_typed_array2 + +module Types = Js_types + +module Float = Js_float + +module Int = Js_int + +module BigInt = Js_bigint + +module File = Js_file + +module Blob = Js_blob + +module Option = Js_option + +module Result = Js_result + +module List = Js_list + +module Vector = Js_vector + +module Console = Js_console + +module Set = Js_set + +module WeakSet = Js_weakset + +module Map = Js_map + +module WeakMap = Js_weakmap diff --git a/jscomp/runtime/release.ninja b/jscomp/runtime/release.ninja index d21ca55b4d..1fb2e8df6c 100644 --- a/jscomp/runtime/release.ninja +++ b/jscomp/runtime/release.ninja @@ -11,7 +11,7 @@ rule cc_cmi o runtime/bs_stdlib_mini.cmi : cc runtime/bs_stdlib_mini.resi bsc_flags = -nostdlib -nopervasives -o runtime/js.cmj runtime/js.cmi : cc runtime/js.ml +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 o runtime/caml.cmi : cc runtime/caml.resi | runtime/bs_stdlib_mini.cmi runtime/caml_int64_extern.cmj runtime/js.cmi runtime/js.cmj @@ -21,19 +21,19 @@ o runtime/caml_bigint.cmj : cc_cmi runtime/caml_bigint.res | runtime/caml_bigint o runtime/caml_bigint.cmi : cc runtime/caml_bigint.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_bytes.cmj : cc_cmi runtime/caml_bytes.res | runtime/caml_bytes.cmi o runtime/caml_bytes.cmi : cc runtime/caml_bytes.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj -o runtime/caml_exceptions.cmj : cc_cmi runtime/caml_exceptions.res | runtime/caml_exceptions.cmi runtime/js.cmj +o runtime/caml_exceptions.cmj : cc_cmi runtime/caml_exceptions.res | runtime/caml_exceptions.cmi o runtime/caml_exceptions.cmi : cc runtime/caml_exceptions.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_float.cmj : cc_cmi runtime/caml_float.res | runtime/caml_float.cmi runtime/caml_float_extern.cmj o runtime/caml_float.cmi : cc runtime/caml_float.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_format.cmj : cc_cmi runtime/caml_format.ml | runtime/caml.cmj runtime/caml_float.cmj runtime/caml_float_extern.cmj runtime/caml_format.cmi runtime/caml_int64.cmj runtime/caml_int64_extern.cmj runtime/caml_nativeint_extern.cmj runtime/caml_string_extern.cmj o runtime/caml_format.cmi : cc runtime/caml_format.mli | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj -o runtime/caml_hash.cmj : cc_cmi runtime/caml_hash.res | runtime/caml_hash.cmi runtime/caml_hash_primitive.cmj runtime/caml_nativeint_extern.cmj runtime/js.cmj +o runtime/caml_hash.cmj : cc_cmi runtime/caml_hash.res | runtime/caml_hash.cmi runtime/caml_hash_primitive.cmj runtime/caml_nativeint_extern.cmj o runtime/caml_hash.cmi : cc runtime/caml_hash.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_hash_primitive.cmj : cc_cmi runtime/caml_hash_primitive.res | runtime/caml_hash_primitive.cmi runtime/caml_string_extern.cmj o runtime/caml_hash_primitive.cmi : cc runtime/caml_hash_primitive.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_int32.cmj : cc_cmi runtime/caml_int32.res | runtime/caml_int32.cmi runtime/caml_nativeint_extern.cmj o runtime/caml_int32.cmi : cc runtime/caml_int32.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj -o runtime/caml_int64.cmj : cc_cmi runtime/caml_int64.res | runtime/caml.cmj runtime/caml_float.cmj runtime/caml_float_extern.cmj runtime/caml_int64.cmi runtime/caml_int64_extern.cmj runtime/caml_nativeint_extern.cmj runtime/caml_string_extern.cmj runtime/js.cmj +o runtime/caml_int64.cmj : cc_cmi runtime/caml_int64.res | runtime/caml.cmj runtime/caml_float.cmj runtime/caml_float_extern.cmj runtime/caml_int64.cmi runtime/caml_int64_extern.cmj runtime/caml_nativeint_extern.cmj runtime/caml_string_extern.cmj o runtime/caml_int64.cmi : cc runtime/caml_int64.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_lexer.cmj : cc_cmi runtime/caml_lexer.res | runtime/caml_lexer.cmi o runtime/caml_lexer.cmi : cc runtime/caml_lexer.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj @@ -41,9 +41,9 @@ o runtime/caml_md5.cmj : cc_cmi runtime/caml_md5.res | runtime/caml_array_extern o runtime/caml_md5.cmi : cc runtime/caml_md5.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_module.cmj : cc_cmi runtime/caml_module.res | runtime/caml_array_extern.cmj runtime/caml_module.cmi runtime/caml_obj.cmj o runtime/caml_module.cmi : cc runtime/caml_module.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj -o runtime/caml_obj.cmj : cc_cmi runtime/caml_obj.res | runtime/caml.cmj runtime/caml_array_extern.cmj runtime/caml_obj.cmi runtime/caml_option.cmj runtime/js.cmj +o runtime/caml_obj.cmj : cc_cmi runtime/caml_obj.res | runtime/caml.cmj runtime/caml_array_extern.cmj runtime/caml_obj.cmi runtime/caml_option.cmj o runtime/caml_obj.cmi : cc runtime/caml_obj.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj -o runtime/caml_option.cmj : cc_cmi runtime/caml_option.res | runtime/caml_option.cmi runtime/caml_undefined_extern.cmj runtime/js.cmj +o runtime/caml_option.cmj : cc_cmi runtime/caml_option.res | runtime/caml_option.cmi runtime/caml_undefined_extern.cmj o runtime/caml_option.cmi : cc runtime/caml_option.resi | runtime/bs_stdlib_mini.cmi runtime/caml_undefined_extern.cmj runtime/js.cmi runtime/js.cmj o runtime/caml_parser.cmj : cc_cmi runtime/caml_parser.res | runtime/caml_parser.cmi o runtime/caml_parser.cmi : cc runtime/caml_parser.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj @@ -51,7 +51,7 @@ o runtime/caml_splice_call.cmj : cc_cmi runtime/caml_splice_call.res | runtime/c o runtime/caml_splice_call.cmi : cc runtime/caml_splice_call.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_string.cmj : cc_cmi runtime/caml_string.res | runtime/caml_string.cmi runtime/caml_string_extern.cmj o runtime/caml_string.cmi : cc runtime/caml_string.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj -o runtime/caml_sys.cmj : cc_cmi runtime/caml_sys.res | runtime/caml_array_extern.cmj runtime/caml_sys.cmi runtime/caml_undefined_extern.cmj runtime/js.cmj +o runtime/caml_sys.cmj : cc_cmi runtime/caml_sys.res | runtime/caml_array_extern.cmj runtime/caml_sys.cmi runtime/caml_undefined_extern.cmj o runtime/caml_sys.cmi : cc runtime/caml_sys.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_array_extern.cmi runtime/caml_array_extern.cmj : cc runtime/caml_array_extern.res | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_bigint_extern.cmi runtime/caml_bigint_extern.cmj : cc runtime/caml_bigint_extern.res | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj diff --git a/jscomp/stdlib-406/arg.res b/jscomp/stdlib-406/arg.res index 7dadf08940..22707e9dad 100644 --- a/jscomp/stdlib-406/arg.res +++ b/jscomp/stdlib-406/arg.res @@ -109,7 +109,7 @@ let add_help = speclist => { let usage_b = (buf, speclist, errmsg) => { Buffer.add_string(buf, `${errmsg}\n`) - List.iter(print_spec(buf), add_help(speclist)) + List.iter(l => print_spec(buf, l), add_help(speclist)) } let usage_string = (speclist, errmsg) => { @@ -423,5 +423,5 @@ let align = (~limit=max_int, speclist) => { let completed = add_help(speclist) let len = List.fold_left(max_arg_len, 0, completed) let len = min(len, limit) - List.map(add_padding(len), completed) + List.map(l => add_padding(len, l), completed) } diff --git a/jscomp/stdlib-406/filename.res b/jscomp/stdlib-406/filename.res index 0dcb014b31..0703ee7de4 100644 --- a/jscomp/stdlib-406/filename.res +++ b/jscomp/stdlib-406/filename.res @@ -114,9 +114,9 @@ module Unix = { let temp_dir_name = try Sys.getenv("TMPDIR") catch { | Not_found => "/tmp" } - let quote = generic_quote("'\\''") - let basename = generic_basename(is_dir_sep, current_dir_name) - let dirname = generic_dirname(is_dir_sep, current_dir_name) + let quote = a => generic_quote("'\\''", a) + let basename = a => generic_basename(is_dir_sep, current_dir_name, a) + let dirname = a => generic_dirname(is_dir_sep, current_dir_name, a) } module Win32 = { @@ -221,8 +221,8 @@ module Cygwin = { let check_suffix = Win32.check_suffix let temp_dir_name = Unix.temp_dir_name let quote = Unix.quote - let basename = generic_basename(is_dir_sep, current_dir_name) - let dirname = generic_dirname(is_dir_sep, current_dir_name) + let basename = a => generic_basename(is_dir_sep, current_dir_name, a) + let dirname = a => generic_dirname(is_dir_sep, current_dir_name, a) } let ( diff --git a/jscomp/stdlib-406/genlex.res b/jscomp/stdlib-406/genlex.res index bb6ef2409a..1ddc7f3987 100644 --- a/jscomp/stdlib-406/genlex.res +++ b/jscomp/stdlib-406/genlex.res @@ -51,7 +51,7 @@ let get_string = () => { /* The lexer */ -let make_lexer = keywords => { +let make_lexer = (keywords, input) => { let kwd_table = Hashtbl.create(17) List.iter(s => Hashtbl.add(kwd_table, s, Kwd(s)), keywords) let ident_or_keyword = id => @@ -349,5 +349,5 @@ let make_lexer = keywords => { | _ => raise(Stream.Failure) } - input => Stream.from(_count => next_token(input)) + Stream.from(_count => next_token(input)) } diff --git a/jscomp/stdlib-406/lexing.res b/jscomp/stdlib-406/lexing.res index 2773ecb4cf..8d5fd0302e 100644 --- a/jscomp/stdlib-406/lexing.res +++ b/jscomp/stdlib-406/lexing.res @@ -161,7 +161,7 @@ let zero_pos = { } let from_function = f => { - refill_buff: lex_refill(f, Bytes.create(512)), + refill_buff: a => lex_refill(f, Bytes.create(512), a), lex_buffer: Bytes.create(1024), lex_buffer_len: 0, lex_abs_pos: 0, diff --git a/jscomp/stdlib-406/list.res b/jscomp/stdlib-406/list.res index c8ae708a4e..4aa190c89f 100644 --- a/jscomp/stdlib-406/list.res +++ b/jscomp/stdlib-406/list.res @@ -352,7 +352,7 @@ let rec find_opt = (p, param) => } } -let find_all = p => { +let find_all = (p, l) => { let rec find = (accu, param) => switch param { | list{} => rev(accu) @@ -363,7 +363,7 @@ let find_all = p => { find(accu, l) } } - find(list{}) + find(list{}, l) } let filter = find_all diff --git a/jscomp/stdlib-406/listLabels.res b/jscomp/stdlib-406/listLabels.res index 48d46d97fe..d08db5ee32 100644 --- a/jscomp/stdlib-406/listLabels.res +++ b/jscomp/stdlib-406/listLabels.res @@ -352,7 +352,7 @@ let rec find_opt = (~f as p, param) => } } -let find_all = (~f as p) => { +let find_all = (~f as p, l) => { let rec find = (accu, param) => switch param { | list{} => rev(accu) @@ -363,7 +363,7 @@ let find_all = (~f as p) => { find(accu, l) } } - find(list{}) + find(list{}, l) } let filter = find_all diff --git a/jscomp/stdlib-406/pervasives.res b/jscomp/stdlib-406/pervasives.res index 632d0b7228..5c5ecaf04f 100644 --- a/jscomp/stdlib-406/pervasives.res +++ b/jscomp/stdlib-406/pervasives.res @@ -13,15 +13,14 @@ /* */ /* ************************************************************************ */ -module Jsx = JsxC -module JsxEvent = JsxEventC -module JsxDOM = JsxDOMC -module JsxPPXReactSupport = JsxPPXReactSupportC - +module Jsx = Jsx +module JsxEvent = JsxEvent +module JsxDOM = JsxDOM +module JsxPPXReactSupport = JsxPPXReactSupport module JsxModules = { - module Jsx = JsxC - module JsxEvent = JsxEventC - module JsxDOM = JsxDOMC + module Jsx = Jsx + module JsxEvent = JsxEvent + module JsxDOM = JsxDOM } /* Internal */ @@ -165,7 +164,7 @@ type fpclass = | FP_nan let classify_float = (x: float): fpclass => - if (%raw(`isFinite`): (. _) => _)(. x) { + if (%raw(`isFinite`): _ => _)(x) { if abs_float(x) >= /* 0x1p-1022 */ /* 2.22507385850720138e-308 */ min_float { FP_normal } else if x != 0. { @@ -173,7 +172,7 @@ let classify_float = (x: float): fpclass => } else { FP_zero } - } else if (%raw(`isNaN`): (. _) => _)(. x) { + } else if (%raw(`isNaN`): _ => _)(x) { FP_nan } else { FP_infinite diff --git a/jscomp/stdlib-406/pervasives.resi b/jscomp/stdlib-406/pervasives.resi index 43407ced92..c858de3eef 100644 --- a/jscomp/stdlib-406/pervasives.resi +++ b/jscomp/stdlib-406/pervasives.resi @@ -24,22 +24,23 @@ name, without prefixing them by [Pervasives]. */ -module Jsx = JsxC -module JsxEvent = JsxEventC -module JsxDOM = JsxDOMC -module JsxPPXReactSupport = JsxPPXReactSupportC +module Jsx = Jsx +module JsxEvent = JsxEvent +module JsxDOM = JsxDOM +module JsxPPXReactSupport = JsxPPXReactSupport /* For autocomplete */ module JsxModules: { - module Jsx = JsxC - module JsxEvent = JsxEventC - module JsxDOM = JsxDOMC + module Jsx = Jsx + module JsxEvent = JsxEvent + module JsxDOM = JsxDOM // skip JsxPPXReactSupport as it's not user-facing } /* Internal */ external __unsafe_cast: 'a => 'b = "%identity" -/* 1 Exceptions} */ + +/*** {1 Exceptions} */ /** Raise the given exception value */ external raise: exn => 'a = "%raise" @@ -59,7 +60,7 @@ let failwith: string => 'a provided for use in your programs. */ exception Exit -/* {1 Comparisons} */ +/*** {1 Comparisons} */ /** [e1 = e2] tests for structural equality of [e1] and [e2]. Mutable structures (e.g. references and arrays) are equal @@ -141,7 +142,7 @@ external \"==": ('a, 'a) => bool = "%eq" Left-associative operator at precedence level 4/11. */ external \"!=": ('a, 'a) => bool = "%noteq" -/* {1 Boolean operations} */ +/*** {1 Boolean operations} */ /** The boolean negation. */ external not: bool => bool = "%boolnot" @@ -159,7 +160,7 @@ external \"&&": (bool, bool) => bool = "%sequand" */ external \"||": (bool, bool) => bool = "%sequor" -/* {1 Debugging} */ +/*** {1 Debugging} */ /** [__LOC__] returns the location at which this expression appears in the file currently being parsed by the compiler, with the standard @@ -220,7 +221,7 @@ external __LINE_OF__: 'a => (int, 'a) = "%loc_LINE" */ external __POS_OF__: 'a => ((string, int, int, int), 'a) = "%loc_POS" -/* {1 Composition operators} */ +/*** {1 Composition operators} */ /** Reverse-application operator: [x |> f |> g] is exactly equivalent to [g (f (x))]. @@ -236,9 +237,9 @@ external \"|>": ('a, 'a => 'b) => 'b = "%revapply" */ external \"@@": ('a => 'b, 'a) => 'b = "%apply" -/* {1 Integer arithmetic} */ +/*** {1 Integer arithmetic} */ -/* Integers are 31 bits wide (or 63 bits on 64-bit processors). +/*** Integers are 31 bits wide (or 63 bits on 64-bit processors). All operations are taken modulo 2{^31} (or 2{^63}). They do not fail on overflow. */ @@ -301,7 +302,7 @@ let max_int: int /** The smallest representable integer. */ let min_int: int -/* {2 Bitwise operations} */ +/*** {2 Bitwise operations} */ /** Bitwise logical and. Left-associative operator at precedence level 7/11. */ @@ -338,7 +339,7 @@ external lsr: (int, int) => int = "%lsrint" Right-associative operator at precedence level 8/11. */ external asr: (int, int) => int = "%asrint" -/* {1 Floating-point arithmetic} +/*** {1 Floating-point arithmetic} OCaml's floating-point numbers follow the IEEE 754 standard, using double precision (64 bits) numbers. @@ -563,7 +564,7 @@ let classify_float: float => fpclass Right-associative operator at precedence level 5/11. */ external \"^": (string, string) => string = "#string_append" -/* {1 Character operations} +/*** {1 Character operations} More character operations are provided in module {!Char}. */ @@ -576,7 +577,7 @@ external int_of_char: char => int = "%identity" outside the range 0--255. */ let char_of_int: int => char -/* {1 Unit operations} */ +/*** {1 Unit operations} */ /** Discard the value of its argument and return [()]. For instance, [ignore(f x)] discards the result of @@ -586,7 +587,7 @@ let char_of_int: int => char avoids the warning. */ external ignore: 'a => unit = "%ignore" -/* {1 String conversion functions} */ +/*** {1 String conversion functions} */ /** Return the string representation of a boolean. As the returned values may be shared, the user should not modify them directly. @@ -657,7 +658,7 @@ external float_of_string: string => float = "?float_of_string" */ let float_of_string_opt: string => option -/* {1 Pair operations} */ +/*** {1 Pair operations} */ /** Return the first component of a pair. */ external fst: (('a, 'b)) => 'a = "%field0" @@ -665,7 +666,7 @@ external fst: (('a, 'b)) => 'a = "%field0" /** Return the second component of a pair. */ external snd: (('a, 'b)) => 'b = "%field1" -/* {1 List operations} +/*** {1 List operations} More list operations are provided in module {!List}. */ @@ -708,7 +709,7 @@ external prerr_endline: string => unit = "error" standard error. */ let prerr_newline: unit => unit -/* {1 References} */ +/*** {1 References} */ /** The type of references (mutable indirection cells) containing a value of type ['a]. */ @@ -735,7 +736,7 @@ external incr: ref => unit = "%incr" Equivalent to [fun r -> r := pred !r]. */ external decr: ref => unit = "%decr" -/* {1 Program termination} */ +/*** {1 Program termination} */ /** Terminate the process, returning the given status code to the operating system: usually 0 to indicate no errors, diff --git a/jscomp/stdlib-406/pervasivesU.res b/jscomp/stdlib-406/pervasivesU.res deleted file mode 100644 index c044504bb7..0000000000 --- a/jscomp/stdlib-406/pervasivesU.res +++ /dev/null @@ -1,321 +0,0 @@ -/* ************************************************************************ */ -/* */ -/* OCaml */ -/* */ -/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ -/* */ -/* Copyright 1996 Institut National de Recherche en Informatique et */ -/* en Automatique. */ -/* */ -/* All rights reserved. This file is distributed under the terms of */ -/* the GNU Lesser General Public License version 2.1, with the */ -/* special exception on linking described in the file LICENSE. */ -/* */ -/* ************************************************************************ */ - -@@uncurried - -module Jsx = JsxU -module JsxEvent = JsxEventU -module JsxDOM = JsxDOMU -module JsxPPXReactSupport = JsxPPXReactSupportU -module JsxModules = { - module Jsx = JsxU - module JsxEvent = JsxEventU - module JsxDOM = JsxDOMU -} - -/* Internal */ -external __unsafe_cast: 'a => 'b = "%identity" - -/* Exceptions */ - -external raise: exn => 'a = "%raise" -external raise_notrace: exn => 'a = "%raise_notrace" - -let failwith = s => raise(Failure(s)) -let invalid_arg = s => raise(Invalid_argument(s)) - -exception Exit - -/* Composition operators */ - -external \"|>": ('a, 'a => 'b) => 'b = "%revapply" -external \"@@": ('a => 'b, 'a) => 'b = "%apply" - -/* Debugging */ - -external __LOC__: string = "%loc_LOC" -external __FILE__: string = "%loc_FILE" -external __LINE__: int = "%loc_LINE" -external __MODULE__: string = "%loc_MODULE" -external __POS__: (string, int, int, int) = "%loc_POS" - -external __LOC_OF__: 'a => (string, 'a) = "%loc_LOC" -external __LINE_OF__: 'a => (int, 'a) = "%loc_LINE" -external __POS_OF__: 'a => ((string, int, int, int), 'a) = "%loc_POS" - -/* Comparisons */ - -external \"=": ('a, 'a) => bool = "%equal" -external \"<>": ('a, 'a) => bool = "%notequal" -external \"<": ('a, 'a) => bool = "%lessthan" -external \">": ('a, 'a) => bool = "%greaterthan" -external \"<=": ('a, 'a) => bool = "%lessequal" -external \">=": ('a, 'a) => bool = "%greaterequal" -external compare: ('a, 'a) => int = "%compare" -external min: ('a, 'a) => 'a = "%bs_min" -external max: ('a, 'a) => 'a = "%bs_max" -external \"==": ('a, 'a) => bool = "%eq" -external \"!=": ('a, 'a) => bool = "%noteq" - -/* Boolean operations */ - -external not: bool => bool = "%boolnot" - -external \"&&": (bool, bool) => bool = "%sequand" - -external \"||": (bool, bool) => bool = "%sequor" - -/* Integer operations */ - -external \"~-": int => int = "%negint" -external \"~+": int => int = "%identity" -external succ: int => int = "%succint" -external pred: int => int = "%predint" -external \"+": (int, int) => int = "%addint" -external \"-": (int, int) => int = "%subint" -external \"*": (int, int) => int = "%mulint" -external \"/": (int, int) => int = "%divint" -external mod: (int, int) => int = "%modint" - -let abs = x => - if x >= 0 { - x - } else { - -x - } - -external land: (int, int) => int = "%andint" -external lor: (int, int) => int = "%orint" -external lxor: (int, int) => int = "%xorint" - -let lnot = x => lxor(x, -1) - -external lsl: (int, int) => int = "%lslint" -external lsr: (int, int) => int = "%lsrint" -external asr: (int, int) => int = "%asrint" - -let max_int = lsr(-1, 1) -let min_int = max_int + 1 - -/* Floating-point operations */ - -external \"~-.": float => float = "%negfloat" -external \"~+.": float => float = "%identity" -external \"+.": (float, float) => float = "%addfloat" -external \"-.": (float, float) => float = "%subfloat" -external \"*.": (float, float) => float = "%mulfloat" -external \"/.": (float, float) => float = "%divfloat" - -@val @scope("Math") external \"**": (float, float) => float = "pow" -@val @scope("Math") external exp: float => float = "exp" -external expm1: float => float = "?expm1_float" - -@val @scope("Math") external acos: float => float = "acos" -@val @scope("Math") external asin: float => float = "asin" -@val @scope("Math") external atan: float => float = "atan" -@val @scope("Math") external atan2: (float, float) => float = "atan2" -external hypot: (float, float) => float = "?hypot_float" - -@val @scope("Math") external cos: float => float = "cos" -@val @scope("Math") external cosh: float => float = "cosh" -@val @scope("Math") external log: float => float = "log" -@val @scope("Math") external log10: float => float = "log10" -@val @scope("Math") external log1p: float => float = "log1p" -@val @scope("Math") external sin: float => float = "sin" -@val @scope("Math") external sinh: float => float = "sinh" -@val @scope("Math") external sqrt: float => float = "sqrt" -@val @scope("Math") external tan: float => float = "tan" -@val @scope("Math") external tanh: float => float = "tanh" -@val @scope("Math") external ceil: float => float = "ceil" -@val @scope("Math") external floor: float => float = "floor" -@val @scope("Math") external abs_float: float => float = "abs" -external copysign: (float, float) => float = "?copysign_float" -external mod_float: (float, float) => float = "?fmod_float" -external frexp: float => (float, int) = "?frexp_float" -external ldexp: (float, int) => float = "?ldexp_float" -external modf: float => (float, float) = "?modf_float" -external float: int => float = "%floatofint" -external float_of_int: int => float = "%floatofint" -external truncate: float => int = "%intoffloat" -external int_of_float: float => int = "%intoffloat" - -let infinity = 0x1p2047 -let neg_infinity = -0x1p2047 -@val @scope("Number") external nan: float = "NaN" -let max_float = 1.79769313486231571e+308 /* 0x1.ffff_ffff_ffff_fp+1023 */ -let min_float = 2.22507385850720138e-308 /* 0x1p-1022 */ -let epsilon_float = 2.22044604925031308e-16 /* 0x1p-52 */ - -type fpclass = - | FP_normal - | FP_subnormal - | FP_zero - | FP_infinite - | FP_nan - -let classify_float = (x: float): fpclass => - if (%raw(`isFinite`): _ => _)(x) { - if abs_float(x) >= /* 0x1p-1022 */ /* 2.22507385850720138e-308 */ min_float { - FP_normal - } else if x != 0. { - FP_subnormal - } else { - FP_zero - } - } else if (%raw(`isNaN`): _ => _)(x) { - FP_nan - } else { - FP_infinite - } - -/* String and byte sequence operations -- more in modules String and Bytes */ - -external string_length: string => int = "%string_length" - -external \"^": (string, string) => string = "#string_append" -/* Character operations -- more in module Char */ - -external int_of_char: char => int = "%identity" -external unsafe_char_of_int: int => char = "%identity" -let char_of_int = n => - if n < 0 || n > 255 { - invalid_arg("char_of_int") - } else { - unsafe_char_of_int(n) - } - -/* Unit operations */ - -external ignore: 'a => unit = "%ignore" - -/* Pair operations */ - -external fst: (('a, 'b)) => 'a = "%field0" -external snd: (('a, 'b)) => 'b = "%field1" - -/* References */ - -type ref<'a> = {mutable contents: 'a} -external ref: 'a => ref<'a> = "%makemutable" -external \"!": ref<'a> => 'a = "%bs_ref_field0" -external \":=": (ref<'a>, 'a) => unit = "%bs_ref_setfield0" -external incr: ref => unit = "%incr" -external decr: ref => unit = "%decr" - -/* String conversion functions */ -external format_float: (string, float) => string = "?format_float" - -let string_of_bool = b => - if b { - "true" - } else { - "false" - } -let bool_of_string = param => - switch param { - | "true" => true - | "false" => false - | _ => invalid_arg("bool_of_string") - } - -let bool_of_string_opt = param => - switch param { - | "true" => Some(true) - | "false" => Some(false) - | _ => None - } - -@val external string_of_int: int => string = "String" - -external int_of_string: string => int = "?int_of_string" - -let int_of_string_opt = s => - /* TODO: provide this directly as a non-raising primitive. */ - try Some(int_of_string(s)) catch { - | Failure(_) => None - } - -external string_get: (string, int) => char = "%string_safe_get" - -let valid_float_lexem = s => { - let l = string_length(s) - let rec loop = i => - if i >= l { - s ++ "." - } else { - switch string_get(s, i) { - | '0' .. '9' | '-' => loop(i + 1) - | _ => s - } - } - - loop(0) -} - -let string_of_float = f => valid_float_lexem(format_float("%.12g", f)) - -external float_of_string: string => float = "?float_of_string" - -let float_of_string_opt = s => - /* TODO: provide this directly as a non-raising primitive. */ - try Some(float_of_string(s)) catch { - | Failure(_) => None - } - -/* List operations -- more in module List */ - -let rec \"@" = (l1, l2) => - switch l1 { - | list{} => l2 - | list{hd, ...tl} => list{hd, ...\"@"(tl, l2)} - } - -/* Output functions on standard output */ - -@val @scope("console") external print_endline: string => unit = "log" -let print_newline = () => print_endline("") - -/* Output functions on standard error */ - -@val @scope("console") external prerr_endline: string => unit = "error" -let prerr_newline = () => prerr_endline("") - -let print_int = (i: int) => print_endline(string_of_int(i)) -let print_float = (i: float) => print_endline(string_of_float(i)) -let print_string = print_endline - -/* Miscellaneous */ - -external sys_exit: int => 'a = "?sys_exit" - -let exit_function = ref(ignore) - -let at_exit = f => { - let g = exit_function.contents - exit_function := - () => { - f() - g() - } -} - -let do_at_exit = () => exit_function.contents() - -let exit = retcode => { - do_at_exit() - sys_exit(retcode) -} - -type int32 = int diff --git a/jscomp/stdlib-406/pervasivesU.resi b/jscomp/stdlib-406/pervasivesU.resi deleted file mode 100644 index 4b0f05928b..0000000000 --- a/jscomp/stdlib-406/pervasivesU.resi +++ /dev/null @@ -1,763 +0,0 @@ -/* ************************************************************************ */ -/* */ -/* OCaml */ -/* */ -/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ -/* */ -/* Copyright 1996 Institut National de Recherche en Informatique et */ -/* en Automatique. */ -/* */ -/* All rights reserved. This file is distributed under the terms of */ -/* the GNU Lesser General Public License version 2.1, with the */ -/* special exception on linking described in the file LICENSE. */ -/* */ -/* ************************************************************************ */ - -/*** The initially opened module. - - This module provides the basic operations over the built-in types - (numbers, booleans, byte sequences, strings, exceptions, references, - lists, arrays, input-output channels, ...). - - This module is automatically opened at the beginning of each compilation. - All components of this module can therefore be referred by their short - name, without prefixing them by [Pervasives]. -*/ - -@@uncurried - -module Jsx = JsxU -module JsxEvent = JsxEventU -module JsxDOM = JsxDOMU -module JsxPPXReactSupport = JsxPPXReactSupportU - -/* For autocomplete */ -module JsxModules: { - module Jsx = JsxU - module JsxEvent = JsxEventU - module JsxDOM = JsxDOMU - // skip JsxPPXReactSupport as it's not user-facing -} - -/* Internal */ -external __unsafe_cast: 'a => 'b = "%identity" - -/*** {1 Exceptions} */ - -/** Raise the given exception value */ -external raise: exn => 'a = "%raise" - -/** A faster version [raise] which does not record the backtrace. - @since 4.02.0 -*/ -external raise_notrace: exn => 'a = "%raise_notrace" - -/** Raise exception [Invalid_argument] with the given string. */ -let invalid_arg: string => 'a - -/** Raise exception [Failure] with the given string. */ -let failwith: string => 'a - -/** The [Exit] exception is not raised by any library function. It is - provided for use in your programs. */ -exception Exit - -/*** {1 Comparisons} */ - -/** [e1 = e2] tests for structural equality of [e1] and [e2]. - Mutable structures (e.g. references and arrays) are equal - if and only if their current contents are structurally equal, - even if the two mutable objects are not the same physical object. - Equality between functional values raises [Invalid_argument]. - Equality between cyclic data structures may not terminate. - Left-associative operator at precedence level 4/11. */ -external \"=": ('a, 'a) => bool = "%equal" - -/** Negation of {!Pervasives.( = )}. - Left-associative operator at precedence level 4/11. */ -external \"<>": ('a, 'a) => bool = "%notequal" - -/** See {!Pervasives.( >= )}. - Left-associative operator at precedence level 4/11. */ -external \"<": ('a, 'a) => bool = "%lessthan" - -/** See {!Pervasives.( >= )}. - Left-associative operator at precedence level 4/11. */ -external \">": ('a, 'a) => bool = "%greaterthan" - -/** See {!Pervasives.( >= )}. - Left-associative operator at precedence level 4/11. */ -external \"<=": ('a, 'a) => bool = "%lessequal" - -/** Structural ordering functions. These functions coincide with - the usual orderings over integers, characters, strings, byte sequences - and floating-point numbers, and extend them to a - total ordering over all types. - The ordering is compatible with [( = )]. As in the case - of [( = )], mutable structures are compared by contents. - Comparison between functional values raises [Invalid_argument]. - Comparison between cyclic structures may not terminate. - Left-associative operator at precedence level 4/11. */ -external \">=": ('a, 'a) => bool = "%greaterequal" - -/** [compare x y] returns [0] if [x] is equal to [y], - a negative integer if [x] is less than [y], and a positive integer - if [x] is greater than [y]. The ordering implemented by [compare] - is compatible with the comparison predicates [=], [<] and [>] - defined above, with one difference on the treatment of the float value - {!Pervasives.nan}. Namely, the comparison predicates treat [nan] - as different from any other float value, including itself; - while [compare] treats [nan] as equal to itself and less than any - other float value. This treatment of [nan] ensures that [compare] - defines a total ordering relation. - - [compare] applied to functional values may raise [Invalid_argument]. - [compare] applied to cyclic structures may not terminate. - - The [compare] function can be used as the comparison function - required by the {!Set.Make} and {!Map.Make} functors, as well as - the {!List.sort} and {!Array.sort} functions. */ -external compare: ('a, 'a) => int = "%compare" - -/** Return the smaller of the two arguments. - The result is unspecified if one of the arguments contains - the float value [nan]. */ -external min: ('a, 'a) => 'a = "%bs_min" - -/** Return the greater of the two arguments. - The result is unspecified if one of the arguments contains - the float value [nan]. */ -external max: ('a, 'a) => 'a = "%bs_max" - -/** [e1 == e2] tests for physical equality of [e1] and [e2]. - On mutable types such as references, arrays, byte sequences, records with - mutable fields and objects with mutable instance variables, - [e1 == e2] is true if and only if physical modification of [e1] - also affects [e2]. - On non-mutable types, the behavior of [( == )] is - implementation-dependent; however, it is guaranteed that - [e1 == e2] implies [compare e1 e2 = 0]. - Left-associative operator at precedence level 4/11. */ -external \"==": ('a, 'a) => bool = "%eq" - -/** Negation of {!Pervasives.( == )}. - Left-associative operator at precedence level 4/11. */ -external \"!=": ('a, 'a) => bool = "%noteq" - -/*** {1 Boolean operations} */ - -/** The boolean negation. */ -external not: bool => bool = "%boolnot" - -/** The boolean 'and'. Evaluation is sequential, left-to-right: - in [e1 && e2], [e1] is evaluated first, and if it returns [false], - [e2] is not evaluated at all. - Right-associative operator at precedence level 3/11. */ -external \"&&": (bool, bool) => bool = "%sequand" - -/** The boolean 'or'. Evaluation is sequential, left-to-right: - in [e1 || e2], [e1] is evaluated first, and if it returns [true], - [e2] is not evaluated at all. - Right-associative operator at precedence level 2/11. -*/ -external \"||": (bool, bool) => bool = "%sequor" - -/*** {1 Debugging} */ - -/** [__LOC__] returns the location at which this expression appears in - the file currently being parsed by the compiler, with the standard - error format of OCaml: "File %S, line %d, characters %d-%d". - @since 4.02.0 -*/ -external __LOC__: string = "%loc_LOC" - -/** [__FILE__] returns the name of the file currently being - parsed by the compiler. - @since 4.02.0 -*/ -external __FILE__: string = "%loc_FILE" - -/** [__LINE__] returns the line number at which this expression - appears in the file currently being parsed by the compiler. - @since 4.02.0 -*/ -external __LINE__: int = "%loc_LINE" - -/** [__MODULE__] returns the module name of the file being - parsed by the compiler. - @since 4.02.0 -*/ -external __MODULE__: string = "%loc_MODULE" - -/** [__POS__] returns a tuple [(file,lnum,cnum,enum)], corresponding - to the location at which this expression appears in the file - currently being parsed by the compiler. [file] is the current - filename, [lnum] the line number, [cnum] the character position in - the line and [enum] the last character position in the line. - @since 4.02.0 - */ -external __POS__: (string, int, int, int) = "%loc_POS" - -/** [__LOC_OF__ expr] returns a pair [(loc, expr)] where [loc] is the - location of [expr] in the file currently being parsed by the - compiler, with the standard error format of OCaml: "File %S, line - %d, characters %d-%d". - @since 4.02.0 -*/ -external __LOC_OF__: 'a => (string, 'a) = "%loc_LOC" - -/** [__LINE__ expr] returns a pair [(line, expr)], where [line] is the - line number at which the expression [expr] appears in the file - currently being parsed by the compiler. - @since 4.02.0 - */ -external __LINE_OF__: 'a => (int, 'a) = "%loc_LINE" - -/** [__POS_OF__ expr] returns a pair [(loc,expr)], where [loc] is a - tuple [(file,lnum,cnum,enum)] corresponding to the location at - which the expression [expr] appears in the file currently being - parsed by the compiler. [file] is the current filename, [lnum] the - line number, [cnum] the character position in the line and [enum] - the last character position in the line. - @since 4.02.0 - */ -external __POS_OF__: 'a => ((string, int, int, int), 'a) = "%loc_POS" - -/*** {1 Composition operators} */ - -/** Reverse-application operator: [x |> f |> g] is exactly equivalent - to [g (f (x))]. - Left-associative operator at precedence level 4/11. - @since 4.01 - */ -external \"|>": ('a, 'a => 'b) => 'b = "%revapply" - -/** Application operator: [g @@ f @@ x] is exactly equivalent to - [g (f (x))]. - Right-associative operator at precedence level 5/11. - @since 4.01 -*/ -external \"@@": ('a => 'b, 'a) => 'b = "%apply" - -/*** {1 Integer arithmetic} */ - -/*** Integers are 31 bits wide (or 63 bits on 64-bit processors). - All operations are taken modulo 2{^31} (or 2{^63}). - They do not fail on overflow. */ - -/** Unary negation. You can also write [- e] instead of [~- e]. - Unary operator at precedence level 9/11 for [- e] - and 11/11 for [~- e]. */ -external \"~-": int => int = "%negint" - -/** Unary addition. You can also write [+ e] instead of [~+ e]. - Unary operator at precedence level 9/11 for [+ e] - and 11/11 for [~+ e]. - @since 3.12.0 -*/ -external \"~+": int => int = "%identity" - -/** [succ x] is [x + 1]. */ -external succ: int => int = "%succint" - -/** [pred x] is [x - 1]. */ -external pred: int => int = "%predint" - -/** Integer addition. - Left-associative operator at precedence level 6/11. */ -external \"+": (int, int) => int = "%addint" - -/** Integer subtraction. - Left-associative operator at precedence level 6/11. */ -external \"-": (int, int) => int = "%subint" - -/** Integer multiplication. - Left-associative operator at precedence level 7/11. */ -external \"*": (int, int) => int = "%mulint" - -/** Integer division. - Raise [Division_by_zero] if the second argument is 0. - Integer division rounds the real quotient of its arguments towards zero. - More precisely, if [x >= 0] and [y > 0], [x / y] is the greatest integer - less than or equal to the real quotient of [x] by [y]. Moreover, - [(- x) / y = x / (- y) = - (x / y)]. - Left-associative operator at precedence level 7/11. */ -external \"/": (int, int) => int = "%divint" - -/** Integer remainder. If [y] is not zero, the result - of [x mod y] satisfies the following properties: - [x = (x / y) * y + x mod y] and - [abs(x mod y) <= abs(y) - 1]. - If [y = 0], [x mod y] raises [Division_by_zero]. - Note that [x mod y] is negative only if [x < 0]. - Raise [Division_by_zero] if [y] is zero. - Left-associative operator at precedence level 7/11. */ -external mod: (int, int) => int = "%modint" - -/** Return the absolute value of the argument. Note that this may be - negative if the argument is [min_int]. */ -let abs: int => int - -/** The greatest representable integer. */ -let max_int: int - -/** The smallest representable integer. */ -let min_int: int - -/*** {2 Bitwise operations} */ - -/** Bitwise logical and. - Left-associative operator at precedence level 7/11. */ -external land: (int, int) => int = "%andint" - -/** Bitwise logical or. - Left-associative operator at precedence level 7/11. */ -external lor: (int, int) => int = "%orint" - -/** Bitwise logical exclusive or. - Left-associative operator at precedence level 7/11. */ -external lxor: (int, int) => int = "%xorint" - -/** Bitwise logical negation. */ -let lnot: int => int - -/** [n lsl m] shifts [n] to the left by [m] bits. - The result is unspecified if [m < 0] or [m >= bitsize], - where [bitsize] is [32] on a 32-bit platform and - [64] on a 64-bit platform. - Right-associative operator at precedence level 8/11. */ -external lsl: (int, int) => int = "%lslint" - -/** [n lsr m] shifts [n] to the right by [m] bits. - This is a logical shift: zeroes are inserted regardless of - the sign of [n]. - The result is unspecified if [m < 0] or [m >= bitsize]. - Right-associative operator at precedence level 8/11. */ -external lsr: (int, int) => int = "%lsrint" - -/** [n asr m] shifts [n] to the right by [m] bits. - This is an arithmetic shift: the sign bit of [n] is replicated. - The result is unspecified if [m < 0] or [m >= bitsize]. - Right-associative operator at precedence level 8/11. */ -external asr: (int, int) => int = "%asrint" - -/*** {1 Floating-point arithmetic} - - OCaml's floating-point numbers follow the - IEEE 754 standard, using double precision (64 bits) numbers. - Floating-point operations never raise an exception on overflow, - underflow, division by zero, etc. Instead, special IEEE numbers - are returned as appropriate, such as [infinity] for [1.0 /. 0.0], - [neg_infinity] for [-1.0 /. 0.0], and [nan] ('not a number') - for [0.0 /. 0.0]. These special numbers then propagate through - floating-point computations as expected: for instance, - [1.0 /. infinity] is [0.0], and any arithmetic operation with [nan] - as argument returns [nan] as result. -*/ - -/** Unary negation. You can also write [-. e] instead of [~-. e]. - Unary operator at precedence level 9/11 for [-. e] - and 11/11 for [~-. e]. */ -external \"~-.": float => float = "%negfloat" - -/** Unary addition. You can also write [+. e] instead of [~+. e]. - Unary operator at precedence level 9/11 for [+. e] - and 11/11 for [~+. e]. - @since 3.12.0 -*/ -external \"~+.": float => float = "%identity" - -/** Floating-point addition. - Left-associative operator at precedence level 6/11. */ -external \"+.": (float, float) => float = "%addfloat" - -/** Floating-point subtraction. - Left-associative operator at precedence level 6/11. */ -external \"-.": (float, float) => float = "%subfloat" - -/** Floating-point multiplication. - Left-associative operator at precedence level 7/11. */ -external \"*.": (float, float) => float = "%mulfloat" - -/** Floating-point division. - Left-associative operator at precedence level 7/11. */ -external \"/.": (float, float) => float = "%divfloat" - -@val @scope("Math") /** Exponentiation. */ -external \"**": (float, float) => float = "pow" - -@val @scope("Math") /** Square root. */ -external sqrt: float => float = "sqrt" - -@val @scope("Math") /** Exponential. */ -external exp: float => float = "exp" - -@val @scope("Math") /** Natural logarithm. */ -external log: float => float = "log" - -@val @scope("Math") /** Base 10 logarithm. */ -external log10: float => float = "log10" - -/** [expm1 x] computes [exp x -. 1.0], giving numerically-accurate results - even if [x] is close to [0.0]. - @since 3.12.0 -*/ -external expm1: float => float = "?expm1_float" - -@val -@scope("Math") -/** [log1p x] computes [log(1.0 +. x)] (natural logarithm), - giving numerically-accurate results even if [x] is close to [0.0]. - @since 3.12.0 -*/ -external log1p: float => float = "log1p" - -@val @scope("Math") /** Cosine. Argument is in radians. */ -external cos: float => float = "cos" - -@val @scope("Math") /** Sine. Argument is in radians. */ -external sin: float => float = "sin" - -@val @scope("Math") /** Tangent. Argument is in radians. */ -external tan: float => float = "tan" - -@val -@scope("Math") -/** Arc cosine. The argument must fall within the range [[-1.0, 1.0]]. - Result is in radians and is between [0.0] and [pi]. */ -external acos: float => float = "acos" - -@val -@scope("Math") -/** Arc sine. The argument must fall within the range [[-1.0, 1.0]]. - Result is in radians and is between [-pi/2] and [pi/2]. */ -external asin: float => float = "asin" - -@val @scope("Math") /** Arc tangent. - Result is in radians and is between [-pi/2] and [pi/2]. */ -external atan: float => float = "atan" - -@val -@scope("Math") -/** [atan2 y x] returns the arc tangent of [y /. x]. The signs of [x] - and [y] are used to determine the quadrant of the result. - Result is in radians and is between [-pi] and [pi]. */ -external atan2: (float, float) => float = "atan2" - -/** [hypot x y] returns [sqrt(x *. x + y *. y)], that is, the length - of the hypotenuse of a right-angled triangle with sides of length - [x] and [y], or, equivalently, the distance of the point [(x,y)] - to origin. - @since 4.00.0 */ -external hypot: (float, float) => float = "?hypot_float" - -@val @scope("Math") /** Hyperbolic cosine. Argument is in radians. */ -external cosh: float => float = "cosh" - -@val @scope("Math") /** Hyperbolic sine. Argument is in radians. */ -external sinh: float => float = "sinh" - -@val @scope("Math") /** Hyperbolic tangent. Argument is in radians. */ -external tanh: float => float = "tanh" - -@val -@scope("Math") -/** Round above to an integer value. - [ceil f] returns the least integer value greater than or equal to [f]. - The result is returned as a float. */ -external ceil: float => float = "ceil" - -@val -@scope("Math") -/** Round below to an integer value. - [floor f] returns the greatest integer value less than or - equal to [f]. - The result is returned as a float. */ -external floor: float => float = "floor" - -@val @scope("Math") /** [abs_float f] returns the absolute value of [f]. */ -external abs_float: float => float = "abs" - -/** [copysign x y] returns a float whose absolute value is that of [x] - and whose sign is that of [y]. If [x] is [nan], returns [nan]. - If [y] is [nan], returns either [x] or [-. x], but it is not - specified which. - @since 4.00.0 */ -external copysign: (float, float) => float = "?copysign_float" - -/** [mod_float a b] returns the remainder of [a] with respect to - [b]. The returned value is [a -. n *. b], where [n] - is the quotient [a /. b] rounded towards zero to an integer. */ -external mod_float: (float, float) => float = "?fmod_float" - -/** [frexp f] returns the pair of the significant - and the exponent of [f]. When [f] is zero, the - significant [x] and the exponent [n] of [f] are equal to - zero. When [f] is non-zero, they are defined by - [f = x *. 2 ** n] and [0.5 <= x < 1.0]. */ -external frexp: float => (float, int) = "?frexp_float" - -/** [ldexp x n] returns [x *. 2 ** n]. */ -external ldexp: (float, int) => float = "?ldexp_float" - -/** [modf f] returns the pair of the fractional and integral - part of [f]. */ -external modf: float => (float, float) = "?modf_float" - -/** Same as {!Pervasives.float_of_int}. */ -external float: int => float = "%floatofint" - -/** Convert an integer to floating-point. */ -external float_of_int: int => float = "%floatofint" - -/** Same as {!Pervasives.int_of_float}. */ -external truncate: float => int = "%intoffloat" - -/** Truncate the given floating-point number to an integer. - The result is unspecified if the argument is [nan] or falls outside the - range of representable integers. */ -external int_of_float: float => int = "%intoffloat" - -/** Positive infinity. */ -let infinity: float - -/** Negative infinity. */ -let neg_infinity: float - -@val -@scope("Number") -/** A special floating-point value denoting the result of an - undefined operation such as [0.0 /. 0.0]. Stands for - 'not a number'. Any floating-point operation with [nan] as - argument returns [nan] as result. As for floating-point comparisons, - [=], [<], [<=], [>] and [>=] return [false] and [<>] returns [true] - if one or both of their arguments is [nan]. */ -external nan: float = "NaN" -/* we could also use [0. /. 0.] */ - -/** The largest positive finite value of type [float]. */ -let max_float: float - -/** The smallest positive, non-zero, non-denormalized value of type [float]. */ -let min_float: float - -/** The difference between [1.0] and the smallest exactly representable - floating-point number greater than [1.0]. */ -let epsilon_float: float - -/** The five classes of floating-point numbers, as determined by - the {!Pervasives.classify_float} function. */ -type fpclass = - | /** Normal number, none of the below */ FP_normal - | /** Number very close to 0.0, has reduced precision */ FP_subnormal - | /** Number is 0.0 or -0.0 */ FP_zero - | /** Number is positive or negative infinity */ FP_infinite - | /** Not a number: result of an undefined operation */ FP_nan - -/** Return the class of the given floating-point number: - normal, subnormal, zero, infinite, or not a number. */ -let classify_float: float => fpclass - -/** {1 String operations} - - More string operations are provided in module {!String}. -*/ -/** String concatenation. - Right-associative operator at precedence level 5/11. */ -external \"^": (string, string) => string = "#string_append" - -/*** {1 Character operations} - - More character operations are provided in module {!Char}. -*/ - -/** Return the ASCII code of the argument. */ -external int_of_char: char => int = "%identity" - -/** Return the character with the given ASCII code. - Raise [Invalid_argument "char_of_int"] if the argument is - outside the range 0--255. */ -let char_of_int: int => char - -/*** {1 Unit operations} */ - -/** Discard the value of its argument and return [()]. - For instance, [ignore(f x)] discards the result of - the side-effecting function [f]. It is equivalent to - [f x; ()], except that the latter may generate a - compiler warning; writing [ignore(f x)] instead - avoids the warning. */ -external ignore: 'a => unit = "%ignore" - -/*** {1 String conversion functions} */ - -/** Return the string representation of a boolean. As the returned values - may be shared, the user should not modify them directly. -*/ -let string_of_bool: bool => string - -/** Convert the given string to a boolean. - Raise [Invalid_argument "bool_of_string"] if the string is not - ["true"] or ["false"]. */ -let bool_of_string: string => bool - -/** Convert the given string to a boolean. - Return [None] if the string is not - ["true"] or ["false"]. - @since 4.05 -*/ -let bool_of_string_opt: string => option - -@val /** Return the string representation of an integer, in decimal. */ -external string_of_int: int => string = "String" - -/** Convert the given string to an integer. - The string is read in decimal (by default, or if the string - begins with [0u]), in hexadecimal (if it begins with [0x] or - [0X]), in octal (if it begins with [0o] or [0O]), or in binary - (if it begins with [0b] or [0B]). - - The [0u] prefix reads the input as an unsigned integer in the range - [[0, 2*max_int+1]]. If the input exceeds {!max_int} - it is converted to the signed integer - [min_int + input - max_int - 1]. - - The [_] (underscore) character can appear anywhere in the string - and is ignored. - Raise [Failure "int_of_string"] if the given string is not - a valid representation of an integer, or if the integer represented - exceeds the range of integers representable in type [int]. */ -external int_of_string: string => int = "?int_of_string" - -/** Same as [int_of_string], but returns [None] instead of raising. - @since 4.05 -*/ -let int_of_string_opt: string => option - -@deprecated("Please use Js.Float.toString instead, string_of_float generates unparseable floats") -/** Return the string representation of a floating-point number. */ -let string_of_float: float => string - -/** Convert the given string to a float. The string is read in decimal - (by default) or in hexadecimal (marked by [0x] or [0X]). - The format of decimal floating-point numbers is - [ [-] dd.ddd (e|E) [+|-] dd ], where [d] stands for a decimal digit. - The format of hexadecimal floating-point numbers is - [ [-] 0(x|X) hh.hhh (p|P) [+|-] dd ], where [h] stands for an - hexadecimal digit and [d] for a decimal digit. - In both cases, at least one of the integer and fractional parts must be - given; the exponent part is optional. - The [_] (underscore) character can appear anywhere in the string - and is ignored. - Depending on the execution platforms, other representations of - floating-point numbers can be accepted, but should not be relied upon. - Raise [Failure "float_of_string"] if the given string is not a valid - representation of a float. */ -external float_of_string: string => float = "?float_of_string" - -/** Same as [float_of_string], but returns [None] instead of raising. - @since 4.05 -*/ -let float_of_string_opt: string => option - -/*** {1 Pair operations} */ - -/** Return the first component of a pair. */ -external fst: (('a, 'b)) => 'a = "%field0" - -/** Return the second component of a pair. */ -external snd: (('a, 'b)) => 'b = "%field1" - -/*** {1 List operations} - - More list operations are provided in module {!List}. -*/ - -@deprecated("Use Belt.List.concat instead") -/** List concatenation. Tail-recursive (length of the first argument). - Right-associative operator at precedence level 5/11. */ -let \"@": (list<'a>, list<'a>) => list<'a> - -type int32 = int - -/** Print a string on standard output. */ -let print_string: string => unit - -/** Print an integer, in decimal, on standard output. */ -let print_int: int => unit - -/** Print a floating-point number, in decimal, on standard output. */ -let print_float: float => unit - -/** Print a floating-point number, in decimal, on standard output. */ -@val -@scope("console") -/** Print a string, followed by a newline character, on - standard output and flush standard output. */ -external print_endline: string => unit = "log" - -/** Print a newline character on standard output, and flush - standard output. This can be used to simulate line - buffering of standard output. */ -let print_newline: unit => unit - -@val -@scope("console") -/** Print a string, followed by a newline character on standard - error and flush standard error. */ -external prerr_endline: string => unit = "error" - -/** Print a newline character on standard error, and flush - standard error. */ -let prerr_newline: unit => unit - -/*** {1 References} */ - -/** The type of references (mutable indirection cells) containing - a value of type ['a]. */ -type ref<'a> = {mutable contents: 'a} - -/** Return a fresh reference containing the given value. */ -external ref: 'a => ref<'a> = "%makemutable" - -/** [!r] returns the current contents of reference [r]. - Equivalent to [fun r -> r.contents]. - Unary operator at precedence level 11/11.*/ -external \"!": ref<'a> => 'a = "%bs_ref_field0" - -/** [r := a] stores the value of [a] in reference [r]. - Equivalent to [fun r v -> r.contents <- v]. - Right-associative operator at precedence level 1/11. */ -external \":=": (ref<'a>, 'a) => unit = "%bs_ref_setfield0" - -/** Increment the integer contained in the given reference. - Equivalent to [fun r -> r := succ !r]. */ -external incr: ref => unit = "%incr" - -/** Decrement the integer contained in the given reference. - Equivalent to [fun r -> r := pred !r]. */ -external decr: ref => unit = "%decr" - -/*** {1 Program termination} */ - -/** Terminate the process, returning the given status code - to the operating system: usually 0 to indicate no errors, - and a small positive integer to indicate failure. - All open output channels are flushed with [flush_all]. - An implicit [exit 0] is performed each time a program - terminates normally. An implicit [exit 2] is performed if the program - terminates early because of an uncaught exception. */ -let exit: int => 'a - -/** Register the given function to be called at program termination - time. The functions registered with [at_exit] will be called when - the program does any of the following: - - executes {!Pervasives.exit} - - terminates, either normally or because of an uncaught - exception - - executes the C function [caml_shutdown]. - The functions are called in 'last in, first out' order: the - function most recently added with [at_exit] is called first. */ -let at_exit: (unit => unit) => unit - -let valid_float_lexem: string => string diff --git a/jscomp/stdlib-406/release.ninja b/jscomp/stdlib-406/release.ninja index 992f90f652..cad3e0e641 100644 --- a/jscomp/stdlib-406/release.ninja +++ b/jscomp/stdlib-406/release.ninja @@ -12,8 +12,8 @@ o stdlib-406/pervasives.cmj : cc_cmi stdlib-406/pervasives.res | stdlib-406/perv bsc_flags = $bsc_flags -nopervasives o stdlib-406/pervasives.cmi : cc stdlib-406/pervasives.resi | $bsc others bsc_flags = $bsc_flags -nopervasives -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/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/set.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 stdlib-406/set.cmi stdlib-406/string.cmi $bsc others o stdlib-406/array.cmj : cc_cmi stdlib-406/array.res | stdlib-406/array.cmi $bsc others o stdlib-406/array.cmi : cc stdlib-406/array.resi | stdlib-406/pervasives.cmj $bsc others o stdlib-406/arrayLabels.cmj : cc_cmi stdlib-406/arrayLabels.res | stdlib-406/arrayLabels.cmi $bsc others @@ -39,7 +39,7 @@ o stdlib-406/digest.cmi : cc stdlib-406/digest.resi | stdlib-406/pervasives.cmj o stdlib-406/filename.cmj : cc_cmi stdlib-406/filename.res | stdlib-406/buffer.cmj stdlib-406/filename.cmi stdlib-406/string.cmj stdlib-406/sys.cmj $bsc others o stdlib-406/filename.cmi : cc stdlib-406/filename.resi | stdlib-406/pervasives.cmj $bsc others o stdlib-406/genlex.cmj : cc_cmi stdlib-406/genlex.res | stdlib-406/bytes.cmj stdlib-406/char.cmj stdlib-406/genlex.cmi stdlib-406/hashtbl.cmj stdlib-406/list.cmj stdlib-406/stream.cmj stdlib-406/string.cmj $bsc others -o stdlib-406/genlex.cmi : cc stdlib-406/genlex.resi | stdlib-406/pervasives.cmj stdlib-406/stream.cmi $bsc others +o stdlib-406/genlex.cmi : cc stdlib-406/genlex.resi | stdlib-406/char.cmi stdlib-406/pervasives.cmj stdlib-406/stream.cmi stdlib-406/string.cmi $bsc others o stdlib-406/hashtbl.cmj : cc_cmi stdlib-406/hashtbl.res | stdlib-406/array.cmj stdlib-406/hashtbl.cmi stdlib-406/lazy.cmj stdlib-406/random.cmj $bsc others o stdlib-406/hashtbl.cmi : cc stdlib-406/hashtbl.resi | stdlib-406/pervasives.cmj $bsc others o stdlib-406/hashtblLabels.cmi stdlib-406/hashtblLabels.cmj : cc stdlib-406/hashtblLabels.res | stdlib-406/hashtbl.cmj stdlib-406/pervasives.cmj $bsc others @@ -64,11 +64,9 @@ 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 +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 $bsc others o stdlib-406/random.cmi : cc stdlib-406/random.resi | stdlib-406/int32.cmi stdlib-406/int64.cmi stdlib-406/pervasives.cmj $bsc others o stdlib-406/set.cmj : cc_cmi stdlib-406/set.res | stdlib-406/list.cmj stdlib-406/set.cmi $bsc others o stdlib-406/set.cmi : cc stdlib-406/set.resi | stdlib-406/pervasives.cmj $bsc others @@ -89,4 +87,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/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/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/syntax/tests/idempotency/mareo/Director.res b/jscomp/syntax/tests/idempotency/mareo/Director.res index b0c5e6820b..0b5939b152 100644 --- a/jscomp/syntax/tests/idempotency/mareo/Director.res +++ b/jscomp/syntax/tests/idempotency/mareo/Director.res @@ -498,8 +498,7 @@ let update_loop = (canvas, (player, objs), map_dim) => { List.forEach(parts, part => run_update_particle(state, part)) Draw.fps(canvas, fps) Draw.hud(canvas, state.score, state.coins) - \"@@"( - ignore, + ignore( Dom_html.requestAnimationFrame((t: float) => update_helper(t, state, player, collid_objs.contents, particles.contents) ), diff --git a/jscomp/syntax/tests/idempotency/mareo/Draw.res b/jscomp/syntax/tests/idempotency/mareo/Draw.res index ac1567d1de..f69bea9f1e 100644 --- a/jscomp/syntax/tests/idempotency/mareo/Draw.res +++ b/jscomp/syntax/tests/idempotency/mareo/Draw.res @@ -20,7 +20,7 @@ let render = (sprite, (posx, posy)) => { let sx = sx +. float_of_int(sprite.frame.contents) *. sw /* print_endline (string_of_int !(sprite.frame)); */ /* context##clearRect(0.,0.,sw, sh); */ - \"@@"(ignore, context["drawImage"](sprite.img, sx, sy, sw, sh, dx, dy, dw, dh)) + ignore(context["drawImage"](sprite.img, sx, sy, sw, sh, dx, dy, dw, dh)) } /* Draws two background images, which needs to be done because of the @@ -37,7 +37,7 @@ let clear_canvas = canvas => { let context = Dom_html.canvasRenderingContext2DToJsObj(canvas["getContext"]("2d")) let cwidth = float_of_int(canvas["width"]) let cheight = float_of_int(canvas["height"]) - \"@@"(ignore, context["clearRect"](0., 0., cwidth, cheight)) + ignore(context["clearRect"](0., 0., cwidth, cheight)) } /* Displays the text for score and coins. */ @@ -46,12 +46,11 @@ let hud = (canvas, score, coins) => { let coin_string = string_of_int(coins) let canvas = Dom_html.canvasElementToJsObj(canvas) let context = Dom_html.canvasRenderingContext2DToJsObj(canvas["getContext"]("2d")) - \"@@"(ignore, context["font"] = "10px 'Press Start 2P'") - \"@@"( - ignore, + ignore(context["font"] = "10px 'Press Start 2P'") + ignore( context["fillText"]("Score: " ++ score_string, float_of_int(canvas["width"]) -. 140., 18.), ) - \"@@"(ignore, context["fillText"]("Coins: " ++ coin_string, 120., 18.)) + ignore(context["fillText"]("Coins: " ++ coin_string, 120., 18.)) } /* Displays the fps. */ @@ -59,29 +58,29 @@ let fps = (canvas, fps_val) => { let fps_str = int_of_float(fps_val) |> string_of_int let canvas = Dom_html.canvasElementToJsObj(canvas) let context = Dom_html.canvasRenderingContext2DToJsObj(canvas["getContext"]("2d")) - \"@@"(ignore, context["fillText"](fps_str, 10., 18.)) + ignore(context["fillText"](fps_str, 10., 18.)) } /* game_win displays a black screen when you finish a game. */ let game_win = ctx => { let ctx = Dom_html.canvasRenderingContext2DToJsObj(ctx) - \"@@"(ignore, ctx["rect"](0., 0., 512., 512.)) - \"@@"(ignore, ctx["fillStyle"] = "black") - \"@@"(ignore, ctx["fill"]()) - \"@@"(ignore, ctx["fillStyle"] = "white") - \"@@"(ignore, ctx["font"] = "20px 'Press Start 2P'") - \"@@"(ignore, ctx["fillText"]("You win!", 180., 128.)) + ignore(ctx["rect"](0., 0., 512., 512.)) + ignore(ctx["fillStyle"] = "black") + ignore(ctx["fill"]()) + ignore(ctx["fillStyle"] = "white") + ignore(ctx["font"] = "20px 'Press Start 2P'") + ignore(ctx["fillText"]("You win!", 180., 128.)) failwith("Game over.") } /* gave_loss displays a black screen stating a loss to finish that level play. */ let game_loss = ctx => { let ctx = Dom_html.canvasRenderingContext2DToJsObj(ctx) - \"@@"(ignore, ctx["rect"](0., 0., 512., 512.)) + ignore(ctx["rect"](0., 0., 512., 512.)) ctx["fillStyle"] = "black" - \"@@"(ignore, ctx["fill"]()) + ignore(ctx["fill"]()) ctx["fillStyle"] = "white" ctx["font"] = "20px 'Press Start 2P'" - \"@@"(ignore, ctx["fillText"]("GAME OVER. You lose!", 60., 128.)) + ignore(ctx["fillText"]("GAME OVER. You lose!", 60., 128.)) failwith("Game over.") } diff --git a/jscomp/syntax/tests/idempotency/reprocessing/Reprocessing.res b/jscomp/syntax/tests/idempotency/reprocessing/Reprocessing.res index 7801ce09b6..5640c80f5a 100644 --- a/jscomp/syntax/tests/idempotency/reprocessing/Reprocessing.res +++ b/jscomp/syntax/tests/idempotency/reprocessing/Reprocessing.res @@ -207,10 +207,10 @@ let run = ( ) () => { let (x, y) = (0, 0) - let (x1, y1) = (\"@@"(float_of_int, x + width), \"@@"(float_of_int, y)) - let (x2, y2) = (float_of_int(x), \"@@"(float_of_int, y)) - let (x3, y3) = (\"@@"(float_of_int, x + width), \"@@"(float_of_int, y + height)) - let (x4, y4) = (float_of_int(x), \"@@"(float_of_int, y + height)) + let (x1, y1) = (float_of_int(x + width), float_of_int(y)) + let (x2, y2) = (float_of_int(x), float_of_int(y)) + let (x3, y3) = (float_of_int(x + width), float_of_int(y + height)) + let (x4, y4) = (float_of_int(x), float_of_int(y + height)) let verticesColorAndTexture = [ x1, y1, @@ -277,7 +277,7 @@ let run = ( Reasongl.Gl.Window.setWindowSize(~window=env.window, ~width, ~height) } if fns.filename != "" { - \"@@"(ignore, Reprocessing_Hotreload.checkRebuild(false, fns.filename)) + ignore(Reprocessing_Hotreload.checkRebuild(false, fns.filename)) } if fns.justHotReloaded { let newInitialState = fns.setup(env) diff --git a/jscomp/syntax/tests/idempotency/reprocessing/Reprocessing_Internal.res b/jscomp/syntax/tests/idempotency/reprocessing/Reprocessing_Internal.res index 663bdbcff0..97e2cee753 100644 --- a/jscomp/syntax/tests/idempotency/reprocessing/Reprocessing_Internal.res +++ b/jscomp/syntax/tests/idempotency/reprocessing/Reprocessing_Internal.res @@ -32,18 +32,17 @@ let getProgram = ( if linkedCorrectly { Some(program) } else { - \"@@"(print_endline, "Linking error: " ++ Gl.getProgramInfoLog(~context, program)) + print_endline("Linking error: " ++ Gl.getProgramInfoLog(~context, program)) None } } else { - \"@@"( - print_endline, + print_endline( "Fragment shader error: " ++ Gl.getShaderInfoLog(~context, fragmentShader), ) None } } else { - \"@@"(print_endline, "Vertex shader error: " ++ Gl.getShaderInfoLog(~context, vertexShader)) + print_endline("Vertex shader error: " ++ Gl.getShaderInfoLog(~context, vertexShader)) None } } diff --git a/jscomp/test/406_primitive_test.js b/jscomp/test/406_primitive_test.js index a84882e414..f664f76c49 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/Import.js b/jscomp/test/Import.js index bc1f456e50..f29c2ac0b5 100644 --- a/jscomp/test/Import.js +++ b/jscomp/test/Import.js @@ -1,22 +1,20 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); +let Js_promise2 = require("../../lib/js/js_promise2.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) { - let obj = import("../../lib/js/belt_List.js").then(function (m) { + return Js_promise2.then(import("../../lib/js/belt_List.js").then(function (m) { return m.forEach; - }); - let arg1 = function (each) { - return Promise.resolve(Curry._2(each, list, f)); - }; - return obj.then(arg1); + }), (function (each) { + return Promise.resolve(each(list, f)); + })); } eachIntLazy({ @@ -75,15 +73,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 [ @@ -92,7 +90,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 [ @@ -101,11 +99,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 [ @@ -114,7 +112,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 [ @@ -124,7 +122,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/Import.res b/jscomp/test/Import.res index 5b8097bf64..47c6a93e6e 100644 --- a/jscomp/test/Import.res +++ b/jscomp/test/Import.res @@ -3,7 +3,7 @@ let eachIntAsync = async (list: list, f: int => unit) => { } let eachIntLazy = (list: list, f: int => unit) => - Js.import(Belt.List.forEach) |> Js.Promise.then_(each => list->each(f)->Js.Promise.resolve) + Js.Promise2.then(Js.import(Belt.List.forEach), each => list->each(f)->Js.Promise.resolve) let _ = list{1, 2, 3}->eachIntLazy(n => Js.log2("lazy", n)) let _ = list{1, 2, 3}->eachIntAsync(n => Js.log2("async", n)) 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/SafePromises.res b/jscomp/test/SafePromises.res index 8b18ca8f80..091adf475d 100644 --- a/jscomp/test/SafePromises.res +++ b/jscomp/test/SafePromises.res @@ -3,17 +3,17 @@ let nestedPromise = async (xxx: promise>) => { let xx = await xxx - let _ = xx->Js.Promise2.then(x => Js.log2("Promise2.then", x) |> Js.Promise.resolve) + let _ = xx->Js.Promise2.then(x => Js.Promise.resolve(Js.log2("Promise2.then", x))) let _ = xx->Js.Promise2.catch(x => { Js.log2("Promise2.catch_", x) - 0 |> Js.Promise.resolve + Js.Promise.resolve(0) }) // This crashes - let _ = Js.Promise.then_(x => Js.log2("Promise.then_", x) |> Js.Promise.resolve, xx) + let _ = Js.Promise.then_(x => Js.Promise.resolve(Js.log2("Promise.then_", x)), xx) } -let create = async (x) => { +let create = async x => { Js.log2("create", x) x } diff --git a/jscomp/test/UncurriedExternals.js b/jscomp/test/UncurriedExternals.js index a23c67f6f1..44aa87de80 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 { RE_EXN_ID: "Not_found", Error: new Error() @@ -48,7 +48,7 @@ function tsiU(c) { }); } -let match = React.useState(function (param) { +let match = React.useState(function () { return 3; }); @@ -72,11 +72,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); + }; } function dd$1(param) { diff --git a/jscomp/test/UntaggedVariants.js b/jscomp/test/UntaggedVariants.js index 739535cd41..fcf3ba5aac 100644 --- a/jscomp/test/UntaggedVariants.js +++ b/jscomp/test/UntaggedVariants.js @@ -500,9 +500,9 @@ async function classify$10(a) { return; } else { if (Array.isArray(a)) { - console.log(function (param) { - return Belt_Array.joinWith(a, "-", param); - }); + console.log(Belt_Array.joinWith(a, "-", (function (x) { + return x; + }))); return; } if (a instanceof Promise) { @@ -527,9 +527,9 @@ let Arr = { async function classifyAll(t) { if (Array.isArray(t)) { - console.log(function (param) { - return Belt_Array.joinWith(t, "-", param); - }); + console.log(Belt_Array.joinWith(t, "-", (function (x) { + return x; + }))); return; } if (t instanceof Promise) { diff --git a/jscomp/test/UntaggedVariants.res b/jscomp/test/UntaggedVariants.res index 0bcfe81208..b55f3d8ebd 100644 --- a/jscomp/test/UntaggedVariants.res +++ b/jscomp/test/UntaggedVariants.res @@ -296,16 +296,16 @@ module OptionUnboxingHeuristic = { module TestFunctionCase = { @unboxed - type t = Array(array) | Record({x: int}) | Function((. int) => int) + type t = Array(array) | Record({x: int}) | Function(int => int) let classify = v => switch v { | Record({x}) => x | Array(a) => a[0] - | Function(f) => f(. 3) + | Function(f) => f(3) } - let ff = Function((. x) => x + 1) + let ff = Function(x => x + 1) } module ComplexPattern = { @@ -375,7 +375,7 @@ module Arr = { let classify = async (a: arr) => switch a { - | Array(arr) => Js.log(arr->Belt.Array.joinWith("-")) + | Array(arr) => Js.log(arr->Belt.Array.joinWith("-", x => x)) | String(s) => Js.log(s) | Promise(p) => Js.log(await p) | Object({userName}) => Js.log(userName) @@ -408,7 +408,7 @@ module AllInstanceofTypes = { | Object({userName}) => Js.log(userName) | Date(date) => Js.log(date->Js.Date.toString) | RegExp(re) => Js.log(re->Js.Re.test_("test")) - | Array(arr) => Js.log(arr->Belt.Array.joinWith("-")) + | Array(arr) => Js.log(arr->Belt.Array.joinWith("-", x => x)) | File(file) => Js.log(file->fileName) | Blob(blob) => Js.log(blob->blobSize) } @@ -416,14 +416,14 @@ module AllInstanceofTypes = { module Aliased = { type dict = Js.Dict.t - type fn = (. unit) => option + type fn = unit => option @unboxed type t = Object(dict) | String(string) | Function(fn) let test = (t: t) => { switch t { | Object(d) => d->Js.Dict.get("Hello") | String(s) => Some(s) - | Function(fn) => fn(.) + | Function(fn) => fn() } } } @@ -431,4 +431,4 @@ module Aliased = { module OnlyOne = { @unboxed type onlyOne = OnlyOne let onlyOne = OnlyOne -} \ No newline at end of file +} diff --git a/jscomp/test/a_filename_test.js b/jscomp/test/a_filename_test.js deleted file mode 100644 index 214cec8a36..0000000000 --- a/jscomp/test/a_filename_test.js +++ /dev/null @@ -1,130 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let $$Array = require("../../lib/js/array.js"); -let Ext_filename_test = require("./ext_filename_test.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + String(test_id.contents)), - (function (param) { - return { - TAG: "Eq", - _0: x, - _1: y - }; - }) - ], - tl: suites.contents - }; -} - -function test(param, param$1) { - return Ext_filename_test.node_relative_path(true, param, param$1); -} - -if (process.platform !== "win32") { - eq("File \"a_filename_test.res\", line 16, characters 4-11", [ - Ext_filename_test.combine("/tmp", "subdir/file.txt"), - Ext_filename_test.combine("/tmp", "/a/tmp.txt"), - Ext_filename_test.combine("/a/tmp.txt", "subdir/file.txt") - ], [ - "/tmp/subdir/file.txt", - "/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, { - 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, { - 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, { - 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, { - 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, { - 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, { - 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, { - NAME: "Dir", - VAL: "./a/" - }, { - NAME: "File", - VAL: "./a/b.js" - }), "./b.js"); - eq("File \"a_filename_test.res\", line 51, characters 5-12", Ext_filename_test.get_extension("a.txt"), ".txt"); - eq("File \"a_filename_test.res\", line 52, characters 5-12", Ext_filename_test.get_extension("a"), ""); - eq("File \"a_filename_test.res\", line 53, characters 5-12", Ext_filename_test.get_extension(".txt"), ".txt"); - eq("File \"a_filename_test.res\", line 56, characters 4-11", $$Array.map(Ext_filename_test.normalize_absolute_path, [ - "/gsho/./..", - "/a/b/../c../d/e/f", - "/a/b/../c/../d/e/f", - "/gsho/./../..", - "/a/b/c/d", - "/a/b/c/d/", - "/a/", - "/a", - "/a.txt/", - "/a.txt" - ]), [ - "/", - "/a/c../d/e/f", - "/a/d/e/f", - "/", - "/a/b/c/d", - "/a/b/c/d", - "/a", - "/a", - "/a.txt", - "/a.txt" - ]); -} - -Mt.from_pair_suites("A_filename_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.test = test; -/* Not a pure module */ diff --git a/jscomp/test/a_filename_test.res b/jscomp/test/a_filename_test.res deleted file mode 100644 index 33df783432..0000000000 --- a/jscomp/test/a_filename_test.res +++ /dev/null @@ -1,76 +0,0 @@ -@var @scope("process") -external platform: [#aix | #darwin | #freebsd | #linux | #openbsd | #sunos | #win32] = "platform" - -let suites: ref = ref(list{}) -let test_id = ref(0) -let eq = (loc, x, y) => { - incr(test_id) - suites := - list{(loc ++ (" id " ++ string_of_int(test_id.contents)), _ => Mt.Eq(x, y)), ...suites.contents} -} - -let test = Ext_filename_test.node_relative_path(true) -let () = /* TODO: adapt these tests to run on Windows. */ -if platform !== #win32 { - eq( - __LOC__, - { - let \"//" = Ext_filename_test.combine - ( - \"//"("/tmp", "subdir/file.txt"), - \"//"("/tmp", "/a/tmp.txt"), - \"//"("/a/tmp.txt", "subdir/file.txt"), - ) - }, - ("/tmp/subdir/file.txt", "/a/tmp.txt", "/a/tmp.txt/subdir/file.txt"), - ) - - eq(__LOC__, test(#File("./a/b.c"), #File("./a/u/g.c")), "./u/g.c") - - eq( - __LOC__, - test(#File("./a/b.c"), #File("xxxghsoghos/ghsoghso/node_modules/buckle-stdlib/list.js")), - "buckle-stdlib/list.js", - ) - - eq( - __LOC__, - test(#File("./a/b.c"), #File("xxxghsoghos/ghsoghso/node_modules//buckle-stdlib/list.js")), - "buckle-stdlib/list.js", - ) - - eq( - __LOC__, - test(#File("./a/b.c"), #File("xxxghsoghos/ghsoghso/node_modules/./buckle-stdlib/list.js")), - "buckle-stdlib/list.js", - ) - - eq(__LOC__, test(#File("./a/c.js"), #File("./a/b")), "./b") - eq(__LOC__, test(#File("./a/c"), #File("./a/b.js")), "./b.js") - eq(__LOC__, test(#Dir("./a/"), #File("./a/b.js")), "./b.js") - eq(__LOC__, Ext_filename_test.get_extension("a.txt"), ".txt") - eq(__LOC__, Ext_filename_test.get_extension("a"), "") - eq(__LOC__, Ext_filename_test.get_extension(".txt"), ".txt") - - eq( - __LOC__, - Array.map( - Ext_filename_test.normalize_absolute_path, - [ - "/gsho/./..", - "/a/b/../c../d/e/f", - "/a/b/../c/../d/e/f", - "/gsho/./../..", - "/a/b/c/d", - "/a/b/c/d/", - "/a/", - "/a", - "/a.txt/", - "/a.txt", - ], - ), - ["/", "/a/c../d/e/f", "/a/d/e/f", "/", "/a/b/c/d", "/a/b/c/d", "/a", "/a", "/a.txt", "/a.txt"], - ) -} - -Mt.from_pair_suites(__MODULE__, suites.contents) 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/a_string_test.js b/jscomp/test/a_string_test.js index c008b8256d..881f69d6a4 100644 --- a/jscomp/test/a_string_test.js +++ b/jscomp/test/a_string_test.js @@ -79,9 +79,9 @@ let suites_1 = { (function (param) { return { TAG: "Eq", - _0: List.filter(function (s) { + _0: List.filter((function (s) { return s !== ""; - })(Ext_string_test.split_by(undefined, (function (x) { + }), Ext_string_test.split_by(undefined, (function (x) { if (x === /* ' ' */32) { return true; } else { 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 6e996c97f1..7bab7fa2e0 100644 --- a/jscomp/test/ari_regress_test.js +++ b/jscomp/test/ari_regress_test.js @@ -2,7 +2,6 @@ 'use strict'; let Mt = require("./mt.js"); -let Curry = require("../../lib/js/curry.js"); let g = 7; @@ -20,12 +19,12 @@ function g1(x, y) { let u = 8; -let x = u + 6 | 0; +let x = (function (z) { + return u + z | 0; +})(6); -let partial_arg = g1(3, 4); - -function v(param) { - return partial_arg(6, param); +function v(yy) { + return g1(3, 4)(6, yy); } let suites_0 = [ @@ -46,7 +45,7 @@ let suites_1 = { return { TAG: "Eq", _0: 14, - _1: (Curry._1(v, 1), Curry._1(v, 1)) + _1: (v(1), v(1)) }; }) ], @@ -68,7 +67,7 @@ let suites_1 = { return { TAG: "Eq", _0: h.contents, - _1: 1 + _1: 2 }; }) ], @@ -84,4 +83,4 @@ let suites = { Mt.from_pair_suites("Ari_regress_test", suites); -/* partial_arg Not a pure module */ +/* x Not a pure module */ diff --git a/jscomp/test/ari_regress_test.res b/jscomp/test/ari_regress_test.res index 6aa7ec12ee..2af0de7932 100644 --- a/jscomp/test/ari_regress_test.res +++ b/jscomp/test/ari_regress_test.res @@ -1,4 +1,4 @@ -let f = x => \"+"(x) +let f = (x, y) => \"+"(x, y) let g = f(3, 4) let h = ref(0) @@ -13,9 +13,9 @@ let g1 = (x, y) => { let () = incr(h) (xx, yy) => xx + yy + u } -let x = gg(3, 5, 6) +let x = gg(3, 5)(6) -let v = g1(3, 4, 6) +let v = yy => g1(3, 4)(6, yy) let suites = { open Mt @@ -32,7 +32,7 @@ let suites = { ), ), ("curry3", _ => Eq(x, 14)), - (__LOC__, _ => Eq(h.contents, 1)), + (__LOC__, _ => Eq(h.contents, 2)), } } diff --git a/jscomp/test/arith_lexer.js b/jscomp/test/arith_lexer.js index 3fe31466a5..7ede8cf05e 100644 --- a/jscomp/test/arith_lexer.js +++ b/jscomp/test/arith_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"); let Pervasives = require("../../lib/js/pervasives.js"); let Caml_format = require("../../lib/js/caml_format.js"); @@ -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; } 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..af5a8ecdd0 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, @@ -50,15 +50,17 @@ function f3(x) { }; } -eq("File \"arity_deopt.res\", line 47, characters 11-18", 6, 6); +eq("File \"arity_deopt.res\", line 47, characters 5-12", 6, 6); -eq("File \"arity_deopt.res\", line 48, characters 11-18", 6, (function (y, z) { +eq("File \"arity_deopt.res\", line 48, characters 5-12", 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 5-12", 6, (function (z) { + return 3 + z | 0; +})(3)); -eq("File \"arity_deopt.res\", line 50, characters 11-18", 6, (function (y, z) { +eq("File \"arity_deopt.res\", line 50, characters 5-12", 6, (function (y, z) { return (1 + y | 0) + z | 0; })(2, 3)); diff --git a/jscomp/test/arity_deopt.res b/jscomp/test/arity_deopt.res index 6eb9cb6335..d0ab75011a 100644 --- a/jscomp/test/arity_deopt.res +++ b/jscomp/test/arity_deopt.res @@ -22,31 +22,31 @@ let eq = (loc, x, y) => { /* let@z z = f x y in */ /* return (x + y + z ) */ -let f0 = (. x, y, z) => x + y + z +let f0 = (x, y, z) => x + y + z /* catch up. In OCaml we can not tell the difference from below {[ let f = fun [@bs] x y z -> x + y + z ]} */ -let f1 = x => (. y, z) => x + y + z +let f1 = x => (y, z) => x + y + z -let f2 = (. x, y) => { +let f2 = (x, y) => { let a = x z => a + y + z } let f3 = x => { let a = x - (. y, z) => a + y + z + (y, z) => a + y + z } /* be careful! When you start optimize functions of [@bs], its call site invariant (Ml_app) will not hold any more. So the best is never shrink functons which could change arity */ let () = { - \"@@"(eq(__LOC__, 6), f0(. 1, 2, 3)) - \"@@"(eq(__LOC__, 6), f1(1)(. 2, 3)) - \"@@"(eq(__LOC__, 6), f2(. 1, 2)(3)) - \"@@"(eq(__LOC__, 6), f3(1)(. 2, 3)) + eq(__LOC__, 6, f0(1, 2, 3)) + eq(__LOC__, 6, f1(1)(2, 3)) + eq(__LOC__, 6, f2(1, 2)(3)) + eq(__LOC__, 6, f3(1)(2, 3)) } let () = Mt.from_pair_suites(__MODULE__, suites.contents) diff --git a/jscomp/test/arity_infer.js b/jscomp/test/arity_infer.js index ed8941aabd..736936e634 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; @@ -23,7 +22,7 @@ function f1(x) { RE_EXN_ID: "Not_found", Error: new Error() }; - 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_subtle_test.res b/jscomp/test/array_subtle_test.res index 59db33eded..6fb8c83a4a 100644 --- a/jscomp/test/array_subtle_test.res +++ b/jscomp/test/array_subtle_test.res @@ -24,7 +24,7 @@ let () = { let () = { while Js.Array2.length(v) > 0 { - \"@@"(ignore, Js.Array2.pop(v)) + ignore(Js.Array2.pop(v)) } eq(__LOC__, (0, Js.Array2.length(v))) } @@ -34,7 +34,7 @@ let f = v => { | Some(x) => Js.log("hi") | None => Js.log("hi2") } - Js.log(\"@@"(ignore, Js.Array2.pop(v))) + Js.log(ignore(Js.Array2.pop(v))) } let fff = x => Array.length(x) >= 0 diff --git a/jscomp/test/array_test.js b/jscomp/test/array_test.js index 0a13101af3..6f3459de46 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 { RE_EXN_ID: H, Error: new Error() diff --git a/jscomp/test/array_test.res b/jscomp/test/array_test.res index a09f495ceb..6488fed8c3 100644 --- a/jscomp/test/array_test.res +++ b/jscomp/test/array_test.res @@ -15,7 +15,7 @@ module Make = (Array: ARRAY) => { } else { try { for i in 0 to len2 - 1 { - if \"@@"(not, p(xs[i], prefix[i])) { + if not(p(xs[i], prefix[i])) { raise(X.H) } } @@ -49,7 +49,7 @@ module Make = (Array: ARRAY) => { let aux = (xs: list<(array, list)>) => List.fold_left((acc, (x, y)) => list{(Array.to_list(x), y), ...acc}, list{}, xs) - let (a, b) = \"@@"(List.split, aux(list{([], list{})})) + let (a, b) = List.split(aux(list{([], list{})})) Eq(a, b) }, ), diff --git a/jscomp/test/ast_abstract_test.js b/jscomp/test/ast_abstract_test.js index 0e581029a3..462fcb9fa2 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_inline.js b/jscomp/test/async_inline.js index de28f21fc0..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) { - return React.useCallback(async function (_a, b) { +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_inline.res b/jscomp/test/async_inline.res index 5e3d48d2a4..54466773fb 100644 --- a/jscomp/test/async_inline.res +++ b/jscomp/test/async_inline.res @@ -1,10 +1,10 @@ let willBeInlined = async () => 3 -let inlined = willBeInlined () +let inlined = willBeInlined() let wrapSomethingAsync: unit => unit = () => { let _ = ( - async (_) => { + async _ => { let test = await Js.Promise.resolve("Test") Js.log(test) } @@ -24,14 +24,14 @@ let wrapSomethingAsync2 = () => module M: { let broken: (unit => promise<'a>) => promise<'a> } = { - let doSomethingAsync = async (someAsyncFunction) => { + let doSomethingAsync = async someAsyncFunction => { await someAsyncFunction() } let broken = someAsyncFunction => doSomethingAsync(someAsyncFunction) } -let broken = async (someAsyncFunction) => { +let broken = async someAsyncFunction => { await someAsyncFunction() } @@ -39,24 +39,24 @@ let broken = someAsyncFunction => broken(someAsyncFunction) let curriedId = x => x let curriedIdAsync = async x => x -let uncurriedId = (.x ) => x -let uncurriedIdAsync = async (.x ) => x +let uncurriedId = x => x +let uncurriedIdAsync = async x => x let tci = curriedId(3) let tcia = curriedIdAsync(3) -let tui = uncurriedId(. 3) -let tuia = uncurriedIdAsync(. 3) +let tui = uncurriedId(3) +let tuia = uncurriedIdAsync(3) -let nested1 = () => async (y) => await y +let nested1 = () => async y => await y -let nested2 = async () => async (y) => await y +let nested2 = async () => async y => await y type callback<'input, 'output> = 'input => 'output @module("react") -external useCallback: (@uncurry ('input => 'output)) => callback<'input, 'output> = "useCallback" +external useCallback: ('input => 'output) => callback<'input, 'output> = "useCallback" let onSubmit = () => - useCallback(async (_a, b) => { + useCallback(async (b) => { await b }) 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 25f7fd2192..6757b31828 100644 --- a/jscomp/test/bdd.js +++ b/jscomp/test/bdd.js @@ -121,7 +121,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; @@ -334,16 +334,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); @@ -353,7 +353,7 @@ let seed = { contents: 0 }; -function random(param) { +function random() { seed.contents = Math.imul(seed.contents, 25173) + 17431 | 0; return (seed.contents & 1) > 0; } @@ -391,7 +391,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 5ae761afb6..1eb4bd033f 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"); 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 []; } @@ -38,7 +41,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]); @@ -46,7 +51,7 @@ function fold_left(f, x, a) { return r; } -function f2(param) { +function f2() { let arr = init(3000000, (function (i) { return i; })); diff --git a/jscomp/test/bigint_test.js b/jscomp/test/bigint_test.js index 0875f84e71..8f78155c3a 100644 --- a/jscomp/test/bigint_test.js +++ b/jscomp/test/bigint_test.js @@ -14,16 +14,12 @@ let suites = { contents: /* [] */0 }; -function eq(loc) { - return function (param, param$1) { - return Mt_global.collect_eq(test_id, suites, loc, param, param$1); - }; +function eq(loc, a, b) { + Mt_global.collect_eq(test_id, suites, loc, a, b); } -function approx(loc) { - return function (param, param$1) { - return Mt_global.collect_approx(test_id, suites, loc, param, param$1); - }; +function approx(loc, a, b) { + Mt_global.collect_approx(test_id, suites, loc, a, b); } let bigint_compare = Caml.bigint_compare; @@ -86,89 +82,89 @@ function bigint_asr(prim0, prim1) { return (prim0 >> prim1); } -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 26, characters 5-12", Caml.bigint_compare(1n, 1n), 0); +eq("File \"bigint_test.res\", line 26, characters 5-12", Caml.bigint_compare(1n, 1n), 0); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 27, characters 5-12", Caml_obj.compare(1n, 1n), 0); +eq("File \"bigint_test.res\", line 27, characters 5-12", Caml_obj.compare(1n, 1n), 0); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 28, characters 5-12", Caml.bigint_compare(-0n, -1n), 1); +eq("File \"bigint_test.res\", line 28, characters 5-12", Caml.bigint_compare(-0n, -1n), 1); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 29, characters 5-12", Caml_obj.compare(-0n, -1n), 1); +eq("File \"bigint_test.res\", line 29, characters 5-12", Caml_obj.compare(-0n, -1n), 1); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 30, characters 5-12", Caml.bigint_compare(0n, -1n), 1); +eq("File \"bigint_test.res\", line 30, characters 5-12", Caml.bigint_compare(0n, -1n), 1); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 31, characters 5-12", Caml_obj.compare(0n, -1n), 1); +eq("File \"bigint_test.res\", line 31, characters 5-12", Caml_obj.compare(0n, -1n), 1); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 32, characters 5-12", Caml.bigint_compare(1n, 2n), -1); +eq("File \"bigint_test.res\", line 32, characters 5-12", Caml.bigint_compare(1n, 2n), -1); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 33, characters 5-12", Caml_obj.compare(1n, 2n), -1); +eq("File \"bigint_test.res\", line 33, characters 5-12", Caml_obj.compare(1n, 2n), -1); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 34, characters 5-12", Caml.bigint_compare(1n, 2n), -1); +eq("File \"bigint_test.res\", line 34, characters 5-12", Caml.bigint_compare(1n, 2n), -1); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 35, characters 5-12", Caml_obj.compare(1n, 2n), -1); +eq("File \"bigint_test.res\", line 35, characters 5-12", Caml_obj.compare(1n, 2n), -1); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 36, characters 5-12", Caml.bigint_compare(1n, 1n), 0); +eq("File \"bigint_test.res\", line 36, characters 5-12", Caml.bigint_compare(1n, 1n), 0); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 37, characters 5-12", Caml_obj.compare(1n, 1n), 0); +eq("File \"bigint_test.res\", line 37, characters 5-12", Caml_obj.compare(1n, 1n), 0); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 38, characters 5-12", 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n === 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, true); +eq("File \"bigint_test.res\", line 38, characters 5-12", 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n === 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, true); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 39, characters 5-12", Caml_obj.equal(1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n), true); +eq("File \"bigint_test.res\", line 39, characters 5-12", Caml_obj.equal(1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n), true); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 40, characters 5-12", 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n === 1000000000000000000000000000000000000000000000000000000000000000000000000000000000001n, false); +eq("File \"bigint_test.res\", line 40, characters 5-12", 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n === 1000000000000000000000000000000000000000000000000000000000000000000000000000000000001n, false); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 41, characters 5-12", Caml_obj.equal(1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, 1000000000000000000000000000000000000000000000000000000000000000000000000000000000001n), false); +eq("File \"bigint_test.res\", line 41, characters 5-12", Caml_obj.equal(1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, 1000000000000000000000000000000000000000000000000000000000000000000000000000000000001n), false); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 42, characters 5-12", 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n === -1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, false); +eq("File \"bigint_test.res\", line 42, characters 5-12", 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n === -1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, false); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 43, characters 5-12", Caml_obj.equal(1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, -1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n), false); +eq("File \"bigint_test.res\", line 43, characters 5-12", Caml_obj.equal(1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, -1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n), false); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 44, characters 5-12", ( +eq("File \"bigint_test.res\", line 44, characters 5-12", ( 1n !== 1n ? ( 1n !== 2n ? 0n : 4n ) : 3n ) === 3n, true); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 49, characters 5-12", Caml_obj.equal(1n !== 1n ? ( +eq("File \"bigint_test.res\", line 49, characters 5-12", Caml_obj.equal(1n !== 1n ? ( 1n !== 2n ? 0n : 4n ) : 3n, 3n), true); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 54, characters 5-12", ( +eq("File \"bigint_test.res\", line 54, characters 5-12", ( -1n !== -2n ? ( -1n !== -1n ? 0n : 3n ) : 4n ) === 3n, true); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 59, characters 5-12", Caml_obj.equal(-1n !== -1n ? ( +eq("File \"bigint_test.res\", line 59, characters 5-12", Caml_obj.equal(-1n !== -1n ? ( -1n !== 2n ? 0n : 4n ) : 3n, 3n), true); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 64, characters 5-12", ( +eq("File \"bigint_test.res\", line 64, characters 5-12", ( -1000n !== -1000n ? ( -1000n !== -2n ? 0n : 4n ) : 3n ) === 3n, true); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 69, characters 5-12", Caml_obj.equal(-1000n !== -1000n ? ( +eq("File \"bigint_test.res\", line 69, characters 5-12", Caml_obj.equal(-1000n !== -1000n ? ( -1000n !== -2n ? 0n : 4n ) : 3n, 3n), true); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 74, characters 5-12", 9n & 1n, 1n); +eq("File \"bigint_test.res\", line 74, characters 5-12", 9n & 1n, 1n); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 75, characters 5-12", 9n | 1n, 9n); +eq("File \"bigint_test.res\", line 75, characters 5-12", 9n | 1n, 9n); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 76, characters 5-12", 9n ^ 1n, 8n); +eq("File \"bigint_test.res\", line 76, characters 5-12", 9n ^ 1n, 8n); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 77, characters 5-12", (9n << 1n), 18n); +eq("File \"bigint_test.res\", line 77, characters 5-12", (9n << 1n), 18n); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 78, characters 5-12", (9n << -1n), 4n); +eq("File \"bigint_test.res\", line 78, characters 5-12", (9n << -1n), 4n); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 79, characters 5-12", (9n >> 1n), 4n); +eq("File \"bigint_test.res\", line 79, characters 5-12", (9n >> 1n), 4n); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 80, characters 5-12", (9n >> -1n), 18n); +eq("File \"bigint_test.res\", line 80, characters 5-12", (9n >> -1n), 18n); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 81, characters 5-12", (-9n >> 1n), -5n); +eq("File \"bigint_test.res\", line 81, characters 5-12", (-9n >> 1n), -5n); -Mt_global.collect_eq(test_id, suites, "File \"bigint_test.res\", line 82, characters 5-12", (-9n >> -1n), -18n); +eq("File \"bigint_test.res\", line 82, characters 5-12", (-9n >> -1n), -18n); Mt.from_pair_suites("Bigint_test", suites.contents); diff --git a/jscomp/test/bigint_test.res b/jscomp/test/bigint_test.res index 4348c8fb7d..91bc5ad82e 100644 --- a/jscomp/test/bigint_test.res +++ b/jscomp/test/bigint_test.res @@ -1,6 +1,6 @@ let (test_id, suites) = (ref(0), ref(list{})) -let eq = loc => Mt_global.collect_eq(test_id, suites, loc) -let approx = loc => Mt_global.collect_approx(test_id, suites, loc) +let eq = (loc, a, b) => Mt_global.collect_eq(test_id, suites, loc, a, b) +let approx = (loc, a, b) => Mt_global.collect_approx(test_id, suites, loc, a, b) let bigint_compare = (x: bigint, y) => Pervasives.compare(x, y) let generic_compare = Pervasives.compare 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 deleted file mode 100644 index 04b65a9ae0..0000000000 --- a/jscomp/test/bs_abstract_test.js +++ /dev/null @@ -1,61 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Curry = require("../../lib/js/curry.js"); - -let v = { - hd: 3, - tl: null -}; - -v.tl = v; - -let f = { - k: (function (x, y) { - return x === y; - }), - y: "x" -}; - -function uf(u) { - return Curry._1(u.y0, 1); -} - -function uf1(u) { - return Curry._1(u.y1, 1); -} - -function uf2(u) { - return Curry._2(u.y1, 1, 2); -} - -function uff(f) { - return f.yyyy(1); -} - -function uff2(f) { - return f.yyyy1(1, 2); -} - -function uff3(f) { - let x = f.yyyy2; - if (x !== undefined) { - return Curry._1(x, 0); - } else { - return 0; - } -} - -function fx(v) { - return v.x; -} - -exports.f = f; -exports.uf = uf; -exports.uf1 = uf1; -exports.uf2 = uf2; -exports.uff = uff; -exports.uff2 = uff2; -exports.uff3 = uff3; -exports.fx = fx; -/* Not a pure module */ diff --git a/jscomp/test/bs_abstract_test.res b/jscomp/test/bs_abstract_test.res deleted file mode 100644 index 3e1448039b..0000000000 --- a/jscomp/test/bs_abstract_test.res +++ /dev/null @@ -1,60 +0,0 @@ -@deriving(abstract) -type rec linked_list<'a> = { - hd: 'a, - mutable tl: Js.null>, -} - -let v = linked_list(~hd=3, ~tl=Js.null) - -tlSet(v, Js.Null.return(v)) - -type rec t = (. int, int) => bool -@deriving(abstract) -and x = { - k: t, - y: string, -} - -let x0 = k => x(~k, ~y="xx") -let x1 = k => x(~k, ~y="xx") - -let f = x(~k=(. x, y) => x == y, ~y="x") - -@deriving(abstract) -type u = { - x: int, - y0: int => int, - y1: (int, int) => int, -} - -let uf = u => u->y0Get(1) -let uf1 = u => u->y1Get(1) -let uf2 = u => u->y1Get(1, 2) - -@deriving(abstract) -type u1 = { - x: int, - yyyy: (. int) => int, - yyyy1: (. int, int) => int, - @optional yyyy2: int => int, -} - -let uff = f => (f->yyyyGet)(. 1) - -let uff2 = f => (f->yyyy1Get)(. 1, 2) - -let uff3 = f => - switch f->yyyy2Get { - | None => 0 - | Some(x) => x(0) - } - -@deriving({abstract: light}) -type u3 = { - x: int, - yyyy: (. int) => int, - yyyy1: (. int, int) => int, - @optional yyyy2: int => int, -} - -let fx = v => v->x diff --git a/jscomp/test/bs_abstract_test.resi b/jscomp/test/bs_abstract_test.resi deleted file mode 100644 index e663e7d8bd..0000000000 --- a/jscomp/test/bs_abstract_test.resi +++ /dev/null @@ -1,27 +0,0 @@ -@deriving(abstract) -type rec linked_list<'a> = private { - /* hd : 'a ; */ - tl: Js.null>, -} - -type rec t = (. int, int) => bool -@deriving(abstract) -and x = private { - k: t, - /* y : string */ -} - -let f: x -type u -let uf: u => int -let uf1: (u, int) => int -let uf2: u => int - -type u1 -let uff: u1 => int -let uff2: u1 => int - -let uff3: u1 => int - -type u3 -let fx: u3 => int diff --git a/jscomp/test/bs_array_test.js b/jscomp/test/bs_array_test.js index 84ffb53c49..e749807774 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(l) { + return Belt_Array.getExn([ + 0, + 1 + ], l); } 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 @@ -308,7 +305,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, @@ -1272,28 +1273,20 @@ id$1("File \"bs_array_test.res\", line 355, characters 5-12", [ 4 ]); -function every2(xs, ys) { - let partial_arg = Belt_List.toArray(ys); - let partial_arg$1 = Belt_List.toArray(xs); - return function (param) { - return Belt_Array.every2(partial_arg$1, partial_arg, param); - }; +function every2(xs, ys, x) { + return Belt_Array.every2(Belt_List.toArray(xs), Belt_List.toArray(ys), x); } -function some2(xs, ys) { - let partial_arg = Belt_List.toArray(ys); - let partial_arg$1 = Belt_List.toArray(xs); - return function (param) { - return Belt_Array.some2(partial_arg$1, partial_arg, param); - }; +function some2(xs, ys, x) { + return Belt_Array.some2(Belt_List.toArray(xs), Belt_List.toArray(ys), x); } eq("File \"bs_array_test.res\", line 363, characters 5-12", every2(/* [] */0, { hd: 1, tl: /* [] */0 -})(function (x, y) { +}, (function (x, y) { return x > y; -}), true); +})), true); eq("File \"bs_array_test.res\", line 364, characters 5-12", every2({ hd: 2, @@ -1304,9 +1297,9 @@ eq("File \"bs_array_test.res\", line 364, characters 5-12", every2({ }, { hd: 1, tl: /* [] */0 -})(function (x, y) { +}, (function (x, y) { return x > y; -}), true); +})), true); eq("File \"bs_array_test.res\", line 365, characters 5-12", every2({ hd: 2, @@ -1314,9 +1307,9 @@ eq("File \"bs_array_test.res\", line 365, characters 5-12", every2({ }, { hd: 1, tl: /* [] */0 -})(function (x, y) { +}, (function (x, y) { return x > y; -}), true); +})), true); eq("File \"bs_array_test.res\", line 366, characters 5-12", every2({ hd: 2, @@ -1330,9 +1323,9 @@ eq("File \"bs_array_test.res\", line 366, characters 5-12", every2({ hd: 4, tl: /* [] */0 } -})(function (x, y) { +}, (function (x, y) { return x > y; -}), false); +})), false); eq("File \"bs_array_test.res\", line 367, characters 5-12", every2({ hd: 2, @@ -1346,16 +1339,16 @@ eq("File \"bs_array_test.res\", line 367, characters 5-12", every2({ hd: 0, tl: /* [] */0 } -})(function (x, y) { +}, (function (x, y) { return x > y; -}), true); +})), true); eq("File \"bs_array_test.res\", line 368, characters 5-12", some2(/* [] */0, { hd: 1, tl: /* [] */0 -})(function (x, y) { +}, (function (x, y) { return x > y; -}), false); +})), false); eq("File \"bs_array_test.res\", line 369, characters 5-12", some2({ hd: 2, @@ -1366,9 +1359,9 @@ eq("File \"bs_array_test.res\", line 369, characters 5-12", some2({ }, { hd: 1, tl: /* [] */0 -})(function (x, y) { +}, (function (x, y) { return x > y; -}), true); +})), true); eq("File \"bs_array_test.res\", line 370, characters 5-12", some2({ hd: 2, @@ -1382,9 +1375,9 @@ eq("File \"bs_array_test.res\", line 370, characters 5-12", some2({ hd: 4, tl: /* [] */0 } -})(function (x, y) { +}, (function (x, y) { return x > y; -}), true); +})), true); eq("File \"bs_array_test.res\", line 371, characters 5-12", some2({ hd: 0, @@ -1398,9 +1391,9 @@ eq("File \"bs_array_test.res\", line 371, characters 5-12", some2({ hd: 4, tl: /* [] */0 } -})(function (x, y) { +}, (function (x, y) { return x > y; -}), false); +})), false); eq("File \"bs_array_test.res\", line 372, characters 5-12", some2({ hd: 0, @@ -1414,9 +1407,9 @@ eq("File \"bs_array_test.res\", line 372, characters 5-12", some2({ hd: 2, tl: /* [] */0 } -})(function (x, y) { +}, (function (x, y) { return x > y; -}), true); +})), true); eq("File \"bs_array_test.res\", line 376, characters 5-12", Belt_Array.concat([], [ 1, diff --git a/jscomp/test/bs_array_test.res b/jscomp/test/bs_array_test.res index dbb88eb2de..44192a5b0d 100644 --- a/jscomp/test/bs_array_test.res +++ b/jscomp/test/bs_array_test.res @@ -32,12 +32,12 @@ let () = { (A.get(v, 0), A.get(v, 1), A.get(v, 2), A.get(v, 3), A.get(v, -1)), (Some(1), Some(2), None, None, None), ) - throw(__LOC__, _ => A.getExn([0, 1], -1) |> ignore) - throw(__LOC__, _ => A.getExn([0, 1], 2) |> ignore) + throw(__LOC__, _ => ignore(A.getExn([0, 1], -1))) + throw(__LOC__, _ => ignore(A.getExn([0, 1], 2))) b( __LOC__, { - let f = A.getExn([0, 1]) + let f = l => A.getExn([0, 1], l) (f(0), f(1)) == (0, 1) }, ) @@ -78,17 +78,17 @@ let () = { ) } -let id = x => eq(__LOC__, \"@@"(Js.Vector.toList, Js.List.toVector(x)), x) +let id = x => eq(__LOC__, Js.Vector.toList(Js.List.toVector(x)), x) let () = { eq(__LOC__, Js.List.toVector(list{1, 2, 3}), [1, 2, 3]) - eq(__LOC__, Js.Vector.map((. x) => x + 1, [1, 2, 3]), [2, 3, 4]) + eq(__LOC__, Js.Vector.map(x => x + 1, [1, 2, 3]), [2, 3, 4]) eq(__LOC__, Js.Vector.make(5, 3), [3, 3, 3, 3, 3]) eq( __LOC__, { - let a = Js.Vector.init(5, (. i) => i + 1) - Js.Vector.filterInPlace((. j) => mod(j, 2) == 0, a) + let a = Js.Vector.init(5, i => i + 1) + Js.Vector.filterInPlace(j => mod(j, 2) == 0, a) a }, [2, 4], @@ -97,8 +97,8 @@ let () = { eq( __LOC__, { - let a = Js.Vector.init(5, (. i) => i + 1) - Js.Vector.filterInPlace((. j) => mod(j, 2) != 0, a) + let a = Js.Vector.init(5, i => i + 1) + Js.Vector.filterInPlace(j => mod(j, 2) != 0, a) a }, [1, 3, 5], @@ -111,7 +111,7 @@ let () = { id(list{1, 2, 3, 4, 5}) id({ open Js.Vector - \"@@"(toList, init(100, (. i) => i)) + toList(init(100, i => i)) }) } @@ -146,7 +146,7 @@ let () = { eq(__LOC__, A.reduceWithIndex([1, 2, 3, 4], 0, (acc, x, i) => acc + x + i), 16) b(__LOC__, A.reduceReverse2([1, 2, 3], [1, 2], 0, (acc, x, y) => acc + x + y) == 6) } -let addone = (. x) => x + 1 +let addone = x => x + 1 let makeMatrixExn = (sx, sy, init) => { /* let open A in */ @@ -324,8 +324,8 @@ let () = { eq(__LOC__, sumUsingForEach([0, 1, 2, 3, 4]), 10) b(__LOC__, !A.every([0, 1, 2, 3, 4], x => x > 2)) b(__LOC__, A.some([1, 3, 7, 8], x => mod(x, 2) == 0)) - b(__LOC__, \"@@"(not, A.some([1, 3, 7], x => mod(x, 2) == 0))) - b(__LOC__, \"@@"(not, A.eq([0, 1], [1], \"="))) + b(__LOC__, not(A.some([1, 3, 7], x => mod(x, 2) == 0))) + b(__LOC__, not(A.eq([0, 1], [1], \"="))) b( __LOC__, { @@ -357,8 +357,8 @@ let () = { let () = { module N = { - let every2 = (xs, ys) => A.every2(L.toArray(xs), L.toArray(ys)) - let some2 = (xs, ys) => A.some2(L.toArray(xs), L.toArray(ys)) + let every2 = (xs, ys, x) => A.every2(L.toArray(xs), L.toArray(ys), x) + let some2 = (xs, ys, x) => A.some2(L.toArray(xs), L.toArray(ys), x) } eq(__LOC__, N.every2(list{}, list{1}, (x, y) => x > y), true) eq(__LOC__, N.every2(list{2, 3}, list{1}, (x, y) => x > y), true) diff --git a/jscomp/test/bs_auto_uncurry.js b/jscomp/test/bs_auto_uncurry.js index c1a250bc22..21d0e40461 100644 --- a/jscomp/test/bs_auto_uncurry.js +++ b/jscomp/test/bs_auto_uncurry.js @@ -36,13 +36,13 @@ let xs = Array.prototype.map.call([ }; })); -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"); @@ -63,21 +63,19 @@ function f_03(xs, u) { return hi(Curry.__1(u)); } -function fishy(x, y, z) { - return map2(x, y, Curry.__2(z)); -} - function h(x, y, z) { return map2(x, y, Curry.__2(z)); } function h1(x, y, u, z) { - let partial_arg = Curry._1(z, u); + let partial_arg = z(u); return map2(x, y, Curry.__2(partial_arg)); } -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) { @@ -87,20 +85,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; })); } @@ -116,7 +114,7 @@ function h6(x) { return ff2(x, "3", add); } -function unit_magic(param) { +function unit_magic() { console.log("noinline"); console.log("noinline"); return 3; @@ -124,13 +122,11 @@ function unit_magic(param) { let f_unit_magic = unit_magic(); -function hh(xs) { - return function (param) { - Caml_splice_call.spliceApply(f_0002, [ - xs, - param - ]); - }; +function hh(xs, a) { + Caml_splice_call.spliceApply(f_0002, [ + xs, + a + ]); } exports.Curry = Curry$1; @@ -142,7 +138,6 @@ exports.f_0 = f_0; exports.f_01 = f_01; exports.f_02 = f_02; exports.f_03 = f_03; -exports.fishy = fishy; exports.h = h; exports.h1 = h1; exports.add3 = add3; diff --git a/jscomp/test/bs_auto_uncurry.res b/jscomp/test/bs_auto_uncurry.res index 7f1e243d9e..3fa907729e 100644 --- a/jscomp/test/bs_auto_uncurry.res +++ b/jscomp/test/bs_auto_uncurry.res @@ -15,7 +15,7 @@ let xbs = map([1, 2, 3, 5], x => x + 1) let f = (cb: int => int) => map([1, 2, 3, 4], cb) -let xs = map([1, 1, 2], (x, y) => y + x + 1) +let xs = map([1, 1, 2], (x) => (y) => y + x + 1) @val external map2: (array<'a>, array<'b>, @uncurry ('a, 'b) => 'c) => array<'c> = "map2" @@ -48,13 +48,11 @@ let f_02 = xs => let f_03 = (xs, u) => hi(u) /* arity adjust to [0] [ function (){return u (0)}] */ -let fishy = (x, y, z) => map2(x, y, x => z(x)) - let h = (x, y, z) => map2(x, y, z) let h1 = (x, y, u, z) => map2(x, y, z(u)) -let add3 = (x, y, z) => x + y + z +let add3 = (x) => (y, z) => x + y + z let h2 = x => ff(x, 2, \"+") @@ -169,4 +167,4 @@ let f_unit_magic = unit_magic() @variadic @val external f_0002: (string, array) => unit = "f_0002" -let hh = xs => f_0002(xs) +let hh = (xs, a) => f_0002(xs, a) 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 3252a97b0b..5931516b83 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); } @@ -67,7 +66,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); } @@ -142,8 +141,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); } @@ -178,8 +177,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); @@ -220,8 +219,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); } @@ -256,8 +255,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..30bbdae5a9 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(a, b) { + eq("FLATTEN", a, b); +} + +$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(a, b) { + eq("CONCATMANY", a, b); +} + +$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(a, b) { + eq("APPEND", a, b); +} + +$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(a, b) { + eq("ZIP", a, b); +} + +$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(a, b) { + eq("PARTITION", a, b); +} + +$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(a, b) { + eq("UNZIP", a, b); +} + +$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(a, b) { + eq("FILTER", a, b); +} + +$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(a, b) { + eq("FILTER2", a, b); +} + +$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(a, b) { + eq("MAP", a, b); +} + +$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(a, b) { + eq("MAP2", a, b); +} + 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(a, b) { + eq("TAKE", a, b); +} + +$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(a, b) { + eq("DROP", a, b); +} + +$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(a, b) { + eq("SPLIT", a, b); +} 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(a, b) { + eq("REMOVEASSOQ", a, b); +} + 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(a, b) { + eq("SORT", a, b); +} + 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_list_test.res b/jscomp/test/bs_list_test.res index 0972509555..0df499887e 100644 --- a/jscomp/test/bs_list_test.res +++ b/jscomp/test/bs_list_test.res @@ -34,7 +34,7 @@ let () = { } let () = { - let \"=~" = eq("FLATTEN") + let \"=~" = (a, b) => eq("FLATTEN", a, b) \"=~"( { @@ -48,7 +48,7 @@ let () = { } let () = { - let \"=~" = eq("CONCATMANY") + let \"=~" = (a, b) => eq("CONCATMANY", a, b) \"=~"( { open N @@ -64,23 +64,23 @@ let () = { let () = eq( __LOC__, - { + N.toArray({ open N concat(makeBy(100, i => i), makeBy(100, i => i)) - } |> N.toArray, + }), { open A concat(makeBy(100, i => i), makeBy(100, i => i)) }, ) let () = { - let \"=~" = eq("APPEND") + let \"=~" = (a, b) => eq("APPEND", a, b) \"=~"(N.concat(list{1}, list{}), list{1}) \"=~"(N.concat(list{}, list{1}), list{1}) } let () = { - let \"=~" = eq("ZIP") + let \"=~" = (a, b) => eq("ZIP", a, b) \"=~"(N.zip(list{1, 2, 3}, list{3, 4}), list{(1, 3), (2, 4)}) \"=~"(N.zip(list{}, list{1}), list{}) @@ -93,7 +93,7 @@ let mod2 = x => mod(x, 2) == 0 let evenIndex = (_x, i) => mod(i, 2) == 0 let () = { - let \"=~" = eq("PARTITION") + let \"=~" = (a, b) => eq("PARTITION", a, b) \"=~"(N.partition(list{1, 2, 3, 2, 3, 4}, mod2), (list{2, 2, 4}, list{1, 3, 3})) \"=~"(N.partition(list{2, 2, 2, 4}, mod2), (list{2, 2, 2, 4}, list{})) @@ -102,14 +102,14 @@ let () = { } let () = { - let \"=~" = eq("UNZIP") + let \"=~" = (a, b) => eq("UNZIP", a, b) \"=~"(N.unzip(list{}), (list{}, list{})) \"=~"(N.unzip(list{(1, 2)}), (list{1}, list{2})) \"=~"(N.unzip(list{(1, 2), (3, 4)}), (list{1, 3}, list{2, 4})) } let () = { - let \"=~" = eq("FILTER") + let \"=~" = (a, b) => eq("FILTER", a, b) \"=~"(N.keep(list{1, 2, 3, 4}, mod2), list{2, 4}) \"=~"(N.keep(list{1, 3, 41}, mod2), list{}) \"=~"(N.keep(list{}, mod2), list{}) @@ -117,7 +117,7 @@ let () = { } let () = { - let \"=~" = eq("FILTER2") + let \"=~" = (a, b) => eq("FILTER2", a, b) \"=~"(N.keepWithIndex(list{}, evenIndex), list{}) \"=~"(N.keepWithIndex(list{1, 2, 3, 4}, evenIndex), list{1, 3}) \"=~"(N.keepWithIndex(list{0, 1, 2, 3, 4, 5, 6, 7}, evenIndex), list{0, 2, 4, 6}) @@ -126,7 +126,7 @@ let () = { let id: int => int = x => x let () = { - let \"=~" = eq("MAP") + let \"=~" = (a, b) => eq("MAP", a, b) \"=~"(N.map(N.makeBy(5, id), x => x * 2), list{0, 2, 4, 6, 8}) \"=~"(N.map(list{}, id), list{}) \"=~"(N.map(list{1}, x => -x), list{-1}) @@ -135,7 +135,7 @@ let add = (a, b) => a + b let length_10_id = N.makeBy(10, id) let length_8_id = N.makeBy(8, id) let () = { - let \"=~" = eq("MAP2") + let \"=~" = (a, b) => eq("MAP2", a, b) let b = length_10_id let c = length_8_id let d = N.makeBy(10, x => 2 * x) @@ -166,7 +166,7 @@ let () = { } let () = { - let \"=~" = eq("TAKE") + let \"=~" = (a, b) => eq("TAKE", a, b) \"=~"(N.take(list{1, 2, 3}, 2), Some(list{1, 2})) \"=~"(N.take(list{}, 1), None) \"=~"(N.take(list{1, 2}, 3), None) @@ -177,7 +177,7 @@ let () = { } let () = { - let \"=~" = eq("DROP") + let \"=~" = (a, b) => eq("DROP", a, b) \"=~"(N.drop(length_10_id, 10), Some(list{})) \"=~"(N.drop(length_10_id, 8), Some(list{8, 9})) \"=~"(N.drop(length_10_id, 0), Some(length_10_id)) @@ -185,7 +185,7 @@ let () = { } let () = { - let \"=~" = eq("SPLIT") + let \"=~" = (a, b) => eq("SPLIT", a, b) let a = N.makeBy(5, id) \"=~"(N.splitAt(list{}, 1), None) \"=~"(N.splitAt(a, 6), None) @@ -200,7 +200,7 @@ let () = { let succx = x => x + 1 let () = { - let \"=~" = eq("REMOVEASSOQ") + let \"=~" = (a, b) => eq("REMOVEASSOQ", a, b) let eqx = (x, y) => (x: int) == y b(__LOC__, N.hasAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 2, \"=")) b(__LOC__, !N.hasAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 4, \"=")) @@ -254,9 +254,9 @@ let () = { ) eq(__LOC__, N.head(list{}), None) throw(__LOC__, _ => N.headExn(list{})) - throw(__LOC__, _ => N.tailExn(list{}) |> ignore) - throw(__LOC__, _ => N.getExn(list{0, 1}, -1) |> ignore) - throw(__LOC__, _ => N.getExn(list{0, 1}, 2) |> ignore) + throw(__LOC__, _ => ignore(N.tailExn(list{}))) + throw(__LOC__, _ => ignore(N.getExn(list{0, 1}, -1))) + throw(__LOC__, _ => ignore(N.getExn(list{0, 1}, 2))) eq(__LOC__, N.map(list{0, 1}, i => N.getExn(list{0, 1}, i)), list{0, 1}) eq(__LOC__, N.headExn(list{1}), 1) eq(__LOC__, N.tailExn(list{1}), list{}) @@ -364,17 +364,17 @@ let () = { } let () = { - let \"=~" = eq("SORT") + let \"=~" = (a, b) => eq("SORT", a, b) let cmp = (a, b) => a - b \"=~"(N.sort(list{5, 4, 3, 2}, cmp), list{2, 3, 4, 5}) \"=~"(N.sort(list{3, 9, 37, 3, 1}, cmp), list{1, 3, 3, 9, 37}) } let () = { - b(__LOC__, \"@@"(not, N.eq(list{1, 2, 3}, list{1, 2}, (x, y) => x == y))) + b(__LOC__, not(N.eq(list{1, 2, 3}, list{1, 2}, (x, y) => x == y))) b(__LOC__, N.eq(list{1, 2, 3}, list{1, 2, 3}, (x, y) => x == y)) - b(__LOC__, \"@@"(not, N.eq(list{1, 2, 3}, list{1, 2, 4}, (x, y) => x == y))) - b(__LOC__, \"@@"(not, N.eq(list{1, 2, 3}, list{1, 2, 3, 4}, \"="))) + b(__LOC__, not(N.eq(list{1, 2, 3}, list{1, 2, 4}, (x, y) => x == y))) + b(__LOC__, not(N.eq(list{1, 2, 3}, list{1, 2, 3, 4}, \"="))) } let () = { let u0 = N.makeBy(20, x => x) diff --git a/jscomp/test/bs_map_set_dict_test.js b/jscomp/test/bs_map_set_dict_test.js index e881facfed..ae99422e67 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(l) { + return Belt_Map.fromArray(l, Icmp); } function $eq$tilde(a, b) { - return function (param) { - return Belt_Map.eq(a, b, param); + return function (l) { + return Belt_Map.eq(a, b, l); }; } -let u0 = f(Belt_Array.map(Array_data_util.randomRange(0, 39), (function (x) { +let l = Belt_Array.map(Array_data_util.randomRange(0, 39), (function (x) { return [ x, x ]; -}))); +})); + +let u0 = Belt_Map.fromArray(l, 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 l$1 = Belt_Array.makeByAndShuffle(10000, (function (x) { return [ x, x ]; -}))); +})); + +let u = Belt_Map.fromArray(l$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_set_dict_test.res b/jscomp/test/bs_map_set_dict_test.res index 24075c1e60..9d88483bf8 100644 --- a/jscomp/test/bs_map_set_dict_test.res +++ b/jscomp/test/bs_map_set_dict_test.res @@ -62,8 +62,8 @@ let () = { Js.log(data.contents) } -let f = M.fromArray(~id=module(Icmp)) -let \"=~" = (a, b) => M.eq(a, b) +let f = l => M.fromArray(~id=module(Icmp), l) +let \"=~" = (a, b) => l => M.eq(a, b, l) let () = { let u0 = f(A.map(I.randomRange(0, 39), x => (x, x))) 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..b944e55362 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(loc, x) { + Mt.bool_suites(test_id, suites, loc, x); } function f(x, y) { diff --git a/jscomp/test/bs_min_max_test.res b/jscomp/test/bs_min_max_test.res index b81ea690db..ccd36b4aca 100644 --- a/jscomp/test/bs_min_max_test.res +++ b/jscomp/test/bs_min_max_test.res @@ -2,7 +2,7 @@ let suites: ref = ref(list{}) let test_id = ref(0) let eq = (loc, x, y) => Mt.eq_suites(~test_id, ~suites, loc, x, y) -let b = Mt.bool_suites(~test_id, ~suites) +let b = (loc, x) => Mt.bool_suites(~test_id, ~suites, loc, x) let f = (x, y) => Pervasives.compare(x + y, y + x) diff --git a/jscomp/test/bs_mutable_set_test.js b/jscomp/test/bs_mutable_set_test.js deleted file mode 100644 index 16d171bb1f..0000000000 --- a/jscomp/test/bs_mutable_set_test.js +++ /dev/null @@ -1,860 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Belt_List = require("../../lib/js/belt_List.js"); -let Belt_Array = require("../../lib/js/belt_Array.js"); -let Belt_Range = require("../../lib/js/belt_Range.js"); -let Caml_array = require("../../lib/js/caml_array.js"); -let Array_data_util = require("./array_data_util.js"); -let Belt_MutableSetInt = require("../../lib/js/belt_MutableSetInt.js"); -let Belt_internalAVLset = require("../../lib/js/belt_internalAVLset.js"); -let Belt_internalSetInt = require("../../lib/js/belt_internalSetInt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - Mt.eq_suites(test_id, suites, loc, x, y); -} - -function b(loc, x) { - Mt.bool_suites(test_id, suites, loc, x); -} - -let xs = Array_data_util.range(0, 30); - -let u = { - data: Belt_internalSetInt.fromArray(xs) -}; - -b("File \"bs_mutable_set_test.res\", line 21, characters 8-15", Belt_MutableSetInt.removeCheck(u, 0)); - -b("File \"bs_mutable_set_test.res\", line 22, characters 8-15", !Belt_MutableSetInt.removeCheck(u, 0)); - -b("File \"bs_mutable_set_test.res\", line 23, characters 8-15", Belt_MutableSetInt.removeCheck(u, 30)); - -b("File \"bs_mutable_set_test.res\", line 24, characters 8-15", Belt_MutableSetInt.removeCheck(u, 20)); - -eq("File \"bs_mutable_set_test.res\", line 25, characters 9-16", Belt_internalAVLset.size(u.data), 28); - -let r = Array_data_util.randomRange(0, 30); - -b("File \"bs_mutable_set_test.res\", line 27, characters 8-15", 29 === Belt_internalAVLset.maxUndefined(u.data)); - -b("File \"bs_mutable_set_test.res\", line 28, characters 8-15", 1 === Belt_internalAVLset.minUndefined(u.data)); - -Belt_MutableSetInt.add(u, 3); - -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)); - -Belt_MutableSetInt.add(u, 0); - -Belt_MutableSetInt.add(u, 1); - -Belt_MutableSetInt.add(u, 2); - -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)); - -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)); - -Belt_MutableSetInt.mergeMany(u, Array_data_util.randomRange(0, 20000)); - -Belt_MutableSetInt.mergeMany(u, Array_data_util.randomRange(0, 200)); - -eq("File \"bs_mutable_set_test.res\", line 46, characters 9-16", Belt_internalAVLset.size(u.data), 20001); - -Belt_MutableSetInt.removeMany(u, Array_data_util.randomRange(0, 200)); - -eq("File \"bs_mutable_set_test.res\", line 48, characters 9-16", Belt_internalAVLset.size(u.data), 19800); - -Belt_MutableSetInt.removeMany(u, Array_data_util.randomRange(0, 1000)); - -eq("File \"bs_mutable_set_test.res\", line 50, characters 9-16", Belt_internalAVLset.size(u.data), 19000); - -Belt_MutableSetInt.removeMany(u, Array_data_util.randomRange(0, 1000)); - -eq("File \"bs_mutable_set_test.res\", line 52, characters 9-16", Belt_internalAVLset.size(u.data), 19000); - -Belt_MutableSetInt.removeMany(u, Array_data_util.randomRange(1000, 10000)); - -eq("File \"bs_mutable_set_test.res\", line 54, characters 9-16", Belt_internalAVLset.size(u.data), 10000); - -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)); - -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)); - -let xs$1 = Array_data_util.randomRange(1000, 2000); - -let v = { - data: Belt_internalSetInt.fromArray(xs$1) -}; - -let bs = Belt_Array.map(Array_data_util.randomRange(500, 1499), (function (x) { - return Belt_MutableSetInt.removeCheck(v, x); -})); - -let indeedRemoved = Belt_Array.reduce(bs, 0, (function (acc, x) { - if (x) { - return acc + 1 | 0; - } else { - return acc; - } -})); - -eq("File \"bs_mutable_set_test.res\", line 72, characters 9-16", indeedRemoved, 500); - -eq("File \"bs_mutable_set_test.res\", line 73, characters 9-16", Belt_internalAVLset.size(v.data), 501); - -let cs = Belt_Array.map(Array_data_util.randomRange(500, 2000), (function (x) { - return Belt_MutableSetInt.addCheck(v, x); -})); - -let indeedAded = Belt_Array.reduce(cs, 0, (function (acc, x) { - if (x) { - return acc + 1 | 0; - } else { - return acc; - } -})); - -eq("File \"bs_mutable_set_test.res\", line 82, characters 9-16", indeedAded, 1000); - -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({ - data: undefined -})); - -eq("File \"bs_mutable_set_test.res\", line 85, characters 9-16", Belt_internalAVLset.minimum(v.data), 500); - -eq("File \"bs_mutable_set_test.res\", line 86, characters 9-16", Belt_internalAVLset.maximum(v.data), 2000); - -eq("File \"bs_mutable_set_test.res\", line 87, characters 9-16", Belt_internalAVLset.minUndefined(v.data), 500); - -eq("File \"bs_mutable_set_test.res\", line 88, characters 9-16", Belt_internalAVLset.maxUndefined(v.data), 2000); - -eq("File \"bs_mutable_set_test.res\", line 89, characters 9-16", Belt_MutableSetInt.reduce(v, 0, (function (x, y) { - return x + y | 0; -})), 1876250); - -b("File \"bs_mutable_set_test.res\", line 90, characters 8-15", Belt_List.eq(Belt_internalAVLset.toList(v.data), Belt_List.makeBy(1501, (function (i) { - return i + 500 | 0; -})), (function (x, y) { - return x === y; -}))); - -eq("File \"bs_mutable_set_test.res\", line 91, characters 9-16", Belt_internalAVLset.toArray(v.data), Array_data_util.range(500, 2000)); - -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 94, characters 9-16", Belt_internalSetInt.get(v.data, 1200), 1200); - -let match = Belt_MutableSetInt.split(v, 1000); - -let match$1 = match[0]; - -let bb = match$1[1]; - -let aa = match$1[0]; - -b("File \"bs_mutable_set_test.res\", line 96, characters 8-15", match[1]); - -b("File \"bs_mutable_set_test.res\", line 97, characters 8-15", Belt_Array.eq(Belt_internalAVLset.toArray(aa.data), Array_data_util.range(500, 999), (function (x, y) { - return x === y; -}))); - -b("File \"bs_mutable_set_test.res\", line 98, characters 8-15", Belt_Array.eq(Belt_internalAVLset.toArray(bb.data), Array_data_util.range(1001, 2000), (function (prim0, prim1) { - return prim0 === prim1; -}))); - -b("File \"bs_mutable_set_test.res\", line 99, characters 8-15", Belt_MutableSetInt.subset(aa, v)); - -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 c = Belt_MutableSetInt.removeCheck(v, 1000); - -b("File \"bs_mutable_set_test.res\", line 103, characters 8-15", c); - -let match$2 = Belt_MutableSetInt.split(v, 1000); - -let match$3 = match$2[0]; - -let bb$1 = match$3[1]; - -let aa$1 = match$3[0]; - -b("File \"bs_mutable_set_test.res\", line 105, characters 8-15", !match$2[1]); - -b("File \"bs_mutable_set_test.res\", line 106, characters 8-15", Belt_Array.eq(Belt_internalAVLset.toArray(aa$1.data), Array_data_util.range(500, 999), (function (prim0, prim1) { - return prim0 === prim1; -}))); - -b("File \"bs_mutable_set_test.res\", line 107, characters 8-15", Belt_Array.eq(Belt_internalAVLset.toArray(bb$1.data), Array_data_util.range(1001, 2000), (function (prim0, prim1) { - return prim0 === prim1; -}))); - -b("File \"bs_mutable_set_test.res\", line 108, characters 8-15", Belt_MutableSetInt.subset(aa$1, v)); - -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 xs$2 = Array_data_util.randomRange(0, 100); - -let aa$2 = { - data: Belt_internalSetInt.fromArray(xs$2) -}; - -let xs$3 = Array_data_util.randomRange(40, 120); - -let bb$2 = { - data: Belt_internalSetInt.fromArray(xs$3) -}; - -let cc = Belt_MutableSetInt.union(aa$2, bb$2); - -let xs$4 = Array_data_util.randomRange(0, 120); - -b("File \"bs_mutable_set_test.res\", line 120, characters 8-15", Belt_MutableSetInt.eq(cc, { - data: Belt_internalSetInt.fromArray(xs$4) -})); - -let xs$5 = Array_data_util.randomRange(0, 20); - -let xs$6 = Array_data_util.randomRange(21, 40); - -let xs$7 = Array_data_util.randomRange(0, 40); - -b("File \"bs_mutable_set_test.res\", line 123, characters 8-15", Belt_MutableSetInt.eq(Belt_MutableSetInt.union({ - data: Belt_internalSetInt.fromArray(xs$5) -}, { - data: Belt_internalSetInt.fromArray(xs$6) -}), { - data: Belt_internalSetInt.fromArray(xs$7) -})); - -let dd = Belt_MutableSetInt.intersect(aa$2, bb$2); - -let xs$8 = Array_data_util.randomRange(40, 100); - -b("File \"bs_mutable_set_test.res\", line 127, characters 8-15", Belt_MutableSetInt.eq(dd, { - data: Belt_internalSetInt.fromArray(xs$8) -})); - -let xs$9 = Array_data_util.randomRange(0, 20); - -let xs$10 = Array_data_util.randomRange(21, 40); - -b("File \"bs_mutable_set_test.res\", line 129, characters 8-15", Belt_MutableSetInt.eq(Belt_MutableSetInt.intersect({ - data: Belt_internalSetInt.fromArray(xs$9) -}, { - data: Belt_internalSetInt.fromArray(xs$10) -}), { - data: undefined -})); - -let xs$11 = Array_data_util.randomRange(21, 40); - -let xs$12 = Array_data_util.randomRange(0, 20); - -b("File \"bs_mutable_set_test.res\", line 136, characters 8-15", Belt_MutableSetInt.eq(Belt_MutableSetInt.intersect({ - data: Belt_internalSetInt.fromArray(xs$11) -}, { - data: Belt_internalSetInt.fromArray(xs$12) -}), { - data: undefined -})); - -b("File \"bs_mutable_set_test.res\", line 142, characters 8-15", Belt_MutableSetInt.eq(Belt_MutableSetInt.intersect({ - data: Belt_internalSetInt.fromArray([ - 1, - 3, - 4, - 5, - 7, - 9 - ]) -}, { - data: Belt_internalSetInt.fromArray([ - 2, - 4, - 5, - 6, - 8, - 10 - ]) -}), { - data: Belt_internalSetInt.fromArray([ - 4, - 5 - ]) -})); - -let xs$13 = Array_data_util.randomRange(0, 39); - -b("File \"bs_mutable_set_test.res\", line 143, characters 8-15", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff(aa$2, bb$2), { - data: Belt_internalSetInt.fromArray(xs$13) -})); - -let xs$14 = Array_data_util.randomRange(101, 120); - -b("File \"bs_mutable_set_test.res\", line 144, characters 8-15", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff(bb$2, aa$2), { - data: Belt_internalSetInt.fromArray(xs$14) -})); - -let xs$15 = Array_data_util.randomRange(21, 40); - -let xs$16 = Array_data_util.randomRange(0, 20); - -let xs$17 = Array_data_util.randomRange(21, 40); - -b("File \"bs_mutable_set_test.res\", line 146, characters 8-15", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff({ - data: Belt_internalSetInt.fromArray(xs$15) -}, { - data: Belt_internalSetInt.fromArray(xs$16) -}), { - data: Belt_internalSetInt.fromArray(xs$17) -})); - -let xs$18 = Array_data_util.randomRange(0, 20); - -let xs$19 = Array_data_util.randomRange(21, 40); - -let xs$20 = Array_data_util.randomRange(0, 20); - -b("File \"bs_mutable_set_test.res\", line 153, characters 8-15", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff({ - data: Belt_internalSetInt.fromArray(xs$18) -}, { - data: Belt_internalSetInt.fromArray(xs$19) -}), { - data: Belt_internalSetInt.fromArray(xs$20) -})); - -let xs$21 = Array_data_util.randomRange(0, 20); - -let xs$22 = Array_data_util.randomRange(0, 40); - -let xs$23 = Array_data_util.randomRange(0, -1); - -b("File \"bs_mutable_set_test.res\", line 161, characters 8-15", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff({ - data: Belt_internalSetInt.fromArray(xs$21) -}, { - data: Belt_internalSetInt.fromArray(xs$22) -}), { - data: Belt_internalSetInt.fromArray(xs$23) -})); - -let xs$24 = Array_data_util.randomRange(0, 1000); - -let a0 = { - data: Belt_internalSetInt.fromArray(xs$24) -}; - -let a1 = Belt_MutableSetInt.keep(a0, (function (x) { - return x % 2 === 0; -})); - -let a2 = Belt_MutableSetInt.keep(a0, (function (x) { - return x % 2 !== 0; -})); - -let match$4 = Belt_MutableSetInt.partition(a0, (function (x) { - return x % 2 === 0; -})); - -let a4 = match$4[1]; - -let a3 = match$4[0]; - -b("File \"bs_mutable_set_test.res\", line 173, characters 8-15", Belt_MutableSetInt.eq(a1, a3)); - -b("File \"bs_mutable_set_test.res\", line 174, characters 8-15", Belt_MutableSetInt.eq(a2, a4)); - -Belt_List.forEach({ - hd: a0, - tl: { - hd: a1, - tl: { - hd: a2, - tl: { - hd: a3, - tl: { - hd: a4, - tl: /* [] */0 - } - } - } - } -}, (function (x) { - Belt_internalAVLset.checkInvariantInternal(x.data); -})); - -let v$1 = { - data: undefined -}; - -for(let i$2 = 0; i$2 <= 100000; ++i$2){ - Belt_MutableSetInt.add(v$1, 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); -}))); - -eq("File \"bs_mutable_set_test.res\", line 189, characters 5-12", Belt_internalAVLset.size(v$1.data), 100001); - -let u$1 = Belt_Array.concat(Array_data_util.randomRange(30, 100), Array_data_util.randomRange(40, 120)); - -let v$2 = { - data: undefined -}; - -Belt_MutableSetInt.mergeMany(v$2, u$1); - -eq("File \"bs_mutable_set_test.res\", line 196, characters 5-12", Belt_internalAVLset.size(v$2.data), 91); - -eq("File \"bs_mutable_set_test.res\", line 197, characters 5-12", Belt_internalAVLset.toArray(v$2.data), Array_data_util.range(30, 120)); - -let u$2 = Belt_Array.concat(Array_data_util.randomRange(0, 100000), Array_data_util.randomRange(0, 100)); - -let v$3 = { - data: Belt_internalSetInt.fromArray(u$2) -}; - -eq("File \"bs_mutable_set_test.res\", line 203, characters 5-12", Belt_internalAVLset.size(v$3.data), 100001); - -let u$3 = Array_data_util.randomRange(50000, 80000); - -for(let i$3 = 0 ,i_finish$1 = u$3.length; i$3 < i_finish$1; ++i$3){ - Belt_MutableSetInt.remove(v$3, i$3); -} - -eq("File \"bs_mutable_set_test.res\", line 210, characters 5-12", Belt_internalAVLset.size(v$3.data), 70000); - -let vv = Array_data_util.randomRange(0, 100000); - -for(let i$4 = 0 ,i_finish$2 = vv.length; i$4 < i_finish$2; ++i$4){ - Belt_MutableSetInt.remove(v$3, Caml_array.get(vv, 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)); - -let xs$25 = Belt_Array.makeBy(30, (function (i) { - return i; -})); - -let v$4 = { - data: Belt_internalSetInt.fromArray(xs$25) -}; - -Belt_MutableSetInt.remove(v$4, 30); - -Belt_MutableSetInt.remove(v$4, 29); - -b("File \"bs_mutable_set_test.res\", line 224, characters 4-11", 28 === Belt_internalAVLset.maxUndefined(v$4.data)); - -Belt_MutableSetInt.remove(v$4, 0); - -b("File \"bs_mutable_set_test.res\", line 226, characters 4-11", 1 === Belt_internalAVLset.minUndefined(v$4.data)); - -eq("File \"bs_mutable_set_test.res\", line 227, characters 5-12", Belt_internalAVLset.size(v$4.data), 28); - -let vv$1 = Array_data_util.randomRange(1, 28); - -for(let i$5 = 0 ,i_finish$3 = vv$1.length; i$5 < i_finish$3; ++i$5){ - Belt_MutableSetInt.remove(v$4, Caml_array.get(vv$1, i$5)); -} - -eq("File \"bs_mutable_set_test.res\", line 232, characters 5-12", Belt_internalAVLset.size(v$4.data), 0); - -function id(loc, x) { - let u = { - data: Belt_internalAVLset.fromSortedArrayUnsafe(x) - }; - Belt_internalAVLset.checkInvariantInternal(u.data); - b(loc, Belt_Array.every2(Belt_internalAVLset.toArray(u.data), x, (function (prim0, prim1) { - return prim0 === prim1; - }))); -} - -id("File \"bs_mutable_set_test.res\", line 242, characters 5-12", []); - -id("File \"bs_mutable_set_test.res\", line 243, characters 5-12", [0]); - -id("File \"bs_mutable_set_test.res\", line 244, characters 5-12", [ - 0, - 1 -]); - -id("File \"bs_mutable_set_test.res\", line 245, characters 5-12", [ - 0, - 1, - 2 -]); - -id("File \"bs_mutable_set_test.res\", line 246, characters 5-12", [ - 0, - 1, - 2, - 3 -]); - -id("File \"bs_mutable_set_test.res\", line 247, characters 5-12", [ - 0, - 1, - 2, - 3, - 4 -]); - -id("File \"bs_mutable_set_test.res\", line 248, characters 5-12", [ - 0, - 1, - 2, - 3, - 4, - 5 -]); - -id("File \"bs_mutable_set_test.res\", line 249, characters 5-12", [ - 0, - 1, - 2, - 3, - 4, - 6 -]); - -id("File \"bs_mutable_set_test.res\", line 250, characters 5-12", [ - 0, - 1, - 2, - 3, - 4, - 6, - 7 -]); - -id("File \"bs_mutable_set_test.res\", line 251, characters 5-12", [ - 0, - 1, - 2, - 3, - 4, - 6, - 7, - 8 -]); - -id("File \"bs_mutable_set_test.res\", line 252, characters 5-12", [ - 0, - 1, - 2, - 3, - 4, - 6, - 7, - 8, - 9 -]); - -id("File \"bs_mutable_set_test.res\", line 253, characters 5-12", Array_data_util.range(0, 1000)); - -let xs$26 = Array_data_util.randomRange(0, 1000); - -let v$5 = { - data: Belt_internalSetInt.fromArray(xs$26) -}; - -let copyV = Belt_MutableSetInt.keep(v$5, (function (x) { - return x % 8 === 0; -})); - -let match$5 = Belt_MutableSetInt.partition(v$5, (function (x) { - return x % 8 === 0; -})); - -let cc$1 = Belt_MutableSetInt.keep(v$5, (function (x) { - return x % 8 !== 0; -})); - -for(let i$6 = 0; i$6 <= 200; ++i$6){ - Belt_MutableSetInt.remove(v$5, i$6); -} - -eq("File \"bs_mutable_set_test.res\", line 264, characters 5-12", Belt_internalAVLset.size(copyV.data), 126); - -eq("File \"bs_mutable_set_test.res\", line 265, characters 5-12", Belt_internalAVLset.toArray(copyV.data), Belt_Array.makeBy(126, (function (i) { - return (i << 3); -}))); - -eq("File \"bs_mutable_set_test.res\", line 266, characters 5-12", Belt_internalAVLset.size(v$5.data), 800); - -b("File \"bs_mutable_set_test.res\", line 267, characters 4-11", Belt_MutableSetInt.eq(copyV, match$5[0])); - -b("File \"bs_mutable_set_test.res\", line 268, characters 4-11", Belt_MutableSetInt.eq(cc$1, match$5[1])); - -let xs$27 = Array_data_util.randomRange(0, 1000); - -let v$6 = { - data: Belt_internalSetInt.fromArray(xs$27) -}; - -let match$6 = Belt_MutableSetInt.split(v$6, 400); - -let match$7 = match$6[0]; - -let xs$28 = Array_data_util.randomRange(0, 399); - -b("File \"bs_mutable_set_test.res\", line 274, characters 4-11", Belt_MutableSetInt.eq(match$7[0], { - data: Belt_internalSetInt.fromArray(xs$28) -})); - -let xs$29 = Array_data_util.randomRange(401, 1000); - -b("File \"bs_mutable_set_test.res\", line 275, characters 4-11", Belt_MutableSetInt.eq(match$7[1], { - data: Belt_internalSetInt.fromArray(xs$29) -})); - -let xs$30 = Belt_Array.map(Array_data_util.randomRange(0, 1000), (function (x) { - return (x << 1); -})); - -let d = { - data: Belt_internalSetInt.fromArray(xs$30) -}; - -let match$8 = Belt_MutableSetInt.split(d, 1001); - -let match$9 = match$8[0]; - -let xs$31 = Belt_Array.makeBy(501, (function (x) { - return (x << 1); -})); - -b("File \"bs_mutable_set_test.res\", line 278, characters 4-11", Belt_MutableSetInt.eq(match$9[0], { - data: Belt_internalSetInt.fromArray(xs$31) -})); - -let xs$32 = Belt_Array.makeBy(500, (function (x) { - return 1002 + (x << 1) | 0; -})); - -b("File \"bs_mutable_set_test.res\", line 279, characters 4-11", Belt_MutableSetInt.eq(match$9[1], { - data: Belt_internalSetInt.fromArray(xs$32) -})); - -let xs$33 = Array_data_util.randomRange(0, 100); - -let aa$3 = { - data: Belt_internalSetInt.fromArray(xs$33) -}; - -let xs$34 = Array_data_util.randomRange(40, 120); - -let bb$3 = { - data: Belt_internalSetInt.fromArray(xs$34) -}; - -let cc$2 = Belt_MutableSetInt.union(aa$3, bb$3); - -let xs$35 = Array_data_util.randomRange(0, 120); - -b("File \"bs_mutable_set_test.res\", line 289, characters 4-11", Belt_MutableSetInt.eq(cc$2, { - data: Belt_internalSetInt.fromArray(xs$35) -})); - -let xs$36 = Array_data_util.randomRange(0, 20); - -let xs$37 = Array_data_util.randomRange(21, 40); - -let xs$38 = Array_data_util.randomRange(0, 40); - -b("File \"bs_mutable_set_test.res\", line 292, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.union({ - data: Belt_internalSetInt.fromArray(xs$36) -}, { - data: Belt_internalSetInt.fromArray(xs$37) -}), { - data: Belt_internalSetInt.fromArray(xs$38) -})); - -let dd$1 = Belt_MutableSetInt.intersect(aa$3, bb$3); - -let xs$39 = Array_data_util.randomRange(40, 100); - -b("File \"bs_mutable_set_test.res\", line 296, characters 4-11", Belt_MutableSetInt.eq(dd$1, { - data: Belt_internalSetInt.fromArray(xs$39) -})); - -let xs$40 = Array_data_util.randomRange(0, 20); - -let xs$41 = Array_data_util.randomRange(21, 40); - -b("File \"bs_mutable_set_test.res\", line 298, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.intersect({ - data: Belt_internalSetInt.fromArray(xs$40) -}, { - data: Belt_internalSetInt.fromArray(xs$41) -}), { - data: undefined -})); - -let xs$42 = Array_data_util.randomRange(21, 40); - -let xs$43 = Array_data_util.randomRange(0, 20); - -b("File \"bs_mutable_set_test.res\", line 302, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.intersect({ - data: Belt_internalSetInt.fromArray(xs$42) -}, { - data: Belt_internalSetInt.fromArray(xs$43) -}), { - data: undefined -})); - -b("File \"bs_mutable_set_test.res\", line 305, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.intersect({ - data: Belt_internalSetInt.fromArray([ - 1, - 3, - 4, - 5, - 7, - 9 - ]) -}, { - data: Belt_internalSetInt.fromArray([ - 2, - 4, - 5, - 6, - 8, - 10 - ]) -}), { - data: Belt_internalSetInt.fromArray([ - 4, - 5 - ]) -})); - -let xs$44 = Array_data_util.randomRange(0, 39); - -b("File \"bs_mutable_set_test.res\", line 306, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff(aa$3, bb$3), { - data: Belt_internalSetInt.fromArray(xs$44) -})); - -let xs$45 = Array_data_util.randomRange(101, 120); - -b("File \"bs_mutable_set_test.res\", line 307, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff(bb$3, aa$3), { - data: Belt_internalSetInt.fromArray(xs$45) -})); - -let xs$46 = Array_data_util.randomRange(21, 40); - -let xs$47 = Array_data_util.randomRange(0, 20); - -let xs$48 = Array_data_util.randomRange(21, 40); - -b("File \"bs_mutable_set_test.res\", line 309, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff({ - data: Belt_internalSetInt.fromArray(xs$46) -}, { - data: Belt_internalSetInt.fromArray(xs$47) -}), { - data: Belt_internalSetInt.fromArray(xs$48) -})); - -let xs$49 = Array_data_util.randomRange(0, 20); - -let xs$50 = Array_data_util.randomRange(21, 40); - -let xs$51 = Array_data_util.randomRange(0, 20); - -b("File \"bs_mutable_set_test.res\", line 316, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff({ - data: Belt_internalSetInt.fromArray(xs$49) -}, { - data: Belt_internalSetInt.fromArray(xs$50) -}), { - data: Belt_internalSetInt.fromArray(xs$51) -})); - -let xs$52 = Array_data_util.randomRange(0, 20); - -let xs$53 = Array_data_util.randomRange(0, 40); - -let xs$54 = Array_data_util.randomRange(0, -1); - -b("File \"bs_mutable_set_test.res\", line 324, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff({ - data: Belt_internalSetInt.fromArray(xs$52) -}, { - data: Belt_internalSetInt.fromArray(xs$53) -}), { - data: Belt_internalSetInt.fromArray(xs$54) -})); - -Mt.from_pair_suites("Bs_mutable_set_test", suites.contents); - -let N; - -let I; - -let R; - -let A; - -let L; - -let empty = Belt_MutableSetInt.make; - -let fromArray = Belt_MutableSetInt.fromArray; - -let $plus$plus = Belt_MutableSetInt.union; - -let f = Belt_MutableSetInt.fromArray; - -let $eq$tilde = Belt_MutableSetInt.eq; - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.b = b; -exports.N = N; -exports.I = I; -exports.R = R; -exports.A = A; -exports.L = L; -exports.empty = empty; -exports.fromArray = fromArray; -exports.$plus$plus = $plus$plus; -exports.f = f; -exports.$eq$tilde = $eq$tilde; -/* u Not a pure module */ diff --git a/jscomp/test/bs_mutable_set_test.res b/jscomp/test/bs_mutable_set_test.res deleted file mode 100644 index 478bdd3c77..0000000000 --- a/jscomp/test/bs_mutable_set_test.res +++ /dev/null @@ -1,332 +0,0 @@ -let suites: ref = ref(list{}) -let test_id = ref(0) -let eq = (loc, x, y) => Mt.eq_suites(~test_id, ~suites, loc, x, y) -let b = (loc, x) => Mt.bool_suites(~test_id, ~suites, loc, x) - -module N = Belt.MutableSet.Int - -module I = Array_data_util -module R = Belt.Range -module A = Belt.Array -module L = Belt.List -let \"++" = A.concat -let empty = N.make -let fromArray = N.fromArray - -/* ********************************************** */ -include ( - { - let () = { - let u = fromArray(I.range(0, 30)) - b(__LOC__, N.removeCheck(u, 0)) - b(__LOC__, !N.removeCheck(u, 0)) - b(__LOC__, N.removeCheck(u, 30)) - b(__LOC__, N.removeCheck(u, 20)) - eq(__LOC__, N.size(u), 28) - let r = I.randomRange(0, 30) - b(__LOC__, Js.eqUndefined(29, N.maxUndefined(u))) - b(__LOC__, Js.eqUndefined(1, N.minUndefined(u))) - N.add(u, 3) - for i in 0 to A.length(r) - 1 { - N.remove(u, A.getUnsafe(r, i)) - } - b(__LOC__, N.isEmpty(u)) - N.add(u, 0) - N.add(u, 1) - N.add(u, 2) - N.add(u, 0) - eq(__LOC__, N.size(u), 3) - b(__LOC__, !N.isEmpty(u)) - for i in 0 to 3 { - N.remove(u, i) - } - b(__LOC__, N.isEmpty(u)) - N.mergeMany(u, I.randomRange(0, 20000)) - N.mergeMany(u, I.randomRange(0, 200)) - eq(__LOC__, N.size(u), 20001) - N.removeMany(u, I.randomRange(0, 200)) - eq(__LOC__, N.size(u), 19800) - N.removeMany(u, I.randomRange(0, 1000)) - eq(__LOC__, N.size(u), 19000) - N.removeMany(u, I.randomRange(0, 1000)) - eq(__LOC__, N.size(u), 19000) - N.removeMany(u, I.randomRange(1000, 10000)) - eq(__LOC__, N.size(u), 10000) - N.removeMany(u, I.randomRange(10000, 20000 - 1)) - eq(__LOC__, N.size(u), 1) - b(__LOC__, N.has(u, 20000)) - N.removeMany(u, I.randomRange(10_000, 30_000)) - b(__LOC__, N.isEmpty(u)) - } - - let () = { - let v = fromArray(I.randomRange(1_000, 2_000)) - let bs = A.map(I.randomRange(500, 1499), x => N.removeCheck(v, x)) - let indeedRemoved = A.reduce(bs, 0, (acc, x) => - if x { - acc + 1 - } else { - acc - } - ) - eq(__LOC__, indeedRemoved, 500) - eq(__LOC__, N.size(v), 501) - let cs = A.map(I.randomRange(500, 2_000), x => N.addCheck(v, x)) - let indeedAded = A.reduce(cs, 0, (acc, x) => - if x { - acc + 1 - } else { - acc - } - ) - eq(__LOC__, indeedAded, 1000) - eq(__LOC__, N.size(v), 1_501) - b(__LOC__, N.isEmpty(empty())) - eq(__LOC__, N.minimum(v), Some(500)) - eq(__LOC__, N.maximum(v), Some(2000)) - eq(__LOC__, N.minUndefined(v), Js.Undefined.return(500)) - eq(__LOC__, N.maxUndefined(v), Js.Undefined.return(2000)) - eq(__LOC__, N.reduce(v, 0, (x, y) => x + y), (500 + 2000) / 2 * 1501) - b(__LOC__, L.eq(N.toList(v), L.makeBy(1_501, i => i + 500), (x, y) => x == y)) - eq(__LOC__, N.toArray(v), I.range(500, 2000)) - N.checkInvariantInternal(v) - eq(__LOC__, N.get(v, 3), None) - eq(__LOC__, N.get(v, 1_200), Some(1_200)) - let ((aa, bb), pres) = N.split(v, 1000) - b(__LOC__, pres) - b(__LOC__, A.eq(N.toArray(aa), I.range(500, 999), (x, y) => x == y)) - b(__LOC__, A.eq(N.toArray(bb), I.range(1_001, 2_000), \"=")) - b(__LOC__, N.subset(aa, v)) - b(__LOC__, N.subset(bb, v)) - b(__LOC__, N.isEmpty(N.intersect(aa, bb))) - let c = N.removeCheck(v, 1_000) - b(__LOC__, c) - let ((aa, bb), pres) = N.split(v, 1_000) - b(__LOC__, !pres) - b(__LOC__, A.eq(N.toArray(aa), I.range(500, 999), \"=")) - b(__LOC__, A.eq(N.toArray(bb), I.range(1_001, 2_000), \"=")) - b(__LOC__, N.subset(aa, v)) - b(__LOC__, N.subset(bb, v)) - b(__LOC__, N.isEmpty(N.intersect(aa, bb))) - } - - let \"++" = N.union - let f = fromArray - let \"=~" = N.eq - let () = { - let aa = f(I.randomRange(0, 100)) - let bb = f(I.randomRange(40, 120)) - let cc = \"++"(aa, bb) - b(__LOC__, \"=~"(cc, f(I.randomRange(0, 120)))) - - b( - __LOC__, - N.eq(N.union(f(I.randomRange(0, 20)), f(I.randomRange(21, 40))), f(I.randomRange(0, 40))), - ) - let dd = N.intersect(aa, bb) - b(__LOC__, \"=~"(dd, f(I.randomRange(40, 100)))) - b( - __LOC__, - \"=~"( - N.intersect(\"@@"(f, I.randomRange(0, 20)), \"@@"(f, I.randomRange(21, 40))), - empty(), - ), - ) - b( - __LOC__, - \"=~"( - N.intersect(\"@@"(f, I.randomRange(21, 40)), \"@@"(f, I.randomRange(0, 20))), - empty(), - ), - ) - b(__LOC__, \"=~"(N.intersect(f([1, 3, 4, 5, 7, 9]), f([2, 4, 5, 6, 8, 10])), f([4, 5]))) - b(__LOC__, \"=~"(N.diff(aa, bb), f(I.randomRange(0, 39)))) - b(__LOC__, \"=~"(N.diff(bb, aa), f(I.randomRange(101, 120)))) - b( - __LOC__, - \"=~"( - N.diff(\"@@"(f, I.randomRange(21, 40)), \"@@"(f, I.randomRange(0, 20))), - f(I.randomRange(21, 40)), - ), - ) - b( - __LOC__, - \"=~"( - N.diff(\"@@"(f, I.randomRange(0, 20)), \"@@"(f, I.randomRange(21, 40))), - f(I.randomRange(0, 20)), - ), - ) - - b( - __LOC__, - \"=~"( - N.diff(\"@@"(f, I.randomRange(0, 20)), \"@@"(f, I.randomRange(0, 40))), - f(I.randomRange(0, -1)), - ), - ) - } - - let () = { - let a0 = fromArray(I.randomRange(0, 1000)) - let (a1, a2) = (N.keep(a0, x => mod(x, 2) == 0), N.keep(a0, x => mod(x, 2) != 0)) - let (a3, a4) = N.partition(a0, x => mod(x, 2) == 0) - b(__LOC__, N.eq(a1, a3)) - b(__LOC__, N.eq(a2, a4)) - L.forEach(list{a0, a1, a2, a3, a4}, x => N.checkInvariantInternal(x)) - } - }: {} -) - -/* ********************************************** */ -let () = { - let v = N.make() - for i in 0 to 1_00_000 { - /* [%assert (N.checkInvariantInternal !v)]; */ - N.add(v, i) - } - N.checkInvariantInternal(v) - \"@@"(b(__LOC__), R.every(0, 1_00_000, i => N.has(v, i))) - eq(__LOC__, N.size(v), 1_00_001) -} - -let () = { - let u = \"++"(I.randomRange(30, 100), I.randomRange(40, 120)) - let v = N.make() - N.mergeMany(v, u) - eq(__LOC__, N.size(v), 91) - eq(__LOC__, N.toArray(v), I.range(30, 120)) -} - -let () = { - let u = \"++"(I.randomRange(0, 100_000), I.randomRange(0, 100)) - let v = N.fromArray(u) - eq(__LOC__, N.size(v), 100_001) - let u = I.randomRange(50_000, 80_000) - - for i in 0 to A.length(u) - 1 { - N.remove(v, i) - } - - eq(__LOC__, N.size(v), 70_000) - let count = 100_000 - let vv = I.randomRange(0, count) - for i in 0 to A.length(vv) - 1 { - N.remove(v, vv[i]) - } - eq(__LOC__, N.size(v), 0) - b(__LOC__, N.isEmpty(v)) -} - -let () = { - let v = N.fromArray(A.makeBy(30, i => i)) - N.remove(v, 30) - N.remove(v, 29) - b(__LOC__, Js.eqUndefined(28, N.maxUndefined(v))) - N.remove(v, 0) - b(__LOC__, Js.eqUndefined(1, N.minUndefined(v))) - eq(__LOC__, N.size(v), 28) - let vv = I.randomRange(1, 28) - for i in 0 to A.length(vv) - 1 { - N.remove(v, vv[i]) - } - eq(__LOC__, N.size(v), 0) -} - -let () = { - let id = (loc, x) => { - let u = N.fromSortedArrayUnsafe(x) - N.checkInvariantInternal(u) - b(loc, A.every2(N.toArray(u), x, \"=")) - } - - id(__LOC__, []) - id(__LOC__, [0]) - id(__LOC__, [0, 1]) - id(__LOC__, [0, 1, 2]) - id(__LOC__, [0, 1, 2, 3]) - id(__LOC__, [0, 1, 2, 3, 4]) - id(__LOC__, [0, 1, 2, 3, 4, 5]) - id(__LOC__, [0, 1, 2, 3, 4, 6]) - id(__LOC__, [0, 1, 2, 3, 4, 6, 7]) - id(__LOC__, [0, 1, 2, 3, 4, 6, 7, 8]) - id(__LOC__, [0, 1, 2, 3, 4, 6, 7, 8, 9]) - id(__LOC__, I.range(0, 1000)) -} - -let () = { - let v = N.fromArray(I.randomRange(0, 1000)) - let copyV = N.keep(v, x => mod(x, 8) == 0) - let (aa, bb) = N.partition(v, x => mod(x, 8) == 0) - let cc = N.keep(v, x => mod(x, 8) != 0) - for i in 0 to 200 { - N.remove(v, i) - } - eq(__LOC__, N.size(copyV), 126) - eq(__LOC__, N.toArray(copyV), A.makeBy(126, i => i * 8)) - eq(__LOC__, N.size(v), 800) - b(__LOC__, N.eq(copyV, aa)) - b(__LOC__, N.eq(cc, bb)) -} - -let () = { - let v = N.fromArray(I.randomRange(0, 1000)) - let ((aa, bb), _) = N.split(v, 400) - b(__LOC__, N.eq(aa, N.fromArray(I.randomRange(0, 399)))) - b(__LOC__, N.eq(bb, N.fromArray(I.randomRange(401, 1000)))) - let d = N.fromArray(A.map(I.randomRange(0, 1000), x => x * 2)) - let ((cc, dd), _) = N.split(d, 1001) - b(__LOC__, N.eq(cc, N.fromArray(A.makeBy(501, x => x * 2)))) - b(__LOC__, N.eq(dd, N.fromArray(A.makeBy(500, x => 1002 + x * 2)))) -} - -let \"++" = N.union -let f = N.fromArray -let \"=~" = N.eq -let () = { - let aa = f(I.randomRange(0, 100)) - let bb = f(I.randomRange(40, 120)) - let cc = \"++"(aa, bb) - b(__LOC__, \"=~"(cc, f(I.randomRange(0, 120)))) - - b( - __LOC__, - N.eq(N.union(f(I.randomRange(0, 20)), f(I.randomRange(21, 40))), f(I.randomRange(0, 40))), - ) - let dd = N.intersect(aa, bb) - b(__LOC__, \"=~"(dd, f(I.randomRange(40, 100)))) - b( - __LOC__, - \"=~"(N.intersect(\"@@"(f, I.randomRange(0, 20)), \"@@"(f, I.randomRange(21, 40))), N.make()), - ) - b( - __LOC__, - \"=~"(N.intersect(\"@@"(f, I.randomRange(21, 40)), \"@@"(f, I.randomRange(0, 20))), N.make()), - ) - b(__LOC__, \"=~"(N.intersect(f([1, 3, 4, 5, 7, 9]), f([2, 4, 5, 6, 8, 10])), f([4, 5]))) - b(__LOC__, \"=~"(N.diff(aa, bb), f(I.randomRange(0, 39)))) - b(__LOC__, \"=~"(N.diff(bb, aa), f(I.randomRange(101, 120)))) - b( - __LOC__, - \"=~"( - N.diff(\"@@"(f, I.randomRange(21, 40)), \"@@"(f, I.randomRange(0, 20))), - f(I.randomRange(21, 40)), - ), - ) - b( - __LOC__, - \"=~"( - N.diff(\"@@"(f, I.randomRange(0, 20)), \"@@"(f, I.randomRange(21, 40))), - f(I.randomRange(0, 20)), - ), - ) - - b( - __LOC__, - \"=~"( - N.diff(\"@@"(f, I.randomRange(0, 20)), \"@@"(f, I.randomRange(0, 40))), - f(I.randomRange(0, -1)), - ), - ) -} - -Mt.from_pair_suites(__MODULE__, suites.contents) diff --git a/jscomp/test/bs_poly_map_test.js b/jscomp/test/bs_poly_map_test.js index 700bc4a593..f7703766da 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 59, 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 60, 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 61, 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 62, 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); @@ -120,21 +137,21 @@ let a5 = Belt_Map.remove(a0, 3); let a6 = Belt_Map.remove(a5, 3); -b("File \"bs_poly_map_test.res\", line 88, characters 4-11", a5 === a6); +b("File \"bs_poly_map_test.res\", line 83, characters 4-11", a5 === a6); -b("File \"bs_poly_map_test.res\", line 89, characters 4-11", Belt_Map.has(a0, 3)); +b("File \"bs_poly_map_test.res\", line 84, characters 4-11", Belt_Map.has(a0, 3)); -b("File \"bs_poly_map_test.res\", line 90, characters 4-11", !Belt_Map.has(a5, 3)); +b("File \"bs_poly_map_test.res\", line 85, characters 4-11", !Belt_Map.has(a5, 3)); -b("File \"bs_poly_map_test.res\", line 91, characters 4-11", 3 === Belt_Map.getUndefined(a0, 3)); +b("File \"bs_poly_map_test.res\", line 86, characters 4-11", 3 === Belt_Map.getUndefined(a0, 3)); -b("File \"bs_poly_map_test.res\", line 92, characters 4-11", 33 === Belt_Map.getUndefined(a1, 3)); +b("File \"bs_poly_map_test.res\", line 87, characters 4-11", 33 === Belt_Map.getUndefined(a1, 3)); -b("File \"bs_poly_map_test.res\", line 93, characters 4-11", Belt_Map.getUndefined(a2, 3) === undefined); +b("File \"bs_poly_map_test.res\", line 88, characters 4-11", Belt_Map.getUndefined(a2, 3) === undefined); -b("File \"bs_poly_map_test.res\", line 95, characters 4-11", 11 === Belt_Map.getUndefined(a3, 3)); +b("File \"bs_poly_map_test.res\", line 90, characters 4-11", 11 === Belt_Map.getUndefined(a3, 3)); -b("File \"bs_poly_map_test.res\", line 96, characters 4-11", Belt_Map.getUndefined(a4, 3) === undefined); +b("File \"bs_poly_map_test.res\", line 91, characters 4-11", Belt_Map.getUndefined(a4, 3) === undefined); let a7 = Belt_Map.removeMany(a0, [ 7, @@ -150,22 +167,24 @@ let a7 = Belt_Map.removeMany(a0, [ 6 ]); -eq("File \"bs_poly_map_test.res\", line 99, characters 5-12", Belt_MapDict.keysToArray(a7.data), [ +eq("File \"bs_poly_map_test.res\", line 94, characters 5-12", Belt_MapDict.keysToArray(a7.data), [ 9, 10 ]); 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)); +b("File \"bs_poly_map_test.res\", line 96, 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); -eq("File \"bs_poly_map_test.res\", line 108, characters 5-12", Belt_Map.get(u1$1, 3), 32); +eq("File \"bs_poly_map_test.res\", line 103, characters 5-12", Belt_Map.get(u1$1, 3), 32); -eq("File \"bs_poly_map_test.res\", line 109, characters 5-12", Belt_Map.get(u0$1, 3), 3); +eq("File \"bs_poly_map_test.res\", line 104, characters 5-12", Belt_Map.get(u0$1, 3), 3); function acc(m, is) { return Belt_Array.reduce(is, m, (function (a, i) { @@ -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 121, characters 4-11", Belt_Map.eq(m1, Belt_Map.fromArray(x$8, Icmp), (function (x, y) { return x === y; }))); @@ -211,14 +232,16 @@ 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) { +b("File \"bs_poly_map_test.res\", line 145, characters 4-11", Belt_Map.eq(v1, v2, (function (x, y) { return x === y; }))); @@ -242,39 +265,39 @@ let match$1 = match[0]; let match$2 = Belt_Map.get(v3, 10); -b("File \"bs_poly_map_test.res\", line 161, characters 4-11", match$2 !== undefined ? match$2 === 11 : false); +b("File \"bs_poly_map_test.res\", line 156, characters 4-11", match$2 !== undefined ? match$2 === 11 : false); let match$3 = Belt_Map.get(v3, -10); -b("File \"bs_poly_map_test.res\", line 168, characters 4-11", match$3 === undefined); +b("File \"bs_poly_map_test.res\", line 163, characters 4-11", match$3 === undefined); let match$4 = Belt_Map.get(v4, -10); -b("File \"bs_poly_map_test.res\", line 175, characters 4-11", match$4 !== undefined ? match$4 === 0 : false); +b("File \"bs_poly_map_test.res\", line 170, characters 4-11", match$4 !== undefined ? match$4 === 0 : false); let map = Belt_Map.remove({ cmp: Icmp.cmp, data: undefined }, 0); -b("File \"bs_poly_map_test.res\", line 181, characters 4-11", Belt_MapDict.isEmpty(map.data)); +b("File \"bs_poly_map_test.res\", line 176, characters 4-11", Belt_MapDict.isEmpty(map.data)); let map$1 = Belt_Map.removeMany({ cmp: Icmp.cmp, data: undefined }, [0]); -b("File \"bs_poly_map_test.res\", line 182, characters 4-11", Belt_MapDict.isEmpty(map$1.data)); +b("File \"bs_poly_map_test.res\", line 177, characters 4-11", Belt_MapDict.isEmpty(map$1.data)); -b("File \"bs_poly_map_test.res\", line 184, characters 4-11", pres !== undefined ? pres === 5000 : false); +b("File \"bs_poly_map_test.res\", line 179, characters 4-11", pres !== undefined ? pres === 5000 : false); -b("File \"bs_poly_map_test.res\", line 190, characters 4-11", Belt_Array.eq(Belt_MapDict.keysToArray(match$1[0].data), Belt_Array.makeBy(5000, (function (i) { +b("File \"bs_poly_map_test.res\", line 185, characters 4-11", Belt_Array.eq(Belt_MapDict.keysToArray(match$1[0].data), Belt_Array.makeBy(5000, (function (i) { return i; })), (function (prim0, prim1) { return prim0 === prim1; }))); -b("File \"bs_poly_map_test.res\", line 191, characters 4-11", Belt_Array.eq(Belt_MapDict.keysToArray(match$1[1].data), Belt_Array.makeBy(5000, (function (i) { +b("File \"bs_poly_map_test.res\", line 186, characters 4-11", Belt_Array.eq(Belt_MapDict.keysToArray(match$1[1].data), Belt_Array.makeBy(5000, (function (i) { return 5001 + i | 0; })), (function (prim0, prim1) { return prim0 === prim1; @@ -286,15 +309,15 @@ let match$5 = Belt_Map.split(v7, 5000); let match$6 = match$5[0]; -b("File \"bs_poly_map_test.res\", line 196, characters 4-11", match$5[1] === undefined); +b("File \"bs_poly_map_test.res\", line 191, characters 4-11", match$5[1] === undefined); -b("File \"bs_poly_map_test.res\", line 202, characters 4-11", Belt_Array.eq(Belt_MapDict.keysToArray(match$6[0].data), Belt_Array.makeBy(5000, (function (i) { +b("File \"bs_poly_map_test.res\", line 197, characters 4-11", Belt_Array.eq(Belt_MapDict.keysToArray(match$6[0].data), Belt_Array.makeBy(5000, (function (i) { return i; })), (function (prim0, prim1) { return prim0 === prim1; }))); -b("File \"bs_poly_map_test.res\", line 203, characters 4-11", Belt_Array.eq(Belt_MapDict.keysToArray(match$6[1].data), Belt_Array.makeBy(5000, (function (i) { +b("File \"bs_poly_map_test.res\", line 198, characters 4-11", Belt_Array.eq(Belt_MapDict.keysToArray(match$6[1].data), Belt_Array.makeBy(5000, (function (i) { return 5001 + i | 0; })), (function (prim0, prim1) { return prim0 === prim1; diff --git a/jscomp/test/bs_poly_map_test.res b/jscomp/test/bs_poly_map_test.res index d3084fa487..b0409ab450 100644 --- a/jscomp/test/bs_poly_map_test.res +++ b/jscomp/test/bs_poly_map_test.res @@ -15,8 +15,7 @@ let setOfArray = x => N.fromArray(~id=module(Icmp), x) let emptyMap = () => M.make(~id=module(Icmp)) let mergeInter = (s1, s2) => - \"@@"( - setOfArray, + setOfArray( M.keysToArray( M.merge(s1, s2, (k, v1, v2) => switch (v1, v2) { @@ -28,10 +27,8 @@ let mergeInter = (s1, s2) => ) let mergeUnion = (s1, s2) => - \"@@"( - setOfArray, - \"@@"( - M.keysToArray, + setOfArray( + M.keysToArray( M.merge(s1, s2, (k, v1, v2) => switch (v1, v2) { | (None, None) => None @@ -41,10 +38,8 @@ let mergeUnion = (s1, s2) => ), ) let mergeDiff = (s1, s2) => - \"@@"( - setOfArray, - \"@@"( - M.keysToArray, + setOfArray( + M.keysToArray( M.merge(s1, s2, (k, v1, v2) => switch (v1, v2) { | (Some(_), None) => Some() 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..5ee8b053fd 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(l) { + return Belt_MutableSet.fromArray(l, IntCmp); } -function empty(param) { +function empty() { return { cmp: IntCmp.cmp, data: undefined }; } -let u = fromArray(Array_data_util.range(0, 30)); +let l = Array_data_util.range(0, 30); + +let u = Belt_MutableSet.fromArray(l, 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 l$1 = Array_data_util.randomRange(1000, 2000); -let v = fromArray(Array_data_util.randomRange(1000, 2000)); +let v = Belt_MutableSet.fromArray(l$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 l$2 = Array_data_util.randomRange(0, 100); -let aa$2 = fromArray(Array_data_util.randomRange(0, 100)); +let aa$2 = Belt_MutableSet.fromArray(l$2, IntCmp); -let bb$2 = fromArray(Array_data_util.randomRange(40, 120)); +let l$3 = Array_data_util.randomRange(40, 120); + +let bb$2 = Belt_MutableSet.fromArray(l$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 l$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(l$4, IntCmp))); + +let l$5 = Array_data_util.randomRange(0, 20); + +let l$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 l$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(l$5, IntCmp), Belt_MutableSet.fromArray(l$6, IntCmp)), Belt_MutableSet.fromArray(l$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 l$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(l$8, IntCmp))); + +let l$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 l$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(l$9, IntCmp), Belt_MutableSet.fromArray(l$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 l$11 = Array_data_util.randomRange(21, 40); + +let l$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(l$11, IntCmp), Belt_MutableSet.fromArray(l$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 l$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(l$13, IntCmp))); + +let l$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(l$14, IntCmp))); + +let l$15 = Array_data_util.randomRange(21, 40); + +let l$16 = Array_data_util.randomRange(0, 20); + +let l$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(l$15, IntCmp), Belt_MutableSet.fromArray(l$16, IntCmp)), Belt_MutableSet.fromArray(l$17, IntCmp))); + +let l$18 = Array_data_util.randomRange(0, 20); + +let l$19 = Array_data_util.randomRange(21, 40); + +let l$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(l$18, IntCmp), Belt_MutableSet.fromArray(l$19, IntCmp)), Belt_MutableSet.fromArray(l$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 l$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 l$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 l$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(l$21, IntCmp), Belt_MutableSet.fromArray(l$22, IntCmp)), Belt_MutableSet.fromArray(l$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 l$24 = Array_data_util.randomRange(0, 1000); -let a0 = fromArray(Array_data_util.randomRange(0, 1000)); +let a0 = Belt_MutableSet.fromArray(l$24, IntCmp); let a1 = Belt_MutableSet.keep(a0, (function (x) { return x % 2 === 0; diff --git a/jscomp/test/bs_poly_mutable_set_test.res b/jscomp/test/bs_poly_mutable_set_test.res index d808233fe9..ea31dfe0a2 100644 --- a/jscomp/test/bs_poly_mutable_set_test.res +++ b/jscomp/test/bs_poly_mutable_set_test.res @@ -8,7 +8,7 @@ module I = Array_data_util module A = Belt.Array module IntCmp = unpack(Belt.Id.comparable(~cmp=(x: int, y) => compare(x, y))) module L = Belt.List -let fromArray = N.fromArray(~id=module(IntCmp)) +let fromArray = l => N.fromArray(~id=module(IntCmp), l) let empty = () => N.make(~id=module(IntCmp)) let () = { @@ -122,11 +122,11 @@ let () = { b(__LOC__, \"=~"(dd, f(I.randomRange(40, 100)))) b( __LOC__, - \"=~"(N.intersect(\"@@"(f, I.randomRange(0, 20)), \"@@"(f, I.randomRange(21, 40))), empty()), + \"=~"(N.intersect(f(I.randomRange(0, 20)), f(I.randomRange(21, 40))), empty()), ) b( __LOC__, - \"=~"(N.intersect(\"@@"(f, I.randomRange(21, 40)), \"@@"(f, I.randomRange(0, 20))), empty()), + \"=~"(N.intersect(f(I.randomRange(21, 40)), f(I.randomRange(0, 20))), empty()), ) b(__LOC__, \"=~"(N.intersect(f([1, 3, 4, 5, 7, 9]), f([2, 4, 5, 6, 8, 10])), f([4, 5]))) b(__LOC__, \"=~"(N.diff(aa, bb), f(I.randomRange(0, 39)))) @@ -134,14 +134,14 @@ let () = { b( __LOC__, \"=~"( - N.diff(\"@@"(f, I.randomRange(21, 40)), \"@@"(f, I.randomRange(0, 20))), + N.diff(f(I.randomRange(21, 40)), f(I.randomRange(0, 20))), f(I.randomRange(21, 40)), ), ) b( __LOC__, \"=~"( - N.diff(\"@@"(f, I.randomRange(0, 20)), \"@@"(f, I.randomRange(21, 40))), + N.diff(f(I.randomRange(0, 20)), f(I.randomRange(21, 40))), f(I.randomRange(0, 20)), ), ) @@ -149,7 +149,7 @@ let () = { b( __LOC__, \"=~"( - N.diff(\"@@"(f, I.randomRange(0, 20)), \"@@"(f, I.randomRange(0, 40))), + N.diff(f(I.randomRange(0, 20)), f(I.randomRange(0, 40))), f(I.randomRange(0, -1)), ), ) 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_poly_set_test.res b/jscomp/test/bs_poly_set_test.res index f5d2aded12..e5d017f46e 100644 --- a/jscomp/test/bs_poly_set_test.res +++ b/jscomp/test/bs_poly_set_test.res @@ -53,7 +53,7 @@ let () = { eq(__LOC__, N.size(u14), 10000) eq(__LOC__, N.size(u15), 1) b(__LOC__, N.has(u15, 20000)) - b(__LOC__, \"@@"(not, N.has(u15, 2000))) + b(__LOC__, not(N.has(u15, 2000))) b(__LOC__, N.isEmpty(u16)) let u17 = N.fromArray(~id=module(IntCmp), I.randomRange(0, 100)) let u18 = N.fromArray(~id=module(IntCmp), I.randomRange(59, 200)) @@ -115,7 +115,7 @@ let () = { b(__LOC__, N.every(u0, x => x < 24)) b(__LOC__, D.every(N.getData(u0), x => x < 24)) b(__LOC__, !N.every(u2, x => x < 24)) - b(__LOC__, \"@@"(not, N.every(N.fromArray(~id=module(IntCmp), [1, 2, 3]), x => x == 2))) + b(__LOC__, not(N.every(N.fromArray(~id=module(IntCmp), [1, 2, 3]), x => x == 2))) b(__LOC__, N.cmp(u1, u0) < 0) b(__LOC__, N.cmp(u0, u1) > 0) } @@ -128,10 +128,10 @@ let () = { b(__LOC__, N.eq(a2, a4)) eq(__LOC__, N.getExn(a0, 3), 3) eq(__LOC__, N.getExn(a0, 4), 4) - t(__LOC__, _ => \"@@"(ignore, N.getExn(a0, 1002))) - t(__LOC__, _ => \"@@"(ignore, N.getExn(a0, -1))) + t(__LOC__, _ => ignore(N.getExn(a0, 1002))) + t(__LOC__, _ => ignore(N.getExn(a0, -1))) eq(__LOC__, N.size(a0), 1001) - b(__LOC__, \"@@"(not, N.isEmpty(a0))) + b(__LOC__, not(N.isEmpty(a0))) let ((a5, a6), pres) = N.split(a0, 200) b(__LOC__, pres) eq(__LOC__, N.toArray(a5), A.makeBy(200, i => i)) 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_qualified.res b/jscomp/test/bs_qualified.res index 96096477aa..425bf2fedc 100644 --- a/jscomp/test/bs_qualified.res +++ b/jscomp/test/bs_qualified.res @@ -72,21 +72,21 @@ type t @send @scope(("a0", "a1")) external psend3: (t, int) => unit = "psend3" let f3 = x => { - \"@@"(ignore, makeBuffer(20)) - \"@@"(ignore, makeBuffer1(20)) - \"@@"(ignore, makeBuffer2(100)) - \"@@"(ignore, makeBuffer3(20)) - \"@@"(Js.log, max(1.0, 2.0)) + ignore(makeBuffer(20)) + ignore(makeBuffer1(20)) + ignore(makeBuffer2(100)) + ignore(makeBuffer3(20)) + Js.log(max(1.0, 2.0)) /* Js.log @@ scope_f x ; */ - \"@@"(Js.log, getMockFn1(x, 0)) - \"@@"(Js.log, getMockFn2(x, 0)) - \"@@"(Js.log, getMockFn3(x, 0)) + Js.log(getMockFn1(x, 0)) + Js.log(getMockFn2(x, 0)) + Js.log(getMockFn3(x, 0)) setMocFn1(x, 0, "x") setMocFn2(x, 0, "x") setMocFn3(x, 0, "x") - \"@@"(Js.log, getX1(x)) - \"@@"(Js.log, getX2(x)) - \"@@"(Js.log, getX3(x)) + Js.log(getX1(x)) + Js.log(getX2(x)) + Js.log(getX3(x)) setX1(x, 0) setX2(x, 0) diff --git a/jscomp/test/bs_queue_test.js b/jscomp/test/bs_queue_test.js index 952013e908..c4f88028bf 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){ @@ -56,7 +55,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 { RE_EXN_ID: "Assert_failure", _1: [ @@ -68,7 +67,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)) { @@ -83,7 +82,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 @@ -99,7 +98,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, @@ -237,7 +236,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 { RE_EXN_ID: "Assert_failure", _1: [ @@ -261,7 +260,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 { RE_EXN_ID: "Assert_failure", _1: [ @@ -303,7 +302,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 { RE_EXN_ID: "Assert_failure", _1: [ @@ -315,7 +314,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 { RE_EXN_ID: "Assert_failure", _1: [ @@ -327,7 +326,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 { RE_EXN_ID: "Assert_failure", _1: [ @@ -1291,4 +1290,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 1e013f250d..64653f97cb 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 9c4f63def7..3bae3d08e7 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_sort_test.js b/jscomp/test/bs_sort_test.js index 6c4b2a8c3b..7fc8dd0515 100644 --- a/jscomp/test/bs_sort_test.js +++ b/jscomp/test/bs_sort_test.js @@ -335,7 +335,7 @@ eq("File \"bs_sort_test.res\", line 116, characters 5-12", Belt_SortArray.binary let aa = Array_data_util.range(0, 1000); -b("File \"bs_sort_test.res\", line 118, characters 10-17", Belt_Range.every(0, 1000, (function (i) { +b("File \"bs_sort_test.res\", line 118, characters 4-11", Belt_Range.every(0, 1000, (function (i) { return Belt_SortArray.binarySearchBy(aa, i, cmp) === i; }))); @@ -351,7 +351,7 @@ eq("File \"bs_sort_test.res\", line 123, characters 5-12", Belt_SortArray.binary eq("File \"bs_sort_test.res\", line 125, characters 5-12", Belt_SortArray.binarySearchBy(cc, 1, cmp) ^ -1, 1); -b("File \"bs_sort_test.res\", line 127, characters 6-13", Belt_Range.every(0, 1999, (function (i) { +b("File \"bs_sort_test.res\", line 126, characters 4-11", Belt_Range.every(0, 1999, (function (i) { return (Belt_SortArray.binarySearchBy(cc, (i << 1) + 1 | 0, cmp) ^ -1) === (i + 1 | 0); }))); @@ -359,27 +359,27 @@ function lt(x, y) { return x < y; } -eq("File \"bs_sort_test.res\", line 137, characters 5-12", Belt_SortArray.strictlySortedLength([], lt), 0); +eq("File \"bs_sort_test.res\", line 131, characters 5-12", Belt_SortArray.strictlySortedLength([], lt), 0); -eq("File \"bs_sort_test.res\", line 138, characters 5-12", Belt_SortArray.strictlySortedLength([1], lt), 1); +eq("File \"bs_sort_test.res\", line 132, characters 5-12", Belt_SortArray.strictlySortedLength([1], lt), 1); -eq("File \"bs_sort_test.res\", line 139, characters 5-12", Belt_SortArray.strictlySortedLength([ +eq("File \"bs_sort_test.res\", line 133, characters 5-12", Belt_SortArray.strictlySortedLength([ 1, 1 ], lt), 1); -eq("File \"bs_sort_test.res\", line 140, characters 5-12", Belt_SortArray.strictlySortedLength([ +eq("File \"bs_sort_test.res\", line 134, characters 5-12", Belt_SortArray.strictlySortedLength([ 1, 1, 2 ], lt), 1); -eq("File \"bs_sort_test.res\", line 141, characters 5-12", Belt_SortArray.strictlySortedLength([ +eq("File \"bs_sort_test.res\", line 135, characters 5-12", Belt_SortArray.strictlySortedLength([ 1, 2 ], lt), 2); -eq("File \"bs_sort_test.res\", line 142, characters 5-12", Belt_SortArray.strictlySortedLength([ +eq("File \"bs_sort_test.res\", line 136, characters 5-12", Belt_SortArray.strictlySortedLength([ 1, 2, 3, @@ -387,7 +387,7 @@ eq("File \"bs_sort_test.res\", line 142, characters 5-12", Belt_SortArray.strict 3 ], lt), 4); -eq("File \"bs_sort_test.res\", line 143, characters 5-12", Belt_SortArray.strictlySortedLength([ +eq("File \"bs_sort_test.res\", line 137, characters 5-12", Belt_SortArray.strictlySortedLength([ 4, 4, 3, @@ -395,14 +395,14 @@ eq("File \"bs_sort_test.res\", line 143, characters 5-12", Belt_SortArray.strict 1 ], lt), 1); -eq("File \"bs_sort_test.res\", line 144, characters 5-12", Belt_SortArray.strictlySortedLength([ +eq("File \"bs_sort_test.res\", line 138, characters 5-12", Belt_SortArray.strictlySortedLength([ 4, 3, 2, 1 ], lt), -4); -eq("File \"bs_sort_test.res\", line 145, characters 5-12", Belt_SortArray.strictlySortedLength([ +eq("File \"bs_sort_test.res\", line 139, characters 5-12", Belt_SortArray.strictlySortedLength([ 4, 3, 2, diff --git a/jscomp/test/bs_sort_test.res b/jscomp/test/bs_sort_test.res index 42b9059472..d084e5772e 100644 --- a/jscomp/test/bs_sort_test.res +++ b/jscomp/test/bs_sort_test.res @@ -73,7 +73,7 @@ let () = { b(__LOC__, S.isSorted([0], cmp)) b(__LOC__, S.isSorted([0, 1], cmp)) - b(__LOC__, \"@@"(not, S.isSorted([1, 0], cmp))) + b(__LOC__, not(S.isSorted([1, 0], cmp))) } module SI = Belt.SortArray.Int @@ -115,7 +115,7 @@ let () = { eq(__LOC__, S.binarySearchBy([1, 2, 3, 4, 33, 35, 36], 3, cmp), 2) eq(__LOC__, S.binarySearchBy([1, 2, 3, 4, 33, 35, 36], 4, cmp), 3) let aa = I.range(0, 1000) - \"@@"(b(__LOC__), R.every(0, 1000, i => S.binarySearchBy(aa, i, cmp) == i)) + b(__LOC__, R.every(0, 1000, i => S.binarySearchBy(aa, i, cmp) == i)) /* 0, 2, 4, ... 4000 */ let cc = A.map(I.range(0, 2000), x => x * 2) eq(__LOC__, lnot(S.binarySearchBy(cc, 5000, cmp)), 2001) @@ -123,13 +123,7 @@ let () = { eq(__LOC__, S.binarySearchBy(cc, 0, cmp), 0) eq(__LOC__, lnot(S.binarySearchBy(cc, 1, cmp)), 1) - \"@@"( - b(__LOC__), - R.every(0, 1999, i => - lnot(S.binarySearchBy(cc, 2 * i + 1, cmp)) == i + 1 - /* 1, 3, 5, ... , 3999 */ - ), - ) + b(__LOC__, R.every(0, 1999, i => lnot(S.binarySearchBy(cc, 2 * i + 1, cmp)) == i + 1)) } let lt = (x: int, y) => x < y diff --git a/jscomp/test/bs_splice_partial.js b/jscomp/test/bs_splice_partial.js index 301af7f9df..baa6337220 100644 --- a/jscomp/test/bs_splice_partial.js +++ b/jscomp/test/bs_splice_partial.js @@ -27,8 +27,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 +36,7 @@ function f(x) { Curry._1(v, x); } -function testUndefined(param) { +function testUndefined() { return say(1, 2, [undefined,undefined]); } diff --git a/jscomp/test/bs_splice_partial.res b/jscomp/test/bs_splice_partial.res index e6e5489459..47d659e25b 100644 --- a/jscomp/test/bs_splice_partial.res +++ b/jscomp/test/bs_splice_partial.res @@ -37,14 +37,14 @@ type id2 = (. int) => int let test_cb = x => { ignore((x->cb("hI", [1, 2, 3]))(3)) - \"@@"(ignore, cb(x, "hI", [1, 2, 3])(3)) + ignore(cb(x, "hI", [1, 2, 3])(3)) cb2(x, "hI", [1, 2, 3])(. 3) } type u = (. int) => int @val external v: u = "v" -let f = x => \"@@"(ignore, v(. x)) +let f = x => ignore(v(. x)) @val external fff0: (int, int, @as(json`[undefined,undefined]`) _) => int = "say" 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 4a790f83d9..dca59c0ad6 100644 --- a/jscomp/test/build.ninja +++ b/jscomp/test/build.ninja @@ -39,7 +39,6 @@ o test/UntaggedVariants.cmi test/UntaggedVariants.cmj : cc test/UntaggedVariants o test/VariantCoercion.cmi test/VariantCoercion.cmj : cc test/VariantCoercion.res | $bsc $stdlib runtime o test/VariantSpreads.cmi test/VariantSpreads.cmj : cc test/VariantSpreads.res | $bsc $stdlib runtime o test/a.cmi test/a.cmj : cc test/a.res | test/test_order.cmj $bsc $stdlib runtime -o test/a_filename_test.cmi test/a_filename_test.cmj : cc test/a_filename_test.res | test/ext_filename_test.cmj test/mt.cmj $bsc $stdlib runtime o test/a_list_test.cmi test/a_list_test.cmj : cc test/a_list_test.res | test/ext_list_test.cmj test/mt.cmj $bsc $stdlib runtime o test/a_recursive_type.cmj : cc_cmi test/a_recursive_type.res | test/a_recursive_type.cmi $bsc $stdlib runtime o test/a_recursive_type.cmi : cc test/a_recursive_type.resi | $bsc $stdlib runtime @@ -90,8 +89,6 @@ o test/bigint_test.cmi test/bigint_test.cmj : cc test/bigint_test.res | test/mt. o test/block_alias_test.cmi test/block_alias_test.cmj : cc test/block_alias_test.res | test/mt.cmj $bsc $stdlib runtime o test/boolean_test.cmi test/boolean_test.cmj : cc test/boolean_test.res | test/mt.cmj test/test_bool_equal.cmj $bsc $stdlib runtime o test/bs_MapInt_test.cmi test/bs_MapInt_test.cmj : cc test/bs_MapInt_test.res | $bsc $stdlib runtime -o test/bs_abstract_test.cmj : cc_cmi test/bs_abstract_test.res | test/bs_abstract_test.cmi $bsc $stdlib runtime -o test/bs_abstract_test.cmi : cc test/bs_abstract_test.resi | $bsc $stdlib runtime o test/bs_array_test.cmi test/bs_array_test.cmj : cc test/bs_array_test.res | test/mt.cmj $bsc $stdlib runtime o test/bs_auto_uncurry.cmi test/bs_auto_uncurry.cmj : cc test/bs_auto_uncurry.res | $bsc $stdlib runtime o test/bs_auto_uncurry_test.cmi test/bs_auto_uncurry_test.cmj : cc test/bs_auto_uncurry_test.res | test/mt.cmj $bsc $stdlib runtime @@ -106,7 +103,6 @@ o test/bs_list_test.cmi test/bs_list_test.cmj : cc test/bs_list_test.res | test/ o test/bs_map_set_dict_test.cmi test/bs_map_set_dict_test.cmj : cc test/bs_map_set_dict_test.res | test/array_data_util.cmj test/mt.cmj $bsc $stdlib runtime o test/bs_map_test.cmi test/bs_map_test.cmj : cc test/bs_map_test.res | test/mt.cmj $bsc $stdlib runtime o test/bs_min_max_test.cmi test/bs_min_max_test.cmj : cc test/bs_min_max_test.res | test/mt.cmj $bsc $stdlib runtime -o test/bs_mutable_set_test.cmi test/bs_mutable_set_test.cmj : cc test/bs_mutable_set_test.res | test/array_data_util.cmj test/mt.cmj $bsc $stdlib runtime o test/bs_poly_map_test.cmi test/bs_poly_map_test.cmj : cc test/bs_poly_map_test.res | test/array_data_util.cmj test/mt.cmj $bsc $stdlib runtime o test/bs_poly_mutable_map_test.cmi test/bs_poly_mutable_map_test.cmj : cc test/bs_poly_mutable_map_test.res | test/array_data_util.cmj test/mt.cmj $bsc $stdlib runtime o test/bs_poly_mutable_set_test.cmi test/bs_poly_mutable_set_test.cmj : cc test/bs_poly_mutable_set_test.res | test/array_data_util.cmj test/mt.cmj $bsc $stdlib runtime @@ -126,7 +122,6 @@ o test/buffer_test.cmi test/buffer_test.cmj : cc test/buffer_test.res | test/mt. o test/bytes_split_gpr_743_test.cmi test/bytes_split_gpr_743_test.cmj : cc test/bytes_split_gpr_743_test.res | test/mt.cmj $bsc $stdlib runtime o test/caml_compare_bigint_test.cmi test/caml_compare_bigint_test.cmj : cc test/caml_compare_bigint_test.res | test/mt.cmj $bsc $stdlib runtime o test/caml_compare_test.cmi test/caml_compare_test.cmj : cc test/caml_compare_test.res | test/mt.cmj $bsc $stdlib runtime -o test/caml_format_test.cmi test/caml_format_test.cmj : cc test/caml_format_test.res | test/mt.cmj $bsc $stdlib runtime o test/chain_code_test.cmi test/chain_code_test.cmj : cc test/chain_code_test.res | test/mt.cmj $bsc $stdlib runtime o test/chn_test.cmi test/chn_test.cmj : cc test/chn_test.res | test/mt.cmj $bsc $stdlib runtime o test/class_type_ffi_test.cmi test/class_type_ffi_test.cmj : cc test/class_type_ffi_test.res | $bsc $stdlib runtime @@ -160,7 +155,6 @@ o test/demo_page.cmi test/demo_page.cmj : cc test/demo_page.res | $bsc $stdlib r o test/demo_pipe.cmi test/demo_pipe.cmj : cc test/demo_pipe.res | $bsc $stdlib runtime o test/derive_projector_test.cmj : cc_cmi test/derive_projector_test.res | test/derive_projector_test.cmi $bsc $stdlib runtime o test/derive_projector_test.cmi : cc test/derive_projector_test.resi | $bsc $stdlib runtime -o test/digest_test.cmi test/digest_test.cmj : cc test/digest_test.res | test/ext_array_test.cmj test/mt.cmj $bsc $stdlib runtime o test/directives.cmi test/directives.cmj : cc test/directives.res | $bsc $stdlib runtime o test/div_by_zero_test.cmi test/div_by_zero_test.cmj : cc test/div_by_zero_test.res | test/mt.cmj $bsc $stdlib runtime o test/dollar_escape_test.cmi test/dollar_escape_test.cmj : cc test/dollar_escape_test.res | test/mt.cmj $bsc $stdlib runtime @@ -228,7 +222,6 @@ o test/gentTypeReTest.cmi test/gentTypeReTest.cmj : cc test/gentTypeReTest.res | o test/global_exception_regression_test.cmi test/global_exception_regression_test.cmj : cc test/global_exception_regression_test.res | test/mt.cmj $bsc $stdlib runtime o test/global_mangles.cmi test/global_mangles.cmj : cc test/global_mangles.res | $bsc $stdlib runtime o test/global_module_alias_test.cmi test/global_module_alias_test.cmj : cc test/global_module_alias_test.res | test/mt.cmj $bsc $stdlib runtime -o test/google_closure_test.cmi test/google_closure_test.cmj : cc test/google_closure_test.res | test/mt.cmj test/test_google_closure.cmj $bsc $stdlib runtime o test/gpr496_test.cmi test/gpr496_test.cmj : cc test/gpr496_test.res | test/mt.cmj $bsc $stdlib runtime o test/gpr_1072.cmi test/gpr_1072.cmj : cc test/gpr_1072.res | $bsc $stdlib runtime o test/gpr_1072_reg.cmi test/gpr_1072_reg.cmj : cc test/gpr_1072_reg.res | $bsc $stdlib runtime @@ -386,7 +379,6 @@ o test/int64_mul_div_test.cmi test/int64_mul_div_test.cmj : cc test/int64_mul_di o test/int64_string_bench.cmi test/int64_string_bench.cmj : cc test/int64_string_bench.res | $bsc $stdlib runtime o test/int64_string_test.cmi test/int64_string_test.cmj : cc test/int64_string_test.res | test/mt.cmj $bsc $stdlib runtime o test/int64_test.cmi test/int64_test.cmj : cc test/int64_test.res | test/ext_array_test.cmj test/mt.cmj $bsc $stdlib runtime -o test/int_hashtbl_test.cmi test/int_hashtbl_test.cmj : cc test/int_hashtbl_test.res | test/mt.cmj $bsc $stdlib runtime o test/int_map.cmi test/int_map.cmj : cc test/int_map.res | $bsc $stdlib runtime o test/int_overflow_test.cmi test/int_overflow_test.cmj : cc test/int_overflow_test.res | test/mt.cmj $bsc $stdlib runtime o test/int_poly_var.cmi test/int_poly_var.cmj : cc test/int_poly_var.res | test/mt.cmj test/test2.cmj $bsc $stdlib runtime @@ -412,7 +404,6 @@ o test/js_obj_test.cmi test/js_obj_test.cmj : cc test/js_obj_test.res | test/mt. o test/js_option_test.cmi test/js_option_test.cmj : cc test/js_option_test.res | test/mt.cmj $bsc $stdlib runtime o test/js_re_test.cmi test/js_re_test.cmj : cc test/js_re_test.res | test/mt.cmj $bsc $stdlib runtime o test/js_string_test.cmi test/js_string_test.cmj : cc test/js_string_test.res | test/mt.cmj $bsc $stdlib runtime -o test/js_typed_array_test.cmi test/js_typed_array_test.cmj : cc test/js_typed_array_test.res | test/mt.cmj $bsc $stdlib runtime o test/js_undefined_test.cmi test/js_undefined_test.cmj : cc test/js_undefined_test.res | test/mt.cmj $bsc $stdlib runtime o test/js_val.cmi test/js_val.cmj : cc test/js_val.res | $bsc $stdlib runtime o test/jsoo_400_test.cmi test/jsoo_400_test.cmj : cc test/jsoo_400_test.res | test/mt.cmj $bsc $stdlib runtime @@ -477,7 +468,6 @@ o test/obj_literal_ppx.cmi test/obj_literal_ppx.cmj : cc test/obj_literal_ppx.re o test/obj_literal_ppx_test.cmi test/obj_literal_ppx_test.cmj : cc test/obj_literal_ppx_test.res | $bsc $stdlib runtime o test/obj_magic_test.cmi test/obj_magic_test.cmj : cc test/obj_magic_test.res | test/mt.cmj $bsc $stdlib runtime o test/obj_type_test.cmi test/obj_type_test.cmj : cc test/obj_type_test.res | $bsc $stdlib runtime -o test/ocaml_re_test.cmi test/ocaml_re_test.cmj : cc test/ocaml_re_test.res | test/mt.cmj $bsc $stdlib runtime o test/of_string_test.cmi test/of_string_test.cmj : cc test/of_string_test.res | test/mt.cmj $bsc $stdlib runtime o test/offset.cmi test/offset.cmj : cc test/offset.res | $bsc $stdlib runtime o test/omit_trailing_undefined_in_external_calls.cmi test/omit_trailing_undefined_in_external_calls.cmj : cc test/omit_trailing_undefined_in_external_calls.res | $bsc $stdlib runtime @@ -499,13 +489,11 @@ o test/polyvar_test.cmi test/polyvar_test.cmj : cc test/polyvar_test.res | $bsc o test/ppx_apply_test.cmi test/ppx_apply_test.cmj : cc test/ppx_apply_test.res | test/mt.cmj $bsc $stdlib runtime o test/pq_test.cmi test/pq_test.cmj : cc test/pq_test.res | $bsc $stdlib runtime o test/pr6726.cmi test/pr6726.cmj : cc test/pr6726.res | $bsc $stdlib runtime -o test/pr_regression_test.cmi test/pr_regression_test.cmj : cc test/pr_regression_test.res | test/mt.cmj $bsc $stdlib runtime o test/prepend_data_ffi.cmi test/prepend_data_ffi.cmj : cc test/prepend_data_ffi.res | $bsc $stdlib runtime o test/primitive_reg_test.cmi test/primitive_reg_test.cmj : cc test/primitive_reg_test.res | $bsc $stdlib runtime o test/print_alpha_test.cmi test/print_alpha_test.cmj : cc test/print_alpha_test.res | test/mt.cmj $bsc $stdlib runtime o test/queue_402.cmi test/queue_402.cmj : cc test/queue_402.res | $bsc $stdlib runtime o test/queue_test.cmi test/queue_test.cmj : cc test/queue_test.res | test/mt.cmj test/queue_402.cmj $bsc $stdlib runtime -o test/random_test.cmi test/random_test.cmj : cc test/random_test.res | test/mt.cmj test/mt_global.cmj $bsc $stdlib runtime o test/raw_hash_tbl_bench.cmi test/raw_hash_tbl_bench.cmj : cc test/raw_hash_tbl_bench.res | $bsc $stdlib runtime o test/raw_output_test.cmi test/raw_output_test.cmj : cc test/raw_output_test.res | $bsc $stdlib runtime o test/raw_pure_test.cmi test/raw_pure_test.cmj : cc test/raw_pure_test.res | $bsc $stdlib runtime @@ -519,8 +507,6 @@ o test/reactTestUtils.cmj : cc_cmi test/reactTestUtils.res | test/react.cmj test o test/reactTestUtils.cmi : cc test/reactTestUtils.resi | test/react.cmi $bsc $stdlib runtime o test/reasonReact.cmj : cc_cmi test/reasonReact.res | test/react.cmj test/reasonReact.cmi test/reasonReactRouter.cmj $bsc $stdlib runtime o test/reasonReact.cmi : cc test/reasonReact.resi | test/react.cmi test/reasonReactRouter.cmi $bsc $stdlib runtime -o test/reasonReactCompat.cmj : cc_cmi test/reasonReactCompat.res | test/react.cmj test/reasonReact.cmj test/reasonReactCompat.cmi $bsc $stdlib runtime -o test/reasonReactCompat.cmi : cc test/reasonReactCompat.resi | test/react.cmi test/reasonReact.cmi $bsc $stdlib runtime o test/reasonReactOptimizedCreateClass.cmi test/reasonReactOptimizedCreateClass.cmj : cc test/reasonReactOptimizedCreateClass.res | $bsc $stdlib runtime o test/reasonReactRouter.cmj : cc_cmi test/reasonReactRouter.res | test/react.cmj test/reasonReactRouter.cmi $bsc $stdlib runtime o test/reasonReactRouter.cmi : cc test/reasonReactRouter.resi | $bsc $stdlib runtime @@ -549,11 +535,6 @@ o test/return_check.cmi test/return_check.cmj : cc test/return_check.res | $bsc o test/runtime_encoding_test.cmi test/runtime_encoding_test.cmj : cc test/runtime_encoding_test.res | $bsc $stdlib runtime o test/set_annotation.cmi test/set_annotation.cmj : cc test/set_annotation.res | $bsc $stdlib runtime o test/set_gen.cmi test/set_gen.cmj : cc test/set_gen.res | $bsc $stdlib runtime -o test/sexp.cmj : cc_cmi test/sexp.res | test/sexp.cmi $bsc $stdlib runtime -o test/sexp.cmi : cc test/sexp.resi | $bsc $stdlib runtime -o test/sexpm.cmj : cc_cmi test/sexpm.res | test/sexpm.cmi $bsc $stdlib runtime -o test/sexpm.cmi : cc test/sexpm.resi | $bsc $stdlib runtime -o test/sexpm_test.cmi test/sexpm_test.cmj : cc test/sexpm_test.res | test/mt.cmj test/sexpm.cmj $bsc $stdlib runtime o test/side_effect.cmi test/side_effect.cmj : cc test/side_effect.res | $bsc $stdlib runtime o test/side_effect2.cmi test/side_effect2.cmj : cc test/side_effect2.res | $bsc $stdlib runtime o test/side_effect_free.cmi test/side_effect_free.cmj : cc test/side_effect_free.res | $bsc $stdlib runtime @@ -621,7 +602,6 @@ o test/test_formatter.cmi test/test_formatter.cmj : cc test/test_formatter.res | o test/test_functor_dead_code.cmi test/test_functor_dead_code.cmj : cc test/test_functor_dead_code.res | $bsc $stdlib runtime o test/test_generative_module.cmi test/test_generative_module.cmj : cc test/test_generative_module.res | $bsc $stdlib runtime o test/test_global_print.cmi test/test_global_print.cmj : cc test/test_global_print.res | $bsc $stdlib runtime -o test/test_google_closure.cmi test/test_google_closure.cmj : cc test/test_google_closure.res | $bsc $stdlib runtime o test/test_include.cmi test/test_include.cmj : cc test/test_include.res | test/test_order.cmj $bsc $stdlib runtime o test/test_incomplete.cmi test/test_incomplete.cmj : cc test/test_incomplete.res | $bsc $stdlib runtime o test/test_incr_ref.cmi test/test_incr_ref.cmj : cc test/test_incr_ref.res | $bsc $stdlib runtime @@ -721,4 +701,4 @@ o test/update_record_test.cmi test/update_record_test.cmj : cc test/update_recor o test/variant.cmi test/variant.cmj : cc test/variant.res | $bsc $stdlib runtime o test/variantsMatching.cmi test/variantsMatching.cmj : cc test/variantsMatching.res | $bsc $stdlib runtime o test/webpack_config.cmi test/webpack_config.cmj : cc test/webpack_config.res | $bsc $stdlib runtime -o test : phony test/406_primitive_test.cmi test/406_primitive_test.cmj test/AsInUncurriedExternals.cmi test/AsInUncurriedExternals.cmj test/Coercion.cmi test/Coercion.cmj test/DerivingAccessorsCurried.cmi test/DerivingAccessorsCurried.cmj test/DerivingAccessorsUncurried.cmi test/DerivingAccessorsUncurried.cmj test/DictInference.cmi test/DictInference.cmj test/DotDotDot.cmi test/DotDotDot.cmj test/EmptyRecord.cmi test/EmptyRecord.cmj test/FFI.cmi test/FFI.cmj test/Import.cmi test/Import.cmj test/ImportAttributes.cmi test/ImportAttributes.cmj test/RecordCoercion.cmi test/RecordCoercion.cmj test/RecordOrObject.cmi test/RecordOrObject.cmj test/SafePromises.cmi test/SafePromises.cmj test/UncurriedAlways.cmi test/UncurriedAlways.cmj test/UncurriedExternals.cmi test/UncurriedExternals.cmj test/UncurriedPervasives.cmi test/UncurriedPervasives.cmj test/UntaggedVariants.cmi test/UntaggedVariants.cmj test/VariantCoercion.cmi test/VariantCoercion.cmj test/VariantSpreads.cmi test/VariantSpreads.cmj test/a.cmi test/a.cmj test/a_filename_test.cmi test/a_filename_test.cmj test/a_list_test.cmi test/a_list_test.cmj test/a_recursive_type.cmi test/a_recursive_type.cmj test/a_scope_bug.cmi test/a_scope_bug.cmj test/a_string_test.cmi test/a_string_test.cmj test/abstract_type.cmi test/abstract_type.cmj test/adt_optimize_test.cmi test/adt_optimize_test.cmj test/alias_default_value_test.cmi test/alias_default_value_test.cmj test/alias_test.cmi test/alias_test.cmj test/and_or_tailcall_test.cmi test/and_or_tailcall_test.cmj test/argv_test.cmi test/argv_test.cmj test/ari_regress_test.cmi test/ari_regress_test.cmj test/arith_lexer.cmi test/arith_lexer.cmj test/arith_parser.cmi test/arith_parser.cmj test/arith_syntax.cmi test/arith_syntax.cmj test/arity.cmi test/arity.cmj test/arity_deopt.cmi test/arity_deopt.cmj test/arity_infer.cmi test/arity_infer.cmj test/array_data_util.cmi test/array_data_util.cmj test/array_safe_get.cmi test/array_safe_get.cmj test/array_subtle_test.cmi test/array_subtle_test.cmj test/array_test.cmi test/array_test.cmj test/as_inline_record_test.cmi test/as_inline_record_test.cmj test/ast_abstract_test.cmi test/ast_abstract_test.cmj test/ast_mapper_unused_warning_test.cmi test/ast_mapper_unused_warning_test.cmj test/async_await.cmi test/async_await.cmj test/async_ideas.cmi test/async_ideas.cmj test/async_inline.cmi test/async_inline.cmj test/async_inside_loop.cmi test/async_inside_loop.cmj test/attr_test.cmi test/attr_test.cmj test/b.cmi test/b.cmj test/bal_set_mini.cmi test/bal_set_mini.cmj test/bang_primitive.cmi test/bang_primitive.cmj test/basic_module_test.cmi test/basic_module_test.cmj test/bb.cmi test/bb.cmj test/bdd.cmi test/bdd.cmj test/belt_internal_test.cmi test/belt_internal_test.cmj test/belt_result_alias_test.cmi test/belt_result_alias_test.cmj test/bench.cmi test/bench.cmj test/big_enum.cmi test/big_enum.cmj test/big_polyvar_test.cmi test/big_polyvar_test.cmj test/bigint_test.cmi test/bigint_test.cmj test/block_alias_test.cmi test/block_alias_test.cmj test/boolean_test.cmi test/boolean_test.cmj test/bs_MapInt_test.cmi test/bs_MapInt_test.cmj test/bs_abstract_test.cmi test/bs_abstract_test.cmj test/bs_array_test.cmi test/bs_array_test.cmj test/bs_auto_uncurry.cmi test/bs_auto_uncurry.cmj test/bs_auto_uncurry_test.cmi test/bs_auto_uncurry_test.cmj test/bs_float_test.cmi test/bs_float_test.cmj test/bs_hashmap_test.cmi test/bs_hashmap_test.cmj test/bs_hashset_int_test.cmi test/bs_hashset_int_test.cmj test/bs_hashtbl_string_test.cmi test/bs_hashtbl_string_test.cmj test/bs_ignore_effect.cmi test/bs_ignore_effect.cmj test/bs_ignore_test.cmi test/bs_ignore_test.cmj test/bs_int_test.cmi test/bs_int_test.cmj test/bs_list_test.cmi test/bs_list_test.cmj test/bs_map_set_dict_test.cmi test/bs_map_set_dict_test.cmj test/bs_map_test.cmi test/bs_map_test.cmj test/bs_min_max_test.cmi test/bs_min_max_test.cmj test/bs_mutable_set_test.cmi test/bs_mutable_set_test.cmj test/bs_poly_map_test.cmi test/bs_poly_map_test.cmj test/bs_poly_mutable_map_test.cmi test/bs_poly_mutable_map_test.cmj test/bs_poly_mutable_set_test.cmi test/bs_poly_mutable_set_test.cmj test/bs_poly_set_test.cmi test/bs_poly_set_test.cmj test/bs_qualified.cmi test/bs_qualified.cmj test/bs_queue_test.cmi test/bs_queue_test.cmj test/bs_rbset_int_bench.cmi test/bs_rbset_int_bench.cmj test/bs_rest_test.cmi test/bs_rest_test.cmj test/bs_set_bench.cmi test/bs_set_bench.cmj test/bs_set_int_test.cmi test/bs_set_int_test.cmj test/bs_sort_test.cmi test/bs_sort_test.cmj test/bs_splice_partial.cmi test/bs_splice_partial.cmj test/bs_stack_test.cmi test/bs_stack_test.cmj test/bs_string_test.cmi test/bs_string_test.cmj test/bs_unwrap_test.cmi test/bs_unwrap_test.cmj test/buffer_test.cmi test/buffer_test.cmj test/bytes_split_gpr_743_test.cmi test/bytes_split_gpr_743_test.cmj test/caml_compare_bigint_test.cmi test/caml_compare_bigint_test.cmj test/caml_compare_test.cmi test/caml_compare_test.cmj test/caml_format_test.cmi test/caml_format_test.cmj test/chain_code_test.cmi test/chain_code_test.cmj test/chn_test.cmi test/chn_test.cmj test/class_type_ffi_test.cmi test/class_type_ffi_test.cmj test/coercion_module_alias_test.cmi test/coercion_module_alias_test.cmj test/compare_test.cmi test/compare_test.cmj test/complete_parmatch_test.cmi test/complete_parmatch_test.cmj test/complex_if_test.cmi test/complex_if_test.cmj test/complex_test.cmi test/complex_test.cmj test/complex_while_loop.cmi test/complex_while_loop.cmj test/condition_compilation_test.cmi test/condition_compilation_test.cmj test/config1_test.cmi test/config1_test.cmj test/console_log_test.cmi test/console_log_test.cmj test/const_block_test.cmi test/const_block_test.cmj test/const_defs.cmi test/const_defs.cmj test/const_defs_test.cmi test/const_defs_test.cmj test/const_test.cmi test/const_test.cmj test/cont_int_fold_test.cmi test/cont_int_fold_test.cmj test/cps_test.cmi test/cps_test.cmj test/cross_module_inline_test.cmi test/cross_module_inline_test.cmj test/custom_error_test.cmi test/custom_error_test.cmj test/debug_keep_test.cmi test/debug_keep_test.cmj test/debug_mode_value.cmi test/debug_mode_value.cmj test/debug_tmp.cmi test/debug_tmp.cmj test/debugger_test.cmi test/debugger_test.cmj test/default_export_test.cmi test/default_export_test.cmj test/defunctor_make_test.cmi test/defunctor_make_test.cmj test/demo_int_map.cmi test/demo_int_map.cmj test/demo_page.cmi test/demo_page.cmj test/demo_pipe.cmi test/demo_pipe.cmj test/derive_projector_test.cmi test/derive_projector_test.cmj test/digest_test.cmi test/digest_test.cmj test/directives.cmi test/directives.cmj test/div_by_zero_test.cmi test/div_by_zero_test.cmj test/dollar_escape_test.cmi test/dollar_escape_test.cmj test/earger_curry_test.cmi test/earger_curry_test.cmj test/effect.cmi test/effect.cmj test/epsilon_test.cmi test/epsilon_test.cmj test/equal_box_test.cmi test/equal_box_test.cmj test/equal_exception_test.cmi test/equal_exception_test.cmj test/equal_test.cmi test/equal_test.cmj test/es6_export.cmi test/es6_export.cmj test/es6_import.cmi test/es6_import.cmj test/es6_module_test.cmi test/es6_module_test.cmj test/escape_esmodule.cmi test/escape_esmodule.cmj test/esmodule_ref.cmi test/esmodule_ref.cmj test/event_ffi.cmi test/event_ffi.cmj test/exception_alias.cmi test/exception_alias.cmj test/exception_raise_test.cmi test/exception_raise_test.cmj test/exception_rebound_err_test.cmi test/exception_rebound_err_test.cmj test/exception_value_test.cmi test/exception_value_test.cmj test/exponentiation_precedence_test.cmi test/exponentiation_precedence_test.cmj test/export_keyword.cmi test/export_keyword.cmj test/ext_array_test.cmi test/ext_array_test.cmj test/ext_bytes_test.cmi test/ext_bytes_test.cmj test/ext_filename_test.cmi test/ext_filename_test.cmj test/ext_list_test.cmi test/ext_list_test.cmj test/ext_pervasives_test.cmi test/ext_pervasives_test.cmj test/ext_string_test.cmi test/ext_string_test.cmj test/ext_sys_test.cmi test/ext_sys_test.cmj test/extensible_variant_test.cmi test/extensible_variant_test.cmj test/external_polyfill_test.cmi test/external_polyfill_test.cmj test/external_ppx.cmi test/external_ppx.cmj test/external_ppx2.cmi test/external_ppx2.cmj test/fail_comp.cmi test/fail_comp.cmj test/ffi_arity_test.cmi test/ffi_arity_test.cmj test/ffi_array_test.cmi test/ffi_array_test.cmj test/ffi_js_test.cmi test/ffi_js_test.cmj test/ffi_splice_test.cmi test/ffi_splice_test.cmj test/ffi_test.cmi test/ffi_test.cmj test/fib.cmi test/fib.cmj test/flattern_order_test.cmi test/flattern_order_test.cmj test/flexible_array_test.cmi test/flexible_array_test.cmj test/float_array.cmi test/float_array.cmj test/float_of_bits_test.cmi test/float_of_bits_test.cmj test/float_record.cmi test/float_record.cmj test/float_test.cmi test/float_test.cmj test/floatarray_test.cmi test/floatarray_test.cmj test/for_loop_test.cmi test/for_loop_test.cmj test/for_side_effect_test.cmi test/for_side_effect_test.cmj test/format_regression.cmi test/format_regression.cmj test/format_test.cmi test/format_test.cmj test/fun_pattern_match.cmi test/fun_pattern_match.cmj test/function_directives.cmi test/function_directives.cmj test/function_directives_no_inline.cmi test/function_directives_no_inline.cmj test/functor_app_test.cmi test/functor_app_test.cmj test/functor_def.cmi test/functor_def.cmj test/functor_ffi.cmi test/functor_ffi.cmj test/functor_inst.cmi test/functor_inst.cmj test/functors.cmi test/functors.cmj test/gbk.cmi test/gbk.cmj test/genlex_test.cmi test/genlex_test.cmj test/gentTypeReTest.cmi test/gentTypeReTest.cmj test/global_exception_regression_test.cmi test/global_exception_regression_test.cmj test/global_mangles.cmi test/global_mangles.cmj test/global_module_alias_test.cmi test/global_module_alias_test.cmj test/google_closure_test.cmi test/google_closure_test.cmj test/gpr496_test.cmi test/gpr496_test.cmj test/gpr_1072.cmi test/gpr_1072.cmj test/gpr_1072_reg.cmi test/gpr_1072_reg.cmj test/gpr_1150.cmi test/gpr_1150.cmj test/gpr_1154_test.cmi test/gpr_1154_test.cmj test/gpr_1170.cmi test/gpr_1170.cmj test/gpr_1240_missing_unbox.cmi test/gpr_1240_missing_unbox.cmj test/gpr_1245_test.cmi test/gpr_1245_test.cmj test/gpr_1268.cmi test/gpr_1268.cmj test/gpr_1409_test.cmi test/gpr_1409_test.cmj test/gpr_1423_app_test.cmi test/gpr_1423_app_test.cmj test/gpr_1423_nav.cmi test/gpr_1423_nav.cmj test/gpr_1438.cmi test/gpr_1438.cmj test/gpr_1481.cmi test/gpr_1481.cmj test/gpr_1484.cmi test/gpr_1484.cmj test/gpr_1503_test.cmi test/gpr_1503_test.cmj test/gpr_1539_test.cmi test/gpr_1539_test.cmj test/gpr_1658_test.cmi test/gpr_1658_test.cmj test/gpr_1667_test.cmi test/gpr_1667_test.cmj test/gpr_1692_test.cmi test/gpr_1692_test.cmj test/gpr_1698_test.cmi test/gpr_1698_test.cmj test/gpr_1701_test.cmi test/gpr_1701_test.cmj test/gpr_1716_test.cmi test/gpr_1716_test.cmj test/gpr_1717_test.cmi test/gpr_1717_test.cmj test/gpr_1728_test.cmi test/gpr_1728_test.cmj test/gpr_1749_test.cmi test/gpr_1749_test.cmj test/gpr_1759_test.cmi test/gpr_1759_test.cmj test/gpr_1760_test.cmi test/gpr_1760_test.cmj test/gpr_1762_test.cmi test/gpr_1762_test.cmj test/gpr_1817_test.cmi test/gpr_1817_test.cmj test/gpr_1822_test.cmi test/gpr_1822_test.cmj test/gpr_1891_test.cmi test/gpr_1891_test.cmj test/gpr_1943_test.cmi test/gpr_1943_test.cmj test/gpr_1946_test.cmi test/gpr_1946_test.cmj test/gpr_2316_test.cmi test/gpr_2316_test.cmj test/gpr_2352_test.cmi test/gpr_2352_test.cmj test/gpr_2413_test.cmi test/gpr_2413_test.cmj test/gpr_2474.cmi test/gpr_2474.cmj test/gpr_2487.cmi test/gpr_2487.cmj test/gpr_2503_test.cmi test/gpr_2503_test.cmj test/gpr_2608_test.cmi test/gpr_2608_test.cmj test/gpr_2614_test.cmi test/gpr_2614_test.cmj test/gpr_2633_test.cmi test/gpr_2633_test.cmj test/gpr_2642_test.cmi test/gpr_2642_test.cmj test/gpr_2682_test.cmi test/gpr_2682_test.cmj test/gpr_2700_test.cmi test/gpr_2700_test.cmj test/gpr_2731_test.cmi test/gpr_2731_test.cmj test/gpr_2789_test.cmi test/gpr_2789_test.cmj test/gpr_2931_test.cmi test/gpr_2931_test.cmj test/gpr_3142_test.cmi test/gpr_3142_test.cmj test/gpr_3154_test.cmi test/gpr_3154_test.cmj test/gpr_3209_test.cmi test/gpr_3209_test.cmj test/gpr_3492_test.cmi test/gpr_3492_test.cmj test/gpr_3519_jsx_test.cmi test/gpr_3519_jsx_test.cmj test/gpr_3519_test.cmi test/gpr_3519_test.cmj test/gpr_3536_test.cmi test/gpr_3536_test.cmj test/gpr_3546_test.cmi test/gpr_3546_test.cmj test/gpr_3548_test.cmi test/gpr_3548_test.cmj test/gpr_3549_test.cmi test/gpr_3549_test.cmj test/gpr_3566_drive_test.cmi test/gpr_3566_drive_test.cmj test/gpr_3566_test.cmi test/gpr_3566_test.cmj test/gpr_3595_test.cmi test/gpr_3595_test.cmj test/gpr_3609_test.cmi test/gpr_3609_test.cmj test/gpr_3697_test.cmi test/gpr_3697_test.cmj test/gpr_373_test.cmi test/gpr_373_test.cmj test/gpr_3770_test.cmi test/gpr_3770_test.cmj test/gpr_3852_alias.cmi test/gpr_3852_alias.cmj test/gpr_3852_alias_reify.cmi test/gpr_3852_alias_reify.cmj test/gpr_3852_effect.cmi test/gpr_3852_effect.cmj test/gpr_3865.cmi test/gpr_3865.cmj test/gpr_3865_bar.cmi test/gpr_3865_bar.cmj test/gpr_3865_foo.cmi test/gpr_3865_foo.cmj test/gpr_3875_test.cmi test/gpr_3875_test.cmj test/gpr_3877_test.cmi test/gpr_3877_test.cmj test/gpr_3895_test.cmi test/gpr_3895_test.cmj test/gpr_3897_test.cmi test/gpr_3897_test.cmj test/gpr_3931_test.cmi test/gpr_3931_test.cmj test/gpr_3980_test.cmi test/gpr_3980_test.cmj test/gpr_4025_test.cmi test/gpr_4025_test.cmj test/gpr_405_test.cmi test/gpr_405_test.cmj test/gpr_4069_test.cmi test/gpr_4069_test.cmj test/gpr_4265_test.cmi test/gpr_4265_test.cmj test/gpr_4274_test.cmi test/gpr_4274_test.cmj test/gpr_4280_test.cmi test/gpr_4280_test.cmj test/gpr_4407_test.cmi test/gpr_4407_test.cmj test/gpr_441.cmi test/gpr_441.cmj test/gpr_4442_test.cmi test/gpr_4442_test.cmj test/gpr_4491_test.cmi test/gpr_4491_test.cmj test/gpr_4494_test.cmi test/gpr_4494_test.cmj test/gpr_4519_test.cmi test/gpr_4519_test.cmj test/gpr_459_test.cmi test/gpr_459_test.cmj test/gpr_4632.cmi test/gpr_4632.cmj test/gpr_4639_test.cmi test/gpr_4639_test.cmj test/gpr_4900_test.cmi test/gpr_4900_test.cmj test/gpr_4924_test.cmi test/gpr_4924_test.cmj test/gpr_4931.cmi test/gpr_4931.cmj test/gpr_4931_allow.cmi test/gpr_4931_allow.cmj test/gpr_5071_test.cmi test/gpr_5071_test.cmj test/gpr_5169_test.cmi test/gpr_5169_test.cmj test/gpr_5218_test.cmi test/gpr_5218_test.cmj test/gpr_5280_optimize_test.cmi test/gpr_5280_optimize_test.cmj test/gpr_5312.cmi test/gpr_5312.cmj test/gpr_5557.cmi test/gpr_5557.cmj test/gpr_5753.cmi test/gpr_5753.cmj test/gpr_658.cmi test/gpr_658.cmj test/gpr_858_test.cmi test/gpr_858_test.cmj test/gpr_858_unit2_test.cmi test/gpr_858_unit2_test.cmj test/gpr_904_test.cmi test/gpr_904_test.cmj test/gpr_974_test.cmi test/gpr_974_test.cmj test/gpr_977_test.cmi test/gpr_977_test.cmj test/gpr_return_type_unused_attribute.cmi test/gpr_return_type_unused_attribute.cmj test/gray_code_test.cmi test/gray_code_test.cmj test/guide_for_ext.cmi test/guide_for_ext.cmj test/hash_collision_test.cmi test/hash_collision_test.cmj test/hash_sugar_desugar.cmi test/hash_sugar_desugar.cmj test/hash_test.cmi test/hash_test.cmj test/hashtbl_test.cmi test/hashtbl_test.cmj test/hello.foo.cmi test/hello.foo.cmj test/hello_res.cmi test/hello_res.cmj test/ignore_test.cmi test/ignore_test.cmj test/imm_map_bench.cmi test/imm_map_bench.cmj test/import2.cmi test/import2.cmj test/import_external.cmi test/import_external.cmj test/import_side_effect.cmi test/import_side_effect.cmj test/import_side_effect_free.cmi test/import_side_effect_free.cmj test/include_side_effect.cmi test/include_side_effect.cmj test/include_side_effect_free.cmi test/include_side_effect_free.cmj test/incomplete_toplevel_test.cmi test/incomplete_toplevel_test.cmj test/infer_type_test.cmi test/infer_type_test.cmj test/inline_condition_with_pattern_matching.cmi test/inline_condition_with_pattern_matching.cmj test/inline_const.cmi test/inline_const.cmj test/inline_const_test.cmi test/inline_const_test.cmj test/inline_edge_cases.cmi test/inline_edge_cases.cmj test/inline_map2_test.cmi test/inline_map2_test.cmj test/inline_map_demo.cmi test/inline_map_demo.cmj test/inline_map_test.cmi test/inline_map_test.cmj test/inline_record_test.cmi test/inline_record_test.cmj test/inline_regression_test.cmi test/inline_regression_test.cmj test/inline_string_test.cmi test/inline_string_test.cmj test/inner_call.cmi test/inner_call.cmj test/inner_define.cmi test/inner_define.cmj test/inner_unused.cmi test/inner_unused.cmj test/installation_test.cmi test/installation_test.cmj test/int32_test.cmi test/int32_test.cmj test/int64_mul_div_test.cmi test/int64_mul_div_test.cmj test/int64_string_bench.cmi test/int64_string_bench.cmj test/int64_string_test.cmi test/int64_string_test.cmj test/int64_test.cmi test/int64_test.cmj test/int_hashtbl_test.cmi test/int_hashtbl_test.cmj test/int_map.cmi test/int_map.cmj test/int_overflow_test.cmi test/int_overflow_test.cmj test/int_poly_var.cmi test/int_poly_var.cmj test/int_switch_test.cmi test/int_switch_test.cmj test/internal_unused_test.cmi test/internal_unused_test.cmj test/io_test.cmi test/io_test.cmj test/js_array_test.cmi test/js_array_test.cmj test/js_bool_test.cmi test/js_bool_test.cmj test/js_cast_test.cmi test/js_cast_test.cmj test/js_date_test.cmi test/js_date_test.cmj test/js_dict_test.cmi test/js_dict_test.cmj test/js_exception_catch_test.cmi test/js_exception_catch_test.cmj test/js_float_test.cmi test/js_float_test.cmj test/js_global_test.cmi test/js_global_test.cmj test/js_int_test.cmi test/js_int_test.cmj test/js_json_test.cmi test/js_json_test.cmj test/js_list_test.cmi test/js_list_test.cmj test/js_math_test.cmi test/js_math_test.cmj test/js_null_test.cmi test/js_null_test.cmj test/js_null_undefined_test.cmi test/js_null_undefined_test.cmj test/js_nullable_test.cmi test/js_nullable_test.cmj test/js_obj_test.cmi test/js_obj_test.cmj test/js_option_test.cmi test/js_option_test.cmj test/js_re_test.cmi test/js_re_test.cmj test/js_string_test.cmi test/js_string_test.cmj test/js_typed_array_test.cmi test/js_typed_array_test.cmj test/js_undefined_test.cmi test/js_undefined_test.cmj test/js_val.cmi test/js_val.cmj test/jsoo_400_test.cmi test/jsoo_400_test.cmj test/jsoo_485_test.cmi test/jsoo_485_test.cmj test/jsxv4_newtype.cmi test/jsxv4_newtype.cmj test/key_word_property.cmi test/key_word_property.cmj test/key_word_property2.cmi test/key_word_property2.cmj test/key_word_property_plus_test.cmi test/key_word_property_plus_test.cmj test/label_uncurry.cmi test/label_uncurry.cmj test/large_integer_pat.cmi test/large_integer_pat.cmj test/large_record_duplication_test.cmi test/large_record_duplication_test.cmj test/largest_int_flow.cmi test/largest_int_flow.cmj test/lazy_demo.cmi test/lazy_demo.cmj test/lazy_test.cmi test/lazy_test.cmj test/lib_js_test.cmi test/lib_js_test.cmj test/libarg_test.cmi test/libarg_test.cmj test/libqueue_test.cmi test/libqueue_test.cmj test/limits_test.cmi test/limits_test.cmj test/list_stack.cmi test/list_stack.cmj test/list_test.cmi test/list_test.cmj test/local_exception_test.cmi test/local_exception_test.cmj test/loop_regression_test.cmi test/loop_regression_test.cmj test/loop_suites_test.cmi test/loop_suites_test.cmj test/map_find_test.cmi test/map_find_test.cmj test/map_test.cmi test/map_test.cmj test/mario_game.cmi test/mario_game.cmj test/marshal.cmi test/marshal.cmj test/meth_annotation.cmi test/meth_annotation.cmj test/method_name_test.cmi test/method_name_test.cmj test/method_string_name.cmi test/method_string_name.cmj test/minimal_test.cmi test/minimal_test.cmj test/miss_colon_test.cmi test/miss_colon_test.cmj test/mock_mt.cmi test/mock_mt.cmj test/module_alias_test.cmi test/module_alias_test.cmj test/module_as_class_ffi.cmi test/module_as_class_ffi.cmj test/module_as_function.cmi test/module_as_function.cmj test/module_missing_conversion.cmi test/module_missing_conversion.cmj test/module_parameter_test.cmi test/module_parameter_test.cmj test/module_splice_test.cmi test/module_splice_test.cmj test/more_poly_variant_test.cmi test/more_poly_variant_test.cmj test/more_uncurry.cmi test/more_uncurry.cmj test/mpr_6033_test.cmi test/mpr_6033_test.cmj test/mt.cmi test/mt.cmj test/mt_global.cmi test/mt_global.cmj test/mutable_obj_test.cmi test/mutable_obj_test.cmj test/mutable_uncurry_test.cmi test/mutable_uncurry_test.cmj test/mutual_non_recursive_type.cmi test/mutual_non_recursive_type.cmj test/name_mangle_test.cmi test/name_mangle_test.cmj test/nested_include.cmi test/nested_include.cmj test/nested_module_alias.cmi test/nested_module_alias.cmj test/nested_obj_literal.cmi test/nested_obj_literal.cmj test/nested_obj_test.cmi test/nested_obj_test.cmj test/nested_pattern_match_test.cmi test/nested_pattern_match_test.cmj test/noassert.cmi test/noassert.cmj test/node_path_test.cmi test/node_path_test.cmj test/null_list_test.cmi test/null_list_test.cmj test/number_lexer.cmi test/number_lexer.cmj test/obj_literal_ppx.cmi test/obj_literal_ppx.cmj test/obj_literal_ppx_test.cmi test/obj_literal_ppx_test.cmj test/obj_magic_test.cmi test/obj_magic_test.cmj test/obj_type_test.cmi test/obj_type_test.cmj test/ocaml_re_test.cmi test/ocaml_re_test.cmj test/of_string_test.cmi test/of_string_test.cmj test/offset.cmi test/offset.cmj test/omit_trailing_undefined_in_external_calls.cmi test/omit_trailing_undefined_in_external_calls.cmj test/option_encoding_test.cmi test/option_encoding_test.cmj test/option_record_none_test.cmi test/option_record_none_test.cmj test/option_repr_test.cmi test/option_repr_test.cmj test/optional_ffi_test.cmi test/optional_ffi_test.cmj test/optional_regression_test.cmi test/optional_regression_test.cmj test/pipe_send_readline.cmi test/pipe_send_readline.cmj test/pipe_syntax.cmi test/pipe_syntax.cmj test/poly_empty_array.cmi test/poly_empty_array.cmj test/poly_variant_test.cmi test/poly_variant_test.cmj test/polymorphic_raw_test.cmi test/polymorphic_raw_test.cmj test/polymorphism_test.cmi test/polymorphism_test.cmj test/polyvar_convert.cmi test/polyvar_convert.cmj test/polyvar_test.cmi test/polyvar_test.cmj test/ppx_apply_test.cmi test/ppx_apply_test.cmj test/pq_test.cmi test/pq_test.cmj test/pr6726.cmi test/pr6726.cmj test/pr_regression_test.cmi test/pr_regression_test.cmj test/prepend_data_ffi.cmi test/prepend_data_ffi.cmj test/primitive_reg_test.cmi test/primitive_reg_test.cmj test/print_alpha_test.cmi test/print_alpha_test.cmj test/queue_402.cmi test/queue_402.cmj test/queue_test.cmi test/queue_test.cmj test/random_test.cmi test/random_test.cmj test/raw_hash_tbl_bench.cmi test/raw_hash_tbl_bench.cmj test/raw_output_test.cmi test/raw_output_test.cmj test/raw_pure_test.cmi test/raw_pure_test.cmj test/rbset.cmi test/rbset.cmj test/react.cmi test/react.cmj test/reactDOMRe.cmi test/reactDOMRe.cmj test/reactDOMServerRe.cmi test/reactDOMServerRe.cmj test/reactEvent.cmi test/reactEvent.cmj test/reactTestUtils.cmi test/reactTestUtils.cmj test/reasonReact.cmi test/reasonReact.cmj test/reasonReactCompat.cmi test/reasonReactCompat.cmj test/reasonReactOptimizedCreateClass.cmi test/reasonReactOptimizedCreateClass.cmj test/reasonReactRouter.cmi test/reasonReactRouter.cmj test/rebind_module.cmi test/rebind_module.cmj test/rebind_module_test.cmi test/rebind_module_test.cmj test/rec_array_test.cmi test/rec_array_test.cmj test/rec_fun_test.cmi test/rec_fun_test.cmj test/rec_module_opt.cmi test/rec_module_opt.cmj test/rec_module_test.cmi test/rec_module_test.cmj test/recmodule.cmi test/recmodule.cmj test/record_debug_test.cmi test/record_debug_test.cmj test/record_extension_test.cmi test/record_extension_test.cmj test/record_name_test.cmi test/record_name_test.cmj test/record_regression.cmi test/record_regression.cmj test/record_type_spread.cmi test/record_type_spread.cmj test/record_with_test.cmi test/record_with_test.cmj test/recursive_module.cmi test/recursive_module.cmj test/recursive_module_test.cmi test/recursive_module_test.cmj test/recursive_react_component.cmi test/recursive_react_component.cmj test/recursive_records_test.cmi test/recursive_records_test.cmj test/recursive_unbound_module_test.cmi test/recursive_unbound_module_test.cmj test/regression_print.cmi test/regression_print.cmj test/relative_path.cmi test/relative_path.cmj test/res_debug.cmi test/res_debug.cmj test/return_check.cmi test/return_check.cmj test/runtime_encoding_test.cmi test/runtime_encoding_test.cmj test/set_annotation.cmi test/set_annotation.cmj test/set_gen.cmi test/set_gen.cmj test/sexp.cmi test/sexp.cmj test/sexpm.cmi test/sexpm.cmj test/sexpm_test.cmi test/sexpm_test.cmj test/side_effect.cmi test/side_effect.cmj test/side_effect2.cmi test/side_effect2.cmj test/side_effect_free.cmi test/side_effect_free.cmj test/simplify_lambda_632o.cmi test/simplify_lambda_632o.cmj test/single_module_alias.cmi test/single_module_alias.cmj test/singular_unit_test.cmi test/singular_unit_test.cmj test/small_inline_test.cmi test/small_inline_test.cmj test/splice_test.cmi test/splice_test.cmj test/stack_comp_test.cmi test/stack_comp_test.cmj test/stack_test.cmi test/stack_test.cmj test/stream_parser_test.cmi test/stream_parser_test.cmj test/string_bound_get_test.cmi test/string_bound_get_test.cmj test/string_constant_compare.cmi test/string_constant_compare.cmj test/string_get_set_test.cmi test/string_get_set_test.cmj test/string_runtime_test.cmi test/string_runtime_test.cmj test/string_set.cmi test/string_set.cmj test/string_set_test.cmi test/string_set_test.cmj test/string_test.cmi test/string_test.cmj test/string_unicode_test.cmi test/string_unicode_test.cmj test/stringmatch_test.cmi test/stringmatch_test.cmj test/submodule.cmi test/submodule.cmj test/submodule_call.cmi test/submodule_call.cmj test/switch_case_test.cmi test/switch_case_test.cmj test/switch_string.cmi test/switch_string.cmj test/tagged_template_test.cmi test/tagged_template_test.cmj test/tailcall_inline_test.cmi test/tailcall_inline_test.cmj test/template.cmi test/template.cmj test/test.cmi test/test.cmj test/test2.cmi test/test2.cmj test/test_alias.cmi test/test_alias.cmj test/test_ari.cmi test/test_ari.cmj test/test_array.cmi test/test_array.cmj test/test_array_append.cmi test/test_array_append.cmj test/test_array_primitive.cmi test/test_array_primitive.cmj test/test_bool_equal.cmi test/test_bool_equal.cmj test/test_bs_this.cmi test/test_bs_this.cmj test/test_bug.cmi test/test_bug.cmj test/test_bytes.cmi test/test_bytes.cmj test/test_case_opt_collision.cmi test/test_case_opt_collision.cmj test/test_case_set.cmi test/test_case_set.cmj test/test_char.cmi test/test_char.cmj test/test_closure.cmi test/test_closure.cmj test/test_common.cmi test/test_common.cmj test/test_const_elim.cmi test/test_const_elim.cmj test/test_const_propogate.cmi test/test_const_propogate.cmj test/test_cpp.cmi test/test_cpp.cmj test/test_cps.cmi test/test_cps.cmj test/test_demo.cmi test/test_demo.cmj test/test_dup_param.cmi test/test_dup_param.cmj test/test_eq.cmi test/test_eq.cmj test/test_exception.cmi test/test_exception.cmj test/test_exception_escape.cmi test/test_exception_escape.cmj test/test_export2.cmi test/test_export2.cmj test/test_external.cmi test/test_external.cmj test/test_external_unit.cmi test/test_external_unit.cmj test/test_ffi.cmi test/test_ffi.cmj test/test_fib.cmi test/test_fib.cmj test/test_filename.cmi test/test_filename.cmj test/test_for_loop.cmi test/test_for_loop.cmj test/test_for_map.cmi test/test_for_map.cmj test/test_for_map2.cmi test/test_for_map2.cmj test/test_format.cmi test/test_format.cmj test/test_formatter.cmi test/test_formatter.cmj test/test_functor_dead_code.cmi test/test_functor_dead_code.cmj test/test_generative_module.cmi test/test_generative_module.cmj test/test_global_print.cmi test/test_global_print.cmj test/test_google_closure.cmi test/test_google_closure.cmj test/test_include.cmi test/test_include.cmj test/test_incomplete.cmi test/test_incomplete.cmj test/test_incr_ref.cmi test/test_incr_ref.cmj test/test_int_map_find.cmi test/test_int_map_find.cmj test/test_internalOO.cmi test/test_internalOO.cmj test/test_is_js.cmi test/test_is_js.cmj test/test_js_ffi.cmi test/test_js_ffi.cmj test/test_let.cmi test/test_let.cmj test/test_list.cmi test/test_list.cmj test/test_literal.cmi test/test_literal.cmj test/test_literals.cmi test/test_literals.cmj test/test_match_exception.cmi test/test_match_exception.cmj test/test_mutliple.cmi test/test_mutliple.cmj test/test_nat64.cmi test/test_nat64.cmj test/test_nested_let.cmi test/test_nested_let.cmj test/test_nested_print.cmi test/test_nested_print.cmj test/test_non_export.cmi test/test_non_export.cmj test/test_nullary.cmi test/test_nullary.cmj test/test_obj.cmi test/test_obj.cmj test/test_order.cmi test/test_order.cmj test/test_order_tailcall.cmi test/test_order_tailcall.cmj test/test_other_exn.cmi test/test_other_exn.cmj test/test_pack.cmi test/test_pack.cmj test/test_per.cmi test/test_per.cmj test/test_pervasive.cmi test/test_pervasive.cmj test/test_pervasives2.cmi test/test_pervasives2.cmj test/test_pervasives3.cmi test/test_pervasives3.cmj test/test_primitive.cmi test/test_primitive.cmj test/test_ramification.cmi test/test_ramification.cmj test/test_react.cmi test/test_react.cmj test/test_react_case.cmi test/test_react_case.cmj test/test_regex.cmi test/test_regex.cmj test/test_runtime_encoding.cmi test/test_runtime_encoding.cmj test/test_scope.cmi test/test_scope.cmj test/test_seq.cmi test/test_seq.cmj test/test_set.cmi test/test_set.cmj test/test_side_effect_functor.cmi test/test_side_effect_functor.cmj test/test_simple_include.cmi test/test_simple_include.cmj test/test_simple_pattern_match.cmi test/test_simple_pattern_match.cmj test/test_simple_ref.cmi test/test_simple_ref.cmj test/test_simple_tailcall.cmi test/test_simple_tailcall.cmj test/test_small.cmi test/test_small.cmj test/test_sprintf.cmi test/test_sprintf.cmj test/test_stack.cmi test/test_stack.cmj test/test_static_catch_ident.cmi test/test_static_catch_ident.cmj test/test_string.cmi test/test_string.cmj test/test_string_case.cmi test/test_string_case.cmj test/test_string_const.cmi test/test_string_const.cmj test/test_string_map.cmi test/test_string_map.cmj test/test_string_switch.cmi test/test_string_switch.cmj test/test_switch.cmi test/test_switch.cmj test/test_trywith.cmi test/test_trywith.cmj test/test_tuple.cmi test/test_tuple.cmj test/test_tuple_destructring.cmi test/test_tuple_destructring.cmj test/test_type_based_arity.cmi test/test_type_based_arity.cmj test/test_u.cmi test/test_u.cmj test/test_unknown.cmi test/test_unknown.cmj test/test_unsafe_cmp.cmi test/test_unsafe_cmp.cmj test/test_unsafe_obj_ffi.cmi test/test_unsafe_obj_ffi.cmj test/test_unsafe_obj_ffi_ppx.cmi test/test_unsafe_obj_ffi_ppx.cmj test/test_unsupported_primitive.cmi test/test_unsupported_primitive.cmj test/test_while_closure.cmi test/test_while_closure.cmj test/test_while_side_effect.cmi test/test_while_side_effect.cmj test/test_zero_nullable.cmi test/test_zero_nullable.cmj test/then_mangle_test.cmi test/then_mangle_test.cmj test/ticker.cmi test/ticker.cmj test/to_string_test.cmi test/to_string_test.cmj test/topsort_test.cmi test/topsort_test.cmj test/tramp_fib.cmi test/tramp_fib.cmj test/tuple_alloc.cmi test/tuple_alloc.cmj test/type_disambiguate.cmi test/type_disambiguate.cmj test/typeof_test.cmi test/typeof_test.cmj test/unboxed_attribute.cmi test/unboxed_attribute.cmj test/unboxed_attribute_test.cmi test/unboxed_attribute_test.cmj test/unboxed_crash.cmi test/unboxed_crash.cmj test/unboxed_use_case.cmi test/unboxed_use_case.cmj test/uncurried_cast.cmi test/uncurried_cast.cmj test/uncurried_default.args.cmi test/uncurried_default.args.cmj test/uncurried_pipe.cmi test/uncurried_pipe.cmj test/uncurry_external_test.cmi test/uncurry_external_test.cmj test/uncurry_glob_test.cmi test/uncurry_glob_test.cmj test/uncurry_test.cmi test/uncurry_test.cmj test/undef_regression2_test.cmi test/undef_regression2_test.cmj test/undef_regression_test.cmi test/undef_regression_test.cmj test/undefine_conditional.cmi test/undefine_conditional.cmj test/unicode_type_error.cmi test/unicode_type_error.cmj test/unit_undefined_test.cmi test/unit_undefined_test.cmj test/unitest_string.cmi test/unitest_string.cmj test/unsafe_full_apply_primitive.cmi test/unsafe_full_apply_primitive.cmj test/unsafe_ppx_test.cmi test/unsafe_ppx_test.cmj test/update_record_test.cmi test/update_record_test.cmj test/variant.cmi test/variant.cmj test/variantsMatching.cmi test/variantsMatching.cmj test/webpack_config.cmi test/webpack_config.cmj +o test : phony test/406_primitive_test.cmi test/406_primitive_test.cmj test/AsInUncurriedExternals.cmi test/AsInUncurriedExternals.cmj test/Coercion.cmi test/Coercion.cmj test/DerivingAccessorsCurried.cmi test/DerivingAccessorsCurried.cmj test/DerivingAccessorsUncurried.cmi test/DerivingAccessorsUncurried.cmj test/DictInference.cmi test/DictInference.cmj test/DotDotDot.cmi test/DotDotDot.cmj test/EmptyRecord.cmi test/EmptyRecord.cmj test/FFI.cmi test/FFI.cmj test/Import.cmi test/Import.cmj test/ImportAttributes.cmi test/ImportAttributes.cmj test/RecordCoercion.cmi test/RecordCoercion.cmj test/RecordOrObject.cmi test/RecordOrObject.cmj test/SafePromises.cmi test/SafePromises.cmj test/UncurriedAlways.cmi test/UncurriedAlways.cmj test/UncurriedExternals.cmi test/UncurriedExternals.cmj test/UncurriedPervasives.cmi test/UncurriedPervasives.cmj test/UntaggedVariants.cmi test/UntaggedVariants.cmj test/VariantCoercion.cmi test/VariantCoercion.cmj test/VariantSpreads.cmi test/VariantSpreads.cmj test/a.cmi test/a.cmj test/a_list_test.cmi test/a_list_test.cmj test/a_recursive_type.cmi test/a_recursive_type.cmj test/a_scope_bug.cmi test/a_scope_bug.cmj test/a_string_test.cmi test/a_string_test.cmj test/abstract_type.cmi test/abstract_type.cmj test/adt_optimize_test.cmi test/adt_optimize_test.cmj test/alias_default_value_test.cmi test/alias_default_value_test.cmj test/alias_test.cmi test/alias_test.cmj test/and_or_tailcall_test.cmi test/and_or_tailcall_test.cmj test/argv_test.cmi test/argv_test.cmj test/ari_regress_test.cmi test/ari_regress_test.cmj test/arith_lexer.cmi test/arith_lexer.cmj test/arith_parser.cmi test/arith_parser.cmj test/arith_syntax.cmi test/arith_syntax.cmj test/arity.cmi test/arity.cmj test/arity_deopt.cmi test/arity_deopt.cmj test/arity_infer.cmi test/arity_infer.cmj test/array_data_util.cmi test/array_data_util.cmj test/array_safe_get.cmi test/array_safe_get.cmj test/array_subtle_test.cmi test/array_subtle_test.cmj test/array_test.cmi test/array_test.cmj test/as_inline_record_test.cmi test/as_inline_record_test.cmj test/ast_abstract_test.cmi test/ast_abstract_test.cmj test/ast_mapper_unused_warning_test.cmi test/ast_mapper_unused_warning_test.cmj test/async_await.cmi test/async_await.cmj test/async_ideas.cmi test/async_ideas.cmj test/async_inline.cmi test/async_inline.cmj test/async_inside_loop.cmi test/async_inside_loop.cmj test/attr_test.cmi test/attr_test.cmj test/b.cmi test/b.cmj test/bal_set_mini.cmi test/bal_set_mini.cmj test/bang_primitive.cmi test/bang_primitive.cmj test/basic_module_test.cmi test/basic_module_test.cmj test/bb.cmi test/bb.cmj test/bdd.cmi test/bdd.cmj test/belt_internal_test.cmi test/belt_internal_test.cmj test/belt_result_alias_test.cmi test/belt_result_alias_test.cmj test/bench.cmi test/bench.cmj test/big_enum.cmi test/big_enum.cmj test/big_polyvar_test.cmi test/big_polyvar_test.cmj test/bigint_test.cmi test/bigint_test.cmj test/block_alias_test.cmi test/block_alias_test.cmj test/boolean_test.cmi test/boolean_test.cmj test/bs_MapInt_test.cmi test/bs_MapInt_test.cmj test/bs_array_test.cmi test/bs_array_test.cmj test/bs_auto_uncurry.cmi test/bs_auto_uncurry.cmj test/bs_auto_uncurry_test.cmi test/bs_auto_uncurry_test.cmj test/bs_float_test.cmi test/bs_float_test.cmj test/bs_hashmap_test.cmi test/bs_hashmap_test.cmj test/bs_hashset_int_test.cmi test/bs_hashset_int_test.cmj test/bs_hashtbl_string_test.cmi test/bs_hashtbl_string_test.cmj test/bs_ignore_effect.cmi test/bs_ignore_effect.cmj test/bs_ignore_test.cmi test/bs_ignore_test.cmj test/bs_int_test.cmi test/bs_int_test.cmj test/bs_list_test.cmi test/bs_list_test.cmj test/bs_map_set_dict_test.cmi test/bs_map_set_dict_test.cmj test/bs_map_test.cmi test/bs_map_test.cmj test/bs_min_max_test.cmi test/bs_min_max_test.cmj test/bs_poly_map_test.cmi test/bs_poly_map_test.cmj test/bs_poly_mutable_map_test.cmi test/bs_poly_mutable_map_test.cmj test/bs_poly_mutable_set_test.cmi test/bs_poly_mutable_set_test.cmj test/bs_poly_set_test.cmi test/bs_poly_set_test.cmj test/bs_qualified.cmi test/bs_qualified.cmj test/bs_queue_test.cmi test/bs_queue_test.cmj test/bs_rbset_int_bench.cmi test/bs_rbset_int_bench.cmj test/bs_rest_test.cmi test/bs_rest_test.cmj test/bs_set_bench.cmi test/bs_set_bench.cmj test/bs_set_int_test.cmi test/bs_set_int_test.cmj test/bs_sort_test.cmi test/bs_sort_test.cmj test/bs_splice_partial.cmi test/bs_splice_partial.cmj test/bs_stack_test.cmi test/bs_stack_test.cmj test/bs_string_test.cmi test/bs_string_test.cmj test/bs_unwrap_test.cmi test/bs_unwrap_test.cmj test/buffer_test.cmi test/buffer_test.cmj test/bytes_split_gpr_743_test.cmi test/bytes_split_gpr_743_test.cmj test/caml_compare_bigint_test.cmi test/caml_compare_bigint_test.cmj test/caml_compare_test.cmi test/caml_compare_test.cmj test/chain_code_test.cmi test/chain_code_test.cmj test/chn_test.cmi test/chn_test.cmj test/class_type_ffi_test.cmi test/class_type_ffi_test.cmj test/coercion_module_alias_test.cmi test/coercion_module_alias_test.cmj test/compare_test.cmi test/compare_test.cmj test/complete_parmatch_test.cmi test/complete_parmatch_test.cmj test/complex_if_test.cmi test/complex_if_test.cmj test/complex_test.cmi test/complex_test.cmj test/complex_while_loop.cmi test/complex_while_loop.cmj test/condition_compilation_test.cmi test/condition_compilation_test.cmj test/config1_test.cmi test/config1_test.cmj test/console_log_test.cmi test/console_log_test.cmj test/const_block_test.cmi test/const_block_test.cmj test/const_defs.cmi test/const_defs.cmj test/const_defs_test.cmi test/const_defs_test.cmj test/const_test.cmi test/const_test.cmj test/cont_int_fold_test.cmi test/cont_int_fold_test.cmj test/cps_test.cmi test/cps_test.cmj test/cross_module_inline_test.cmi test/cross_module_inline_test.cmj test/custom_error_test.cmi test/custom_error_test.cmj test/debug_keep_test.cmi test/debug_keep_test.cmj test/debug_mode_value.cmi test/debug_mode_value.cmj test/debug_tmp.cmi test/debug_tmp.cmj test/debugger_test.cmi test/debugger_test.cmj test/default_export_test.cmi test/default_export_test.cmj test/defunctor_make_test.cmi test/defunctor_make_test.cmj test/demo_int_map.cmi test/demo_int_map.cmj test/demo_page.cmi test/demo_page.cmj test/demo_pipe.cmi test/demo_pipe.cmj test/derive_projector_test.cmi test/derive_projector_test.cmj test/directives.cmi test/directives.cmj test/div_by_zero_test.cmi test/div_by_zero_test.cmj test/dollar_escape_test.cmi test/dollar_escape_test.cmj test/earger_curry_test.cmi test/earger_curry_test.cmj test/effect.cmi test/effect.cmj test/epsilon_test.cmi test/epsilon_test.cmj test/equal_box_test.cmi test/equal_box_test.cmj test/equal_exception_test.cmi test/equal_exception_test.cmj test/equal_test.cmi test/equal_test.cmj test/es6_export.cmi test/es6_export.cmj test/es6_import.cmi test/es6_import.cmj test/es6_module_test.cmi test/es6_module_test.cmj test/escape_esmodule.cmi test/escape_esmodule.cmj test/esmodule_ref.cmi test/esmodule_ref.cmj test/event_ffi.cmi test/event_ffi.cmj test/exception_alias.cmi test/exception_alias.cmj test/exception_raise_test.cmi test/exception_raise_test.cmj test/exception_rebound_err_test.cmi test/exception_rebound_err_test.cmj test/exception_value_test.cmi test/exception_value_test.cmj test/exponentiation_precedence_test.cmi test/exponentiation_precedence_test.cmj test/export_keyword.cmi test/export_keyword.cmj test/ext_array_test.cmi test/ext_array_test.cmj test/ext_bytes_test.cmi test/ext_bytes_test.cmj test/ext_filename_test.cmi test/ext_filename_test.cmj test/ext_list_test.cmi test/ext_list_test.cmj test/ext_pervasives_test.cmi test/ext_pervasives_test.cmj test/ext_string_test.cmi test/ext_string_test.cmj test/ext_sys_test.cmi test/ext_sys_test.cmj test/extensible_variant_test.cmi test/extensible_variant_test.cmj test/external_polyfill_test.cmi test/external_polyfill_test.cmj test/external_ppx.cmi test/external_ppx.cmj test/external_ppx2.cmi test/external_ppx2.cmj test/fail_comp.cmi test/fail_comp.cmj test/ffi_arity_test.cmi test/ffi_arity_test.cmj test/ffi_array_test.cmi test/ffi_array_test.cmj test/ffi_js_test.cmi test/ffi_js_test.cmj test/ffi_splice_test.cmi test/ffi_splice_test.cmj test/ffi_test.cmi test/ffi_test.cmj test/fib.cmi test/fib.cmj test/flattern_order_test.cmi test/flattern_order_test.cmj test/flexible_array_test.cmi test/flexible_array_test.cmj test/float_array.cmi test/float_array.cmj test/float_of_bits_test.cmi test/float_of_bits_test.cmj test/float_record.cmi test/float_record.cmj test/float_test.cmi test/float_test.cmj test/floatarray_test.cmi test/floatarray_test.cmj test/for_loop_test.cmi test/for_loop_test.cmj test/for_side_effect_test.cmi test/for_side_effect_test.cmj test/format_regression.cmi test/format_regression.cmj test/format_test.cmi test/format_test.cmj test/fun_pattern_match.cmi test/fun_pattern_match.cmj test/function_directives.cmi test/function_directives.cmj test/function_directives_no_inline.cmi test/function_directives_no_inline.cmj test/functor_app_test.cmi test/functor_app_test.cmj test/functor_def.cmi test/functor_def.cmj test/functor_ffi.cmi test/functor_ffi.cmj test/functor_inst.cmi test/functor_inst.cmj test/functors.cmi test/functors.cmj test/gbk.cmi test/gbk.cmj test/genlex_test.cmi test/genlex_test.cmj test/gentTypeReTest.cmi test/gentTypeReTest.cmj test/global_exception_regression_test.cmi test/global_exception_regression_test.cmj test/global_mangles.cmi test/global_mangles.cmj test/global_module_alias_test.cmi test/global_module_alias_test.cmj test/gpr496_test.cmi test/gpr496_test.cmj test/gpr_1072.cmi test/gpr_1072.cmj test/gpr_1072_reg.cmi test/gpr_1072_reg.cmj test/gpr_1150.cmi test/gpr_1150.cmj test/gpr_1154_test.cmi test/gpr_1154_test.cmj test/gpr_1170.cmi test/gpr_1170.cmj test/gpr_1240_missing_unbox.cmi test/gpr_1240_missing_unbox.cmj test/gpr_1245_test.cmi test/gpr_1245_test.cmj test/gpr_1268.cmi test/gpr_1268.cmj test/gpr_1409_test.cmi test/gpr_1409_test.cmj test/gpr_1423_app_test.cmi test/gpr_1423_app_test.cmj test/gpr_1423_nav.cmi test/gpr_1423_nav.cmj test/gpr_1438.cmi test/gpr_1438.cmj test/gpr_1481.cmi test/gpr_1481.cmj test/gpr_1484.cmi test/gpr_1484.cmj test/gpr_1503_test.cmi test/gpr_1503_test.cmj test/gpr_1539_test.cmi test/gpr_1539_test.cmj test/gpr_1658_test.cmi test/gpr_1658_test.cmj test/gpr_1667_test.cmi test/gpr_1667_test.cmj test/gpr_1692_test.cmi test/gpr_1692_test.cmj test/gpr_1698_test.cmi test/gpr_1698_test.cmj test/gpr_1701_test.cmi test/gpr_1701_test.cmj test/gpr_1716_test.cmi test/gpr_1716_test.cmj test/gpr_1717_test.cmi test/gpr_1717_test.cmj test/gpr_1728_test.cmi test/gpr_1728_test.cmj test/gpr_1749_test.cmi test/gpr_1749_test.cmj test/gpr_1759_test.cmi test/gpr_1759_test.cmj test/gpr_1760_test.cmi test/gpr_1760_test.cmj test/gpr_1762_test.cmi test/gpr_1762_test.cmj test/gpr_1817_test.cmi test/gpr_1817_test.cmj test/gpr_1822_test.cmi test/gpr_1822_test.cmj test/gpr_1891_test.cmi test/gpr_1891_test.cmj test/gpr_1943_test.cmi test/gpr_1943_test.cmj test/gpr_1946_test.cmi test/gpr_1946_test.cmj test/gpr_2316_test.cmi test/gpr_2316_test.cmj test/gpr_2352_test.cmi test/gpr_2352_test.cmj test/gpr_2413_test.cmi test/gpr_2413_test.cmj test/gpr_2474.cmi test/gpr_2474.cmj test/gpr_2487.cmi test/gpr_2487.cmj test/gpr_2503_test.cmi test/gpr_2503_test.cmj test/gpr_2608_test.cmi test/gpr_2608_test.cmj test/gpr_2614_test.cmi test/gpr_2614_test.cmj test/gpr_2633_test.cmi test/gpr_2633_test.cmj test/gpr_2642_test.cmi test/gpr_2642_test.cmj test/gpr_2682_test.cmi test/gpr_2682_test.cmj test/gpr_2700_test.cmi test/gpr_2700_test.cmj test/gpr_2731_test.cmi test/gpr_2731_test.cmj test/gpr_2789_test.cmi test/gpr_2789_test.cmj test/gpr_2931_test.cmi test/gpr_2931_test.cmj test/gpr_3142_test.cmi test/gpr_3142_test.cmj test/gpr_3154_test.cmi test/gpr_3154_test.cmj test/gpr_3209_test.cmi test/gpr_3209_test.cmj test/gpr_3492_test.cmi test/gpr_3492_test.cmj test/gpr_3519_jsx_test.cmi test/gpr_3519_jsx_test.cmj test/gpr_3519_test.cmi test/gpr_3519_test.cmj test/gpr_3536_test.cmi test/gpr_3536_test.cmj test/gpr_3546_test.cmi test/gpr_3546_test.cmj test/gpr_3548_test.cmi test/gpr_3548_test.cmj test/gpr_3549_test.cmi test/gpr_3549_test.cmj test/gpr_3566_drive_test.cmi test/gpr_3566_drive_test.cmj test/gpr_3566_test.cmi test/gpr_3566_test.cmj test/gpr_3595_test.cmi test/gpr_3595_test.cmj test/gpr_3609_test.cmi test/gpr_3609_test.cmj test/gpr_3697_test.cmi test/gpr_3697_test.cmj test/gpr_373_test.cmi test/gpr_373_test.cmj test/gpr_3770_test.cmi test/gpr_3770_test.cmj test/gpr_3852_alias.cmi test/gpr_3852_alias.cmj test/gpr_3852_alias_reify.cmi test/gpr_3852_alias_reify.cmj test/gpr_3852_effect.cmi test/gpr_3852_effect.cmj test/gpr_3865.cmi test/gpr_3865.cmj test/gpr_3865_bar.cmi test/gpr_3865_bar.cmj test/gpr_3865_foo.cmi test/gpr_3865_foo.cmj test/gpr_3875_test.cmi test/gpr_3875_test.cmj test/gpr_3877_test.cmi test/gpr_3877_test.cmj test/gpr_3895_test.cmi test/gpr_3895_test.cmj test/gpr_3897_test.cmi test/gpr_3897_test.cmj test/gpr_3931_test.cmi test/gpr_3931_test.cmj test/gpr_3980_test.cmi test/gpr_3980_test.cmj test/gpr_4025_test.cmi test/gpr_4025_test.cmj test/gpr_405_test.cmi test/gpr_405_test.cmj test/gpr_4069_test.cmi test/gpr_4069_test.cmj test/gpr_4265_test.cmi test/gpr_4265_test.cmj test/gpr_4274_test.cmi test/gpr_4274_test.cmj test/gpr_4280_test.cmi test/gpr_4280_test.cmj test/gpr_4407_test.cmi test/gpr_4407_test.cmj test/gpr_441.cmi test/gpr_441.cmj test/gpr_4442_test.cmi test/gpr_4442_test.cmj test/gpr_4491_test.cmi test/gpr_4491_test.cmj test/gpr_4494_test.cmi test/gpr_4494_test.cmj test/gpr_4519_test.cmi test/gpr_4519_test.cmj test/gpr_459_test.cmi test/gpr_459_test.cmj test/gpr_4632.cmi test/gpr_4632.cmj test/gpr_4639_test.cmi test/gpr_4639_test.cmj test/gpr_4900_test.cmi test/gpr_4900_test.cmj test/gpr_4924_test.cmi test/gpr_4924_test.cmj test/gpr_4931.cmi test/gpr_4931.cmj test/gpr_4931_allow.cmi test/gpr_4931_allow.cmj test/gpr_5071_test.cmi test/gpr_5071_test.cmj test/gpr_5169_test.cmi test/gpr_5169_test.cmj test/gpr_5218_test.cmi test/gpr_5218_test.cmj test/gpr_5280_optimize_test.cmi test/gpr_5280_optimize_test.cmj test/gpr_5312.cmi test/gpr_5312.cmj test/gpr_5557.cmi test/gpr_5557.cmj test/gpr_5753.cmi test/gpr_5753.cmj test/gpr_658.cmi test/gpr_658.cmj test/gpr_858_test.cmi test/gpr_858_test.cmj test/gpr_858_unit2_test.cmi test/gpr_858_unit2_test.cmj test/gpr_904_test.cmi test/gpr_904_test.cmj test/gpr_974_test.cmi test/gpr_974_test.cmj test/gpr_977_test.cmi test/gpr_977_test.cmj test/gpr_return_type_unused_attribute.cmi test/gpr_return_type_unused_attribute.cmj test/gray_code_test.cmi test/gray_code_test.cmj test/guide_for_ext.cmi test/guide_for_ext.cmj test/hash_collision_test.cmi test/hash_collision_test.cmj test/hash_sugar_desugar.cmi test/hash_sugar_desugar.cmj test/hash_test.cmi test/hash_test.cmj test/hashtbl_test.cmi test/hashtbl_test.cmj test/hello.foo.cmi test/hello.foo.cmj test/hello_res.cmi test/hello_res.cmj test/ignore_test.cmi test/ignore_test.cmj test/imm_map_bench.cmi test/imm_map_bench.cmj test/import2.cmi test/import2.cmj test/import_external.cmi test/import_external.cmj test/import_side_effect.cmi test/import_side_effect.cmj test/import_side_effect_free.cmi test/import_side_effect_free.cmj test/include_side_effect.cmi test/include_side_effect.cmj test/include_side_effect_free.cmi test/include_side_effect_free.cmj test/incomplete_toplevel_test.cmi test/incomplete_toplevel_test.cmj test/infer_type_test.cmi test/infer_type_test.cmj test/inline_condition_with_pattern_matching.cmi test/inline_condition_with_pattern_matching.cmj test/inline_const.cmi test/inline_const.cmj test/inline_const_test.cmi test/inline_const_test.cmj test/inline_edge_cases.cmi test/inline_edge_cases.cmj test/inline_map2_test.cmi test/inline_map2_test.cmj test/inline_map_demo.cmi test/inline_map_demo.cmj test/inline_map_test.cmi test/inline_map_test.cmj test/inline_record_test.cmi test/inline_record_test.cmj test/inline_regression_test.cmi test/inline_regression_test.cmj test/inline_string_test.cmi test/inline_string_test.cmj test/inner_call.cmi test/inner_call.cmj test/inner_define.cmi test/inner_define.cmj test/inner_unused.cmi test/inner_unused.cmj test/installation_test.cmi test/installation_test.cmj test/int32_test.cmi test/int32_test.cmj test/int64_mul_div_test.cmi test/int64_mul_div_test.cmj test/int64_string_bench.cmi test/int64_string_bench.cmj test/int64_string_test.cmi test/int64_string_test.cmj test/int64_test.cmi test/int64_test.cmj test/int_map.cmi test/int_map.cmj test/int_overflow_test.cmi test/int_overflow_test.cmj test/int_poly_var.cmi test/int_poly_var.cmj test/int_switch_test.cmi test/int_switch_test.cmj test/internal_unused_test.cmi test/internal_unused_test.cmj test/io_test.cmi test/io_test.cmj test/js_array_test.cmi test/js_array_test.cmj test/js_bool_test.cmi test/js_bool_test.cmj test/js_cast_test.cmi test/js_cast_test.cmj test/js_date_test.cmi test/js_date_test.cmj test/js_dict_test.cmi test/js_dict_test.cmj test/js_exception_catch_test.cmi test/js_exception_catch_test.cmj test/js_float_test.cmi test/js_float_test.cmj test/js_global_test.cmi test/js_global_test.cmj test/js_int_test.cmi test/js_int_test.cmj test/js_json_test.cmi test/js_json_test.cmj test/js_list_test.cmi test/js_list_test.cmj test/js_math_test.cmi test/js_math_test.cmj test/js_null_test.cmi test/js_null_test.cmj test/js_null_undefined_test.cmi test/js_null_undefined_test.cmj test/js_nullable_test.cmi test/js_nullable_test.cmj test/js_obj_test.cmi test/js_obj_test.cmj test/js_option_test.cmi test/js_option_test.cmj test/js_re_test.cmi test/js_re_test.cmj test/js_string_test.cmi test/js_string_test.cmj test/js_undefined_test.cmi test/js_undefined_test.cmj test/js_val.cmi test/js_val.cmj test/jsoo_400_test.cmi test/jsoo_400_test.cmj test/jsoo_485_test.cmi test/jsoo_485_test.cmj test/jsxv4_newtype.cmi test/jsxv4_newtype.cmj test/key_word_property.cmi test/key_word_property.cmj test/key_word_property2.cmi test/key_word_property2.cmj test/key_word_property_plus_test.cmi test/key_word_property_plus_test.cmj test/label_uncurry.cmi test/label_uncurry.cmj test/large_integer_pat.cmi test/large_integer_pat.cmj test/large_record_duplication_test.cmi test/large_record_duplication_test.cmj test/largest_int_flow.cmi test/largest_int_flow.cmj test/lazy_demo.cmi test/lazy_demo.cmj test/lazy_test.cmi test/lazy_test.cmj test/lib_js_test.cmi test/lib_js_test.cmj test/libarg_test.cmi test/libarg_test.cmj test/libqueue_test.cmi test/libqueue_test.cmj test/limits_test.cmi test/limits_test.cmj test/list_stack.cmi test/list_stack.cmj test/list_test.cmi test/list_test.cmj test/local_exception_test.cmi test/local_exception_test.cmj test/loop_regression_test.cmi test/loop_regression_test.cmj test/loop_suites_test.cmi test/loop_suites_test.cmj test/map_find_test.cmi test/map_find_test.cmj test/map_test.cmi test/map_test.cmj test/mario_game.cmi test/mario_game.cmj test/marshal.cmi test/marshal.cmj test/meth_annotation.cmi test/meth_annotation.cmj test/method_name_test.cmi test/method_name_test.cmj test/method_string_name.cmi test/method_string_name.cmj test/minimal_test.cmi test/minimal_test.cmj test/miss_colon_test.cmi test/miss_colon_test.cmj test/mock_mt.cmi test/mock_mt.cmj test/module_alias_test.cmi test/module_alias_test.cmj test/module_as_class_ffi.cmi test/module_as_class_ffi.cmj test/module_as_function.cmi test/module_as_function.cmj test/module_missing_conversion.cmi test/module_missing_conversion.cmj test/module_parameter_test.cmi test/module_parameter_test.cmj test/module_splice_test.cmi test/module_splice_test.cmj test/more_poly_variant_test.cmi test/more_poly_variant_test.cmj test/more_uncurry.cmi test/more_uncurry.cmj test/mpr_6033_test.cmi test/mpr_6033_test.cmj test/mt.cmi test/mt.cmj test/mt_global.cmi test/mt_global.cmj test/mutable_obj_test.cmi test/mutable_obj_test.cmj test/mutable_uncurry_test.cmi test/mutable_uncurry_test.cmj test/mutual_non_recursive_type.cmi test/mutual_non_recursive_type.cmj test/name_mangle_test.cmi test/name_mangle_test.cmj test/nested_include.cmi test/nested_include.cmj test/nested_module_alias.cmi test/nested_module_alias.cmj test/nested_obj_literal.cmi test/nested_obj_literal.cmj test/nested_obj_test.cmi test/nested_obj_test.cmj test/nested_pattern_match_test.cmi test/nested_pattern_match_test.cmj test/noassert.cmi test/noassert.cmj test/node_path_test.cmi test/node_path_test.cmj test/null_list_test.cmi test/null_list_test.cmj test/number_lexer.cmi test/number_lexer.cmj test/obj_literal_ppx.cmi test/obj_literal_ppx.cmj test/obj_literal_ppx_test.cmi test/obj_literal_ppx_test.cmj test/obj_magic_test.cmi test/obj_magic_test.cmj test/obj_type_test.cmi test/obj_type_test.cmj test/of_string_test.cmi test/of_string_test.cmj test/offset.cmi test/offset.cmj test/omit_trailing_undefined_in_external_calls.cmi test/omit_trailing_undefined_in_external_calls.cmj test/option_encoding_test.cmi test/option_encoding_test.cmj test/option_record_none_test.cmi test/option_record_none_test.cmj test/option_repr_test.cmi test/option_repr_test.cmj test/optional_ffi_test.cmi test/optional_ffi_test.cmj test/optional_regression_test.cmi test/optional_regression_test.cmj test/pipe_send_readline.cmi test/pipe_send_readline.cmj test/pipe_syntax.cmi test/pipe_syntax.cmj test/poly_empty_array.cmi test/poly_empty_array.cmj test/poly_variant_test.cmi test/poly_variant_test.cmj test/polymorphic_raw_test.cmi test/polymorphic_raw_test.cmj test/polymorphism_test.cmi test/polymorphism_test.cmj test/polyvar_convert.cmi test/polyvar_convert.cmj test/polyvar_test.cmi test/polyvar_test.cmj test/ppx_apply_test.cmi test/ppx_apply_test.cmj test/pq_test.cmi test/pq_test.cmj test/pr6726.cmi test/pr6726.cmj test/prepend_data_ffi.cmi test/prepend_data_ffi.cmj test/primitive_reg_test.cmi test/primitive_reg_test.cmj test/print_alpha_test.cmi test/print_alpha_test.cmj test/queue_402.cmi test/queue_402.cmj test/queue_test.cmi test/queue_test.cmj test/raw_hash_tbl_bench.cmi test/raw_hash_tbl_bench.cmj test/raw_output_test.cmi test/raw_output_test.cmj test/raw_pure_test.cmi test/raw_pure_test.cmj test/rbset.cmi test/rbset.cmj test/react.cmi test/react.cmj test/reactDOMRe.cmi test/reactDOMRe.cmj test/reactDOMServerRe.cmi test/reactDOMServerRe.cmj test/reactEvent.cmi test/reactEvent.cmj test/reactTestUtils.cmi test/reactTestUtils.cmj test/reasonReact.cmi test/reasonReact.cmj test/reasonReactOptimizedCreateClass.cmi test/reasonReactOptimizedCreateClass.cmj test/reasonReactRouter.cmi test/reasonReactRouter.cmj test/rebind_module.cmi test/rebind_module.cmj test/rebind_module_test.cmi test/rebind_module_test.cmj test/rec_array_test.cmi test/rec_array_test.cmj test/rec_fun_test.cmi test/rec_fun_test.cmj test/rec_module_opt.cmi test/rec_module_opt.cmj test/rec_module_test.cmi test/rec_module_test.cmj test/recmodule.cmi test/recmodule.cmj test/record_debug_test.cmi test/record_debug_test.cmj test/record_extension_test.cmi test/record_extension_test.cmj test/record_name_test.cmi test/record_name_test.cmj test/record_regression.cmi test/record_regression.cmj test/record_type_spread.cmi test/record_type_spread.cmj test/record_with_test.cmi test/record_with_test.cmj test/recursive_module.cmi test/recursive_module.cmj test/recursive_module_test.cmi test/recursive_module_test.cmj test/recursive_react_component.cmi test/recursive_react_component.cmj test/recursive_records_test.cmi test/recursive_records_test.cmj test/recursive_unbound_module_test.cmi test/recursive_unbound_module_test.cmj test/regression_print.cmi test/regression_print.cmj test/relative_path.cmi test/relative_path.cmj test/res_debug.cmi test/res_debug.cmj test/return_check.cmi test/return_check.cmj test/runtime_encoding_test.cmi test/runtime_encoding_test.cmj test/set_annotation.cmi test/set_annotation.cmj test/set_gen.cmi test/set_gen.cmj test/side_effect.cmi test/side_effect.cmj test/side_effect2.cmi test/side_effect2.cmj test/side_effect_free.cmi test/side_effect_free.cmj test/simplify_lambda_632o.cmi test/simplify_lambda_632o.cmj test/single_module_alias.cmi test/single_module_alias.cmj test/singular_unit_test.cmi test/singular_unit_test.cmj test/small_inline_test.cmi test/small_inline_test.cmj test/splice_test.cmi test/splice_test.cmj test/stack_comp_test.cmi test/stack_comp_test.cmj test/stack_test.cmi test/stack_test.cmj test/stream_parser_test.cmi test/stream_parser_test.cmj test/string_bound_get_test.cmi test/string_bound_get_test.cmj test/string_constant_compare.cmi test/string_constant_compare.cmj test/string_get_set_test.cmi test/string_get_set_test.cmj test/string_runtime_test.cmi test/string_runtime_test.cmj test/string_set.cmi test/string_set.cmj test/string_set_test.cmi test/string_set_test.cmj test/string_test.cmi test/string_test.cmj test/string_unicode_test.cmi test/string_unicode_test.cmj test/stringmatch_test.cmi test/stringmatch_test.cmj test/submodule.cmi test/submodule.cmj test/submodule_call.cmi test/submodule_call.cmj test/switch_case_test.cmi test/switch_case_test.cmj test/switch_string.cmi test/switch_string.cmj test/tagged_template_test.cmi test/tagged_template_test.cmj test/tailcall_inline_test.cmi test/tailcall_inline_test.cmj test/template.cmi test/template.cmj test/test.cmi test/test.cmj test/test2.cmi test/test2.cmj test/test_alias.cmi test/test_alias.cmj test/test_ari.cmi test/test_ari.cmj test/test_array.cmi test/test_array.cmj test/test_array_append.cmi test/test_array_append.cmj test/test_array_primitive.cmi test/test_array_primitive.cmj test/test_bool_equal.cmi test/test_bool_equal.cmj test/test_bs_this.cmi test/test_bs_this.cmj test/test_bug.cmi test/test_bug.cmj test/test_bytes.cmi test/test_bytes.cmj test/test_case_opt_collision.cmi test/test_case_opt_collision.cmj test/test_case_set.cmi test/test_case_set.cmj test/test_char.cmi test/test_char.cmj test/test_closure.cmi test/test_closure.cmj test/test_common.cmi test/test_common.cmj test/test_const_elim.cmi test/test_const_elim.cmj test/test_const_propogate.cmi test/test_const_propogate.cmj test/test_cpp.cmi test/test_cpp.cmj test/test_cps.cmi test/test_cps.cmj test/test_demo.cmi test/test_demo.cmj test/test_dup_param.cmi test/test_dup_param.cmj test/test_eq.cmi test/test_eq.cmj test/test_exception.cmi test/test_exception.cmj test/test_exception_escape.cmi test/test_exception_escape.cmj test/test_export2.cmi test/test_export2.cmj test/test_external.cmi test/test_external.cmj test/test_external_unit.cmi test/test_external_unit.cmj test/test_ffi.cmi test/test_ffi.cmj test/test_fib.cmi test/test_fib.cmj test/test_filename.cmi test/test_filename.cmj test/test_for_loop.cmi test/test_for_loop.cmj test/test_for_map.cmi test/test_for_map.cmj test/test_for_map2.cmi test/test_for_map2.cmj test/test_format.cmi test/test_format.cmj test/test_formatter.cmi test/test_formatter.cmj test/test_functor_dead_code.cmi test/test_functor_dead_code.cmj test/test_generative_module.cmi test/test_generative_module.cmj test/test_global_print.cmi test/test_global_print.cmj test/test_include.cmi test/test_include.cmj test/test_incomplete.cmi test/test_incomplete.cmj test/test_incr_ref.cmi test/test_incr_ref.cmj test/test_int_map_find.cmi test/test_int_map_find.cmj test/test_internalOO.cmi test/test_internalOO.cmj test/test_is_js.cmi test/test_is_js.cmj test/test_js_ffi.cmi test/test_js_ffi.cmj test/test_let.cmi test/test_let.cmj test/test_list.cmi test/test_list.cmj test/test_literal.cmi test/test_literal.cmj test/test_literals.cmi test/test_literals.cmj test/test_match_exception.cmi test/test_match_exception.cmj test/test_mutliple.cmi test/test_mutliple.cmj test/test_nat64.cmi test/test_nat64.cmj test/test_nested_let.cmi test/test_nested_let.cmj test/test_nested_print.cmi test/test_nested_print.cmj test/test_non_export.cmi test/test_non_export.cmj test/test_nullary.cmi test/test_nullary.cmj test/test_obj.cmi test/test_obj.cmj test/test_order.cmi test/test_order.cmj test/test_order_tailcall.cmi test/test_order_tailcall.cmj test/test_other_exn.cmi test/test_other_exn.cmj test/test_pack.cmi test/test_pack.cmj test/test_per.cmi test/test_per.cmj test/test_pervasive.cmi test/test_pervasive.cmj test/test_pervasives2.cmi test/test_pervasives2.cmj test/test_pervasives3.cmi test/test_pervasives3.cmj test/test_primitive.cmi test/test_primitive.cmj test/test_ramification.cmi test/test_ramification.cmj test/test_react.cmi test/test_react.cmj test/test_react_case.cmi test/test_react_case.cmj test/test_regex.cmi test/test_regex.cmj test/test_runtime_encoding.cmi test/test_runtime_encoding.cmj test/test_scope.cmi test/test_scope.cmj test/test_seq.cmi test/test_seq.cmj test/test_set.cmi test/test_set.cmj test/test_side_effect_functor.cmi test/test_side_effect_functor.cmj test/test_simple_include.cmi test/test_simple_include.cmj test/test_simple_pattern_match.cmi test/test_simple_pattern_match.cmj test/test_simple_ref.cmi test/test_simple_ref.cmj test/test_simple_tailcall.cmi test/test_simple_tailcall.cmj test/test_small.cmi test/test_small.cmj test/test_sprintf.cmi test/test_sprintf.cmj test/test_stack.cmi test/test_stack.cmj test/test_static_catch_ident.cmi test/test_static_catch_ident.cmj test/test_string.cmi test/test_string.cmj test/test_string_case.cmi test/test_string_case.cmj test/test_string_const.cmi test/test_string_const.cmj test/test_string_map.cmi test/test_string_map.cmj test/test_string_switch.cmi test/test_string_switch.cmj test/test_switch.cmi test/test_switch.cmj test/test_trywith.cmi test/test_trywith.cmj test/test_tuple.cmi test/test_tuple.cmj test/test_tuple_destructring.cmi test/test_tuple_destructring.cmj test/test_type_based_arity.cmi test/test_type_based_arity.cmj test/test_u.cmi test/test_u.cmj test/test_unknown.cmi test/test_unknown.cmj test/test_unsafe_cmp.cmi test/test_unsafe_cmp.cmj test/test_unsafe_obj_ffi.cmi test/test_unsafe_obj_ffi.cmj test/test_unsafe_obj_ffi_ppx.cmi test/test_unsafe_obj_ffi_ppx.cmj test/test_unsupported_primitive.cmi test/test_unsupported_primitive.cmj test/test_while_closure.cmi test/test_while_closure.cmj test/test_while_side_effect.cmi test/test_while_side_effect.cmj test/test_zero_nullable.cmi test/test_zero_nullable.cmj test/then_mangle_test.cmi test/then_mangle_test.cmj test/ticker.cmi test/ticker.cmj test/to_string_test.cmi test/to_string_test.cmj test/topsort_test.cmi test/topsort_test.cmj test/tramp_fib.cmi test/tramp_fib.cmj test/tuple_alloc.cmi test/tuple_alloc.cmj test/type_disambiguate.cmi test/type_disambiguate.cmj test/typeof_test.cmi test/typeof_test.cmj test/unboxed_attribute.cmi test/unboxed_attribute.cmj test/unboxed_attribute_test.cmi test/unboxed_attribute_test.cmj test/unboxed_crash.cmi test/unboxed_crash.cmj test/unboxed_use_case.cmi test/unboxed_use_case.cmj test/uncurried_cast.cmi test/uncurried_cast.cmj test/uncurried_default.args.cmi test/uncurried_default.args.cmj test/uncurried_pipe.cmi test/uncurried_pipe.cmj test/uncurry_external_test.cmi test/uncurry_external_test.cmj test/uncurry_glob_test.cmi test/uncurry_glob_test.cmj test/uncurry_test.cmi test/uncurry_test.cmj test/undef_regression2_test.cmi test/undef_regression2_test.cmj test/undef_regression_test.cmi test/undef_regression_test.cmj test/undefine_conditional.cmi test/undefine_conditional.cmj test/unicode_type_error.cmi test/unicode_type_error.cmj test/unit_undefined_test.cmi test/unit_undefined_test.cmj test/unitest_string.cmi test/unitest_string.cmj test/unsafe_full_apply_primitive.cmi test/unsafe_full_apply_primitive.cmj test/unsafe_ppx_test.cmi test/unsafe_ppx_test.cmj test/update_record_test.cmi test/update_record_test.cmj test/variant.cmi test/variant.cmj test/variantsMatching.cmi test/variantsMatching.cmj test/webpack_config.cmi test/webpack_config.cmj 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_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 deleted file mode 100644 index 6030a74115..0000000000 --- a/jscomp/test/caml_format_test.js +++ /dev/null @@ -1,482 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -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 of_string = [ - [ - 0, - "0" - ], - [ - 3, - "03" - ], - [ - -3, - "-03" - ], - [ - -63, - "-0x3f" - ], - [ - -31, - "-0x1f" - ], - [ - 47, - "0X2f" - ], - [ - 11, - "0O13" - ], - [ - 8, - "0o10" - ], - [ - 3, - "0b11" - ], - [ - 1, - "0b01" - ], - [ - 0, - "0b00" - ], - [ - -3, - "-0b11" - ], - [ - -5, - "-0B101" - ], - [ - 332, - "0332" - ], - [ - -32, - "-32" - ], - [ - 1, - "-0xffff_ffff" - ], - [ - -1, - "0xffff_ffff" - ] -]; - -function from_float_of_string(xs) { - return $$Array.mapi((function (i, param) { - return Pervasives.string_of_float; - }), xs); -} - -function from_of_string(xs) { - return $$Array.to_list($$Array.mapi((function (i, param) { - let b = param[1]; - let a = param[0]; - return [ - "of_string " + String(i), - (function (param) { - return { - TAG: "Eq", - _0: Caml_format.int_of_string(b), - _1: a - }; - }) - ]; - }), of_string)); -} - -let to_str = Caml_format.int_of_string; - -let pairs = [ - [ - "FP_infinite", - "infinity" - ], - [ - "FP_infinite", - "+infinity" - ], - [ - "FP_infinite", - "-infinity" - ], - [ - "FP_zero", - "0" - ], - [ - "FP_zero", - "0." - ] -]; - -let pairs$1 = [ - [ - 3232, - "32_32.0" - ], - [ - 1.000, - "1.000" - ], - [ - 12.000, - "12.000" - ] -]; - -let suites = Pervasives.$at(from_of_string(of_string), Pervasives.$at({ - hd: [ - "isnan_of_string", - (function (param) { - return { - TAG: "Eq", - _0: true, - _1: Pervasives.classify_float(Caml_format.float_of_string("nan")) === "FP_nan" - }; - }) - ], - tl: /* [] */0 -}, Pervasives.$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) { - return { - TAG: "Eq", - _0: a, - _1: Pervasives.classify_float(Caml_format.float_of_string(b)) - }; - }) - ]; -}), pairs)), Pervasives.$at({ - hd: [ - "throw", - (function (param) { - return { - TAG: "ThrowAny", - _0: (function (param) { - Caml_format.float_of_string(""); - }) - }; - }) - ], - tl: { - hd: [ - "format_int", - (function (param) { - return { - TAG: "Eq", - _0: " 33", - _1: Caml_format.format_int("%32d", 33) - }; - }) - ], - tl: /* [] */0 - } -}, $$Array.to_list($$Array.mapi((function (i, param) { - let b = param[1]; - let a = param[0]; - return [ - "normal_float_of_string " + String(i), - (function (param) { - return { - TAG: "Eq", - _0: a, - _1: Caml_format.float_of_string(b) - }; - }) - ]; -}), pairs$1)))))); - -function ff(param) { - return Caml_format.format_int("%32d", param); -} - -let float_data = [ - [ - "%f", - 32, - "32.000000" - ], - [ - "%f", - Number.NaN, - "nan" - ], - [ - "%f", - Pervasives.infinity, - "inf" - ], - [ - "%f", - Pervasives.neg_infinity, - "-inf" - ], - [ - "%1.e", - 13000, - "1e+04" - ], - [ - "%1.3e", - 2.3e-05, - "2.300e-05" - ], - [ - "%3.10e", - 3e+56, - "3.0000000000e+56" - ], - [ - "%3.10f", - 20000000000, - "20000000000.0000000000" - ], - [ - "%3.3f", - -3300, - "-3300.000" - ], - [ - "%1.g", - 13000, - "1e+04" - ], - [ - "%1.3g", - 2.3e-05, - "2.3e-05" - ], - [ - "%3.10g", - 3e+56, - "3e+56" - ], - [ - "%3.10g", - 20000000000, - "2e+10" - ], - [ - "%3.3g", - -3300, - "-3.3e+03" - ], - [ - "%3.3g", - -0.0033, - "-0.0033" - ], - [ - "%3.10g", - 30000000000, - "3e+10" - ], - [ - "%3.0g", - 30000000000, - "3e+10" - ], - [ - "%3.g", - 30000000000, - "3e+10" - ], - [ - "%3.g", - 3, - " 3" - ], - [ - "%1.1g", - 2.1, - "2" - ], - [ - "%1.2g", - 2.1, - "2.1" - ] -]; - -let int64_suites_0 = [ - "i64_simple7", - (function (param) { - return { - TAG: "Eq", - _0: Caml_int64.to_string([ - 0, - 3333 - ]), - _1: "3333" - }; - }) -]; - -let int64_suites_1 = { - hd: [ - "i64_simple15", - (function (param) { - return { - TAG: "Eq", - _0: Caml_int64.to_string(Caml_int64.neg_one), - _1: "-1" - }; - }) - ], - tl: { - hd: [ - "i64_simple16", - (function (param) { - return { - TAG: "Eq", - _0: Caml_int64.to_string([ - -1, - 4294956185 - ]), - _1: "-11111" - }; - }) - ], - tl: /* [] */0 - } -}; - -let int64_suites = { - hd: int64_suites_0, - tl: int64_suites_1 -}; - -let of_string_data = [ - [ - Caml_int64.zero, - "0" - ], - [ - [ - 0, - 3 - ], - "3" - ], - [ - [ - 0, - 33 - ], - "33" - ], - [ - [ - 0, - 333 - ], - "33_3" - ], - [ - [ - 0, - 33333 - ], - "33_33_3" - ], - [ - [ - 77, - 2620851541 - ], - "333333333333" - ], - [ - Caml_int64.neg_one, - "0xffff_ffff_ffff_ffff" - ], - [ - [ - 0, - 113 - ], - "0b01110001" - ], - [ - Caml_int64.one, - "-0xffff_ffff_ffff_ffff" - ] -]; - -Mt.from_pair_suites("Caml_format_test", Pervasives.$at(suites, Pervasives.$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) { - return { - TAG: "Eq", - _0: Caml_format.format_float(fmt, f), - _1: str_result - }; - }) - ]; -}), float_data)), Pervasives.$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) { - return { - TAG: "Eq", - _0: Caml_format.int64_of_string(b), - _1: a - }; - }) - ]; -}), of_string_data)))))); - -let float_suites = { - hd: "float_nan", - tl: /* [] */0 -}; - -let hh = [ - 214748364, - 3435973836 -]; - -let hhh = [ - 268435456, - 0 -]; - -exports.of_string = of_string; -exports.from_float_of_string = from_float_of_string; -exports.from_of_string = from_of_string; -exports.to_str = to_str; -exports.suites = suites; -exports.ff = ff; -exports.float_data = float_data; -exports.float_suites = float_suites; -exports.int64_suites = int64_suites; -exports.hh = hh; -exports.hhh = hhh; -exports.of_string_data = of_string_data; -/* suites Not a pure module */ diff --git a/jscomp/test/caml_format_test.res b/jscomp/test/caml_format_test.res deleted file mode 100644 index b69981df68..0000000000 --- a/jscomp/test/caml_format_test.res +++ /dev/null @@ -1,167 +0,0 @@ -@@warning("-107") - -let of_string = [ - (0, "0"), - (3, "03"), - (-3, "-03"), - (-63, "-0x3f"), - (-31, "-0x1f"), - (47, "0X2f"), - (11, "0O13"), - (8, "0o10"), - (3, "0b11"), - (1, "0b01"), - (0, "0b00"), - (-3, "-0b11"), - (-5, "-0B101"), - (332, "0332"), - (-32, "-32"), - (-4294967295, "-0xffff_ffff"), - (-1, "0xffff_ffff"), -] - -/* let float_of_string = */ -/* [| "nan", nan ; */ -/* "infinity", infinity; */ -/* "0.", 0. */ -/* |] */ - -let from_float_of_string = xs => xs |> Array.mapi((i, (a, b)) => string_of_float) - -let from_of_string = xs => - of_string - |> Array.mapi((i, (a, b)) => (`of_string ${string_of_int(i)}`, _ => Mt.Eq(int_of_string(b), a))) - |> Array.to_list - -let to_str = s => int_of_string(s) - -external format_int: (string, int) => string = "?format_int" - -let suites: Mt.pair_suites = \"@"( - from_of_string(of_string), - \"@"( - list{("isnan_of_string", _ => Mt.Eq(true, classify_float(float_of_string("nan")) == FP_nan))}, - \"@"( - { - let pairs = [ - (FP_infinite, "infinity"), - (FP_infinite, "+infinity"), - (FP_infinite, "-infinity"), - (FP_zero, "0"), - (FP_zero, "0."), - ] - - pairs - |> Array.mapi((i, (a, b)) => ( - `infinity_of_string ${string_of_int(i)}`, - _ => Mt.Eq(a, \"@@"(classify_float, float_of_string(b))), - )) - |> Array.to_list - }, - \"@"( - list{ - ("throw", _ => Mt.ThrowAny(_ => \"@@"(ignore, float_of_string("")))), - ("format_int", _ => Mt.Eq(" 33", format_int("%32d", 33))), - }, - { - let pairs = [(3232., "32_32.0"), (1.000, "1.000"), (12.000, "12.000")] - - pairs - |> Array.mapi((i, (a, b)) => ( - `normal_float_of_string ${string_of_int(i)}`, - _ => Mt.Eq(a, float_of_string(b)), - )) - |> Array.to_list - }, - ), - ), - ), -) - -let ff = format_int("%32d") - -external format_float: (string, float) => string = "?format_float" - -/* ("%3.10f", 3e+56, */ -/* "300000000000000005792779041490073052596128503513888063488.0000000000"); */ - -let float_data = [ - ("%f", 32., "32.000000"), - ("%f", nan, "nan"), - ("%f", infinity, "inf"), - ("%f", neg_infinity, "-inf"), - ("%1.e", 13000., "1e+04"), - ("%1.3e", 2.3e-05, "2.300e-05"), - ("%3.10e", 3e+56, "3.0000000000e+56"), - ("%3.10f", 20000000000., "20000000000.0000000000"), - ("%3.3f", -3300., "-3300.000"), - ("%1.g", 13000., "1e+04"), - ("%1.3g", 2.3e-05, "2.3e-05"), - ("%3.10g", 3e+56, "3e+56"), - ("%3.10g", 20000000000., "2e+10"), - ("%3.3g", -3300., "-3.3e+03"), - ("%3.3g", -0.0033, "-0.0033"), - ("%3.10g", 30000000000., "3e+10"), - ("%3.0g", 30000000000., "3e+10"), - ("%3.g", 30000000000., "3e+10"), - ("%3.g", 3., " 3"), - ("%1.1g", 2.1, "2"), - ("%1.2g", 2.1, "2.1"), -] - -let float_suites = { - open Mt - list{"float_nan"} -} - -/* module Mt = Mock_mt */ - -let int64_suites = { - open Mt - list{ - ("i64_simple7", _ => Eq(Int64.to_string(3333L), "3333")), - ("i64_simple15", _ => Eq(Int64.to_string(-1L), "-1")), - ("i64_simple16", _ => Eq(Int64.to_string(-11111L), "-11111")), - } -} - -let hh = 922337203685477580L /* 2 ^ 63 / 10 */ -let hhh = 1152921504606846976L -let of_string_data = [ - (0L, "0"), - (3L, "3"), - (33L, "33"), - (333L, "33_3"), - (33333L, "33_33_3"), - (333333333333L, "333333333333"), - (-1L, "0xffff_ffff_ffff_ffff"), - (113L, "0b01110001"), - (1L, "-0xffff_ffff_ffff_ffff"), -] - -/* module Mt = Mock_mt */ - -let () = \"@@"( - Mt.from_pair_suites(__MODULE__), - \"@"( - suites, - \"@"( - Array.mapi( - (i, (fmt, f, str_result)) => ( - `loat_format ${string_of_int(i)}`, - _ => Mt.Eq(format_float(fmt, f), str_result), - ), - float_data, - ) |> Array.to_list, - \"@"( - int64_suites, - of_string_data - |> Array.mapi((i, (a, b)) => ( - `int64_of_string ${string_of_int(i)} `, - _ => Mt.Eq(Int64.of_string(b), a), - )) - |> Array.to_list, - ), - ), - ), -) 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 12d568fe57..ed0e2c037b 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/chn_test.res b/jscomp/test/chn_test.res index 65dc5666b0..76078883d0 100644 --- a/jscomp/test/chn_test.res +++ b/jscomp/test/chn_test.res @@ -12,7 +12,7 @@ Js.log(`你好, Js.log(`\x3f\u003f\b\t\n\v\f\r\0"'`) let convert = (s: string): list => - Js_array2.fromMap(Js_string.castToArrayLike(s), x => + Js_array2.fromMap(Js_string2.castToArrayLike(s), x => switch Js_string2.codePointAt(x, 0) { | None => assert(false) | Some(x) => 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/coercion_module_alias_test.res b/jscomp/test/coercion_module_alias_test.res index e8356088a2..6578cf94e3 100644 --- a/jscomp/test/coercion_module_alias_test.res +++ b/jscomp/test/coercion_module_alias_test.res @@ -2,17 +2,17 @@ let l = Js.log module C = Char module C': module type of Char = C -\"@@"(l, C'.chr(66)) +l(C'.chr(66)) module C''': module type of C = C' /* fails */ module C'': module type of Char = C -\"@@"(l, C''.chr(66)) +l(C''.chr(66)) module C3 = { include Char } -\"@@"(l, C3.chr(66)) +l(C3.chr(66)) let f = x => { module M = { @@ -27,7 +27,7 @@ let g = x => { module F = (X: {}) => Char module C4 = F() -\"@@"(l, C4.chr(66)) +l(C4.chr(66)) module G = (X: {}) => X /* does not alias X */ module M = G() @@ -38,14 +38,14 @@ module M' = { } module N' = N } -\"@@"(l, M'.N'.x) +l(M'.N'.x) module M'': { module N': { let x: int } } = M' -\"@@"(l, M''.N'.x) +l(M''.N'.x) module M2 = { include M' } @@ -56,13 +56,13 @@ module M3: { } = { include M' } -\"@@"(l, M3.N'.x) +l(M3.N'.x) module M3': { module N': { let x: int } } = M2 -\"@@"(l, M3'.N'.x) +l(M3'.N'.x) module M4: { module N': { @@ -74,7 +74,7 @@ module M4: { } module N' = N } -\"@@"(l, M4.N'.x) +l(M4.N'.x) module F0 = (X: {}) => { module N = { @@ -89,7 +89,7 @@ module G0: (X: {}) => } } = F0 module M5 = G0() -\"@@"(l, M5.N'.x) +l(M5.N'.x) module M6 = { module D = { @@ -107,7 +107,7 @@ module M1: { } module N' = N } = M6 -\"@@"(l, M1.N'.x) +l(M1.N'.x) module M7: { module N': { let x: int @@ -118,10 +118,10 @@ module M7: { } module N' = N }) -\"@@"(l, M7.N'.x) +l(M7.N'.x) open M6 -\"@@"(l, N'.x) +l(N'.x) module M8 = { module C = Char @@ -133,7 +133,7 @@ module M9: { } module C' = C } = M8 -\"@@"(l, M9.C'.chr(66)) +l(M9.C'.chr(66)) module M10: { module C': { let chr: int => char @@ -144,4 +144,4 @@ module M10: { } module C' = C }) -\"@@"(l, M10.C'.chr(66)) +l(M10.C'.chr(66)) 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 b94f4305fa..a1b5eba93b 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 { RE_EXN_ID: "Invalid_argument", _1: "hi", 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 f6d09ba131..0eecb2b65e 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\" : }"); @@ -20,7 +20,7 @@ function test_js_error(param) { return e; } -function test_js_error2(param) { +function test_js_error2() { try { return JSON.parse(" {\"x\" : }"); } @@ -34,7 +34,7 @@ function test_js_error2(param) { } } -function example1(param) { +function example1() { let v; try { v = JSON.parse(" {\"x\" }"); @@ -50,7 +50,7 @@ function example1(param) { return v; } -function example2(param) { +function example2() { try { return JSON.parse(" {\"x\"}"); } diff --git a/jscomp/test/custom_error_test.res b/jscomp/test/custom_error_test.res index b99ee46fe2..01d137efdd 100644 --- a/jscomp/test/custom_error_test.res +++ b/jscomp/test/custom_error_test.res @@ -1,7 +1,7 @@ let test_js_error = () => switch Js.Json.parseExn(` {"x" : }`) { | exception Js.Exn.Error(err) => - \"@@"(Js.log, Js.Exn.stack(err)) + Js.log(Js.Exn.stack(err)) None | e => Some(e) } @@ -9,14 +9,14 @@ let test_js_error = () => let test_js_error2 = () => try Js.Json.parseExn(` {"x" : }`) catch { | Js.Exn.Error(err) as e => - \"@@"(Js.log, Js.Exn.stack(err)) + Js.log(Js.Exn.stack(err)) raise(e) } let example1 = () => switch Js.Json.parseExn(` {"x" }`) { | exception Js.Exn.Error(err) => - \"@@"(Js.log, Js.Exn.stack(err)) + Js.log(Js.Exn.stack(err)) None | v => Some(v) } 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/debugger_test.res b/jscomp/test/debugger_test.res index af0252e36d..b4081074f0 100644 --- a/jscomp/test/debugger_test.res +++ b/jscomp/test/debugger_test.res @@ -4,18 +4,18 @@ let f = (x, y) => { } let g = () => { - \"@@"(ignore, f(1, 2)) + ignore(f(1, 2)) %debugger - \"@@"(ignore, f(1, 2)) + ignore(f(1, 2)) %debugger 3 } let exterme_g = () => { - \"@@"(ignore, f(1, 2)) + ignore(f(1, 2)) let v = %debugger Js.log(v) - \"@@"(ignore, f(1, 2)) + ignore(f(1, 2)) %debugger 3 } diff --git a/jscomp/test/demo_int_map.js b/jscomp/test/demo_int_map.js index 0e8553c93c..0eb340eda8 100644 --- a/jscomp/test/demo_int_map.js +++ b/jscomp/test/demo_int_map.js @@ -150,7 +150,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_page.res b/jscomp/test/demo_page.res index f8b207f9cb..85737bfcba 100644 --- a/jscomp/test/demo_page.res +++ b/jscomp/test/demo_page.res @@ -5,7 +5,8 @@ let rec fib = x => | n => fib(n - 1) + fib(n - 2) } -/** Imperative style */ /** List map */ +/** Imperative style */ +/** List map */ let sum = n => { let v = ref(0) for i in 0 to n { @@ -27,7 +28,7 @@ let rec map = (f, x) => /** Test curry and uncurry calling convention */ let test_curry = (x, y) => x + y -let f = test_curry(32) +let f = test_curry(32, ...) /** Create a typed binding for react */ type t @@ -43,7 +44,8 @@ type component_class @obj /** make a json object */ external config: (~display_name: string=?, ~render: unit => component, unit) => config = "" -/** make a json object */ @obj +/** make a json object */ +@obj external attrs: (~alt: string=?, ~autoPlay: bool=?, unit) => attrs = "" external str: string => component = "%identity" 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/derive_projector_test.res b/jscomp/test/derive_projector_test.res index ef1e9bce0a..6079a14f63 100644 --- a/jscomp/test/derive_projector_test.res +++ b/jscomp/test/derive_projector_test.res @@ -15,7 +15,7 @@ and u = Hei and h = {d: d, h: list, u_X: int} @deriving({accessors: accessors}) and e = {d: d} -let v = \"@@"(d, {d: d_int(3)}) +let v = d({d: d_int(3)}) let g = u_X diff --git a/jscomp/test/digest_test.js b/jscomp/test/digest_test.js deleted file mode 100644 index 2ceaad6b71..0000000000 --- a/jscomp/test/digest_test.js +++ /dev/null @@ -1,234 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -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 Ext_array_test = require("./ext_array_test.js"); - -function f(x) { - return Digest.to_hex(Digest.string(x)); -} - -let ref = [ - "d41d8cd98f00b204e9800998ecf8427e", - "0cc175b9c0f1b6a831c399e269772661", - "4124bc0a9335c27f086f24ba207a4912", - "47bce5c74f589f4867dbd57e9ca9f808", - "74b87337454200d4d33f80c4663dc5e5", - "594f803b380a41396ed63dca39503542", - "0b4e7a0e5fe84ad35fb5f95b9ceeac79", - "5d793fc5b00a2348c3fb9ab59e5ca98a", - "3dbe00a167653a1aaee01d93e77e730e", - "552e6a97297c53e592208cf97fbb3b60", - "e09c80c42fda55f9d992e59ca6b3307d", - "d57f21e6a273781dbf8b7657940f3b03", - "45e4812014d83dde5666ebdf5a8ed1ed", - "c162de19c4c3731ca3428769d0cd593d", - "451599a5f9afa91a0f2097040a796f3d", - "12f9cf6998d52dbe773b06f848bb3608", - "23ca472302f49b3ea5592b146a312da0", - "88e42e96cc71151b6e1938a1699b0a27", - "2c60c24e7087e18e45055a33f9a5be91", - "639d76897485360b3147e66e0a8a3d6c", - "22d42eb002cefa81e9ad604ea57bc01d", - "bd049f221af82804c5a2826809337c9b", - "ff49cfac3968dbce26ebe7d4823e58bd", - "d95dbfee231e34cccb8c04444412ed7d", - "40edae4bad0e5bf6d6c2dc5615a86afb", - "a5a8bfa3962f49330227955e24a2e67c", - "ae791f19bdf77357ff10bb6b0e97e121", - "aaab9c59a88bf0bdfcb170546c5459d6", - "b0f0545856af1a340acdedce23c54b97", - "f7ce3d7d44f3342107d884bfa90c966a", - "59e794d45697b360e18ba972bada0123", - "3b0845db57c200be6052466f87b2198a", - "5eca9bd3eb07c006cd43ae48dfde7fd3", - "b4f13cb081e412f44e99742cb128a1a5", - "4c660346451b8cf91ef50f4634458d41", - "11db24dc3f6c2145701db08625dd6d76", - "80dad3aad8584778352c68ab06250327", - "1227fe415e79db47285cb2689c93963f", - "8e084f489f1bdf08c39f98ff6447ce6d", - "08b2f2b0864bac1ba1585043362cbec9", - "4697843037d962f62a5a429e611e0f5f", - "10c4da18575c092b486f8ab96c01c02f", - "af205d729450b663f48b11d839a1c8df", - "0d3f91798fac6ee279ec2485b25f1124", - "4c3c7c067634daec9716a80ea886d123", - "d1e358e6e3b707282cdd06e919f7e08c", - "8c6ded4f0af86e0a7e301f8a716c4363", - "4c2d8bcb02d982d7cb77f649c0a2dea8", - "bdb662f765cd310f2a547cab1cfecef6", - "08ff5f7301d30200ab89169f6afdb7af", - "6eb6a030bcce166534b95bc2ab45d9cf", - "1bb77918e5695c944be02c16ae29b25e", - "b6fe77c19f0f0f4946c761d62585bfea", - "e9e7e260dce84ffa6e0e7eb5fd9d37fc", - "eced9e0b81ef2bba605cbc5e2e76a1d0", - "ef1772b6dff9a122358552954ad0df65", - "3b0c8ac703f828b04c6c197006d17218", - "652b906d60af96844ebd21b674f35e93", - "dc2f2f2462a0d72358b2f99389458606", - "762fc2665994b217c52c3c2eb7d9f406", - "cc7ed669cf88f201c3297c6a91e1d18d", - "cced11f7bbbffea2f718903216643648", - "24612f0ce2c9d2cf2b022ef1e027a54f", - "b06521f39153d618550606be297466d5", - "014842d480b571495a4a0363793f7367", - "c743a45e0d2e6a95cb859adae0248435", - "def5d97e01e1219fb2fc8da6c4d6ba2f", - "92cb737f8687ccb93022fdb411a77cca", - "a0d1395c7fb36247bfe2d49376d9d133", - "ab75504250558b788f99d1ebd219abf2", - "0f5c6c4e740bfcc08c3c26ccb2673d46", - "cddd19bec7f310d8c87149ef47a1828f", - "96b39b8b95e016c79d104d83395b8133", - "f1fc0b14ff8fa674b02344577e23eeb1", - "0e8d28a1cafa3ffcff22afd480cce7d8", - "448539ffc17e1e81005b65581855cef4", - "61e39aae7c53e6e77db2e4405d9fb157", - "618a426895ee6133a372bebd1129b63e", - "046c90690c9e36578b9d4a7e1d249c75", - "aadab38075c43296ee7e12466ebb03e3", - "b15af9cdabbaea0516866a33d8fd0f98", - "986e6938ed767a8ae9530eef54bfe5f1", - "7ae25a72b71a42ccbc5477fd989cd512", - "98d34e50d4aa7a893cc7919a91acb0e3", - "3fc53fc22ea40f1a0afd78fc2cd9aa0f", - "923e37c738b9d7b1526f70b65229cc3d", - "b3966b7a08e5d46fd0774b797ba78dc2", - "f50c7286b540bb181db1d6e05a51a296", - "4efd6c8826e65a61f82af954d431b59b", - "ef1031e79e7a15a4470a5e98b23781b5", - "067876bfd0df0f4c5002780ec85e6f8c", - "789851dfa4c03563e9cef5f7bc050a7e", - "baf934720818ee49477e74fc644faa5e", - "9a0ea77ca26d2c121ddcc179edb76308", - "20c825561572e33d026f99ddfd999538", - "464c461455c5a927079a13609c20b637", - "cf37d42f89b6adb0e1a9e99104501b82", - "d266af45e3d06b70d9f52e2df4344186", - "f8b59fa22eb0ba944e2b7aa24d67b681", - "0918d7c2f9062743450a86eae9dde1a3", - "36a92cc94a9e0fa21f625f8bfb007adf", - "681d73898dad5685d48b5e8438bc3a66", - "337ccef058459c3c16411381778da0c4", - "6ccdfcc742862036ce07583633c5f77e", - "ddfa1adc974649dc5b414be86def7457", - "650ebc28ad85f11aa4b63b6ee565b89d", - "e4571793bcaba284017eeabd8df85697", - "4fc040d354ad9ba5e4f62862109d3e17", - "25814274e02aa7cc03d6314eb703e655", - "11378ecaee0089c840d26352704027e3", - "86f950bfcd824d5546da01c40576db31", - "089f243d1e831c5879aa375ee364a06e", - "9146ef3527c7cfcc66dc615c3986e391", - "d727cfdfc9ed0347e6917a68b982f7bc", - "da8f45e1fdc12deecfe56aeb5288796e", - "29cfcf52d8250a253a535cf7989c7bd2", - "0f6eb555b8e3c35411eebe9348594193", - "a922439f963e7e59040e4756992c6f1b", - "81f8453cf3f7e5ee5479c777e5a8d80c", - "8a7bd0732ed6a28ce75f6dabc90e1613", - "5f61c0ccad4cac44c75ff505e1f1e537", - "f6acfca2d47c87f2b14ca038234d3614", - "269fc62c517f3d55c368152addca57e7", - "50587cb16413da779b35508018721647", - "5e4a3ecfdaa4636b84a39b6a7be7c047", - "c5339dc2af6bf595580281ffb07353f6", - "e51176a47347e167ed0ed766b6de1a0c", - "020406e1d05cdc2aa287641f7ae2cc39", - "e510683b3f5ffe4093d021808bc6ff70", - "b325dc1c6f5e7a2b7cf465b9feab7948" -]; - -Mt.from_pair_suites("Digest_test", Pervasives.$at({ - hd: [ - "File \"digest_test.res\", line 9, characters 9-16", - (function (param) { - return { - TAG: "Eq", - _0: Digest.to_hex(Digest.string("value")), - _1: "2063c1608d6e0baf80249c42e2be5804" - }; - }) - ], - tl: { - hd: [ - "File \"digest_test.res\", line 11, characters 10-17", - (function (param) { - return { - TAG: "Eq", - _0: Digest.to_hex(Digest.string("The quick brown fox jumps over the lazy dog")), - _1: "9e107d9d372bb6826bd81d3542a419d6" - }; - }) - ], - tl: { - hd: [ - "File \"digest_test.res\", line 18, characters 10-17", - (function (param) { - return { - TAG: "Eq", - _0: Digest.to_hex(Digest.string("The quick brown fox jumps over the lazy dog.")), - _1: "e4d909c290d0fb1ca068ffaddf22cbd0" - }; - }) - ], - tl: { - hd: [ - "File \"digest_test.res\", line 24, characters 9-16", - (function (param) { - return { - TAG: "Eq", - _0: Digest.to_hex(Digest.string("")), - _1: "d41d8cd98f00b204e9800998ecf8427e" - }; - }) - ], - tl: { - hd: [ - "File \"digest_test.res\", line 26, characters 10-17", - (function (param) { - 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.")), - _1: "7065cc36bba1d155fb09f9d02f22e8bf" - }; - }) - ], - tl: { - hd: [ - "File \"digest_test.res\", line 45, characters 10-17", - (function (param) { - 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.")), - _1: "b9193d1df4b7a8f0a25ffdd1005c5b2b" - }; - }) - ], - tl: /* [] */0 - } - } - } - } - } -}, $$Array.to_list($$Array.map((function (i) { - return [ - String(i), - (function (param) { - return { - TAG: "Eq", - _0: Digest.to_hex(Digest.string("a".repeat(i))), - _1: Caml_array.get(ref, i) - }; - }) - ]; -}), Ext_array_test.range(0, 129))))); - -exports.f = f; -/* Not a pure module */ diff --git a/jscomp/test/digest_test.res b/jscomp/test/digest_test.res deleted file mode 100644 index 8c9f0edce6..0000000000 --- a/jscomp/test/digest_test.res +++ /dev/null @@ -1,199 +0,0 @@ -let f = x => \"@@"(Digest.to_hex, Digest.string(x)) - -\"@@"( - Mt.from_pair_suites(__MODULE__), - \"@"( - { - open Mt - list{ - (__LOC__, _ => Eq(f("value"), "2063c1608d6e0baf80249c42e2be5804")), - ( - __LOC__, - _ => Eq( - f("The quick brown fox jumps over the lazy dog"), - "9e107d9d372bb6826bd81d3542a419d6", - ), - ), - ( - __LOC__, - _ => Eq( - f("The quick brown fox jumps over the lazy dog."), - "e4d909c290d0fb1ca068ffaddf22cbd0", - ), - ), - (__LOC__, _ => Eq(f(""), "d41d8cd98f00b204e9800998ecf8427e")), - ( - __LOC__, - _ => Eq( - f( - "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.")))))))))), - ), - "7065cc36bba1d155fb09f9d02f22e8bf", - ), - ), - ( - __LOC__, - _ => Eq( - f( - "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."), - ), - "b9193d1df4b7a8f0a25ffdd1005c5b2b", - ), - ), - } - }, - { - let ref = [ - "d41d8cd98f00b204e9800998ecf8427e", - "0cc175b9c0f1b6a831c399e269772661", - "4124bc0a9335c27f086f24ba207a4912", - "47bce5c74f589f4867dbd57e9ca9f808", - "74b87337454200d4d33f80c4663dc5e5", - "594f803b380a41396ed63dca39503542", - "0b4e7a0e5fe84ad35fb5f95b9ceeac79", - "5d793fc5b00a2348c3fb9ab59e5ca98a", - "3dbe00a167653a1aaee01d93e77e730e", - "552e6a97297c53e592208cf97fbb3b60", - "e09c80c42fda55f9d992e59ca6b3307d", - "d57f21e6a273781dbf8b7657940f3b03", - "45e4812014d83dde5666ebdf5a8ed1ed", - "c162de19c4c3731ca3428769d0cd593d", - "451599a5f9afa91a0f2097040a796f3d", - "12f9cf6998d52dbe773b06f848bb3608", - "23ca472302f49b3ea5592b146a312da0", - "88e42e96cc71151b6e1938a1699b0a27", - "2c60c24e7087e18e45055a33f9a5be91", - "639d76897485360b3147e66e0a8a3d6c", - "22d42eb002cefa81e9ad604ea57bc01d", - "bd049f221af82804c5a2826809337c9b", - "ff49cfac3968dbce26ebe7d4823e58bd", - "d95dbfee231e34cccb8c04444412ed7d", - "40edae4bad0e5bf6d6c2dc5615a86afb", - "a5a8bfa3962f49330227955e24a2e67c", - "ae791f19bdf77357ff10bb6b0e97e121", - "aaab9c59a88bf0bdfcb170546c5459d6", - "b0f0545856af1a340acdedce23c54b97", - "f7ce3d7d44f3342107d884bfa90c966a", - "59e794d45697b360e18ba972bada0123", - "3b0845db57c200be6052466f87b2198a", - "5eca9bd3eb07c006cd43ae48dfde7fd3", - "b4f13cb081e412f44e99742cb128a1a5", - "4c660346451b8cf91ef50f4634458d41", - "11db24dc3f6c2145701db08625dd6d76", - "80dad3aad8584778352c68ab06250327", - "1227fe415e79db47285cb2689c93963f", - "8e084f489f1bdf08c39f98ff6447ce6d", - "08b2f2b0864bac1ba1585043362cbec9", - "4697843037d962f62a5a429e611e0f5f", - "10c4da18575c092b486f8ab96c01c02f", - "af205d729450b663f48b11d839a1c8df", - "0d3f91798fac6ee279ec2485b25f1124", - "4c3c7c067634daec9716a80ea886d123", - "d1e358e6e3b707282cdd06e919f7e08c", - "8c6ded4f0af86e0a7e301f8a716c4363", - "4c2d8bcb02d982d7cb77f649c0a2dea8", - "bdb662f765cd310f2a547cab1cfecef6", - "08ff5f7301d30200ab89169f6afdb7af", - "6eb6a030bcce166534b95bc2ab45d9cf", - "1bb77918e5695c944be02c16ae29b25e", - "b6fe77c19f0f0f4946c761d62585bfea", - "e9e7e260dce84ffa6e0e7eb5fd9d37fc", - "eced9e0b81ef2bba605cbc5e2e76a1d0", - "ef1772b6dff9a122358552954ad0df65", - "3b0c8ac703f828b04c6c197006d17218", - "652b906d60af96844ebd21b674f35e93", - "dc2f2f2462a0d72358b2f99389458606", - "762fc2665994b217c52c3c2eb7d9f406", - "cc7ed669cf88f201c3297c6a91e1d18d", - "cced11f7bbbffea2f718903216643648", - "24612f0ce2c9d2cf2b022ef1e027a54f", - "b06521f39153d618550606be297466d5", - "014842d480b571495a4a0363793f7367", - "c743a45e0d2e6a95cb859adae0248435", - "def5d97e01e1219fb2fc8da6c4d6ba2f", - "92cb737f8687ccb93022fdb411a77cca", - "a0d1395c7fb36247bfe2d49376d9d133", - "ab75504250558b788f99d1ebd219abf2", - "0f5c6c4e740bfcc08c3c26ccb2673d46", - "cddd19bec7f310d8c87149ef47a1828f", - "96b39b8b95e016c79d104d83395b8133", - "f1fc0b14ff8fa674b02344577e23eeb1", - "0e8d28a1cafa3ffcff22afd480cce7d8", - "448539ffc17e1e81005b65581855cef4", - "61e39aae7c53e6e77db2e4405d9fb157", - "618a426895ee6133a372bebd1129b63e", - "046c90690c9e36578b9d4a7e1d249c75", - "aadab38075c43296ee7e12466ebb03e3", - "b15af9cdabbaea0516866a33d8fd0f98", - "986e6938ed767a8ae9530eef54bfe5f1", - "7ae25a72b71a42ccbc5477fd989cd512", - "98d34e50d4aa7a893cc7919a91acb0e3", - "3fc53fc22ea40f1a0afd78fc2cd9aa0f", - "923e37c738b9d7b1526f70b65229cc3d", - "b3966b7a08e5d46fd0774b797ba78dc2", - "f50c7286b540bb181db1d6e05a51a296", - "4efd6c8826e65a61f82af954d431b59b", - "ef1031e79e7a15a4470a5e98b23781b5", - "067876bfd0df0f4c5002780ec85e6f8c", - "789851dfa4c03563e9cef5f7bc050a7e", - "baf934720818ee49477e74fc644faa5e", - "9a0ea77ca26d2c121ddcc179edb76308", - "20c825561572e33d026f99ddfd999538", - "464c461455c5a927079a13609c20b637", - "cf37d42f89b6adb0e1a9e99104501b82", - "d266af45e3d06b70d9f52e2df4344186", - "f8b59fa22eb0ba944e2b7aa24d67b681", - "0918d7c2f9062743450a86eae9dde1a3", - "36a92cc94a9e0fa21f625f8bfb007adf", - "681d73898dad5685d48b5e8438bc3a66", - "337ccef058459c3c16411381778da0c4", - "6ccdfcc742862036ce07583633c5f77e", - "ddfa1adc974649dc5b414be86def7457", - "650ebc28ad85f11aa4b63b6ee565b89d", - "e4571793bcaba284017eeabd8df85697", - "4fc040d354ad9ba5e4f62862109d3e17", - "25814274e02aa7cc03d6314eb703e655", - "11378ecaee0089c840d26352704027e3", - "86f950bfcd824d5546da01c40576db31", - "089f243d1e831c5879aa375ee364a06e", - "9146ef3527c7cfcc66dc615c3986e391", - "d727cfdfc9ed0347e6917a68b982f7bc", - "da8f45e1fdc12deecfe56aeb5288796e", - "29cfcf52d8250a253a535cf7989c7bd2", - "0f6eb555b8e3c35411eebe9348594193", - "a922439f963e7e59040e4756992c6f1b", - "81f8453cf3f7e5ee5479c777e5a8d80c", - "8a7bd0732ed6a28ce75f6dabc90e1613", - "5f61c0ccad4cac44c75ff505e1f1e537", - "f6acfca2d47c87f2b14ca038234d3614", - "269fc62c517f3d55c368152addca57e7", - "50587cb16413da779b35508018721647", - "5e4a3ecfdaa4636b84a39b6a7be7c047", - "c5339dc2af6bf595580281ffb07353f6", - "e51176a47347e167ed0ed766b6de1a0c", - "020406e1d05cdc2aa287641f7ae2cc39", - "e510683b3f5ffe4093d021808bc6ff70", - "b325dc1c6f5e7a2b7cf465b9feab7948", - ] - - Ext_array_test.range(0, 129) - |> Array.map(i => ( - Belt.Int.toString(i), - _ => Mt.Eq(\"@@"(Digest.to_hex, \"@@"(Digest.string, String.make(i, 'a'))), ref[i]), - )) - |> Array.to_list - }, - ), -) 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 698bed75a6..700236f8ed 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"); 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 []; } @@ -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(30000000, (function (i) { return i; })); @@ -75,7 +80,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -111,22 +116,14 @@ 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 (a, b) { + return add5(x, (v.contents = v.contents + 1 | 0, 1), (v.contents = v.contents + 1 | 0, 2), a, b); }; } function g(x) { - v.contents = v.contents + 1 | 0; - let partial_arg = 2; - v.contents = v.contents + 1 | 0; - let partial_arg$1 = 1; - let u = function (param, param$1) { - return add5(x, partial_arg$1, partial_arg, param, param$1); + let u = function (a, b) { + return add5(x, (v.contents = v.contents + 1 | 0, 1), (v.contents = v.contents + 1 | 0, 2), a, b); }; all_v.contents = { hd: v.contents, @@ -139,26 +136,26 @@ let a = f(0)(3, 4); let b = f(0)(3, 5); -let c = Curry._2(g(0), 3, 4); +let c = g(0)(3, 4); -let d = Curry._2(g(0), 3, 5); +let d = g(0)(3, 5); -eq("File \"earger_curry_test.res\", line 138, characters 5-12", a, 10); +eq("File \"earger_curry_test.res\", line 143, characters 5-12", a, 10); -eq("File \"earger_curry_test.res\", line 139, characters 5-12", b, 11); +eq("File \"earger_curry_test.res\", line 144, characters 5-12", b, 11); -eq("File \"earger_curry_test.res\", line 140, characters 5-12", c, 10); +eq("File \"earger_curry_test.res\", line 145, characters 5-12", c, 10); -eq("File \"earger_curry_test.res\", line 141, characters 5-12", d, 11); +eq("File \"earger_curry_test.res\", line 146, characters 5-12", d, 11); -eq("File \"earger_curry_test.res\", line 142, characters 5-12", all_v.contents, { +eq("File \"earger_curry_test.res\", line 147, characters 5-12", all_v.contents, { hd: 8, tl: { - hd: 8, + hd: 6, tl: { hd: 6, tl: { - hd: 6, + hd: 4, tl: { hd: 4, tl: { diff --git a/jscomp/test/earger_curry_test.res b/jscomp/test/earger_curry_test.res index a8301343c3..c98548eb01 100644 --- a/jscomp/test/earger_curry_test.res +++ b/jscomp/test/earger_curry_test.res @@ -1,19 +1,19 @@ -let f = g => (. x) => g(x) +let f = g => x => g(x) let map = (f, a) => { let l = Array.length(a) if l == 0 { [] } else { - let r = Array.make(l, f(. Array.unsafe_get(a, 0))) + let r = Array.make(l, f(Array.unsafe_get(a, 0))) for i in 1 to l - 1 { - Array.unsafe_set(r, i, f(. Array.unsafe_get(a, i))) + Array.unsafe_set(r, i, f(Array.unsafe_get(a, i))) } r } } -let map = (type u v, f: u => v, a: array): array => map((. x) => f(x), a) +let map = (type u v, f: u => v, a: array): array => map(x => f(x), a) let init = (l, f) => if l == 0 { @@ -24,24 +24,24 @@ let init = (l, f) => /* See #6575. We could also check for maximum array size, but this depends on whether we create a float array or a regular one... */ - let res = Array.make(l, f(. 0)) + let res = Array.make(l, f(0)) for i in 1 to pred(l) { - Array.unsafe_set(res, i, f(. i)) + Array.unsafe_set(res, i, f(i)) } res } -let init = (l, f) => init(l, (. x) => f(x)) +let init = (l, f) => init(l, x => f(x)) let fold_left = (f, x, a) => { let r = ref(x) for i in 0 to Array.length(a) - 1 { - r := f(. r.contents, Array.unsafe_get(a, i)) + r := f(r.contents, Array.unsafe_get(a, i)) } r.contents } -let fold_left = (f, x, a) => fold_left((. x, y) => f(x, y), x, a) +let fold_left = (f, x, a) => fold_left((x, y) => f(x, y), x, a) @val external timeStart: string => unit = "console.time" @@ -97,8 +97,8 @@ let add5 = (a0, a1, a2, a3, a4) => { a0 + a1 + a2 + a3 + a4 } -let f = x => - /* let u = */ add5( +let f = x => /* let u = */ (a, b) => + add5( x, { incr(v) @@ -108,37 +108,42 @@ let f = x => incr(v) 2 }, + a, + b, ) /* in */ /* all_v := !v :: !all_v ; u */ let g = x => { - let u = add5( - x, - { - incr(v) - 1 - }, - { - incr(v) - 2 - }, - ) + let u = (a, b) => + add5( + x, + { + incr(v) + 1 + }, + { + incr(v) + 2 + }, + a, + b, + ) all_v := list{v.contents, ...all_v.contents} u } -let a = f(0, 3, 4) +let a = f(0)(3, 4) -let b = f(0, 3, 5) +let b = f(0)(3, 5) -let c = g(0, 3, 4) -let d = g(0, 3, 5) +let c = g(0)(3, 4) +let d = g(0)(3, 5) let () = { eq(__LOC__, a, 10) eq(__LOC__, b, 11) eq(__LOC__, c, 10) eq(__LOC__, d, 11) - eq(__LOC__, all_v.contents, list{8, 8, 6, 6, 4, 2}) + eq(__LOC__, all_v.contents, list{8, 6, 6, 4, 4, 2}) } let () = Mt.from_pair_suites(__MODULE__, suites.contents) 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 f5594faac7..224e3edd6b 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 { RE_EXN_ID: "Assert_failure", @@ -61,7 +61,7 @@ function is_equal(param) { }; } -function is_exception(param) { +function is_exception() { try { throw { RE_EXN_ID: "Not_found", @@ -98,7 +98,7 @@ function is_normal_exception(_x) { } } -function is_arbitrary_exception(param) { +function is_arbitrary_exception() { let A = /* @__PURE__ */Caml_exceptions.create("A"); try { throw { 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 3cb6d010cf..3ed1fa7256 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); @@ -134,7 +133,7 @@ let suites = { contents: { hd: [ "File \"exception_raise_test.res\", line 120, characters 5-12", - (function (param) { + (function () { return { TAG: "Eq", _0: [ @@ -155,7 +154,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", @@ -209,12 +208,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 d9ad524e89..367a64547d 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_rebound_err_test.res b/jscomp/test/exception_rebound_err_test.res index aa03004a84..0aafb48781 100644 --- a/jscomp/test/exception_rebound_err_test.res +++ b/jscomp/test/exception_rebound_err_test.res @@ -12,7 +12,7 @@ exception C(int, int) let test_js_error4 = () => try { - \"@@"(ignore, Js.Json.parseExn(` {"x"}`)) + ignore(Js.Json.parseExn(` {"x"}`)) 1 } catch { | Not_found => 2 diff --git a/jscomp/test/exception_value_test.js b/jscomp/test/exception_value_test.js index aba2a66913..2b036adb20 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 { RE_EXN_ID: "Not_found", Error: new Error() @@ -28,7 +27,7 @@ function assert_f(x) { return 3; } -function hh(param) { +function hh() { throw { RE_EXN_ID: "Not_found", Error: new Error() @@ -48,7 +47,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); @@ -59,7 +58,7 @@ function test_not_found(f, param) { } } -function test_js_error2(param) { +function test_js_error2() { try { return JSON.parse(" {\"x\" : }"); } @@ -73,7 +72,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/exception_value_test.res b/jscomp/test/exception_value_test.res index 38460a461c..b5b753e290 100644 --- a/jscomp/test/exception_value_test.res +++ b/jscomp/test/exception_value_test.res @@ -1,7 +1,7 @@ let f = () => raise(Not_found) let assert_f = x => { - let () = assert (x > 3) + let () = assert(x > 3) 3 } @@ -25,13 +25,13 @@ let test_not_found = (f, ()) => let test_js_error2 = () => try Js.Json.parseExn(` {"x" : }`) catch { | Js.Exn.Error(err) as e => - \"@@"(Js.log, Js.Exn.stack(err)) + Js.log(Js.Exn.stack(err)) raise(e) } let test_js_error3 = () => try { - \"@@"(ignore, Js.Json.parseExn(` {"x"}`)) + ignore(Js.Json.parseExn(` {"x"}`)) 1 } catch { | e => 0 diff --git a/jscomp/test/ext_array_test.js b/jscomp/test/ext_array_test.js index b81a644c3d..bc2059958d 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,30 +104,30 @@ function filter_map(f, a) { } function range(from, to_) { - if (from > to_) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_array_test.range", - Error: new Error() - }; + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_array_test.range", + Error: new Error() + }; } function map2i(f, a, b) { let len = a.length; - if (len !== b.length) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_array_test.map2i", - Error: new Error() - }; + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_array_test.map2i", + Error: new Error() + }; } function tolist_aux(a, f, _i, _res) { @@ -139,7 +138,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 @@ -162,7 +161,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; @@ -173,7 +172,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; @@ -188,7 +187,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; @@ -219,7 +218,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; @@ -250,7 +249,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; @@ -268,7 +267,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 5867be472a..65cf3bcb59 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 { RE_EXN_ID: H, Error: new Error() @@ -155,21 +155,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; @@ -189,7 +193,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), @@ -216,6 +220,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 cf1a316671..8e1b3e90f6 100644 --- a/jscomp/test/ext_filename_test.js +++ b/jscomp/test/ext_filename_test.js @@ -2,10 +2,9 @@ '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"); @@ -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,10 +63,9 @@ 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 { RE_EXN_ID: "Invalid_argument", - _1: s, + _1: "Filename.chop_extension ( " + loc + " : " + name + " )", Error: new Error() }; } @@ -91,8 +89,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) { @@ -110,21 +108,14 @@ function relative_path(file_or_dir_1, file_or_dir_2) { }; }; let ys = go(dir1, dir2); - if (ys) { - if (ys.hd === node_parent) { - return $$Array.of_list(ys).join(node_sep); - } - let xs = { + if (ys && ys.hd === node_parent) { + return $$String.concat(node_sep, ys); + } else { + return $$String.concat(node_sep, { hd: node_current, tl: ys - }; - return $$Array.of_list(xs).join(node_sep); + }); } - let xs$1 = { - hd: node_current, - tl: ys - }; - return $$Array.of_list(xs$1).join(node_sep); } function node_relative_path(node_modules_shorten, file1, dep_file) { @@ -144,16 +135,15 @@ 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 { RE_EXN_ID: "Failure", - _1: s, + _1: "invalid path: " + file2, Error: new Error() }; } @@ -174,15 +164,14 @@ 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 { RE_EXN_ID: "Failure", - _1: s, + _1: filename + " not found from " + cwd, Error: new Error() }; }; @@ -192,19 +181,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 +199,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 +212,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 +247,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 +268,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,10 +347,9 @@ 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 { RE_EXN_ID: "Failure", - _1: s, + _1: "Unknown OS : " + Sys.os_type, Error: new Error() }; } @@ -389,4 +379,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_filename_test.res b/jscomp/test/ext_filename_test.res index 86ffdaf2f8..e216de63c5 100644 --- a/jscomp/test/ext_filename_test.res +++ b/jscomp/test/ext_filename_test.res @@ -134,7 +134,7 @@ let relative_path = (file_or_dir_1, file_or_dir_2) => { switch go(dir1, dir2) { | list{x, ..._} as ys if x == node_parent => String.concat(node_sep, ys) - | ys => \"@@"(String.concat(node_sep), list{node_current, ...ys}) + | ys => String.concat(node_sep, list{node_current, ...ys}) } } @@ -214,10 +214,10 @@ let find_package_json_dir = cwd => find_root_filename(~cwd, Test_literals.bsconf let package_dir = Lazy.from_fun(() => find_package_json_dir(Lazy.force(cwd))) let module_name_of_file = file => - String.capitalize_ascii(\"@@"(Filename.chop_extension, Filename.basename(file))) + String.capitalize_ascii(Filename.chop_extension(Filename.basename(file))) let module_name_of_file_if_any = file => - String.capitalize_ascii(\"@@"(chop_extension_if_any, Filename.basename(file))) + String.capitalize_ascii(chop_extension_if_any(Filename.basename(file))) /* For win32 or case insensitve OS [\".cmj\"] is the same as [\".CMJ\"] diff --git a/jscomp/test/ext_list_test.js b/jscomp/test/ext_list_test.js index c4331e1387..80e4b7bc31 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), @@ -231,7 +230,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), @@ -270,7 +269,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; @@ -290,7 +289,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 { @@ -299,14 +298,14 @@ function flat_map2(f, lx, ly) { Error: new Error() }; } - if (ly$1) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_list_test.flat_map2", - Error: new Error() - }; + if (!ly$1) { + return List.rev(acc); } - return List.rev(acc); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.flat_map2", + Error: new Error() + }; }; } @@ -318,7 +317,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; }; } @@ -339,7 +338,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 }; } @@ -353,7 +352,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) @@ -383,11 +382,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) @@ -401,7 +400,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 { @@ -413,7 +412,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 { RE_EXN_ID: "Invalid_argument", @@ -421,14 +420,14 @@ function fold_right2_last(f, l1, l2, accu) { Error: new Error() }; } - if (l2) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2", - Error: new Error() - }; + if (!l2) { + return accu; } - return accu; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2", + Error: new Error() + }; } function init(n, f) { @@ -438,17 +437,17 @@ function init(n, f) { function take(n, l) { let arr = $$Array.of_list(l); let arr_length = arr.length; - if (arr_length < n) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_list_test.take", - Error: new Error() - }; + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.take", + Error: new Error() + }; } function try_take(n, l) { @@ -555,7 +554,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, @@ -609,7 +608,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; @@ -623,7 +622,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; } @@ -634,7 +633,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); } @@ -649,7 +648,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; @@ -659,7 +658,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 { @@ -670,7 +669,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); } } @@ -689,7 +688,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; @@ -705,7 +704,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; @@ -719,7 +718,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; } @@ -742,7 +741,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], @@ -760,7 +759,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 { @@ -781,7 +780,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 c56bed008e..0ed86ff5e7 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,13 +8,13 @@ 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 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 4fbe0c414b..8ccacf99f0 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,14 +216,14 @@ 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 { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_string_test.for_all_range", - Error: new Error() - }; + if (!(start < 0 || finish >= len)) { + return unsafe_for_all_range(s, start, finish, p); } - return unsafe_for_all_range(s, start, finish, p); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_string_test.for_all_range", + Error: new Error() + }; } function for_all(p, s) { @@ -297,25 +296,25 @@ function contain_substring(s, sub) { function non_overlap_count(sub, s) { let sub_len = sub.length; - if (sub.length === 0) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_string_test.non_overlap_count", - Error: new Error() + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_string_test.non_overlap_count", + Error: new Error() }; } @@ -545,14 +544,14 @@ 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 { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_string_test.no_char", - Error: new Error() - }; + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_string_test.no_char", + Error: new Error() + }; } 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_arity_test.res b/jscomp/test/ffi_arity_test.res index f2d1c7cbf3..fd8b5673fd 100644 --- a/jscomp/test/ffi_arity_test.res +++ b/jscomp/test/ffi_arity_test.res @@ -1,5 +1,5 @@ -@send external map: (array<'a>, (. 'a) => 'b) => array<'b> = "map" -@send external mapi: (array<'a>, (. 'a, int) => 'b) => array<'b> = "map" +@send external map: (array<'a>, 'a => 'b) => array<'b> = "map" +@send external mapi: (array<'a>, ('a, int) => 'b) => array<'b> = "map" @val external parseInt: string => int = "parseInt" @val external parseInt_radix: (string, int) => int = "parseInt" @@ -11,13 +11,13 @@ let f = v => v => v + v } -let v = mapi([1, 2, 3], (. a, b) => f(a, b)) +let v = mapi([1, 2, 3], (a, b) => f(a)(b)) -let vv = mapi([1, 2, 3], (. a, b) => a + b) +let vv = mapi([1, 2, 3], (a, b) => a + b) -let hh = map(["1", "2", "3"], (. x) => parseInt(x)) +let hh = map(["1", "2", "3"], x => parseInt(x)) -let u = (. ()) => 3 +let u = () => 3 let vvv = ref(0) let fff = () => { @@ -27,7 +27,7 @@ let fff = () => { incr(vvv) } -let g = (. ()) => fff() +let g = () => fff() /* will be compiled into var g = function () { fff (0)} not {[ var g = fff ]} @@ -38,11 +38,11 @@ let abc = (x, y, z) => { x + y + z } -let abc_u = (. x, y, z) => abc(x, y, z) +let abc_u = (x, y, z) => abc(x, y, z) /* cool, it will be compiled into {[ var absc_u = abc ]} */ -let () = g(.) +let () = g() Mt.from_pair_suites( __MODULE__, { 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_js_test.res b/jscomp/test/ffi_js_test.res index 68a4136fe3..89a56bfcd4 100644 --- a/jscomp/test/ffi_js_test.res +++ b/jscomp/test/ffi_js_test.res @@ -91,7 +91,7 @@ let ffff = x => { switch getGADTI3(x, Int, Str) { | (cc, dd) => Js.log((cc, dd)) } - \"@@"(Js.log, getGADT(x, Int)) + Js.log(getGADT(x, Int)) switch getGADT2(x, Int, Str) { | (a: int, b: string) => Js.log2(a, b) } diff --git a/jscomp/test/ffi_splice_test.js b/jscomp/test/ffi_splice_test.js index c4e4b6c483..6798e95f35 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 87624f5667..3d0cce06b2 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"); @@ -236,7 +235,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); } @@ -307,16 +306,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 { RE_EXN_ID: "Assert_failure", _1: [ @@ -332,13 +329,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/flexible_array_test.res b/jscomp/test/flexible_array_test.res index 4ffee6666a..262655b1e8 100644 --- a/jscomp/test/flexible_array_test.res +++ b/jscomp/test/flexible_array_test.res @@ -161,8 +161,8 @@ module Int_array: { s } else { let head = get(s, 0) - let larger = \"@@"(sort, filter_from(1, x => x > head, s)) - let smaller = \"@@"(sort, filter_from(1, x => x <= head, s)) + let larger = sort(filter_from(1, x => x > head, s)) + let smaller = sort(filter_from(1, x => x <= head, s)) append(smaller, push_front(larger, head)) } } diff --git a/jscomp/test/float_of_bits_test.js b/jscomp/test/float_of_bits_test.js index ab56973d40..7b6747eae2 100644 --- a/jscomp/test/float_of_bits_test.js +++ b/jscomp/test/float_of_bits_test.js @@ -59,7 +59,7 @@ function from_pairs(pair) { let suites = Pervasives.$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 c09c9a97b9..0e9a0fc9d3 100644 --- a/jscomp/test/float_test.js +++ b/jscomp/test/float_test.js @@ -5,6 +5,7 @@ let Mt = require("./mt.js"); let Caml = require("../../lib/js/caml.js"); let $$Array = require("../../lib/js/array.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); +let Belt_List = require("../../lib/js/belt_List.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"); @@ -18,16 +19,12 @@ let suites = { contents: /* [] */0 }; -function eq(loc) { - return function (param, param$1) { - return Mt_global.collect_eq(test_id, suites, loc, param, param$1); - }; +function eq(loc, a, b) { + Mt_global.collect_eq(test_id, suites, loc, a, b); } -function approx(loc) { - return function (param, param$1) { - return Mt_global.collect_approx(test_id, suites, loc, param, param$1); - }; +function approx(loc, a, b) { + Mt_global.collect_approx(test_id, suites, loc, a, b); } let epsilon_float = Caml_int64.float_of_bits([ @@ -178,16 +175,16 @@ function float_greaterequal(x, y) { let generic_greaterequal = Caml_obj.greaterequal; -Mt_global.collect_eq(test_id, suites, "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", Pervasives.classify_float(3), "FP_normal"); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 60, characters 5-12", Caml_float.modf_float(-3.125), [ +eq("File \"float_test.res\", line 60, characters 5-12", Caml_float.modf_float(-3.125), [ -0.125, -3 ]); let match$3 = Caml_float.modf_float(Number.NaN); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 62, characters 4-11", [ +eq("File \"float_test.res\", line 62, characters 4-11", [ Number.isNaN(match$3[0]), Number.isNaN(match$3[1]) ], [ @@ -195,7 +192,7 @@ Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 62, charact true ]); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 71, characters 4-11", $$Array.map((function (x) { +eq("File \"float_test.res\", line 71, characters 4-11", $$Array.map((function (x) { if (x > 0) { return 1; } else if (x < 0) { @@ -224,101 +221,101 @@ Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 71, charact 1 ]); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 83, characters 5-12", Caml_float.copysign_float(-3, 0), 3); +eq("File \"float_test.res\", line 83, characters 5-12", Caml_float.copysign_float(-3, 0), 3); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 84, characters 5-12", Caml_float.copysign_float(3, 0), 3); +eq("File \"float_test.res\", line 84, characters 5-12", Caml_float.copysign_float(3, 0), 3); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 85, characters 5-12", Math.log10(10), 1); +eq("File \"float_test.res\", line 85, characters 5-12", Math.log10(10), 1); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 86, characters 5-12", Caml_float.expm1_float(0), 0); +eq("File \"float_test.res\", line 86, characters 5-12", Caml_float.expm1_float(0), 0); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 87, characters 5-12", Number("3.0"), 3.0); +eq("File \"float_test.res\", line 87, characters 5-12", Number("3.0"), 3.0); -Mt_global.collect_approx(test_id, suites, "File \"float_test.res\", line 88, characters 9-16", Caml_float.expm1_float(2), 6.38905609893065); +approx("File \"float_test.res\", line 88, characters 9-16", Caml_float.expm1_float(2), 6.38905609893065); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 89, characters 5-12", Caml.float_compare(NaN, NaN), 0); +eq("File \"float_test.res\", line 89, characters 5-12", Caml.float_compare(NaN, NaN), 0); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 90, characters 5-12", Caml_obj.compare(NaN, NaN), 0); +eq("File \"float_test.res\", line 90, characters 5-12", Caml_obj.compare(NaN, NaN), 0); -Mt_global.collect_eq(test_id, suites, "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, Pervasives.neg_infinity), -1); -Mt_global.collect_eq(test_id, suites, "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, Pervasives.neg_infinity), -1); -Mt_global.collect_eq(test_id, suites, "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(Pervasives.neg_infinity, NaN), 1); -Mt_global.collect_eq(test_id, suites, "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(Pervasives.neg_infinity, NaN), 1); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 95, characters 5-12", NaN === NaN, false); +eq("File \"float_test.res\", line 95, characters 5-12", NaN === NaN, false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 96, characters 5-12", Caml_obj.equal(NaN, NaN), false); +eq("File \"float_test.res\", line 96, characters 5-12", Caml_obj.equal(NaN, NaN), false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 97, characters 5-12", 4.2 === NaN, false); +eq("File \"float_test.res\", line 97, characters 5-12", 4.2 === NaN, false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 98, characters 5-12", Caml_obj.equal(4.2, NaN), false); +eq("File \"float_test.res\", line 98, characters 5-12", Caml_obj.equal(4.2, NaN), false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 99, characters 5-12", NaN === 4.2, false); +eq("File \"float_test.res\", line 99, characters 5-12", NaN === 4.2, false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 100, characters 5-12", Caml_obj.equal(NaN, 4.2), false); +eq("File \"float_test.res\", line 100, characters 5-12", Caml_obj.equal(NaN, 4.2), false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 101, characters 5-12", NaN !== NaN, true); +eq("File \"float_test.res\", line 101, characters 5-12", NaN !== NaN, true); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 102, characters 5-12", Caml_obj.notequal(NaN, NaN), true); +eq("File \"float_test.res\", line 102, characters 5-12", Caml_obj.notequal(NaN, NaN), true); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 103, characters 5-12", 4.2 !== NaN, true); +eq("File \"float_test.res\", line 103, characters 5-12", 4.2 !== NaN, true); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 104, characters 5-12", Caml_obj.notequal(4.2, NaN), true); +eq("File \"float_test.res\", line 104, characters 5-12", Caml_obj.notequal(4.2, NaN), true); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 105, characters 5-12", NaN !== 4.2, true); +eq("File \"float_test.res\", line 105, characters 5-12", NaN !== 4.2, true); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 106, characters 5-12", Caml_obj.notequal(NaN, 4.2), true); +eq("File \"float_test.res\", line 106, characters 5-12", Caml_obj.notequal(NaN, 4.2), true); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 107, characters 5-12", NaN < NaN, false); +eq("File \"float_test.res\", line 107, characters 5-12", NaN < NaN, false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 108, characters 5-12", Caml_obj.lessthan(NaN, NaN), false); +eq("File \"float_test.res\", line 108, characters 5-12", Caml_obj.lessthan(NaN, NaN), false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 109, characters 5-12", 4.2 < NaN, false); +eq("File \"float_test.res\", line 109, characters 5-12", 4.2 < NaN, false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 110, characters 5-12", Caml_obj.lessthan(4.2, NaN), false); +eq("File \"float_test.res\", line 110, characters 5-12", Caml_obj.lessthan(4.2, NaN), false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 111, characters 5-12", NaN < 4.2, false); +eq("File \"float_test.res\", line 111, characters 5-12", NaN < 4.2, false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 112, characters 5-12", Caml_obj.lessthan(NaN, 4.2), false); +eq("File \"float_test.res\", line 112, characters 5-12", Caml_obj.lessthan(NaN, 4.2), false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 113, characters 5-12", NaN > NaN, false); +eq("File \"float_test.res\", line 113, characters 5-12", NaN > NaN, false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 114, characters 5-12", Caml_obj.greaterthan(NaN, NaN), false); +eq("File \"float_test.res\", line 114, characters 5-12", Caml_obj.greaterthan(NaN, NaN), false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 115, characters 5-12", 4.2 > NaN, false); +eq("File \"float_test.res\", line 115, characters 5-12", 4.2 > NaN, false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 116, characters 5-12", Caml_obj.greaterthan(4.2, NaN), false); +eq("File \"float_test.res\", line 116, characters 5-12", Caml_obj.greaterthan(4.2, NaN), false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 117, characters 5-12", NaN > 4.2, false); +eq("File \"float_test.res\", line 117, characters 5-12", NaN > 4.2, false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 118, characters 5-12", Caml_obj.greaterthan(NaN, 4.2), false); +eq("File \"float_test.res\", line 118, characters 5-12", Caml_obj.greaterthan(NaN, 4.2), false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 119, characters 5-12", NaN <= NaN, false); +eq("File \"float_test.res\", line 119, characters 5-12", NaN <= NaN, false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 120, characters 5-12", Caml_obj.lessequal(NaN, NaN), false); +eq("File \"float_test.res\", line 120, characters 5-12", Caml_obj.lessequal(NaN, NaN), false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 121, characters 5-12", 4.2 <= NaN, false); +eq("File \"float_test.res\", line 121, characters 5-12", 4.2 <= NaN, false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 122, characters 5-12", Caml_obj.lessequal(4.2, NaN), false); +eq("File \"float_test.res\", line 122, characters 5-12", Caml_obj.lessequal(4.2, NaN), false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 123, characters 5-12", NaN <= 4.2, false); +eq("File \"float_test.res\", line 123, characters 5-12", NaN <= 4.2, false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 124, characters 5-12", Caml_obj.lessequal(NaN, 4.2), false); +eq("File \"float_test.res\", line 124, characters 5-12", Caml_obj.lessequal(NaN, 4.2), false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 125, characters 5-12", NaN >= NaN, false); +eq("File \"float_test.res\", line 125, characters 5-12", NaN >= NaN, false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 126, characters 5-12", Caml_obj.greaterequal(NaN, NaN), false); +eq("File \"float_test.res\", line 126, characters 5-12", Caml_obj.greaterequal(NaN, NaN), false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 127, characters 5-12", 4.2 >= NaN, false); +eq("File \"float_test.res\", line 127, characters 5-12", 4.2 >= NaN, false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 128, characters 5-12", Caml_obj.greaterequal(4.2, NaN), false); +eq("File \"float_test.res\", line 128, characters 5-12", Caml_obj.greaterequal(4.2, NaN), false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 129, characters 5-12", NaN >= 4.2, false); +eq("File \"float_test.res\", line 129, characters 5-12", NaN >= 4.2, false); -Mt_global.collect_eq(test_id, suites, "File \"float_test.res\", line 130, characters 5-12", Caml_obj.greaterequal(NaN, 4.2), false); +eq("File \"float_test.res\", line 130, characters 5-12", Caml_obj.greaterequal(NaN, 4.2), false); let match$4 = Caml_float.modf_float(32.3); @@ -326,55 +323,58 @@ let b = match$4[1]; let a = match$4[0]; -Mt.from_pair_suites("Float_test", Pervasives.$at({ - hd: [ - "mod_float", - (function (param) { - return { - TAG: "Approx", - _0: 3.2 % 0.5, - _1: 0.200000000000000178 - }; - }) - ], - tl: { +Mt.from_pair_suites("Float_test", Belt_List.concatMany([ + { hd: [ - "modf_float1", - (function (param) { + "mod_float", + (function () { return { TAG: "Approx", - _0: a, - _1: 0.299999999999997158 + _0: 3.2 % 0.5, + _1: 0.200000000000000178 }; }) ], tl: { hd: [ - "modf_float2", - (function (param) { + "modf_float1", + (function () { return { TAG: "Approx", - _0: b, - _1: 32 + _0: a, + _1: 0.299999999999997158 }; }) ], tl: { hd: [ - "int_of_float", - (function (param) { + "modf_float2", + (function () { return { - TAG: "Eq", - _0: 3, - _1: 3 + TAG: "Approx", + _0: b, + _1: 32 }; }) ], - tl: /* [] */0 + tl: { + hd: [ + "int_of_float", + (function () { + return { + TAG: "Eq", + _0: 3, + _1: 3 + }; + }) + ], + tl: from_pairs(results) + } } } - } -}, Pervasives.$at(from_pairs(results), suites.contents))); + }, + suites.contents +])); exports.test_id = test_id; exports.suites = suites; diff --git a/jscomp/test/float_test.res b/jscomp/test/float_test.res index eb8662005e..2135b6eb21 100644 --- a/jscomp/test/float_test.res +++ b/jscomp/test/float_test.res @@ -1,6 +1,6 @@ let (test_id, suites) = (ref(0), ref(list{})) -let eq = loc => Mt_global.collect_eq(test_id, suites, loc) -let approx = loc => Mt_global.collect_approx(test_id, suites, loc) +let eq = (loc, a, b) => Mt_global.collect_eq(test_id, suites, loc, a, b) +let approx = (loc, a, b) => Mt_global.collect_approx(test_id, suites, loc, a, b) let epsilon_float = Int64.float_of_bits(0x3C_B0_00_00_00_00_00_00L) @@ -132,19 +132,15 @@ let () = { let () = { let (a, b) = modf(32.3) - \"@@"( - Mt.from_pair_suites(__MODULE__), - \"@"( - { - open Mt - list{ - ("mod_float", _ => Approx(mod_float(3.2, 0.5), 0.200000000000000178)), - ("modf_float1", _ => Approx(a, 0.299999999999997158)), - ("modf_float2", _ => Approx(b, 32.)), - ("int_of_float", _ => Eq(int_of_float(3.2), 3)), - } - }, - \"@"(from_pairs(results), suites.contents), - ), - ) + Mt.from_pair_suites(__MODULE__, { + open Mt + list{ + ("mod_float", _ => Approx(mod_float(3.2, 0.5), 0.200000000000000178)), + ("modf_float1", _ => Approx(a, 0.299999999999997158)), + ("modf_float2", _ => Approx(b, 32.)), + ("int_of_float", _ => Eq(int_of_float(3.2), 3)), + ...from_pairs(results), + ...suites.contents + } + }) } 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_loop_test.res b/jscomp/test/for_loop_test.res index 8c45dd2c05..1fc343aa6e 100644 --- a/jscomp/test/for_loop_test.res +++ b/jscomp/test/for_loop_test.res @@ -1,6 +1,6 @@ let for_3 = x => { let v = ref(0) - let arr = Array.map((_, _) => (), x) + let arr = Array.map(_ => _ => (), x) for i in 0 to Array.length(x) - 1 { let j = i * 2 arr[i] = _ => v := v.contents + j @@ -11,7 +11,7 @@ let for_3 = x => { let for_4 = x => { let v = ref(0) - let arr = Array.map((_, _) => (), x) + let arr = Array.map(_ => _ => (), x) for i in 0 to Array.length(x) - 1 { let j = i * 2 let k = 2 * j @@ -23,7 +23,7 @@ let for_4 = x => { let for_5 = (x, u) => { let v = ref(0) - let arr = Array.map((_, _) => (), x) + let arr = Array.map(_ => _ => (), x) for i in 0 to Array.length(x) - 1 { let _j = i * 2 let k = 2 * u * u @@ -35,7 +35,7 @@ let for_5 = (x, u) => { let for_6 = (x, u) => { let v = ref(0) - let arr = Array.map((_, _) => (), x) + let arr = Array.map(_ => _ => (), x) let v4 = ref(0) let v5 = ref(0) let inspect_3 = ref(-1) @@ -91,7 +91,7 @@ let for_8 = () => { let for_9 = () => { let (collect, get) = { let v: ref> = ref(list{}) - (x => v := list{x, ...v.contents}, () => \"@@"(Array.of_list, List.rev(v.contents))) + (x => v := list{x, ...v.contents}, () => Array.of_list(List.rev(v.contents))) } let i_len = 2 @@ -158,8 +158,8 @@ console.log(result,u) */ let suites = list{ - ("for_loop_test_3", _ => Mt.Eq(90, \"@@"(for_3, Array.make(10, 2)))), - ("for_loop_test_4", _ => Mt.Eq(180, \"@@"(for_4, Array.make(10, 2)))), + ("for_loop_test_3", _ => Mt.Eq(90, for_3(Array.make(10, 2)))), + ("for_loop_test_4", _ => Mt.Eq(180, for_4(Array.make(10, 2)))), ("for_loop_test_5", _ => Mt.Eq(2420, for_5(Array.make(10, 2), 11))), ("for_loop_test_6", _ => Mt.Eq([30, 1, 2, 3], for_6(Array.make(3, 0), 0))), ("for_loop_test_7", _ => Mt.Eq(84, for_7())), 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_regression.js b/jscomp/test/format_regression.js index 1fac2d7e41..bd55be1863 100644 --- a/jscomp/test/format_regression.js +++ b/jscomp/test/format_regression.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); function peek_queue(param) { throw { @@ -39,13 +38,13 @@ function take_queue(param) { }; } -function format_pp_token(param, param$1) { +function format_pp_token(param, param$1, param$2) { throw { RE_EXN_ID: "Assert_failure", _1: [ "format_regression.res", 13, - 32 + 35 ], Error: new Error() }; @@ -60,7 +59,7 @@ function advance_loop(state) { return; } take_queue(state.pp_queue); - Curry._1(format_pp_token(state, size$1 < 0 ? 1000000010 : size$1), match.token); + format_pp_token(state, size$1 < 0 ? 1000000010 : size$1, match.token); state.pp_left_total = match.length + state.pp_left_total | 0; continue; }; diff --git a/jscomp/test/format_regression.res b/jscomp/test/format_regression.res index 52d1cfce89..a8394503f4 100644 --- a/jscomp/test/format_regression.res +++ b/jscomp/test/format_regression.res @@ -10,7 +10,7 @@ type pp_token let peek_queue = _ => assert(false) let int_of_size = _ => assert(false) let take_queue = _ => assert(false) -let format_pp_token = (_, _) => assert(false) +let format_pp_token = (_, _, _) => assert(false) let pp_infinity = 1000000010 type pp_queue_elem = { mutable elem_size: size, diff --git a/jscomp/test/format_test.js b/jscomp/test/format_test.js index 54cec63dd7..9c7de3c192 100644 --- a/jscomp/test/format_test.js +++ b/jscomp/test/format_test.js @@ -3,7 +3,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 Pervasives = require("../../lib/js/pervasives.js"); let Caml_format = require("../../lib/js/caml_format.js"); @@ -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, @@ -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 964a3f85c7..9b3880f260 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,51 +11,47 @@ 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 { - RE_EXN_ID: "Assert_failure", - _1: [ - "fun_pattern_match.res", - 33, - 9 - ], - Error: new Error() - }; + rhs === "Uninitialized"; + } + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "fun_pattern_match.res", + 33, + 9 + ], + Error: new Error() }; } -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 { - RE_EXN_ID: "Assert_failure", - _1: [ - "fun_pattern_match.res", - 39, - 9 - ], - Error: new Error() - }; + rhs === "Uninitialized"; + } + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "fun_pattern_match.res", + 39, + 9 + ], + Error: new Error() }; } @@ -65,13 +60,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/functor_ffi.res b/jscomp/test/functor_ffi.res index c5de0aab39..8dd7920ef3 100644 --- a/jscomp/test/functor_ffi.res +++ b/jscomp/test/functor_ffi.res @@ -9,7 +9,7 @@ module Make = ( @get_index external get: (t, int) => Js.undefined = "" - let opt_get = (f, i) => \"@@"(Js.Undefined.toOption, get(f, i)) + let opt_get = (f, i) => Js.Undefined.toOption(get(f, i)) } module Int_arr = Make({ 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/genlex_test.js b/jscomp/test/genlex_test.js index a912127e2e..bad7e471db 100644 --- a/jscomp/test/genlex_test.js +++ b/jscomp/test/genlex_test.js @@ -7,31 +7,33 @@ let Genlex = require("../../lib/js/genlex.js"); let Stream = require("../../lib/js/stream.js"); let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); -let lexer = Genlex.make_lexer({ - hd: "+", - tl: { - hd: "-", +function lexer(l) { + return Genlex.make_lexer({ + hd: "+", tl: { - hd: "*", + hd: "-", tl: { - hd: "/", + hd: "*", tl: { - hd: "let", + hd: "/", tl: { - hd: "=", + hd: "let", tl: { - hd: "(", + hd: "=", tl: { - hd: ")", - tl: /* [] */0 + hd: "(", + tl: { + hd: ")", + tl: /* [] */0 + } } } } } } } - } -}); + }, l); +} function to_list(s) { let _acc = /* [] */0; @@ -119,4 +121,4 @@ Mt.from_pair_suites("Genlex_test", suites); exports.lexer = lexer; exports.to_list = to_list; exports.suites = suites; -/* lexer Not a pure module */ +/* Not a pure module */ diff --git a/jscomp/test/genlex_test.res b/jscomp/test/genlex_test.res index 74f3d7b0de..f1b29edbd3 100644 --- a/jscomp/test/genlex_test.res +++ b/jscomp/test/genlex_test.res @@ -1,6 +1,6 @@ open Genlex -let lexer = make_lexer(list{"+", "-", "*", "/", "let", "=", "(", ")"}) +let lexer = l => make_lexer(list{"+", "-", "*", "/", "let", "=", "(", ")"}, l) let to_list = s => { let rec aux = acc => @@ -18,7 +18,7 @@ let suites = { "lexer_stream_genlex", _ => Eq( list{Int(3), Kwd("("), Int(3), Kwd("+"), Int(2), Int(-1), Kwd(")")}, - "3(3 + 2 -1)" |> Stream.of_string |> lexer |> to_list, + to_list(lexer(Stream.of_string("3(3 + 2 -1)"))), ), ), } 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 deleted file mode 100644 index 922111d0a7..0000000000 --- a/jscomp/test/google_closure_test.js +++ /dev/null @@ -1,32 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Test_google_closure = require("./test_google_closure.js"); - -Mt.from_pair_suites("Closure", { - hd: [ - "partial", - (function (param) { - return { - TAG: "Eq", - _0: [ - Test_google_closure.a, - Test_google_closure.b, - Test_google_closure.c - ], - _1: [ - "3", - 101, - [ - 1, - 2 - ] - ] - }; - }) - ], - tl: /* [] */0 -}); - -/* Not a pure module */ diff --git a/jscomp/test/google_closure_test.res b/jscomp/test/google_closure_test.res deleted file mode 100644 index 38e2e63020..0000000000 --- a/jscomp/test/google_closure_test.res +++ /dev/null @@ -1,20 +0,0 @@ -/* module Mt = Mock_mt */ - -Mt.from_pair_suites( - "Closure", - { - open Mt - list{ - ( - "partial", - _ => Eq( - { - open Test_google_closure - (a, b, c) - }, - ("3", 101, [1, 2]), - ), - ), - } - }, -) 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 0ce7961ca2..62a5074d7a 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 aacdda3c1b..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,27 +39,25 @@ 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))); } } -function make(foo) { - let partial_arg = map((function (prim) { +function make(foo, param) { + let tmp = {}; + let tmp$1 = map((function (prim) { return String(prim); }), foo); - return function (param) { - let tmp = {}; - if (partial_arg !== undefined) { - tmp.foo = partial_arg; - } - return tmp; - }; + if (tmp$1 !== undefined) { + tmp.foo = tmp$1; + } + return tmp; } -let a_ = make(undefined)(); +let a_ = make(undefined, undefined); -let b_ = make(42)(); +let b_ = make(42, undefined); eq("File \"gpr_1409_test.res\", line 26, characters 3-10", b_.foo, "42"); @@ -104,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_1409_test.res b/jscomp/test/gpr_1409_test.res index 934b850bf3..a00780abb2 100644 --- a/jscomp/test/gpr_1409_test.res +++ b/jscomp/test/gpr_1409_test.res @@ -18,7 +18,7 @@ let map = (f, x) => | Some(x) => Some(f(x)) } -let make = (~foo: option=?) => make(~foo=?map(string_of_int, foo)) +let make = (~foo: option=?, ()) => make(~foo=?map(string_of_int, foo), ()) let a_ = make() let b_ = make(~foo=42, ()) 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_1423_app_test.res b/jscomp/test/gpr_1423_app_test.res index 86a1762f1c..5ae7060ee9 100644 --- a/jscomp/test/gpr_1423_app_test.res +++ b/jscomp/test/gpr_1423_app_test.res @@ -8,10 +8,10 @@ let eq = (loc, x, y) => { let foo = f => Js.log(f(~a1="a1", ())) -let _ = foo(Gpr_1423_nav.busted(~a2="a2")) +let _ = foo(Gpr_1423_nav.busted(~a2="a2", ...)) let foo2 = f => f(~a1="a1", ()) -let () = eq(__LOC__, foo2(Gpr_1423_nav.busted(~a2="a2")), "a1a2") +let () = eq(__LOC__, foo2(Gpr_1423_nav.busted(~a2="a2", ...)), "a1a2") let () = Mt.from_pair_suites(__MODULE__, 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_1692_test.res b/jscomp/test/gpr_1692_test.res index fd789e0920..2526639b5c 100644 --- a/jscomp/test/gpr_1692_test.res +++ b/jscomp/test/gpr_1692_test.res @@ -5,5 +5,5 @@ let j = f => true f => 0 } - }("", "") + }("")("") } diff --git a/jscomp/test/gpr_1698_test.res b/jscomp/test/gpr_1698_test.res index b49992f479..37e09f9a56 100644 --- a/jscomp/test/gpr_1698_test.res +++ b/jscomp/test/gpr_1698_test.res @@ -44,4 +44,4 @@ let a = Sum(list{sym("a"), Val(Natural(2))}) let b = sym("x") type st = {complex: bool} let empty = () => {complex: true} -let _ = \"@@"(Js.log, compare(InSum, empty(), a, b)) +let _ = Js.log(compare(InSum, empty(), a, b)) 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_1946_test.res b/jscomp/test/gpr_1946_test.res index dce60f16c2..54919e2dc8 100644 --- a/jscomp/test/gpr_1946_test.res +++ b/jscomp/test/gpr_1946_test.res @@ -23,6 +23,6 @@ let f = id => { eq(__LOC__, ({"_5": 3})["_5"], 3) eq(__LOC__, (2, 3), (f(h).a, f(h).b)) -\"@@"(Js.log, Obj.tag(Obj.repr({"_5": 3}))) +Js.log(Obj.tag(Obj.repr({"_5": 3}))) Mt.from_pair_suites(__LOC__, suites.contents) diff --git a/jscomp/test/gpr_2316_test.js b/jscomp/test/gpr_2316_test.js index 8a2570b931..a46b1b1d7a 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_2608_test.js b/jscomp/test/gpr_2608_test.js index 81367dfca2..3e58451f94 100644 --- a/jscomp/test/gpr_2608_test.js +++ b/jscomp/test/gpr_2608_test.js @@ -24,18 +24,18 @@ let oppHeroes = { let huntGrootCondition = false; if (List.length(/* [] */0) > 0) { - let x = List.filter(function (h) { + let x = List.filter((function (h) { return List.hd(/* [] */0) <= 1000; - })(oppHeroes); + }), oppHeroes); huntGrootCondition = List.length(x) === 0; } let huntGrootCondition2 = true; if (List.length(/* [] */0) < 0) { - let x$1 = List.filter(function (h) { + let x$1 = List.filter((function (h) { return List.hd(/* [] */0) <= 1000; - })(oppHeroes); + }), oppHeroes); huntGrootCondition2 = List.length(x$1) === 0; } 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 850ef7b215..e58580f942 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_3697_test.res b/jscomp/test/gpr_3697_test.res index 0c11967c4d..dcf69a67af 100644 --- a/jscomp/test/gpr_3697_test.res +++ b/jscomp/test/gpr_3697_test.res @@ -2,7 +2,7 @@ type rec t<'a> = Fix(lazy_t>) let rec fix = () => Fix(Lazy.from_fun(fix)) -let rec unfixLeak = (Fix(f)) => \"@@"(unfixLeak, Lazy.force(f)) +let rec unfixLeak = (Fix(f)) => unfixLeak(Lazy.force(f)) let unfix = p => while true { 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_3931_test.res b/jscomp/test/gpr_3931_test.res index 26593086a0..5645e6af7e 100644 --- a/jscomp/test/gpr_3931_test.res +++ b/jscomp/test/gpr_3931_test.res @@ -3,7 +3,7 @@ module rec PA: { } = { /* let () = P.print 3 */ let print = { - let iter = Array.iter(P.print) + let iter = l => Array.iter(P.print, l) a => iter(a) } } diff --git a/jscomp/test/gpr_405_test.js b/jscomp/test/gpr_405_test.js index 56ec7c8456..289c165682 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); @@ -25,10 +24,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 }; @@ -58,12 +57,12 @@ function Make(funarg) { Error: new Error() }; } - 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) { @@ -81,19 +80,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 { RE_EXN_ID: "Invalid_argument", _1: "Graph.Mincut: graph not reducible", @@ -105,8 +104,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]; @@ -121,4 +120,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_4265_test.res b/jscomp/test/gpr_4265_test.res index 0db028d430..c65306c749 100644 --- a/jscomp/test/gpr_4265_test.res +++ b/jscomp/test/gpr_4265_test.res @@ -5,15 +5,15 @@ let eq = (loc, x, y) => Mt.eq_suites(~test_id, ~suites, loc, x, y) open Belt let mockMap = MutableMap.Int.make() let add = id => { - (mockMap->MutableMap.Int.set)(id, id) + MutableMap.Int.set(mockMap, id, id) id } -let remove = id => (mockMap->MutableMap.Int.remove)(id) +let remove = id => MutableMap.Int.remove(mockMap, id) let _ = add(1726) let n = add(6667) let _ = add(486) let _ = remove(1726) -let n1 = (mockMap->MutableMap.Int.getExn)(6667) +let n1 = MutableMap.Int.getExn(mockMap, 6667) eq(__LOC__, n, n1) 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_5312.js b/jscomp/test/gpr_5312.js index 237cd351ad..d285f33a5c 100644 --- a/jscomp/test/gpr_5312.js +++ b/jscomp/test/gpr_5312.js @@ -2,12 +2,10 @@ 'use strict'; -function someFunction(arg1, arg2, obj) { - obj.someFunction(arg1, arg2); -} - let MyModule = { - someFunction: someFunction + someFunction: (function (prim) { + return prim.someFunction(); + }) }; exports.MyModule = MyModule; diff --git a/jscomp/test/gpr_858_unit2_test.js b/jscomp/test/gpr_858_unit2_test.js index e296bebc5d..42f1d731f7 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; @@ -35,6 +34,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/hash_test.js b/jscomp/test/hash_test.js index e1689aae41..e16a1f3cc0 100644 --- a/jscomp/test/hash_test.js +++ b/jscomp/test/hash_test.js @@ -16,10 +16,8 @@ let test_id = { contents: 0 }; -function eq(f) { - return function (param, param$1) { - return Mt_global.collect_eq(test_id, suites, f, param, param$1); - }; +function eq(f, x, y) { + Mt_global.collect_eq(test_id, suites, f, x, y); } let test_strings = $$Array.init(32, (function (i) { @@ -69,13 +67,13 @@ function caml_hash(x) { return Hashtbl.hash(x) & 1073741823; } -Mt_global.collect_eq(test_id, suites, "File \"hash_test.res\", line 44, characters 12-19", $$Array.map(caml_hash, test_strings), test_strings_hash_results); +eq("File \"hash_test.res\", line 44, characters 12-19", $$Array.map(caml_hash, test_strings), test_strings_hash_results); -Mt_global.collect_eq(test_id, suites, "File \"hash_test.res\", line 46, characters 12-19", Hashtbl.hash(0) & 1073741823, 129913994); +eq("File \"hash_test.res\", line 46, characters 12-19", Hashtbl.hash(0) & 1073741823, 129913994); -Mt_global.collect_eq(test_id, suites, "File \"hash_test.res\", line 48, characters 12-19", Hashtbl.hash("x") & 1073741823, 780510073); +eq("File \"hash_test.res\", line 48, characters 12-19", Hashtbl.hash("x") & 1073741823, 780510073); -Mt_global.collect_eq(test_id, suites, "File \"hash_test.res\", line 50, characters 12-19", Hashtbl.hash("xy") & 1073741823, 194127723); +eq("File \"hash_test.res\", line 50, characters 12-19", Hashtbl.hash("xy") & 1073741823, 194127723); Mt.from_pair_suites("Hash_test", suites.contents); diff --git a/jscomp/test/hash_test.res b/jscomp/test/hash_test.res index 7a532f1bcf..526d552cc8 100644 --- a/jscomp/test/hash_test.res +++ b/jscomp/test/hash_test.res @@ -1,6 +1,6 @@ let suites: ref = ref(list{}) let test_id = ref(0) -let eq = f => Mt_global.collect_eq(test_id, suites, f) +let eq = (f, x, y) => Mt_global.collect_eq(test_id, suites, f, x, y) let test_strings = Array.init(32, i => String.make(i, Char.chr(i))) diff --git a/jscomp/test/hashtbl_test.js b/jscomp/test/hashtbl_test.js index 4b7983a031..c11dceffd6 100644 --- a/jscomp/test/hashtbl_test.js +++ b/jscomp/test/hashtbl_test.js @@ -20,7 +20,7 @@ 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); @@ -38,9 +38,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/hashtbl_test.res b/jscomp/test/hashtbl_test.res index 6132a5e86c..c62db83934 100644 --- a/jscomp/test/hashtbl_test.res +++ b/jscomp/test/hashtbl_test.res @@ -6,7 +6,7 @@ let f = () => { let tbl = Hashtbl.create(17) add(tbl, 1, '1') add(tbl, 2, '2') - \"@@"(List.sort(((a: int, _), (b, _)) => compare(a, b)), to_list(tbl)) + List.sort(((a: int, _), (b, _)) => compare(a, b), to_list(tbl)) } let g = count => { @@ -18,7 +18,7 @@ let g = count => { replace(tbl, i * 2, string_of_int(i)) } let v = to_list(tbl) - let v = \"@@"(List.sort(((x, _), (y: int, _)) => compare(x, y)), v) + let v = List.sort(((x, _), (y: int, _)) => compare(x, y), v) Array.of_list(v) } 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 2232d0bde6..1842c14b1a 100644 --- a/jscomp/test/imm_map_bench.js +++ b/jscomp/test/imm_map_bench.js @@ -30,14 +30,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 89bb5c14b7..7c79ad78a7 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) { @@ -121,7 +120,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", @@ -146,7 +145,7 @@ function Make(Ord) { Error: new Error() }; } - let c = Curry._2(Ord.compare, x, x_._1); + let c = Ord.compare(x, x_._1); if (c === 0) { return x_._2; } @@ -160,7 +159,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; } @@ -231,7 +230,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; @@ -254,7 +253,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; }; @@ -264,7 +263,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", @@ -281,7 +280,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", @@ -299,7 +298,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; }; @@ -310,7 +309,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)) { @@ -326,7 +325,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)) { @@ -396,7 +395,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, @@ -429,7 +428,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])); } } @@ -446,7 +445,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") { @@ -455,7 +454,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); @@ -475,7 +474,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]; @@ -525,11 +524,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; } @@ -554,10 +553,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); @@ -890,7 +889,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; }; @@ -901,7 +900,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", @@ -919,7 +918,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", @@ -938,7 +937,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; }; @@ -950,7 +949,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)) { @@ -967,7 +966,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)) { @@ -1077,7 +1076,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])); } } @@ -1094,7 +1093,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) { @@ -1104,7 +1103,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); @@ -1125,7 +1124,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]; @@ -1181,7 +1180,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; } @@ -1210,7 +1209,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); @@ -1574,7 +1573,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; }; @@ -1585,7 +1584,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", @@ -1603,7 +1602,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", @@ -1622,7 +1621,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; }; @@ -1634,7 +1633,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)) { @@ -1651,7 +1650,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)) { @@ -1761,7 +1760,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])); } } @@ -1778,7 +1777,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) { @@ -1788,7 +1787,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); @@ -1809,7 +1808,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]; @@ -1865,7 +1864,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; } @@ -1894,7 +1893,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); @@ -2003,7 +2002,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), @@ -2014,7 +2013,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 674004fdcf..7e2458b803 100644 --- a/jscomp/test/inline_map_demo.js +++ b/jscomp/test/inline_map_demo.js @@ -186,7 +186,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 05c1408e8c..b1376103da 100644 --- a/jscomp/test/inline_map_test.js +++ b/jscomp/test/inline_map_test.js @@ -170,7 +170,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..15c0c621bd 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(l) { return generic_basename((function (s, i) { return Caml_string.get(s, i) === /* '/' */47; - }), Filename.current_dir_name, param); + }), Filename.current_dir_name, l); } let suites_0 = [ diff --git a/jscomp/test/inline_regression_test.res b/jscomp/test/inline_regression_test.res index 8139912655..85e7a9a938 100644 --- a/jscomp/test/inline_regression_test.res +++ b/jscomp/test/inline_regression_test.res @@ -23,7 +23,8 @@ let generic_basename = (is_dir_sep, current_dir_name, name) => { } } -let basename = generic_basename((s, i) => String.get(s, i) == '/', Filename.current_dir_name) +let basename = l => + generic_basename((s, i) => String.get(s, i) == '/', Filename.current_dir_name, l) let suites = { open Mt 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..a2d0f1710f 100644 --- a/jscomp/test/int32_test.js +++ b/jscomp/test/int32_test.js @@ -156,7 +156,7 @@ let suites = { contents: Pervasives.$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, @@ -180,7 +180,7 @@ let suites = { }, Pervasives.$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, @@ -191,7 +191,7 @@ 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) { 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..0484535e85 100644 --- a/jscomp/test/int64_mul_div_test.js +++ b/jscomp/test/int64_mul_div_test.js @@ -5,8 +5,8 @@ let Mt = require("./mt.js"); let List = require("../../lib/js/list.js"); let $$Array = require("../../lib/js/array.js"); let Int64 = require("../../lib/js/int64.js"); +let Belt_List = require("../../lib/js/belt_List.js"); let Caml_int64 = require("../../lib/js/caml_int64.js"); -let Pervasives = require("../../lib/js/pervasives.js"); function commutative_mul(result, a, b) { return { @@ -1600,83 +1600,92 @@ 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 f = param[1]; - let i64 = param[0]; - return [ - "to_float_" + i, - (function (param) { - return { - TAG: "Eq", - _0: Caml_int64.to_float(i64), - _1: f - }; - }) - ]; -}), $$Array.to_list(to_floats)), Pervasives.$at(List.mapi((function (i, param) { - let i64 = param[1]; - let f = param[0]; - return [ - "of_float_" + i, - (function (param) { - return { - TAG: "Eq", - _0: Caml_int64.of_float(f), - _1: i64 - }; - }) - ]; -}), $$Array.to_list(of_float_pairs)), Pervasives.$at({ - hd: [ - "compare_check_complete", - (function (param) { - return { - TAG: "Eq", - _0: $$Array.map((function (param) { - return true; - }), check_complete_compare), - _1: check_complete_compare - }; - }) - ], - tl: /* [] */0 -}, Pervasives.$at(from(simple_divs), Pervasives.$at(from_compare(int64_compare_tests), { - hd: [ - "div_rem_0", - (function (param) { - return { - TAG: "Eq", - _0: Caml_int64.zero, - _1: Caml_int64.zero - }; - }) - ], - tl: { +Mt.from_pair_suites("Int64_mul_div_test", Belt_List.concatMany([ + from_pairs("random", pairs), + from_pairs("small", small_pairs), + List.mapi((function (i, param) { + let f = param[1]; + let i64 = param[0]; + return [ + "to_float_" + i, + (function () { + return { + TAG: "Eq", + _0: Caml_int64.to_float(i64), + _1: f + }; + }) + ]; + }), $$Array.to_list(to_floats)), + List.mapi((function (i, param) { + let i64 = param[1]; + let f = param[0]; + return [ + "of_float_" + i, + (function () { + return { + TAG: "Eq", + _0: Caml_int64.of_float(f), + _1: i64 + }; + }) + ]; + }), $$Array.to_list(of_float_pairs)), + { hd: [ - "div_rem_1", - (function (param) { + "compare_check_complete", + (function () { + return { + TAG: "Eq", + _0: $$Array.map((function (param) { + return true; + }), check_complete_compare), + _1: check_complete_compare + }; + }) + ], + tl: /* [] */0 + }, + from(simple_divs), + from_compare(int64_compare_tests), + { + hd: [ + "div_rem_0", + (function () { return { TAG: "Eq", - _0: Caml_int64.neg_one, - _1: Caml_int64.neg_one + _0: Caml_int64.zero, + _1: Caml_int64.zero }; }) ], tl: { hd: [ - "File \"int64_mul_div_test.res\", line 263, characters 19-26", - (function (param) { + "div_rem_1", + (function () { return { TAG: "Eq", - _0: Caml_int64.to_float(Int64.max_int), - _1: 9.22337203685477581e+18 + _0: Caml_int64.neg_one, + _1: Caml_int64.neg_one }; }) ], - tl: /* [] */0 + tl: { + hd: [ + "File \"int64_mul_div_test.res\", line 247, characters 5-12", + (function () { + return { + TAG: "Eq", + _0: Caml_int64.to_float(Int64.max_int), + _1: 9.22337203685477581e+18 + }; + }) + ], + tl: /* [] */0 + } } } -})))))))); +])); exports.commutative_mul = commutative_mul; exports.pairs = pairs; diff --git a/jscomp/test/int64_mul_div_test.res b/jscomp/test/int64_mul_div_test.res index 856cdd87b2..088104303f 100644 --- a/jscomp/test/int64_mul_div_test.res +++ b/jscomp/test/int64_mul_div_test.res @@ -26,8 +26,7 @@ let pairs = [ ] let from_pairs = (prefix, pairs) => - \"@@"( - Array.to_list, + Array.to_list( Array.mapi( (i, (result, a, b)) => ( "" ++ prefix ++ "_" ++ __unsafe_cast(i), @@ -199,77 +198,55 @@ let simple_divs = [ /* let f a b = a,b, div a b, rem a b;; */ let from = xs => - xs - |> Array.to_list - |> List.mapi((i, (a, b, c, d)) => ( - "small_divs " ++ __unsafe_cast(i), - _ => Mt.Eq((c, d), (Int64.div(a, b), Int64.rem(a, b))), - )) + List.mapi( + (i, (a, b, c, d)) => ( + "small_divs " ++ __unsafe_cast(i), + _ => Mt.Eq((c, d), (Int64.div(a, b), Int64.rem(a, b))), + ), + Array.to_list(xs), + ) let to_string = [(0L, "0")] let int64_compare_tests = [(1L, 2L, -1), (2L, 1L, 1), (2L, 1L, 1)] let from_compare = xs => - xs - |> Array.to_list - |> List.mapi((i, (a, b, c)) => ( - "int64_compare " ++ __unsafe_cast(i), - _ => Mt.Eq(c, Int64.compare(a, b)), - )) + List.mapi( + (i, (a, b, c)) => ("int64_compare " ++ __unsafe_cast(i), _ => Mt.Eq(c, Int64.compare(a, b))), + Array.to_list(xs), + ) let from_to_string = xs => - xs - |> Array.to_list - |> List.mapi((i, (a, str_a)) => ( - "to_string " ++ __unsafe_cast(i), - _ => Mt.Eq(str_a, Int64.to_string(a)), - )) + List.mapi( + (i, (a, str_a)) => ("to_string " ++ __unsafe_cast(i), _ => Mt.Eq(str_a, Int64.to_string(a))), + Array.to_list(xs), + ) -\"@@"( - Mt.from_pair_suites(__MODULE__), - \"@"( - from_pairs("random", pairs), - \"@"( - from_pairs("small", small_pairs), - \"@"( - to_floats - |> Array.to_list - |> List.mapi((i, (i64, f)) => ( - "to_float_" ++ __unsafe_cast(i), - _ => Mt.Eq(Int64.to_float(i64), f), - )), - \"@"( - of_float_pairs - |> Array.to_list - |> List.mapi((i, (f, i64)) => ( - "of_float_" ++ __unsafe_cast(i), - _ => Mt.Eq(Int64.of_float(f), i64), - )), - \"@"( - list{ - ( - "compare_check_complete", - _ => Mt.Eq(Array.map(_ => true, check_complete_compare), check_complete_compare), - ), - }, - \"@"( - from(simple_divs), - \"@"( - from_compare(int64_compare_tests), - list{ - ("div_rem_0", _ => Eq(Int64.div(-1L, 16L), 0L)), - ("div_rem_1", _ => Eq(Int64.rem(-1L, 16L), -1L)), - /* __LOC__, (fun _ -> Eq(Int64.of_float 2e65, -9223372036854775808L)) */ - (__LOC__, _ => Eq(Int64.to_float(Int64.max_int), 9.22337203685477581e+18)), - }, - ), - ), - ), - ), - ), - ), +Mt.from_pair_suites(__MODULE__, list{ + ...from_pairs("random", pairs), + ...from_pairs("small", small_pairs), + ...List.mapi( + (i, (i64, f)) => ("to_float_" ++ __unsafe_cast(i), _ => Mt.Eq(Int64.to_float(i64), f)), + Array.to_list(to_floats), ), -) + ...List.mapi( + (i, (f, i64)) => ("of_float_" ++ __unsafe_cast(i), _ => Mt.Eq(Int64.of_float(f), i64)), + Array.to_list(of_float_pairs), + ), + ...list{ + ( + "compare_check_complete", + _ => Mt.Eq(Array.map(_ => true, check_complete_compare), check_complete_compare), + ), + }, + ...from(simple_divs), + ...from_compare(int64_compare_tests), + ...list{ + ("div_rem_0", _ => Eq(Int64.div(-1L, 16L), 0L)), + ("div_rem_1", _ => Eq(Int64.rem(-1L, 16L), -1L)), + /* __LOC__, (fun _ -> Eq(Int64.of_float 2e65, -9223372036854775808L)) */ + (__LOC__, _ => Eq(Int64.to_float(Int64.max_int), 9.22337203685477581e+18)), + } +}) /* Undefined behaviorJ diff --git a/jscomp/test/int64_string_test.res b/jscomp/test/int64_string_test.res index 804eb3bfcb..f443545b6e 100644 --- a/jscomp/test/int64_string_test.res +++ b/jscomp/test/int64_string_test.res @@ -32,7 +32,7 @@ for i in 0 to 8 { __LOC__, { open Int64 - to_string(add(min_int, \"@@"(of_int, 100 + i))) + to_string(add(min_int, of_int(100 + i))) }, "-922337203685477570" ++ string_of_int(8 - i), ) @@ -42,7 +42,7 @@ for i in 0 to 8 { __LOC__, { open Int64 - to_string(add(min_int, \"@@"(of_int, 1_000_000 + i))) + to_string(add(min_int, of_int(1_000_000 + i))) }, "-922337203685377580" ++ string_of_int(8 - i), ) diff --git a/jscomp/test/int64_test.js b/jscomp/test/int64_test.js index 17dc6deb67..9106dc41ab 100644 --- a/jscomp/test/int64_test.js +++ b/jscomp/test/int64_test.js @@ -852,7 +852,7 @@ function fac(_n, _acc) { let suites = Pervasives.$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, @@ -2101,7 +2101,7 @@ let suites = Pervasives.$at({ }, Pervasives.$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, @@ -2112,7 +2112,7 @@ 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) { 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, diff --git a/jscomp/test/int_hashtbl_test.js b/jscomp/test/int_hashtbl_test.js deleted file mode 100644 index 75ca3080e8..0000000000 --- a/jscomp/test/int_hashtbl_test.js +++ /dev/null @@ -1,114 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -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) { - return { - hd: [ - k, - v - ], - tl: acc - }; - }), tbl, /* [] */0)); -} - -function g(H, count) { - let tbl = Curry._1(H.create, 17); - for(let i = 0; i <= count; ++i){ - Curry._3(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)); - } - let v = Curry._3(H.fold, (function (k, v, acc) { - return { - hd: [ - k, - v - ], - tl: acc - }; - }), tbl, /* [] */0); - return $$Array.of_list(List.sort((function (param, param$1) { - return Caml.int_compare(param[0], param$1[0]); - }), v)); -} - -let hash = Hashtbl.hash; - -function equal(x, y) { - return x === y; -} - -let Int_hash = Hashtbl.Make({ - equal: equal, - hash: hash -}); - -let suites_0 = [ - "simple", - (function (param) { - return { - TAG: "Eq", - _0: { - hd: [ - 1, - /* '1' */49 - ], - tl: { - hd: [ - 2, - /* '2' */50 - ], - tl: /* [] */0 - } - }, - _1: f(Int_hash) - }; - }) -]; - -let suites_1 = { - hd: [ - "more_iterations", - (function (param) { - return { - TAG: "Eq", - _0: $$Array.init(1001, (function (i) { - return [ - (i << 1), - String(i) - ]; - })), - _1: g(Int_hash, 1000) - }; - }) - ], - tl: /* [] */0 -}; - -let suites = { - hd: suites_0, - tl: suites_1 -}; - -Mt.from_pair_suites("Int_hashtbl_test", suites); - -exports.f = f; -exports.g = g; -exports.Int_hash = Int_hash; -exports.suites = suites; -/* Int_hash Not a pure module */ diff --git a/jscomp/test/int_hashtbl_test.res b/jscomp/test/int_hashtbl_test.res deleted file mode 100644 index cfaf7e4a94..0000000000 --- a/jscomp/test/int_hashtbl_test.res +++ /dev/null @@ -1,54 +0,0 @@ -open Hashtbl - -module type S = Hashtbl.S with type key = int - -/* -let to_list (module H : S) (tbl : 'a H.t) = - H.fold (fun k v acc -> (k,v)::acc) tbl [] -*/ - -let f = (module(H: Hashtbl.S with type key = int)) => { - /* let module Hashtbl = (val Hashtbl) in */ - let tbl = H.create(17) - H.add(tbl, 1, '1') - H.add(tbl, 2, '2') - \"@@"( - List.sort(((a: int, _), (b, _)) => compare(a, b)), - H.fold((k, v, acc) => list{(k, v), ...acc}, tbl, list{}), - ) -} - -let g = (module(H: S), count) => { - let tbl = H.create(17) - for i in 0 to count { - H.replace(tbl, i * 2, string_of_int(i)) - } - for i in 0 to count { - H.replace(tbl, i * 2, string_of_int(i)) - } - let v = H.fold((k, v, acc) => list{(k, v), ...acc}, tbl, list{}) - let v = \"@@"(List.sort(((x, _), (y: int, _)) => compare(x, y)), v) - Array.of_list(v) -} - -module Int_hash = Hashtbl.Make({ - type t = int - let hash = x => Hashtbl.hash(x) - let equal = (x: int, y) => x == y -}) - -let suites = { - open Mt - list{ - ("simple", _ => Eq(list{(1, '1'), (2, '2')}, f(module(Int_hash)))), - ( - "more_iterations", - _ => { - let count = 1000 - Eq(Array.init(count + 1, i => (2 * i, string_of_int(i))), g(module(Int_hash), count)) - }, - ), - } -} - -Mt.from_pair_suites(__MODULE__, suites) diff --git a/jscomp/test/int_map.js b/jscomp/test/int_map.js index c05570e3a0..6962d39575 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) { @@ -182,7 +181,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; @@ -197,7 +196,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; @@ -219,7 +218,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; @@ -234,7 +233,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; @@ -259,7 +258,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; @@ -274,7 +273,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; @@ -296,7 +295,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; @@ -311,7 +310,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; @@ -491,7 +490,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", @@ -511,7 +510,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); } @@ -552,7 +551,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; }; @@ -563,7 +562,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", @@ -581,7 +580,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", @@ -600,7 +599,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; }; @@ -612,7 +611,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)) { @@ -629,7 +628,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)) { @@ -739,7 +738,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])); } } @@ -756,7 +755,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) { @@ -776,7 +775,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); } @@ -786,7 +785,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); } @@ -801,7 +800,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) { @@ -826,7 +825,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]; @@ -882,7 +881,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; } @@ -911,7 +910,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_overflow_test.res b/jscomp/test/int_overflow_test.res index 598e060ffe..8102c2e8f1 100644 --- a/jscomp/test/int_overflow_test.res +++ b/jscomp/test/int_overflow_test.res @@ -91,8 +91,8 @@ Mt.from_pair_suites( ("int_literal_flow2", _ => Eq(-1l, Int32.of_int(0xffffffff))), ("int_literal_flow3", _ => Eq(-1l, Int32.of_int(0xfffffffff))), ("int32_mul", _ => Eq(-33554431l, Int32.mul(0xffffffl, 0xffffffl))), - (__LOC__, _ => Eq(\"@@"(int_of_float, Js.Float.fromString("3")), 3)), + (__LOC__, _ => Eq(int_of_float(Js.Float.fromString("3")), 3)), /* FIXME */ - (__LOC__, _ => Eq(\"@@"(int_of_float, Js.Float.fromString("3.2")), 3)), + (__LOC__, _ => Eq(int_of_float(Js.Float.fromString("3.2")), 3)), }, ) 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 0a1e938c2a..222fa625c9 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 { RE_EXN_ID: A, Error: new Error() 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_array_test.js b/jscomp/test/js_array_test.js index 5c3db77382..81da0f36a6 100644 --- a/jscomp/test/js_array_test.js +++ b/jscomp/test/js_array_test.js @@ -591,37 +591,37 @@ let suites_1 = { ], tl: { hd: [ - "join", + "joinWith", (function (param) { return { TAG: "Eq", - _0: "1,2,3", + _0: "1;2;3", _1: [ 1, 2, 3 - ].join() + ].join(";") }; }) ], tl: { hd: [ - "joinWith", + "lastIndexOf", (function (param) { return { TAG: "Eq", - _0: "1;2;3", + _0: 1, _1: [ 1, 2, 3 - ].join(";") + ].lastIndexOf(2) }; }) ], tl: { hd: [ - "lastIndexOf", + "lastIndexOfFrom", (function (param) { return { TAG: "Eq", @@ -629,36 +629,44 @@ let suites_1 = { _1: [ 1, 2, - 3 - ].lastIndexOf(2) + 3, + 2 + ].lastIndexOf(2, 2) }; }) ], tl: { hd: [ - "lastIndexOfFrom", + "slice", (function (param) { return { TAG: "Eq", - _0: 1, + _0: [ + 2, + 3 + ], _1: [ 1, 2, 3, - 2 - ].lastIndexOf(2, 2) + 4, + 5 + ].slice(1, 3) }; }) ], tl: { hd: [ - "slice", + "copy", (function (param) { return { TAG: "Eq", _0: [ + 1, 2, - 3 + 3, + 4, + 5 ], _1: [ 1, @@ -666,19 +674,17 @@ let suites_1 = { 3, 4, 5 - ].slice(1, 3) + ].slice() }; }) ], tl: { hd: [ - "copy", + "sliceFrom", (function (param) { return { TAG: "Eq", _0: [ - 1, - 2, 3, 4, 5 @@ -689,34 +695,28 @@ let suites_1 = { 3, 4, 5 - ].slice() + ].slice(2) }; }) ], tl: { hd: [ - "sliceFrom", + "toString", (function (param) { return { TAG: "Eq", - _0: [ - 3, - 4, - 5 - ], + _0: "1,2,3", _1: [ 1, 2, - 3, - 4, - 5 - ].slice(2) + 3 + ].toString() }; }) ], tl: { hd: [ - "toString", + "toLocaleString", (function (param) { return { TAG: "Eq", @@ -725,212 +725,218 @@ let suites_1 = { 1, 2, 3 - ].toString() + ].toLocaleString() }; }) ], tl: { hd: [ - "toLocaleString", + "every", (function (param) { return { TAG: "Eq", - _0: "1,2,3", + _0: true, _1: [ 1, 2, 3 - ].toLocaleString() + ].every(function (n) { + return n > 0; + }) }; }) ], tl: { hd: [ - "every", + "everyi", (function (param) { return { TAG: "Eq", - _0: true, + _0: false, _1: [ 1, 2, 3 - ].every(function (n) { - return n > 0; + ].every(function (param, i) { + return i > 0; }) }; }) ], tl: { hd: [ - "everyi", + "filter", (function (param) { return { TAG: "Eq", - _0: false, + _0: [ + 2, + 4 + ], _1: [ 1, 2, - 3 - ].every(function (param, i) { - return i > 0; + 3, + 4 + ].filter(function (n) { + return n % 2 === 0; }) }; }) ], tl: { hd: [ - "filter", + "filteri", (function (param) { return { TAG: "Eq", _0: [ - 2, - 4 + 1, + 3 ], _1: [ 1, 2, 3, 4 - ].filter(function (n) { - return n % 2 === 0; + ].filter(function (param, i) { + return i % 2 === 0; }) }; }) ], tl: { hd: [ - "filteri", + "find", (function (param) { return { TAG: "Eq", - _0: [ - 1, - 3 - ], - _1: [ + _0: 2, + _1: Caml_option.undefined_to_opt([ 1, 2, 3, 4 - ].filter(function (param, i) { - return i % 2 === 0; - }) + ].find(function (n) { + return n % 2 === 0; + })) }; }) ], tl: { hd: [ - "find", + "find - no match", (function (param) { return { TAG: "Eq", - _0: 2, + _0: undefined, _1: Caml_option.undefined_to_opt([ 1, 2, 3, 4 ].find(function (n) { - return n % 2 === 0; + return n % 2 === 5; })) }; }) ], tl: { hd: [ - "find - no match", + "findi", (function (param) { return { TAG: "Eq", - _0: undefined, + _0: 1, _1: Caml_option.undefined_to_opt([ 1, 2, 3, 4 - ].find(function (n) { - return n % 2 === 5; + ].find(function (param, i) { + return i % 2 === 0; })) }; }) ], tl: { hd: [ - "findi", + "findi - no match", (function (param) { return { TAG: "Eq", - _0: 1, + _0: undefined, _1: Caml_option.undefined_to_opt([ 1, 2, 3, 4 ].find(function (param, i) { - return i % 2 === 0; + return i % 2 === 5; })) }; }) ], tl: { hd: [ - "findi - no match", + "findIndex", (function (param) { return { TAG: "Eq", - _0: undefined, - _1: Caml_option.undefined_to_opt([ + _0: 1, + _1: [ 1, 2, 3, 4 - ].find(function (param, i) { - return i % 2 === 5; - })) + ].findIndex(function (n) { + return n % 2 === 0; + }) }; }) ], tl: { hd: [ - "findIndex", + "findIndexi", (function (param) { return { TAG: "Eq", - _0: 1, + _0: 0, _1: [ 1, 2, 3, 4 - ].findIndex(function (n) { - return n % 2 === 0; + ].findIndex(function (param, i) { + return i % 2 === 0; }) }; }) ], tl: { hd: [ - "findIndexi", + "forEach", (function (param) { + let sum = { + contents: 0 + }; + [ + 1, + 2, + 3 + ].forEach(function (n) { + sum.contents = sum.contents + n | 0; + }); return { TAG: "Eq", - _0: 0, - _1: [ - 1, - 2, - 3, - 4 - ].findIndex(function (param, i) { - return i % 2 === 0; - }) + _0: 6, + _1: sum.contents }; }) ], tl: { hd: [ - "forEach", + "forEachi", (function (param) { let sum = { contents: 0 @@ -939,34 +945,36 @@ let suites_1 = { 1, 2, 3 - ].forEach(function (n) { - sum.contents = sum.contents + n | 0; + ].forEach(function (param, i) { + sum.contents = sum.contents + i | 0; }); return { TAG: "Eq", - _0: 6, + _0: 3, _1: sum.contents }; }) ], tl: { hd: [ - "forEachi", + "map", (function (param) { - let sum = { - contents: 0 - }; - [ - 1, - 2, - 3 - ].forEach(function (param, i) { - sum.contents = sum.contents + i | 0; - }); return { TAG: "Eq", - _0: 3, - _1: sum.contents + _0: [ + 2, + 4, + 6, + 8 + ], + _1: [ + 1, + 2, + 3, + 4 + ].map(function (n) { + return (n << 1); + }) }; }) ], @@ -977,155 +985,131 @@ let suites_1 = { return { TAG: "Eq", _0: [ + 0, 2, 4, - 6, - 8 + 6 ], _1: [ 1, 2, 3, 4 - ].map(function (n) { - return (n << 1); + ].map(function (param, i) { + return (i << 1); }) }; }) ], tl: { hd: [ - "map", + "reduce", (function (param) { return { TAG: "Eq", - _0: [ - 0, - 2, - 4, - 6 - ], + _0: -10, _1: [ 1, 2, 3, 4 - ].map(function (param, i) { - return (i << 1); - }) + ].reduce((function (acc, n) { + return acc - n | 0; + }), 0) }; }) ], tl: { hd: [ - "reduce", + "reducei", (function (param) { return { TAG: "Eq", - _0: -10, + _0: -6, _1: [ 1, 2, 3, 4 - ].reduce((function (acc, n) { - return acc - n | 0; + ].reduce((function (acc, param, i) { + return acc - i | 0; }), 0) }; }) ], tl: { hd: [ - "reducei", + "reduceRight", (function (param) { return { TAG: "Eq", - _0: -6, + _0: -10, _1: [ 1, 2, 3, 4 - ].reduce((function (acc, param, i) { - return acc - i | 0; + ].reduceRight((function (acc, n) { + return acc - n | 0; }), 0) }; }) ], tl: { hd: [ - "reduceRight", + "reduceRighti", (function (param) { return { TAG: "Eq", - _0: -10, + _0: -6, _1: [ 1, 2, 3, 4 - ].reduceRight((function (acc, n) { - return acc - n | 0; + ].reduceRight((function (acc, param, i) { + return acc - i | 0; }), 0) }; }) ], tl: { hd: [ - "reduceRighti", + "some", (function (param) { return { TAG: "Eq", - _0: -6, + _0: false, _1: [ 1, 2, 3, 4 - ].reduceRight((function (acc, param, i) { - return acc - i | 0; - }), 0) + ].some(function (n) { + return n <= 0; + }) }; }) ], tl: { hd: [ - "some", + "somei", (function (param) { return { TAG: "Eq", - _0: false, + _0: true, _1: [ 1, 2, 3, 4 - ].some(function (n) { - return n <= 0; + ].some(function (param, i) { + return i <= 0; }) }; }) ], - tl: { - hd: [ - "somei", - (function (param) { - return { - TAG: "Eq", - _0: true, - _1: [ - 1, - 2, - 3, - 4 - ].some(function (param, i) { - return i <= 0; - }) - }; - }) - ], - tl: /* [] */0 - } + tl: /* [] */0 } } } diff --git a/jscomp/test/js_array_test.res b/jscomp/test/js_array_test.res index 5cf60b1b98..0f55afd2bd 100644 --- a/jscomp/test/js_array_test.res +++ b/jscomp/test/js_array_test.res @@ -113,7 +113,6 @@ let suites = { ("includes", _ => Eq(true, [1, 2, 3]->Js.Array2.includes(3))), ("indexOf", _ => Eq(1, [1, 2, 3]->Js.Array2.indexOf(2))), ("indexOfFrom", _ => Eq(3, [1, 2, 3, 2]->Js.Array2.indexOfFrom(2, ~from=2))), - ("join", _ => Eq("1,2,3", [1, 2, 3]->Js.Array.join)), ("joinWith", _ => Eq("1;2;3", [1, 2, 3]->Js.Array2.joinWith(";"))), ("lastIndexOf", _ => Eq(1, [1, 2, 3]->Js.Array2.lastIndexOf(2))), ("lastIndexOfFrom", _ => Eq(1, [1, 2, 3, 2]->Js.Array2.lastIndexOfFrom(2, ~from=2))), 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 53a6c9da30..9416b7713a 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 @@ -78,7 +77,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 @@ -94,7 +93,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){ @@ -129,18 +128,18 @@ 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 { RE_EXN_ID: "Not_found", Error: new Error() }; }), "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 { RE_EXN_ID: "Invalid_argument", _1: "x", @@ -148,7 +147,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 { RE_EXN_ID: "Invalid_argument", _1: "", @@ -156,7 +155,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 { RE_EXN_ID: A, _1: 2, @@ -164,7 +163,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 { RE_EXN_ID: A, _1: 3, @@ -172,14 +171,14 @@ 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 { RE_EXN_ID: B, Error: new Error() }; }), "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 { RE_EXN_ID: C, _1: 1, @@ -188,7 +187,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 { RE_EXN_ID: C, _1: 0, @@ -197,11 +196,11 @@ 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("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 { RE_EXN_ID: "Failure", _1: "x", diff --git a/jscomp/test/js_float_test.js b/jscomp/test/js_float_test.js index 5c509bb326..28a31f0f7a 100644 --- a/jscomp/test/js_float_test.js +++ b/jscomp/test/js_float_test.js @@ -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_float_test.res b/jscomp/test/js_float_test.res index 0d8f0f75fc..74590db7b6 100644 --- a/jscomp/test/js_float_test.res +++ b/jscomp/test/js_float_test.res @@ -24,10 +24,10 @@ let suites = { "toExponentialWithPrecision - digits:20", _ => Eq("0.00000000000000000000e+0", toExponentialWithPrecision(0., ~digits=20)), ), - (__LOC__, _ => ThrowAny(() => \"@@"(ignore, toExponentialWithPrecision(0., ~digits=101)))), + (__LOC__, _ => ThrowAny(() => ignore(toExponentialWithPrecision(0., ~digits=101)))), ( "toExponentialWithPrecision - digits:-1", - _ => ThrowAny(() => \"@@"(ignore, toExponentialWithPrecision(0., ~digits=-1))), + _ => ThrowAny(() => ignore(toExponentialWithPrecision(0., ~digits=-1))), ), ("toFixed", _ => Eq("123", toFixed(123.456))), ("toFixed - large number", _ => Eq("1.2e+21", toFixed(1.2e21))), @@ -45,11 +45,11 @@ let suites = { ), ( "toFixedWithPrecision - digits:101", - _ => ThrowAny(() => \"@@"(ignore, toFixedWithPrecision(0., ~digits=101))), + _ => ThrowAny(() => ignore(toFixedWithPrecision(0., ~digits=101))), ), ( "toFixedWithPrecision - digits:-1", - _ => ThrowAny(() => \"@@"(ignore, toFixedWithPrecision(0., ~digits=-1))), + _ => ThrowAny(() => ignore(toFixedWithPrecision(0., ~digits=-1))), ), ("toPrecision", _ => Eq("123.456", toPrecision(123.456))), ("toPrecision - large number", _ => Eq("1.2e+21", toPrecision(1.2e21))), @@ -65,10 +65,10 @@ let suites = { "toPrecisionWithPrecision - digits:20", _ => Eq("0.0000000000000000000", toPrecisionWithPrecision(0., ~digits=20)), ), - (__LOC__, _ => ThrowAny(() => \"@@"(ignore, toPrecisionWithPrecision(0., ~digits=101)))), + (__LOC__, _ => ThrowAny(() => ignore(toPrecisionWithPrecision(0., ~digits=101)))), ( "toPrecisionWithPrecision - digits:-1", - _ => ThrowAny(() => \"@@"(ignore, toPrecisionWithPrecision(0., ~digits=-1))), + _ => ThrowAny(() => ignore(toPrecisionWithPrecision(0., ~digits=-1))), ), ("toString", _ => Eq("1.23", toString(1.23))), ("toString - large number", _ => Eq("1.2e+21", toString(1.2e21))), @@ -86,15 +86,15 @@ let suites = { ("toStringWithRadix - radix:36", _ => Eq("3f", toStringWithRadix(123., ~radix=36))), ( "toStringWithRadix - radix:37", - _ => ThrowAny(() => \"@@"(ignore, toStringWithRadix(0., ~radix=37))), + _ => ThrowAny(() => ignore(toStringWithRadix(0., ~radix=37))), ), ( "toStringWithRadix - radix:1", - _ => ThrowAny(() => \"@@"(ignore, toStringWithRadix(0., ~radix=1))), + _ => ThrowAny(() => ignore(toStringWithRadix(0., ~radix=1))), ), ( "toStringWithRadix - radix:-1", - _ => ThrowAny(() => \"@@"(ignore, toStringWithRadix(0., ~radix=-1))), + _ => ThrowAny(() => ignore(toStringWithRadix(0., ~radix=-1))), ), ("fromString - 123", _ => Eq(123., fromString("123"))), ("fromString - 12.3", _ => Eq(12.3, fromString("12.3"))), 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_int_test.res b/jscomp/test/js_int_test.res index 92554452fb..1dd3d9d9b9 100644 --- a/jscomp/test/js_int_test.res +++ b/jscomp/test/js_int_test.res @@ -16,10 +16,10 @@ let suites = { "toExponentialWithPrecision - digits:20", _ => Eq("0.00000000000000000000e+0", toExponentialWithPrecision(0, ~digits=20)), ), - (__LOC__, _ => ThrowAny(() => \"@@"(ignore, toExponentialWithPrecision(0, ~digits=101)))), + (__LOC__, _ => ThrowAny(() => ignore(toExponentialWithPrecision(0, ~digits=101)))), ( "toExponentialWithPrecision - digits:-1", - _ => ThrowAny(() => \"@@"(ignore, toExponentialWithPrecision(0, ~digits=-1))), + _ => ThrowAny(() => ignore(toExponentialWithPrecision(0, ~digits=-1))), ), ("toPrecision", _ => Eq("123456", toPrecision(123456))), ( @@ -34,10 +34,10 @@ let suites = { "toPrecisionWithPrecision - digits:20", _ => Eq("0.0000000000000000000", toPrecisionWithPrecision(0, ~digits=20)), ), - (__LOC__, _ => ThrowAny(() => \"@@"(ignore, toPrecisionWithPrecision(0, ~digits=101)))), + (__LOC__, _ => ThrowAny(() => ignore(toPrecisionWithPrecision(0, ~digits=101)))), ( "toPrecisionWithPrecision - digits:-1", - _ => ThrowAny(() => \"@@"(ignore, toPrecisionWithPrecision(0, ~digits=-1))), + _ => ThrowAny(() => ignore(toPrecisionWithPrecision(0, ~digits=-1))), ), ("toString", _ => Eq("123", toString(123))), ( @@ -48,15 +48,15 @@ let suites = { ("toStringWithRadix - radix:36", _ => Eq("2n9c", toStringWithRadix(123456, ~radix=36))), ( "toStringWithRadix - radix:37", - _ => ThrowAny(() => \"@@"(ignore, toStringWithRadix(0, ~radix=37))), + _ => ThrowAny(() => ignore(toStringWithRadix(0, ~radix=37))), ), ( "toStringWithRadix - radix:1", - _ => ThrowAny(() => \"@@"(ignore, toStringWithRadix(0, ~radix=1))), + _ => ThrowAny(() => ignore(toStringWithRadix(0, ~radix=1))), ), ( "toStringWithRadix - radix:-1", - _ => ThrowAny(() => \"@@"(ignore, toStringWithRadix(0, ~radix=-1))), + _ => ThrowAny(() => ignore(toStringWithRadix(0, ~radix=-1))), ), } } diff --git a/jscomp/test/js_json_test.js b/jscomp/test/js_json_test.js index 3603dd8dcd..95d358b5b3 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,33 @@ 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 { + RE_EXN_ID: "Assert_failure", + _1: [ + "js_json_test.res", + 37, + 19 + ], + Error: new Error() + }; + } + if (ty3.TAG === "JSONNumber") { + return; + } throw { RE_EXN_ID: "Assert_failure", _1: [ @@ -106,24 +118,8 @@ add_test("File \"js_json_test.res\", line 22, characters 11-18", (function (para ], Error: new Error() }; - } - if (ty3.TAG === "JSONNumber") { - return; - } - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "js_json_test.res", - 37, - 19 - ], - Error: new Error() - }; - }); - return { - TAG: "Ok", - _0: true - }; + }), undefined)); + } })); eq("File \"js_json_test.res\", line 48, characters 5-12", Js_json.test(v, "Object"), true); @@ -134,7 +130,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 @@ -142,7 +138,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 @@ -151,7 +147,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 @@ -164,7 +160,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 @@ -173,7 +169,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 @@ -194,7 +190,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 @@ -215,7 +211,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 @@ -227,7 +223,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 @@ -240,7 +236,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 @@ -279,7 +275,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 @@ -289,7 +285,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 @@ -297,7 +293,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 @@ -306,7 +302,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 @@ -314,7 +310,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, @@ -322,7 +318,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 @@ -331,7 +327,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 @@ -339,7 +335,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 @@ -350,7 +346,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 @@ -358,7 +354,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 @@ -369,7 +365,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 @@ -378,7 +374,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 @@ -387,7 +383,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 @@ -396,7 +392,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 @@ -405,7 +401,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 @@ -414,7 +410,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 @@ -423,7 +419,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 @@ -432,7 +428,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 @@ -441,7 +437,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 @@ -454,7 +450,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 @@ -464,14 +460,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 @@ -479,7 +475,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 @@ -577,7 +573,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 @@ -586,7 +582,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 @@ -595,7 +591,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 @@ -604,7 +600,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 @@ -612,7 +608,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 @@ -620,7 +616,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 @@ -630,7 +626,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 @@ -638,7 +634,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 @@ -741,7 +737,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_json_test.res b/jscomp/test/js_json_test.res index 04086a7cce..32fdacf256 100644 --- a/jscomp/test/js_json_test.res +++ b/jscomp/test/js_json_test.res @@ -124,14 +124,14 @@ let () = { switch ty { | J.JSONObject(x) => /* Test field 'a' */ - let ta = J.classify(\"@@"(option_get, Js_dict.get(x, "a"))) + let ta = J.classify(option_get(Js_dict.get(x, "a"))) switch ta { | J.JSONString(a) => if a != "test string" { false_(__LOC__) } else { /* Test field 'b' */ - let ty = J.classify(\"@@"(option_get, Js_dict.get(x, "b"))) + let ty = J.classify(option_get(Js_dict.get(x, "b"))) switch ty { | J.JSONNumber(b) => add_test(__LOC__, _ => Mt.Approx(123.0, b)) | _ => false_(__LOC__) @@ -261,7 +261,7 @@ let () = { let ty = J.classify(x[1]) switch ty { | J.JSONObject(a1) => - let ty = \"@@"(J.classify, \"@@"(option_get, Js_dict.get(a1, "a"))) + let ty = J.classify(option_get(Js_dict.get(a1, "a"))) switch ty { | J.JSONString(aValue) => eq(__LOC__, aValue, "bbb") | _ => false_(__LOC__) @@ -301,7 +301,7 @@ let () = { eq(__LOC__, J.decodeString(J.boolean(true)), None) eq(__LOC__, J.decodeString(J.array([])), None) eq(__LOC__, J.decodeString(J.null), None) - eq(__LOC__, J.decodeString(\"@@"(J.object_, Js.Dict.empty())), None) + eq(__LOC__, J.decodeString(J.object_(Js.Dict.empty())), None) eq(__LOC__, J.decodeString(J.number(1.23)), None) } @@ -310,7 +310,7 @@ let () = { eq(__LOC__, J.decodeNumber(J.boolean(true)), None) eq(__LOC__, J.decodeNumber(J.array([])), None) eq(__LOC__, J.decodeNumber(J.null), None) - eq(__LOC__, J.decodeNumber(\"@@"(J.object_, Js.Dict.empty())), None) + eq(__LOC__, J.decodeNumber(J.object_(Js.Dict.empty())), None) eq(__LOC__, J.decodeNumber(J.number(1.23)), Some(1.23)) } @@ -319,7 +319,7 @@ let () = { eq(__LOC__, J.decodeObject(J.boolean(true)), None) eq(__LOC__, J.decodeObject(J.array([])), None) eq(__LOC__, J.decodeObject(J.null), None) - eq(__LOC__, J.decodeObject(\"@@"(J.object_, Js.Dict.empty())), Some(Js.Dict.empty())) + eq(__LOC__, J.decodeObject(J.object_(Js.Dict.empty())), Some(Js.Dict.empty())) eq(__LOC__, J.decodeObject(J.number(1.23)), None) } @@ -328,7 +328,7 @@ let () = { eq(__LOC__, J.decodeArray(J.boolean(true)), None) eq(__LOC__, J.decodeArray(J.array([])), Some([])) eq(__LOC__, J.decodeArray(J.null), None) - eq(__LOC__, J.decodeArray(\"@@"(J.object_, Js.Dict.empty())), None) + eq(__LOC__, J.decodeArray(J.object_(Js.Dict.empty())), None) eq(__LOC__, J.decodeArray(J.number(1.23)), None) } @@ -337,7 +337,7 @@ let () = { eq(__LOC__, J.decodeBoolean(J.boolean(true)), Some(true)) eq(__LOC__, J.decodeBoolean(J.array([])), None) eq(__LOC__, J.decodeBoolean(J.null), None) - eq(__LOC__, J.decodeBoolean(\"@@"(J.object_, Js.Dict.empty())), None) + eq(__LOC__, J.decodeBoolean(J.object_(Js.Dict.empty())), None) eq(__LOC__, J.decodeBoolean(J.number(1.23)), None) } @@ -346,7 +346,7 @@ let () = { eq(__LOC__, J.decodeNull(J.boolean(true)), None) eq(__LOC__, J.decodeNull(J.array([])), None) eq(__LOC__, J.decodeNull(J.null), Some(Js.null)) - eq(__LOC__, J.decodeNull(\"@@"(J.object_, Js.Dict.empty())), None) + eq(__LOC__, J.decodeNull(J.object_(Js.Dict.empty())), None) eq(__LOC__, J.decodeNull(J.number(1.23)), None) } 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/js_string_test.res b/jscomp/test/js_string_test.res index f1ae84d6d8..f1d586441f 100644 --- a/jscomp/test/js_string_test.res +++ b/jscomp/test/js_string_test.res @@ -33,7 +33,7 @@ let suites = { "match - not found capture groups", _ => Eq( Some([Some("hello "), None]), - "hello word"->Js.String2.match_(%re("/hello (world)?/"))->Belt.Option.map(Js.Array.copy), + "hello word"->Js.String2.match_(%re("/hello (world)?/"))->Belt.Option.map(Js.Array2.copy), ), ), /* es2015 */ @@ -107,14 +107,14 @@ let suites = { "splitByRe", _ => Eq( [Some("a"), Some("#"), None, Some("b"), Some("#"), Some(":"), Some("c")], - "a#b#:c" |> Js.String.splitByRe(%re("/(#)(:)?/")), + Js.String2.splitByRe("a#b#:c", %re("/(#)(:)?/")), ), ), ( "splitByReAtMost", _ => Eq( [Some("a"), Some("#"), None], - "a#b#:c" |> Js.String.splitByReAtMost(%re("/(#)(:)?/"), ~limit=3), + Js.String2.splitByReAtMost( "a#b#:c", %re("/(#)(:)?/"), ~limit=3), ), ), /* es2015 */ diff --git a/jscomp/test/js_typed_array_test.js b/jscomp/test/js_typed_array_test.js deleted file mode 100644 index 1eba182c0a..0000000000 --- a/jscomp/test/js_typed_array_test.js +++ /dev/null @@ -1,2342 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let $$Array = require("../../lib/js/array.js"); -let Curry = require("../../lib/js/curry.js"); -let Js_typed_array = require("../../lib/js/js_typed_array.js"); - -function mkI8(a) { - return new Int8Array(a); -} - -function via(make, f, arr) { - return Array.from(Curry._1(f, Curry._1(make, arr))); -} - -function viaInt8(f, arr) { - return function (param, param$1) { - return Array.from(Curry._1(param, new Int8Array(param$1))); - }; -} - -let x = new Int8Array([ - 1, - 2, - 3 - ]); - -let suites_0 = [ - "array_buffer - make", - (function (param) { - return { - TAG: "Eq", - _0: 5, - _1: new ArrayBuffer(5).byteLength - }; - }) -]; - -let suites_1 = { - hd: [ - "array_buffer - byteLength", - (function (param) { - return { - TAG: "Eq", - _0: 5, - _1: new ArrayBuffer(5).byteLength - }; - }) - ], - tl: { - hd: [ - "array_buffer - slice", - (function (param) { - return { - TAG: "Eq", - _0: 2, - _1: Js_typed_array.$$ArrayBuffer.slice(2, 4, new ArrayBuffer(5)).byteLength - }; - }) - ], - tl: { - hd: [ - "array_buffer - sliceFrom", - (function (param) { - return { - TAG: "Eq", - _0: 3, - _1: Js_typed_array.$$ArrayBuffer.sliceFrom(2, new ArrayBuffer(5)).byteLength - }; - }) - ], - tl: { - hd: [ - "typed_array - unsafe_get", - (function (param) { - return { - TAG: "Eq", - _0: 4, - _1: new Int8Array([ - 1, - 2, - 3, - 4, - 5 - ])[3] - }; - }) - ], - tl: { - hd: [ - "typed_array - unsafe_set", - (function (param) { - let a = new Int8Array([ - 1, - 2, - 3, - 4, - 5 - ]); - a[3] = 14; - return { - TAG: "Eq", - _0: 14, - _1: a[3] - }; - }) - ], - tl: { - hd: [ - "typed_array - buffer", - (function (param) { - return { - TAG: "Eq", - _0: new Int8Array([ - 3, - 4, - 5 - ]), - _1: new Int8Array(new Int8Array([ - 1, - 2, - 3, - 4, - 5 - ]).buffer, 2) - }; - }) - ], - tl: { - hd: [ - "typed_array - byteLength", - (function (param) { - return { - TAG: "Eq", - _0: 10, - _1: new Int16Array([ - 1, - 2, - 3, - 4, - 5 - ]).byteLength - }; - }) - ], - tl: { - hd: [ - "typed_array - byteOffset", - (function (param) { - return { - TAG: "Eq", - _0: 0, - _1: new Int8Array([ - 1, - 2, - 3, - 4, - 5 - ]).byteOffset - }; - }) - ], - tl: { - hd: [ - "typed_array - setArray", - (function (param) { - let f = function (a) { - Js_typed_array.$$Int8Array.setArray([ - 9, - 8, - 7 - ], a); - return a; - }; - return { - TAG: "Eq", - _0: new Int8Array([ - 9, - 8, - 7, - 4, - 5 - ]), - _1: f(new Int8Array([ - 1, - 2, - 3, - 4, - 5 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - setArrayOffset", - (function (param) { - let f = function (a) { - Js_typed_array.$$Int8Array.setArrayOffset([ - 9, - 8, - 7 - ], 2, a); - return a; - }; - return { - TAG: "Eq", - _0: new Int8Array([ - 1, - 2, - 9, - 8, - 7 - ]), - _1: f(new Int8Array([ - 1, - 2, - 3, - 4, - 5 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - length", - (function (param) { - return { - TAG: "Eq", - _0: 5, - _1: new Int8Array([ - 1, - 2, - 3, - 4, - 5 - ]).length - }; - }) - ], - tl: { - hd: [ - "typed_array - copyWithin", - (function (param) { - return { - TAG: "Eq", - _0: new Int8Array([ - 1, - 2, - 3, - 1, - 2 - ]), - _1: Js_typed_array.$$Int8Array.copyWithin(-2, new Int8Array([ - 1, - 2, - 3, - 4, - 5 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - copyWithinFrom", - (function (param) { - return { - TAG: "Eq", - _0: new Int8Array([ - 4, - 5, - 3, - 4, - 5 - ]), - _1: Js_typed_array.$$Int8Array.copyWithinFrom(0, 3, new Int8Array([ - 1, - 2, - 3, - 4, - 5 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - copyWithinFromRange", - (function (param) { - return { - TAG: "Eq", - _0: new Int8Array([ - 4, - 2, - 3, - 4, - 5 - ]), - _1: Js_typed_array.$$Int8Array.copyWithinFromRange(0, 3, 4, new Int8Array([ - 1, - 2, - 3, - 4, - 5 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - fillInPlace", - (function (param) { - return { - TAG: "Eq", - _0: new Int8Array([ - 4, - 4, - 4 - ]), - _1: Js_typed_array.$$Int8Array.fillInPlace(4, new Int8Array([ - 1, - 2, - 3 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - fillFromInPlace", - (function (param) { - return { - TAG: "Eq", - _0: new Int8Array([ - 1, - 4, - 4 - ]), - _1: Js_typed_array.$$Int8Array.fillFromInPlace(4, 1, new Int8Array([ - 1, - 2, - 3 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - fillRangeInPlace", - (function (param) { - return { - TAG: "Eq", - _0: new Int8Array([ - 1, - 4, - 3 - ]), - _1: Js_typed_array.$$Int8Array.fillRangeInPlace(4, 1, 2, new Int8Array([ - 1, - 2, - 3 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - reverseInPlace", - (function (param) { - return { - TAG: "Eq", - _0: new Int8Array([ - 3, - 2, - 1 - ]), - _1: new Int8Array([ - 1, - 2, - 3 - ]).reverse() - }; - }) - ], - tl: { - hd: [ - "typed_array - sortInPlace", - (function (param) { - return { - TAG: "Eq", - _0: new Int8Array([ - 1, - 2, - 3 - ]), - _1: new Int8Array([ - 3, - 1, - 2 - ]).sort() - }; - }) - ], - tl: { - hd: [ - "typed_array - sortInPlaceWith", - (function (param) { - return { - TAG: "Eq", - _0: new Int8Array([ - 3, - 2, - 1 - ]), - _1: Js_typed_array.$$Int8Array.sortInPlaceWith((function (a, b) { - return b - a | 0; - }), new Int8Array([ - 3, - 1, - 2 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - includes", - (function (param) { - return { - TAG: "Eq", - _0: true, - _1: Js_typed_array.$$Int8Array.includes(3, new Int8Array([ - 1, - 2, - 3 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - indexOf", - (function (param) { - return { - TAG: "Eq", - _0: 1, - _1: Js_typed_array.$$Int8Array.indexOf(2, new Int8Array([ - 1, - 2, - 3 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - indexOfFrom", - (function (param) { - return { - TAG: "Eq", - _0: 3, - _1: Js_typed_array.$$Int8Array.indexOfFrom(2, 2, new Int8Array([ - 1, - 2, - 3, - 2 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - join", - (function (param) { - return { - TAG: "Eq", - _0: "1,2,3", - _1: new Int8Array([ - 1, - 2, - 3 - ]).join() - }; - }) - ], - tl: { - hd: [ - "typed_array - joinWith", - (function (param) { - return { - TAG: "Eq", - _0: "1;2;3", - _1: Js_typed_array.$$Int8Array.joinWith(";", new Int8Array([ - 1, - 2, - 3 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - lastIndexOf", - (function (param) { - return { - TAG: "Eq", - _0: 1, - _1: Js_typed_array.$$Int8Array.lastIndexOf(2, new Int8Array([ - 1, - 2, - 3 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - lastIndexOfFrom", - (function (param) { - return { - TAG: "Eq", - _0: 1, - _1: Js_typed_array.$$Int8Array.lastIndexOfFrom(2, 2, new Int8Array([ - 1, - 2, - 3, - 2 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - slice", - (function (param) { - return { - TAG: "Eq", - _0: new Int8Array([ - 2, - 3 - ]), - _1: Js_typed_array.$$Int8Array.slice(1, 3, new Int8Array([ - 1, - 2, - 3, - 4, - 5 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - copy", - (function (param) { - return { - TAG: "Eq", - _0: new Int8Array([ - 1, - 2, - 3, - 4, - 5 - ]), - _1: new Int8Array([ - 1, - 2, - 3, - 4, - 5 - ]).slice() - }; - }) - ], - tl: { - hd: [ - "typed_array - sliceFrom", - (function (param) { - return { - TAG: "Eq", - _0: new Int8Array([ - 3, - 4, - 5 - ]), - _1: Js_typed_array.$$Int8Array.sliceFrom(2, new Int8Array([ - 1, - 2, - 3, - 4, - 5 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - subarray", - (function (param) { - return { - TAG: "Eq", - _0: new Int8Array([ - 2, - 3 - ]), - _1: Js_typed_array.$$Int8Array.subarray(1, 3, new Int8Array([ - 1, - 2, - 3, - 4, - 5 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - subarrayFrom", - (function (param) { - return { - TAG: "Eq", - _0: new Int8Array([ - 3, - 4, - 5 - ]), - _1: Js_typed_array.$$Int8Array.subarrayFrom(2, new Int8Array([ - 1, - 2, - 3, - 4, - 5 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - toString", - (function (param) { - return { - TAG: "Eq", - _0: "1,2,3", - _1: new Int8Array([ - 1, - 2, - 3 - ]).toString() - }; - }) - ], - tl: { - hd: [ - "typed_array - toLocaleString", - (function (param) { - return { - TAG: "Eq", - _0: "1,2,3", - _1: new Int8Array([ - 1, - 2, - 3 - ]).toLocaleString() - }; - }) - ], - tl: { - hd: [ - "typed_array - every", - (function (param) { - return { - TAG: "Eq", - _0: true, - _1: Js_typed_array.$$Int8Array.every((function (n) { - return n > 0; - }), new Int8Array([ - 1, - 2, - 3 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - everyi", - (function (param) { - return { - TAG: "Eq", - _0: false, - _1: Js_typed_array.$$Int8Array.everyi((function (param, i) { - return i > 0; - }), new Int8Array([ - 1, - 2, - 3 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - filter", - (function (param) { - return { - TAG: "Eq", - _0: new Int8Array([ - 2, - 4 - ]), - _1: Js_typed_array.$$Int8Array.filter((function (n) { - return n % 2 === 0; - }), new Int8Array([ - 1, - 2, - 3, - 4 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - filteri", - (function (param) { - return { - TAG: "Eq", - _0: new Int8Array([ - 1, - 3 - ]), - _1: Js_typed_array.$$Int8Array.filteri((function (param, i) { - return i % 2 === 0; - }), new Int8Array([ - 1, - 2, - 3, - 4 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - find", - (function (param) { - return { - TAG: "Eq", - _0: 2, - _1: Js_typed_array.$$Int8Array.find((function (n) { - return n % 2 === 0; - }), new Int8Array([ - 1, - 2, - 3, - 4 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - findi", - (function (param) { - return { - TAG: "Eq", - _0: 1, - _1: Js_typed_array.$$Int8Array.findi((function (param, i) { - return i % 2 === 0; - }), new Int8Array([ - 1, - 2, - 3, - 4 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - findIndex", - (function (param) { - return { - TAG: "Eq", - _0: 1, - _1: Js_typed_array.$$Int8Array.findIndex((function (n) { - return n % 2 === 0; - }), new Int8Array([ - 1, - 2, - 3, - 4 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - findIndexi", - (function (param) { - return { - TAG: "Eq", - _0: 0, - _1: Js_typed_array.$$Int8Array.findIndexi((function (param, i) { - return i % 2 === 0; - }), new Int8Array([ - 1, - 2, - 3, - 4 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - forEach", - (function (param) { - let sum = { - contents: 0 - }; - Js_typed_array.$$Int8Array.forEach((function (n) { - sum.contents = sum.contents + n | 0; - }), new Int8Array([ - 1, - 2, - 3 - ])); - return { - TAG: "Eq", - _0: 6, - _1: sum.contents - }; - }) - ], - tl: { - hd: [ - "typed_array - forEachi", - (function (param) { - let sum = { - contents: 0 - }; - Js_typed_array.$$Int8Array.forEachi((function (param, i) { - sum.contents = sum.contents + i | 0; - }), new Int8Array([ - 1, - 2, - 3 - ])); - return { - TAG: "Eq", - _0: 3, - _1: sum.contents - }; - }) - ], - tl: { - hd: [ - "typed_array - map", - (function (param) { - return { - TAG: "Eq", - _0: new Int8Array([ - 2, - 4, - 6, - 8 - ]), - _1: Js_typed_array.$$Int8Array.map((function (n) { - return (n << 1); - }), new Int8Array([ - 1, - 2, - 3, - 4 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - map", - (function (param) { - return { - TAG: "Eq", - _0: new Int8Array([ - 0, - 2, - 4, - 6 - ]), - _1: Js_typed_array.$$Int8Array.mapi((function (param, i) { - return (i << 1); - }), new Int8Array([ - 1, - 2, - 3, - 4 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - reduce", - (function (param) { - return { - TAG: "Eq", - _0: -10, - _1: Js_typed_array.$$Int8Array.reduce((function (acc, n) { - return acc - n | 0; - }), 0, new Int8Array([ - 1, - 2, - 3, - 4 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - reducei", - (function (param) { - return { - TAG: "Eq", - _0: -6, - _1: Js_typed_array.$$Int8Array.reducei((function (acc, param, i) { - return acc - i | 0; - }), 0, new Int8Array([ - 1, - 2, - 3, - 4 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - reduceRight", - (function (param) { - return { - TAG: "Eq", - _0: -10, - _1: Js_typed_array.$$Int8Array.reduceRight((function (acc, n) { - return acc - n | 0; - }), 0, new Int8Array([ - 1, - 2, - 3, - 4 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - reduceRighti", - (function (param) { - return { - TAG: "Eq", - _0: -6, - _1: Js_typed_array.$$Int8Array.reduceRighti((function (acc, param, i) { - return acc - i | 0; - }), 0, new Int8Array([ - 1, - 2, - 3, - 4 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - some", - (function (param) { - return { - TAG: "Eq", - _0: false, - _1: Js_typed_array.$$Int8Array.some((function (n) { - return n <= 0; - }), new Int8Array([ - 1, - 2, - 3, - 4 - ])) - }; - }) - ], - tl: { - hd: [ - "typed_array - somei", - (function (param) { - return { - TAG: "Eq", - _0: true, - _1: Js_typed_array.$$Int8Array.somei((function (param, i) { - return i <= 0; - }), new Int8Array([ - 1, - 2, - 3, - 4 - ])) - }; - }) - ], - tl: { - hd: [ - "int8_array - _BYTES_PER_ELEMENT", - (function (param) { - return { - TAG: "Eq", - _0: 1, - _1: Int8Array.BYTES_PER_ELEMENT - }; - }) - ], - tl: { - hd: [ - "int8_array - make", - (function (param) { - return { - TAG: "Eq", - _0: 3, - _1: new Int8Array([ - 1, - 2, - 3 - ]).byteLength - }; - }) - ], - tl: { - hd: [ - "int8_array - fromBuffer", - (function (param) { - return { - TAG: "Eq", - _0: 32, - _1: new Int8Array(new ArrayBuffer(32)).byteLength - }; - }) - ], - tl: { - hd: [ - "int8_array - fromBufferOffset", - (function (param) { - let buffer = new ArrayBuffer(32); - return { - TAG: "Eq", - _0: 24, - _1: new Int8Array(buffer, 8).byteLength - }; - }) - ], - tl: { - hd: [ - "int8_array - fromBufferRange", - (function (param) { - let buffer = new ArrayBuffer(32); - return { - TAG: "Eq", - _0: 2, - _1: new Int8Array(buffer, 8, 2).byteLength - }; - }) - ], - tl: { - hd: [ - "int8_array - fromLength", - (function (param) { - return { - TAG: "Eq", - _0: 3, - _1: new Int8Array(3).byteLength - }; - }) - ], - tl: { - hd: [ - "int8_array - unsafe_set - typed_array sanity check", - (function (param) { - let a = new Int8Array([ - 1, - 2, - 3, - 4, - 5 - ]); - a[3] = 14; - return { - TAG: "Eq", - _0: 14, - _1: a[3] - }; - }) - ], - tl: { - hd: [ - "uint8_array - _BYTES_PER_ELEMENT", - (function (param) { - return { - TAG: "Eq", - _0: 1, - _1: Uint8Array.BYTES_PER_ELEMENT - }; - }) - ], - tl: { - hd: [ - "uint8_array - make", - (function (param) { - return { - TAG: "Eq", - _0: 3, - _1: new Uint8Array([ - 1, - 2, - 3 - ]).byteLength - }; - }) - ], - tl: { - hd: [ - "uint8_array - fromBuffer", - (function (param) { - return { - TAG: "Eq", - _0: 32, - _1: new Uint8Array(new ArrayBuffer(32)).byteLength - }; - }) - ], - tl: { - hd: [ - "uint8_array - fromBufferOffset", - (function (param) { - let buffer = new ArrayBuffer(32); - return { - TAG: "Eq", - _0: 24, - _1: new Uint8Array(buffer, 8).byteLength - }; - }) - ], - tl: { - hd: [ - "uint8_array - fromBufferRange", - (function (param) { - let buffer = new ArrayBuffer(32); - return { - TAG: "Eq", - _0: 2, - _1: new Uint8Array(buffer, 8, 2).byteLength - }; - }) - ], - tl: { - hd: [ - "uint8_array - fromLength", - (function (param) { - return { - TAG: "Eq", - _0: 3, - _1: new Uint8Array(3).byteLength - }; - }) - ], - tl: { - hd: [ - "uint8_array - unsafe_set - typed_array sanity check", - (function (param) { - let a = new Uint8Array([ - 1, - 2, - 3, - 4, - 5 - ]); - a[3] = 14; - return { - TAG: "Eq", - _0: 14, - _1: a[3] - }; - }) - ], - tl: { - hd: [ - "uint8clamped_array - _BYTES_PER_ELEMENT", - (function (param) { - return { - TAG: "Eq", - _0: 1, - _1: Uint8ClampedArray.BYTES_PER_ELEMENT - }; - }) - ], - tl: { - hd: [ - "uint8clamped_array - make", - (function (param) { - return { - TAG: "Eq", - _0: 3, - _1: new Uint8ClampedArray([ - 1, - 2, - 3 - ]).byteLength - }; - }) - ], - tl: { - hd: [ - "uint8clamped_array - fromBuffer", - (function (param) { - return { - TAG: "Eq", - _0: 32, - _1: new Uint8ClampedArray(new ArrayBuffer(32)).byteLength - }; - }) - ], - tl: { - hd: [ - "uint8clamped_array - fromBufferOffset", - (function (param) { - let buffer = new ArrayBuffer(32); - return { - TAG: "Eq", - _0: 24, - _1: new Uint8ClampedArray(buffer, 8).byteLength - }; - }) - ], - tl: { - hd: [ - "uint8clamped_array - fromBufferRange", - (function (param) { - let buffer = new ArrayBuffer(32); - return { - TAG: "Eq", - _0: 2, - _1: new Uint8ClampedArray(buffer, 8, 2).byteLength - }; - }) - ], - tl: { - hd: [ - "uint8clamped_array - fromLength", - (function (param) { - return { - TAG: "Eq", - _0: 3, - _1: new Uint8ClampedArray(3).byteLength - }; - }) - ], - tl: { - hd: [ - "uint8clamped_array - unsafe_set - typed_array sanity check", - (function (param) { - let a = new Uint8ClampedArray([ - 1, - 2, - 3, - 4, - 5 - ]); - a[3] = 14; - return { - TAG: "Eq", - _0: 14, - _1: a[3] - }; - }) - ], - tl: { - hd: [ - "int16_array - _BYTES_PER_ELEMENT", - (function (param) { - return { - TAG: "Eq", - _0: 2, - _1: Int16Array.BYTES_PER_ELEMENT - }; - }) - ], - tl: { - hd: [ - "int16_array - make", - (function (param) { - return { - TAG: "Eq", - _0: 6, - _1: new Int16Array([ - 1, - 2, - 3 - ]).byteLength - }; - }) - ], - tl: { - hd: [ - "int16_array - fromBuffer", - (function (param) { - return { - TAG: "Eq", - _0: 32, - _1: new Int16Array(new ArrayBuffer(32)).byteLength - }; - }) - ], - tl: { - hd: [ - "int16_array - fromBufferOffset", - (function (param) { - let buffer = new ArrayBuffer(32); - return { - TAG: "Eq", - _0: 24, - _1: new Int16Array(buffer, 8).byteLength - }; - }) - ], - tl: { - hd: [ - "int16_array - fromBufferRange", - (function (param) { - let buffer = new ArrayBuffer(32); - return { - TAG: "Eq", - _0: 4, - _1: new Int16Array(buffer, 8, 2).byteLength - }; - }) - ], - tl: { - hd: [ - "int16_array - fromLength", - (function (param) { - return { - TAG: "Eq", - _0: 6, - _1: new Int16Array(3).byteLength - }; - }) - ], - tl: { - hd: [ - "int16_array - unsafe_set - typed_array sanity check", - (function (param) { - let a = new Int16Array([ - 1, - 2, - 3, - 4, - 5 - ]); - a[3] = 14; - return { - TAG: "Eq", - _0: 14, - _1: a[3] - }; - }) - ], - tl: { - hd: [ - "uint16_array - _BYTES_PER_ELEMENT", - (function (param) { - return { - TAG: "Eq", - _0: 2, - _1: Uint16Array.BYTES_PER_ELEMENT - }; - }) - ], - tl: { - hd: [ - "uint16_array - make", - (function (param) { - return { - TAG: "Eq", - _0: 6, - _1: new Uint16Array([ - 1, - 2, - 3 - ]).byteLength - }; - }) - ], - tl: { - hd: [ - "uint16_array - fromBuffer", - (function (param) { - return { - TAG: "Eq", - _0: 32, - _1: new Uint16Array(new ArrayBuffer(32)).byteLength - }; - }) - ], - tl: { - hd: [ - "uint16_array - fromBufferOffset", - (function (param) { - let buffer = new ArrayBuffer(32); - return { - TAG: "Eq", - _0: 24, - _1: new Uint16Array(buffer, 8).byteLength - }; - }) - ], - tl: { - hd: [ - "uint16_array - fromBufferRange", - (function (param) { - let buffer = new ArrayBuffer(32); - return { - TAG: "Eq", - _0: 4, - _1: new Uint16Array(buffer, 8, 2).byteLength - }; - }) - ], - tl: { - hd: [ - "uint16_array - fromLength", - (function (param) { - return { - TAG: "Eq", - _0: 6, - _1: new Uint16Array(3).byteLength - }; - }) - ], - tl: { - hd: [ - "uint16_array - unsafe_set - typed_array sanity check", - (function (param) { - let a = new Uint16Array([ - 1, - 2, - 3, - 4, - 5 - ]); - a[3] = 14; - return { - TAG: "Eq", - _0: 14, - _1: a[3] - }; - }) - ], - tl: { - hd: [ - "int32_array - _BYTES_PER_ELEMENT", - (function (param) { - return { - TAG: "Eq", - _0: 4, - _1: Int32Array.BYTES_PER_ELEMENT - }; - }) - ], - tl: { - hd: [ - "int32_array - make", - (function (param) { - return { - TAG: "Eq", - _0: 12, - _1: new Int32Array($$Array.map((function (prim) { - return prim; - }), [ - 1, - 2, - 3 - ])).byteLength - }; - }) - ], - tl: { - hd: [ - "int32_array - fromBuffer", - (function (param) { - return { - TAG: "Eq", - _0: 32, - _1: new Int32Array(new ArrayBuffer(32)).byteLength - }; - }) - ], - tl: { - hd: [ - "int32_array - fromBufferOffset", - (function (param) { - let buffer = new ArrayBuffer(32); - return { - TAG: "Eq", - _0: 24, - _1: new Int32Array(buffer, 8).byteLength - }; - }) - ], - tl: { - hd: [ - "int32_array - fromBufferRange", - (function (param) { - let buffer = new ArrayBuffer(32); - return { - TAG: "Eq", - _0: 8, - _1: new Int32Array(buffer, 8, 2).byteLength - }; - }) - ], - tl: { - hd: [ - "int32_array - fromLength", - (function (param) { - return { - TAG: "Eq", - _0: 12, - _1: new Int32Array(3).byteLength - }; - }) - ], - tl: { - hd: [ - "int32_array - unsafe_set - typed_array sanity check", - (function (param) { - let a = new Int32Array($$Array.map((function (prim) { - return prim; - }), [ - 1, - 2, - 3, - 4, - 5 - ])); - a[3] = 14; - return { - TAG: "Eq", - _0: 14, - _1: a[3] - }; - }) - ], - tl: { - hd: [ - "uint32_array - _BYTES_PER_ELEMENT", - (function (param) { - return { - TAG: "Eq", - _0: 4, - _1: Uint32Array.BYTES_PER_ELEMENT - }; - }) - ], - tl: { - hd: [ - "uint32_array - make", - (function (param) { - return { - TAG: "Eq", - _0: 12, - _1: new Uint32Array([ - 1, - 2, - 3 - ]).byteLength - }; - }) - ], - tl: { - hd: [ - "uint32_array - fromBuffer", - (function (param) { - return { - TAG: "Eq", - _0: 32, - _1: new Uint32Array(new ArrayBuffer(32)).byteLength - }; - }) - ], - tl: { - hd: [ - "uint32_array - fromBufferOffset", - (function (param) { - let buffer = new ArrayBuffer(32); - return { - TAG: "Eq", - _0: 24, - _1: new Uint32Array(buffer, 8).byteLength - }; - }) - ], - tl: { - hd: [ - "uint32_array - fromBufferRange", - (function (param) { - let buffer = new ArrayBuffer(32); - return { - TAG: "Eq", - _0: 8, - _1: new Uint32Array(buffer, 8, 2).byteLength - }; - }) - ], - tl: { - hd: [ - "uint32_array - fromLength", - (function (param) { - return { - TAG: "Eq", - _0: 12, - _1: new Uint32Array(3).byteLength - }; - }) - ], - tl: { - hd: [ - "uint32_array - unsafe_set - typed_array sanity check", - (function (param) { - let a = new Uint32Array([ - 1, - 2, - 3, - 4, - 5 - ]); - a[3] = 14; - return { - TAG: "Eq", - _0: 14, - _1: a[3] - }; - }) - ], - tl: { - hd: [ - "float32_array - _BYTES_PER_ELEMENT", - (function (param) { - return { - TAG: "Eq", - _0: 4, - _1: Float32Array.BYTES_PER_ELEMENT - }; - }) - ], - tl: { - hd: [ - "float32_array - make", - (function (param) { - return { - TAG: "Eq", - _0: 12, - _1: new Float32Array([ - 1, - 2, - 3 - ]).byteLength - }; - }) - ], - tl: { - hd: [ - "float32_array - fromBuffer", - (function (param) { - return { - TAG: "Eq", - _0: 32, - _1: new Float32Array(new ArrayBuffer(32)).byteLength - }; - }) - ], - tl: { - hd: [ - "float32_array - fromBufferOffset", - (function (param) { - let buffer = new ArrayBuffer(32); - return { - TAG: "Eq", - _0: 24, - _1: new Float32Array(buffer, 8).byteLength - }; - }) - ], - tl: { - hd: [ - "float32_array - fromBufferRange", - (function (param) { - let buffer = new ArrayBuffer(32); - return { - TAG: "Eq", - _0: 8, - _1: new Float32Array(buffer, 8, 2).byteLength - }; - }) - ], - tl: { - hd: [ - "float32_array - fromLength", - (function (param) { - return { - TAG: "Eq", - _0: 12, - _1: new Float32Array(3).byteLength - }; - }) - ], - tl: { - hd: [ - "float32_array - unsafe_set - typed_array sanity check", - (function (param) { - let a = new Float32Array([ - 1, - 2, - 3, - 4, - 5 - ]); - a[3] = 14; - return { - TAG: "Eq", - _0: 14, - _1: a[3] - }; - }) - ], - tl: { - hd: [ - "float64_array - _BYTES_PER_ELEMENT", - (function (param) { - return { - TAG: "Eq", - _0: 8, - _1: Float64Array.BYTES_PER_ELEMENT - }; - }) - ], - tl: { - hd: [ - "float64_array - make", - (function (param) { - return { - TAG: "Eq", - _0: 24, - _1: new Float64Array([ - 1, - 2, - 3 - ]).byteLength - }; - }) - ], - tl: { - hd: [ - "float64_array - fromBuffer", - (function (param) { - return { - TAG: "Eq", - _0: 32, - _1: new Float64Array(new ArrayBuffer(32)).byteLength - }; - }) - ], - tl: { - hd: [ - "float64_array - fromBufferOffset", - (function (param) { - let buffer = new ArrayBuffer(32); - return { - TAG: "Eq", - _0: 24, - _1: new Float64Array(buffer, 8).byteLength - }; - }) - ], - tl: { - hd: [ - "float64_array - fromBufferRange", - (function (param) { - let buffer = new ArrayBuffer(32); - return { - TAG: "Eq", - _0: 16, - _1: new Float64Array(buffer, 8, 2).byteLength - }; - }) - ], - tl: { - hd: [ - "float64_array - fromLength", - (function (param) { - return { - TAG: "Eq", - _0: 24, - _1: new Float64Array(3).byteLength - }; - }) - ], - tl: { - hd: [ - "float64_array - unsafe_set - typed_array sanity check", - (function (param) { - let a = new Float64Array([ - 1, - 2, - 3, - 4, - 5 - ]); - a[3] = 14; - return { - TAG: "Eq", - _0: 14, - _1: a[3] - }; - }) - ], - tl: { - hd: [ - "DataView - make, byteLength", - (function (param) { - return { - TAG: "Eq", - _0: 32, - _1: new DataView(new ArrayBuffer(32)).byteLength - }; - }) - ], - tl: { - hd: [ - "DataView - fromBuffer", - (function (param) { - return { - TAG: "Eq", - _0: 32, - _1: new DataView(new ArrayBuffer(32)).byteLength - }; - }) - ], - tl: { - hd: [ - "DataView - fromBufferOffset", - (function (param) { - let buffer = new ArrayBuffer(32); - return { - TAG: "Eq", - _0: 24, - _1: new DataView(buffer, 8).byteLength - }; - }) - ], - tl: { - hd: [ - "DataView - fromBufferRange", - (function (param) { - let buffer = new ArrayBuffer(32); - return { - TAG: "Eq", - _0: 4, - _1: new DataView(buffer, 8, 4).byteLength - }; - }) - ], - tl: { - hd: [ - "DataView - buffer", - (function (param) { - let buffer = new ArrayBuffer(32); - return { - TAG: "Eq", - _0: buffer, - _1: new DataView(buffer).buffer - }; - }) - ], - tl: { - hd: [ - "DataView - byteOffset", - (function (param) { - let buffer = new ArrayBuffer(32); - return { - TAG: "Eq", - _0: 8, - _1: new DataView(buffer, 8).byteOffset - }; - }) - ], - tl: { - hd: [ - "DataView - setInt8, getInt8", - (function (param) { - let buffer = new ArrayBuffer(8); - let view = new DataView(buffer); - view.setInt8(0, 1); - return { - TAG: "Eq", - _0: 1, - _1: view.getInt8(0) - }; - }) - ], - tl: { - hd: [ - "DataView - setUint8, getUint8", - (function (param) { - let buffer = new ArrayBuffer(8); - let view = new DataView(buffer); - view.setUint8(0, 128); - return { - TAG: "Eq", - _0: 128, - _1: view.getUint8(0) - }; - }) - ], - tl: { - hd: [ - "DataView - setInt16, getInt16", - (function (param) { - let buffer = new ArrayBuffer(8); - let view = new DataView(buffer); - view.setInt16(0, 257); - return { - TAG: "Eq", - _0: 257, - _1: view.getInt16(0) - }; - }) - ], - tl: { - hd: [ - "DataView - getInt16LittleEndian", - (function (param) { - let buffer = new ArrayBuffer(8); - let view = new DataView(buffer); - view.setInt16(0, 25000, 1); - return { - TAG: "Eq", - _0: 25000, - _1: view.getInt16(0, 1) - }; - }) - ], - tl: { - hd: [ - "DataView - setInt16LittleEndian", - (function (param) { - let buffer = new ArrayBuffer(8); - let view = new DataView(buffer); - view.setInt16(0, 25000, 1); - return { - TAG: "Eq", - _0: -22431, - _1: view.getInt16(0) - }; - }) - ], - tl: { - hd: [ - "DataView - setUint16, getUint16", - (function (param) { - let buffer = new ArrayBuffer(8); - let view = new DataView(buffer); - view.setUint16(0, 32768); - return { - TAG: "Eq", - _0: 32768, - _1: view.getUint16(0) - }; - }) - ], - tl: { - hd: [ - "DataView - getUint16LittleEndian", - (function (param) { - let buffer = new ArrayBuffer(8); - let view = new DataView(buffer); - view.setUint16(0, 32768, 1); - return { - TAG: "Eq", - _0: 32768, - _1: view.getUint16(0, 1) - }; - }) - ], - tl: { - hd: [ - "DataView - setUint16LittleEndian", - (function (param) { - let buffer = new ArrayBuffer(8); - let view = new DataView(buffer); - view.setUint16(0, 32768, 1); - return { - TAG: "Eq", - _0: 128, - _1: view.getUint16(0) - }; - }) - ], - tl: { - hd: [ - "DataView - setInt32, getInt32", - (function (param) { - let buffer = new ArrayBuffer(8); - let view = new DataView(buffer); - view.setInt32(0, 65537); - return { - TAG: "Eq", - _0: 65537, - _1: view.getInt32(0) - }; - }) - ], - tl: { - hd: [ - "DataView - getInt32LittleEndian", - (function (param) { - let buffer = new ArrayBuffer(8); - let view = new DataView(buffer); - view.setInt32(0, 65537, 1); - return { - TAG: "Eq", - _0: 65537, - _1: view.getInt32(0, 1) - }; - }) - ], - tl: { - hd: [ - "DataView - setInt32LittleEndian", - (function (param) { - let buffer = new ArrayBuffer(8); - let view = new DataView(buffer); - view.setInt32(0, 65537, 1); - return { - TAG: "Eq", - _0: 16777472, - _1: view.getInt32(0) - }; - }) - ], - tl: { - hd: [ - "DataView - setUint32, getUint32", - (function (param) { - let buffer = new ArrayBuffer(8); - let view = new DataView(buffer); - view.setUint32(0, 65537); - return { - TAG: "Eq", - _0: 65537, - _1: view.getUint32(0) - }; - }) - ], - tl: { - hd: [ - "DataView - getUint32LittleEndian", - (function (param) { - let buffer = new ArrayBuffer(8); - let view = new DataView(buffer); - view.setUint32(0, 65537, 1); - return { - TAG: "Eq", - _0: 65537, - _1: view.getUint32(0, 1) - }; - }) - ], - tl: { - hd: [ - "DataView - setUint32LittleEndian", - (function (param) { - let buffer = new ArrayBuffer(8); - let view = new DataView(buffer); - view.setUint32(0, 65537, 1); - return { - TAG: "Eq", - _0: 16777472, - _1: view.getUint32(0) - }; - }) - ], - tl: { - hd: [ - "DataView - setFloat32, getFloat32", - (function (param) { - let buffer = new ArrayBuffer(8); - let view = new DataView(buffer); - view.setFloat32(0, 65537.0); - return { - TAG: "Eq", - _0: 65537.0, - _1: view.getFloat32(0) - }; - }) - ], - tl: { - hd: [ - "DataView - getFloat32LittleEndian", - (function (param) { - let buffer = new ArrayBuffer(8); - let view = new DataView(buffer); - view.setFloat32(0, 65537.0, 1); - return { - TAG: "Eq", - _0: 65537.0, - _1: view.getFloat32(0, 1) - }; - }) - ], - tl: { - hd: [ - "DataView - setFloat32LittleEndian", - (function (param) { - let buffer = new ArrayBuffer(8); - let view = new DataView(buffer); - view.setFloat32(0, 1.0, 1); - return { - TAG: "Eq", - _0: 4.600602988224807e-41, - _1: view.getFloat32(0) - }; - }) - ], - tl: { - hd: [ - "DataView - setFloat64, getFloat64", - (function (param) { - let buffer = new ArrayBuffer(8); - let view = new DataView(buffer); - view.setFloat64(0, 1e200); - return { - TAG: "Eq", - _0: 1e200, - _1: view.getFloat64(0) - }; - }) - ], - tl: { - hd: [ - "DataView - getFloat64LittleEndian", - (function (param) { - let buffer = new ArrayBuffer(8); - let view = new DataView(buffer); - view.setFloat64(0, 1e200, 1); - return { - TAG: "Eq", - _0: 1e200, - _1: view.getFloat64(0, 1) - }; - }) - ], - tl: { - hd: [ - "DataView - setFloat64LittleEndian", - (function (param) { - let buffer = new ArrayBuffer(8); - let view = new DataView(buffer); - view.setFloat64(0, 1.0, 1); - return { - TAG: "Eq", - _0: 3.03865e-319, - _1: view.getFloat64(0) - }; - }) - ], - tl: /* [] */0 - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } -}; - -let suites = { - hd: suites_0, - tl: suites_1 -}; - -Mt.from_pair_suites("Js_typed_array_test", suites); - -exports.mkI8 = mkI8; -exports.via = via; -exports.viaInt8 = viaInt8; -exports.x = x; -exports.suites = suites; -/* x Not a pure module */ diff --git a/jscomp/test/js_typed_array_test.res b/jscomp/test/js_typed_array_test.res deleted file mode 100644 index d86763e0b9..0000000000 --- a/jscomp/test/js_typed_array_test.res +++ /dev/null @@ -1,889 +0,0 @@ -open Js_typed_array - -@val external arrayFrom: 'a => array<'b> = "Array.from" - -let mkI8 = a => Int8Array.make(a) -let via = (make, f, arr) => arrayFrom(f(make(arr))) -let viaInt8 = (f, arr) => via(Int8Array.make) - -/* make sure we expose a type that's easy to refer to */ -let x: Int8Array.t = mkI8([1, 2, 3]) - -let suites = { - open Mt - list{ - /* ArrayBuffer - */ - - ("array_buffer - make", _ => Eq(5, ArrayBuffer.make(5) |> ArrayBuffer.byteLength)), - /* experimental - "array_buffer - transfer", (fun _ -> - Eq(5, ArrayBuffer.make 5 |> ArrayBuffer.transfer |> ArrayBuffer.byteLength)); - "array_buffer - transferWithLength", (fun _ -> - let a = ArrayBuffer.make 5 in - Eq(10, ArrayBuffer.transferWithLength a 10 |> ArrayBuffer.byteLength)); - */ - - ("array_buffer - byteLength", _ => Eq(5, ArrayBuffer.make(5) |> ArrayBuffer.byteLength)), - ( - "array_buffer - slice", - _ => Eq( - 2, - ArrayBuffer.make(5) |> ArrayBuffer.slice(~start=2, ~end_=4) |> ArrayBuffer.byteLength, - ), - ), - ( - "array_buffer - sliceFrom", - _ => Eq(3, ArrayBuffer.make(5) |> ArrayBuffer.sliceFrom(2) |> ArrayBuffer.byteLength), - ), - /* Generic typed array - */ - - ("typed_array - unsafe_get", _ => Eq(4, Int8Array.unsafe_get(mkI8([1, 2, 3, 4, 5]), 3))), - ( - "typed_array - unsafe_set", - _ => { - let a = mkI8([1, 2, 3, 4, 5]) - let _ = Int8Array.unsafe_set(a, 3, 14) - - Eq(14, Int8Array.unsafe_get(a, 3)) - }, - ), - ( - "typed_array - buffer", - _ => Eq( - mkI8([3, 4, 5]), - mkI8([1, 2, 3, 4, 5]) - |> Int8Array.buffer - |> ( - x => - switch x { - | a => Int8Array.fromBufferOffset(a, 2) - } - ), - ), - ), - ( - "typed_array - byteLength", - _ => Eq(10, Int16Array.make([1, 2, 3, 4, 5]) |> Int16Array.byteLength), - ), - ("typed_array - byteOffset", _ => Eq(0, mkI8([1, 2, 3, 4, 5]) |> Int8Array.byteOffset)), - ( - "typed_array - setArray", - _ => { - let f = a => { - Int8Array.setArray([9, 8, 7], a) - a - } - - Eq(mkI8([9, 8, 7, 4, 5]), mkI8([1, 2, 3, 4, 5]) |> f) - }, - ), - ( - "typed_array - setArrayOffset", - _ => { - let f = a => { - Int8Array.setArrayOffset([9, 8, 7], 2, a) - a - } - - Eq(mkI8([1, 2, 9, 8, 7]), mkI8([1, 2, 3, 4, 5]) |> f) - }, - ), - /* These shouldn't compile - "type_safe_sanity_check 1", (fun _ -> - let a = Float32Array.make [| 1.; 2.; 3.; 4.; 5. |] in - let _ = Int8Array.set a 3 14 in - - Eq(14, Int8Array.get a 3) - ); - "type_safe_sanity_check 2", (fun _ -> - let a = Int16Array.make [| 1; 2; 3; 4; 5 |] in - let _ = Int8Array.set a 3 14 in - - Eq(14, Int8Array.get a 3) - ); - */ - - /* Array itnerface(-ish) */ - - ("typed_array - length", _ => Eq(5, mkI8([1, 2, 3, 4, 5]) |> Int8Array.length)), - ( - "typed_array - copyWithin", - _ => Eq(mkI8([1, 2, 3, 1, 2]), mkI8([1, 2, 3, 4, 5]) |> Int8Array.copyWithin(~to_=-2)), - ), - ( - "typed_array - copyWithinFrom", - _ => Eq( - mkI8([4, 5, 3, 4, 5]), - mkI8([1, 2, 3, 4, 5]) |> Int8Array.copyWithinFrom(~to_=0, ~from=3), - ), - ), - ( - "typed_array - copyWithinFromRange", - _ => Eq( - mkI8([4, 2, 3, 4, 5]), - mkI8([1, 2, 3, 4, 5]) |> Int8Array.copyWithinFromRange(~to_=0, ~start=3, ~end_=4), - ), - ), - ( - "typed_array - fillInPlace", - _ => Eq(mkI8([4, 4, 4]), mkI8([1, 2, 3]) |> Int8Array.fillInPlace(4)), - ), - ( - "typed_array - fillFromInPlace", - _ => Eq(mkI8([1, 4, 4]), mkI8([1, 2, 3]) |> Int8Array.fillFromInPlace(4, ~from=1)), - ), - ( - "typed_array - fillRangeInPlace", - _ => Eq(mkI8([1, 4, 3]), mkI8([1, 2, 3]) |> Int8Array.fillRangeInPlace(4, ~start=1, ~end_=2)), - ), - ( - "typed_array - reverseInPlace", - _ => Eq(mkI8([3, 2, 1]), mkI8([1, 2, 3]) |> Int8Array.reverseInPlace), - ), - ( - "typed_array - sortInPlace", - _ => Eq(mkI8([1, 2, 3]), mkI8([3, 1, 2]) |> Int8Array.sortInPlace), - ), - ( - "typed_array - sortInPlaceWith", - _ => Eq(mkI8([3, 2, 1]), mkI8([3, 1, 2]) |> Int8Array.sortInPlaceWith((. a, b) => b - a)), - ), - /* es2016 */ - ("typed_array - includes", _ => Eq(true, mkI8([1, 2, 3]) |> Int8Array.includes(3))), - ("typed_array - indexOf", _ => Eq(1, mkI8([1, 2, 3]) |> Int8Array.indexOf(2))), - ( - "typed_array - indexOfFrom", - _ => Eq(3, mkI8([1, 2, 3, 2]) |> Int8Array.indexOfFrom(2, ~from=2)), - ), - ("typed_array - join", _ => Eq("1,2,3", mkI8([1, 2, 3]) |> Int8Array.join)), - ("typed_array - joinWith", _ => Eq("1;2;3", mkI8([1, 2, 3]) |> Int8Array.joinWith(";"))), - ("typed_array - lastIndexOf", _ => Eq(1, mkI8([1, 2, 3]) |> Int8Array.lastIndexOf(2))), - ( - "typed_array - lastIndexOfFrom", - _ => Eq(1, mkI8([1, 2, 3, 2]) |> Int8Array.lastIndexOfFrom(2, ~from=2)), - ), - ( - "typed_array - slice", - _ => Eq(mkI8([2, 3]), mkI8([1, 2, 3, 4, 5]) |> Int8Array.slice(~start=1, ~end_=3)), - ), - ("typed_array - copy", _ => Eq(mkI8([1, 2, 3, 4, 5]), mkI8([1, 2, 3, 4, 5]) |> Int8Array.copy)), - ( - "typed_array - sliceFrom", - _ => Eq(mkI8([3, 4, 5]), mkI8([1, 2, 3, 4, 5]) |> Int8Array.sliceFrom(2)), - ), - ( - "typed_array - subarray", - _ => Eq(mkI8([2, 3]), mkI8([1, 2, 3, 4, 5]) |> Int8Array.subarray(~start=1, ~end_=3)), - ), - ( - "typed_array - subarrayFrom", - _ => Eq(mkI8([3, 4, 5]), mkI8([1, 2, 3, 4, 5]) |> Int8Array.subarrayFrom(2)), - ), - ("typed_array - toString", _ => Eq("1,2,3", mkI8([1, 2, 3]) |> Int8Array.toString)), - ("typed_array - toLocaleString", _ => Eq("1,2,3", mkI8([1, 2, 3]) |> Int8Array.toLocaleString)), - /* es2015, iterator - "typed_array - entries", (fun _ -> - Eq(mkI8 [| (0, "a"); (1, "b"); (2, "c") |], - mkI8 [| "a"; "b"; "c" |] |> Int8Array.entries |> Int8Array.from) - ); - */ - - ("typed_array - every", _ => Eq(true, mkI8([1, 2, 3]) |> Int8Array.every((. n) => n > 0))), - ( - "typed_array - everyi", - _ => Eq(false, mkI8([1, 2, 3]) |> Int8Array.everyi((. _, i) => i > 0)), - ), - ( - "typed_array - filter", - _ => Eq(mkI8([2, 4]), mkI8([1, 2, 3, 4]) |> Int8Array.filter((. n) => mod(n, 2) == 0)), - ), - ( - "typed_array - filteri", - _ => Eq(mkI8([1, 3]), mkI8([1, 2, 3, 4]) |> Int8Array.filteri((. _, i) => mod(i, 2) == 0)), - ), - ( - "typed_array - find", - _ => Eq( - Js.Undefined.return(2), - mkI8([1, 2, 3, 4]) |> Int8Array.find((. n) => mod(n, 2) == 0), - ), - ), - ( - "typed_array - findi", - _ => Eq( - Js.Undefined.return(1), - mkI8([1, 2, 3, 4]) |> Int8Array.findi((. _, i) => mod(i, 2) == 0), - ), - ), - ( - "typed_array - findIndex", - _ => Eq(1, mkI8([1, 2, 3, 4]) |> Int8Array.findIndex((. n) => mod(n, 2) == 0)), - ), - ( - "typed_array - findIndexi", - _ => Eq(0, mkI8([1, 2, 3, 4]) |> Int8Array.findIndexi((. _, i) => mod(i, 2) == 0)), - ), - ( - "typed_array - forEach", - _ => { - let sum = ref(0) - let _ = mkI8([1, 2, 3]) |> Int8Array.forEach((. n) => sum := sum.contents + n) - - Eq(6, sum.contents) - }, - ), - ( - "typed_array - forEachi", - _ => { - let sum = ref(0) - let _ = mkI8([1, 2, 3]) |> Int8Array.forEachi((. _, i) => sum := sum.contents + i) - - Eq(3, sum.contents) - }, - ), - /* es2015, iterator - "typed_array - keys", (fun _ -> - Eq(mkI8 [| 0; 1; 2 |], - mkI8 [| "a"; "b"; "c" |] |> Int8Array.keys |> Int8Array.from) - ); - */ - - ( - "typed_array - map", - _ => Eq(mkI8([2, 4, 6, 8]), mkI8([1, 2, 3, 4]) |> Int8Array.map((. n) => n * 2)), - ), - ( - "typed_array - map", - _ => Eq(mkI8([0, 2, 4, 6]), mkI8([1, 2, 3, 4]) |> Int8Array.mapi((. _, i) => i * 2)), - ), - ( - "typed_array - reduce", - _ => Eq(-10, mkI8([1, 2, 3, 4]) |> Int8Array.reduce((. acc, n) => acc - n, 0)), - ), - ( - "typed_array - reducei", - _ => Eq(-6, mkI8([1, 2, 3, 4]) |> Int8Array.reducei((. acc, _, i) => acc - i, 0)), - ), - ( - "typed_array - reduceRight", - _ => Eq(-10, mkI8([1, 2, 3, 4]) |> Int8Array.reduceRight((. acc, n) => acc - n, 0)), - ), - ( - "typed_array - reduceRighti", - _ => Eq(-6, mkI8([1, 2, 3, 4]) |> Int8Array.reduceRighti((. acc, _, i) => acc - i, 0)), - ), - ("typed_array - some", _ => Eq(false, mkI8([1, 2, 3, 4]) |> Int8Array.some((. n) => n <= 0))), - ( - "typed_array - somei", - _ => Eq(true, mkI8([1, 2, 3, 4]) |> Int8Array.somei((. _, i) => i <= 0)), - ), - /* es2015, iterator - "typed_array - values", (fun _ -> - Eq(mkI8 [| "a"; "b"; "c" |], - mkI8 [| "a"; "b"; "c" |] |> Int8Array.values |> Int8Array.from) - ); - */ - - /* Int8Array - */ - - ("int8_array - _BYTES_PER_ELEMENT", _ => Eq(1, Int8Array._BYTES_PER_ELEMENT)), - /* byte length is a decent indicator of the kind of typed array */ - ("int8_array - make", _ => Eq(3, Int8Array.make([1, 2, 3]) |> Int8Array.byteLength)), - ( - "int8_array - fromBuffer", - _ => Eq(32, ArrayBuffer.make(32) |> Int8Array.fromBuffer |> Int8Array.byteLength), - ), - ( - "int8_array - fromBufferOffset", - _ => { - let buffer = ArrayBuffer.make(32) - Eq(24, Int8Array.fromBufferOffset(buffer, 8) |> Int8Array.byteLength) - }, - ), - ( - "int8_array - fromBufferRange", - _ => { - let buffer = ArrayBuffer.make(32) - Eq(2, Int8Array.fromBufferRange(buffer, ~offset=8, ~length=2) |> Int8Array.byteLength) - }, - ), - ("int8_array - fromLength", _ => Eq(3, Int8Array.fromLength(3) |> Int8Array.byteLength)), - /* unable to test because nothing currently implements array_like - "int8_array - from", (fun _ -> - Eq(3, [| "a"; "b"; "c" |] |> Js.Array.keys |> Int8Array.from |> Int8Array.byteLength)); - */ - ( - "int8_array - unsafe_set - typed_array sanity check", - _ => { - let a = Int8Array.make([1, 2, 3, 4, 5]) - let _ = Int8Array.unsafe_set(a, 3, 14) - - Eq(14, Int8Array.unsafe_get(a, 3)) - }, - ), - /* Uint8Array - */ - - ("uint8_array - _BYTES_PER_ELEMENT", _ => Eq(1, Uint8Array._BYTES_PER_ELEMENT)), - /* byte length is a decent indicator of the kind of typed array */ - ("uint8_array - make", _ => Eq(3, Uint8Array.make([1, 2, 3]) |> Uint8Array.byteLength)), - ( - "uint8_array - fromBuffer", - _ => Eq(32, ArrayBuffer.make(32) |> Uint8Array.fromBuffer |> Uint8Array.byteLength), - ), - ( - "uint8_array - fromBufferOffset", - _ => { - let buffer = ArrayBuffer.make(32) - Eq(24, Uint8Array.fromBufferOffset(buffer, 8) |> Uint8Array.byteLength) - }, - ), - ( - "uint8_array - fromBufferRange", - _ => { - let buffer = ArrayBuffer.make(32) - Eq(2, Uint8Array.fromBufferRange(buffer, ~offset=8, ~length=2) |> Uint8Array.byteLength) - }, - ), - ("uint8_array - fromLength", _ => Eq(3, Uint8Array.fromLength(3) |> Uint8Array.byteLength)), - /* unable to test because nothing currently implements array_like - "uint8_array - from", (fun _ -> - Eq(3, [| "a"; "b"; "c" |] |> Js.Array.keys |> Uint8Array.from |> Uint8Array.byteLength)); - */ - ( - "uint8_array - unsafe_set - typed_array sanity check", - _ => { - let a = Uint8Array.make([1, 2, 3, 4, 5]) - let _ = Uint8Array.unsafe_set(a, 3, 14) - - Eq(14, Uint8Array.unsafe_get(a, 3)) - }, - ), - /* Uint8ClampedArray - */ - - ("uint8clamped_array - _BYTES_PER_ELEMENT", _ => Eq(1, Uint8ClampedArray._BYTES_PER_ELEMENT)), - /* byte length is a decent indicator of the kind of typed array */ - ( - "uint8clamped_array - make", - _ => Eq(3, Uint8ClampedArray.make([1, 2, 3]) |> Uint8ClampedArray.byteLength), - ), - ( - "uint8clamped_array - fromBuffer", - _ => Eq( - 32, - ArrayBuffer.make(32) |> Uint8ClampedArray.fromBuffer |> Uint8ClampedArray.byteLength, - ), - ), - ( - "uint8clamped_array - fromBufferOffset", - _ => { - let buffer = ArrayBuffer.make(32) - Eq(24, Uint8ClampedArray.fromBufferOffset(buffer, 8) |> Uint8ClampedArray.byteLength) - }, - ), - ( - "uint8clamped_array - fromBufferRange", - _ => { - let buffer = ArrayBuffer.make(32) - Eq( - 2, - Uint8ClampedArray.fromBufferRange( - buffer, - ~offset=8, - ~length=2, - ) |> Uint8ClampedArray.byteLength, - ) - }, - ), - ( - "uint8clamped_array - fromLength", - _ => Eq(3, Uint8ClampedArray.fromLength(3) |> Uint8ClampedArray.byteLength), - ), - /* unable to test because nothing currently implements array_like - "uint8clamped_array - from", (fun _ -> - Eq(3, [| "a"; "b"; "c" |] |> Js.Array.keys |> Uint8ClampedArray.from |> Uint8ClampedArray.byteLength)); - */ - ( - "uint8clamped_array - unsafe_set - typed_array sanity check", - _ => { - let a = Uint8ClampedArray.make([1, 2, 3, 4, 5]) - let _ = Uint8ClampedArray.unsafe_set(a, 3, 14) - - Eq(14, Uint8ClampedArray.unsafe_get(a, 3)) - }, - ), - /* Int16Array - */ - - ("int16_array - _BYTES_PER_ELEMENT", _ => Eq(2, Int16Array._BYTES_PER_ELEMENT)), - /* byte length is a decent indicator of the kind of typed array */ - ("int16_array - make", _ => Eq(6, Int16Array.make([1, 2, 3]) |> Int16Array.byteLength)), - ( - "int16_array - fromBuffer", - _ => Eq(32, ArrayBuffer.make(32) |> Int16Array.fromBuffer |> Int16Array.byteLength), - ), - ( - "int16_array - fromBufferOffset", - _ => { - let buffer = ArrayBuffer.make(32) - Eq(24, Int16Array.fromBufferOffset(buffer, 8) |> Int16Array.byteLength) - }, - ), - ( - "int16_array - fromBufferRange", - _ => { - let buffer = ArrayBuffer.make(32) - Eq(4, Int16Array.fromBufferRange(buffer, ~offset=8, ~length=2) |> Int16Array.byteLength) - }, - ), - ("int16_array - fromLength", _ => Eq(6, Int16Array.fromLength(3) |> Int16Array.byteLength)), - /* unable to test because nothing currently implements array_like - "int16_array - from", (fun _ -> - Eq(3, [| "a"; "b"; "c" |] |> Js.Array.keys |> Int16Array.from |> Int16Array.byteLength)); - */ - ( - "int16_array - unsafe_set - typed_array sanity check", - _ => { - let a = Int16Array.make([1, 2, 3, 4, 5]) - let _ = Int16Array.unsafe_set(a, 3, 14) - - Eq(14, Int16Array.unsafe_get(a, 3)) - }, - ), - /* Uint16Array - */ - - ("uint16_array - _BYTES_PER_ELEMENT", _ => Eq(2, Uint16Array._BYTES_PER_ELEMENT)), - /* byte length is a decent indicator of the kind of typed array */ - ("uint16_array - make", _ => Eq(6, Uint16Array.make([1, 2, 3]) |> Uint16Array.byteLength)), - ( - "uint16_array - fromBuffer", - _ => Eq(32, ArrayBuffer.make(32) |> Uint16Array.fromBuffer |> Uint16Array.byteLength), - ), - ( - "uint16_array - fromBufferOffset", - _ => { - let buffer = ArrayBuffer.make(32) - Eq(24, Uint16Array.fromBufferOffset(buffer, 8) |> Uint16Array.byteLength) - }, - ), - ( - "uint16_array - fromBufferRange", - _ => { - let buffer = ArrayBuffer.make(32) - Eq(4, Uint16Array.fromBufferRange(buffer, ~offset=8, ~length=2) |> Uint16Array.byteLength) - }, - ), - ("uint16_array - fromLength", _ => Eq(6, Uint16Array.fromLength(3) |> Uint16Array.byteLength)), - /* unable to test because nothing currently implements array_like - "uint16_array - from", (fun _ -> - Eq(3, [| "a"; "b"; "c" |] |> Js.Array.keys |> Uint16Array.from |> Uint16Array.byteLength)); - */ - ( - "uint16_array - unsafe_set - typed_array sanity check", - _ => { - let a = Uint16Array.make([1, 2, 3, 4, 5]) - let _ = Uint16Array.unsafe_set(a, 3, 14) - - Eq(14, Uint16Array.unsafe_get(a, 3)) - }, - ), - /* Int32Array - */ - - ("int32_array - _BYTES_PER_ELEMENT", _ => Eq(4, Int32Array._BYTES_PER_ELEMENT)), - /* byte length is a decent indicator of the kind of typed array */ - ( - "int32_array - make", - _ => Eq(12, Int32Array.make([1, 2, 3] |> Array.map(Int32.of_int)) |> Int32Array.byteLength), - ), - ( - "int32_array - fromBuffer", - _ => Eq(32, ArrayBuffer.make(32) |> Int32Array.fromBuffer |> Int32Array.byteLength), - ), - ( - "int32_array - fromBufferOffset", - _ => { - let buffer = ArrayBuffer.make(32) - Eq(24, Int32Array.fromBufferOffset(buffer, 8) |> Int32Array.byteLength) - }, - ), - ( - "int32_array - fromBufferRange", - _ => { - let buffer = ArrayBuffer.make(32) - Eq(8, Int32Array.fromBufferRange(buffer, ~offset=8, ~length=2) |> Int32Array.byteLength) - }, - ), - ("int32_array - fromLength", _ => Eq(12, Int32Array.fromLength(3) |> Int32Array.byteLength)), - /* unable to test because nothing currently implements array_like - "int32_array - from", (fun _ -> - Eq(3, [| "a"; "b"; "c" |] |> Js.Array.keys |> Int32Array.from |> Int32Array.byteLength)); - */ - ( - "int32_array - unsafe_set - typed_array sanity check", - _ => { - let a = Int32Array.make([1, 2, 3, 4, 5] |> Array.map(Int32.of_int)) - let _ = Int32Array.unsafe_set(a, 3, Int32.of_int(14)) - - Eq(Int32.of_int(14), Int32Array.unsafe_get(a, 3)) - }, - ), - /* Uint32Array - */ - - ("uint32_array - _BYTES_PER_ELEMENT", _ => Eq(4, Uint32Array._BYTES_PER_ELEMENT)), - /* byte length is a decent indicator of the kind of typed array */ - ("uint32_array - make", _ => Eq(12, Uint32Array.make([1, 2, 3]) |> Uint32Array.byteLength)), - ( - "uint32_array - fromBuffer", - _ => Eq(32, ArrayBuffer.make(32) |> Uint32Array.fromBuffer |> Uint32Array.byteLength), - ), - ( - "uint32_array - fromBufferOffset", - _ => { - let buffer = ArrayBuffer.make(32) - Eq(24, Uint32Array.fromBufferOffset(buffer, 8) |> Uint32Array.byteLength) - }, - ), - ( - "uint32_array - fromBufferRange", - _ => { - let buffer = ArrayBuffer.make(32) - Eq(8, Uint32Array.fromBufferRange(buffer, ~offset=8, ~length=2) |> Uint32Array.byteLength) - }, - ), - ("uint32_array - fromLength", _ => Eq(12, Uint32Array.fromLength(3) |> Uint32Array.byteLength)), - /* unable to test because nothing currently implements array_like - "uint32_array - from", (fun _ -> - Eq(3, [| "a"; "b"; "c" |] |> Js.Array.keys |> Uint32Array.from |> Uint32Array.byteLength)); - */ - ( - "uint32_array - unsafe_set - typed_array sanity check", - _ => { - let a = Uint32Array.make([1, 2, 3, 4, 5]) - let _ = Uint32Array.unsafe_set(a, 3, 14) - - Eq(14, Uint32Array.unsafe_get(a, 3)) - }, - ), - /* Float32Array - */ - - ("float32_array - _BYTES_PER_ELEMENT", _ => Eq(4, Float32Array._BYTES_PER_ELEMENT)), - /* byte length is a decent indicator of the kind of typed array */ - ( - "float32_array - make", - _ => Eq(12, Float32Array.make([1., 2., 3.]) |> Float32Array.byteLength), - ), - ( - "float32_array - fromBuffer", - _ => Eq(32, ArrayBuffer.make(32) |> Float32Array.fromBuffer |> Float32Array.byteLength), - ), - ( - "float32_array - fromBufferOffset", - _ => { - let buffer = ArrayBuffer.make(32) - Eq(24, Float32Array.fromBufferOffset(buffer, 8) |> Float32Array.byteLength) - }, - ), - ( - "float32_array - fromBufferRange", - _ => { - let buffer = ArrayBuffer.make(32) - Eq(8, Float32Array.fromBufferRange(buffer, ~offset=8, ~length=2) |> Float32Array.byteLength) - }, - ), - ( - "float32_array - fromLength", - _ => Eq(12, Float32Array.fromLength(3) |> Float32Array.byteLength), - ), - /* unable to test because nothing currently implements array_like - "float32_array - from", (fun _ -> - Eq(3, [| "a"; "b"; "c" |] |> Js.Array.keys |> Float32Array.from |> Float32Array.byteLength)); - */ - ( - "float32_array - unsafe_set - typed_array sanity check", - _ => { - let a = Float32Array.make([1., 2., 3., 4., 5.]) - let _ = Float32Array.unsafe_set(a, 3, 14.) - - Eq(14., Float32Array.unsafe_get(a, 3)) - }, - ), - /* Float64Array - */ - - ("float64_array - _BYTES_PER_ELEMENT", _ => Eq(8, Float64Array._BYTES_PER_ELEMENT)), - /* byte length is a decent indicator of the kind of typed array */ - ( - "float64_array - make", - _ => Eq(24, Float64Array.make([1., 2., 3.]) |> Float64Array.byteLength), - ), - ( - "float64_array - fromBuffer", - _ => Eq(32, ArrayBuffer.make(32) |> Float64Array.fromBuffer |> Float64Array.byteLength), - ), - ( - "float64_array - fromBufferOffset", - _ => { - let buffer = ArrayBuffer.make(32) - Eq(24, Float64Array.fromBufferOffset(buffer, 8) |> Float64Array.byteLength) - }, - ), - ( - "float64_array - fromBufferRange", - _ => { - let buffer = ArrayBuffer.make(32) - Eq( - 16, - Float64Array.fromBufferRange(buffer, ~offset=8, ~length=2) |> Float64Array.byteLength, - ) - }, - ), - ( - "float64_array - fromLength", - _ => Eq(24, Float64Array.fromLength(3) |> Float64Array.byteLength), - ), - /* unable to test because nothing currently implements array_like - "float64_array - from", (fun _ -> - Eq(3, [| "a"; "b"; "c" |] |> Js.Array.keys |> Float64Array.from |> Float64Array.byteLength)); - */ - ( - "float64_array - unsafe_set - typed_array sanity check", - _ => { - let a = Float64Array.make([1., 2., 3., 4., 5.]) - let _ = Float64Array.unsafe_set(a, 3, 14.) - - Eq(14., Float64Array.unsafe_get(a, 3)) - }, - ), - /* DataView - */ - - ( - "DataView - make, byteLength", - _ => Eq(32, ArrayBuffer.make(32) |> DataView.make |> DataView.byteLength), - ), - ( - "DataView - fromBuffer", - _ => Eq(32, ArrayBuffer.make(32) |> DataView.fromBuffer |> DataView.byteLength), - ), - ( - "DataView - fromBufferOffset", - _ => { - let buffer = ArrayBuffer.make(32) - Eq(24, DataView.fromBufferOffset(buffer, 8) |> DataView.byteLength) - }, - ), - ( - "DataView - fromBufferRange", - _ => { - let buffer = ArrayBuffer.make(32) - Eq(4, DataView.fromBufferRange(buffer, ~offset=8, ~length=4) |> DataView.byteLength) - }, - ), - ( - "DataView - buffer", - _ => { - let buffer = ArrayBuffer.make(32) - Eq(buffer, DataView.fromBuffer(buffer) |> DataView.buffer) - }, - ), - ( - "DataView - byteOffset", - _ => { - let buffer = ArrayBuffer.make(32) - Eq(8, DataView.fromBufferOffset(buffer, 8) |> DataView.byteOffset) - }, - ), - ( - "DataView - setInt8, getInt8", - _ => { - let buffer = ArrayBuffer.make(8) - let view = DataView.make(buffer) - DataView.setInt8(view, 0, 1) - Eq(1, DataView.getInt8(view, 0)) - }, - ), - ( - "DataView - setUint8, getUint8", - _ => { - let buffer = ArrayBuffer.make(8) - let view = DataView.make(buffer) - DataView.setUint8(view, 0, 128) - Eq(128, DataView.getUint8(view, 0)) - }, - ), - ( - "DataView - setInt16, getInt16", - _ => { - let buffer = ArrayBuffer.make(8) - let view = DataView.make(buffer) - DataView.setInt16(view, 0, 257) - Eq(257, DataView.getInt16(view, 0)) - }, - ), - ( - "DataView - getInt16LittleEndian", - _ => { - let buffer = ArrayBuffer.make(8) - let view = DataView.make(buffer) - DataView.setInt16LittleEndian(view, 0, 25000) - Eq(25000, DataView.getInt16LittleEndian(view, 0)) - }, - ), - ( - "DataView - setInt16LittleEndian", - _ => { - let buffer = ArrayBuffer.make(8) - let view = DataView.make(buffer) - DataView.setInt16LittleEndian(view, 0, 25000) - Eq(-22431, DataView.getInt16(view, 0)) - }, - ), - ( - "DataView - setUint16, getUint16", - _ => { - let buffer = ArrayBuffer.make(8) - let view = DataView.make(buffer) - DataView.setUint16(view, 0, 32768) - Eq(32768, DataView.getUint16(view, 0)) - }, - ), - ( - "DataView - getUint16LittleEndian", - _ => { - let buffer = ArrayBuffer.make(8) - let view = DataView.make(buffer) - DataView.setUint16LittleEndian(view, 0, 32768) - Eq(32768, DataView.getUint16LittleEndian(view, 0)) - }, - ), - ( - "DataView - setUint16LittleEndian", - _ => { - let buffer = ArrayBuffer.make(8) - let view = DataView.make(buffer) - DataView.setUint16LittleEndian(view, 0, 32768) - Eq(128, DataView.getUint16(view, 0)) - }, - ), - ( - "DataView - setInt32, getInt32", - _ => { - let buffer = ArrayBuffer.make(8) - let view = DataView.make(buffer) - DataView.setInt32(view, 0, 65537) - Eq(65537, DataView.getInt32(view, 0)) - }, - ), - ( - "DataView - getInt32LittleEndian", - _ => { - let buffer = ArrayBuffer.make(8) - let view = DataView.make(buffer) - DataView.setInt32LittleEndian(view, 0, 65537) - Eq(65537, DataView.getInt32LittleEndian(view, 0)) - }, - ), - ( - "DataView - setInt32LittleEndian", - _ => { - let buffer = ArrayBuffer.make(8) - let view = DataView.make(buffer) - DataView.setInt32LittleEndian(view, 0, 65537) - Eq(16777472, DataView.getInt32(view, 0)) - }, - ), - /* Testing against 2_147_483_649 would be better, - but JS platform restrict us with int32 */ - ( - "DataView - setUint32, getUint32", - _ => { - let buffer = ArrayBuffer.make(8) - let view = DataView.make(buffer) - DataView.setUint32(view, 0, 65537) - Eq(65537, DataView.getUint32(view, 0)) - }, - ), - ( - "DataView - getUint32LittleEndian", - _ => { - let buffer = ArrayBuffer.make(8) - let view = DataView.make(buffer) - DataView.setUint32LittleEndian(view, 0, 65537) - Eq(65537, DataView.getUint32LittleEndian(view, 0)) - }, - ), - ( - "DataView - setUint32LittleEndian", - _ => { - let buffer = ArrayBuffer.make(8) - let view = DataView.make(buffer) - DataView.setUint32LittleEndian(view, 0, 65537) - Eq(16777472, DataView.getUint32(view, 0)) - }, - ), - ( - "DataView - setFloat32, getFloat32", - _ => { - let buffer = ArrayBuffer.make(8) - let view = DataView.make(buffer) - DataView.setFloat32(view, 0, 65537.0) - Eq(65537.0, DataView.getFloat32(view, 0)) - }, - ), - ( - "DataView - getFloat32LittleEndian", - _ => { - let buffer = ArrayBuffer.make(8) - let view = DataView.make(buffer) - DataView.setFloat32LittleEndian(view, 0, 65537.0) - Eq(65537.0, DataView.getFloat32LittleEndian(view, 0)) - }, - ), - ( - "DataView - setFloat32LittleEndian", - _ => { - let buffer = ArrayBuffer.make(8) - let view = DataView.make(buffer) - DataView.setFloat32LittleEndian(view, 0, 1.0) - Eq(4.600602988224807e-41, DataView.getFloat32(view, 0)) - }, - ), - ( - "DataView - setFloat64, getFloat64", - _ => { - let buffer = ArrayBuffer.make(8) - let view = DataView.make(buffer) - DataView.setFloat64(view, 0, 1e200) - Eq(1e200, DataView.getFloat64(view, 0)) - }, - ), - ( - "DataView - getFloat64LittleEndian", - _ => { - let buffer = ArrayBuffer.make(8) - let view = DataView.make(buffer) - DataView.setFloat64LittleEndian(view, 0, 1e200) - Eq(1e200, DataView.getFloat64LittleEndian(view, 0)) - }, - ), - ( - "DataView - setFloat64LittleEndian", - _ => { - let buffer = ArrayBuffer.make(8) - let view = DataView.make(buffer) - DataView.setFloat64LittleEndian(view, 0, 1.0) - Eq(3.03865e-319, DataView.getFloat64(view, 0)) - }, - ), - } -} - -Mt.from_pair_suites(__MODULE__, suites) 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/key_word_property.js b/jscomp/test/key_word_property.js index 23bb343a31..d4d0b45ed7 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 c40d94c062..ae997e5d0f 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 f1a95a5a14..6fb353c89a 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,34 +35,34 @@ 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 { RE_EXN_ID: "Not_found", Error: new Error() }; }); -let f008 = CamlinternalLazy.from_fun(function () { +let f008 = Lazy.from_fun(function () { console.log("hi"); throw { RE_EXN_ID: "Not_found", @@ -70,7 +70,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); @@ -87,7 +89,7 @@ let a8 = CamlinternalLazy.force(a6); Mt.from_pair_suites("Lazy_test", { hd: [ "simple", - (function (param) { + (function () { return { TAG: "Eq", _0: lazy_test(), @@ -101,7 +103,7 @@ Mt.from_pair_suites("Lazy_test", { tl: { hd: [ "lazy_force", - (function (param) { + (function () { return { TAG: "Eq", _0: u_v.contents, @@ -112,7 +114,7 @@ Mt.from_pair_suites("Lazy_test", { tl: { hd: [ "lazy_from_fun", - (function (param) { + (function () { return { TAG: "Eq", _0: CamlinternalLazy.force(l_from_fun), @@ -123,7 +125,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)), @@ -134,12 +136,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 }; }) @@ -147,7 +150,7 @@ Mt.from_pair_suites("Lazy_test", { tl: { hd: [ "lazy_from_val3", - (function (param) { + (function () { debugger; return { TAG: "Eq", @@ -159,7 +162,7 @@ Mt.from_pair_suites("Lazy_test", { tl: { hd: [ "lazy_test.res", - (function (param) { + (function () { return { TAG: "Eq", _0: a3, @@ -170,7 +173,7 @@ Mt.from_pair_suites("Lazy_test", { tl: { hd: [ "lazy_test.res", - (function (param) { + (function () { return { TAG: "Eq", _0: a7, @@ -181,7 +184,7 @@ Mt.from_pair_suites("Lazy_test", { tl: { hd: [ "lazy_test.res", - (function (param) { + (function () { return { TAG: "Eq", _0: a8, @@ -192,7 +195,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)) @@ -202,10 +205,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 { RE_EXN_ID: "Not_found", Error: new Error() @@ -245,4 +248,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/lazy_test.res b/jscomp/test/lazy_test.res index 00b9bd7c32..a0cf9b8dc4 100644 --- a/jscomp/test/lazy_test.res +++ b/jscomp/test/lazy_test.res @@ -78,13 +78,13 @@ Mt.from_pair_suites( ("lazy_force", _ => Eq(u_v.contents, 2)), ("lazy_from_fun", _ => Eq(Lazy.force(l_from_fun), 3)), ("lazy_from_val", _ => Eq(Lazy.force(Lazy.from_val(3)), 3)), - ("lazy_from_val2", _ => Eq(\"@@"(Lazy.force, Lazy.force(Lazy.from_val(Lazy.from_fun(() => 3)))), 3)), + ("lazy_from_val2", _ => Eq(Lazy.force(Lazy.force(Lazy.from_val(Lazy.from_fun(() => 3)))), 3)), ( "lazy_from_val3", _ => Eq( { %debugger - \"@@"(Lazy.force, Lazy.force(Lazy.from_val(forward_test))) + Lazy.force(Lazy.force(Lazy.from_val(forward_test))) }, 4, ), @@ -93,7 +93,7 @@ Mt.from_pair_suites( (__FILE__, _ => Eq(a7, None)), (__FILE__, _ => Eq(a8, ())), (__LOC__, _ => Ok(Lazy.is_val(Lazy.from_val(3)))), - (__LOC__, _ => Ok(\"@@"(not, Lazy.is_val(Lazy.from_fun(() => raise(Not_found)))))), + (__LOC__, _ => Ok(not(Lazy.is_val(Lazy.from_fun(() => raise(Not_found)))))), } }, ) diff --git a/jscomp/test/lib_js_test.res b/jscomp/test/lib_js_test.res index c5f2cec14a..f237d65dbc 100644 --- a/jscomp/test/lib_js_test.res +++ b/jscomp/test/lib_js_test.res @@ -1,7 +1,7 @@ @val external to_json_string: 'a => string = "JSON.stringify" let () = { - \"@@"(Js.log, to_json_string(list{1, 2, 3})) + Js.log(to_json_string(list{1, 2, 3})) Js.log("hey") } @val external of_any: 'a => string = "String" 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 8f7b41e660..fc925ab729 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..bdf6c1e70d 100644 --- a/jscomp/test/limits_test.js +++ b/jscomp/test/limits_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/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 3d8284291b..1883190ca9 100644 --- a/jscomp/test/map_find_test.js +++ b/jscomp/test/map_find_test.js @@ -360,7 +360,7 @@ let s = List.fold_left((function (acc, param) { Mt.from_pair_suites("Map_find_test", { hd: [ "int", - (function (param) { + (function () { return { TAG: "Eq", _0: find(10, m), @@ -371,7 +371,7 @@ Mt.from_pair_suites("Map_find_test", { tl: { hd: [ "string", - (function (param) { + (function () { return { TAG: "Eq", _0: find$1("10", s), diff --git a/jscomp/test/map_find_test.res b/jscomp/test/map_find_test.res index 64a946d30a..fc0b7286c5 100644 --- a/jscomp/test/map_find_test.res +++ b/jscomp/test/map_find_test.res @@ -25,8 +25,9 @@ include ( ) @val("console.log") external log: 'a => unit = "" - \"@@"( - Mt.from_pair_suites(__MODULE__), + + Mt.from_pair_suites( + __MODULE__, list{("int", _ => Eq(IntMap.find(10, m), 'a')), ("string", _ => Eq(SMap.find("10", s), 'a'))}, ) }: {} diff --git a/jscomp/test/map_test.js b/jscomp/test/map_test.js index 1a5f45a366..f8675c29f2 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") { @@ -175,7 +174,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; } @@ -204,7 +203,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 a865032667..dafe6a8475 100644 --- a/jscomp/test/mario_game.js +++ b/jscomp/test/mario_game.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 Random = require("../../lib/js/random.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); let Caml_int32 = require("../../lib/js/caml_int32.js"); @@ -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) { @@ -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 (l) { let lr_acc = player.vel.x * 0.2; - switch (param) { + switch (l) { case "CLeft" : if (!player.crouch) { if (player.vel.x > - player.params.speed) { @@ -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 { RE_EXN_ID: "Failure", _1: "Game over.", @@ -1516,12 +1510,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 { RE_EXN_ID: "Failure", _1: "Game over.", @@ -1656,9 +1650,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" : @@ -1672,14 +1667,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; @@ -1687,7 +1682,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; @@ -1700,14 +1695,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 @@ -1720,7 +1715,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 @@ -1728,8 +1723,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 @@ -1745,20 +1740,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 @@ -1771,26 +1766,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; @@ -1842,7 +1837,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, @@ -1854,14 +1849,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, @@ -1876,13 +1871,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 @@ -1902,67 +1897,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 @@ -1993,11 +1977,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); @@ -2007,6 +1989,7 @@ function process_collision(dir, c1, c2, state) { ]; } + break; } break; @@ -2091,7 +2074,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; @@ -2103,7 +2086,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 [ @@ -2112,19 +2095,25 @@ function process_collision(dir, c1, c2, state) { ]; } break; + case 4 : + collide_block(undefined, dir, o1$3); + return [ + undefined, + undefined + ]; } } function broad_phase(collid, all_collids, state) { let obj = collid._2; - return List.filter(function (c) { + return List.filter((function (c) { if (in_viewport(state.vpt, obj.pos) || is_player(collid)) { return true; } else { return out_of_viewport_below(state.vpt, obj.pos.y); } - })(all_collids); + }), all_collids); } function check_collisions(collid, all_collids, state) { @@ -2210,7 +2199,7 @@ function update_collidable(state, collid, all_collids) { return evolved; } -function translate_keys(param) { +function translate_keys() { let ctrls_0 = [ pressed_keys.left, "CLeft" @@ -2288,7 +2277,7 @@ function run_update_collid(state, collid, all_collids) { 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([ @@ -2305,7 +2294,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); @@ -3293,7 +3282,7 @@ function generate(w, h, context) { ]; } -function init(param) { +function init() { Random.self_init(); } @@ -3321,7 +3310,7 @@ function load(param) { Error: new Error() }; } - 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/mario_game.res b/jscomp/test/mario_game.res index 4dc4f04851..1ae48a5b62 100644 --- a/jscomp/test/mario_game.res +++ b/jscomp/test/mario_game.res @@ -1101,7 +1101,7 @@ module Object: { let update_player = (player, keys, context) => { let prev_jumping = player.jumping let prev_dir = player.dir and prev_vx = abs_float(player.vel.x) - List.iter(update_player_keys(player), keys) + List.iter(l => update_player_keys(player, l), keys) let v = player.vel.x *. friction let vel_damped = if abs_float(v) < 0.1 { 0. @@ -1445,7 +1445,7 @@ module Draw: { let context = Dom_html.canvasRenderingContext2DToJsObj(canvas["getContext"]("2d")) let cwidth = float_of_int(canvas["width"]) let cheight = float_of_int(canvas["height"]) - \"@@"(ignore, context["clearRect"](0., 0., cwidth, cheight)) + ignore(context["clearRect"](0., 0., cwidth, cheight)) } /* Displays the text for score and coins. */ @@ -1454,20 +1454,19 @@ module Draw: { let coin_string = string_of_int(coins) let canvas = Dom_html.canvasElementToJsObj(canvas) let context = Dom_html.canvasRenderingContext2DToJsObj(canvas["getContext"]("2d")) - \"@@"(ignore, context["font"] = "10px 'Press Start 2P'") - \"@@"( - ignore, + ignore(context["font"] = "10px 'Press Start 2P'") + ignore( context["fillText"]("Score: " ++ score_string, float_of_int(canvas["width"]) -. 140., 18.), ) - \"@@"(ignore, context["fillText"]("Coins: " ++ coin_string, 120., 18.)) + ignore(context["fillText"]("Coins: " ++ coin_string, 120., 18.)) } /* Displays the fps. */ let fps = (canvas, fps_val) => { - let fps_str = int_of_float(fps_val) |> string_of_int + let fps_str = string_of_int(int_of_float(fps_val)) let canvas = Dom_html.canvasElementToJsObj(canvas) let context = Dom_html.canvasRenderingContext2DToJsObj(canvas["getContext"]("2d")) - \"@@"(ignore, context["fillText"](fps_str, 10., 18.)) + ignore(context["fillText"](fps_str, 10., 18.)) } /* game_win displays a black screen when you finish a game. */ @@ -2100,8 +2099,7 @@ module Director: { List.iter(part => run_update_particle(state, part), parts) Draw.fps(canvas, fps) Draw.hud(canvas, state.score, state.coins) - \"@@"( - ignore, + ignore( Dom_html.requestAnimationFrame((t: float) => update_helper(t, state, player, collid_objs.contents, particles.contents) ), diff --git a/jscomp/test/marshal.js b/jscomp/test/marshal.js index 1b044bd79c..b8acf95e10 100644 --- a/jscomp/test/marshal.js +++ b/jscomp/test/marshal.js @@ -5,25 +5,25 @@ 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 { - RE_EXN_ID: "Invalid_argument", - _1: "Marshal.to_buffer: substring out of bounds", - Error: new Error() - }; + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Marshal.to_buffer: substring out of bounds", + Error: new Error() + }; } function data_size(buff, ofs) { - if (ofs < 0 || ofs > (buff.length - 20 | 0)) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Marshal.data_size", - Error: new Error() - }; + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Marshal.data_size", + Error: new Error() + }; } function total_size(buff, ofs) { @@ -39,14 +39,14 @@ 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 { - RE_EXN_ID: "Invalid_argument", - _1: "Marshal.from_bytes", - Error: new Error() - }; + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Marshal.from_bytes", + Error: new Error() + }; } 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/more_poly_variant_test.res b/jscomp/test/more_poly_variant_test.res index 6352030926..b471c3bb82 100644 --- a/jscomp/test/more_poly_variant_test.res +++ b/jscomp/test/more_poly_variant_test.res @@ -1,11 +1,10 @@ type rec vlist<'a> = [#Nil | #Cons('a, vlist<'a>)] -let rec map = (f): (vlist<'a> => vlist<'b>) => - x => - switch x { - | #Nil => #Nil - | #Cons(a, l) => #Cons(f(. a), map(f, l)) - } +let rec map = (f): (vlist<'a> => vlist<'b>) => x => + switch x { + | #Nil => #Nil + | #Cons(a, l) => #Cons(f(a), map(f)(l)) + } let split_cases = x => switch x { 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 a49dfbd4fe..b6f0ee3fbc 100644 --- a/jscomp/test/mt.js +++ b/jscomp/test/mt.js @@ -4,15 +4,15 @@ 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"); +let Js_promise2 = require("../../lib/js/js_promise2.js"); 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; @@ -36,7 +36,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); })); @@ -102,7 +102,7 @@ function force_curry(x) { tl: /* [] */0 }); $$Array.copy([5]); - return Curry._1(x, undefined); + return x(); } let from_pair_suites = (function from_pair_suites(name, suites) { @@ -113,7 +113,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 +125,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([ @@ -234,12 +234,11 @@ function old_from_promise_suites_donotuse(name, suites) { describe(name, (function () { List.iter((function (param) { let code = param[1]; - it(param[0], (function (param) { - let arg1 = function (x) { + it(param[0], (function () { + return Js_promise2.then(code, (function (x) { handleCode(x); return val_unit; - }; - return code.then(arg1); + })); })); }), suites); })); diff --git a/jscomp/test/mt.res b/jscomp/test/mt.res index aaf6e225bc..33a7e29af0 100644 --- a/jscomp/test/mt.res +++ b/jscomp/test/mt.res @@ -1,8 +1,8 @@ -@val external describe: (string, (. unit) => unit) => unit = "describe" +@val external describe: (string, unit => unit) => unit = "describe" -@val external it: (string, @uncurry (unit => unit)) => unit = "it" +@val external it: (string, unit => unit) => unit = "it" -@val external it_promise: (string, @uncurry (unit => Js.Promise.t<_>)) => unit = "it" +@val external it_promise: (string, unit => Js.Promise.t<_>) => unit = "it" @val @module("assert") external eq: ('a, 'a) => unit = "deepEqual" @@ -18,9 +18,7 @@ @val @variadic external dump: array<'a> => unit = "console.log" -@val -@module("assert") -/** There is a problem -- +@val @module("assert") /** There is a problem -- it does not return [unit] */ external throws: (unit => unit) => unit = "throws" @@ -53,7 +51,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); })); @@ -132,7 +130,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 +142,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([ @@ -253,20 +251,19 @@ let old_from_promise_suites_donotuse = (name, suites: list<(string, Js.Promise.t switch Array.to_list(argv) { | list{cmd, ..._} => if is_mocha() { - describe(name, (. ()) => - suites |> List.iter(((name, code)) => + describe(name, () => List.iter(((name, code)) => it_promise( name, _ => - code |> Js.Promise.then_( + Js.Promise2.then( + code, x => { handleCode(x) val_unit }, ), ) - ) - ) + , suites)) } else { Js.log("promise suites") } /* TODO */ diff --git a/jscomp/test/mutable_uncurry_test.js b/jscomp/test/mutable_uncurry_test.js index 2889661fd4..9ac4412fdc 100644 --- a/jscomp/test/mutable_uncurry_test.js +++ b/jscomp/test/mutable_uncurry_test.js @@ -51,22 +51,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 Curry._2((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 Curry._2((function (param) { @@ -83,26 +96,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 Curry._3((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 Curry._3((function (param) { @@ -123,60 +138,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 +176,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 735a8a431d..9626fa7296 100644 --- a/jscomp/test/noassert.js +++ b/jscomp/test/noassert.js @@ -2,7 +2,7 @@ 'use strict'; -function f(param) { +function f() { throw { RE_EXN_ID: "Assert_failure", _1: [ @@ -14,7 +14,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 deleted file mode 100644 index 61b99a6b38..0000000000 --- a/jscomp/test/ocaml_re_test.js +++ /dev/null @@ -1,4195 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Caml = require("../../lib/js/caml.js"); -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 Caml_exceptions = require("../../lib/js/caml_exceptions.js"); -let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + String(test_id.contents)), - (function (param) { - return { - TAG: "Eq", - _0: x, - _1: y - }; - }) - ], - tl: suites.contents - }; -} - -function union(_l, _l$p) { - while(true) { - let l$p = _l$p; - let l = _l; - if (!l$p) { - return l; - } - if (!l) { - return l$p; - } - let r$p = l$p.tl; - let match = l$p.hd; - let c2$p = match[1]; - let c1$p = match[0]; - let r = l.tl; - let match$1 = l.hd; - let c2 = match$1[1]; - let c1 = match$1[0]; - if ((c2 + 1 | 0) < c1$p) { - return { - hd: [ - c1, - c2 - ], - tl: union(r, l$p) - }; - } - if ((c2$p + 1 | 0) < c1) { - return { - hd: [ - c1$p, - c2$p - ], - tl: union(l, r$p) - }; - } - if (c2 < c2$p) { - _l$p = { - hd: [ - c1 < c1$p ? c1 : c1$p, - c2$p - ], - tl: r$p - }; - _l = r; - continue; - } - _l$p = r$p; - _l = { - hd: [ - c1 < c1$p ? c1 : c1$p, - c2 - ], - tl: r - }; - continue; - }; -} - -function inter(_l, _l$p) { - while(true) { - let l$p = _l$p; - let l = _l; - if (!l$p) { - return /* [] */0; - } - if (!l) { - return /* [] */0; - } - let r$p = l$p.tl; - let match = l$p.hd; - let c2$p = match[1]; - let c1$p = match[0]; - let r = l.tl; - let match$1 = l.hd; - let c2 = match$1[1]; - let c1 = match$1[0]; - if (Caml_obj.lessthan(c2, c1$p)) { - _l = r; - continue; - } - if (!Caml_obj.lessthan(c2$p, c1)) { - if (Caml_obj.lessthan(c2, c2$p)) { - return { - hd: [ - Caml_obj.max(c1, c1$p), - c2 - ], - tl: inter(r, l$p) - }; - } else { - return { - hd: [ - Caml_obj.max(c1, c1$p), - c2$p - ], - tl: inter(l, r$p) - }; - } - } - _l$p = r$p; - continue; - }; -} - -function diff(_l, _l$p) { - while(true) { - let l$p = _l$p; - let l = _l; - if (!l$p) { - return l; - } - if (!l) { - return /* [] */0; - } - let r$p = l$p.tl; - let match = l$p.hd; - let c2$p = match[1]; - let c1$p = match[0]; - let r = l.tl; - let match$1 = l.hd; - let c2 = match$1[1]; - let c1 = match$1[0]; - if (c2 < c1$p) { - return { - hd: [ - c1, - c2 - ], - tl: diff(r, l$p) - }; - } - if (c2$p < c1) { - _l$p = r$p; - continue; - } - let r$p$p = c2$p < c2 ? ({ - hd: [ - c2$p + 1 | 0, - c2 - ], - tl: r - }) : r; - if (c1 < c1$p) { - return { - hd: [ - c1, - c1$p - 1 | 0 - ], - tl: diff(r$p$p, r$p) - }; - } - _l$p = r$p; - _l = r$p$p; - continue; - }; -} - -function single(c) { - return { - hd: [ - c, - c - ], - tl: /* [] */0 - }; -} - -function seq(c, c$p) { - if (Caml_obj.lessequal(c, c$p)) { - return { - hd: [ - c, - c$p - ], - tl: /* [] */0 - }; - } else { - return { - hd: [ - c$p, - c - ], - tl: /* [] */0 - }; - } -} - -function offset(o, l) { - if (!l) { - return /* [] */0; - } - let match = l.hd; - return { - hd: [ - match[0] + o | 0, - match[1] + o | 0 - ], - tl: offset(o, l.tl) - }; -} - -function mem(c, _s) { - while(true) { - let s = _s; - if (!s) { - return false; - } - let match = s.hd; - if (c <= match[1]) { - return c >= match[0]; - } - _s = s.tl; - continue; - }; -} - -function hash_rec(x) { - if (!x) { - return 0; - } - let match = x.hd; - return (match[0] + Math.imul(13, match[1]) | 0) + Math.imul(257, hash_rec(x.tl)) | 0; -} - -function one_char(x) { - if (!x) { - return; - } - if (x.tl) { - return; - } - let match = x.hd; - let i = match[0]; - if (Caml_obj.equal(i, match[1])) { - return Caml_option.some(i); - } - -} - -function compare(param, param$1) { - let c = Caml_obj.compare(param[0], param$1[0]); - if (c !== 0) { - return c; - } else { - return Caml_obj.compare(param[1], param$1[1]); - } -} - -function height(param) { - if (typeof param !== "object") { - return 0; - } else { - return param.h; - } -} - -function create(l, x, d, r) { - let hl = height(l); - let hr = height(r); - return { - TAG: "Node", - l: l, - v: x, - d: d, - r: r, - h: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 - }; -} - -function bal(l, x, d, r) { - let hl; - hl = typeof l !== "object" ? 0 : l.h; - let hr; - hr = typeof r !== "object" ? 0 : r.h; - if (hl > (hr + 2 | 0)) { - if (typeof l !== "object") { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal", - Error: new Error() - }; - } - let lr = l.r; - let ld = l.d; - let lv = l.v; - let ll = l.l; - if (height(ll) >= height(lr)) { - return create(ll, lv, ld, create(lr, x, d, r)); - } - if (typeof lr === "object") { - return create(create(ll, lv, ld, lr.l), lr.v, lr.d, create(lr.r, x, d, r)); - } - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal", - Error: new Error() - }; - } - if (hr <= (hl + 2 | 0)) { - return { - TAG: "Node", - l: l, - v: x, - d: d, - r: r, - h: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 - }; - } - if (typeof r !== "object") { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal", - Error: new Error() - }; - } - let rr = r.r; - let rd = r.d; - let rv = r.v; - let rl = r.l; - if (height(rr) >= height(rl)) { - return create(create(l, x, d, rl), rv, rd, rr); - } - if (typeof rl === "object") { - return create(create(l, x, d, rl.l), rl.v, rl.d, create(rl.r, rv, rd, rr)); - } - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal", - Error: new Error() - }; -} - -function add(x, data, param) { - if (typeof param !== "object") { - return { - TAG: "Node", - l: "Empty", - v: x, - d: data, - r: "Empty", - h: 1 - }; - } - let r = param.r; - let d = param.d; - let v = param.v; - let l = param.l; - let c = compare(x, v); - if (c === 0) { - if (d === data) { - return param; - } else { - return { - TAG: "Node", - l: l, - v: x, - d: data, - r: r, - h: param.h - }; - } - } - if (c < 0) { - let ll = add(x, data, l); - if (l === ll) { - return param; - } else { - return bal(ll, v, d, r); - } - } - let rr = add(x, data, r); - if (r === rr) { - return param; - } else { - return bal(l, v, d, rr); - } -} - -let cany = { - hd: [ - 0, - 255 - ], - tl: /* [] */0 -}; - -function intersect(x, y) { - return (x & y) !== 0; -} - -function $plus$plus(x, y) { - return x | y; -} - -function from_char(x) { - if (x >= 170) { - if (x >= 192) { - if (x > 255 || x < 216) { - if (x >= 215) { - return 4; - } else { - return 2; - } - } else if (x !== 247) { - return 2; - } else { - return 4; - } - } else if (x > 185 || x < 171) { - if (x >= 187) { - return 4; - } else { - return 2; - } - } else if (x !== 181) { - return 4; - } else { - return 2; - } - } else if (x >= 65) { - if (x > 96 || x < 91) { - if (x >= 123) { - return 4; - } else { - return 2; - } - } else if (x !== 95) { - return 4; - } else { - return 2; - } - } else if (x >= 48) { - if (x >= 58) { - return 4; - } else { - return 2; - } - } else if (x !== 10) { - return 4; - } else { - return 12; - } -} - -function height$1(param) { - if (typeof param !== "object") { - return 0; - } else { - return param.h; - } -} - -function create$1(l, v, r) { - let hl; - hl = typeof l !== "object" ? 0 : l.h; - let hr; - hr = typeof r !== "object" ? 0 : r.h; - return { - TAG: "Node", - l: l, - v: v, - r: r, - h: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 - }; -} - -function bal$1(l, v, r) { - let hl; - hl = typeof l !== "object" ? 0 : l.h; - let hr; - hr = typeof r !== "object" ? 0 : r.h; - if (hl > (hr + 2 | 0)) { - if (typeof l !== "object") { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal", - Error: new Error() - }; - } - let lr = l.r; - let lv = l.v; - let ll = l.l; - if (height$1(ll) >= height$1(lr)) { - return create$1(ll, lv, create$1(lr, v, r)); - } - if (typeof lr === "object") { - return create$1(create$1(ll, lv, lr.l), lr.v, create$1(lr.r, v, r)); - } - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal", - Error: new Error() - }; - } - if (hr <= (hl + 2 | 0)) { - return { - TAG: "Node", - l: l, - v: v, - r: r, - h: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 - }; - } - if (typeof r !== "object") { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal", - Error: new Error() - }; - } - let rr = r.r; - let rv = r.v; - let rl = r.l; - if (height$1(rr) >= height$1(rl)) { - return create$1(create$1(l, v, rl), rv, rr); - } - if (typeof rl === "object") { - return create$1(create$1(l, v, rl.l), rl.v, create$1(rl.r, rv, rr)); - } - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal", - Error: new Error() - }; -} - -function add$1(x, param) { - if (typeof param !== "object") { - return { - TAG: "Node", - l: "Empty", - v: x, - r: "Empty", - h: 1 - }; - } - let r = param.r; - let v = param.v; - let l = param.l; - let c = Caml.int_compare(x, v); - if (c === 0) { - return param; - } - if (c < 0) { - let ll = add$1(x, l); - if (l === ll) { - return param; - } else { - return bal$1(ll, v, r); - } - } - let rr = add$1(x, r); - if (r === rr) { - return param; - } else { - return bal$1(l, v, rr); - } -} - -function hash_combine(h, accu) { - return Math.imul(accu, 65599) + h | 0; -} - -let empty = { - marks: /* [] */0, - pmarks: "Empty" -}; - -function hash(m, accu) { - let _l = m.marks; - let _accu = hash_combine(Hashtbl.hash(m.pmarks), accu); - while(true) { - let accu$1 = _accu; - let l = _l; - if (!l) { - return accu$1; - } - let match = l.hd; - _accu = hash_combine(match[0], hash_combine(match[1], accu$1)); - _l = l.tl; - continue; - }; -} - -function marks_set_idx(idx, x) { - if (!x) { - return x; - } - let match = x.hd; - if (match[1] !== -1) { - return x; - } else { - return { - hd: [ - match[0], - idx - ], - tl: marks_set_idx(idx, x.tl) - }; - } -} - -function marks_set_idx$1(marks, idx) { - return { - marks: marks_set_idx(idx, marks.marks), - pmarks: marks.pmarks - }; -} - -function first(f, _x) { - while(true) { - let x = _x; - if (!x) { - return; - } - let res = Curry._1(f, x.hd); - if (res !== undefined) { - return res; - } - _x = x.tl; - continue; - }; -} - -let eps_expr = { - id: 0, - def: "Eps" -}; - -function mk_expr(ids, def) { - ids.contents = ids.contents + 1 | 0; - return { - id: ids.contents, - def: def - }; -} - -function cst(ids, s) { - if (s ? false : true) { - return mk_expr(ids, { - TAG: "Alt", - _0: /* [] */0 - }); - } else { - return mk_expr(ids, { - TAG: "Cst", - _0: s - }); - } -} - -function alt(ids, x) { - if (x) { - if (x.tl) { - return mk_expr(ids, { - TAG: "Alt", - _0: x - }); - } else { - return x.hd; - } - } else { - return mk_expr(ids, { - TAG: "Alt", - _0: /* [] */0 - }); - } -} - -function seq$1(ids, kind, x, y) { - let match = x.def; - let match$1 = y.def; - let exit = 0; - if (typeof match !== "object") { - return y; - } - if (match.TAG === "Alt") { - if (!match._0) { - return x; - } - exit = 2; - } else { - exit = 2; - } - if (exit === 2) { - if (typeof match$1 !== "object") { - if (kind === "First") { - return x; - } - - } else if (match$1.TAG === "Alt" && !match$1._0) { - return y; - } - - } - return mk_expr(ids, { - TAG: "Seq", - _0: kind, - _1: x, - _2: y - }); -} - -function is_eps(expr) { - let match = expr.def; - if (typeof match !== "object") { - return true; - } else { - return false; - } -} - -function rep(ids, kind, sem, x) { - return mk_expr(ids, { - TAG: "Rep", - _0: kind, - _1: sem, - _2: x - }); -} - -function erase(ids, m, m$p) { - return mk_expr(ids, { - TAG: "Erase", - _0: m, - _1: m$p - }); -} - -function rename(ids, x) { - let l = x.def; - if (typeof l !== "object") { - return mk_expr(ids, x.def); - } - switch (l.TAG) { - case "Alt" : - return mk_expr(ids, { - TAG: "Alt", - _0: List.map((function (param) { - return rename(ids, param); - }), l._0) - }); - case "Seq" : - return mk_expr(ids, { - TAG: "Seq", - _0: l._0, - _1: rename(ids, l._1), - _2: rename(ids, l._2) - }); - case "Rep" : - return mk_expr(ids, { - TAG: "Rep", - _0: l._0, - _1: l._1, - _2: rename(ids, l._2) - }); - default: - return mk_expr(ids, x.def); - } -} - -function equal(_l1, _l2) { - while(true) { - let l2 = _l2; - let l1 = _l1; - if (!l1) { - if (l2) { - return false; - } else { - return true; - } - } - let marks1 = l1.hd; - switch (marks1.TAG) { - case "TSeq" : - if (!l2) { - return false; - } - let match = l2.hd; - switch (match.TAG) { - case "TSeq" : - if (marks1._1.id !== match._1.id) { - return false; - } - if (!equal(marks1._0, match._0)) { - return false; - } - _l2 = l2.tl; - _l1 = l1.tl; - continue; - case "TExp" : - case "TMatch" : - return false; - - } - case "TExp" : - if (!l2) { - return false; - } - let match$1 = l2.hd; - switch (match$1.TAG) { - case "TExp" : - if (marks1._1.id !== match$1._1.id) { - return false; - } - if (!Caml_obj.equal(marks1._0, match$1._0)) { - return false; - } - _l2 = l2.tl; - _l1 = l1.tl; - continue; - case "TSeq" : - case "TMatch" : - return false; - - } - case "TMatch" : - if (!l2) { - return false; - } - let marks2 = l2.hd; - switch (marks2.TAG) { - case "TSeq" : - case "TExp" : - return false; - case "TMatch" : - if (!Caml_obj.equal(marks1._0, marks2._0)) { - return false; - } - _l2 = l2.tl; - _l1 = l1.tl; - continue; - - } - - } - }; -} - -function hash$1(_l, _accu) { - while(true) { - let accu = _accu; - let l = _l; - if (!l) { - return accu; - } - let marks = l.hd; - switch (marks.TAG) { - case "TSeq" : - _accu = hash_combine(388635598, hash_combine(marks._1.id, hash$1(marks._0, accu))); - _l = l.tl; - continue; - case "TExp" : - _accu = hash_combine(726404471, hash_combine(marks._1.id, hash(marks._0, accu))); - _l = l.tl; - continue; - case "TMatch" : - _accu = hash_combine(471882453, hash(marks._0, accu)); - _l = l.tl; - continue; - - } - }; -} - -function tseq(kind, x, y, rem) { - if (!x) { - return rem; - } - let match = x.hd; - switch (match.TAG) { - case "TExp" : - let tmp = match._1.def; - if (typeof tmp !== "object" && !x.tl) { - return { - hd: { - TAG: "TExp", - _0: match._0, - _1: y - }, - tl: rem - }; - } - break; - case "TSeq" : - case "TMatch" : - break; - - } - return { - hd: { - TAG: "TSeq", - _0: x, - _1: y, - _2: kind - }, - tl: rem - }; -} - -let dummy = { - idx: -1, - category: -1, - desc: /* [] */0, - status: undefined, - hash: -1 -}; - -function hash$2(idx, cat, desc) { - return hash$1(desc, hash_combine(idx, hash_combine(cat, 0))) & 1073741823; -} - -function mk(idx, cat, desc) { - return { - idx: idx, - category: cat, - desc: desc, - status: undefined, - hash: hash$2(idx, cat, desc) - }; -} - -function create$2(cat, e) { - return mk(0, cat, { - hd: { - TAG: "TExp", - _0: empty, - _1: e - }, - tl: /* [] */0 - }); -} - -function equal$1(x, y) { - if (x.hash === y.hash && x.idx === y.idx && x.category === y.category) { - return equal(x.desc, y.desc); - } else { - return false; - } -} - -function hash$3(t) { - return t.hash; -} - -let Table = Hashtbl.Make({ - equal: equal$1, - hash: hash$3 -}); - -function reset_table(a) { - $$Array.fill(a, 0, a.length, false); -} - -function mark_used_indices(tbl) { - return function (param) { - return List.iter((function (x) { - switch (x.TAG) { - case "TSeq" : - return mark_used_indices(tbl)(x._0); - case "TExp" : - case "TMatch" : - break; - - } - List.iter((function (param) { - let i = param[1]; - if (i >= 0) { - return Caml_array.set(tbl, i, true); - } - - }), x._0.marks); - }), param); - }; -} - -function find_free(tbl, _idx, len) { - while(true) { - let idx = _idx; - if (idx === len || !Caml_array.get(tbl, idx)) { - return idx; - } - _idx = idx + 1 | 0; - continue; - }; -} - -function free_index(tbl_ref, l) { - let tbl = tbl_ref.contents; - reset_table(tbl); - mark_used_indices(tbl)(l); - let len = tbl.length; - let idx = find_free(tbl, 0, len); - if (idx === len) { - tbl_ref.contents = Caml_array.make((len << 1), false); - } - return idx; -} - -let remove_matches = List.filter(function (x) { - switch (x.TAG) { - case "TSeq" : - case "TExp" : - return true; - case "TMatch" : - return false; - - } -}); - -function split_at_match_rec(_l$p, _x) { - while(true) { - let x = _x; - let l$p = _l$p; - if (x) { - let x$1 = x.hd; - switch (x$1.TAG) { - case "TSeq" : - case "TExp" : - _x = x.tl; - _l$p = { - hd: x$1, - tl: l$p - }; - continue; - case "TMatch" : - return [ - List.rev(l$p), - Curry._1(remove_matches, x.tl) - ]; - - } - } else { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "ocaml_re_test.res", - 816, - 16 - ], - Error: new Error() - }; - } - }; -} - -function remove_duplicates(prev, _l, y) { - while(true) { - let l = _l; - if (!l) { - return [ - /* [] */0, - prev - ]; - } - let x = l.hd; - switch (x.TAG) { - case "TSeq" : - let x$1 = x._1; - let match = remove_duplicates(prev, x._0, x$1); - let match$1 = remove_duplicates(match[1], l.tl, y); - return [ - tseq(x._2, match[0], x$1, match$1[0]), - match$1[1] - ]; - case "TExp" : - let x$2 = x._1; - let tmp = x$2.def; - if (typeof tmp !== "object") { - let r = l.tl; - if (List.memq(y.id, prev)) { - _l = r; - continue; - } - let match$2 = remove_duplicates({ - hd: y.id, - tl: prev - }, r, y); - return [ - { - hd: x, - tl: match$2[0] - }, - match$2[1] - ]; - } - let r$1 = l.tl; - if (List.memq(x$2.id, prev)) { - _l = r$1; - continue; - } - let match$3 = remove_duplicates({ - hd: x$2.id, - tl: prev - }, r$1, y); - return [ - { - hd: x, - tl: match$3[0] - }, - match$3[1] - ]; - case "TMatch" : - return [ - { - hd: x, - tl: /* [] */0 - }, - prev - ]; - - } - }; -} - -function set_idx(idx, x) { - if (!x) { - return /* [] */0; - } - let marks = x.hd; - switch (marks.TAG) { - case "TSeq" : - return { - hd: { - TAG: "TSeq", - _0: set_idx(idx, marks._0), - _1: marks._1, - _2: marks._2 - }, - tl: set_idx(idx, x.tl) - }; - case "TExp" : - return { - hd: { - TAG: "TExp", - _0: marks_set_idx$1(marks._0, idx), - _1: marks._1 - }, - tl: set_idx(idx, x.tl) - }; - case "TMatch" : - return { - hd: { - TAG: "TMatch", - _0: marks_set_idx$1(marks._0, idx) - }, - tl: set_idx(idx, x.tl) - }; - - } -} - -function filter_marks(b, e, marks) { - return { - marks: List.filter(function (param) { - let i = param[0]; - if (i < b) { - return true; - } else { - return i > e; - } - })(marks.marks), - pmarks: marks.pmarks - }; -} - -function delta_1(marks, c, next_cat, prev_cat, x, rem) { - let s = x.def; - if (typeof s !== "object") { - return { - hd: { - TAG: "TMatch", - _0: marks - }, - tl: rem - }; - } - switch (s.TAG) { - case "Cst" : - if (mem(c, s._0)) { - return { - hd: { - TAG: "TExp", - _0: marks, - _1: eps_expr - }, - tl: rem - }; - } else { - return rem; - } - case "Alt" : - return delta_2(marks, c, next_cat, prev_cat, s._0, rem); - case "Seq" : - let y$p = delta_1(marks, c, next_cat, prev_cat, s._1, /* [] */0); - return delta_seq(c, next_cat, prev_cat, s._0, y$p, s._2, rem); - case "Rep" : - let kind = s._1; - let y$p$1 = delta_1(marks, c, next_cat, prev_cat, s._2, /* [] */0); - let marks$p = first((function (x) { - switch (x.TAG) { - case "TSeq" : - case "TExp" : - return; - case "TMatch" : - return x._0; - - } - }), y$p$1); - let match = marks$p !== undefined ? [ - Curry._1(remove_matches, y$p$1), - marks$p - ] : [ - y$p$1, - marks - ]; - let y$p$p = match[0]; - if (s._0 === "Non_greedy") { - return { - hd: { - TAG: "TMatch", - _0: marks - }, - tl: tseq(kind, y$p$p, x, rem) - }; - } else { - return tseq(kind, y$p$p, x, { - hd: { - TAG: "TMatch", - _0: match[1] - }, - tl: rem - }); - } - case "Mark" : - let i = s._0; - let marks_marks = { - hd: [ - i, - -1 - ], - tl: List.remove_assq(i, marks.marks) - }; - let marks_pmarks = marks.pmarks; - let marks$1 = { - marks: marks_marks, - pmarks: marks_pmarks - }; - return { - hd: { - TAG: "TMatch", - _0: marks$1 - }, - tl: rem - }; - case "Erase" : - return { - hd: { - TAG: "TMatch", - _0: filter_marks(s._0, s._1, marks) - }, - tl: rem - }; - case "Before" : - if (intersect(next_cat, s._0)) { - return { - hd: { - TAG: "TMatch", - _0: marks - }, - tl: rem - }; - } else { - return rem; - } - case "After" : - if (intersect(prev_cat, s._0)) { - return { - hd: { - TAG: "TMatch", - _0: marks - }, - tl: rem - }; - } else { - return rem; - } - case "Pmark" : - let marks_marks$1 = marks.marks; - let marks_pmarks$1 = add$1(s._0, marks.pmarks); - let marks$2 = { - marks: marks_marks$1, - pmarks: marks_pmarks$1 - }; - return { - hd: { - TAG: "TMatch", - _0: marks$2 - }, - tl: rem - }; - - } -} - -function delta_2(marks, c, next_cat, prev_cat, l, rem) { - if (l) { - return delta_1(marks, c, next_cat, prev_cat, l.hd, delta_2(marks, c, next_cat, prev_cat, l.tl, rem)); - } else { - return rem; - } -} - -function delta_seq(c, next_cat, prev_cat, kind, y, z, rem) { - let marks = first((function (x) { - switch (x.TAG) { - case "TSeq" : - case "TExp" : - return; - case "TMatch" : - return x._0; - - } - }), y); - if (marks === undefined) { - return tseq(kind, y, z, rem); - } - if (kind === "Longest") { - return tseq(kind, Curry._1(remove_matches, y), z, delta_1(marks, c, next_cat, prev_cat, z, rem)); - } - if (kind !== "First") { - return delta_1(marks, c, next_cat, prev_cat, z, tseq(kind, Curry._1(remove_matches, y), z, rem)); - } - let match = split_at_match_rec(/* [] */0, y); - return tseq(kind, match[0], z, delta_1(marks, c, next_cat, prev_cat, z, tseq(kind, match[1], z, rem))); -} - -function delta_4(c, next_cat, prev_cat, l, rem) { - if (l) { - let x = l.hd; - let rem$1 = delta_4(c, next_cat, prev_cat, l.tl, rem); - switch (x.TAG) { - case "TSeq" : - let y$p = delta_4(c, next_cat, prev_cat, x._0, /* [] */0); - return delta_seq(c, next_cat, prev_cat, x._2, y$p, x._1, rem$1); - case "TExp" : - return delta_1(x._0, c, next_cat, prev_cat, x._1, rem$1); - case "TMatch" : - return { - hd: x, - tl: rem$1 - }; - - } - } else { - return rem; - } -} - -function delta(tbl_ref, next_cat, $$char, st) { - let prev_cat = st.category; - let match = remove_duplicates(/* [] */0, delta_4($$char, next_cat, prev_cat, st.desc, /* [] */0), eps_expr); - let expr$p = match[0]; - let idx = free_index(tbl_ref, expr$p); - let expr$p$p = set_idx(idx, expr$p); - return mk(idx, next_cat, expr$p$p); -} - -function flatten_match(m) { - let ma = List.fold_left((function (ma, param) { - return Caml.int_max(ma, param[0]); - }), -1, m); - let res = Caml_array.make(ma + 1 | 0, -1); - List.iter((function (param) { - Caml_array.set(res, param[0], param[1]); - }), m); - return res; -} - -function status(s) { - let st = s.status; - if (st !== undefined) { - return st; - } - let match = s.desc; - let st$1; - if (match) { - let m = match.hd; - switch (m.TAG) { - case "TSeq" : - case "TExp" : - st$1 = "Running"; - break; - case "TMatch" : - let m$1 = m._0; - st$1 = { - TAG: "Match", - _0: flatten_match(m$1.marks), - _1: m$1.pmarks - }; - break; - - } - } else { - st$1 = "Failed"; - } - s.status = st$1; - return st$1; -} - -let Re_automata_Category = { - $plus$plus: $plus$plus, - from_char: from_char, - inexistant: 1, - letter: 2, - not_letter: 4, - newline: 8, - lastnewline: 16, - search_boundary: 32 -}; - -let Re_automata_State = { - dummy: dummy, - create: create$2, - Table: Table -}; - -function iter(_n, f, _v) { - while(true) { - let v = _v; - let n = _n; - if (n === 0) { - return v; - } - _v = Curry._1(f, v); - _n = n - 1 | 0; - continue; - }; -} - -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); - } else { - return Curry._1(Re_automata_Category.from_char, Caml_bytes.get(re.col_repr, c)); - } -} - -let dummy_next = []; - -let unknown_state = { - idx: -2, - real_idx: 0, - next: dummy_next, - final: /* [] */0, - desc: Re_automata_State.dummy -}; - -function mk_state(ncol, desc) { - let match = status(desc); - let break_state; - break_state = typeof match !== "object" && match !== "Failed" ? false : true; - return { - idx: break_state ? -3 : desc.idx, - real_idx: desc.idx, - next: break_state ? dummy_next : Caml_array.make(ncol, unknown_state), - final: /* [] */0, - desc: desc - }; -} - -function find_state(re, desc) { - try { - return Curry._2(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); - return st; - } - throw exn; - } -} - -function delta$1(info, cat, c, st) { - let desc = delta(info.re.tbl, cat, c, st.desc); - let len = info.positions.length; - if (desc.idx === len && len > 0) { - let pos = info.positions; - info.positions = Caml_array.make((len << 1), 0); - $$Array.blit(pos, 0, info.positions, 0, len); - } - return desc; -} - -function validate(info, s, pos, st) { - let c = Caml_bytes.get(info.i_cols, Caml_string.get(s, pos)); - let cat = category(info.re, c); - let desc$p = delta$1(info, cat, c, st); - let st$p = find_state(info.re, desc$p); - Caml_array.set(st.next, c, st$p); -} - -function loop(info, s, pos, st) { - if (pos >= info.last) { - return st; - } - let st$p = Caml_array.get(st.next, Caml_bytes.get(info.i_cols, Caml_string.get(s, pos))); - let _pos = pos; - let _st = st; - let _st$p = st$p; - while(true) { - let st$p$1 = _st$p; - let st$1 = _st; - let pos$1 = _pos; - if (st$p$1.idx < 0) { - if (st$p$1.idx === -3) { - Caml_array.set(info.positions, st$p$1.real_idx, pos$1 + 1 | 0); - return st$p$1; - } else { - validate(info, s, pos$1, st$1); - return loop(info, s, pos$1, st$1); - } - } - let pos$2 = pos$1 + 1 | 0; - if (pos$2 < info.last) { - let st$p$p = Caml_array.get(st$p$1.next, Caml_bytes.get(info.i_cols, Caml_string.get(s, pos$2))); - Caml_array.set(info.positions, st$p$1.idx, pos$2); - _st$p = st$p$p; - _st = st$p$1; - _pos = pos$2; - continue; - } - Caml_array.set(info.positions, st$p$1.idx, pos$2); - return st$p$1; - }; -} - -function $$final(info, st, cat) { - try { - return List.assq(cat, st.final); - } - catch (raw_exn){ - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); - if (exn.RE_EXN_ID === "Not_found") { - let st$p = delta$1(info, cat, -1, st); - let res_0 = st$p.idx; - let res_1 = status(st$p); - let res = [ - res_0, - res_1 - ]; - st.final = { - hd: [ - cat, - res - ], - tl: st.final - }; - return res; - } - throw exn; - } -} - -function find_initial_state(re, cat) { - try { - return List.assq(cat, re.initial_states); - } - 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)); - re.initial_states = { - hd: [ - cat, - st - ], - tl: re.initial_states - }; - return st; - } - throw exn; - } -} - -function get_color(re, s, pos) { - if (pos < 0) { - return -1; - } - let slen = s.length; - if (pos >= slen) { - return -1; - } else if (pos === (slen - 1 | 0) && re.lnl !== -1 && Caml_string.get(s, pos) === /* '\n' */10) { - return re.lnl; - } else { - return Caml_bytes.get(re.cols, Caml_string.get(s, pos)); - } -} - -function scan_str(info, s, initial_state, groups) { - let pos = info.pos; - let last = info.last; - if (!(last === s.length && info.re.lnl !== -1 && last > pos && Caml_string.get(s, last - 1 | 0) === /* '\n' */10)) { - if (groups) { - return loop(info, s, pos, initial_state); - } else { - let _pos = pos; - let _st = initial_state; - while(true) { - let st = _st; - let pos$1 = _pos; - if (pos$1 >= last) { - return st; - } - let st$p = Caml_array.get(st.next, Caml_bytes.get(info.i_cols, Caml_string.get(s, pos$1))); - if (st$p.idx >= 0) { - _st = st$p; - _pos = pos$1 + 1 | 0; - continue; - } - if (st$p.idx === -3) { - return st$p; - } - validate(info, s, pos$1, st); - continue; - }; - } - } - let info$1 = { - re: info.re, - i_cols: info.i_cols, - positions: info.positions, - pos: info.pos, - last: last - 1 | 0 - }; - let st$1 = scan_str(info$1, s, initial_state, groups); - if (st$1.idx === -3) { - return st$1; - } else { - let pos$2 = last - 1 | 0; - while(true) { - let st$p$1 = Caml_array.get(st$1.next, info$1.re.lnl); - if (st$p$1.idx >= 0) { - if (groups) { - Caml_array.set(info$1.positions, st$p$1.idx, pos$2 + 1 | 0); - } - return st$p$1; - } - if (st$p$1.idx === -3) { - if (groups) { - Caml_array.set(info$1.positions, st$p$1.real_idx, pos$2 + 1 | 0); - } - return st$p$1; - } - let c = info$1.re.lnl; - let real_c = Caml_bytes.get(info$1.i_cols, /* '\n' */10); - let cat = category(info$1.re, c); - let desc$p = delta$1(info$1, cat, real_c, st$1); - let st$p$2 = find_state(info$1.re, desc$p); - Caml_array.set(st$1.next, c, st$p$2); - continue; - }; - } -} - -function cadd(c, s) { - return union(single(c), s); -} - -function trans_set(cache, cm, s) { - let i = one_char(s); - if (i !== undefined) { - return single(Caml_bytes.get(cm, i)); - } - let v_0 = hash_rec(s); - let v = [ - v_0, - s - ]; - try { - let _param = cache.contents; - while(true) { - let param = _param; - if (typeof param !== "object") { - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; - } - let c = compare(v, param.v); - if (c === 0) { - return param.d; - } - _param = c < 0 ? param.l : param.r; - continue; - }; - } - 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) { - 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); - return l; - } - throw exn; - } -} - -function is_charset(_x) { - while(true) { - let x = _x; - if (typeof x !== "object") { - return false; - } - switch (x.TAG) { - case "Set" : - return true; - case "Sem" : - case "Sem_greedy" : - _x = x._1; - continue; - case "No_group" : - case "Case" : - case "No_case" : - _x = x._0; - continue; - case "Alternative" : - case "Intersection" : - case "Complement" : - return List.for_all(is_charset, x._0); - case "Difference" : - if (!is_charset(x._0)) { - return false; - } - _x = x._1; - continue; - default: - return false; - } - }; -} - -function split(s, cm) { - let _t = s; - let f = function (i, j) { - Caml_bytes.set(cm, i, /* '\001' */1); - Caml_bytes.set(cm, j + 1 | 0, /* '\001' */1); - }; - while(true) { - let t = _t; - if (!t) { - return; - } - let match = t.hd; - Curry._2(f, match[0], match[1]); - _t = t.tl; - continue; - }; -} - -let cupper = union(seq(/* 'A' */65, /* 'Z' */90), union(seq(/* '\192' */192, /* '\214' */214), seq(/* '\216' */216, /* '\222' */222))); - -let clower = offset(32, cupper); - -let calpha = List.fold_right(cadd, { - hd: /* '\170' */170, - tl: { - hd: /* '\181' */181, - tl: { - hd: /* '\186' */186, - tl: { - hd: /* '\223' */223, - tl: { - hd: /* '\255' */255, - tl: /* [] */0 - } - } - } - } -}, union(clower, cupper)); - -let cdigit = seq(/* '0' */48, /* '9' */57); - -let calnum = union(calpha, cdigit); - -let cword = union({ - hd: [ - /* '_' */95, - /* '_' */95 - ], - tl: /* [] */0 -}, calnum); - -function colorize(c, regexp) { - let lnl = { - contents: false - }; - let colorize$1 = function (_regexp) { - while(true) { - let regexp = _regexp; - if (typeof regexp !== "object") { - switch (regexp) { - case "Beg_of_line" : - case "End_of_line" : - return split({ - hd: [ - /* '\n' */10, - /* '\n' */10 - ], - tl: /* [] */0 - }, c); - case "Beg_of_word" : - case "End_of_word" : - case "Not_bound" : - return split(cword, c); - case "Last_end_of_line" : - lnl.contents = true; - return; - case "Beg_of_str" : - case "End_of_str" : - case "Start" : - case "Stop" : - return; - - } - } else { - switch (regexp.TAG) { - case "Set" : - return split(regexp._0, c); - case "Sequence" : - case "Alternative" : - return List.iter(colorize$1, regexp._0); - case "Repeat" : - case "Group" : - case "No_group" : - case "Nest" : - _regexp = regexp._0; - continue; - case "Sem" : - case "Sem_greedy" : - case "Pmark" : - _regexp = regexp._1; - continue; - default: - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "ocaml_re_test.res", - 2169, - 8 - ], - Error: new Error() - }; - } - } - }; - }; - colorize$1(regexp); - return lnl.contents; -} - -function flatten_cmap(cm) { - let c = Caml_bytes.create(256); - let col_repr = Caml_bytes.create(256); - let v = 0; - Caml_bytes.set(c, 0, /* '\000' */0); - Caml_bytes.set(col_repr, 0, /* '\000' */0); - for(let i = 1; i <= 255; ++i){ - if (Caml_bytes.get(cm, i) !== /* '\000' */0) { - v = v + 1 | 0; - } - Caml_bytes.set(c, i, Char.chr(v)); - Caml_bytes.set(col_repr, v, Char.chr(i)); - } - return [ - c, - Bytes.sub(col_repr, 0, v + 1 | 0), - v + 1 | 0 - ]; -} - -function equal$2(_x1, _x2) { - while(true) { - let x2 = _x2; - let x1 = _x1; - if (typeof x1 !== "object") { - switch (x1) { - case "Beg_of_line" : - if (typeof x2 !== "object" && x2 === "Beg_of_line") { - return true; - } else { - return false; - } - case "End_of_line" : - if (typeof x2 !== "object" && x2 === "End_of_line") { - return true; - } else { - return false; - } - case "Beg_of_word" : - if (typeof x2 !== "object" && x2 === "Beg_of_word") { - return true; - } else { - return false; - } - case "End_of_word" : - if (typeof x2 !== "object" && x2 === "End_of_word") { - return true; - } else { - return false; - } - case "Not_bound" : - if (typeof x2 !== "object" && x2 === "Not_bound") { - return true; - } else { - return false; - } - case "Beg_of_str" : - if (typeof x2 !== "object" && x2 === "Beg_of_str") { - return true; - } else { - return false; - } - case "End_of_str" : - if (typeof x2 !== "object" && x2 === "End_of_str") { - return true; - } else { - return false; - } - case "Last_end_of_line" : - if (typeof x2 !== "object" && x2 === "Last_end_of_line") { - return true; - } else { - return false; - } - case "Start" : - if (typeof x2 !== "object" && x2 === "Start") { - return true; - } else { - return false; - } - case "Stop" : - if (typeof x2 !== "object" && x2 === "Stop") { - return true; - } else { - return false; - } - - } - } else { - switch (x1.TAG) { - case "Set" : - if (typeof x2 !== "object" || x2.TAG !== "Set") { - return false; - } else { - return Caml_obj.equal(x1._0, x2._0); - } - case "Sequence" : - if (typeof x2 !== "object" || x2.TAG !== "Sequence") { - return false; - } else { - return eq_list(x1._0, x2._0); - } - case "Alternative" : - if (typeof x2 !== "object" || x2.TAG !== "Alternative") { - return false; - } else { - return eq_list(x1._0, x2._0); - } - case "Repeat" : - if (typeof x2 !== "object") { - return false; - } - if (x2.TAG !== "Repeat") { - return false; - } - if (x1._1 !== x2._1) { - return false; - } - if (!Caml_obj.equal(x1._2, x2._2)) { - return false; - } - _x2 = x2._0; - _x1 = x1._0; - continue; - case "Sem" : - if (typeof x2 !== "object") { - return false; - } - if (x2.TAG !== "Sem") { - return false; - } - if (x1._0 !== x2._0) { - return false; - } - _x2 = x2._1; - _x1 = x1._1; - continue; - case "Sem_greedy" : - if (typeof x2 !== "object") { - return false; - } - if (x2.TAG !== "Sem_greedy") { - return false; - } - if (x1._0 !== x2._0) { - return false; - } - _x2 = x2._1; - _x1 = x1._1; - continue; - case "Group" : - return false; - case "No_group" : - if (typeof x2 !== "object") { - return false; - } - if (x2.TAG !== "No_group") { - return false; - } - _x2 = x2._0; - _x1 = x1._0; - continue; - case "Nest" : - if (typeof x2 !== "object") { - return false; - } - if (x2.TAG !== "Nest") { - return false; - } - _x2 = x2._0; - _x1 = x1._0; - continue; - case "Case" : - if (typeof x2 !== "object") { - return false; - } - if (x2.TAG !== "Case") { - return false; - } - _x2 = x2._0; - _x1 = x1._0; - continue; - case "No_case" : - if (typeof x2 !== "object") { - return false; - } - if (x2.TAG !== "No_case") { - return false; - } - _x2 = x2._0; - _x1 = x1._0; - continue; - case "Intersection" : - if (typeof x2 !== "object" || x2.TAG !== "Intersection") { - return false; - } else { - return eq_list(x1._0, x2._0); - } - case "Complement" : - if (typeof x2 !== "object" || x2.TAG !== "Complement") { - return false; - } else { - return eq_list(x1._0, x2._0); - } - case "Difference" : - if (typeof x2 !== "object") { - return false; - } - if (x2.TAG !== "Difference") { - return false; - } - if (!equal$2(x1._0, x2._0)) { - return false; - } - _x2 = x2._1; - _x1 = x1._1; - continue; - case "Pmark" : - if (typeof x2 !== "object") { - return false; - } - if (x2.TAG !== "Pmark") { - return false; - } - if (x1._0 !== x2._0) { - return false; - } - _x2 = x2._1; - _x1 = x1._1; - continue; - - } - } - }; -} - -function eq_list(_l1, _l2) { - while(true) { - let l2 = _l2; - let l1 = _l1; - if (!l1) { - if (l2) { - return false; - } else { - return true; - } - } - if (!l2) { - return false; - } - if (!equal$2(l1.hd, l2.hd)) { - return false; - } - _l2 = l2.tl; - _l1 = l1.tl; - continue; - }; -} - -function sequence(x) { - if (x && !x.tl) { - return x.hd; - } else { - return { - TAG: "Sequence", - _0: x - }; - } -} - -function merge_sequences(_x) { - while(true) { - let x = _x; - if (!x) { - return /* [] */0; - } - let l$p = x.hd; - if (typeof l$p === "object") { - switch (l$p.TAG) { - case "Sequence" : - let match = l$p._0; - if (match) { - let y = match.tl; - let x$1 = match.hd; - let r$p = merge_sequences(x.tl); - let exit = 0; - if (r$p) { - let match$1 = r$p.hd; - if (typeof match$1 !== "object" || match$1.TAG !== "Sequence") { - exit = 2; - } else { - let match$2 = match$1._0; - if (match$2) { - if (equal$2(x$1, match$2.hd)) { - return { - hd: { - TAG: "Sequence", - _0: { - hd: x$1, - tl: { - hd: { - TAG: "Alternative", - _0: { - hd: sequence(y), - tl: { - hd: sequence(match$2.tl), - tl: /* [] */0 - } - } - }, - tl: /* [] */0 - } - } - }, - tl: r$p.tl - }; - } - exit = 2; - } else { - exit = 2; - } - } - } else { - exit = 2; - } - if (exit === 2) { - return { - hd: { - TAG: "Sequence", - _0: { - hd: x$1, - tl: y - } - }, - tl: r$p - }; - } - - } - break; - case "Alternative" : - _x = Pervasives.$at(l$p._0, x.tl); - continue; - default: - - } - } - return { - hd: l$p, - tl: merge_sequences(x.tl) - }; - }; -} - -function enforce_kind(ids, kind, kind$p, cr) { - if (kind === "First" && kind$p !== "First") { - return seq$1(ids, kind$p, cr, mk_expr(ids, "Eps")); - } else { - return cr; - } -} - -function translate(ids, kind, _ign_group, ign_case, _greedy, pos, cache, c, _x) { - while(true) { - let x = _x; - let greedy = _greedy; - let ign_group = _ign_group; - 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 - }), - 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 - }), - 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 - })), - 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 - })), - 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 - })), - 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 - })), - tl: /* [] */0 - } - }), - kind - ]; - case "Beg_of_str" : - return [ - mk_expr(ids, { - TAG: "After", - _0: Re_automata_Category.inexistant - }), - kind - ]; - case "End_of_str" : - return [ - mk_expr(ids, { - TAG: "Before", - _0: 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 - }), - kind - ]; - case "Start" : - return [ - mk_expr(ids, { - TAG: "After", - _0: Re_automata_Category.search_boundary - }), - kind - ]; - case "Stop" : - return [ - mk_expr(ids, { - TAG: "Before", - _0: Re_automata_Category.search_boundary - }), - kind - ]; - - } - } else { - switch (x.TAG) { - case "Set" : - return [ - cst(ids, trans_set(cache, c, x._0)), - kind - ]; - case "Sequence" : - return [ - trans_seq(ids, kind, ign_group, ign_case, greedy, pos, cache, c, x._0), - kind - ]; - case "Alternative" : - let merged_sequences = merge_sequences(x._0); - if (merged_sequences && !merged_sequences.tl) { - let match = translate(ids, kind, ign_group, ign_case, greedy, pos, cache, c, merged_sequences.hd); - return [ - enforce_kind(ids, kind, match[1], match[0]), - kind - ]; - } - return [ - alt(ids, List.map((function (r$p) { - let match = translate(ids, kind, ign_group, ign_case, greedy, pos, cache, c, r$p); - return enforce_kind(ids, kind, match[1], match[0]); - }), merged_sequences)), - kind - ]; - case "Repeat" : - let j = x._2; - let i = x._1; - let match$1 = translate(ids, kind, ign_group, ign_case, greedy, pos, cache, c, x._0); - let kind$p = match$1[1]; - let cr = match$1[0]; - let rem; - if (j !== undefined) { - let f = greedy === "Non_greedy" ? (function (rem) { - return alt(ids, { - hd: mk_expr(ids, "Eps"), - tl: { - hd: seq$1(ids, kind$p, rename(ids, cr), rem), - tl: /* [] */0 - } - }); - }) : (function (rem) { - return alt(ids, { - hd: seq$1(ids, kind$p, rename(ids, cr), rem), - tl: { - hd: mk_expr(ids, "Eps"), - tl: /* [] */0 - } - }); - }); - rem = iter(j - i | 0, f, mk_expr(ids, "Eps")); - } else { - rem = rep(ids, greedy, kind$p, cr); - } - return [ - iter(i, (function (rem) { - return seq$1(ids, kind$p, rename(ids, cr), rem); - }), rem), - kind - ]; - case "Sem" : - let kind$p$1 = x._0; - let match$2 = translate(ids, kind$p$1, ign_group, ign_case, greedy, pos, cache, c, x._1); - return [ - enforce_kind(ids, kind$p$1, match$2[1], match$2[0]), - kind$p$1 - ]; - case "Sem_greedy" : - _x = x._1; - _greedy = x._0; - continue; - case "Group" : - let r$p = x._0; - if (ign_group) { - _x = r$p; - continue; - } - let p = pos.contents; - 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 - }))), - match$3[1] - ]; - case "No_group" : - _x = x._0; - _ign_group = true; - continue; - case "Nest" : - let b = pos.contents; - let match$4 = translate(ids, kind, ign_group, ign_case, greedy, pos, cache, c, x._0); - let kind$p$2 = match$4[1]; - let cr$1 = match$4[0]; - let e = pos.contents - 1 | 0; - if (e < b) { - return [ - cr$1, - kind$p$2 - ]; - } else { - return [ - seq$1(ids, "First", erase(ids, b, e), cr$1), - kind$p$2 - ]; - } - 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]), - match$5[1] - ]; - default: - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "ocaml_re_test.res", - 2403, - 80 - ], - Error: new Error() - }; - } - } - }; -} - -function trans_seq(ids, kind, ign_group, ign_case, greedy, pos, cache, c, x) { - if (!x) { - return mk_expr(ids, "Eps"); - } - let rem = x.tl; - let r = x.hd; - if (rem) { - let match = translate(ids, kind, ign_group, ign_case, greedy, pos, cache, c, r); - let cr$p = match[0]; - let cr$p$p = trans_seq(ids, kind, ign_group, ign_case, greedy, pos, cache, c, rem); - if (is_eps(cr$p$p)) { - return cr$p; - } else if (is_eps(cr$p)) { - return cr$p$p; - } else { - return seq$1(ids, match[1], cr$p, cr$p$p); - } - } - let match$1 = translate(ids, kind, ign_group, ign_case, greedy, pos, cache, c, r); - return enforce_kind(ids, kind, match$1[1], match$1[0]); -} - -function case_insens(s) { - return union(s, union(offset(32, inter(s, cupper)), offset(-32, inter(s, clower)))); -} - -function as_set(x) { - if (typeof x !== "object") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "ocaml_re_test.res", - 2438, - 11 - ], - Error: new Error() - }; - } - if (x.TAG === "Set") { - return x._0; - } - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "ocaml_re_test.res", - 2438, - 11 - ], - Error: new Error() - }; -} - -function handle_case(_ign_case, _x) { - while(true) { - let x = _x; - let ign_case = _ign_case; - if (typeof x !== "object") { - return x; - } - switch (x.TAG) { - case "Set" : - let s = x._0; - return { - TAG: "Set", - _0: ign_case ? case_insens(s) : s - }; - case "Sequence" : - return { - TAG: "Sequence", - _0: List.map((function (param) { - return handle_case(ign_case, param); - }), x._0) - }; - case "Alternative" : - let l$p = List.map((function (param) { - return handle_case(ign_case, param); - }), x._0); - if (is_charset({ - TAG: "Alternative", - _0: l$p - })) { - return { - TAG: "Set", - _0: List.fold_left((function (s, r) { - return union(s, as_set(r)); - }), /* [] */0, l$p) - }; - } else { - return { - TAG: "Alternative", - _0: l$p - }; - } - case "Repeat" : - return { - TAG: "Repeat", - _0: handle_case(ign_case, x._0), - _1: x._1, - _2: x._2 - }; - case "Sem" : - let r$p = handle_case(ign_case, x._1); - if (is_charset(r$p)) { - return r$p; - } else { - return { - TAG: "Sem", - _0: x._0, - _1: r$p - }; - } - case "Sem_greedy" : - let r$p$1 = handle_case(ign_case, x._1); - if (is_charset(r$p$1)) { - return r$p$1; - } else { - return { - TAG: "Sem_greedy", - _0: x._0, - _1: r$p$1 - }; - } - case "Group" : - return { - TAG: "Group", - _0: handle_case(ign_case, x._0) - }; - case "No_group" : - let r$p$2 = handle_case(ign_case, x._0); - if (is_charset(r$p$2)) { - return r$p$2; - } else { - return { - TAG: "No_group", - _0: r$p$2 - }; - } - case "Nest" : - let r$p$3 = handle_case(ign_case, x._0); - if (is_charset(r$p$3)) { - return r$p$3; - } else { - return { - TAG: "Nest", - _0: r$p$3 - }; - } - case "Case" : - _x = x._0; - _ign_case = false; - continue; - case "No_case" : - _x = x._0; - _ign_case = true; - continue; - case "Intersection" : - let l$p$1 = List.map((function (r) { - return handle_case(ign_case, r); - }), x._0); - return { - TAG: "Set", - _0: List.fold_left((function (s, r) { - return inter(s, as_set(r)); - }), cany, l$p$1) - }; - case "Complement" : - let l$p$2 = List.map((function (r) { - return handle_case(ign_case, r); - }), x._0); - return { - TAG: "Set", - _0: diff(cany, List.fold_left((function (s, r) { - return union(s, as_set(r)); - }), /* [] */0, l$p$2)) - }; - case "Difference" : - return { - TAG: "Set", - _0: inter(as_set(handle_case(ign_case, x._0)), diff(cany, as_set(handle_case(ign_case, x._1)))) - }; - case "Pmark" : - return { - TAG: "Pmark", - _0: x._0, - _1: handle_case(ign_case, x._1) - }; - - } - }; -} - -function anchored(_x) { - while(true) { - let x = _x; - if (typeof x !== "object") { - switch (x) { - case "Beg_of_str" : - case "Start" : - return true; - default: - return false; - } - } else { - switch (x.TAG) { - case "Sequence" : - return List.exists(anchored, x._0); - case "Alternative" : - return List.for_all(anchored, x._0); - case "Repeat" : - if (x._1 <= 0) { - return false; - } - _x = x._0; - continue; - case "Group" : - case "No_group" : - case "Nest" : - case "Case" : - case "No_case" : - _x = x._0; - continue; - case "Sem" : - case "Sem_greedy" : - case "Pmark" : - _x = x._1; - continue; - default: - return false; - } - } - }; -} - -function alt$1(x) { - if (x && !x.tl) { - return x.hd; - } else { - return { - TAG: "Alternative", - _0: x - }; - } -} - -function seq$2(x) { - if (x && !x.tl) { - return x.hd; - } else { - return { - TAG: "Sequence", - _0: x - }; - } -} - -let epsilon = { - TAG: "Sequence", - _0: /* [] */0 -}; - -function repn(r, i, j) { - if (i < 0) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Re.repn", - Error: new Error() - }; - } - if (j !== undefined && j < i) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Re.repn", - Error: new Error() - }; - } - return { - TAG: "Repeat", - _0: r, - _1: i, - _2: j - }; -} - -function set(str) { - let s = /* [] */0; - for(let i = 0 ,i_finish = str.length; i < i_finish; ++i){ - s = union(single(Caml_string.get(str, i)), s); - } - return { - TAG: "Set", - _0: s - }; -} - -function compl(l) { - let r = { - TAG: "Complement", - _0: l - }; - if (is_charset(r)) { - return r; - } - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Re.compl", - Error: new Error() - }; -} - -let any = { - TAG: "Set", - _0: cany -}; - -let notnl = { - TAG: "Set", - _0: diff(cany, { - hd: [ - /* '\n' */10, - /* '\n' */10 - ], - tl: /* [] */0 - }) -}; - -let lower = alt$1({ - hd: { - TAG: "Set", - _0: seq(/* 'a' */97, /* 'z' */122) - }, - tl: { - hd: { - TAG: "Set", - _0: { - hd: [ - /* '\181' */181, - /* '\181' */181 - ], - tl: /* [] */0 - } - }, - tl: { - hd: { - TAG: "Set", - _0: seq(/* '\223' */223, /* '\246' */246) - }, - tl: { - hd: { - TAG: "Set", - _0: seq(/* '\248' */248, /* '\255' */255) - }, - tl: /* [] */0 - } - } - } -}); - -let upper = alt$1({ - hd: { - TAG: "Set", - _0: seq(/* 'A' */65, /* 'Z' */90) - }, - tl: { - hd: { - TAG: "Set", - _0: seq(/* '\192' */192, /* '\214' */214) - }, - tl: { - hd: { - TAG: "Set", - _0: seq(/* '\216' */216, /* '\222' */222) - }, - tl: /* [] */0 - } - } -}); - -let alpha = alt$1({ - hd: lower, - tl: { - hd: upper, - tl: { - hd: { - TAG: "Set", - _0: { - hd: [ - /* '\170' */170, - /* '\170' */170 - ], - tl: /* [] */0 - } - }, - tl: { - hd: { - TAG: "Set", - _0: { - hd: [ - /* '\186' */186, - /* '\186' */186 - ], - tl: /* [] */0 - } - }, - tl: /* [] */0 - } - } - } -}); - -let digit = { - TAG: "Set", - _0: seq(/* '0' */48, /* '9' */57) -}; - -let alnum = alt$1({ - hd: alpha, - tl: { - hd: digit, - tl: /* [] */0 - } -}); - -let wordc = alt$1({ - hd: alnum, - tl: { - hd: { - TAG: "Set", - _0: { - hd: [ - /* '_' */95, - /* '_' */95 - ], - tl: /* [] */0 - } - }, - tl: /* [] */0 - } -}); - -let ascii = { - TAG: "Set", - _0: seq(/* '\000' */0, /* '\127' */127) -}; - -let blank = set("\t "); - -let cntrl = alt$1({ - hd: { - TAG: "Set", - _0: seq(/* '\000' */0, /* '\031' */31) - }, - tl: { - hd: { - TAG: "Set", - _0: seq(/* '\127' */127, /* '\159' */159) - }, - tl: /* [] */0 - } -}); - -let graph = alt$1({ - hd: { - TAG: "Set", - _0: seq(/* '!' */33, /* '~' */126) - }, - tl: { - hd: { - TAG: "Set", - _0: seq(/* '\160' */160, /* '\255' */255) - }, - tl: /* [] */0 - } -}); - -let print = alt$1({ - hd: { - TAG: "Set", - _0: seq(/* ' ' */32, /* '~' */126) - }, - tl: { - hd: { - TAG: "Set", - _0: seq(/* '\160' */160, /* '\255' */255) - }, - tl: /* [] */0 - } -}); - -let punct = alt$1({ - hd: { - TAG: "Set", - _0: seq(/* '!' */33, /* '/' */47) - }, - tl: { - hd: { - TAG: "Set", - _0: seq(/* ':' */58, /* '@' */64) - }, - tl: { - hd: { - TAG: "Set", - _0: seq(/* '[' */91, /* '`' */96) - }, - tl: { - hd: { - TAG: "Set", - _0: seq(/* '{' */123, /* '~' */126) - }, - tl: { - hd: { - TAG: "Set", - _0: seq(/* '\160' */160, /* '\169' */169) - }, - tl: { - hd: { - TAG: "Set", - _0: seq(/* '\171' */171, /* '\180' */180) - }, - tl: { - hd: { - TAG: "Set", - _0: seq(/* '\182' */182, /* '\185' */185) - }, - tl: { - hd: { - TAG: "Set", - _0: seq(/* '\187' */187, /* '\191' */191) - }, - tl: { - hd: { - TAG: "Set", - _0: { - hd: [ - /* '\215' */215, - /* '\215' */215 - ], - tl: /* [] */0 - } - }, - tl: { - hd: { - TAG: "Set", - _0: { - hd: [ - /* '\247' */247, - /* '\247' */247 - ], - tl: /* [] */0 - } - }, - tl: /* [] */0 - } - } - } - } - } - } - } - } - } -}); - -let space = alt$1({ - hd: { - TAG: "Set", - _0: { - hd: [ - /* ' ' */32, - /* ' ' */32 - ], - tl: /* [] */0 - } - }, - tl: { - hd: { - TAG: "Set", - _0: seq(/* '\t' */9, /* '\r' */13) - }, - tl: /* [] */0 - } -}); - -let xdigit = alt$1({ - hd: digit, - tl: { - hd: { - TAG: "Set", - _0: seq(/* 'a' */97, /* 'f' */102) - }, - tl: { - hd: { - TAG: "Set", - _0: seq(/* '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; - if (pos < 0 || len < -1 || (pos + len | 0) > s.length) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: name, - Error: new Error() - }; - } - let partial = false; - let slen = s.length; - let last = len === -1 ? slen : pos + len | 0; - let tmp; - if (groups) { - let n = re.tbl.contents.length + 1 | 0; - tmp = n <= 10 ? [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ] : Caml_array.make(n, 0); - } else { - tmp = []; - } - let info = { - re: re, - i_cols: re.cols, - positions: tmp, - 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_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 match = $$final(info, st, final_cat); - if (groups) { - Caml_array.set(info.positions, match[0], last + 1 | 0); - } - res = match[1]; - } - if (typeof res !== "object") { - if (res === "Failed") { - return "Failed"; - } else { - return "Running"; - } - } else { - return { - TAG: "Match", - _0: { - s: s, - marks: res._0, - pmarks: res._1, - gpos: info.positions, - gcount: re.group_count - } - }; - } -} - -function offset$1(t, i) { - if (((i << 1) + 1 | 0) >= t.marks.length) { - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; - } - let m1 = Caml_array.get(t.marks, (i << 1)); - if (m1 === -1) { - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; - } - let p1 = Caml_array.get(t.gpos, m1) - 1 | 0; - let p2 = Caml_array.get(t.gpos, Caml_array.get(t.marks, (i << 1) + 1 | 0)) - 1 | 0; - return [ - p1, - p2 - ]; -} - -function get(t, i) { - let match = offset$1(t, i); - let p1 = match[0]; - return $$String.sub(t.s, p1, match[1] - p1 | 0); -} - -let Parse_error = /* @__PURE__ */Caml_exceptions.create("Parse_error"); - -let Not_supported = /* @__PURE__ */Caml_exceptions.create("Not_supported"); - -function posix_class_of_string(x) { - switch (x) { - case "alnum" : - return alnum; - case "ascii" : - return ascii; - case "blank" : - return blank; - case "cntrl" : - return cntrl; - case "digit" : - return digit; - case "graph" : - return graph; - case "lower" : - return lower; - case "print" : - return print; - case "punct" : - return punct; - case "space" : - return space; - case "upper" : - return upper; - case "word" : - return wordc; - case "xdigit" : - return xdigit; - default: - let s = "Invalid pcre class: " + x; - throw { - RE_EXN_ID: "Invalid_argument", - _1: s, - Error: new Error() - }; - } -} - -function parse(multiline, dollar_endonly, dotall, ungreedy, s) { - let i = { - contents: 0 - }; - let l = s.length; - let test = function (c) { - if (i.contents !== l) { - return Caml_string.get(s, i.contents) === c; - } else { - return false; - } - }; - let accept = function (c) { - let r = test(c); - if (r) { - i.contents = i.contents + 1 | 0; - } - return r; - }; - let accept_s = function (s$p) { - let len = s$p.length; - try { - for(let j = 0; j < len; ++j){ - try { - if (Caml_string.get(s$p, j) !== Caml_string.get(s, i.contents + j | 0)) { - throw { - RE_EXN_ID: Pervasives.Exit, - Error: new Error() - }; - } - - } - catch (exn){ - throw { - RE_EXN_ID: Pervasives.Exit, - Error: new Error() - }; - } - } - i.contents = i.contents + len | 0; - return true; - } - catch (raw_exn){ - let exn$1 = Caml_js_exceptions.internalToOCamlException(raw_exn); - if (exn$1.RE_EXN_ID === Pervasives.Exit) { - return false; - } - throw exn$1; - } - }; - let get = function (param) { - let r = Caml_string.get(s, i.contents); - i.contents = i.contents + 1 | 0; - return r; - }; - let greedy_mod = function (r) { - let gr = accept(/* '?' */63); - let gr$1 = ungreedy ? !gr : gr; - if (gr$1) { - return { - TAG: "Sem_greedy", - _0: "Non_greedy", - _1: r - }; - } else { - return { - TAG: "Sem_greedy", - _0: "Greedy", - _1: r - }; - } - }; - let atom = function (param) { - if (accept(/* '.' */46)) { - if (dotall) { - return any; - } else { - return notnl; - } - } - if (accept(/* '(' */40)) { - if (accept(/* '?' */63)) { - if (accept(/* ':' */58)) { - let r = regexp$p(branch$p(/* [] */0)); - if (!accept(/* ')' */41)) { - throw { - RE_EXN_ID: Parse_error, - Error: new Error() - }; - } - return r; - } - if (accept(/* '#' */35)) { - let _param; - while(true) { - if (accept(/* ')' */41)) { - return epsilon; - } - i.contents = i.contents + 1 | 0; - _param = undefined; - continue; - }; - } - throw { - RE_EXN_ID: Parse_error, - Error: new Error() - }; - } - let r$1 = regexp$p(branch$p(/* [] */0)); - if (!accept(/* ')' */41)) { - throw { - RE_EXN_ID: Parse_error, - Error: new Error() - }; - } - return { - TAG: "Group", - _0: r$1 - }; - } - if (accept(/* '^' */94)) { - if (multiline) { - return "Beg_of_line"; - } else { - return "Beg_of_str"; - } - } - if (accept(/* '$' */36)) { - if (multiline) { - return "End_of_line"; - } else if (dollar_endonly) { - return "Last_end_of_line"; - } else { - return "End_of_str"; - } - } - if (accept(/* '[' */91)) { - if (accept(/* '^' */94)) { - return compl(bracket(/* [] */0)); - } else { - return alt$1(bracket(/* [] */0)); - } - } - if (accept(/* '\\' */92)) { - if (i.contents === l) { - throw { - RE_EXN_ID: Parse_error, - Error: new Error() - }; - } - let c = get(); - switch (c) { - case 48 : - case 49 : - case 50 : - case 51 : - case 52 : - case 53 : - case 54 : - case 55 : - case 56 : - case 57 : - throw { - RE_EXN_ID: Not_supported, - Error: new Error() - }; - case 65 : - return "Beg_of_str"; - case 66 : - return "Not_bound"; - case 68 : - return compl({ - hd: digit, - tl: /* [] */0 - }); - case 71 : - return "Start"; - case 83 : - return compl({ - hd: space, - tl: /* [] */0 - }); - case 87 : - return compl({ - hd: alnum, - tl: { - hd: { - TAG: "Set", - _0: { - hd: [ - /* '_' */95, - /* '_' */95 - ], - tl: /* [] */0 - } - }, - tl: /* [] */0 - } - }); - case 90 : - return "Last_end_of_line"; - case 98 : - return alt$1({ - hd: "Beg_of_word", - tl: { - hd: "End_of_word", - tl: /* [] */0 - } - }); - case 100 : - return digit; - case 115 : - return space; - case 119 : - return alt$1({ - hd: alnum, - tl: { - hd: { - TAG: "Set", - _0: { - hd: [ - /* '_' */95, - /* '_' */95 - ], - tl: /* [] */0 - } - }, - tl: /* [] */0 - } - }); - case 67 : - case 69 : - case 70 : - case 72 : - case 73 : - case 74 : - case 75 : - case 76 : - case 77 : - case 78 : - case 79 : - case 80 : - case 81 : - case 82 : - case 84 : - case 85 : - case 86 : - case 88 : - case 89 : - case 97 : - case 99 : - case 101 : - case 102 : - case 103 : - case 104 : - case 105 : - case 106 : - case 107 : - case 108 : - case 109 : - case 110 : - case 111 : - case 112 : - case 113 : - case 114 : - case 116 : - case 117 : - case 118 : - case 120 : - case 121 : - throw { - RE_EXN_ID: Parse_error, - Error: new Error() - }; - case 122 : - return "End_of_str"; - default: - return { - TAG: "Set", - _0: single(c) - }; - } - } else { - if (i.contents === l) { - throw { - RE_EXN_ID: Parse_error, - Error: new Error() - }; - } - let c$1 = get(); - if (c$1 >= 64) { - if (c$1 !== 92) { - if (c$1 !== 123) { - return { - TAG: "Set", - _0: single(c$1) - }; - } - throw { - RE_EXN_ID: Parse_error, - Error: new Error() - }; - } - throw { - RE_EXN_ID: Parse_error, - Error: new Error() - }; - } - if (c$1 >= 44) { - if (c$1 >= 63) { - throw { - RE_EXN_ID: Parse_error, - Error: new Error() - }; - } - return { - TAG: "Set", - _0: single(c$1) - }; - } - if (c$1 >= 42) { - throw { - RE_EXN_ID: Parse_error, - Error: new Error() - }; - } - return { - TAG: "Set", - _0: single(c$1) - }; - } - }; - 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 { - RE_EXN_ID: Parse_error, - Error: new Error() - }; - } - _i = i$p; - continue; - }; - } - }; - let $$char = function (param) { - if (i.contents === l) { - throw { - RE_EXN_ID: Parse_error, - Error: new Error() - }; - } - let c = get(); - if (c === /* '[' */91) { - if (accept(/* '=' */61)) { - throw { - RE_EXN_ID: Not_supported, - Error: new Error() - }; - } - if (accept(/* ':' */58)) { - let compl$1 = accept(/* '^' */94); - let cls; - try { - cls = List.find(accept_s, { - hd: "alnum", - tl: { - hd: "ascii", - tl: { - hd: "blank", - tl: { - hd: "cntrl", - tl: { - hd: "digit", - tl: { - hd: "lower", - tl: { - hd: "print", - tl: { - hd: "space", - tl: { - hd: "upper", - tl: { - hd: "word", - tl: { - hd: "punct", - tl: { - hd: "graph", - tl: { - hd: "xdigit", - tl: /* [] */0 - } - } - } - } - } - } - } - } - } - } - } - } - }); - } - catch (raw_exn){ - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); - if (exn.RE_EXN_ID === "Not_found") { - throw { - RE_EXN_ID: Parse_error, - Error: new Error() - }; - } - throw exn; - } - if (!accept_s(":]")) { - throw { - RE_EXN_ID: Parse_error, - Error: new Error() - }; - } - let posix_class = posix_class_of_string(cls); - let re = compl$1 ? compl({ - hd: posix_class, - tl: /* [] */0 - }) : posix_class; - return { - NAME: "Set", - VAL: re - }; - } - if (!accept(/* '.' */46)) { - return { - NAME: "Char", - VAL: c - }; - } - if (i.contents === l) { - throw { - RE_EXN_ID: Parse_error, - Error: new Error() - }; - } - let c$1 = get(); - if (!accept(/* '.' */46)) { - throw { - RE_EXN_ID: Not_supported, - Error: new Error() - }; - } - if (!accept(/* ']' */93)) { - throw { - RE_EXN_ID: Parse_error, - Error: new Error() - }; - } - return { - NAME: "Char", - VAL: c$1 - }; - } - if (c !== /* '\\' */92) { - return { - NAME: "Char", - VAL: c - }; - } - let c$2 = get(); - if (c$2 >= 58) { - if (c$2 >= 123) { - return { - NAME: "Char", - VAL: c$2 - }; - } - switch (c$2) { - case 68 : - return { - NAME: "Set", - VAL: compl({ - hd: digit, - tl: /* [] */0 - }) - }; - case 83 : - return { - NAME: "Set", - VAL: compl({ - hd: space, - tl: /* [] */0 - }) - }; - case 87 : - return { - NAME: "Set", - VAL: compl({ - hd: alnum, - tl: { - hd: { - TAG: "Set", - _0: { - hd: [ - /* '_' */95, - /* '_' */95 - ], - tl: /* [] */0 - } - }, - tl: /* [] */0 - } - }) - }; - case 58 : - case 59 : - case 60 : - case 61 : - case 62 : - case 63 : - case 64 : - case 91 : - case 92 : - case 93 : - case 94 : - case 95 : - case 96 : - return { - NAME: "Char", - VAL: c$2 - }; - case 98 : - return { - NAME: "Char", - VAL: /* '\b' */8 - }; - case 100 : - return { - NAME: "Set", - VAL: digit - }; - case 110 : - return { - NAME: "Char", - VAL: /* '\n' */10 - }; - case 114 : - return { - NAME: "Char", - VAL: /* '\r' */13 - }; - case 115 : - return { - NAME: "Set", - VAL: space - }; - case 116 : - return { - NAME: "Char", - VAL: /* '\t' */9 - }; - case 119 : - return { - NAME: "Set", - VAL: alt$1({ - hd: alnum, - tl: { - hd: { - TAG: "Set", - _0: { - hd: [ - /* '_' */95, - /* '_' */95 - ], - tl: /* [] */0 - } - }, - tl: /* [] */0 - } - }) - }; - case 65 : - case 66 : - case 67 : - case 69 : - case 70 : - case 71 : - case 72 : - case 73 : - case 74 : - case 75 : - case 76 : - case 77 : - case 78 : - case 79 : - case 80 : - case 81 : - case 82 : - case 84 : - case 85 : - case 86 : - case 88 : - case 89 : - case 90 : - case 97 : - case 99 : - case 101 : - case 102 : - case 103 : - case 104 : - case 105 : - case 106 : - case 107 : - case 108 : - case 109 : - case 111 : - case 112 : - case 113 : - case 117 : - case 118 : - case 120 : - case 121 : - case 122 : - throw { - RE_EXN_ID: Parse_error, - Error: new Error() - }; - - } - } else { - if (c$2 >= 48) { - throw { - RE_EXN_ID: Not_supported, - Error: new Error() - }; - } - return { - NAME: "Char", - VAL: c$2 - }; - } - }; - let bracket = function (_s) { - while(true) { - let s = _s; - if (s !== /* [] */0 && accept(/* ']' */93)) { - return s; - } - let match = $$char(); - if (match.NAME === "Char") { - let c = match.VAL; - if (accept(/* '-' */45)) { - if (accept(/* ']' */93)) { - return { - hd: { - TAG: "Set", - _0: single(c) - }, - tl: { - hd: { - TAG: "Set", - _0: { - hd: [ - /* '-' */45, - /* '-' */45 - ], - tl: /* [] */0 - } - }, - tl: s - } - }; - } - let match$1 = $$char(); - if (match$1.NAME !== "Char") { - return { - hd: { - TAG: "Set", - _0: single(c) - }, - tl: { - hd: { - TAG: "Set", - _0: { - hd: [ - /* '-' */45, - /* '-' */45 - ], - tl: /* [] */0 - } - }, - tl: { - hd: match$1.VAL, - tl: s - } - } - }; - } - _s = { - hd: { - TAG: "Set", - _0: seq(c, match$1.VAL) - }, - tl: s - }; - continue; - } - _s = { - hd: { - TAG: "Set", - _0: single(c) - }, - tl: s - }; - continue; - } - _s = { - hd: match.VAL, - tl: 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 { - RE_EXN_ID: Parse_error, - Error: new Error() - }; - } - if (j !== undefined && j < i$1) { - throw { - RE_EXN_ID: Parse_error, - Error: new Error() - }; - } - return greedy_mod(repn(r, i$1, j)); - } - i.contents = i.contents - 1 | 0; - return r; - }; - 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 regexp$p = function (_left) { - while(true) { - let left = _left; - if (!accept(/* '|' */124)) { - return left; - } - _left = alt$1({ - hd: left, - tl: { - hd: branch$p(/* [] */0), - tl: /* [] */0 - } - }); - continue; - }; - }; - let res = regexp$p(branch$p(/* [] */0)); - if (i.contents !== l) { - throw { - RE_EXN_ID: Parse_error, - Error: new Error() - }; - } - return res; -} - -function re(flagsOpt, pat) { - let flags = flagsOpt !== undefined ? flagsOpt : /* [] */0; - let opts = List.map((function (x) { - if (x === "CASELESS") { - return "Caseless"; - } else if (x === "ANCHORED") { - return "Anchored"; - } else { - return "Multiline"; - } - }), flags); - let optsOpt = opts; - let opts$1 = optsOpt !== undefined ? optsOpt : /* [] */0; - let r = parse(List.memq("Multiline", opts$1), List.memq("Dollar_endonly", opts$1), List.memq("Dotall", opts$1), List.memq("Ungreedy", opts$1), pat); - let r$1 = List.memq("Anchored", opts$1) ? seq$2({ - hd: "Start", - tl: { - hd: r, - tl: /* [] */0 - } - }) : r; - if (List.memq("Caseless", opts$1)) { - return { - TAG: "No_case", - _0: r$1 - }; - } else { - return r$1; - } -} - -function exec(rex, pos, s) { - let len; - let substr = exec_internal("Re.exec", pos, len, true, rex, s); - if (typeof substr === "object") { - return substr._0; - } - if (substr === "Failed") { - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; - } - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; -} - -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"); - -Mt.from_pair_suites("Ocaml_re_test", suites.contents); - -/* Table Not a pure module */ diff --git a/jscomp/test/ocaml_re_test.res b/jscomp/test/ocaml_re_test.res deleted file mode 100644 index c75c80134b..0000000000 --- a/jscomp/test/ocaml_re_test.res +++ /dev/null @@ -1,3847 +0,0 @@ -@@config({flags: ["-w", "a", "-bs-no-bin-annot"], no_export}) -let suites: ref = ref(list{}) -let test_id = ref(0) -let eq = (loc, x, y) => { - incr(test_id) - suites := - list{(loc ++ (" id " ++ string_of_int(test_id.contents)), _ => Mt.Eq(x, y)), ...suites.contents} -} - -module Re_cset: { - /* - RE - A regular expression library - - Copyright (C) 2001 Jerome Vouillon - email: Jerome.Vouillon@pps.jussieu.fr - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation, with - linking exception; either version 2.1 of the License, or (at - your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - - /* Character sets, represented as sorted list of intervals */ - - type c = int - type t - - let iter: (t, ~f: (c, c) => unit) => unit - - let union: (t, t) => t - let inter: (t, t) => t - let diff: (t, t) => t - let offset: (int, t) => t - - let empty: t - let single: c => t - let seq: (c, c) => t - let add: (c, t) => t - - let mem: (c, t) => bool - - type hash - let hash: t => hash - - let one_char: t => option - - let fold_right: (t, ~init: 'acc, ~f: ((c, c), 'acc) => 'acc) => 'acc - - let hash_rec: t => int - - module CSetMap: Map.S with type key = (int, t) - - let cany: t - - let csingle: char => t - - let is_empty: t => bool - - let prepend: (t, list<'a>, list<(t, list<'a>)>) => list<(t, list<'a>)> - - let pick: t => c -} = { - /* - RE - A regular expression library - - Copyright (C) 2001 Jerome Vouillon - email: Jerome.Vouillon@pps.jussieu.fr - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation, with - linking exception; either version 2.1 of the License, or (at - your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - - type c = int - type t = list<(c, c)> - - let rec union = (l, l') => - switch (l, l') { - | (_, list{}) => l - | (list{}, _) => l' - | (list{(c1, c2), ...r}, list{(c1', c2'), ...r'}) => - if c2 + 1 < c1' { - list{(c1, c2), ...union(r, l')} - } else if c2' + 1 < c1 { - list{(c1', c2'), ...union(l, r')} - } else if c2 < c2' { - union(r, list{(min(c1, c1'), c2'), ...r'}) - } else { - union(list{(min(c1, c1'), c2), ...r}, r') - } - } - - let rec inter = (l, l') => - switch (l, l') { - | (_, list{}) => list{} - | (list{}, _) => list{} - | (list{(c1, c2), ...r}, list{(c1', c2'), ...r'}) => - if c2 < c1' { - inter(r, l') - } else if c2' < c1 { - inter(l, r') - } else if c2 < c2' { - list{(max(c1, c1'), c2), ...inter(r, l')} - } else { - list{(max(c1, c1'), c2'), ...inter(l, r')} - } - } - - let rec diff = (l, l') => - switch (l, l') { - | (_, list{}) => l - | (list{}, _) => list{} - | (list{(c1, c2), ...r}, list{(c1', c2'), ...r'}) => - if c2 < c1' { - list{(c1, c2), ...diff(r, l')} - } else if c2' < c1 { - diff(l, r') - } else { - let r'' = if c2' < c2 { - list{(c2' + 1, c2), ...r} - } else { - r - } - if c1 < c1' { - list{(c1, c1' - 1), ...diff(r'', r')} - } else { - diff(r'', r') - } - } - } - - let single = c => list{(c, c)} - - let add = (c, l) => union(single(c), l) - - let seq = (c, c') => - if c <= c' { - list{(c, c')} - } else { - list{(c', c)} - } - - let rec offset = (o, l) => - switch l { - | list{} => list{} - | list{(c1, c2), ...r} => list{(c1 + o, c2 + o), ...offset(o, r)} - } - - let empty = list{} - - let rec mem = (c: int, s) => - switch s { - | list{} => false - | list{(c1, c2), ...rem} => - if c <= c2 { - c >= c1 - } else { - mem(c, rem) - } - } - - /* ** */ - - type hash = int - - let rec hash_rec = x => - switch x { - | list{} => 0 - | list{(i, j), ...r} => i + 13 * j + 257 * hash_rec(r) - } - let hash = l => land(hash_rec(l), 0x3FFFFFFF) - - /* ** */ - - /* let%ignore pp = Re_fmt.list print_one */ - - let rec iter = (t, ~f) => - switch t { - | list{} => () - | list{(x, y), ...xs} => - f(x, y) - iter(xs, ~f) - } - - let one_char = x => - switch x { - | list{(i, j)} if i == j => Some(i) - | _ => None - } - - module CSetMap = Map.Make({ - type t = (int, list<(int, int)>) - let compare = ((i, u), (j, v)) => { - let c = compare(i, j) - if c != 0 { - c - } else { - compare(u, v) - } - } - }) - - let fold_right = (t, ~init, ~f) => List.fold_right(f, t, init) - - let csingle = c => single(Char.code(c)) - - let cany = list{(0, 255)} - - let is_empty = x => - switch x { - | list{} => true - | _ => false - } - - let rec prepend = (s, x, l) => - switch (s, l) { - | (list{}, _) => l - | (_r, list{}) => list{} - | (list{(_c, c'), ...r}, list{(list{(d, _d')}, _x'), ..._r'}) if c' < d => prepend(r, x, l) - | (list{(c, c'), ...r}, list{(list{(d, d')}, x'), ...r'}) => - if c <= d { - if c' < d' { - list{ - (list{(d, c')}, \"@"(x, x')), - ...prepend(r, x, list{(list{(c' + 1, d')}, x'), ...r'}), - } - } else { - list{(list{(d, d')}, \"@"(x, x')), ...prepend(s, x, r')} - } - } else if c > d' { - list{(list{(d, d')}, x'), ...prepend(s, x, r')} - } else { - list{(list{(d, c - 1)}, x'), ...prepend(s, x, list{(list{(c, d')}, x'), ...r'})} - } - | _ => assert(false) - } - - let pick = x => - switch x { - | list{} => invalid_arg("Re_cset.pick") - | list{(x, _), ..._} => x - } -} -module Re_automata: { - /* - RE - A regular expression library - - Copyright (C) 2001 Jerome Vouillon - email: Jerome.Vouillon@pps.jussieu.fr - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation, with - linking exception; either version 2.1 of the License, or (at - your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - - /* Regular expressions */ - - @ocaml.doc(" Categories represent the various kinds of characters that can be tested - by look-ahead and look-behind operations. - - This is more restricted than Cset, but faster. -") - module Category: { - type t - let \"++": (t, t) => t - let from_char: char => t - - let inexistant: t - let letter: t - let not_letter: t - let newline: t - let lastnewline: t - let search_boundary: t - } - - type mark = int - - type sem = [#Longest | #Shortest | #First] - type rep_kind = [#Greedy | #Non_greedy] - - module Pmark: { - type t = private int - let equal: (t, t) => bool - let compare: (t, t) => int - let gen: unit => t - } - - type expr - let is_eps: expr => bool - - type ids - let create_ids: unit => ids - - let cst: (ids, Re_cset.t) => expr - let empty: ids => expr - let alt: (ids, list) => expr - let seq: (ids, sem, expr, expr) => expr - let eps: ids => expr - let rep: (ids, rep_kind, sem, expr) => expr - let mark: (ids, mark) => expr - let pmark: (ids, Pmark.t) => expr - let erase: (ids, mark, mark) => expr - let before: (ids, Category.t) => expr - let after: (ids, Category.t) => expr - - let rename: (ids, expr) => expr - - /* ** */ - - module PmarkSet: Set.S with type elt = Pmark.t - - /* States of the automata */ - - type idx = int - module Marks: { - type t = { - marks: list<(mark, idx)>, - pmarks: PmarkSet.t, - } - } - - module E: { - type t - } - - type hash - type mark_infos = array - type status = Failed | Match(mark_infos, PmarkSet.t) | Running - - module State: { - type t = { - idx: idx, - category: Category.t, - desc: list, - mutable status: option, - hash: hash, - } - let dummy: t - let create: (Category.t, expr) => t - module Table: Hashtbl.S with type key = t - } - - /* ** */ - - /* Computation of the states following a given state */ - - type working_area - let create_working_area: unit => working_area - let index_count: working_area => int - - let delta: (working_area, Category.t, Re_cset.c, State.t) => State.t - let deriv: ( - working_area, - Re_cset.t, - list<(Category.t, Re_cset.t)>, - State.t, - ) => list<(Re_cset.t, State.t)> - - /* ** */ - - let status: State.t => status -} = { - /* - RE - A regular expression library - - Copyright (C) 2001 Jerome Vouillon - email: Jerome.Vouillon@pps.jussieu.fr - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation, with - linking exception; either version 2.1 of the License, or (at - your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - - module Cset = Re_cset - - type sem = [#Longest | #Shortest | #First] - - type rep_kind = [#Greedy | #Non_greedy] - - module Category: { - type t - let equal: (t, t) => bool - let compare: (t, t) => int - - let to_int: t => int - - let intersect: (t, t) => bool - let \"++": (t, t) => t - let from_char: char => t - - let dummy: t - let inexistant: t - let letter: t - let not_letter: t - let newline: t - let lastnewline: t - let search_boundary: t - } = { - type t = int - let equal = (x: int, y: int) => x == y - let compare = (x: int, y: int) => compare(x, y) - let to_int = x => x - - let intersect = (x, y) => land(x, y) != 0 - let \"++" = (x, y) => lor(x, y) - - let dummy = -1 - let inexistant = 1 - let letter = 2 - let not_letter = 4 - let newline = 8 - let lastnewline = 16 - let search_boundary = 32 - - let from_char = x => - /* Should match [cword] definition */ - switch x { - | 'a' .. 'z' - | 'A' .. 'Z' - | '0' .. '9' - | '_' - | 'ª' - | 'µ' - | 'º' - | 'À' .. 'Ö' - | 'Ø' .. 'ö' - | 'ø' .. 'ÿ' => letter - | '\n' => \"++"(not_letter, newline) - | _ => not_letter - } - } - - type mark = int - type idx = int - - module Pmark: { - type t = private int - let equal: (t, t) => bool - let compare: (t, t) => int - let gen: unit => t - } = { - type t = int - let equal = (x: int, y: int) => x == y - let compare = (x: int, y: int) => compare(x, y) - let r = ref(0) - let gen = () => { - incr(r) - r.contents - } - } - - type rec expr = {id: int, def: def} - - and def = - | Cst(Cset.t) - | Alt(list) - | Seq(sem, expr, expr) - | Eps - | Rep(rep_kind, sem, expr) - | Mark(int) - | Erase(int, int) - | Before(Category.t) - | After(Category.t) - | Pmark(Pmark.t) - - module PmarkSet = Set.Make(Pmark) - - let hash_combine = (h, accu) => accu * 65599 + h - - module Marks = { - type t = { - marks: list<(int, int)>, - pmarks: PmarkSet.t, - } - - let empty = {marks: list{}, pmarks: PmarkSet.empty} - - let rec merge_marks_offset = (old, x) => - switch x { - | list{} => old - | list{(i, v), ...rem} => - let nw' = merge_marks_offset(List.remove_assq(i, old), rem) - if v == -2 { - nw' - } else { - list{(i, v), ...nw'} - } - } - - let merge = (old, nw) => { - marks: merge_marks_offset(old.marks, nw.marks), - pmarks: PmarkSet.union(old.pmarks, nw.pmarks), - } - - let rec hash_marks_offset = (l, accu) => - switch l { - | list{} => accu - | list{(a, i), ...r} => hash_marks_offset(r, hash_combine(a, hash_combine(i, accu))) - } - - let hash = (m, accu) => hash_marks_offset(m.marks, hash_combine(Hashtbl.hash(m.pmarks), accu)) - - let rec marks_set_idx = (idx, x) => - switch x { - | list{(a, -1), ...rem} => list{(a, idx), ...marks_set_idx(idx, rem)} - | marks => marks - } - - let marks_set_idx = (marks, idx) => {...marks, marks: marks_set_idx(idx, marks.marks)} - } - - /* ** */ - - /* let%ignore rec pp ch e = - let open Re_fmt in - match e.def with - Cst l -> - sexp ch "cst" Cset.pp l; - | Alt l -> - sexp ch "alt" (list pp) l - | Seq (k, e, e') -> - sexp ch "seq" (triple pp_sem pp pp) (k, e, e') - | Eps -> - str ch "eps" - | Rep (_rk, k, e) -> - sexp ch "rep" (pair pp_sem pp) (k, e) - | Mark i -> - sexp ch "mark" int i - | Pmark i -> - sexp ch "pmark" int (i :> int) - | Erase (b, e) -> - sexp ch "erase" (pair int int) (b, e) - | Before c -> - sexp ch "before" Category.pp c - | After c -> - sexp ch "after" Category.pp c - - */ - /* ** */ - - let rec first = (f, x) => - switch x { - | list{} => None - | list{x, ...r} => - switch f(x) { - | None => first(f, r) - | Some(_) as res => res - } - } - - /* ** */ - - type ids = ref - let create_ids = () => ref(0) - - let eps_expr = {id: 0, def: Eps} - - let mk_expr = (ids, def) => { - incr(ids) - {id: ids.contents, def} - } - - let empty = ids => mk_expr(ids, Alt(list{})) - - let cst = (ids, s) => - if Re_cset.is_empty(s) { - empty(ids) - } else { - mk_expr(ids, Cst(s)) - } - - let alt = (ids, x) => - switch x { - | list{} => empty(ids) - | list{c} => c - | l => mk_expr(ids, Alt(l)) - } - - let seq = (ids, kind, x, y) => - switch (x.def, y.def) { - | (Alt(list{}), _) => x - | (_, Alt(list{})) => y - | (Eps, _) => y - | (_, Eps) if kind == #First => x - | _ => mk_expr(ids, Seq(kind, x, y)) - } - - let is_eps = expr => - switch expr.def { - | Eps => true - | _ => false - } - - let eps = ids => mk_expr(ids, Eps) - - let rep = (ids, kind, sem, x) => mk_expr(ids, Rep(kind, sem, x)) - - let mark = (ids, m) => mk_expr(ids, Mark(m)) - - let pmark = (ids, i) => mk_expr(ids, Pmark(i)) - - let erase = (ids, m, m') => mk_expr(ids, Erase(m, m')) - - let before = (ids, c) => mk_expr(ids, Before(c)) - - let after = (ids, c) => mk_expr(ids, After(c)) - - /* ** */ - - let rec rename = (ids, x) => - switch x.def { - | Cst(_) | Eps | Mark(_) | Pmark(_) | Erase(_) | Before(_) | After(_) => mk_expr(ids, x.def) - | Alt(l) => mk_expr(ids, Alt(List.map(rename(ids), l))) - | Seq(k, y, z) => mk_expr(ids, Seq(k, rename(ids, y), rename(ids, z))) - | Rep(g, k, y) => mk_expr(ids, Rep(g, k, rename(ids, y))) - } - - /* ** */ - - type hash = int - type mark_infos = array - type status = Failed | Match(mark_infos, PmarkSet.t) | Running - - module E = { - type rec t = - | TSeq(list, expr, sem) - | TExp(Marks.t, expr) - | TMatch(Marks.t) - - let rec equal = (l1, l2) => - switch (l1, l2) { - | (list{}, list{}) => true - | (list{TSeq(l1', e1, _), ...r1}, list{TSeq(l2', e2, _), ...r2}) => - e1.id == e2.id && (equal(l1', l2') && equal(r1, r2)) - | (list{TExp(marks1, e1), ...r1}, list{TExp(marks2, e2), ...r2}) => - e1.id == e2.id && (marks1 == marks2 && equal(r1, r2)) - | (list{TMatch(marks1), ...r1}, list{TMatch(marks2), ...r2}) => - marks1 == marks2 && equal(r1, r2) - | _ => false - } - - let rec hash = (l, accu) => - switch l { - | list{} => accu - | list{TSeq(l', e, _), ...r} => - hash(r, hash_combine(0x172a1bce, hash_combine(e.id, hash(l', accu)))) - | list{TExp(marks, e), ...r} => - hash(r, hash_combine(0x2b4c0d77, hash_combine(e.id, Marks.hash(marks, accu)))) - | list{TMatch(marks), ...r} => hash(r, hash_combine(0x1c205ad5, Marks.hash(marks, accu))) - } - - let texp = (marks, x) => TExp(marks, x) - - let tseq = (kind, x, y, rem) => - switch x { - | list{} => rem - | list{TExp(marks, {def: Eps, _})} => list{TExp(marks, y), ...rem} - | _ => list{TSeq(x, y, kind), ...rem} - } - } - - module State = { - type t = { - idx: idx, - category: Category.t, - desc: list, - mutable status: option, - hash: hash, - } - - let dummy = { - idx: -1, - category: Category.dummy, - desc: list{}, - status: None, - hash: -1, - } - - let hash = (idx, cat, desc) => - land(E.hash(desc, hash_combine(idx, hash_combine(Category.to_int(cat), 0))), 0x3FFFFFFF) - - let mk = (idx, cat, desc) => { - idx, - category: cat, - desc, - status: None, - hash: hash(idx, cat, desc), - } - - let create = (cat, e) => mk(0, cat, list{E.TExp(Marks.empty, e)}) - - let equal = (x, y) => - (x.hash: int) == y.hash && - ((x.idx: int) == y.idx && - (Category.equal(x.category, y.category) && E.equal(x.desc, y.desc))) - - let compare = (x, y) => { - let c = compare((x.hash: int), y.hash) - if c != 0 { - c - } else { - let c = Category.compare(x.category, y.category) - if c != 0 { - c - } else { - compare(x.desc, y.desc) - } - } - } - - type t' = t - module Table = Hashtbl.Make({ - type t = t' - let equal = equal - let hash = t => t.hash - }) - } - - /* *** Find a free index *** */ - - type working_area = ref> - - let create_working_area = () => ref([false]) - - let index_count = w => Array.length(w.contents) - - let reset_table = a => Array.fill(a, 0, Array.length(a), false) - - let rec mark_used_indices = tbl => - List.iter(x => - switch x { - | E.TSeq(l, _, _) => mark_used_indices(tbl, l) - | E.TExp(marks, _) - | E.TMatch(marks) => - List.iter(((_, i)) => - if i >= 0 { - tbl[i] = true - } - , marks.Marks.marks) - } - ) - - let rec find_free = (tbl, idx, len) => - if idx == len || !tbl[idx] { - idx - } else { - find_free(tbl, idx + 1, len) - } - - let free_index = (tbl_ref, l) => { - let tbl = tbl_ref.contents - reset_table(tbl) - mark_used_indices(tbl, l) - let len = Array.length(tbl) - let idx = find_free(tbl, 0, len) - if idx == len { - tbl_ref := Array.make(2 * len, false) - } - idx - } - - /* *** Computation of the next state *** */ - - let remove_matches = List.filter(x => - switch x { - | E.TMatch(_) => false - | _ => true - } - ) - - let rec split_at_match_rec = (l', x) => - switch x { - | list{} => assert(false) - | list{E.TMatch(_), ...r} => (List.rev(l'), remove_matches(r)) - | list{x, ...r} => split_at_match_rec(list{x, ...l'}, r) - } - - let split_at_match = l => split_at_match_rec(list{}, l) - - let rec remove_duplicates = (prev, l, y) => - switch l { - | list{} => (list{}, prev) - | list{E.TMatch(_) as x, ..._} => /* Truncate after first match */ - (list{x}, prev) - | list{E.TSeq(l', x, kind), ...r} => - let (l'', prev') = remove_duplicates(prev, l', x) - let (r', prev'') = remove_duplicates(prev', r, y) - (E.tseq(kind, l'', x, r'), prev'') - | list{E.TExp(_marks, {def: Eps, _}) as e, ...r} => - if List.memq(y.id, prev) { - remove_duplicates(prev, r, y) - } else { - let (r', prev') = remove_duplicates(list{y.id, ...prev}, r, y) - (list{e, ...r'}, prev') - } - | list{E.TExp(_marks, x) as e, ...r} => - if List.memq(x.id, prev) { - remove_duplicates(prev, r, y) - } else { - let (r', prev') = remove_duplicates(list{x.id, ...prev}, r, y) - (list{e, ...r'}, prev') - } - } - - let rec set_idx = (idx, x) => - switch x { - | list{} => list{} - | list{E.TMatch(marks), ...r} => - list{E.TMatch(Marks.marks_set_idx(marks, idx)), ...set_idx(idx, r)} - | list{E.TSeq(l', x, kind), ...r} => list{E.TSeq(set_idx(idx, l'), x, kind), ...set_idx(idx, r)} - | list{E.TExp(marks, x), ...r} => - list{E.TExp(Marks.marks_set_idx(marks, idx), x), ...set_idx(idx, r)} - } - - let filter_marks = (b, e, marks) => { - ...marks, - Marks.marks: List.filter(((i, _)) => i < b || i > e, marks.Marks.marks), - } - - let rec delta_1 = (marks, c, ~next_cat, ~prev_cat, x, rem) => - switch x.def { - | Cst(s) => - if Cset.mem(c, s) { - list{E.texp(marks, eps_expr), ...rem} - } else { - rem - } - | Alt(l) => delta_2(marks, c, ~next_cat, ~prev_cat, l, rem) - | Seq(kind, y, z) => - let y' = delta_1(marks, c, ~next_cat, ~prev_cat, y, list{}) - delta_seq(c, ~next_cat, ~prev_cat, kind, y', z, rem) - | Rep(rep_kind, kind, y) => - let y' = delta_1(marks, c, ~next_cat, ~prev_cat, y, list{}) - let (y'', marks') = switch first(x => - switch x { - | E.TMatch(marks) => Some(marks) - | _ => None - } - , y') { - | None => (y', marks) - | Some(marks') => (remove_matches(y'), marks') - } - - switch rep_kind { - | #Greedy => E.tseq(kind, y'', x, list{E.TMatch(marks'), ...rem}) - | #Non_greedy => list{E.TMatch(marks), ...E.tseq(kind, y'', x, rem)} - } - | Eps => list{E.TMatch(marks), ...rem} - | Mark(i) => - let marks = {...marks, Marks.marks: list{(i, -1), ...List.remove_assq(i, marks.Marks.marks)}} - list{E.TMatch(marks), ...rem} - | Pmark(i) => - let marks = {...marks, Marks.pmarks: PmarkSet.add(i, marks.Marks.pmarks)} - list{E.TMatch(marks), ...rem} - | Erase(b, e) => list{E.TMatch(filter_marks(b, e, marks)), ...rem} - | Before(cat'') => - if Category.intersect(next_cat, cat'') { - list{E.TMatch(marks), ...rem} - } else { - rem - } - | After(cat'') => - if Category.intersect(prev_cat, cat'') { - list{E.TMatch(marks), ...rem} - } else { - rem - } - } - - and delta_2 = (marks, c, ~next_cat, ~prev_cat, l, rem) => - switch l { - | list{} => rem - | list{y, ...r} => - delta_1(marks, c, ~next_cat, ~prev_cat, y, delta_2(marks, c, ~next_cat, ~prev_cat, r, rem)) - } - - and delta_seq = (c, ~next_cat, ~prev_cat, kind, y, z, rem) => - switch first(x => - switch x { - | E.TMatch(marks) => Some(marks) - | _ => None - } - , y) { - | None => E.tseq(kind, y, z, rem) - | Some(marks) => - switch kind { - | #Longest => - E.tseq(kind, remove_matches(y), z, delta_1(marks, c, ~next_cat, ~prev_cat, z, rem)) - | #Shortest => - delta_1(marks, c, ~next_cat, ~prev_cat, z, E.tseq(kind, remove_matches(y), z, rem)) - | #First => - let (y', y'') = split_at_match(y) - E.tseq(kind, y', z, delta_1(marks, c, ~next_cat, ~prev_cat, z, E.tseq(kind, y'', z, rem))) - } - } - - let rec delta_3 = (c, ~next_cat, ~prev_cat, x, rem) => - switch x { - | E.TSeq(y, z, kind) => - let y' = delta_4(c, ~next_cat, ~prev_cat, y, list{}) - delta_seq(c, ~next_cat, ~prev_cat, kind, y', z, rem) - | E.TExp(marks, e) => delta_1(marks, c, ~next_cat, ~prev_cat, e, rem) - | E.TMatch(_) => list{x, ...rem} - } - - and delta_4 = (c, ~next_cat, ~prev_cat, l, rem) => - switch l { - | list{} => rem - | list{y, ...r} => delta_3(c, ~next_cat, ~prev_cat, y, delta_4(c, ~next_cat, ~prev_cat, r, rem)) - } - - let delta = (tbl_ref, next_cat, char, st) => { - let prev_cat = st.State.category - let (expr', _) = remove_duplicates( - list{}, - delta_4(char, ~next_cat, ~prev_cat, st.State.desc, list{}), - eps_expr, - ) - let idx = free_index(tbl_ref, expr') - let expr'' = set_idx(idx, expr') - State.mk(idx, next_cat, expr'') - } - - /* ** */ - - let rec red_tr = x => - switch x { - | (list{} | list{_}) as l => l - | list{(s1, st1) as tr1, (s2, st2) as tr2, ...rem} => - if State.equal(st1, st2) { - red_tr(list{(Cset.union(s1, s2), st1), ...rem}) - } else { - list{tr1, ...red_tr(list{tr2, ...rem})} - } - } - - let simpl_tr = l => - List.sort( - ((s1, _), (s2, _)) => compare(s1, s2), - red_tr(List.sort(((_, st1), (_, st2)) => State.compare(st1, st2), l)), - ) - - /* ** */ - - let prepend_deriv = List.fold_right(((s, x), l) => Cset.prepend(s, x, l)) - - let rec restrict = (s, x) => - switch x { - | list{} => list{} - | list{(s', x'), ...rem} => - let s'' = Cset.inter(s, s') - if Cset.is_empty(s'') { - restrict(s, rem) - } else { - list{(s'', x'), ...restrict(s, rem)} - } - } - - let rec remove_marks = (b, e, rem) => - if b > e { - rem - } else { - remove_marks(b, e - 1, list{(e, -2), ...rem}) - } - - let rec prepend_marks_expr = (m, x) => - switch x { - | E.TSeq(l, e', s) => E.TSeq(prepend_marks_expr_lst(m, l), e', s) - | E.TExp(m', e') => E.TExp(Marks.merge(m, m'), e') - | E.TMatch(m') => E.TMatch(Marks.merge(m, m')) - } - - and prepend_marks_expr_lst = (m, l) => List.map(prepend_marks_expr(m), l) - - let prepend_marks = m => List.map(((s, x)) => (s, prepend_marks_expr_lst(m, x))) - - let rec deriv_1 = (all_chars, categories, marks, cat, x, rem) => - switch x.def { - | Cst(s) => Cset.prepend(s, list{E.texp(marks, eps_expr)}, rem) - | Alt(l) => deriv_2(all_chars, categories, marks, cat, l, rem) - | Seq(kind, y, z) => - let y' = deriv_1(all_chars, categories, marks, cat, y, list{(all_chars, list{})}) - deriv_seq(all_chars, categories, cat, kind, y', z, rem) - | Rep(rep_kind, kind, y) => - let y' = deriv_1(all_chars, categories, marks, cat, y, list{(all_chars, list{})}) - List.fold_right(((s, z), rem) => { - let (z', marks') = switch first(x => - switch x { - | E.TMatch(marks) => Some(marks) - | _ => None - } - , z) { - | None => (z, marks) - | Some(marks') => (remove_matches(z), marks') - } - - Cset.prepend( - s, - switch rep_kind { - | #Greedy => E.tseq(kind, z', x, list{E.TMatch(marks')}) - | #Non_greedy => list{E.TMatch(marks), ...E.tseq(kind, z', x, list{})} - }, - rem, - ) - }, y', rem) - | Eps => Cset.prepend(all_chars, list{E.TMatch(marks)}, rem) - | Mark(i) => - Cset.prepend( - all_chars, - list{ - E.TMatch({ - ...marks, - Marks.marks: list{(i, -1), ...List.remove_assq(i, marks.Marks.marks)}, - }), - }, - rem, - ) - | Pmark(_) => Cset.prepend(all_chars, list{E.TMatch(marks)}, rem) - | Erase(b, e) => - Cset.prepend( - all_chars, - list{ - E.TMatch({ - ...marks, - Marks.marks: remove_marks(b, e, filter_marks(b, e, marks).Marks.marks), - }), - }, - rem, - ) - | Before(cat') => Cset.prepend(List.assq(cat', categories), list{E.TMatch(marks)}, rem) - | After(cat') => - if Category.intersect(cat, cat') { - Cset.prepend(all_chars, list{E.TMatch(marks)}, rem) - } else { - rem - } - } - - and deriv_2 = (all_chars, categories, marks, cat, l, rem) => - switch l { - | list{} => rem - | list{y, ...r} => - deriv_1( - all_chars, - categories, - marks, - cat, - y, - deriv_2(all_chars, categories, marks, cat, r, rem), - ) - } - - and deriv_seq = (all_chars, categories, cat, kind, y, z, rem) => - if List.exists(((_s, xl)) => List.exists(x => - switch x { - | E.TMatch(_) => true - | _ => false - } - , xl), y) { - let z' = deriv_1(all_chars, categories, Marks.empty, cat, z, list{(all_chars, list{})}) - List.fold_right(((s, y), rem) => - switch first(x => - switch x { - | E.TMatch(marks) => Some(marks) - | _ => None - } - , y) { - | None => Cset.prepend(s, E.tseq(kind, y, z, list{}), rem) - | Some(marks) => - let z'' = prepend_marks(marks, z') - switch kind { - | #Longest => - Cset.prepend( - s, - E.tseq(kind, remove_matches(y), z, list{}), - prepend_deriv(restrict(s, z''), rem), - ) - | #Shortest => - prepend_deriv( - restrict(s, z''), - Cset.prepend(s, E.tseq(kind, remove_matches(y), z, list{}), rem), - ) - | #First => - let (y', y'') = split_at_match(y) - Cset.prepend( - s, - E.tseq(kind, y', z, list{}), - prepend_deriv(restrict(s, z''), Cset.prepend(s, E.tseq(kind, y'', z, list{}), rem)), - ) - } - } - , y, rem) - } else { - List.fold_right(((s, xl), rem) => Cset.prepend(s, E.tseq(kind, xl, z, list{}), rem), y, rem) - } - - let rec deriv_3 = (all_chars, categories, cat, x, rem) => - switch x { - | E.TSeq(y, z, kind) => - let y' = deriv_4(all_chars, categories, cat, y, list{(all_chars, list{})}) - deriv_seq(all_chars, categories, cat, kind, y', z, rem) - | E.TExp(marks, e) => deriv_1(all_chars, categories, marks, cat, e, rem) - | E.TMatch(_) => Cset.prepend(all_chars, list{x}, rem) - } - - and deriv_4 = (all_chars, categories, cat, l, rem) => - switch l { - | list{} => rem - | list{y, ...r} => - deriv_3(all_chars, categories, cat, y, deriv_4(all_chars, categories, cat, r, rem)) - } - - let deriv = (tbl_ref, all_chars, categories, st) => { - let der = deriv_4( - all_chars, - categories, - st.State.category, - st.State.desc, - list{(all_chars, list{})}, - ) - simpl_tr(List.fold_right(((s, expr), rem) => { - let (expr', _) = remove_duplicates(list{}, expr, eps_expr) - let idx = free_index(tbl_ref, expr') - let expr'' = set_idx(idx, expr') - List.fold_right(((cat', s'), rem) => { - let s'' = Cset.inter(s, s') - if Cset.is_empty(s'') { - rem - } else { - list{(s'', State.mk(idx, cat', expr'')), ...rem} - } - }, categories, rem) - }, der, list{})) - } - - /* ** */ - - let flatten_match = m => { - let ma = List.fold_left((ma, (i, _)) => max(ma, i), -1, m) - let res = Array.make(ma + 1, -1) - List.iter(((i, v)) => res[i] = v, m) - res - } - - let status = s => - switch s.State.status { - | Some(st) => st - | None => - let st = switch s.State.desc { - | list{} => Failed - | list{E.TMatch(m), ..._} => Match(flatten_match(m.Marks.marks), m.Marks.pmarks) - | _ => Running - } - - s.State.status = Some(st) - st - } -} -module Re: { - @@ocaml.text( - /* - RE - A regular expression library - - Copyright (C) 2001 Jerome Vouillon - email: Jerome.Vouillon@pps.jussieu.fr - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation, with - linking exception; either version 2.1 of the License, or (at - your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - - " Module [Re]: regular expressions commons " - ) - - @ocaml.doc(" Regular expression ") - type t - - @ocaml.doc(" Compiled regular expression ") - type re - - @ocaml.doc(" Information about groups in a match. ") - type groups - - @@ocaml.text(" {2 Compilation and execution of a regular expression} ") - - @ocaml.doc(" Compile a regular expression into an executable version that can be - used to match strings, e.g. with {!exec}. ") - let compile: t => re - - @ocaml.doc(" [exec re str] matches [str] against the compiled expression [re], - and returns the matched groups if any. - @param pos optional beginning of the string (default 0) - @param len length of the substring of [str] that can be matched (default [-1], - meaning to the end of the string - @raise Not_found if the regular expression can't be found in [str] -") - let exec: ( - ~pos: int /* Default: 0 */=?, - ~len: int /* Default: -1 (until end of string) */=?, - re, - string, - ) => groups - - @ocaml.doc(" Similar to {!exec}, but returns an option instead of using an exception. ") - let exec_opt: ( - ~pos: int /* Default: 0 */=?, - ~len: int /* Default: -1 (until end of string) */=?, - re, - string, - ) => option - - @ocaml.doc(" Similar to {!exec}, but returns [true] if the expression matches, - and [false] if it doesn't ") - let execp: ( - ~pos: int /* Default: 0 */=?, - ~len: int /* Default: -1 (until end of string) */=?, - re, - string, - ) => bool - - @ocaml.doc(" More detailed version of {!exec_p} ") - let exec_partial: ( - ~pos: int /* Default: 0 */=?, - ~len: int /* Default: -1 (until end of string) */=?, - re, - string, - ) => [#Full | #Partial | #Mismatch] - - @ocaml.doc(" Manipulate matching groups. ") - module Group: { - @ocaml.doc(" Information about groups in a match. ") - type t = groups - - @ocaml.doc(" Raise [Not_found] if the group did not match ") - let get: (t, int) => string - - @ocaml.doc(" Raise [Not_found] if the group did not match ") - let offset: (t, int) => (int, int) - - @ocaml.doc(" Return the start of the match. Raise [Not_found] if the group did not match. ") - let start: (t, int) => int - - @ocaml.doc(" Return the end of the match. Raise [Not_found] if the group did not match. ") - let stop: (t, int) => int - - @ocaml.doc(" Return the empty string for each group which did not match ") - let all: t => array - - @ocaml.doc(" Return [(-1,-1)] for each group which did not match ") - let all_offset: t => array<(int, int)> - - @ocaml.doc(" Test whether a group matched ") - let test: (t, int) => bool - - @ocaml.doc(" Returns the total number of groups defined - matched or not. - This function is experimental. ") - let nb_groups: t => int - - /* val pp : Format.formatter -> t -> unit */ - } - - @ocaml.doc(" Marks ") - module Mark: { - @ocaml.doc(" Mark id ") - type t - - @ocaml.doc(" Tell if a mark was matched. ") - let test: (Group.t, t) => bool - - module Set: Set.S with type elt = t - - @ocaml.doc(" Return all the mark matched. ") - let all: Group.t => Set.t - - let equal: (t, t) => bool - let compare: (t, t) => int - } - - @@ocaml.text(" {2 High Level Operations} ") - - type gen<'a> = unit => option<'a> - - @ocaml.doc(" Repeatedly calls {!exec} on the given string, starting at given - position and length.") - let all: (~pos: int=?, ~len: int=?, re, string) => list - - @ocaml.doc(" Same as {!all} but returns a generator ") - let all_gen: (~pos: int=?, ~len: int=?, re, string) => gen - - @ocaml.doc(" Same as {!all}, but extracts the matched substring rather than - returning the whole group. This basically iterates over matched - strings ") - let matches: (~pos: int=?, ~len: int=?, re, string) => list - - @ocaml.doc(" Same as {!matches}, but returns a generator. ") - let matches_gen: (~pos: int=?, ~len: int=?, re, string) => gen - - @ocaml.doc(" [split re s] splits [s] into chunks separated by [re]. It yields - the chunks themselves, not the separator. For instance - this can be used with a whitespace-matching re such as [\"[\t ]+\"]. ") - let split: (~pos: int=?, ~len: int=?, re, string) => list - - let split_gen: (~pos: int=?, ~len: int=?, re, string) => gen - - type split_token = [ - | @ocaml.doc(" Text between delimiters ") #Text(string) - | @ocaml.doc(" Delimiter ") #Delim(Group.t) - ] - - let split_full: (~pos: int=?, ~len: int=?, re, string) => list - - let split_full_gen: (~pos: int=?, ~len: int=?, re, string) => gen - - @ocaml.doc(" [replace ~all re ~f s] iterates on [s], and replaces every occurrence - of [re] with [f substring] where [substring] is the current match. - If [all = false], then only the first occurrence of [re] is replaced. ") - let replace: ( - ~pos: int=?, - ~len: int=?, - ~all: bool=?, - re, - ~f: Group.t => string /* how to replace */, - string, - ) => string - - @ocaml.doc(" [replace_string ~all re ~by s] iterates on [s], and replaces every - occurrence of [re] with [by]. If [all = false], then only the first - occurrence of [re] is replaced. ") - let replace_string: (~pos: int=?, ~len: int=?, ~all: bool=?, re, ~by: string, string) => string - - @@ocaml.text(" {2 String expressions (literal match)} ") - - let str: string => t - let char: char => t - - @@ocaml.text(" {2 Basic operations on regular expressions} ") - - @ocaml.doc(" Alternative ") - let alt: list => t - - @ocaml.doc(" Sequence ") - let seq: list => t - - @ocaml.doc(" Match nothing ") - let empty: t - - @ocaml.doc(" Empty word ") - let epsilon: t - - @ocaml.doc(" 0 or more matches ") - let rep: t => t - - @ocaml.doc(" 1 or more matches ") - let rep1: t => t - - @ocaml.doc(" [repn re i j] matches [re] at least [i] times - and at most [j] times, bounds included. - [j = None] means no upper bound. -") - let repn: (t, int, option) => t - - @ocaml.doc(" 0 or 1 matches ") - let opt: t => t - - @@ocaml.text(" {2 String, line, word} ") - - @ocaml.doc(" Beginning of line ") - let bol: t - - @ocaml.doc(" End of line ") - let eol: t - - @ocaml.doc(" Beginning of word ") - let bow: t - - @ocaml.doc(" End of word ") - let eow: t - - @ocaml.doc(" Beginning of string ") - let bos: t - - @ocaml.doc(" End of string ") - let eos: t - - @ocaml.doc(" Last end of line or end of string ") - let leol: t - - @ocaml.doc(" Initial position ") - let start: t - - @ocaml.doc(" Final position ") - let stop: t - - @ocaml.doc(" Word ") - let word: t => t - - @ocaml.doc(" Not at a word boundary ") - let not_boundary: t - - @ocaml.doc(" Only matches the whole string ") - let whole_string: t => t - - @@ocaml.text(" {2 Match semantics} ") - - @ocaml.doc(" Longest match ") - let longest: t => t - - @ocaml.doc(" Shortest match ") - let shortest: t => t - - @ocaml.doc(" First match ") - let first: t => t - - @@ocaml.text(" {2 Repeated match modifiers} ") - - @ocaml.doc(" Greedy ") - let greedy: t => t - - @ocaml.doc(" Non-greedy ") - let non_greedy: t => t - - @@ocaml.text(" {2 Groups (or submatches)} ") - - @ocaml.doc(" Delimit a group ") - let group: t => t - - @ocaml.doc(" Remove all groups ") - let no_group: t => t - - @ocaml.doc(" when matching against [nest e], only the group matching in the - last match of e will be considered as matching ") - let nest: t => t - - @ocaml.doc(" Mark a regexp. the markid can then be used to know if this regexp was used. ") - let mark: t => (Mark.t, t) - - @@ocaml.text(" {2 Character sets} ") - - @ocaml.doc(" Any character of the string ") - let set: string => t - - @ocaml.doc(" Character ranges ") - let rg: (char, char) => t - - @ocaml.doc(" Intersection of character sets ") - let inter: list => t - - @ocaml.doc(" Difference of character sets ") - let diff: (t, t) => t - - @ocaml.doc(" Complement of union ") - let compl: list => t - - @@ocaml.text(" {2 Predefined character sets} ") - - @ocaml.doc(" Any character ") - let any: t - - @ocaml.doc(" Any character but a newline ") - let notnl: t - - let alnum: t - let wordc: t - let alpha: t - let ascii: t - let blank: t - let cntrl: t - let digit: t - let graph: t - let lower: t - let print: t - let punct: t - let space: t - let upper: t - let xdigit: t - - @@ocaml.text(" {2 Case modifiers} ") - - @ocaml.doc(" Case sensitive matching ") - let case: t => t - - @ocaml.doc(" Case insensitive matching ") - let no_case: t => t - - @@ocaml.text( - /* ** */ - - " {2 Internal debugging} " - ) - - @@ocaml.text( - /* val pp : Format.formatter -> t -> unit */ - - /* val pp_re : Format.formatter -> re -> unit */ - - " Alias for {!pp_re}. Deprecated " - ) - @@ocaml.text( - /* val print_re : Format.formatter -> re -> unit */ - - " {2 Experimental functions}. " - ) - - @ocaml.doc(" [witness r] generates a string [s] such that [execp (compile r) s] is - true ") - let witness: t => string - - @@ocaml.text(" {2 Deprecated functions} ") - - @ocaml.doc(" Alias for {!Group.t}. Deprecated ") - type substrings = Group.t - - @ocaml.doc(" Same as {!Group.get}. Deprecated ") - let get: (Group.t, int) => string - - @ocaml.doc(" Same as {!Group.offset}. Deprecated ") - let get_ofs: (Group.t, int) => (int, int) - - @ocaml.doc(" Same as {!Group.all}. Deprecated ") - let get_all: Group.t => array - - @ocaml.doc(" Same as {!Group.all_offset}. Deprecated ") - let get_all_ofs: Group.t => array<(int, int)> - - @ocaml.doc(" Same as {!Group.test}. Deprecated ") - let test: (Group.t, int) => bool - - @ocaml.doc(" Alias for {!Mark.t}. Deprecated ") - type markid = Mark.t - - @ocaml.doc(" Same as {!Mark.test}. Deprecated ") - let marked: (Group.t, Mark.t) => bool - - @ocaml.doc(" Same as {!Mark.all}. Deprecated ") - let mark_set: Group.t => Mark.Set.t -} = { - /* - RE - A regular expression library - - Copyright (C) 2001 Jerome Vouillon - email: Jerome.Vouillon@pps.jussieu.fr - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation, with - linking exception; either version 2.1 of the License, or (at - your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - - module Cset = Re_cset - module Automata = Re_automata - module MarkSet = Automata.PmarkSet - module Category = Automata.Category - - let rec iter = (n, f, v) => - if n == 0 { - v - } else { - iter(n - 1, f, f(v)) - } - - /* ** */ - - let unknown = -2 - let break = -3 - - /* Result of a successful match. */ - type groups = { - s: string, - /* Input string. Matched strings are substrings of s */ - marks: Automata.mark_infos, - /* Mapping from group indices to positions in gpos. group i has positions 2*i - - 1, 2*i + 1 in gpos. If the group wasn't matched, then its corresponding - values in marks will be -1,-1 */ - pmarks: MarkSet.t, - /* Marks positions. i.e. those marks created with Re.marks */ - gpos: array, - /* Group positions. Adjacent elements are (start, stop) of group match. - indexed by the values in marks. So group i in an re would be the substring: - - start = t.gpos.(marks.(2*i)) - 1 - stop = t.gpos.(marks.(2*i + 1)) - 1 */ - gcount: int, - /* Number of groups the regular expression contains. Matched or not */ - } - - type match_info = - | Match(groups) - | Failed - | Running - - type rec state = { - idx: int, - /* Index of the current position in the position table. - Not yet computed transitions point to a dummy state where - [idx] is set to [unknown]; - If [idx] is set to [break] for states that either always - succeed or always fail. */ - real_idx: int, - /* The real index, in case [idx] is set to [break] */ - next: array, - /* Transition table, indexed by color */ - mutable final: list<(Category.t, (Automata.idx, Automata.status))>, - /* Mapping from the category of the next character to - - the index where the next position should be saved - - possibly, the list of marks (and the corresponding indices) - corresponding to the best match */ - desc: Automata.State.t, - /* Description of this state of the automata */ - } - - /* Automata (compiled regular expression) */ - type re = { - initial: Automata.expr, - /* The whole regular expression */ - mutable initial_states: list<(Category.t, state)>, - /* Initial states, indexed by initial category */ - cols: Bytes.t, - /* Color table */ - col_repr: Bytes.t, - /* Table from colors to one character of this color */ - ncol: int, - /* Number of colors. */ - lnl: int, - /* Color of the last newline */ - tbl: Automata.working_area, - /* Temporary table used to compute the first available index - when computing a new state */ - states: Automata.State.Table.t, - /* States of the deterministic automata */ - group_count: int, - /* Number of groups in the regular expression */ - } - - /* let print_re = pp_re */ - - /* Information used during matching */ - type info = { - re: re, - /* The automata */ - i_cols: Bytes.t, - /* Color table ([x.i_cols = x.re.cols]) - Shortcut used for performance reasons */ - mutable positions: array, - /* Array of mark positions - The mark are off by one for performance reasons */ - pos: int, - /* Position where the match is started */ - last: int, - /* Position where the match should stop */ - } - - /* ** */ - - let category = (re, c) => - if c == -1 { - Category.inexistant - } /* Special category for the last newline */ - else if c == re.lnl { - open Category - \"++"(\"++"(lastnewline, newline), not_letter) - } else { - Category.from_char(Bytes.get(re.col_repr, c)) - } - - /* ** */ - - let dummy_next = [] - - let unknown_state = { - idx: unknown, - real_idx: 0, - next: dummy_next, - final: list{}, - desc: Automata.State.dummy, - } - - let mk_state = (ncol, desc) => { - let break_state = switch Automata.status(desc) { - | Automata.Running => false - | Automata.Failed - | Automata.Match(_) => true - } - - { - idx: if break_state { - break - } else { - desc.Automata.State.idx - }, - real_idx: desc.Automata.State.idx, - next: if break_state { - dummy_next - } else { - Array.make(ncol, unknown_state) - }, - final: list{}, - desc, - } - } - - let find_state = (re, desc) => - try Automata.State.Table.find(re.states, desc) catch { - | Not_found => - let st = mk_state(re.ncol, desc) - Automata.State.Table.add(re.states, desc, st) - st - } - - /* *** Match with marks *** */ - - let delta = (info, cat, c, st) => { - let desc = Automata.delta(info.re.tbl, cat, c, st.desc) - let len = Array.length(info.positions) - if desc.Automata.State.idx == len && len > 0 { - let pos = info.positions - info.positions = Array.make(2 * len, 0) - Array.blit(pos, 0, info.positions, 0, len) - } - desc - } - - let validate = (info, s: string, pos, st) => { - let c = Char.code(Bytes.get(info.i_cols, Char.code(String.get(s, pos)))) - let cat = category(info.re, c) - let desc' = delta(info, cat, c, st) - let st' = find_state(info.re, desc') - st.next[c] = st' - } - - /* -let rec loop info s pos st = - if pos < info.last then - let st' = st.next.(Char.code info.i_cols.[Char.code s.[pos]]) in - let idx = st'.idx in - if idx >= 0 then begin - info.positions.(idx) <- pos; - loop info s (pos + 1) st' - end else if idx = break then begin - info.positions.(st'.real_idx) <- pos; - st' - end else begin (* Unknown *) - validate info s pos st; - loop info s pos st - end - else - st -*/ - - let rec loop = (info, s: string, pos, st) => - if pos < info.last { - let st' = st.next[Char.code(Bytes.get(info.i_cols, Char.code(String.get(s, pos))))] - loop2(info, s, pos, st, st') - } else { - st - } - - and loop2 = (info, s, pos, st, st') => - if st'.idx >= 0 { - let pos = pos + 1 - if pos < info.last { - /* It is important to place these reads before the write */ - /* But then, we don't have enough registers left to store the - right position. So, we store the position plus one. */ - let st'' = st'.next[Char.code(Bytes.get(info.i_cols, Char.code(String.get(s, pos))))] - info.positions[st'.idx] = pos - loop2(info, s, pos, st', st'') - } else { - info.positions[st'.idx] = pos - st' - } - } else if st'.idx == break { - info.positions[st'.real_idx] = pos + 1 - st' - } else { - /* Unknown */ - validate(info, s, pos, st) - loop(info, s, pos, st) - } - - let rec loop_no_mark = (info, s, pos, last, st) => - if pos < last { - let st' = st.next[Char.code(Bytes.get(info.i_cols, Char.code(String.get(s, pos))))] - if st'.idx >= 0 { - loop_no_mark(info, s, pos + 1, last, st') - } else if st'.idx == break { - st' - } else { - /* Unknown */ - validate(info, s, pos, st) - loop_no_mark(info, s, pos, last, st) - } - } else { - st - } - - let final = (info, st, cat) => - try List.assq(cat, st.final) catch { - | Not_found => - let st' = delta(info, cat, -1, st) - let res = (st'.Automata.State.idx, Automata.status(st')) - st.final = list{(cat, res), ...st.final} - res - } - - let find_initial_state = (re, cat) => - try List.assq(cat, re.initial_states) catch { - | Not_found => - let st = find_state(re, Automata.State.create(cat, re.initial)) - re.initial_states = list{(cat, st), ...re.initial_states} - st - } - - let get_color = (re, s: string, pos) => - if pos < 0 { - -1 - } else { - let slen = String.length(s) - if pos >= slen { - -1 - } else if pos == slen - 1 && (re.lnl != -1 && String.get(s, pos) == '\n') { - /* Special case for the last newline */ - re.lnl - } else { - Char.code(Bytes.get(re.cols, Char.code(String.get(s, pos)))) - } - } - - let rec handle_last_newline = (info, pos, st, groups) => { - let st' = st.next[info.re.lnl] - if st'.idx >= 0 { - if groups { - info.positions[st'.idx] = pos + 1 - } - st' - } else if st'.idx == break { - if groups { - info.positions[st'.real_idx] = pos + 1 - } - st' - } else { - /* Unknown */ - let c = info.re.lnl - let real_c = Char.code(Bytes.get(info.i_cols, Char.code('\n'))) - let cat = category(info.re, c) - let desc' = delta(info, cat, real_c, st) - let st' = find_state(info.re, desc') - st.next[c] = st' - handle_last_newline(info, pos, st, groups) - } - } - - let rec scan_str = (info, s: string, initial_state, groups) => { - let pos = info.pos - let last = info.last - if ( - last == String.length(s) && - (info.re.lnl != -1 && - (last > pos && String.get(s, last - 1) == '\n')) - ) { - let info = {...info, last: last - 1} - let st = scan_str(info, s, initial_state, groups) - if st.idx == break { - st - } else { - handle_last_newline(info, last - 1, st, groups) - } - } else if groups { - loop(info, s, pos, initial_state) - } else { - loop_no_mark(info, s, pos, last, initial_state) - } - } - - let match_str = (~groups, ~partial, re, s, ~pos, ~len) => { - let slen = String.length(s) - let last = if len == -1 { - slen - } else { - pos + len - } - let info = { - re, - i_cols: re.cols, - pos, - last, - positions: if groups { - let n = Automata.index_count(re.tbl) + 1 - if n <= 10 { - [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] - } else { - Array.make(n, 0) - } - } else { - [] - }, - } - - let initial_cat = if pos == 0 { - open Category - \"++"(search_boundary, inexistant) - } else { - open Category - \"++"(search_boundary, category(re, get_color(re, s, pos - 1))) - } - let initial_state = find_initial_state(re, initial_cat) - let st = scan_str(info, s, initial_state, groups) - let res = if st.idx == break || partial { - Automata.status(st.desc) - } else { - let final_cat = if last == slen { - open Category - \"++"(search_boundary, inexistant) - } else { - open Category - \"++"(search_boundary, category(re, get_color(re, s, last))) - } - let (idx, res) = final(info, st, final_cat) - if groups { - info.positions[idx] = last + 1 - } - res - } - - switch res { - | Automata.Match(marks, pmarks) => - Match({s, marks, pmarks, gpos: info.positions, gcount: re.group_count}) - | Automata.Failed => Failed - | Automata.Running => Running - } - } - - let mk_re = (init, cols, col_repr, ncol, lnl, group_count) => { - initial: init, - initial_states: list{}, - cols, - col_repr, - ncol, - lnl, - tbl: Automata.create_working_area(), - states: Automata.State.Table.create(97), - group_count, - } - - /* *** Character sets *** */ - - let cseq = (c, c') => Cset.seq(Char.code(c), Char.code(c')) - let cadd = (c, s) => Cset.add(Char.code(c), s) - - let trans_set = (cache, cm, s) => - switch Cset.one_char(s) { - | Some(i) => Cset.csingle(Bytes.get(cm, i)) - | None => - let v = (Cset.hash_rec(s), s) - try Cset.CSetMap.find(v, cache.contents) catch { - | Not_found => - let l = Cset.fold_right( - s, - ~f=((i, j), l) => Cset.union(cseq(Bytes.get(cm, i), Bytes.get(cm, j)), l), - ~init=Cset.empty, - ) - - cache := Cset.CSetMap.add(v, l, cache.contents) - l - } - } - - /* ** */ - - type rec regexp = - | Set(Cset.t) - | Sequence(list) - | Alternative(list) - | Repeat(regexp, int, option) - | Beg_of_line - | End_of_line - | Beg_of_word - | End_of_word - | Not_bound - | Beg_of_str - | End_of_str - | Last_end_of_line - | Start - | Stop - | Sem(Automata.sem, regexp) - | Sem_greedy(Automata.rep_kind, regexp) - | Group(regexp) - | No_group(regexp) - | Nest(regexp) - | Case(regexp) - | No_case(regexp) - | Intersection(list) - | Complement(list) - | Difference(regexp, regexp) - | Pmark(Automata.Pmark.t, regexp) - - /* let %ignore rec pp fmt t = - let open Re_fmt in - let var s re = sexp fmt s pp re in - let seq s rel = sexp fmt s (list pp) rel in - match t with - | Set s -> sexp fmt "Set" Cset.pp s - | Sequence sq -> seq "Sequence" sq - | Alternative alt -> seq "Alternative" alt - | Repeat (re, start, stop) -> - let pp' fmt () = fprintf fmt "%a@ %d%a" pp re start optint stop in - sexp fmt "Repeat" pp' () - | Beg_of_line -> str fmt "Beg_of_line" - | End_of_line -> str fmt "End_of_line" - | Beg_of_word -> str fmt "Beg_of_word" - | End_of_word -> str fmt "End_of_word" - | Not_bound -> str fmt "Not_bound" - | Beg_of_str -> str fmt "Beg_of_str" - | End_of_str -> str fmt "End_of_str" - | Last_end_of_line -> str fmt "Last_end_of_line" - | Start -> str fmt "Start" - | Stop -> str fmt "Stop" - | Sem (sem, re) -> - sexp fmt "Sem" (pair Automata.pp_sem pp) (sem, re) - | Sem_greedy (k, re) -> - sexp fmt "Sem_greedy" (pair Automata.pp_rep_kind pp) (k, re) - | Group c -> var "Group" c - | No_group c -> var "No_group" c - | Nest c -> var "Nest" c - | Case c -> var "Case" c - | No_case c -> var "No_case" c - | Intersection c -> seq "Intersection" c - | Complement c -> seq "Complement" c - | Difference (a, b) -> sexp fmt "Difference" (pair pp pp) (a, b) - | Pmark (m, r) -> sexp fmt "Pmark" (pair Automata.Pmark.pp pp) (m, r) - */ - let rec is_charset = x => - switch x { - | Set(_) => true - | Alternative(l) | Intersection(l) | Complement(l) => List.for_all(is_charset, l) - | Difference(r, r') => is_charset(r) && is_charset(r') - | Sem(_, r) - | Sem_greedy(_, r) - | No_group(r) - | Case(r) - | No_case(r) => - is_charset(r) - | Sequence(_) - | Repeat(_) - | Beg_of_line - | End_of_line - | Beg_of_word - | End_of_word - | Beg_of_str - | End_of_str - | Not_bound - | Last_end_of_line - | Start - | Stop - | Group(_) - | Nest(_) - | Pmark(_, _) => false - } - - /* *** Colormap *** */ - - /* XXX Use a better algorithm allowing non-contiguous regions? */ - let split = (s, cm) => - Re_cset.iter(s, ~f=(i, j) => { - Bytes.set(cm, i, '') - Bytes.set(cm, j + 1, '') - }) - - let cupper = Cset.union(cseq('A', 'Z'), Cset.union(cseq('À', 'Ö'), cseq('Ø', 'Þ'))) - let clower = Cset.offset(32, cupper) - let calpha = List.fold_right(cadd, list{'ª', 'µ', 'º', 'ß', 'ÿ'}, Cset.union(clower, cupper)) - let cdigit = cseq('0', '9') - let calnum = Cset.union(calpha, cdigit) - let cword = cadd('_', calnum) - - let colorize = (c, regexp) => { - let lnl = ref(false) - let rec colorize = regexp => - switch regexp { - | Set(s) => split(s, c) - | Sequence(l) => List.iter(colorize, l) - | Alternative(l) => List.iter(colorize, l) - | Repeat(r, _, _) => colorize(r) - | Beg_of_line | End_of_line => split(Cset.csingle('\n'), c) - | Beg_of_word - | End_of_word - | Not_bound => - split(cword, c) - | Beg_of_str - | End_of_str - | Start - | Stop => () - | Last_end_of_line => lnl := true - | Sem(_, r) - | Sem_greedy(_, r) - | Group(r) - | No_group(r) - | Nest(r) - | Pmark(_, r) => - colorize(r) - | Case(_) - | No_case(_) - | Intersection(_) - | Complement(_) - | Difference(_) => - assert(false) - } - - colorize(regexp) - lnl.contents - } - - let make_cmap = () => Bytes.make(257, '') - - let flatten_cmap = cm => { - let c = Bytes.create(256) - let col_repr = Bytes.create(256) - let v = ref(0) - Bytes.set(c, 0, '') - Bytes.set(col_repr, 0, '') - for i in 1 to 255 { - if Bytes.get(cm, i) != '' { - incr(v) - } - Bytes.set(c, i, Char.chr(v.contents)) - Bytes.set(col_repr, v.contents, Char.chr(i)) - } - (c, Bytes.sub(col_repr, 0, v.contents + 1), v.contents + 1) - } - - /* *** Compilation *** */ - - let rec equal = (x1, x2) => - switch (x1, x2) { - | (Set(s1), Set(s2)) => s1 == s2 - | (Sequence(l1), Sequence(l2)) => eq_list(l1, l2) - | (Alternative(l1), Alternative(l2)) => eq_list(l1, l2) - | (Repeat(x1', i1, j1), Repeat(x2', i2, j2)) => i1 == i2 && (j1 == j2 && equal(x1', x2')) - | (Beg_of_line, Beg_of_line) - | (End_of_line, End_of_line) - | (Beg_of_word, Beg_of_word) - | (End_of_word, End_of_word) - | (Not_bound, Not_bound) - | (Beg_of_str, Beg_of_str) - | (End_of_str, End_of_str) - | (Last_end_of_line, Last_end_of_line) - | (Start, Start) - | (Stop, Stop) => true - | (Sem(sem1, x1'), Sem(sem2, x2')) => sem1 == sem2 && equal(x1', x2') - | (Sem_greedy(k1, x1'), Sem_greedy(k2, x2')) => k1 == k2 && equal(x1', x2') - | (Group(_), Group(_)) => /* Do not merge groups! */ - false - | (No_group(x1'), No_group(x2')) => equal(x1', x2') - | (Nest(x1'), Nest(x2')) => equal(x1', x2') - | (Case(x1'), Case(x2')) => equal(x1', x2') - | (No_case(x1'), No_case(x2')) => equal(x1', x2') - | (Intersection(l1), Intersection(l2)) => eq_list(l1, l2) - | (Complement(l1), Complement(l2)) => eq_list(l1, l2) - | (Difference(x1', x1''), Difference(x2', x2'')) => equal(x1', x2') && equal(x1'', x2'') - | (Pmark(m1, r1), Pmark(m2, r2)) => Automata.Pmark.equal(m1, m2) && equal(r1, r2) - | _ => false - } - - and eq_list = (l1, l2) => - switch (l1, l2) { - | (list{}, list{}) => true - | (list{x1, ...r1}, list{x2, ...r2}) => equal(x1, x2) && eq_list(r1, r2) - | _ => false - } - - let sequence = x => - switch x { - | list{x} => x - | l => Sequence(l) - } - - let rec merge_sequences = x => - switch x { - | list{} => list{} - | list{Alternative(l'), ...r} => merge_sequences(\"@"(l', r)) - | list{Sequence(list{x, ...y}), ...r} => - switch merge_sequences(r) { - | list{Sequence(list{x', ...y'}), ...r'} if equal(x, x') => - list{Sequence(list{x, Alternative(list{sequence(y), sequence(y')})}), ...r'} - | r' => list{Sequence(list{x, ...y}), ...r'} - } - | list{x, ...r} => list{x, ...merge_sequences(r)} - } - - module A = Automata - - let enforce_kind = (ids, kind, kind', cr) => - switch (kind, kind') { - | (#First, #First) => cr - | (#First, k) => A.seq(ids, k, cr, A.eps(ids)) - | _ => cr - } - - /* XXX should probably compute a category mask */ - let rec translate = (ids, kind, ign_group, ign_case, greedy, pos, cache, c, x) => - switch x { - | Set(s) => (A.cst(ids, trans_set(cache, c, s)), kind) - | Sequence(l) => (trans_seq(ids, kind, ign_group, ign_case, greedy, pos, cache, c, l), kind) - | Alternative(l) => - switch merge_sequences(l) { - | list{r'} => - let (cr, kind') = translate(ids, kind, ign_group, ign_case, greedy, pos, cache, c, r') - (enforce_kind(ids, kind, kind', cr), kind) - | merged_sequences => (A.alt(ids, List.map(r' => { - let (cr, kind') = translate(ids, kind, ign_group, ign_case, greedy, pos, cache, c, r') - enforce_kind(ids, kind, kind', cr) - }, merged_sequences)), kind) - } - | Repeat(r', i, j) => - let (cr, kind') = translate(ids, kind, ign_group, ign_case, greedy, pos, cache, c, r') - let rem = switch j { - | None => A.rep(ids, greedy, kind', cr) - | Some(j) => - let f = switch greedy { - | #Greedy => rem => A.alt(ids, list{A.seq(ids, kind', A.rename(ids, cr), rem), A.eps(ids)}) - | #Non_greedy => - rem => A.alt(ids, list{A.eps(ids), A.seq(ids, kind', A.rename(ids, cr), rem)}) - } - - iter(j - i, f, A.eps(ids)) - } - - (iter(i, rem => A.seq(ids, kind', A.rename(ids, cr), rem), rem), kind) - | Beg_of_line => ( - A.after( - ids, - { - open Category - \"++"(inexistant, newline) - }, - ), - kind, - ) - | End_of_line => ( - A.before( - ids, - { - open Category - \"++"(inexistant, newline) - }, - ), - kind, - ) - | Beg_of_word => ( - A.seq( - ids, - #First, - A.after( - ids, - { - open Category - \"++"(inexistant, not_letter) - }, - ), - A.before( - ids, - { - open Category - \"++"(inexistant, letter) - }, - ), - ), - kind, - ) - | End_of_word => ( - A.seq( - ids, - #First, - A.after( - ids, - { - open Category - \"++"(inexistant, letter) - }, - ), - A.before( - ids, - { - open Category - \"++"(inexistant, not_letter) - }, - ), - ), - kind, - ) - | Not_bound => ( - A.alt( - ids, - list{ - A.seq(ids, #First, A.after(ids, Category.letter), A.before(ids, Category.letter)), - A.seq(ids, #First, A.after(ids, Category.letter), A.before(ids, Category.letter)), - }, - ), - kind, - ) - | Beg_of_str => (A.after(ids, Category.inexistant), kind) - | End_of_str => (A.before(ids, Category.inexistant), kind) - | Last_end_of_line => ( - A.before( - ids, - { - open Category - \"++"(inexistant, lastnewline) - }, - ), - kind, - ) - | Start => (A.after(ids, Category.search_boundary), kind) - | Stop => (A.before(ids, Category.search_boundary), kind) - | Sem(kind', r') => - let (cr, kind'') = translate(ids, kind', ign_group, ign_case, greedy, pos, cache, c, r') - (enforce_kind(ids, kind', kind'', cr), kind') - | Sem_greedy(greedy', r') => - translate(ids, kind, ign_group, ign_case, greedy', pos, cache, c, r') - | Group(r') => - if ign_group { - translate(ids, kind, ign_group, ign_case, greedy, pos, cache, c, r') - } else { - let p = pos.contents - pos := pos.contents + 2 - let (cr, kind') = translate(ids, kind, ign_group, ign_case, greedy, pos, cache, c, r') - (A.seq(ids, #First, A.mark(ids, p), A.seq(ids, #First, cr, A.mark(ids, p + 1))), kind') - } - | No_group(r') => translate(ids, kind, true, ign_case, greedy, pos, cache, c, r') - | Nest(r') => - let b = pos.contents - let (cr, kind') = translate(ids, kind, ign_group, ign_case, greedy, pos, cache, c, r') - - let e = pos.contents - 1 - if e < b { - (cr, kind') - } else { - (A.seq(ids, #First, A.erase(ids, b, e), cr), kind') - } - | Difference(_) | Complement(_) | Intersection(_) | No_case(_) | Case(_) => assert(false) - | Pmark(i, r') => - let (cr, kind') = translate(ids, kind, ign_group, ign_case, greedy, pos, cache, c, r') - (A.seq(ids, #First, A.pmark(ids, i), cr), kind') - } - - and trans_seq = (ids, kind, ign_group, ign_case, greedy, pos, cache, c, x) => - switch x { - | list{} => A.eps(ids) - | list{r} => - let (cr', kind') = translate(ids, kind, ign_group, ign_case, greedy, pos, cache, c, r) - enforce_kind(ids, kind, kind', cr') - | list{r, ...rem} => - let (cr', kind') = translate(ids, kind, ign_group, ign_case, greedy, pos, cache, c, r) - let cr'' = trans_seq(ids, kind, ign_group, ign_case, greedy, pos, cache, c, rem) - if A.is_eps(cr'') { - cr' - } else if A.is_eps(cr') { - cr'' - } else { - A.seq(ids, kind', cr', cr'') - } - } - - /* *** Case *** */ - - let case_insens = s => - Cset.union( - s, - Cset.union(Cset.offset(32, Cset.inter(s, cupper)), Cset.offset(-32, Cset.inter(s, clower))), - ) - - let as_set = x => - switch x { - | Set(s) => s - | _ => assert(false) - } - - /* XXX Should split alternatives into (1) charsets and (2) more - complex regular expressions; alternative should therefore probably - be flatten here */ - let rec handle_case = (ign_case, x) => - switch x { - | Set(s) => - Set( - if ign_case { - case_insens(s) - } else { - s - }, - ) - | Sequence(l) => Sequence(List.map(handle_case(ign_case), l)) - | Alternative(l) => - let l' = List.map(handle_case(ign_case), l) - if is_charset(Alternative(l')) { - Set(List.fold_left((s, r) => Cset.union(s, as_set(r)), Cset.empty, l')) - } else { - Alternative(l') - } - | Repeat(r, i, j) => Repeat(handle_case(ign_case, r), i, j) - | (Beg_of_line - | End_of_line - | Beg_of_word - | End_of_word - | Not_bound - | Beg_of_str - | End_of_str - | Last_end_of_line - | Start - | Stop) as r => r - | Sem(k, r) => - let r' = handle_case(ign_case, r) - if is_charset(r') { - r' - } else { - Sem(k, r') - } - | Sem_greedy(k, r) => - let r' = handle_case(ign_case, r) - if is_charset(r') { - r' - } else { - Sem_greedy(k, r') - } - | Group(r) => Group(handle_case(ign_case, r)) - | No_group(r) => - let r' = handle_case(ign_case, r) - if is_charset(r') { - r' - } else { - No_group(r') - } - | Nest(r) => - let r' = handle_case(ign_case, r) - if is_charset(r') { - r' - } else { - Nest(r') - } - | Case(r) => handle_case(false, r) - | No_case(r) => handle_case(true, r) - | Intersection(l) => - let l' = List.map(r => handle_case(ign_case, r), l) - Set(List.fold_left((s, r) => Cset.inter(s, as_set(r)), Cset.cany, l')) - | Complement(l) => - let l' = List.map(r => handle_case(ign_case, r), l) - Set(Cset.diff(Cset.cany, List.fold_left((s, r) => Cset.union(s, as_set(r)), Cset.empty, l'))) - | Difference(r, r') => - Set( - Cset.inter( - as_set(handle_case(ign_case, r)), - Cset.diff(Cset.cany, as_set(handle_case(ign_case, r'))), - ), - ) - | Pmark(i, r) => Pmark(i, handle_case(ign_case, r)) - } - - /* ** */ - - let compile_1 = regexp => { - let regexp = handle_case(false, regexp) - let c = make_cmap() - let need_lnl = colorize(c, regexp) - let (col, col_repr, ncol) = flatten_cmap(c) - let lnl = if need_lnl { - ncol - } else { - -1 - } - let ncol = if need_lnl { - ncol + 1 - } else { - ncol - } - let ids = A.create_ids() - let pos = ref(0) - let (r, kind) = translate( - ids, - #First, - false, - false, - #Greedy, - pos, - ref(Cset.CSetMap.empty), - col, - regexp, - ) - let r = enforce_kind(ids, #First, kind, r) - /* Format.eprintf "<%d %d>@." !ids ncol; */ - mk_re(r, col, col_repr, ncol, lnl, pos.contents / 2) - } - - /* ** */ - - let rec anchored = x => - switch x { - | Sequence(l) => List.exists(anchored, l) - | Alternative(l) => List.for_all(anchored, l) - | Repeat(r, i, _) => i > 0 && anchored(r) - | Set(_) - | Beg_of_line - | End_of_line - | Beg_of_word - | End_of_word - | Not_bound - | End_of_str - | Last_end_of_line - | Stop - | Intersection(_) - | Complement(_) - | Difference(_) => false - | Beg_of_str | Start => true - | Sem(_, r) - | Sem_greedy(_, r) - | Group(r) - | No_group(r) - | Nest(r) - | Case(r) - | No_case(r) - | Pmark(_, r) => - anchored(r) - } - - /* ** */ - - type t = regexp - - let str = s => { - let l = ref(list{}) - for i in String.length(s) - 1 downto 0 { - l := list{Set(Cset.csingle(String.get(s, i))), ...l.contents} - } - Sequence(l.contents) - } - let char = c => Set(Cset.csingle(c)) - - let alt = x => - switch x { - | list{r} => r - | l => Alternative(l) - } - let seq = x => - switch x { - | list{r} => r - | l => Sequence(l) - } - - let empty = alt(list{}) - let epsilon = seq(list{}) - let repn = (r, i, j) => { - if i < 0 { - invalid_arg("Re.repn") - } - switch j { - | Some(j) if j < i => invalid_arg("Re.repn") - | _ => () - } - Repeat(r, i, j) - } - let rep = r => repn(r, 0, None) - let rep1 = r => repn(r, 1, None) - let opt = r => repn(r, 0, Some(1)) - let bol = Beg_of_line - let eol = End_of_line - let bow = Beg_of_word - let eow = End_of_word - let word = r => seq(list{bow, r, eow}) - let not_boundary = Not_bound - let bos = Beg_of_str - let eos = End_of_str - let whole_string = r => seq(list{bos, r, eos}) - let leol = Last_end_of_line - let start = Start - let stop = Stop - let longest = r => Sem(#Longest, r) - let shortest = r => Sem(#Shortest, r) - let first = r => Sem(#First, r) - let greedy = r => Sem_greedy(#Greedy, r) - let non_greedy = r => Sem_greedy(#Non_greedy, r) - let group = r => Group(r) - let no_group = r => No_group(r) - let nest = r => Nest(r) - let mark = r => { - let i = Automata.Pmark.gen() - (i, Pmark(i, r)) - } - - let set = str => { - let s = ref(Cset.empty) - for i in 0 to String.length(str) - 1 { - s := Cset.union(Cset.csingle(String.get(str, i)), s.contents) - } - Set(s.contents) - } - - let rg = (c, c') => Set(cseq(c, c')) - - let inter = l => { - let r = Intersection(l) - if is_charset(r) { - r - } else { - invalid_arg("Re.inter") - } - } - - let compl = l => { - let r = Complement(l) - if is_charset(r) { - r - } else { - invalid_arg("Re.compl") - } - } - - let diff = (r, r') => { - let r'' = Difference(r, r') - if is_charset(r'') { - r'' - } else { - invalid_arg("Re.diff") - } - } - - let any = Set(Cset.cany) - let notnl = Set(Cset.diff(Cset.cany, Cset.csingle('\n'))) - - let lower = alt(list{rg('a', 'z'), char('µ'), rg('ß', 'ö'), rg('ø', 'ÿ')}) - let upper = alt(list{rg('A', 'Z'), rg('À', 'Ö'), rg('Ø', 'Þ')}) - let alpha = alt(list{lower, upper, char('ª'), char('º')}) - let digit = rg('0', '9') - let alnum = alt(list{alpha, digit}) - let wordc = alt(list{alnum, char('_')}) - let ascii = rg('', '') - let blank = set("\t ") - let cntrl = alt(list{rg('', ''), rg('', 'Ÿ')}) - let graph = alt(list{rg('!', '~'), rg(' ', 'ÿ')}) - let print = alt(list{rg(' ', '~'), rg(' ', 'ÿ')}) - let punct = alt(list{ - rg('!', '/'), - rg(':', '@'), - rg('[', '`'), - rg('{', '~'), - rg(' ', '©'), - rg('«', '´'), - rg('¶', '¹'), - rg('»', '¿'), - char('×'), - char('÷'), - }) - let space = alt(list{char(' '), rg('\t', '\r')}) - let xdigit = alt(list{digit, rg('a', 'f'), rg('A', 'F')}) - - let case = r => Case(r) - let no_case = r => No_case(r) - - /* ** */ - - let compile = r => - compile_1( - if anchored(r) { - group(r) - } else { - seq(list{shortest(rep(any)), group(r)}) - }, - ) - - let exec_internal = (name, ~pos=0, ~len=-1, ~groups, re, s) => { - if pos < 0 || (len < -1 || pos + len > String.length(s)) { - invalid_arg(name) - } - match_str(~groups, ~partial=false, re, s, ~pos, ~len) - } - - let exec = (~pos=?, ~len=?, re, s) => - switch exec_internal("Re.exec", ~pos?, ~len?, ~groups=true, re, s) { - | Match(substr) => substr - | _ => raise(Not_found) - } - - let exec_opt = (~pos=?, ~len=?, re, s) => - switch exec_internal("Re.exec_opt", ~pos?, ~len?, ~groups=true, re, s) { - | Match(substr) => Some(substr) - | _ => None - } - - let execp = (~pos=?, ~len=?, re, s) => - switch exec_internal(~groups=false, "Re.execp", ~pos?, ~len?, re, s) { - | Match(_substr) => true - | _ => false - } - - let exec_partial = (~pos=?, ~len=?, re, s) => - switch exec_internal(~groups=false, "Re.exec_partial", ~pos?, ~len?, re, s) { - | Match(_) => #Full - | Running => #Partial - | Failed => #Mismatch - } - - module Group = { - type t = groups - - let offset = (t, i) => { - if 2 * i + 1 >= Array.length(t.marks) { - raise(Not_found) - } - let m1 = t.marks[2 * i] - if m1 == -1 { - raise(Not_found) - } - let p1 = t.gpos[m1] - 1 - let p2 = t.gpos[t.marks[2 * i + 1]] - 1 - (p1, p2) - } - - let get = (t, i) => { - let (p1, p2) = offset(t, i) - String.sub(t.s, p1, p2 - p1) - } - - let start = (subs, i) => fst(offset(subs, i)) - - let stop = (subs, i) => snd(offset(subs, i)) - - let test = (t, i) => - if 2 * i >= Array.length(t.marks) { - false - } else { - let idx = t.marks[2 * i] - idx != -1 - } - - let dummy_offset = (-1, -1) - - let all_offset = t => { - let res = Array.make(t.gcount, dummy_offset) - for i in 0 to Array.length(t.marks) / 2 - 1 { - let m1 = t.marks[2 * i] - if m1 != -1 { - let p1 = t.gpos[m1] - let p2 = t.gpos[t.marks[2 * i + 1]] - res[i] = (p1 - 1, p2 - 1) - } - } - res - } - - let dummy_string = "" - - let all = t => { - let res = Array.make(t.gcount, dummy_string) - for i in 0 to Array.length(t.marks) / 2 - 1 { - let m1 = t.marks[2 * i] - if m1 != -1 { - let p1 = t.gpos[m1] - let p2 = t.gpos[t.marks[2 * i + 1]] - res[i] = String.sub(t.s, p1 - 1, p2 - p1) - } - } - res - } - - /* let%ignore pp fmt t = - let matches = - let offsets = all_offset t in - let strs = all t in - Array.to_list ( - Array.init (Array.length strs) (fun i -> strs.(i), offsets.(i)) - ) in - let open Re_fmt in - let pp_match fmt (str, (start, stop)) = - fprintf fmt "@[(%s (%d %d))@]" str start stop in - sexp fmt "Group" (list pp_match) matches */ - - let nb_groups = t => t.gcount - } - - module Mark = { - type t = Automata.Pmark.t - - let test = ({pmarks, _}, p) => Automata.PmarkSet.mem(p, pmarks) - - let all = s => s.pmarks - - module Set = MarkSet - - let equal = Automata.Pmark.equal - - let compare = Automata.Pmark.compare - } - - type gen<'a> = unit => option<'a> - - let all_gen = (~pos=0, ~len=?, re, s) => { - if pos < 0 { - invalid_arg("Re.all") - } - /* index of the first position we do not consider. - !pos < limit is an invariant */ - let limit = switch len { - | None => String.length(s) - | Some(l) => - if l < 0 || pos + l > String.length(s) { - invalid_arg("Re.all") - } - pos + l - } - - /* iterate on matches. When a match is found, search for the next - one just after its end */ - let pos = ref(pos) - () => - if pos.contents >= limit { - None /* no more matches */ - } else { - switch match_str( - ~groups=true, - ~partial=false, - re, - s, - ~pos=pos.contents, - ~len=limit - pos.contents, - ) { - | Match(substr) => - let (p1, p2) = Group.offset(substr, 0) - pos := if p1 == p2 { - p2 + 1 - } else { - p2 - } - Some(substr) - | Running - | Failed => - None - } - } - } - - let all = (~pos=?, ~len=?, re, s) => { - let l = ref(list{}) - let g = all_gen(~pos?, ~len?, re, s) - let rec iter = () => - switch g() { - | None => List.rev(l.contents) - | Some(sub) => - l := list{sub, ...l.contents} - iter() - } - iter() - } - - let matches_gen = (~pos=?, ~len=?, re, s) => { - let g = all_gen(~pos?, ~len?, re, s) - () => - switch g() { - | None => None - | Some(sub) => Some(Group.get(sub, 0)) - } - } - - let matches = (~pos=?, ~len=?, re, s) => { - let l = ref(list{}) - let g = all_gen(~pos?, ~len?, re, s) - let rec iter = () => - switch g() { - | None => List.rev(l.contents) - | Some(sub) => - l := list{Group.get(sub, 0), ...l.contents} - iter() - } - iter() - } - - type split_token = [ - | #Text(string) - | #Delim(groups) - ] - - let split_full_gen = (~pos=0, ~len=?, re, s) => { - if pos < 0 { - invalid_arg("Re.split") - } - let limit = switch len { - | None => String.length(s) - | Some(l) => - if l < 0 || pos + l > String.length(s) { - invalid_arg("Re.split") - } - pos + l - } - - /* i: start of delimited string - pos: first position after last match of [re] - limit: first index we ignore (!pos < limit is an invariant) */ - let pos0 = pos - let state = ref(#Idle) - let i = ref(pos) and pos = ref(pos) - let next = () => - switch state.contents { - | #Idle if pos.contents >= limit => - if i.contents < limit { - let sub = String.sub(s, i.contents, limit - i.contents) - incr(i) - Some(#Text(sub)) - } else { - None - } - | #Idle => - switch match_str( - ~groups=true, - ~partial=false, - re, - s, - ~pos=pos.contents, - ~len=limit - pos.contents, - ) { - | Match(substr) => - let (p1, p2) = Group.offset(substr, 0) - pos := if p1 == p2 { - p2 + 1 - } else { - p2 - } - let old_i = i.contents - i := p2 - if p1 > pos0 { - /* string does not start by a delimiter */ - let text = String.sub(s, old_i, p1 - old_i) - state := #Yield(#Delim(substr)) - Some(#Text(text)) - } else { - Some(#Delim(substr)) - } - | Running => None - | Failed => - if i.contents < limit { - let text = String.sub(s, i.contents, limit - i.contents) - i := limit - Some(#Text(text)) /* yield last string */ - } else { - None - } - } - | #Yield(x) => - state := #Idle - Some(x) - } - next - } - - let split_full = (~pos=?, ~len=?, re, s) => { - let l = ref(list{}) - let g = split_full_gen(~pos?, ~len?, re, s) - let rec iter = () => - switch g() { - | None => List.rev(l.contents) - | Some(s) => - l := list{s, ...l.contents} - iter() - } - iter() - } - - let split_gen = (~pos=?, ~len=?, re, s) => { - let g = split_full_gen(~pos?, ~len?, re, s) - let rec next = () => - switch g() { - | None => None - | Some(#Delim(_)) => next() - | Some(#Text(s)) => Some(s) - } - next - } - - let split = (~pos=?, ~len=?, re, s) => { - let l = ref(list{}) - let g = split_full_gen(~pos?, ~len?, re, s) - let rec iter = () => - switch g() { - | None => List.rev(l.contents) - | Some(#Delim(_)) => iter() - | Some(#Text(s)) => - l := list{s, ...l.contents} - iter() - } - iter() - } - - let replace = (~pos=0, ~len=?, ~all=true, re, ~f, s) => { - if pos < 0 { - invalid_arg("Re.replace") - } - let limit = switch len { - | None => String.length(s) - | Some(l) => - if l < 0 || pos + l > String.length(s) { - invalid_arg("Re.replace") - } - pos + l - } - - /* buffer into which we write the result */ - let buf = Buffer.create(String.length(s)) - /* iterate on matched substrings. */ - let rec iter = pos => - if pos < limit { - switch match_str(~groups=true, ~partial=false, re, s, ~pos, ~len=limit - pos) { - | Match(substr) => - let (p1, p2) = Group.offset(substr, 0) - /* add string between previous match and current match */ - Buffer.add_substring(buf, s, pos, p1 - pos) - /* what should we replace the matched group with? */ - let replacing = f(substr) - Buffer.add_string(buf, replacing) - if all { - /* if we matched a non-char e.g. ^ we must manually advance by 1 */ - iter( - if p1 == p2 { - /* a non char could be past the end of string. e.g. $ */ - if p2 < limit { - Buffer.add_char(buf, String.get(s, p2)) - } - p2 + 1 - } else { - p2 - }, - ) - } else { - Buffer.add_substring(buf, s, p2, limit - p2) - } - | Running => () - | Failed => Buffer.add_substring(buf, s, pos, limit - pos) - } - } - - iter(pos) - Buffer.contents(buf) - } - - let replace_string = (~pos=?, ~len=?, ~all=?, re, ~by, s) => - replace(~pos?, ~len?, ~all?, re, s, ~f=_ => by) - - let witness = t => { - let rec witness = x => - switch x { - | Set(c) => String.make(1, Char.chr(Cset.pick(c))) - | Sequence(xs) => String.concat("", List.map(witness, xs)) - | Alternative(list{x, ..._}) => witness(x) - | Alternative(list{}) => assert(false) - | Repeat(r, from, _to) => - let w = witness(r) - let b = Buffer.create(String.length(w) * from) - for _i in 1 to from { - Buffer.add_string(b, w) - } - Buffer.contents(b) - | No_case(r) => witness(r) - | Intersection(_) - | Complement(_) - | Difference(_, _) => - assert(false) - | Group(r) - | No_group(r) - | Nest(r) - | Sem(_, r) - | Pmark(_, r) - | Case(r) - | Sem_greedy(_, r) => - witness(r) - | Beg_of_line - | End_of_line - | Beg_of_word - | End_of_word - | Not_bound - | Beg_of_str - | Last_end_of_line - | Start - | Stop - | End_of_str => "" - } - witness(handle_case(false, t)) - } - - @@ocaml.text(" {2 Deprecated functions} ") - - type substrings = groups - - let get = Group.get - let get_ofs = Group.offset - let get_all = Group.all - let get_all_ofs = Group.all_offset - let test = Group.test - - type markid = Mark.t - - let marked = Mark.test - let mark_set = Mark.all - - /* ******************************** */ - - /* -Information about the previous character: -- does not exists -- is a letter -- is not a letter -- is a newline -- is last newline - -Beginning of word: -- previous is not a letter or does not exist -- current is a letter or does not exist - -End of word: -- previous is a letter or does not exist -- current is not a letter or does not exist - -Beginning of line: -- previous is a newline or does not exist - -Beginning of buffer: -- previous does not exist - -End of buffer -- current does not exist - -End of line -- current is a newline or does not exist -*/ - - /* -Rep: e = T,e | () - - semantics of the comma (shortest/longest/first) - - semantics of the union (greedy/non-greedy) - -Bounded repetition - a{0,3} = (a,(a,a?)?)? -*/ -} -module Re_perl: { - @@ocaml.text( - /* - RE - A regular expression library - - Copyright (C) 2001 Jerome Vouillon - email: Jerome.Vouillon@pps.jussieu.fr - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation, with - linking exception; either version 2.1 of the License, or (at - your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - - " Perl-style regular expressions " - ) - - exception Parse_error - @ocaml.doc(" Errors that can be raised during the parsing of the regular expression ") - exception Not_supported - - type opt = [ - | #Ungreedy - | #Dotall - | #Dollar_endonly - | #Multiline - | #Anchored - | #Caseless - ] - - @ocaml.doc(" Parsing of a Perl-style regular expression ") - let re: (~opts: list=?, string) => Re.t - - @ocaml.doc(" Regular expression compilation ") - let compile: Re.t => Re.re - - @ocaml.doc(" (Same as [Re.compile]) ") - let compile_pat: (~opts: list=?, string) => Re.re -} = { - /* - RE - A regular expression library - - Copyright (C) 2001 Jerome Vouillon - email: Jerome.Vouillon@pps.jussieu.fr - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation, with - linking exception; either version 2.1 of the License, or (at - your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - - exception Parse_error - exception Not_supported - - let posix_class_of_string = x => - switch x { - | "alnum" => Re.alnum - | "ascii" => Re.ascii - | "blank" => Re.blank - | "cntrl" => Re.cntrl - | "digit" => Re.digit - | "lower" => Re.lower - | "print" => Re.print - | "space" => Re.space - | "upper" => Re.upper - | "word" => Re.wordc - | "punct" => Re.punct - | "graph" => Re.graph - | "xdigit" => Re.xdigit - | class_ => invalid_arg("Invalid pcre class: " ++ class_) - } - - let posix_class_strings = list{ - "alnum", - "ascii", - "blank", - "cntrl", - "digit", - "lower", - "print", - "space", - "upper", - "word", - "punct", - "graph", - "xdigit", - } - - let parse = (multiline, dollar_endonly, dotall, ungreedy, s) => { - let i = ref(0) - let l = String.length(s) - let eos = () => i.contents == l - let test = c => !eos() && String.get(s, i.contents) == c - let accept = c => { - let r = test(c) - if r { - incr(i) - } - r - } - let accept_s = s' => { - let len = String.length(s') - try { - for j in 0 to len - 1 { - try if String.get(s', j) != String.get(s, i.contents + j) { - raise(Exit) - } catch { - | _ => raise(Exit) - } - } - i := i.contents + len - true - } catch { - | Exit => false - } - } - let get = () => { - let r = String.get(s, i.contents) - incr(i) - r - } - let unget = () => decr(i) - let greedy_mod = r => { - let gr = accept('?') - let gr = if ungreedy { - !gr - } else { - gr - } - if gr { - Re.non_greedy(r) - } else { - Re.greedy(r) - } - } - - let rec regexp = () => regexp'(branch()) - and regexp' = left => - if accept('|') { - regexp'(Re.alt(list{left, branch()})) - } else { - left - } - and branch = () => branch'(list{}) - and branch' = left => - if eos() || (test('|') || test(')')) { - Re.seq(List.rev(left)) - } else { - branch'(list{piece(), ...left}) - } - and piece = () => { - let r = atom() - if accept('*') { - greedy_mod(Re.rep(r)) - } else if accept('+') { - greedy_mod(Re.rep1(r)) - } else if accept('?') { - greedy_mod(Re.opt(r)) - } else if accept('{') { - switch integer() { - | Some(i) => - let j = if accept(',') { - integer() - } else { - Some(i) - } - if !accept('}') { - raise(Parse_error) - } - switch j { - | Some(j) if j < i => raise(Parse_error) - | _ => () - } - greedy_mod(Re.repn(r, i, j)) - | None => - unget() - r - } - } else { - r - } - } - and atom = () => - if accept('.') { - if dotall { - Re.any - } else { - Re.notnl - } - } else if accept('(') { - if accept('?') { - if accept(':') { - let r = regexp() - if !accept(')') { - raise(Parse_error) - } - r - } else if accept('#') { - comment() - } else { - raise(Parse_error) - } - } else { - let r = regexp() - if !accept(')') { - raise(Parse_error) - } - Re.group(r) - } - } else if accept('^') { - if multiline { - Re.bol - } else { - Re.bos - } - } else if accept('$') { - if multiline { - Re.eol - } else if dollar_endonly { - Re.leol - } else { - Re.eos - } - } else if accept('[') { - if accept('^') { - Re.compl(bracket(list{})) - } else { - Re.alt(bracket(list{})) - } - } else if accept('\\') { - /* XXX - - Back-references - - \cx (control-x), \e, \f, \n, \r, \t, \xhh, \ddd -*/ - if eos() { - raise(Parse_error) - } - switch get() { - | 'w' => Re.alt(list{Re.alnum, Re.char('_')}) - | 'W' => Re.compl(list{Re.alnum, Re.char('_')}) - | 's' => Re.space - | 'S' => Re.compl(list{Re.space}) - | 'd' => Re.digit - | 'D' => Re.compl(list{Re.digit}) - | 'b' => Re.alt(list{Re.bow, Re.eow}) - | 'B' => Re.not_boundary - | 'A' => Re.bos - | 'Z' => Re.leol - | 'z' => Re.eos - | 'G' => Re.start - | 'a' .. 'z' | 'A' .. 'Z' => raise(Parse_error) - | '0' .. '9' => raise(Not_supported) - | c => Re.char(c) - } - } else { - if eos() { - raise(Parse_error) - } - switch get() { - | '*' | '+' | '?' | '{' | '\\' => raise(Parse_error) - | c => Re.char(c) - } - } - and integer = () => - if eos() { - None - } else { - switch get() { - | '0' .. '9' as d => integer'(Char.code(d) - Char.code('0')) - | _ => - unget() - None - } - } - and integer' = i => - if eos() { - Some(i) - } else { - switch get() { - | '0' .. '9' as d => - let i' = 10 * i + (Char.code(d) - Char.code('0')) - if i' < i { - raise(Parse_error) - } - integer'(i') - | _ => - unget() - Some(i) - } - } - and bracket = s => - if s != list{} && accept(']') { - s - } else { - switch char() { - | #Char(c) => - if accept('-') { - if accept(']') { - list{Re.char(c), Re.char('-'), ...s} - } else { - switch char() { - | #Char(c') => bracket(list{Re.rg(c, c'), ...s}) - | #Set(st') => list{Re.char(c), Re.char('-'), st', ...s} - } - } - } else { - bracket(list{Re.char(c), ...s}) - } - | #Set(st) => bracket(list{st, ...s}) - } - } - and char = () => { - if eos() { - raise(Parse_error) - } - let c = get() - if c == '[' { - if accept('=') { - raise(Not_supported) - } - if accept(':') { - let compl = accept('^') - let cls = try List.find(accept_s, posix_class_strings) catch { - | Not_found => raise(Parse_error) - } - if !accept_s(":]") { - raise(Parse_error) - } - let re = { - let posix_class = posix_class_of_string(cls) - if compl { - Re.compl(list{posix_class}) - } else { - posix_class - } - } - #Set(re) - } else if accept('.') { - if eos() { - raise(Parse_error) - } - let c = get() - if !accept('.') { - raise(Not_supported) - } - if !accept(']') { - raise(Parse_error) - } - #Char(c) - } else { - #Char(c) - } - } else if c == '\\' { - let c = get() - /* XXX - \127, ... -*/ - switch c { - | 'b' => #Char('\b') - | 'n' => #Char('\n') /* XXX */ - | 'r' => #Char('\r') /* XXX */ - | 't' => #Char('\t') /* XXX */ - | 'w' => #Set(Re.alt(list{Re.alnum, Re.char('_')})) - | 'W' => #Set(Re.compl(list{Re.alnum, Re.char('_')})) - | 's' => #Set(Re.space) - | 'S' => #Set(Re.compl(list{Re.space})) - | 'd' => #Set(Re.digit) - | 'D' => #Set(Re.compl(list{Re.digit})) - | 'a' .. 'z' | 'A' .. 'Z' => raise(Parse_error) - | '0' .. '9' => raise(Not_supported) - | _ => #Char(c) - } - } else { - #Char(c) - } - } - and comment = () => - if accept(')') { - Re.epsilon - } else { - incr(i) - comment() - } - - let res = regexp() - if !eos() { - raise(Parse_error) - } - res - } - - type opt = [ - | #Ungreedy - | #Dotall - | #Dollar_endonly - | #Multiline - | #Anchored - | #Caseless - ] - - let re = (~opts=list{}, s) => { - let r = parse( - List.memq(#Multiline, opts), - List.memq(#Dollar_endonly, opts), - List.memq(#Dotall, opts), - List.memq(#Ungreedy, opts), - s, - ) - - let r = if List.memq(#Anchored, opts) { - Re.seq(list{Re.start, r}) - } else { - r - } - let r = if List.memq(#Caseless, opts) { - Re.no_case(r) - } else { - r - } - r - } - - let compile = Re.compile - let compile_pat = (~opts=list{}, s) => compile(re(~opts, s)) -} -module Re_pcre: { - type regexp = Re.re - - type flag = [#CASELESS | #MULTILINE | #ANCHORED] - - type groups = Re.groups - - @ocaml.doc(" Result of a {!Pcre.full_split} ") - type split_result = - | @ocaml.doc(" Text part of splitted string ") Text(string) - | @ocaml.doc(" Delimiter part of splitted string ") Delim(string) - | @ocaml.doc(" Subgroup of matched delimiter (subgroup_nr, subgroup_str) ") Group(int, string) - | @ocaml.doc(" Unmatched subgroup ") NoGroup - - @ocaml.doc(" [re ~flags s] creates the regexp [s] using the pcre syntax. ") - let re: (~flags: list=?, string) => Re.t - - @ocaml.doc(" [re ~flags s] compiles the regexp [s] using the pcre syntax. ") - let regexp: (~flags: list=?, string) => regexp - - @ocaml.doc(" [extract ~rex s] executes [rex] on [s] and returns the matching groups. ") - let extract: (~rex: regexp, string) => array - - @ocaml.doc(" Equivalent to {!Re.exec}. ") - let exec: (~rex: regexp, ~pos: int=?, string) => groups - - @ocaml.doc(" Equivalent to {!Re.Group.get}. ") - let get_substring: (groups, int) => string - - @ocaml.doc(" Equivalent to {!Re.Group.offset}. ") - let get_substring_ofs: (groups, int) => (int, int) - - @ocaml.doc(" Equivalent to {!Re.execp}. ") - let pmatch: (~rex: regexp, string) => bool - - let substitute: (~rex: Re.re, ~subst: string => string, string) => string - - let full_split: (~max: int=?, ~rex: regexp, string) => list - - let split: (~rex: regexp, string) => list - - let quote: string => string - - @@ocaml.text(" {2 Deprecated} ") - - type substrings = Re.groups -} = { - type regexp = Re.re - - type flag = [#CASELESS | #MULTILINE | #ANCHORED] - - type split_result = - | Text(string) - | Delim(string) - | Group(int, string) - | NoGroup - - type groups = Re.groups - - let re = (~flags=list{}, pat) => { - let opts = List.map(x => - switch x { - | #CASELESS => #Caseless - | #MULTILINE => #Multiline - | #ANCHORED => #Anchored - } - , flags) - Re_perl.re(~opts, pat) - } - - let regexp = (~flags=?, pat) => Re.compile(re(~flags?, pat)) - - let extract = (~rex, s) => Re.Group.all(Re.exec(rex, s)) - - let exec = (~rex, ~pos=?, s) => Re.exec(rex, ~pos?, s) - - let get_substring = (s, i) => Re.Group.get(s, i) - - let get_substring_ofs = (s, i) => Re.Group.offset(s, i) - - let pmatch = (~rex, s) => Re.execp(rex, s) - - let substitute = (~rex, ~subst, str) => { - let b = Buffer.create(1024) - let rec loop = pos => - if pos >= String.length(str) { - Buffer.contents(b) - } else if Re.execp(~pos, rex, str) { - let ss = Re.exec(~pos, rex, str) - let (start, fin) = Re.Group.offset(ss, 0) - let pat = Re.Group.get(ss, 0) - Buffer.add_substring(b, str, pos, start - pos) - Buffer.add_string(b, subst(pat)) - loop(fin) - } else { - Buffer.add_substring(b, str, pos, String.length(str) - pos) - loop(String.length(str)) - } - - loop(0) - } - - let split = (~rex, str) => { - let rec loop = (accu, pos) => - if pos >= String.length(str) { - List.rev(accu) - } else if Re.execp(~pos, rex, str) { - let ss = Re.exec(~pos, rex, str) - let (start, fin) = Re.Group.offset(ss, 0) - let s = String.sub(str, pos, start - pos) - loop(list{s, ...accu}, fin) - } else { - let s = String.sub(str, pos, String.length(str) - pos) - loop(list{s, ...accu}, String.length(str)) - } - loop(list{}, 0) - } - - /* From PCRE */ - let string_unsafe_sub = (s, ofs, len) => { - let r = Bytes.create(len) - Bytes.blit(s, ofs, r, 0, len) - Bytes.unsafe_to_string(r) - } - - let quote = s => { - let len = String.length(s) - let buf = Bytes.create(lsl(len, 1)) - let pos = ref(0) - for i in 0 to len - 1 { - switch String.unsafe_get(s, i) { - | ('\\' - | '^' - | '$' - | '.' - | '[' - | '|' - | '(' - | ')' - | '?' - | '*' - | '+' - | '{') as c => - Bytes.unsafe_set(buf, pos.contents, '\\') - incr(pos) - Bytes.unsafe_set(buf, pos.contents, c) - incr(pos) - | c => - Bytes.unsafe_set(buf, pos.contents, c) - incr(pos) - } - } - string_unsafe_sub(buf, 0, pos.contents) - } - - let full_split = (~max=0, ~rex, s) => - if String.length(s) == 0 { - list{} - } else if max == 1 { - list{Text(s)} - } else { - let results = Re.split_full(rex, s) - let matches = List.map(x => - switch x { - | #Text(s) => list{Text(s)} - | #Delim(d) => - let matches = Re.Group.all_offset(d) - let delim = Re.Group.get(d, 0) - list{ - Delim(delim), - ...{ - let l = ref(list{}) - for i in 1 to Array.length(matches) - 1 { - l := - list{ - if matches[i] == (-1, -1) { - NoGroup - } else { - Group(i, Re.Group.get(d, i)) - }, - ...l.contents, - } - } - List.rev(l.contents) - }, - } - } - , results) - List.concat(matches) - } - - type substrings = Re.groups -} -module Xx = { - let _ = { - let s = String.make(1024 * 1024 - 1, 'a') ++ "b" - - eq(__LOC__, Re.get(Re_pcre.exec(~rex=Re_pcre.regexp("aa?b"), s), 0), "aab") - } -} - -Mt.from_pair_suites(__MODULE__, suites.contents) diff --git a/jscomp/test/offset.js b/jscomp/test/offset.js index 2c473968eb..88a628a94f 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"); @@ -518,7 +517,7 @@ function iter(f, _param) { return; } iter(f, param.l); - Curry._1(f, param.v); + f(param.v); _param = param.r; continue; }; @@ -531,7 +530,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; }; @@ -543,7 +542,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)) { @@ -560,7 +559,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)) { @@ -579,7 +578,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) { @@ -603,7 +602,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]; @@ -677,7 +676,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) { @@ -687,7 +686,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; @@ -708,7 +707,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) { @@ -718,7 +717,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; @@ -742,7 +741,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) { @@ -752,7 +751,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; @@ -773,7 +772,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) { @@ -783,7 +782,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; @@ -821,7 +820,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..31a08c1b84 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: { @@ -182,7 +182,7 @@ let xs = { tl: /* [] */0 }; -b("File \"option_repr_test.res\", line 125, characters 8-15", Belt_List.every(xs, (function (x) { +b("File \"option_repr_test.res\", line 125, characters 2-9", Belt_List.every(xs, (function (x) { return x; }))); @@ -227,7 +227,7 @@ let xs$1 = { tl: xs_1 }; -b("File \"option_repr_test.res\", line 128, characters 4-11", Belt_List.every(xs$1, (function (x) { +b("File \"option_repr_test.res\", line 128, characters 2-9", Belt_List.every(xs$1, (function (x) { return x; }))); @@ -252,7 +252,7 @@ let xs$2 = { tl: xs_1$1 }; -b("File \"option_repr_test.res\", line 145, characters 4-11", Belt_List.every(xs$2, (function (x) { +b("File \"option_repr_test.res\", line 145, characters 2-9", Belt_List.every(xs$2, (function (x) { return x; }))); diff --git a/jscomp/test/option_repr_test.res b/jscomp/test/option_repr_test.res index a57ca37438..8ed8f2d649 100644 --- a/jscomp/test/option_repr_test.res +++ b/jscomp/test/option_repr_test.res @@ -122,10 +122,10 @@ let neqx = (a, b) => a != b && b != a let all_true = xs => Belt.List.every(xs, x => x) -\"@@"(b(__LOC__), all_true(list{gtx(Some(Some(Js.null)), Some(None))})) +b(__LOC__, all_true(list{gtx(Some(Some(Js.null)), Some(None))})) -\"@@"( - b(__LOC__), + +b(__LOC__, all_true(list{ ltx(Some(None), Some(Some(3))), ltx(Some(None), Some(Some(None))), @@ -141,15 +141,15 @@ let all_true = xs => Belt.List.every(xs, x => x) }), ) -\"@@"( - b(__LOC__), + +b(__LOC__, all_true(list{ eqx(None, None), neqx(None, Some(Js.null)), eqx(Some(None), Some(None)), eqx(Some(Some(None)), Some(Some(None))), neqx(Some(Some(Some(None))), Some(Some(None))), - }), + }) ) module N0 = { 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/optional_regression_test.js b/jscomp/test/optional_regression_test.js index cee1c0b3fc..af956ee879 100644 --- a/jscomp/test/optional_regression_test.js +++ b/jscomp/test/optional_regression_test.js @@ -16,20 +16,18 @@ function eq(loc, x, y) { Mt.eq_suites(test_id, suites, loc, x, y); } -function make(s, b, i) { - return function (param) { - let tmp = {}; - if (s !== undefined) { - tmp.s = Caml_option.valFromOption(s); - } - if (b !== undefined) { - tmp.b = Caml_option.valFromOption(b); - } - if (i !== undefined) { - tmp.i = Caml_option.valFromOption(i); - } - return tmp; - }; +function make(s, b, i, param) { + let tmp = {}; + if (s !== undefined) { + tmp.s = Caml_option.valFromOption(s); + } + if (b !== undefined) { + tmp.b = Caml_option.valFromOption(b); + } + if (i !== undefined) { + tmp.i = Caml_option.valFromOption(i); + } + return tmp; } let hh = { diff --git a/jscomp/test/optional_regression_test.res b/jscomp/test/optional_regression_test.res index c525cff5c2..647aff5bc6 100644 --- a/jscomp/test/optional_regression_test.res +++ b/jscomp/test/optional_regression_test.res @@ -9,7 +9,7 @@ type test = { @optional i: int, } -let make = (~s=?, ~b=?, ~i=?) => test(~s?, ~b?, ~i?) +let make = (~s=?, ~b=?, ~i=?, ()) => test(~s?, ~b?, ~i?, ()) let hh = make(~s="", ~b=false, ~i=0, ()) diff --git a/jscomp/test/pipe_syntax.js b/jscomp/test/pipe_syntax.js index 2341470fb0..99e1ec3960 100644 --- a/jscomp/test/pipe_syntax.js +++ b/jscomp/test/pipe_syntax.js @@ -5,19 +5,19 @@ 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._2(f, Curry._3(g, Curry._1(f, x), 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) { @@ -28,7 +28,7 @@ function f(a, b, c) { } function f1(a, b, c, d) { - let __ocaml_internal_obj = Curry._1(a, b); + let __ocaml_internal_obj = a(b); return [ Curry._1(c, __ocaml_internal_obj), Curry._1(d, __ocaml_internal_obj) @@ -36,18 +36,20 @@ function f1(a, b, c, d) { } function f2(a, b, c, d) { - let __ocaml_internal_obj = Curry._1(a, b); + let __ocaml_internal_obj = a(b); let u = Curry._1(c, __ocaml_internal_obj); let v = Curry._1(d, __ocaml_internal_obj); return u + v | 0; } function f3(a, b, c, d, e) { - let __ocaml_internal_obj = Curry._1(a, b); - let u = Curry._2(c, __ocaml_internal_obj, d); - let v = Curry._3(d, __ocaml_internal_obj, 1, 2); - let h = Curry._1(e, __ocaml_internal_obj); - return (u + v | 0) + h | 0; + let __ocaml_internal_obj = a(b); + let param = [ + Curry._2(c, __ocaml_internal_obj, d), + Curry._3(d, __ocaml_internal_obj, 1, 2), + Curry._1(e, __ocaml_internal_obj) + ]; + return (param[0] + param[1] | 0) + param[2] | 0; } function f4(a, b, c) { diff --git a/jscomp/test/pipe_syntax.res b/jscomp/test/pipe_syntax.res index bfec31da42..77c0ef02b4 100644 --- a/jscomp/test/pipe_syntax.res +++ b/jscomp/test/pipe_syntax.res @@ -4,13 +4,13 @@ include ( let t1 = (x, f) => x->f - let t2 = (x, f, g) => x->f->g(x, x)->f(x) + let t2 = (x, f, g) => x->f->g(x, x)->f let t3 = (x, f) => x->f(~h=1, ~x=2) }: { let t0: ('a, 'a => 'a) => 'a let t1: ('a, 'a => 'b) => 'b - let t2: ('a, ('a, 'a) => 'b, ('a => 'b, 'a, 'a) => 'a) => 'b + let t2: ('a, 'a => 'a => 'b, ('a => 'b, 'a, 'a) => 'a) => 'a => 'b let t3: ('a, ('a, ~h: int, ~x: int) => 'b) => 'b } ) 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/pr_regression_test.js b/jscomp/test/pr_regression_test.js deleted file mode 100644 index 225d41acc7..0000000000 --- a/jscomp/test/pr_regression_test.js +++ /dev/null @@ -1,119 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Curry = require("../../lib/js/curry.js"); - -let v = { - contents: 3 -}; - -function f(h) { - v.contents = v.contents + 1 | 0; - let partial_arg = 3; - return function (param) { - return Curry._2(h, partial_arg, param); - }; -} - -f(function (prim0, prim1) { - return prim0 + prim1 | 0; -}); - -f(function (prim0, prim1) { - return prim0 + prim1 | 0; -}); - -let a = v.contents; - -let v$1 = { - contents: 3 -}; - -function f$1(h) { - v$1.contents = v$1.contents + 1 | 0; - let partial_arg = 3; - return function (param) { - return Curry._2(h, partial_arg, param); - }; -} - -f$1(function (prim0, prim1) { - return prim0 + prim1 | 0; -}); - -f$1(function (prim0, prim1) { - return prim0 + prim1 | 0; -}); - -let b = v$1.contents; - -let v$2 = { - contents: 3 -}; - -function f$2(h) { - return Curry._2(h, 2, (v$2.contents = v$2.contents + 1 | 0, 3)); -} - -f$2(function (prim0, prim1) { - return prim0 + prim1 | 0; -}); - -f$2(function (prim0, prim1) { - return prim0 + prim1 | 0; -}); - -let c = v$2.contents; - -let v$3 = { - contents: 3 -}; - -function f$3(h, g) { - v$3.contents = v$3.contents + 1 | 0; - let partial_arg = 9; - return function (param) { - return Curry._2(h, partial_arg, param); - }; -} - -f$3((function (prim0, prim1) { - return prim0 + prim1 | 0; -}), 3); - -f$3((function (prim0, prim1) { - return prim0 + prim1 | 0; -}), 3); - -let d = v$3.contents; - -Mt.from_pair_suites("Pr_regression_test", { - hd: [ - "partial", - (function (param) { - return { - TAG: "Eq", - _0: [ - 5, - 5, - 5, - 5 - ], - _1: [ - a, - b, - c, - d - ] - }; - }) - ], - tl: /* [] */0 -}); - -exports.a = a; -exports.b = b; -exports.c = c; -exports.d = d; -/* Not a pure module */ diff --git a/jscomp/test/pr_regression_test.res b/jscomp/test/pr_regression_test.res deleted file mode 100644 index bd74bf0017..0000000000 --- a/jscomp/test/pr_regression_test.res +++ /dev/null @@ -1,63 +0,0 @@ -let a = { - let v = ref(3) - let action = () => incr(v) - let f = h => - ((x, y) => h(x, y))({ - action() - 3 - }) - \"@@"(ignore, f(\"+")) - \"@@"(ignore, f(\"+")) - v.contents -} - -let b = { - let v = ref(3) - let action = () => incr(v) - let f = h => - ((x, y) => h(x, y))({ - action() - 3 - }) - \"@@"(ignore, f(\"+")) - \"@@"(ignore, f(\"+")) - v.contents -} - -let c = { - let v = ref(3) - let action = () => incr(v) - let f = h => - ((x, y) => h(x, y))( - 2, - { - action() - 3 - }, - ) - \"@@"(ignore, f(\"+")) - \"@@"(ignore, f(\"+")) - v.contents -} - -let d = { - let v = ref(3) - let action = () => incr(v) - let f = (h, g) => - ((x, y) => h(x, y))({ - let v = 3 - action() - v * v - }) - \"@@"(ignore, f(\"+", 3)) - \"@@"(ignore, f(\"+", 3)) - v.contents -} - -Mt.from_pair_suites( - __MODULE__, - { - open Mt - list{("partial", _ => Eq((5, 5, 5, 5), (a, b, c, d)))} - }, -) 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/print_alpha_test.res b/jscomp/test/print_alpha_test.res index 81e6511f4f..da1bd17a6f 100644 --- a/jscomp/test/print_alpha_test.res +++ b/jscomp/test/print_alpha_test.res @@ -13,6 +13,6 @@ Mt.from_pair_suites( __MODULE__, { open Mt - list{(__LOC__, _ => Eq(f(\"+", (), 1, 2), 3))} + list{(__LOC__, _ => Eq(f(\"+", ())(1, 2), 3))} }, ) diff --git a/jscomp/test/queue_402.js b/jscomp/test/queue_402.js index 20b12a4009..18f58e5f55 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 @@ -120,7 +119,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; } @@ -139,7 +138,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/queue_test.res b/jscomp/test/queue_test.res index 128527366a..afd84adfe6 100644 --- a/jscomp/test/queue_test.res +++ b/jscomp/test/queue_test.res @@ -1,7 +1,7 @@ module Test = (Queue: module type of Queue) => { let to_array = q => { let v = Array.make(Queue.length(q), 0) - \"@@"(ignore, Queue.fold((i, e) => { + ignore(Queue.fold((i, e) => { v[i] = e i + 1 }, 0, q)) diff --git a/jscomp/test/random_test.js b/jscomp/test/random_test.js deleted file mode 100644 index be7890cc8d..0000000000 --- a/jscomp/test/random_test.js +++ /dev/null @@ -1,85 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Int64 = require("../../lib/js/int64.js"); -let Random = require("../../lib/js/random.js"); -let Mt_global = require("./mt_global.js"); -let Caml_array = require("../../lib/js/caml_array.js"); - -let id = { - contents: 0 -}; - -let suites = { - contents: /* [] */0 -}; - -function eq(f) { - return function (param, param$1) { - return Mt_global.collect_eq(id, suites, f, param, param$1); - }; -} - -function neq(f) { - return function (param, param$1) { - return Mt_global.collect_neq(id, suites, f, param, param$1); - }; -} - -function approx(f) { - return function (param, param$1) { - return Mt_global.collect_approx(id, suites, f, param, param$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))); - -Random.init(0); - -let v = Caml_array.make(10, false); - -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 -]); - -let f = Random.int64(Int64.max_int); - -let h = Random.int64([ - 0, - 3 -]); - -let vv = Random.bits(); - -let xx = Random.$$float(3.0); - -let xxx = Random.int32(103); - -Mt.from_pair_suites("Random_test", suites.contents); - -exports.id = id; -exports.suites = suites; -exports.eq = eq; -exports.neq = neq; -exports.approx = approx; -exports.v = v; -exports.f = f; -exports.h = h; -exports.vv = vv; -exports.xx = xx; -exports.xxx = xxx; -/* Not a pure module */ diff --git a/jscomp/test/random_test.res b/jscomp/test/random_test.res deleted file mode 100644 index 7d313b1b82..0000000000 --- a/jscomp/test/random_test.res +++ /dev/null @@ -1,36 +0,0 @@ -let id = ref(0) -let suites = ref(list{}) - -let eq = f => Mt_global.collect_eq(id, suites, f) -let neq = f => Mt_global.collect_neq(id, suites, f) -let approx = f => Mt_global.collect_approx(id, suites, f) - -let () = neq( - __LOC__, - { - Random.self_init() - Random.int(10000) - }, - { - Random.self_init() - Random.int(1000) - }, -) - -/* determinism acutally */ -let v = Random.init(0) - -let v = Array.make(10, false) - -let () = for i in 0 to 9 { - v[i] = Random.bool() -} -let () = eq(__LOC__, v, [true, true, true, true, true, false, true, true, true, false]) - -let f = Random.int64(Int64.max_int) -let h = Random.int64(3L) -let vv = Random.bits() -let xx = Random.float(3.0) -let xxx = Random.int32(103l) - -let () = Mt.from_pair_suites(__MODULE__, suites.contents) diff --git a/jscomp/test/raw_hash_tbl_bench.js b/jscomp/test/raw_hash_tbl_bench.js index bb3b40f429..6a112173d9 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/reactDOMRe.res b/jscomp/test/reactDOMRe.res index adb794147f..6184b46dca 100644 --- a/jscomp/test/reactDOMRe.res +++ b/jscomp/test/reactDOMRe.res @@ -2142,7 +2142,7 @@ include ( let createElementVariadic = (domClassName, ~props=?, children) => { let variadicArguments = - [Obj.magic(domClassName), Obj.magic(props)] |> Js.Array.concat(children) + [Obj.magic(domClassName), Obj.magic(props)]->Js.Array2.concat(children) createElementInternalHack->apply(Js.Nullable.null, variadicArguments) } }: { diff --git a/jscomp/test/reactTestUtils.js b/jscomp/test/reactTestUtils.js index dca2fa6dfb..226452e651 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/reactTestUtils.res b/jscomp/test/reactTestUtils.res index 30b76182ca..381af19bf2 100644 --- a/jscomp/test/reactTestUtils.res +++ b/jscomp/test/reactTestUtils.res @@ -80,7 +80,7 @@ module Simulate = { external querySelector: (Dom.element, string) => option = "querySelector" @send -external querySelectorAll: (Dom.element, string) => Js.Array.array_like = +external querySelectorAll: (Dom.element, string) => Js.Array2.array_like = "querySelectorAll" @get external textContent: Dom.element => string = "textContent" @@ -91,7 +91,7 @@ external createElement: (Dom.document, string) => Dom.element = "createElement" @send external appendChild: (Dom.element, Dom.element) => Dom.element = "appendChild" -let querySelectorAll = (element, string) => Js.Array.from(querySelectorAll(element, string)) +let querySelectorAll = (element, string) => Js.Array2.from(querySelectorAll(element, string)) module DOM = { open Belt diff --git a/jscomp/test/reasonReact.js b/jscomp/test/reasonReact.js index 55c86ce840..5d2d2576b3 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, @@ -84,44 +91,6 @@ function element(keyOpt, refOpt, component) { } } -function wrapReasonForJs(component, jsPropsToReason) { - let uncurriedJsPropsToReason = Curry.__1(jsPropsToReason); - component.reactClassInternal.prototype.jsPropsToReason = uncurriedJsPropsToReason; - return component.reactClassInternal; -} - -let dummyInteropComponent = basicComponent("interop"); - -function wrapJsForReason(reactClass, props, children) { - let jsElementWrapped = (function (param, param$1) { - let props$1 = Object.assign(Object.assign({}, props), { - ref: param$1, - key: param - }); - let varargs = [ - reactClass, - props$1 - ].concat(children); - return Curry._2(React.createElement.apply, null, varargs); - }); - return { - debugName: dummyInteropComponent.debugName, - reactClassInternal: dummyInteropComponent.reactClassInternal, - handedOffState: dummyInteropComponent.handedOffState, - willReceiveProps: dummyInteropComponent.willReceiveProps, - didMount: dummyInteropComponent.didMount, - didUpdate: dummyInteropComponent.didUpdate, - willUnmount: dummyInteropComponent.willUnmount, - willUpdate: dummyInteropComponent.willUpdate, - shouldUpdate: dummyInteropComponent.shouldUpdate, - render: dummyInteropComponent.render, - initialState: dummyInteropComponent.initialState, - retainedProps: dummyInteropComponent.retainedProps, - reducer: dummyInteropComponent.reducer, - jsElementWrapped: jsElementWrapped - }; -} - let Router; exports.statelessComponent = statelessComponent; @@ -129,8 +98,6 @@ exports.statelessComponentWithRetainedProps = statelessComponentWithRetainedProp exports.reducerComponent = reducerComponent; exports.reducerComponentWithRetainedProps = reducerComponentWithRetainedProps; exports.element = element; -exports.wrapReasonForJs = wrapReasonForJs; exports.createDomElement = createDomElement; -exports.wrapJsForReason = wrapJsForReason; exports.Router = Router; -/* dummyInteropComponent Not a pure module */ +/* react Not a pure module */ diff --git a/jscomp/test/reasonReact.res b/jscomp/test/reasonReact.res index 0bb79e42bb..7cfb8ce1ab 100644 --- a/jscomp/test/reasonReact.res +++ b/jscomp/test/reasonReact.res @@ -30,7 +30,7 @@ external cloneElement: (reactElement, ~props: {..}=?, array) => re external createElementVerbatim: 'a = "createElement" let createDomElement = (s, ~props, children) => { - let vararg = [Obj.magic(s), Obj.magic(props)] |> Js.Array.concat(children) + let vararg = [Obj.magic(s), Obj.magic(props)]->Js.Array2.concat(children) /* Use varargs to avoid warnings on duplicate keys in children */ Obj.magic(createElementVerbatim)["apply"](Js.Nullable.null, vararg) } @@ -253,56 +253,6 @@ let element = ( } } -let wrapReasonForJs = ( - ~component, - jsPropsToReason: jsPropsToReason<'jsProps, 'state, 'retainedProps, 'action>, -) => { - let jsPropsToReason: jsPropsToReason = Obj.magic( - jsPropsToReason, - ) /* cast 'jsProps to jsProps */ - let uncurriedJsPropsToReason: uncurriedJsPropsToReason< - jsProps, - 'state, - 'retainedProps, - 'action, - > = (. jsProps) => jsPropsToReason(jsProps) - Obj.magic(component.reactClassInternal)["prototype"]["jsPropsToReason"] = Some( - uncurriedJsPropsToReason, - ) - component.reactClassInternal -} - -module WrapProps = { - /* We wrap the props for reason->reason components, as a marker that "these props were passed from another - reason component" */ - let wrapProps = ( - ~reactClass, - ~props, - children, - ~key: Js.nullable, - ~ref: Js.nullable => unit>, - ) => { - let props = Js.Obj.assign( - Js.Obj.assign(Js.Obj.empty(), Obj.magic(props)), - {"ref": ref, "key": key}, - ) - let varargs = [Obj.magic(reactClass), Obj.magic(props)] |> Js.Array.concat(Obj.magic(children)) - /* Use varargs under the hood */ - Obj.magic(createElementVerbatim)["apply"](Js.Nullable.null, varargs) - } - let dummyInteropComponent = basicComponent("interop") - let wrapJsForReason = (~reactClass, ~props, children): component< - stateless, - noRetainedProps, - _, - > => { - let jsElementWrapped = Some(wrapProps(~reactClass, ~props, children)) - {...dummyInteropComponent, jsElementWrapped: jsElementWrapped} - } -} - -let wrapJsForReason = WrapProps.wrapJsForReason - @module("react") external fragment: 'a = "Fragment" module Router = ReasonReactRouter diff --git a/jscomp/test/reasonReact.resi b/jscomp/test/reasonReact.resi index 89d3b7f58a..a006b19ec4 100644 --- a/jscomp/test/reasonReact.resi +++ b/jscomp/test/reasonReact.resi @@ -183,32 +183,11 @@ type jsPropsToReason<'jsProps, 'state, 'retainedProps, 'action> = 'jsProps => co 'action, > -/* ** - * We *under* constrain the kind of component spec this accepts because we actually extend the *originally* - * defined component. It uses mutation on the original component, so that even if it is extended with - * {...component}, all extensions will also see the underlying js class. I can sleep at night because js - * interop is integrating with untyped, code and it is *possible* to create pure-ReasonReact apps without JS - * interop entirely. */ -let wrapReasonForJs: ( - ~component: componentSpec<'state, 'initialState, 'retainedProps, 'initialRetainedProps, 'action>, - jsPropsToReason<_>, -) => reactClass - @deprecated(" Were you using this because you needed to pass a children array reference to a DOM element? We now support children spread for DOM elements: `
...children
`. Alternatively, if you're using this because the prop name contains a hyphen, please use `ReactDOMRe.createElementVariadic` instead.") let createDomElement: (string, ~props: {..}, array) => reactElement -/** - * Wrap props into a JS component - * Use for interop when Reason components use JS components - */ -let wrapJsForReason: ( - ~reactClass: reactClass, - ~props: 'a, - 'b, -) => component - @module("react") external fragment: 'a = "Fragment" module Router = ReasonReactRouter diff --git a/jscomp/test/reasonReactCompat.js b/jscomp/test/reasonReactCompat.js deleted file mode 100644 index 43f178a76d..0000000000 --- a/jscomp/test/reasonReactCompat.js +++ /dev/null @@ -1,12 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let ReasonReact = require("./reasonReact.js"); - -let wrapReactForReasonReact = ReasonReact.wrapJsForReason; - -let wrapReasonReactForReact = ReasonReact.wrapReasonForJs; - -exports.wrapReactForReasonReact = wrapReactForReasonReact; -exports.wrapReasonReactForReact = wrapReasonReactForReact; -/* ReasonReact Not a pure module */ diff --git a/jscomp/test/reasonReactCompat.res b/jscomp/test/reasonReactCompat.res deleted file mode 100644 index 3118ab160c..0000000000 --- a/jscomp/test/reasonReactCompat.res +++ /dev/null @@ -1,10 +0,0 @@ -external componentToReasonReactClass: React.component<'props> => ReasonReact.reactClass = - "%identity" - -external reasonReactClassToComponent: ReasonReact.reactClass => React.component<'props> = - "%identity" -let wrapReactForReasonReact = (component, props, children) => - ReasonReact.wrapJsForReason(~reactClass=componentToReasonReactClass(component), ~props, children) - -let wrapReasonReactForReact = (~component, propsConverter) => - reasonReactClassToComponent(ReasonReact.wrapReasonForJs(~component, propsConverter)) diff --git a/jscomp/test/reasonReactCompat.resi b/jscomp/test/reasonReactCompat.resi deleted file mode 100644 index bb6e9c257c..0000000000 --- a/jscomp/test/reasonReactCompat.resi +++ /dev/null @@ -1,14 +0,0 @@ -let wrapReactForReasonReact: ( - React.component<'props>, - 'props, - 'children, -) => ReasonReact.component< - ReasonReact.stateless, - ReasonReact.noRetainedProps, - ReasonReact.actionless, -> - -let wrapReasonReactForReact: ( - ~component: ReasonReact.componentSpec<'a, 'b, 'c, 'd, 'e>, - ReasonReact.jsPropsToReason<'props, 'g, 'h, 'i>, -) => React.component<'props> diff --git a/jscomp/test/reasonReactRouter.js b/jscomp/test/reasonReactRouter.js index af82ab9612..f78f252253 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/reasonReactRouter.res b/jscomp/test/reasonReactRouter.res index cd70c75ee8..df28cee142 100644 --- a/jscomp/test/reasonReactRouter.res +++ b/jscomp/test/reasonReactRouter.res @@ -68,13 +68,13 @@ let path = () => | "/" => list{} | raw => /* remove the preceeding /, which every pathname seems to have */ - let raw = Js.String.sliceToEnd(~from=1, raw) + let raw = Js.String2.sliceToEnd(raw, ~from=1) /* remove the trailing /, which some pathnames might have. Ugh */ - let raw = switch Js.String.get(raw, Js.String.length(raw) - 1) { - | "/" => Js.String.slice(~from=0, ~to_=-1, raw) + let raw = switch Js.String2.get(raw, Js.String2.length(raw) - 1) { + | "/" => Js.String2.slice(raw, ~from=0, ~to_=-1) | _ => raw } - raw |> Js.String.split("/") |> arrayToList + raw->Js.String2.split("/")->arrayToList } } let hash = () => @@ -87,7 +87,7 @@ let hash = () => | raw => /* remove the preceeding #, which every hash seems to have. Why is this even included in location.hash?? */ - raw |> Js.String.sliceToEnd(~from=1) + raw->Js.String2.sliceToEnd(~from=1) } } let search = () => @@ -99,7 +99,7 @@ let search = () => | "?" => "" | raw => /* remove the preceeding ?, which every search seems to have. */ - raw |> Js.String.sliceToEnd(~from=1) + raw->Js.String2.sliceToEnd(~from=1) } } let push = path => 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_fun_test.res b/jscomp/test/rec_fun_test.res index ee57d1d11b..249961346b 100644 --- a/jscomp/test/rec_fun_test.res +++ b/jscomp/test/rec_fun_test.res @@ -18,7 +18,7 @@ let g = () => { i + 1 } - print_endline(\"@@"(string_of_int, next(0, true))) + print_endline(string_of_int(next(0, true))) } g() 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 f45e17a0fd..307cdc6645 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") { @@ -190,7 +280,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; } @@ -357,7 +447,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, @@ -395,7 +485,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; } @@ -411,7 +501,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; @@ -518,7 +608,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) { @@ -534,7 +624,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; } @@ -545,7 +635,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) { @@ -563,7 +653,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; @@ -606,7 +696,7 @@ function iter(f, _param) { return; } iter(f, param.l); - Curry._1(f, param.v); + f(param.v); _param = param.r; continue; }; @@ -619,7 +709,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; }; @@ -631,7 +721,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)) { @@ -648,7 +738,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)) { @@ -667,7 +757,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) { @@ -691,7 +781,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]; @@ -746,7 +836,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; } @@ -765,7 +855,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) { @@ -775,7 +865,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; @@ -796,7 +886,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) { @@ -806,7 +896,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; @@ -830,7 +920,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) { @@ -840,7 +930,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; @@ -861,7 +951,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) { @@ -871,7 +961,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; @@ -892,7 +982,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); } @@ -909,11 +999,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)); @@ -1065,7 +1155,7 @@ let ASet = { union: union, inter: inter, diff: diff, - compare: compare$1, + compare: compare, equal: equal, subset: subset, iter: iter, @@ -1093,6 +1183,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) { @@ -1105,10 +1219,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) ] }; }) @@ -1120,7 +1234,7 @@ let suites_1 = { (function (param) { return { TAG: "Eq", - _0: Curry._1(y, undefined), + _0: BB.y(), _1: 32 }; }) @@ -1131,7 +1245,7 @@ let suites_1 = { (function (param) { return { TAG: "Eq", - _0: Curry._1(x, undefined), + _0: AA.x(), _1: 35 }; }) @@ -1143,7 +1257,7 @@ let suites_1 = { return { TAG: "Eq", _0: true, - _1: Curry._1(A.even, 2) + _1: A.even(2) }; }) ], @@ -1154,7 +1268,7 @@ let suites_1 = { return { TAG: "Eq", _0: true, - _1: Curry._1(even$1, 4) + _1: AA.even(4) }; }) ], @@ -1165,7 +1279,7 @@ let suites_1 = { return { TAG: "Eq", _0: false, - _1: Curry._1(B.odd, 2) + _1: B.odd(2) }; }) ], @@ -1176,7 +1290,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" @@ -1222,4 +1336,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 a33e3982c2..af2315fe12 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, @@ -51,7 +50,7 @@ function MakeLayer$2(Deps) { Error: new Error() }; }; - let routes = function (param) { + let routes = function () { return [[ "/lights", Deps.handleGetLight @@ -127,7 +126,7 @@ function presentJson(json, status) { }; } -function routes(param) { +function routes() { return [[ "/lights", A.handleGetLight @@ -152,11 +151,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({ @@ -177,7 +176,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 583a1d11ae..6d117d0bba 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; }); @@ -139,7 +138,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; }); @@ -153,7 +152,7 @@ Caml_module.update_mod({ a: a$2 }); -let a$3 = CamlinternalLazy.from_fun(function () { +let a$3 = Lazy.from_fun(function () { return 2; }); @@ -177,7 +176,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/regression_print.res b/jscomp/test/regression_print.res index b652645f72..3485420e9e 100644 --- a/jscomp/test/regression_print.res +++ b/jscomp/test/regression_print.res @@ -4,7 +4,7 @@ include ( let debug = x => print_endline(to_str(x)) let () = { - \"@@"(debug, 2) + debug(2) debug(1) } }: {} diff --git a/jscomp/test/res_debug.js b/jscomp/test/res_debug.js index 19e1fd8326..4dc240a3a2 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 44cc027ead..2977b9a6a4 100644 --- a/jscomp/test/return_check.js +++ b/jscomp/test/return_check.js @@ -41,7 +41,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 7a5a7ee9a1..23de33aba1 100644 --- a/jscomp/test/set_gen.js +++ b/jscomp/test/set_gen.js @@ -2,7 +2,6 @@ 'use strict'; let List = require("../../lib/js/list.js"); -let Curry = require("../../lib/js/curry.js"); let Pervasives = require("../../lib/js/pervasives.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); @@ -120,7 +119,7 @@ function iter(f, _x) { return; } iter(f, x._0); - Curry._1(f, x._1); + f(x._1); _x = x._2; continue; }; @@ -133,7 +132,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; }; @@ -145,7 +144,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)) { @@ -162,7 +161,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)) { @@ -402,7 +401,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); @@ -422,7 +421,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]; @@ -625,7 +624,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: [ @@ -638,7 +637,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: [ @@ -668,7 +667,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: [ @@ -702,7 +701,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 deleted file mode 100644 index 7adebca675..0000000000 --- a/jscomp/test/sexp.js +++ /dev/null @@ -1,541 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'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 equal = Caml_obj.equal; - -let compare = Caml_obj.compare; - -let hash = Hashtbl.hash; - -function of_int(x) { - return { - NAME: "Atom", - VAL: String(x) - }; -} - -function of_float(x) { - return { - NAME: "Atom", - VAL: Pervasives.string_of_float(x) - }; -} - -function of_bool(x) { - return { - NAME: "Atom", - VAL: x ? "true" : "false" - }; -} - -function atom(x) { - return { - NAME: "Atom", - VAL: x - }; -} - -function of_list(l) { - return { - NAME: "List", - VAL: l - }; -} - -function of_rev_list(l) { - return { - NAME: "List", - VAL: List.rev(l) - }; -} - -function of_pair(param) { - return { - NAME: "List", - VAL: { - hd: param[0], - tl: { - hd: param[1], - tl: /* [] */0 - } - } - }; -} - -function of_triple(param) { - return { - NAME: "List", - VAL: { - hd: param[0], - tl: { - hd: param[1], - tl: { - hd: param[2], - tl: /* [] */0 - } - } - } - }; -} - -function of_quad(param) { - return { - NAME: "List", - VAL: { - hd: param[0], - tl: { - hd: param[1], - tl: { - hd: param[2], - tl: { - hd: param[3], - tl: /* [] */0 - } - } - } - } - }; -} - -function of_variant(name, args) { - return { - NAME: "List", - VAL: { - hd: { - NAME: "Atom", - VAL: name - }, - tl: args - } - }; -} - -function of_field(name, t) { - return { - NAME: "List", - VAL: { - hd: { - NAME: "Atom", - VAL: name - }, - tl: { - hd: t, - tl: /* [] */0 - } - } - }; -} - -function of_record(l) { - return { - NAME: "List", - VAL: List.map((function (param) { - return of_field(param[0], param[1]); - }), l) - }; -} - -function $$return(x) { - return Caml_option.some(x); -} - -function $great$pipe$eq(e, f) { - if (e !== undefined) { - return Caml_option.some(Curry._1(f, Caml_option.valFromOption(e))); - } - -} - -function $great$great$eq(e, f) { - if (e !== undefined) { - return Curry._1(f, Caml_option.valFromOption(e)); - } - -} - -function map_opt(f, l) { - let _acc = /* [] */0; - let _l = l; - while(true) { - let l$1 = _l; - let acc = _acc; - if (!l$1) { - return List.rev(acc); - } - let y = Curry._1(f, l$1.hd); - if (y === undefined) { - return; - } - _l = l$1.tl; - _acc = { - hd: Caml_option.valFromOption(y), - tl: acc - }; - continue; - }; -} - -function list_any(f, e) { - if (e.NAME === "List") { - let _l = e.VAL; - while(true) { - let l = _l; - if (!l) { - return; - } - let res = Curry._1(f, l.hd); - if (res !== undefined) { - return res; - } - _l = l.tl; - continue; - }; - } - -} - -function list_all(f, e) { - if (e.NAME === "List") { - let _acc = /* [] */0; - let _l = e.VAL; - while(true) { - let l = _l; - let acc = _acc; - if (!l) { - return List.rev(acc); - } - let tl = l.tl; - let y = Curry._1(f, l.hd); - if (y !== undefined) { - _l = tl; - _acc = { - hd: Caml_option.valFromOption(y), - tl: acc - }; - continue; - } - _l = tl; - continue; - }; - } else { - return /* [] */0; - } -} - -function _try_atom(e, f) { - if (e.NAME === "List") { - return; - } - try { - return Caml_option.some(Curry._1(f, e.VAL)); - } - catch (exn){ - return; - } -} - -function to_int(e) { - return _try_atom(e, Caml_format.int_of_string); -} - -function to_bool(e) { - return _try_atom(e, Pervasives.bool_of_string); -} - -function to_float(e) { - return _try_atom(e, Caml_format.float_of_string); -} - -function to_string(e) { - return _try_atom(e, (function (x) { - return x; - })); -} - -function to_pair(e) { - if (typeof e !== "object") { - return; - } - if (e.NAME !== "List") { - return; - } - let match = e.VAL; - if (!match) { - return; - } - let match$1 = match.tl; - if (match$1 && !match$1.tl) { - return [ - match.hd, - match$1.hd - ]; - } - -} - -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_triple(e) { - if (typeof e !== "object") { - return; - } - if (e.NAME !== "List") { - return; - } - let match = e.VAL; - if (!match) { - return; - } - let match$1 = match.tl; - if (!match$1) { - return; - } - let match$2 = match$1.tl; - if (match$2 && !match$2.tl) { - return [ - match.hd, - match$1.hd, - match$2.hd - ]; - } - -} - -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_list(e) { - if (e.NAME === "List") { - return Caml_option.some(e.VAL); - } - -} - -function to_list_with(f, 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") { - 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; - } - _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 _get_field_list(name, _l) { - while(true) { - let l = _l; - if (!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; - } - _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 _get_variant(s, args, _l) { - while(true) { - let l = _l; - if (!l) { - return; - } - let match = l.hd; - if (Caml_obj.equal(s, match[0])) { - return Curry._1(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_exn(e) { - if (e !== undefined) { - return Caml_option.valFromOption(e); - } - throw { - RE_EXN_ID: "Failure", - _1: "CCSexp.Traverse.get_exn", - Error: new Error() - }; -} - -let of_unit = { - NAME: "List", - VAL: /* [] */0 -}; - -let Traverse = { - map_opt: map_opt, - list_any: list_any, - list_all: list_all, - to_int: to_int, - to_string: to_string, - to_bool: to_bool, - to_float: to_float, - to_list: to_list, - to_list_with: to_list_with, - to_pair: to_pair, - to_pair_with: to_pair_with, - to_triple: to_triple, - to_triple_with: to_triple_with, - get_field: get_field, - field: field, - get_variant: get_variant, - field_list: field_list, - $great$great$eq: $great$great$eq, - $great$pipe$eq: $great$pipe$eq, - $$return: $$return, - get_exn: get_exn -}; - -exports.equal = equal; -exports.compare = compare; -exports.hash = hash; -exports.atom = atom; -exports.of_int = of_int; -exports.of_bool = of_bool; -exports.of_list = of_list; -exports.of_rev_list = of_rev_list; -exports.of_float = of_float; -exports.of_unit = of_unit; -exports.of_pair = of_pair; -exports.of_triple = of_triple; -exports.of_quad = of_quad; -exports.of_variant = of_variant; -exports.of_field = of_field; -exports.of_record = of_record; -exports.Traverse = Traverse; -/* No side effect */ diff --git a/jscomp/test/sexp.res b/jscomp/test/sexp.res deleted file mode 100644 index ef95024c24..0000000000 --- a/jscomp/test/sexp.res +++ /dev/null @@ -1,186 +0,0 @@ -/*** {1 Simple S-expression parsing/printing} */ - -type rec t = [ - | #Atom(string) - | #List(list) -] - -let equal = (a, b) => a == b - -let compare = (a, b) => Pervasives.compare(a, b) - -let hash = a => Hashtbl.hash(a) - -let of_int = x => #Atom(string_of_int(x)) -let of_float = x => #Atom(string_of_float(x)) -let of_bool = x => #Atom(string_of_bool(x)) -let atom = x => #Atom(x) -let of_unit = #List(list{}) -let of_list = l => #List(l) -let of_rev_list = l => #List(List.rev(l)) -let of_pair = ((x, y)) => #List(list{x, y}) -let of_triple = ((x, y, z)) => #List(list{x, y, z}) -let of_quad = ((x, y, z, u)) => #List(list{x, y, z, u}) - -let of_variant = (name, args) => #List(list{#Atom(name), ...args}) -let of_field = (name, t) => #List(list{#Atom(name), t}) -let of_record = l => #List(List.map(((n, x)) => of_field(n, x), l)) - -/*** {6 Traversal of S-exp} */ - -module Traverse = { - type conv<'a> = t => option<'a> - - let return = x => Some(x) - - let \">|=" = (e, f) => - switch e { - | None => None - | Some(x) => Some(f(x)) - } - - let \">>=" = (e, f) => - switch e { - | None => None - | Some(x) => f(x) - } - - let map_opt = (f, l) => { - let rec recurse = (acc, l) => - switch l { - | list{} => Some(List.rev(acc)) - | list{x, ...l'} => - switch f(x) { - | None => None - | Some(y) => recurse(list{y, ...acc}, l') - } - } - recurse(list{}, l) - } - - let rec _list_any = (f, l) => - switch l { - | list{} => None - | list{x, ...tl} => - switch f(x) { - | Some(_) as res => res - | None => _list_any(f, tl) - } - } - - let list_any = (f, e) => - switch e { - | #Atom(_) => None - | #List(l) => _list_any(f, l) - } - - let rec _list_all = (f, acc, l) => - switch l { - | list{} => List.rev(acc) - | list{x, ...tl} => - switch f(x) { - | Some(y) => _list_all(f, list{y, ...acc}, tl) - | None => _list_all(f, acc, tl) - } - } - - let list_all = (f, e) => - switch e { - | #Atom(_) => list{} - | #List(l) => _list_all(f, list{}, l) - } - - let _try_atom = (e, f) => - switch e { - | #List(_) => None - | #Atom(x) => - try Some(f(x)) catch { - | _ => None - } - } - - let to_int = e => _try_atom(e, int_of_string) - let to_bool = e => _try_atom(e, bool_of_string) - let to_float = e => _try_atom(e, float_of_string) - let to_string = e => _try_atom(e, x => x) - - let to_pair = e => - switch e { - | #List(list{x, y}) => Some(x, y) - | _ => None - } - - let to_pair_with = (f1, f2, e) => - \">>="(to_pair(e), ((x, y)) => \">>="(f1(x), x => \">>="(f2(y), y => return((x, y))))) - - let to_triple = e => - switch e { - | #List(list{x, y, z}) => Some(x, y, z) - | _ => None - } - - let to_triple_with = (f1, f2, f3, e) => - \">>="(to_triple(e), ((x, y, z)) => - \">>="(f1(x), x => \">>="(f2(y), y => \">>="(f3(z), z => return((x, y, z))))) - ) - - let to_list = e => - switch e { - | #List(l) => Some(l) - | #Atom(_) => None - } - - let to_list_with = (f, e: t) => - switch e { - | #List(l) => map_opt(f, l) - | #Atom(_) => None - } - - let rec _get_field = (name, l) => - switch l { - | list{#List(list{#Atom(n), x}), ..._} if name == n => Some(x) - | list{_, ...tl} => _get_field(name, tl) - | list{} => None - } - - let get_field = (name, e) => - switch e { - | #List(l) => _get_field(name, l) - | #Atom(_) => None - } - - let field = (name, f, e) => \">>="(get_field(name, e), f) - - let rec _get_field_list = (name, l) => - switch l { - | list{#List(list{#Atom(n), ...tl}), ..._} if name == n => Some(tl) - | list{_, ...tl} => _get_field_list(name, tl) - | list{} => None - } - - let field_list = (name, f, e) => - switch e { - | #List(l) => \">>="(_get_field_list(name, l), f) - | #Atom(_) => None - } - - let rec _get_variant = (s, args, l) => - switch l { - | list{} => None - | list{(s', f), ..._} if s == s' => f(args) - | list{_, ...tl} => _get_variant(s, args, tl) - } - - let get_variant = (l, e) => - switch e { - | #List(list{#Atom(s), ...args}) => _get_variant(s, args, l) - | #List(_) => None - | #Atom(s) => _get_variant(s, list{}, l) - } - - let get_exn = e => - switch e { - | None => failwith("CCSexp.Traverse.get_exn") - | Some(x) => x - } -} diff --git a/jscomp/test/sexp.resi b/jscomp/test/sexp.resi deleted file mode 100644 index ffb85e6343..0000000000 --- a/jscomp/test/sexp.resi +++ /dev/null @@ -1,146 +0,0 @@ -/*** {1 Handling S-expressions} - - @since 0.4 - - @since 0.7 - Moved the streaming parser to CCSexpStream -*/ - -/*** {2 Basics} */ - -type rec t = [ - | #Atom(string) - | #List(list) -] - -let equal: (t, t) => bool -let compare: (t, t) => int -let hash: t => int - -/** Build an atom directly from a string */ -let atom: string => t - -let of_int: int => t -let of_bool: bool => t -let of_list: list => t -/** Reverse the list */ -let of_rev_list: list => t -/** Reverse the list */ -let of_float: float => t -let of_unit: t -let of_pair: ((t, t)) => t -let of_triple: ((t, t, t)) => t -let of_quad: ((t, t, t, t)) => t - -/** [of_variant name args] is used to encode algebraic variants - into a S-expr. For instance [of_variant \"some\" [of_int 1]] - represents the value [Some 1] */ -let of_variant: (string, list) => t - -/** Used to represent one record field */ -let of_field: (string, t) => t - -/** Represent a record by its named fields */ -let of_record: list<(string, t)> => t - -/* {6 Traversal of S-exp} - - Example: serializing 2D points - {[ - type pt = {x:int; y:int };; - - let pt_of_sexp e = - Sexp.Traverse.( - field \"x\" to_int e >>= fun x -> - field \"y\" to_int e >>= fun y -> - return {x;y} - );; - - let sexp_of_pt pt = Sexp.(of_record [\"x\", of_int pt.x; \"y\", of_int pt.y]);; - - let l = [{x=1;y=1}; {x=2;y=10}];; - - let sexp = Sexp.(of_list (List.map sexp_of_pt l));; - - Sexp.Traverse.list_all pt_of_sexp sexp;; - ]} - -*/ - -module Traverse: { - /** A converter from S-expressions to 'a is a function [sexp -> 'a option]. - @since 0.4.1 */ - type conv<'a> = t => option<'a> - - /** Map over a list, failing as soon as the function fails on any element - @since 0.4.1 */ - let map_opt: ('a => option<'b>, list<'a>) => option> - - /** [list_any f (List l)] tries [f x] for every element [x] in [List l], - and returns the first non-None result (if any). */ - let list_any: (conv<'a>, t) => option<'a> - - /** [list_all f (List l)] returns the list of all [y] such that [x] in [l] - and [f x = Some y] */ - let list_all: (conv<'a>, t) => list<'a> - - /** Expect an integer */ - let to_int: conv - - /** Expect a string (an atom) */ - let to_string: conv - - /** Expect a boolean */ - let to_bool: conv - - /** Expect a float */ - let to_float: conv - - /** Expect a list */ - let to_list: conv> - - /** Expect a list, applies [f] to all the elements of the list, and succeeds - only if [f] succeeded on every element - @since 0.4.1 */ - let to_list_with: (t => option<'a>) => conv> - - /** Expect a list of two elements */ - let to_pair: conv<(t, t)> - - /** Same as {!to_pair} but applies conversion functions - @since 0.4.1 */ - let to_pair_with: (conv<'a>, conv<'b>) => conv<('a, 'b)> - - let to_triple: conv<(t, t, t)> - - let to_triple_with: (conv<'a>, conv<'b>, conv<'c>) => conv<('a, 'b, 'c)> - /* @since 0.4.1 */ - - /** [get_field name e], when [e = List [(n1,x1); (n2,x2) ... ]], extracts - the [xi] such that [name = ni], if it can find it. */ - let get_field: string => conv - - /** Enriched version of {!get_field}, with a converter as argument */ - let field: (string, conv<'a>) => conv<'a> - - /** [get_variant l e] checks whether [e = List (Atom s :: args)], and - if some pair of [l] is [s, f]. In this case, it calls [f args] - and returns its result, otherwise it returns None. */ - let get_variant: list<(string, list => option<'a>)> => conv<'a> - - /** [field_list name f \"(... (name a b c d) ...record)\"] - will look for a field based on the given [name], and expect it to have a - list of arguments dealt with by [f] (here, \"a b c d\"). - @since 0.4.1 */ - let field_list: (string, list => option<'a>) => conv<'a> - - let \">>=": (option<'a>, 'a => option<'b>) => option<'b> - - let \">|=": (option<'a>, 'a => 'b) => option<'b> - - let return: 'a => option<'a> - - /** Unwrap an option, possibly failing. - @raise Invalid_argument if the argument is [None] */ - let get_exn: option<'a> => 'a -} diff --git a/jscomp/test/sexpm.js b/jscomp/test/sexpm.js deleted file mode 100644 index f0f5229c11..0000000000 --- a/jscomp/test/sexpm.js +++ /dev/null @@ -1,573 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Sys = require("../../lib/js/sys.js"); -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 Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); - -function _must_escape(s) { - try { - for(let i = 0 ,i_finish = s.length; i < i_finish; ++i){ - let c = s.codePointAt(i); - let exit = 0; - if (c >= 42) { - if (c !== 59) { - if (c !== 92) { - exit = 1; - } else { - throw { - RE_EXN_ID: Pervasives.Exit, - Error: new Error() - }; - } - } else { - throw { - RE_EXN_ID: Pervasives.Exit, - Error: new Error() - }; - } - } else if (c >= 11) { - if (c >= 32) { - switch (c) { - case 33 : - case 35 : - case 36 : - case 37 : - case 38 : - case 39 : - exit = 1; - break; - case 32 : - case 34 : - case 40 : - case 41 : - throw { - RE_EXN_ID: Pervasives.Exit, - Error: new Error() - }; - - } - } else { - exit = 1; - } - } else { - if (c >= 9) { - throw { - RE_EXN_ID: Pervasives.Exit, - Error: new Error() - }; - } - exit = 1; - } - if (exit === 1 && c > 127) { - throw { - RE_EXN_ID: Pervasives.Exit, - Error: new Error() - }; - } - - } - return false; - } - catch (raw_exn){ - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); - if (exn.RE_EXN_ID === Pervasives.Exit) { - return true; - } - throw exn; - } -} - -function to_buf(b, t) { - if (t.NAME === "List") { - let l = t.VAL; - if (l) { - if (l.tl) { - $$Buffer.add_char(b, /* '(' */40); - List.iteri((function (i, t$p) { - if (i > 0) { - $$Buffer.add_char(b, /* ' ' */32); - } - to_buf(b, t$p); - }), l); - return $$Buffer.add_char(b, /* ')' */41); - } else { - $$Buffer.add_string(b, "("); - to_buf(b, l.hd); - return $$Buffer.add_string(b, ")"); - } - } else { - return $$Buffer.add_string(b, "()"); - } - } - let s = t.VAL; - if (_must_escape(s)) { - return $$Buffer.add_string(b, "\"" + ($$String.escaped(s) + "\"")); - } else { - return $$Buffer.add_string(b, s); - } -} - -function to_string(t) { - let b = $$Buffer.create(128); - to_buf(b, t); - return $$Buffer.contents(b); -} - -function make(bufsizeOpt, refill) { - let bufsize = bufsizeOpt !== undefined ? bufsizeOpt : 1024; - let bufsize$1 = Caml.int_min(bufsize > 16 ? bufsize : 16, Sys.max_string_length); - return { - buf: Caml_bytes.create(bufsize$1), - refill: refill, - atom: $$Buffer.create(32), - i: 0, - len: 0, - line: 1, - col: 1 - }; -} - -function _is_digit(c) { - if (/* '0' */48 <= c) { - return c <= /* '9' */57; - } else { - return false; - } -} - -function _refill(t, k_succ, k_fail) { - let n = Curry._3(t.refill, t.buf, 0, t.buf.length); - t.i = 0; - t.len = n; - if (n === 0) { - return Curry._1(k_fail, t); - } else { - return Curry._1(k_succ, t); - } -} - -function _get(t) { - if (t.i >= t.len) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "sexpm.res", - 111, - 4 - ], - Error: new Error() - }; - } - let c = Caml_bytes.get(t.buf, t.i); - t.i = t.i + 1 | 0; - if (c === /* '\n' */10) { - t.col = 1; - t.line = t.line + 1 | 0; - } else { - t.col = t.col + 1 | 0; - } - return c; -} - -function _error(param) { - 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 - }; - }; -} - -function _error_eof(t) { - 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); - }), _error_eof); - } - let c = _get(t); - if (c >= 11) { - if (c !== 32) { - return expr_starting_with(c, k, t); - } - continue; - } - if (c < 9) { - return expr_starting_with(c, k, t); - } - continue; - }; -} - -function expr_starting_with(c, k, t) { - if (c >= 42) { - if (c === 59) { - return skip_comment((function (param, param$1) { - return expr(k, t); - }), t); - } - if (c === 92) { - return _error(t)("unexpected '\\'"); - } - - } else if (c >= 11) { - if (c >= 32) { - switch (c) { - case 32 : - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "sexpm.res", - 152, - 27 - ], - Error: new Error() - }; - case 34 : - return quoted(k, t); - case 33 : - case 35 : - case 36 : - case 37 : - case 38 : - case 39 : - break; - case 40 : - return expr_list(/* [] */0, k, t); - case 41 : - return _error(t)("unexpected ')'"); - - } - } - - } else if (c >= 9) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "sexpm.res", - 152, - 27 - ], - Error: new Error() - }; - } - $$Buffer.add_char(t.atom, c); - return atom(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); - }), _error_eof); - } - let c = _get(t); - if (c > 32 || c < 9) { - if (c === 41) { - return Curry._2(k, undefined, { - NAME: "List", - VAL: List.rev(acc) - }); - } - - } else if (c > 31 || c < 11) { - continue; - } - 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 { - return expr_list(/* [] */0, (function (param, l) { - return expr_list({ - hd: l, - tl: acc - }, k, t); - }), t); - } - } else { - return expr_list({ - hd: e, - tl: acc - }, k, t); - } - }), t); - }; -} - -function _return_atom(last, k, t) { - let s = $$Buffer.contents(t.atom); - t.atom.position = 0; - return Curry._2(k, last, { - NAME: "Atom", - VAL: s - }); -} - -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); - })); - } - let c = _get(t); - let exit = 0; - if (c >= 35) { - if (c >= 42) { - if (c === 92) { - return _error(t)("unexpected '\\' in non-quoted string"); - } - exit = 1; - } else { - exit = c >= 40 ? 2 : 1; - } - } else if (c >= 11) { - if (c >= 32) { - switch (c) { - case 32 : - exit = 2; - break; - case 33 : - exit = 1; - break; - case 34 : - return _error(t)("unexpected '\"' in the middle of an atom"); - - } - } else { - exit = 1; - } - } else { - exit = c >= 9 ? 2 : 1; - } - switch (exit) { - case 1 : - $$Buffer.add_char(t.atom, c); - continue; - case 2 : - return _return_atom(c, k, t); - - } - }; -} - -function quoted(k, t) { - while(true) { - if (t.i === t.len) { - return _refill(t, (function (param) { - return quoted(k, param); - }), _error_eof); - } - let c = _get(t); - if (c === 34) { - return _return_atom(undefined, k, t); - } - if (c === 92) { - return escaped((function (c) { - $$Buffer.add_char(t.atom, c); - return quoted(k, t); - }), t); - } - $$Buffer.add_char(t.atom, c); - continue; - }; -} - -function escaped(k, t) { - if (t.i === t.len) { - return _refill(t, (function (param) { - return escaped(k, param); - }), _error_eof); - } - let c = _get(t); - if (c >= 92) { - if (c < 117) { - switch (c) { - case 92 : - return Curry._1(k, /* '\\' */92); - case 98 : - return Curry._1(k, /* '\b' */8); - case 110 : - return Curry._1(k, /* '\n' */10); - case 114 : - return Curry._1(k, /* '\r' */13); - case 93 : - case 94 : - case 95 : - case 96 : - case 97 : - case 99 : - case 100 : - case 101 : - case 102 : - case 103 : - case 104 : - case 105 : - case 106 : - case 107 : - case 108 : - case 109 : - case 111 : - case 112 : - case 113 : - case 115 : - break; - case 116 : - return Curry._1(k, /* '\t' */9); - - } - } - - } else if (c === 34) { - return Curry._1(k, /* '"' */34); - } - if (_is_digit(c)) { - return read2int(c - /* '0' */48 | 0, (function (n) { - return Curry._1(k, Char.chr(n)); - }), t); - } else { - 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); - }), _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")); - } -} - -function read1int(i, k, t) { - if (t.i === t.len) { - return _refill(t, (function (param) { - return read1int(i, k, param); - }), _error_eof); - } - let c = _get(t); - if (_is_digit(c)) { - return Curry._1(k, Math.imul(10, i) + (c - /* '0' */48 | 0) | 0); - } else { - 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); - }), _error_eof); - } - let match = _get(t); - if (match === 10) { - return Curry._2(k, undefined, undefined); - } - continue; - }; -} - -function expr_or_end(k, t) { - while(true) { - if (t.i === t.len) { - return _refill(t, (function (param) { - return expr_or_end(k, param); - }), (function (param) { - return "End"; - })); - } - let c = _get(t); - if (c >= 11) { - if (c !== 32) { - return expr_starting_with(c, k, t); - } - continue; - } - if (c < 9) { - return expr_starting_with(c, k, t); - } - continue; - }; -} - -function next(t) { - return expr_or_end((function (param, x) { - return { - NAME: "Ok", - VAL: x - }; - }), t); -} - -function parse_string(s) { - let n = s.length; - let stop = { - contents: false - }; - let refill = function (bytes, i, _len) { - if (stop.contents) { - return 0; - } else { - stop.contents = true; - Bytes.blit_string(s, 0, bytes, i, n); - return n; - } - }; - let d = make(n, refill); - let res = next(d); - if (typeof res === "object") { - return res; - } else { - return { - NAME: "Error", - VAL: "unexpected end of file" - }; - } -} - -exports.to_buf = to_buf; -exports.to_string = to_string; -exports.parse_string = parse_string; -/* No side effect */ diff --git a/jscomp/test/sexpm.res b/jscomp/test/sexpm.res deleted file mode 100644 index 24c82f8ce6..0000000000 --- a/jscomp/test/sexpm.res +++ /dev/null @@ -1,323 +0,0 @@ -/* This file is free software, part of containers. See file "license" for more details. */ - -@@warning("a") -type or_error<'a> = [#Ok('a) | #Error(string)] -type sequence<'a> = ('a => unit) => unit -type gen<'a> = unit => option<'a> - -type rec t = [ - | #Atom(string) - | #List(list) -] -type sexp = t - -/* {2 Serialization (encoding)} */ - -/* shall we escape the string because of one of its chars? */ -let _must_escape = s => - try { - for i in 0 to String.length(s) - 1 { - let c = String.unsafe_get(s, i) - switch c { - | ' ' | ';' | ')' | '(' | '"' | '\\' | '\n' | '\t' => raise(Exit) - | _ if Char.code(c) > 127 => raise(Exit) /* non-ascii */ - | _ => () - } - } - false - } catch { - | Exit => true - } - -let rec to_buf = (b, t) => - switch t { - | #Atom(s) if _must_escape(s) => Buffer.add_string(b, "\"" ++ (String.escaped(s) ++ "\"")) - | #Atom(s) => Buffer.add_string(b, s) - | #List(list{}) => Buffer.add_string(b, "()") - | #List(list{x}) => - Buffer.add_string(b, "(") - to_buf(b, x) - Buffer.add_string(b, ")") - | #List(l) => - Buffer.add_char(b, '(') - List.iteri((i, t') => { - if i > 0 { - Buffer.add_char(b, ' ') - } - to_buf(b, t') - }, l) - Buffer.add_char(b, ')') - } - -let to_string = t => { - let b = Buffer.create(128) - to_buf(b, t) - Buffer.contents(b) -} - -/* {2 Deserialization (decoding)} */ - -module type MONAD = { - type t<'a> - let return: 'a => t<'a> - let \">>=": (t<'a>, 'a => t<'b>) => t<'b> -} - -type parse_result<'a> = [or_error<'a> | #End] - -module MakeDecode = (M: MONAD) => { - let \">>=" = M.\">>=" - - type t = { - buf: Bytes.t, - refill: (Bytes.t, int, int) => M.t, - atom: Buffer.t, - mutable i: int /* offset in [buf] */, - mutable len: int /* how many bytes of [buf] are usable */, - mutable line: int, - mutable col: int, - } - - let make = (~bufsize=1024, refill) => { - let bufsize = min(max(bufsize, 16), Sys.max_string_length) - { - buf: Bytes.create(bufsize), - refill, - atom: Buffer.create(32), - i: 0, - len: 0, - line: 1, - col: 1, - } - } - - let _is_digit = c => Char.code('0') <= Char.code(c) && Char.code(c) <= Char.code('9') - let _digit2i = c => Char.code(c) - Char.code('0') - - /* refill buffer. If it works, call k_succ, otherwise call k_fail */ - let _refill = (t, k_succ, k_fail) => - \">>="(t.refill(t.buf, 0, Bytes.length(t.buf)), n => { - t.i = 0 - t.len = n - if n == 0 { - k_fail(t) - } else { - k_succ(t) - } - }) - - /* get next char, assuming t.i < t.len */ - let _get = t => { - assert (t.i < t.len) - let c = Bytes.get(t.buf, t.i) - t.i = t.i + 1 - if c == '\n' { - t.col = 1 - t.line = t.line + 1 - } else { - t.col = t.col + 1 - } - c - } - - /* return an error */ - let _error = ({line, col}, msg: string) => { - let b = Buffer.create(32) - Buffer.add_string(b, "at " ++ (__unsafe_cast(line) ++ (", " ++ (__unsafe_cast(col) ++ ": ")))) - Buffer.add_string(b, msg) - let msg' = Buffer.contents(b) - M.return(#Error(msg')) - } - - let _error_eof = t => _error(t, "unexpected end of input") - - /* The parsers all take a success continuation, and the decoder as - last arguments. The continuation is used to minimize the - number of calls to [>>=] and take two parameters, the next - char (if not consumed), and the returned expression itself */ - - /* read expression */ - let rec expr = (k, t) => - if t.i == t.len { - _refill(t, expr(k), _error_eof) - } else { - switch _get(t) { - | ' ' | '\t' | '\n' => expr(k, t) - | c => expr_starting_with(c, k, t) - } - } - - and expr_starting_with = (c, k, t) => - switch c { - | ' ' | '\t' | '\n' => assert(false) - | ';' => skip_comment((_, ()) => expr(k, t), t) - | '(' => expr_list(list{}, k, t) - | ')' => _error(t, "unexpected ')'") - | '\\' => _error(t, "unexpected '\\'") - | '"' => quoted(k, t) - | c => - Buffer.add_char(t.atom, c) - atom(k, t) - } - - /* parse list */ - and expr_list = (acc, k, t) => - if t.i == t.len { - _refill(t, expr_list(acc, k), _error_eof) - } else { - switch _get(t) { - | ' ' | '\t' | '\n' => expr_list(acc, k, t) - | ')' => k(None, #List(List.rev(acc))) - | c => - expr_starting_with( - c, - (last, e) => - switch last { - | Some('(') => expr_list(list{}, (_, l) => expr_list(list{l, ...acc}, k, t), t) - | Some(')') => k(None, #List(List.rev(list{e, ...acc}))) - | _ => expr_list(list{e, ...acc}, k, t) - }, - t, - ) - } - } - - /* return the current atom (last char: c) */ - and _return_atom = (last, k, t) => { - let s = Buffer.contents(t.atom) - Buffer.clear(t.atom) - k(last, #Atom(s)) - } - - /* parse atom */ - and atom = (k, t) => - if t.i == t.len { - _refill(t, atom(k), _return_atom(None, k)) - } else { - switch _get(t) { - | '\\' => _error(t, "unexpected '\\' in non-quoted string") - | '"' => _error(t, "unexpected '\"' in the middle of an atom") - | (' ' | '\n' | '\t' | '(' | ')') as c => _return_atom(Some(c), k, t) - | c => - Buffer.add_char(t.atom, c) - atom(k, t) - } - } - - /* quoted string */ - and quoted = (k, t) => - if t.i == t.len { - _refill(t, quoted(k), _error_eof) - } else { - switch _get(t) { - | '\\' => - /* read escaped char and continue */ - escaped(c => { - Buffer.add_char(t.atom, c) - quoted(k, t) - }, t) - | '"' => _return_atom(None, k, t) - | c => - Buffer.add_char(t.atom, c) - quoted(k, t) - } - } - - /* read escaped char */ - and escaped = (k, t) => - if t.i == t.len { - _refill(t, escaped(k), _error_eof) - } else { - switch _get(t) { - | 'n' => k('\n') - | 't' => k('\t') - | 'r' => k('\r') - | 'b' => k('\b') - | '\\' => k('\\') - | '"' => k('"') - | c if _is_digit(c) => read2int(_digit2i(c), n => k(Char.chr(n)), t) - | c => _error(t, "unexpected escaped char '" ++ (__unsafe_cast(c) ++ "'")) - } - } - - and read2int = (i, k, t) => - if t.i == t.len { - _refill(t, read2int(i, k), _error_eof) - } else { - switch _get(t) { - | c if _is_digit(c) => read1int(10 * i + _digit2i(c), k, t) - | c => _error(t, "unexpected escaped char '" ++ (__unsafe_cast(c) ++ "' when reading byte")) - } - } - - and read1int = (i, k, t) => - if t.i == t.len { - _refill(t, read1int(i, k), _error_eof) - } else { - switch _get(t) { - | c if _is_digit(c) => k(10 * i + _digit2i(c)) - | c => _error(t, "unexpected escaped char '" ++ (__unsafe_cast(c) ++ "' when reading byte")) - } - } - - /* skip until end of line, then call next() */ - and skip_comment = (k, t) => - if t.i == t.len { - _refill(t, skip_comment(k), _error_eof) - } else { - switch _get(t) { - | '\n' => k(None, ()) - | _ => skip_comment(k, t) - } - } - - /* top-level expression */ - let rec expr_or_end = (k, t) => - if t.i == t.len { - _refill(t, expr_or_end(k), _ => M.return(#End)) - } else { - switch _get(t) { - | ' ' | '\t' | '\n' => expr_or_end(k, t) - | c => expr_starting_with(c, k, t) - } - } - - /* entry point */ - let next = (t): M.t> => expr_or_end((_, x) => M.return(#Ok(x)), t) -} - -module ID_MONAD = { - type t<'a> = 'a - let return = x => x - let \">>=" = (x, f) => f(x) -} - -module D = MakeDecode(ID_MONAD) - -let parse_string = (s): or_error => { - let n = String.length(s) - let stop = ref(false) - let refill = (bytes, i, _len) => - if stop.contents { - 0 - } else { - stop := true - Bytes.blit_string(s, 0, bytes, i, n) - n - } - - let d = D.make(~bufsize=n, refill) - switch D.next(d) { - | #End => #Error("unexpected end of file") - | (#Ok(_) | #Error(_)) as res => res - } -} - -/* $T - CCError.to_opt (parse_string "(abc d/e/f \"hello \\\" () world\" )") <> None - CCError.to_opt (parse_string "(abc ( d e ffff ) \"hello/world\")") <> None -*/ - -/* $Q & ~count:100 - sexp_gen (fun s -> sexp_valid s ==> (to_string s |> parse_string = `Ok s)) -*/ diff --git a/jscomp/test/sexpm.resi b/jscomp/test/sexpm.resi deleted file mode 100644 index 645d0c9ade..0000000000 --- a/jscomp/test/sexpm.resi +++ /dev/null @@ -1,26 +0,0 @@ -/* This file is free software, part of containers. See file "license" for more details. */ - -/* {1 Simple and efficient S-expression parsing/printing} - - @since 0.7 " */ - -type or_error<'a> = [#Ok('a) | #Error(string)] -type sequence<'a> = ('a => unit) => unit -type gen<'a> = unit => option<'a> - -/* {2 Basics} */ - -type rec t = [ - | #Atom(string) - | #List(list) -] -type sexp = t - -/* {2 Serialization (encoding)} */ - -let to_buf: (Buffer.t, t) => unit - -let to_string: t => string - -/** Parse a string */ -let parse_string: string => or_error diff --git a/jscomp/test/sexpm_test.js b/jscomp/test/sexpm_test.js deleted file mode 100644 index c780da38fc..0000000000 --- a/jscomp/test/sexpm_test.js +++ /dev/null @@ -1,96 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Sexpm = require("./sexpm.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, param) { - let y = param[1]; - let x = param[0]; - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + String(test_id.contents)), - (function (param) { - return { - TAG: "Eq", - _0: x, - _1: y - }; - }) - ], - tl: suites.contents - }; -} - -function print_or_error(x) { - if (x.NAME === "Error") { - return "Error:" + x.VAL; - } else { - return "Ok:" + Sexpm.to_string(x.VAL); - } -} - -let a = Sexpm.parse_string("(x x gh 3 3)"); - -eq("File \"sexpm_test.res\", line 17, characters 5-12", [ - { - NAME: "Ok", - VAL: { - NAME: "List", - VAL: { - hd: { - NAME: "Atom", - VAL: "x" - }, - tl: { - hd: { - NAME: "Atom", - VAL: "x" - }, - tl: { - hd: { - NAME: "Atom", - VAL: "gh" - }, - tl: { - hd: { - NAME: "Atom", - VAL: "3" - }, - tl: { - hd: { - NAME: "Atom", - VAL: "3" - }, - tl: /* [] */0 - } - } - } - } - } - } - }, - a -]); - -eq("File \"sexpm_test.res\", line 18, characters 5-12", [ - print_or_error(a).trim(), - "Ok:(x x gh 3 3)\n".trim() -]); - -Mt.from_pair_suites("Sexpm_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.print_or_error = print_or_error; -/* a Not a pure module */ diff --git a/jscomp/test/sexpm_test.res b/jscomp/test/sexpm_test.res deleted file mode 100644 index 591b402f0a..0000000000 --- a/jscomp/test/sexpm_test.res +++ /dev/null @@ -1,25 +0,0 @@ -let suites: ref = ref(list{}) -let test_id = ref(0) -let eq = (loc, (x, y)) => { - incr(test_id) - suites := - list{(loc ++ (" id " ++ string_of_int(test_id.contents)), _ => Mt.Eq(x, y)), ...suites.contents} -} - -let print_or_error = x => - switch x { - | #Ok(a) => "Ok:" ++ Sexpm.to_string(a) - | #Error(a) => "Error:" ++ a - } - -let () = { - let a = Sexpm.parse_string("(x x gh 3 3)") - eq(__LOC__, (#Ok(#List(list{#Atom("x"), #Atom("x"), #Atom("gh"), #Atom("3"), #Atom("3")})), a)) - eq(__LOC__, (Js.String2.trim(print_or_error(a)), Js.String2.trim("Ok:(x x gh 3 3)\n"))) -} - -let () = Mt.from_pair_suites(__MODULE__, suites.contents) - -/* -[%bs.internal.test ] -*/ diff --git a/jscomp/test/small_inline_test.js b/jscomp/test/small_inline_test.js index f68a3a8a52..6056dbd7b1 100644 --- a/jscomp/test/small_inline_test.js +++ b/jscomp/test/small_inline_test.js @@ -4,7 +4,7 @@ let Curry = require("../../lib/js/curry.js"); function $pipe$great(x, f) { - return Curry._1(f, x); + return f(x); } function hello1(y, f) { diff --git a/jscomp/test/stack_comp_test.js b/jscomp/test/stack_comp_test.js index a8356ac0ee..cd4d57493b 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){ @@ -358,10 +356,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/stack_test.res b/jscomp/test/stack_test.res index 48cc753c21..d8c9124daa 100644 --- a/jscomp/test/stack_test.res +++ b/jscomp/test/stack_test.res @@ -2,7 +2,7 @@ open Stack let to_list = v => { let acc = ref(list{}) - while \"@@"(not, is_empty(v)) { + while not(is_empty(v)) { acc := list{pop(v), ...acc.contents} } List.rev(acc.contents) diff --git a/jscomp/test/stream_parser_test.js b/jscomp/test/stream_parser_test.js index da3cdec67b..c02e13545e 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 === ")") { @@ -71,14 +70,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; @@ -88,14 +88,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; @@ -105,7 +106,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) { @@ -117,29 +118,31 @@ function parse(token) { ]; } -let lexer = Genlex.make_lexer({ - hd: "(", - tl: { - hd: "*", +function lexer(input) { + return Genlex.make_lexer({ + hd: "(", tl: { - hd: "/", + hd: "*", tl: { - hd: "+", + hd: "/", tl: { - hd: "-", + hd: "+", tl: { - hd: ")", - tl: /* [] */0 + hd: "-", + tl: { + hd: ")", + tl: /* [] */0 + } } } } } - } -}); + }, input); +} function token(chars) { let strm = lexer(chars); - return function (param) { + return function () { return Stream.next(strm); }; } @@ -150,12 +153,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 { @@ -164,7 +167,31 @@ function l_parse(token) { }; } }; - let parse_f_aux = function (_a) { + 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(); @@ -186,12 +213,12 @@ function l_parse(token) { } }; }; - let parse_f = function (param) { + 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 === ")") { @@ -224,29 +251,7 @@ function l_parse(token) { }; } }; - 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) { @@ -271,7 +276,7 @@ function eq(loc, x, y) { suites.contents = { hd: [ loc + (" id " + String(test_id.contents)), - (function (param) { + (function () { return { TAG: "Eq", _0: x, @@ -331,4 +336,4 @@ exports.l_parse = l_parse; exports.suites = suites; exports.test_id = test_id; exports.eq = eq; -/* lexer Not a pure module */ +/* match Not a pure module */ diff --git a/jscomp/test/stream_parser_test.res b/jscomp/test/stream_parser_test.res index bf6f82113f..d32fa18a34 100644 --- a/jscomp/test/stream_parser_test.res +++ b/jscomp/test/stream_parser_test.res @@ -62,7 +62,7 @@ let parse = (token: unit => Genlex.token) => { let r = parse_expr() (r, Queue.fold((acc, x) => list{x, ...acc}, list{}, look_ahead)) } -let lexer = Genlex.make_lexer(list{"(", "*", "/", "+", "-", ")"}) +let lexer = input => Genlex.make_lexer(list{"(", "*", "/", "+", "-", ")"}, input) let token = chars => { let strm = lexer(chars) () => Stream.next(strm) 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_runtime_test.res b/jscomp/test/string_runtime_test.res index 112b92acbc..fcf6772559 100644 --- a/jscomp/test/string_runtime_test.res +++ b/jscomp/test/string_runtime_test.res @@ -22,8 +22,7 @@ let suites = { Bytes.fill(b, 0, len, 'c') (Bytes.to_string(b), String.init(len, _ => 'c')) } - let (a, b) = \"@@"( - List.split, + let (a, b) = List.split( List.map(x => f(x), list{1000, 1024, 1025, 4095, 4096, 5000, 10000}), ) Eq(a, b) diff --git a/jscomp/test/string_set.js b/jscomp/test/string_set.js index 4312560c40..eb4bb5a3fe 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 9fa548272c..efab7459fd 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"); @@ -123,16 +122,15 @@ function xsplit(delim, s) { } function string_of_chars(x) { - let xs = List.map((function (prim) { + return $$String.concat("", List.map((function (prim) { return String.fromCharCode(prim); - }), x); - return $$Array.of_list(xs).join(""); + }), x)); } Mt.from_pair_suites("String_test", { hd: [ "mutliple switch", - (function (param) { + (function () { return { TAG: "Eq", _0: 9, @@ -143,7 +141,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "int switch", - (function (param) { + (function () { return { TAG: "Eq", _0: 9, @@ -154,7 +152,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "escape_normal", - (function (param) { + (function () { return { TAG: "Eq", _0: "haha", @@ -165,7 +163,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "escape_bytes", - (function (param) { + (function () { return { TAG: "Eq", _0: Bytes.of_string("haha"), @@ -176,7 +174,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "escape_quote", - (function (param) { + (function () { return { TAG: "Eq", _0: "\\\"\\\"", @@ -187,7 +185,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "rev_split_by_char", - (function (param) { + (function () { return { TAG: "Eq", _0: { @@ -207,7 +205,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: { @@ -221,7 +219,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "xsplit", - (function (param) { + (function () { return { TAG: "Eq", _0: { @@ -241,7 +239,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "split_empty", - (function (param) { + (function () { return { TAG: "Eq", _0: /* [] */0, @@ -252,7 +250,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "split_empty2", - (function (param) { + (function () { return { TAG: "Eq", _0: { @@ -266,7 +264,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "rfind", - (function (param) { + (function () { return { TAG: "Eq", _0: 7, @@ -277,7 +275,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "rfind_2", - (function (param) { + (function () { return { TAG: "Eq", _0: 0, @@ -288,7 +286,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "rfind_3", - (function (param) { + (function () { return { TAG: "Eq", _0: -1, @@ -299,7 +297,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "find", - (function (param) { + (function () { return { TAG: "Eq", _0: 0, @@ -310,7 +308,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "find_2", - (function (param) { + (function () { return { TAG: "Eq", _0: 6, @@ -321,7 +319,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "find_3", - (function (param) { + (function () { return { TAG: "Eq", _0: -1, @@ -332,7 +330,7 @@ Mt.from_pair_suites("String_test", { tl: { hd: [ "of_char", - (function (param) { + (function () { return { TAG: "Eq", _0: String.fromCharCode(/* '0' */48), @@ -343,7 +341,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_test.res b/jscomp/test/string_test.res index 92ddcbf3d6..d5192c9f7b 100644 --- a/jscomp/test/string_test.res +++ b/jscomp/test/string_test.res @@ -71,7 +71,7 @@ let xsplit = (~delim, s) => { @val external string_of_char: char => string = "String.fromCharCode" -let string_of_chars = x => \"@@"(String.concat(""), List.map(string_of_char, x)) +let string_of_chars = x => String.concat("", List.map(string_of_char, x)) Mt.from_pair_suites( __MODULE__, 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 dd27498e7a..70bcaf0678 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 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", 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 9d1825a3f5..cf3f4df916 100644 --- a/jscomp/test/test_ari.js +++ b/jscomp/test/test_ari.js @@ -4,12 +4,9 @@ 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) { - return function (param) { - return x + param | 0; - }; +function f(x, y) { + return x + y | 0; } function f1(x, y) { @@ -17,17 +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(x) { + return 3 + x | 0; } let g = 7; -function ff(param) { - return U.test_primit(3, param); +function ff(x) { + return U.test_primit(3, x); } let fff = VV.test_primit2(3); diff --git a/jscomp/test/test_ari.res b/jscomp/test/test_ari.res index cfdf3b61bd..19659092af 100644 --- a/jscomp/test/test_ari.res +++ b/jscomp/test/test_ari.res @@ -1,4 +1,4 @@ -let f = x => \"+"(x) +let f = (x, y) => \"+"(x, y) /* {[ f = function (x){ function(x,y){x + y} (x) } @@ -15,12 +15,12 @@ actually will become */ let f1 = (x, y) => x + y let f3 = (g, x) => g(x) -let f2 = \"+"(3) +let f2 = x => \"+"(3, x) let g = f(3, 4) @val("test_primit") @module("U") external ext: (int, int) => int = "test_primit" -let ff = ext(3) +let ff = x => ext(3, x) type u = int => int @val("test_primit2") @module("VV") external ext: int => u = "test_primit2" let fff = ext(3) diff --git a/jscomp/test/test_array_primitive.js b/jscomp/test/test_array_primitive.js index e9bfac5d2c..a7b16ef382 100644 --- a/jscomp/test/test_array_primitive.js +++ b/jscomp/test/test_array_primitive.js @@ -12,25 +12,25 @@ function caml_array_sub(x, offset, len) { } function caml_array_set(xs, index, newval) { - if (index < 0 || index >= xs.length) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "index out of bounds", - Error: new Error() - }; + if (!(index < 0 || index >= xs.length)) { + return Caml_array.set(xs, index, newval); } - Caml_array.set(xs, index, newval); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds", + Error: new Error() + }; } function caml_array_get(xs, index) { - if (index < 0 || index >= xs.length) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "index out of bounds", - Error: new Error() - }; + if (!(index < 0 || index >= xs.length)) { + return Caml_array.get(xs, index); } - return Caml_array.get(xs, index); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds", + Error: new Error() + }; } function caml_make_vect(len, init) { diff --git a/jscomp/test/test_bool_equal.js b/jscomp/test/test_bool_equal.js index fea96ab95a..549f7c36a7 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 { RE_EXN_ID: "Assert_failure", 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 513556665c..7f37f2416e 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..ce64bd0979 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,13 +59,15 @@ 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; -} +let v = (function (xx, yy) { + return (xx + yy | 0) + u$1 | 0; +})(6, 7); 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_demo.res b/jscomp/test/test_demo.res index 163e78d930..4ceda5c228 100644 --- a/jscomp/test/test_demo.res +++ b/jscomp/test/test_demo.res @@ -76,8 +76,7 @@ let f = (x: cxt) => { } let f = (g, x: cxt) => - \"@@"( - g, + g( switch x { | A => 0 | B(_) => 1 @@ -89,8 +88,7 @@ let f = (g, x: cxt) => ) let f = (h, g, x) => - \"@@"( - h, + h( try g(x) catch { | Not_found => 0 }, @@ -106,6 +104,6 @@ let g1 = (x, y) => { let u = x + y (xx, yy) => xx + yy + u } -let x = g(3, 5, 6) +let x = g(3, 5)(6) -let v = g1(3, 4, 6) +let v = g1(3, 4)(6, 7) diff --git a/jscomp/test/test_exception.js b/jscomp/test/test_exception.js index ad5f3cb93f..c987a027fc 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 { RE_EXN_ID: Local, _1: 3, @@ -14,14 +14,14 @@ function f(param) { }; } -function g(param) { +function g() { throw { RE_EXN_ID: "Not_found", Error: new Error() }; } -function h(param) { +function h() { throw { RE_EXN_ID: Test_common.U, _1: 3, @@ -29,14 +29,14 @@ function h(param) { }; } -function x(param) { +function x() { throw { RE_EXN_ID: Test_common.H, Error: new Error() }; } -function xx(param) { +function xx() { throw { RE_EXN_ID: "Invalid_argument", _1: "x", 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_external.res b/jscomp/test/test_external.res index 0baaa3b734..cd8c1ea4be 100644 --- a/jscomp/test/test_external.res +++ b/jscomp/test/test_external.res @@ -15,4 +15,4 @@ let xx = doc() let () = alert("hehha") -let b = f("x", 3) +let b = f("x")(3) 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_loop.res b/jscomp/test/test_for_loop.res index 5b7e25d61d..45eb52d91a 100644 --- a/jscomp/test/test_for_loop.res +++ b/jscomp/test/test_for_loop.res @@ -14,7 +14,7 @@ let for_2 = x => let for_3 = x => { let v = ref(0) - let arr = Array.map((_, _) => (), x) + let arr = Array.map((_) => (_) => (), x) for i in 0 to Array.length(x) { let j = i * 2 arr[i] = _ => v := v.contents + j @@ -25,7 +25,7 @@ let for_3 = x => { let for_4 = x => { let v = ref(0) - let arr = Array.map((_, _) => (), x) + let arr = Array.map((_) => (_) => (), x) for i in 0 to Array.length(x) { let j = i * 2 let k = 2 * j @@ -37,7 +37,7 @@ let for_4 = x => { let for_5 = (x, u) => { let v = ref(0) - let arr = Array.map((_, _) => (), x) + let arr = Array.map((_) => (_) => (), x) for i in 0 to Array.length(x) { let _j = i * 2 let k = 2 * u * u @@ -49,7 +49,7 @@ let for_5 = (x, u) => { let for_6 = (x, u) => { let v = ref(0) - let arr = Array.map((_, _) => (), x) + let arr = Array.map((_) => (_) => (), x) let v4 = ref(0) let v5 = ref(0) incr(v4) diff --git a/jscomp/test/test_for_map.js b/jscomp/test/test_for_map.js index 412bbeffc6..6103b91887 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) { @@ -182,7 +181,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; @@ -197,7 +196,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; @@ -219,7 +218,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; @@ -234,7 +233,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; @@ -259,7 +258,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; @@ -274,7 +273,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; @@ -296,7 +295,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; @@ -311,7 +310,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; @@ -491,7 +490,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", @@ -511,7 +510,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); } @@ -552,7 +551,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; }; @@ -563,7 +562,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", @@ -581,7 +580,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", @@ -600,7 +599,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; }; @@ -612,7 +611,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)) { @@ -629,7 +628,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)) { @@ -739,7 +738,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])); } } @@ -756,7 +755,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) { @@ -776,7 +775,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); } @@ -786,7 +785,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); } @@ -801,7 +800,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) { @@ -826,7 +825,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]; @@ -882,7 +881,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; } @@ -911,7 +910,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); @@ -988,7 +987,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 deleted file mode 100644 index 77f3725de3..0000000000 --- a/jscomp/test/test_google_closure.js +++ /dev/null @@ -1,42 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let $$Array = require("../../lib/js/array.js"); -let Caml_array = require("../../lib/js/caml_array.js"); - -function f(a, b, param) { - return a + b | 0; -} - -function f2(a) { - return function (param) { - return a + 1 | 0; - }; -} - -let a = String(3); - -let b = 101; - -let arr = $$Array.init(2, (function (param) { - return 0; -})); - -for(let i = 0; i <= 1; ++i){ - Caml_array.set(arr, i, i + 1 | 0); -} - -console.log([ - a, - b, - arr -]); - -let c = arr; - -exports.f = f; -exports.f2 = f2; -exports.a = a; -exports.b = b; -exports.c = c; -/* a Not a pure module */ diff --git a/jscomp/test/test_google_closure.res b/jscomp/test/test_google_closure.res deleted file mode 100644 index 97e50d27c1..0000000000 --- a/jscomp/test/test_google_closure.res +++ /dev/null @@ -1,21 +0,0 @@ -let f = (a, b, _) => a + b - -let f2 = a => f(a, 1) - -let (a, b, c) = ( - string_of_int(f(1, 2, 3)), - { - let f3 = f2(100) - f3(2) - }, - { - let arr = Array.init(2, _ => 0) - for i in 0 to 1 { - let f3 = f2(i) - arr[i] = f3(2) - } - arr - }, -) - -let () = Js.log((a, b, c)) diff --git a/jscomp/test/test_list.js b/jscomp/test/test_list.js index ff8fa1228f..92e2d404f9 100644 --- a/jscomp/test/test_list.js +++ b/jscomp/test/test_list.js @@ -2,7 +2,6 @@ '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"); @@ -106,7 +105,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) @@ -117,7 +116,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) @@ -139,7 +138,7 @@ function rev_map(f, l) { } _x = x.tl; _accu = { - hd: Curry._1(f, x.hd), + hd: f(x.hd), tl: accu }; continue; @@ -152,7 +151,7 @@ function iter(f, _x) { if (!x) { return; } - Curry._1(f, x.hd); + f(x.hd); _x = x.tl; continue; }; @@ -167,7 +166,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; @@ -182,14 +181,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; } @@ -198,7 +197,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) @@ -233,7 +232,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; @@ -244,14 +243,14 @@ function rev_map2(f, l1, l2) { Error: new Error() }; } - if (l2$1) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2", - Error: new Error() - }; + if (!l2$1) { + return accu; } - return accu; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2", + Error: new Error() + }; }; } @@ -261,7 +260,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; @@ -292,7 +291,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 { @@ -301,21 +300,21 @@ function fold_left2(f, _accu, _l1, _l2) { Error: new Error() }; } - if (l2) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_left2", - Error: new Error() - }; + if (!l2) { + return accu; } - return accu; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2", + Error: new Error() + }; }; } 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 { RE_EXN_ID: "Invalid_argument", @@ -323,14 +322,14 @@ function fold_right2(f, l1, l2, accu) { Error: new Error() }; } - if (l2) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2", - Error: new Error() - }; + if (!l2) { + return accu; } - return accu; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2", + Error: new Error() + }; } function for_all(p, _x) { @@ -339,7 +338,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; @@ -353,7 +352,7 @@ function exists(p, _x) { if (!x) { return false; } - if (Curry._1(p, x.hd)) { + if (p(x.hd)) { return true; } _x = x.tl; @@ -367,7 +366,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; @@ -397,7 +396,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; @@ -550,7 +549,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; @@ -563,29 +562,27 @@ function find(p, _x) { }; } -function find_all(p) { - return function (param) { - let _accu = /* [] */0; - let _x = param; - while(true) { - let x = _x; - let accu = _accu; - if (!x) { - return rev_append(accu, /* [] */0); - } - let l = x.tl; - let x$1 = x.hd; - if (Curry._1(p, x$1)) { - _x = l; - _accu = { - hd: x$1, - tl: accu - }; - continue; - } - _x = l; +function find_all(p, l) { + let _accu = /* [] */0; + let _x = l; + while(true) { + let x = _x; + let accu = _accu; + if (!x) { + return rev_append(accu, /* [] */0); + } + let l$1 = x.tl; + let x$1 = x.hd; + if (p(x$1)) { + _x = l$1; + _accu = { + hd: x$1, + tl: accu + }; continue; - }; + } + _x = l$1; + continue; }; } @@ -605,7 +602,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, @@ -679,7 +676,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) @@ -727,8 +724,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: { @@ -739,7 +736,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x1, x3) <= 0) { + } else if (cmp(x1, x3) <= 0) { return { hd: x1, tl: { @@ -762,7 +759,7 @@ function stable_sort(cmp, l) { } }; } - } else if (Curry._2(cmp, x1, x3) <= 0) { + } else if (cmp(x1, x3) <= 0) { return { hd: x2, tl: { @@ -773,7 +770,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x2, x3) <= 0) { + } else if (cmp(x2, x3) <= 0) { return { hd: x2, tl: { @@ -807,7 +804,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: { @@ -847,7 +844,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 @@ -873,8 +870,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: { @@ -885,7 +882,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x1, x3) > 0) { + } else if (cmp(x1, x3) > 0) { return { hd: x1, tl: { @@ -908,7 +905,7 @@ function stable_sort(cmp, l) { } }; } - } else if (Curry._2(cmp, x1, x3) > 0) { + } else if (cmp(x1, x3) > 0) { return { hd: x2, tl: { @@ -919,7 +916,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x2, x3) > 0) { + } else if (cmp(x2, x3) > 0) { return { hd: x2, tl: { @@ -953,7 +950,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: { @@ -993,7 +990,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 @@ -1028,9 +1025,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, @@ -1055,7 +1052,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, @@ -1077,7 +1074,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, @@ -1110,7 +1107,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, @@ -1132,7 +1129,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, @@ -1175,7 +1172,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, @@ -1223,7 +1220,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, @@ -1259,9 +1256,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, @@ -1286,7 +1283,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, @@ -1308,7 +1305,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, @@ -1341,7 +1338,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, @@ -1363,7 +1360,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, @@ -1406,7 +1403,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, @@ -1454,7 +1451,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, diff --git a/jscomp/test/test_list.res b/jscomp/test/test_list.res index acda86ce68..b7198755d6 100644 --- a/jscomp/test/test_list.res +++ b/jscomp/test/test_list.res @@ -275,7 +275,7 @@ let rec find = (p, x) => } } -let find_all = p => { +let find_all = (p, l) => { let rec find = (accu, x) => switch x { | list{} => rev(accu) @@ -286,7 +286,7 @@ let find_all = p => { find(accu, l) } } - find(list{}) + find(list{}, l) } let filter = find_all diff --git a/jscomp/test/test_match_exception.js b/jscomp/test/test_match_exception.js index 0d55fc6b82..c058e129ae 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 eea7e8956d..7b0cd131b9 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"); @@ -216,7 +215,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; @@ -432,18 +431,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 ab66be50ac..6f2abe5272 100644 --- a/jscomp/test/test_seq.js +++ b/jscomp/test/test_seq.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 Pervasives = require("../../lib/js/pervasives.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); @@ -31,7 +30,7 @@ function assoc3(x, _l) { }; } -function help_action(param) { +function help_action() { throw { RE_EXN_ID: Stop, _1: { @@ -48,7 +47,7 @@ function v(speclist) { } function f(g, speclist) { - return Curry._1(g, assoc3("-help", speclist)); + return g(assoc3("-help", speclist)); } function add_help(speclist) { diff --git a/jscomp/test/test_set.js b/jscomp/test/test_set.js index 228e5faf1b..2277bae738 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) { @@ -97,7 +96,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) { @@ -224,7 +223,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, @@ -260,7 +259,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; } @@ -275,7 +274,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) { @@ -375,7 +374,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; } @@ -405,7 +404,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; @@ -447,7 +446,7 @@ function Make(Ord) { return; } iter(f, x_._0); - Curry._1(f, x_._1); + f(x_._1); _x_ = x_._2; continue; }; @@ -459,7 +458,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; }; @@ -470,7 +469,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)) { @@ -486,7 +485,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)) { @@ -502,7 +501,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); @@ -521,7 +520,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]; @@ -572,7 +571,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 2269d68a88..dbca234f2a 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") { @@ -154,20 +153,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_string_map.res b/jscomp/test/test_string_map.res index b58fc23b95..cf87cec744 100644 --- a/jscomp/test/test_string_map.res +++ b/jscomp/test/test_string_map.res @@ -16,12 +16,12 @@ include ( let assertion_test = () => { let m = ref(StringMap.empty) let count = 1000000 - \"@@"(timing("building"), _ => + timing("building", _ => for i in 0 to count { m := StringMap.add(string_of_int(i), string_of_int(i), m.contents) } ) - \"@@"(timing("querying"), _ => + timing("querying", _ => for i in 0 to count { ignore(StringMap.find(string_of_int(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 c1b484b410..957bbdab76 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); @@ -25,7 +24,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); @@ -35,7 +34,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); @@ -45,7 +44,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); @@ -55,7 +54,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); @@ -65,7 +64,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); @@ -75,7 +74,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); @@ -85,7 +84,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); @@ -95,7 +94,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); @@ -105,7 +104,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); @@ -116,7 +115,7 @@ function ff(g, x) { } } -function u(param) { +function u() { throw { RE_EXN_ID: "Not_found", Error: new Error() 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_type_based_arity.res b/jscomp/test/test_type_based_arity.res index ff4dc45e8a..4b20ddb8c5 100644 --- a/jscomp/test/test_type_based_arity.res +++ b/jscomp/test/test_type_based_arity.res @@ -17,7 +17,7 @@ module X: { let f2 = (g, x): X.t => g(x) -let f3 = (g, x) => \"@@"(ignore, g(x)) +let f3 = (g, x) => ignore(g(x)) let f4 = (g, x): ('a, 'b) => g(x) diff --git a/jscomp/test/test_unsafe_obj_ffi_ppx.res b/jscomp/test/test_unsafe_obj_ffi_ppx.res index 3100760da8..462bb4b9d6 100644 --- a/jscomp/test/test_unsafe_obj_ffi_ppx.res +++ b/jscomp/test/test_unsafe_obj_ffi_ppx.res @@ -7,7 +7,7 @@ let i = () => () let h = (x): unit => { x["height"] = 3 - \"@@"(i, x["width"] = 3) + i(x["width"] = 3) } let chain = x => x["element"]["length"] + x["element"]["length"] diff --git a/jscomp/test/test_unsupported_primitive.js b/jscomp/test/test_unsupported_primitive.js index ff497c5966..ab556f677a 100644 --- a/jscomp/test/test_unsupported_primitive.js +++ b/jscomp/test/test_unsupported_primitive.js @@ -4,14 +4,14 @@ 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 { - RE_EXN_ID: "Invalid_argument", - _1: "Marshal.to_buffer: substring out of bounds", - Error: new Error() - }; + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Marshal.to_buffer: substring out of bounds", + Error: new Error() + }; } exports.to_buffer = to_buffer; diff --git a/jscomp/test/test_while_closure.js b/jscomp/test/test_while_closure.js index 7501a52a1e..1db0cfdcd0 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/test_zero_nullable.res b/jscomp/test/test_zero_nullable.res index d181becf2f..a6fc6575f2 100644 --- a/jscomp/test/test_zero_nullable.res +++ b/jscomp/test/test_zero_nullable.res @@ -30,7 +30,7 @@ module Test_null = { } let f5 = (h, x) => { - let u = \"@@"(Js.Null.toOption, h(32)) + let u = Js.Null.toOption(h(32)) switch u { | None => let sum = (x, y) => x + y @@ -42,7 +42,7 @@ module Test_null = { } let f4 = (h, x) => { - let u = \"@@"(Js.Null.toOption, h(32)) + let u = Js.Null.toOption(h(32)) let v = 32 + x switch u { | None => @@ -108,7 +108,7 @@ module Test_def = { } let f5 = (h, x) => { - let u = \"@@"(Js.Undefined.toOption, h(32)) + let u = Js.Undefined.toOption(h(32)) switch u { | None => let sum = (x, y) => x + y @@ -120,7 +120,7 @@ module Test_def = { } let f4 = (h, x) => { - let u = \"@@"(Js.Undefined.toOption, h(32)) + let u = Js.Undefined.toOption(h(32)) let v = 32 + x switch u { | None => @@ -186,7 +186,7 @@ module Test_null_def = { } let f5 = (h, x) => { - let u = \"@@"(toOption, h(32)) + let u = toOption(h(32)) switch u { | None => let sum = (x, y) => x + y @@ -198,7 +198,7 @@ module Test_null_def = { } let f4 = (h, x) => { - let u = \"@@"(toOption, h(32)) + let u = toOption(h(32)) let v = 32 + x switch u { | None => @@ -237,7 +237,7 @@ module Test_null_def = { let f10 = x => isNullable(x) - let f11 = \"@@"(isNullable, return(3)) + let f11 = isNullable(return(3)) } let () = { diff --git a/jscomp/test/ticker.js b/jscomp/test/ticker.js index f88ffd9902..4bde13425b 100644 --- a/jscomp/test/ticker.js +++ b/jscomp/test/ticker.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_obj = require("../../lib/js/caml_obj.js"); let Pervasives = require("../../lib/js/pervasives.js"); @@ -272,7 +271,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; @@ -287,7 +286,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; @@ -309,7 +308,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; @@ -324,7 +323,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; @@ -349,7 +348,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; @@ -364,7 +363,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; @@ -386,7 +385,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; @@ -401,7 +400,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; @@ -581,7 +580,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", @@ -601,7 +600,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); } @@ -642,7 +641,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; }; @@ -653,7 +652,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", @@ -671,7 +670,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", @@ -690,7 +689,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; }; @@ -702,7 +701,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)) { @@ -719,7 +718,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)) { @@ -829,7 +828,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])); } } @@ -846,7 +845,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) { @@ -866,7 +865,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); } @@ -876,7 +875,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); } @@ -891,7 +890,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) { @@ -916,7 +915,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]; @@ -972,7 +971,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; } @@ -1001,7 +1000,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); @@ -1273,20 +1272,20 @@ 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 { - RE_EXN_ID: "Failure", - _1: "Invalid input line", - Error: new Error() - }; + 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 { + RE_EXN_ID: "Failure", + _1: "Invalid input line", + Error: new Error() + }; } throw { RE_EXN_ID: "Failure", @@ -1304,20 +1303,20 @@ 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 { - RE_EXN_ID: "Failure", - _1: "Invalid input line", - Error: new Error() - }; + 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 { + RE_EXN_ID: "Failure", + _1: "Invalid input line", + Error: new Error() + }; } throw { RE_EXN_ID: "Failure", @@ -1331,25 +1330,25 @@ function process_input_line(ticker_map, all_tickers, line) { Error: new Error() }; case "S" : - if (match$3.tl) { - throw { - RE_EXN_ID: "Failure", - _1: "Invalid input line", - Error: new Error() - }; - } - 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 { + RE_EXN_ID: "Failure", + _1: "Invalid input line", + Error: new Error() + }; default: throw { RE_EXN_ID: "Failure", diff --git a/jscomp/test/ticker.res b/jscomp/test/ticker.res index e81690e5e8..4c08e9b84a 100644 --- a/jscomp/test/ticker.res +++ b/jscomp/test/ticker.res @@ -102,7 +102,7 @@ module Ticker_map = Map.Make({ let compute_update_sequences = all_tickers => { /* Ranking */ - \"@@"(ignore, List.fold_left((counter, ticker) => { + ignore(List.fold_left((counter, ticker) => { let rec loop = (counter, {rank, _} as ticker) => switch rank { | Ranked(_) => counter diff --git a/jscomp/test/to_string_test.js b/jscomp/test/to_string_test.js index e6fc68e9db..58bf0132ca 100644 --- a/jscomp/test/to_string_test.js +++ b/jscomp/test/to_string_test.js @@ -4,7 +4,9 @@ let Mt = require("./mt.js"); let Pervasives = require("../../lib/js/pervasives.js"); -let ff = Pervasives.string_of_float; +function ff(v) { + return Pervasives.string_of_float(v); +} function f(v) { return String(v); @@ -13,7 +15,7 @@ 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), @@ -24,7 +26,7 @@ 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), diff --git a/jscomp/test/topsort_test.js b/jscomp/test/topsort_test.js index 62a8e462f0..2d11896f69 100644 --- a/jscomp/test/topsort_test.js +++ b/jscomp/test/topsort_test.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_obj = require("../../lib/js/caml_obj.js"); let Pervasives = require("../../lib/js/pervasives.js"); @@ -404,16 +403,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]); @@ -962,7 +966,7 @@ function iter(f, _param) { return; } iter(f, param.l); - Curry._1(f, param.v); + f(param.v); _param = param.r; continue; }; @@ -975,7 +979,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; }; @@ -987,7 +991,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)) { @@ -1004,7 +1008,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)) { @@ -1023,7 +1027,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) { @@ -1047,7 +1051,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]; @@ -1121,7 +1125,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) { @@ -1131,7 +1135,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; @@ -1152,7 +1156,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) { @@ -1162,7 +1166,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; @@ -1186,7 +1190,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) { @@ -1196,7 +1200,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; @@ -1217,7 +1221,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) { @@ -1227,7 +1231,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; @@ -1265,7 +1269,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/topsort_test.res b/jscomp/test/topsort_test.res index 54e132c6cc..389b0c9ad2 100644 --- a/jscomp/test/topsort_test.res +++ b/jscomp/test/topsort_test.res @@ -49,7 +49,7 @@ let rec dfs2 = (nodes, graph, visited) => { aux(xs, graph, aux(nexts(x, graph), graph, list{x, ...visited})) } } - \"@@"(List.rev, aux(nodes, graph, visited)) + List.rev(aux(nodes, graph, visited)) } let () = { @@ -61,7 +61,7 @@ let () = { let dfs3 = (nodes, graph) => { let visited = ref(list{}) let rec aux = (node, graph) => - if \"@@"(not, List.mem(node, visited.contents)) { + if not(List.mem(node, visited.contents)) { visited := list{node, ...visited.contents} List.iter(x => aux(x, graph), nexts(node, graph)) } @@ -92,7 +92,7 @@ let unsafe_topsort = graph => { let visited = ref(list{}) let rec sort_nodes = nodes => List.iter(node => sort_node(node), nodes) and sort_node = node => - if \"@@"(not, List.mem(node, visited.contents)) { + if not(List.mem(node, visited.contents)) { /* This check does not prevent cycle , but it is still necessary? yes! since a node can have multiple parents @@ -128,7 +128,7 @@ let pathsort = graph => { raise (Cycle (node::stack)) in */ let rec sort_nodes = (path, nodes) => List.iter(node => sort_node(path, node), nodes) and sort_node = (path, node) => - if \"@@"(not, List.mem(node, visited.contents)) { + if not(List.mem(node, visited.contents)) { /* check node path ; */ sort_nodes(\"+>"(node, path), nexts(node, graph)) /* different from dfs, recorded after its @@ -144,7 +144,7 @@ let pathsort = graph => { let () = assert (pathsort(grwork) == list{"wake", "shower", "dress", "eat", "washup", "go"}) let () = try { - \"@@"(ignore, pathsort(list{("go", "eat"), ...grwork})) + ignore(pathsort(list{("go", "eat"), ...grwork})) assert(false) } catch { | Cycle(list{"go", "washup", "eat", "go"}) => () 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 d0c893c335..68a154498e 100644 --- a/jscomp/test/uncurried_cast.js +++ b/jscomp/test/uncurried_cast.js @@ -1,7 +1,6 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; -let Curry = require("../../lib/js/curry.js"); let Belt_List = require("../../lib/js/belt_List.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); @@ -9,7 +8,9 @@ function raise(e) { throw e; } -let map = Belt_List.mapU; +function map(l, f) { + return Belt_List.mapU(l, f); +} let List = { map: map @@ -22,7 +23,7 @@ let Uncurried = { let E = /* @__PURE__ */Caml_exceptions.create("Uncurried_cast.E"); -function testRaise(param) { +function testRaise() { throw { RE_EXN_ID: E, Error: new Error() @@ -39,42 +40,16 @@ let l = Belt_List.mapU({ return x + 1 | 0; })); -let partial_arg = { - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } -}; - -function partial(param) { - return map(partial_arg, param); -} - -let ll = partial(function (x) { - return x + 1 | 0; -}); - function withOpts(xOpt, y, zOpt, w) { let x = xOpt !== undefined ? xOpt : 3; let z = zOpt !== undefined ? zOpt : 4; return ((x + y | 0) + z | 0) + w | 0; } -function still2Args(param, param$1) { - return withOpts(undefined, 4, param, param$1); -} - -let anInt = Curry._1(still2Args, 3)(5); - let StandardNotation = { testRaise: testRaise, l: l, - partial: partial, - ll: ll, - withOpts: withOpts, - still2Args: still2Args, - anInt: anInt + withOpts: withOpts }; function testRaise$1() { @@ -94,46 +69,16 @@ let l$1 = Belt_List.mapU({ return x + 1 | 0; })); -let partial_arg$1 = { - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } -}; - -function partial$1(param) { - return map(partial_arg$1, param); -} - -let ll$1 = partial$1(function (x) { - return x + 1 | 0; -}); - function withOpts$1(xOpt, y, zOpt, w) { let x = xOpt !== undefined ? xOpt : 3; let z = zOpt !== undefined ? zOpt : 4; return ((x + y | 0) + z | 0) + w | 0; } -function still2Args$1(param, param$1) { - return withOpts$1(undefined, 4, param, param$1); -} - -let partial_arg$2 = 3; - -let anInt$1 = (function (param) { - return still2Args$1(partial_arg$2, param); -})(5); - exports.Uncurried = Uncurried; exports.E = E; exports.StandardNotation = StandardNotation; exports.testRaise = testRaise$1; exports.l = l$1; -exports.partial = partial$1; -exports.ll = ll$1; exports.withOpts = withOpts$1; -exports.still2Args = still2Args$1; -exports.anInt = anInt$1; /* l Not a pure module */ diff --git a/jscomp/test/uncurried_cast.res b/jscomp/test/uncurried_cast.res index 4a4684ffd7..3d61288ae5 100644 --- a/jscomp/test/uncurried_cast.res +++ b/jscomp/test/uncurried_cast.res @@ -1,8 +1,8 @@ module Uncurried = { - let raise = (. e) => raise(e) + let raise = (e) => raise(e) module List = { - let map = (. l, f) => Belt.List.mapU(l, f) + let map = (l, f) => Belt.List.mapU(l, f) } } @@ -13,14 +13,10 @@ module StandardNotation = { let testRaise = () => raise(E) - let l = List.map(.list{1, 2}, (. x) => x + 1) - let partial = List.map(list{1, 2}) - let ll = partial((. x) => x + 1) + let l = List.map(list{1, 2}, (x) => x + 1) - let withOpts = (. ~x=3, y, ~z=4, w) => x + y + z + w - type unc2 = (. ~z: int=?, int) => int - let still2Args : unc2 = withOpts(4) - let anInt = still2Args(~z=3)(. 5) + let withOpts = (~x=3, y, ~z=4, w) => x + y + z + w + type unc2 = (~z: int=?, int) => int } @@uncurried.swap @@ -30,10 +26,5 @@ open Uncurried let testRaise = () => raise(E) let l = List.map(list{1, 2}, x => x + 1) -let partial = List.map(. list{1, 2}) -let ll = partial(.x => x + 1) - let withOpts = (~x=3, y, ~z=4, w) => x + y + z + w type unc2 = (~z: int=?, int) => int -let still2Args : unc2 = withOpts(. 4) -let anInt = still2Args(. ~z=3)(5) diff --git a/jscomp/test/uncurried_default.args.js b/jscomp/test/uncurried_default.args.js index 523750380f..a6f1eae777 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; @@ -13,95 +12,10 @@ function withOpt(xOpt, y) { let testWithOpt = withOpt(undefined, 3)(undefined, 4); -let partial_arg = 10; - -let partial = Curry._1((function (param) { - return withOpt(partial_arg, param); -})(3), 4)(11); +let partial = withOpt(10, 3)(4, 11); let total = withOpt(10, 3)(4, 11); -function foo1(xOpt, y) { - let x = xOpt !== undefined ? xOpt : 3; - return x + y | 0; -} - -let x = 3; - -let r1 = x + 11 | 0; - -function foo2(y, xOpt, zOpt) { - let x = xOpt !== undefined ? xOpt : 3; - let z = zOpt !== undefined ? zOpt : 4; - return (x + y | 0) + z | 0; -} - -let r2 = foo2(11, undefined, undefined); - -function foo3(xOpt, yOpt) { - let x = xOpt !== undefined ? xOpt : 3; - let y = yOpt !== undefined ? yOpt : 4; - return x + y | 0; -} - -let r3 = foo3(undefined, undefined); - -let StandardNotation = { - withOpt: withOpt, - testWithOpt: testWithOpt, - partial: partial, - total: total, - foo1: foo1, - r1: r1, - foo2: foo2, - r2: r2, - foo3: foo3, - r3: r3 -}; - -function withOpt$1(xOpt, y) { - let x = xOpt !== undefined ? xOpt : 1; - 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 partial_arg$1 = 10; - -let partial$1 = Curry._1((function (param) { - return withOpt$1(partial_arg$1, param); -})(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; -} - -let x$1 = 3; - -let r1$1 = x$1 + 11 | 0; - -function foo2$1(y, xOpt, zOpt) { - let x = xOpt !== undefined ? xOpt : 3; - let z = zOpt !== undefined ? zOpt : 4; - return (x + y | 0) + z | 0; -} - -let r2$1 = foo2$1(11, undefined, undefined); - -function foo3$1(xOpt, yOpt) { - let x = xOpt !== undefined ? xOpt : 3; - let y = yOpt !== undefined ? yOpt : 4; - return x + y | 0; -} - -let r3$1 = foo3$1(undefined, undefined); - function foo(func) { return func() + 1 | 0; } @@ -110,16 +24,9 @@ let M = { foo: foo }; -exports.StandardNotation = StandardNotation; -exports.withOpt = withOpt$1; -exports.testWithOpt = testWithOpt$1; -exports.partial = partial$1; -exports.total = total$1; -exports.foo1 = foo1$1; -exports.r1 = r1$1; -exports.foo2 = foo2$1; -exports.r2 = r2$1; -exports.foo3 = foo3$1; -exports.r3 = r3$1; +exports.withOpt = withOpt; +exports.testWithOpt = testWithOpt; +exports.partial = partial; +exports.total = total; exports.M = M; /* testWithOpt Not a pure module */ diff --git a/jscomp/test/uncurried_default.args.res b/jscomp/test/uncurried_default.args.res index 386e4269c9..6347cd51f6 100644 --- a/jscomp/test/uncurried_default.args.res +++ b/jscomp/test/uncurried_default.args.res @@ -1,36 +1,7 @@ -module StandardNotation = { - let withOpt = (. ~x=1, y) => (. ~z=1, w) => x+y+z+w - let testWithOpt = withOpt(. 3)(. 4) - let partial = withOpt(~x=10)(3)(~z=4)(11) - let total = withOpt(. ~x=10, 3)(. ~z=4, 11) - - let foo1 = (. ~x=3, ~y) => x+y - let r1 = foo1(. ~y=11) - - let foo2 = (. ~y, ~x=3, ~z=4) => x+y+z - let r2 = foo2(. ~y=11) - - let foo3 = (. ~x=3, ~y=4) => x+y - let r3 = foo3(. ) -} - -@@uncurried.swap - -open StandardNotation - let withOpt = (~x=1, y) => (~z=1, w) => x+y+z+w let testWithOpt = withOpt(3)(4) -let partial = withOpt(. ~x=10)(. 3)(. ~z=4)(. 11) -let total = withOpt(~x=10, 3)(~z=4, 11) - -let foo1 = (~x=3, ~y) => x+y -let r1 = foo1(~y=11) - -let foo2 = (~y, ~x=3, ~z=4) => x+y+z -let r2 = foo2(~y=11) - -let foo3 = (~x=3, ~y=4) => x+y -let r3 = foo3() +let partial = withOpt(~x=10, 3)(~z=4, 11) +let total = withOpt(. ~x=10, 3)(. ~z=4, 11) module M: { let foo: (unit => int) => int 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..f0e9d4a747 100644 --- a/jscomp/test/unsafe_ppx_test.js +++ b/jscomp/test/unsafe_ppx_test.js @@ -2,7 +2,6 @@ '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"); @@ -25,7 +24,7 @@ function g(a) { }); let regression2 = Math.max; regression(a, Pervasives.failwith); - Curry._2(regression2, 3, 2); + 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/unsafe_ppx_test.res b/jscomp/test/unsafe_ppx_test.res index 2b4b48eaf6..8f0c45139f 100644 --- a/jscomp/test/unsafe_ppx_test.res +++ b/jscomp/test/unsafe_ppx_test.res @@ -20,10 +20,10 @@ let g = a => { }`) let regression2: (float, float) => float = %raw("Math.max") - \"@@"(ignore, regression(a, failwith)) - \"@@"(ignore, regression2(3., 2.)) - \"@@"(ignore, regression3(. 3., 2.)) - \"@@"(ignore, regression4(.3., (. x) => x)) + ignore(regression(a, failwith)) + ignore(regression2(3., 2.)) + ignore(regression3(. 3., 2.)) + ignore(regression4(.3., (. x) => x)) } let max2: (. float, float) => float = %raw("Math.max") 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 b9db735100..5c7c413771 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"); @@ -114,7 +113,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 b5c460e74f..2b4f147d0a 100644 --- a/lib/es6/arg.js +++ b/lib/es6/arg.js @@ -4,7 +4,6 @@ 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"; @@ -58,7 +57,7 @@ function make_symlist(prefix, sep, suffix, l) { } } -function help_action(param) { +function help_action() { throw { RE_EXN_ID: Stop, _1: { @@ -121,18 +120,18 @@ function add_help(speclist) { function usage_b(buf, speclist, errmsg) { $$Buffer.add_string(buf, errmsg + "\n"); - List.iter((function (param) { - let doc = param[2]; + List.iter((function (l) { + let doc = l[2]; if (doc.length === 0) { return; } - let spec = param[1]; - let key = param[0]; + let spec = l[1]; + let key = l[0]; if (spec.TAG !== "Symbol") { return $$Buffer.add_string(buf, " " + key + " " + doc + "\n"); } let sym = make_symlist("{", "|", "}", spec._0); - return $$Buffer.add_string(buf, " " + key + " " + sym + doc + "\n"); + $$Buffer.add_string(buf, " " + key + " " + sym + doc + "\n"); }), add_help(speclist)); } @@ -276,7 +275,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; } @@ -291,7 +290,7 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist Error: new Error() }; }; - let get_arg = function (param) { + let get_arg = function () { if (follow !== undefined) { return follow; } @@ -307,7 +306,7 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist Error: new Error() }; }; - let consume_arg = function (param) { + let consume_arg = function () { if (follow !== undefined) { return; } else { @@ -318,12 +317,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 { RE_EXN_ID: Stop, @@ -347,7 +346,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(); @@ -356,7 +355,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 { RE_EXN_ID: Stop, @@ -392,7 +391,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 { RE_EXN_ID: Stop, @@ -430,7 +429,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 { @@ -446,7 +445,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; @@ -459,7 +458,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); @@ -479,7 +478,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){ @@ -654,14 +653,14 @@ function align(limitOpt, speclist) { let completed = add_help(speclist); let len = List.fold_left(max_arg_len, 0, completed); let len$1 = len < limit ? len : limit; - return List.map((function (param) { - let spec = param[1]; - let kwd = param[0]; - if (param[2] === "") { - return param; + return List.map((function (l) { + let spec = l[1]; + let kwd = l[0]; + if (l[2] === "") { + return l; } if (spec.TAG === "Symbol") { - let msg = param[2]; + let msg = l[2]; let cutcol = second_word(msg); let spaces = " ".repeat(Caml.int_max(0, len$1 - cutcol | 0) + 3 | 0); return [ @@ -670,7 +669,7 @@ function align(limitOpt, speclist) { "\n" + (spaces + replace_leading_tab(msg)) ]; } - let msg$1 = param[2]; + let msg$1 = l[2]; let cutcol$1 = second_word(msg$1); let kwd_len = kwd.length; let diff = (len$1 - kwd_len | 0) - cutcol$1 | 0; diff --git a/lib/es6/array.js b/lib/es6/array.js index abb2a612f5..848714c6a1 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"; @@ -21,9 +20,9 @@ function init(l, f) { Error: new Error() }; } - 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; } @@ -57,14 +56,14 @@ function append(a1, a2) { } function sub(a, ofs, len) { - if (ofs < 0 || len < 0 || ofs > (a.length - len | 0)) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Array.sub", - Error: new Error() - }; + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Array.sub", + Error: new Error() + }; } function fill(a, ofs, len, v) { @@ -81,19 +80,19 @@ 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 { - RE_EXN_ID: "Invalid_argument", - _1: "Array.blit", - Error: new Error() - }; + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Array.blit", + Error: new Error() + }; } function iter(f, a) { for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ - Curry._1(f, a[i]); + f(a[i]); } } @@ -106,7 +105,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]); } } @@ -115,9 +114,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; } @@ -135,16 +134,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]); } } @@ -153,9 +152,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; } @@ -214,7 +213,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; } @@ -222,7 +221,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; } @@ -235,7 +234,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; @@ -251,7 +250,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; @@ -298,15 +297,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) { @@ -324,7 +323,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)); @@ -374,7 +373,7 @@ function sort(cmp, a) { Error: new Error() }; } - 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)); @@ -417,7 +416,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) { @@ -443,7 +442,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 f1fcbfed7e..7a818267dc 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"; @@ -21,9 +20,9 @@ function init(l, f) { Error: new Error() }; } - 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; } @@ -57,14 +56,14 @@ function append(a1, a2) { } function sub(a, ofs, len) { - if (ofs < 0 || len < 0 || ofs > (a.length - len | 0)) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Array.sub", - Error: new Error() - }; + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Array.sub", + Error: new Error() + }; } function fill(a, ofs, len, v) { @@ -81,19 +80,19 @@ 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 { - RE_EXN_ID: "Invalid_argument", - _1: "Array.blit", - Error: new Error() - }; + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Array.blit", + Error: new Error() + }; } function iter(f, a) { for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ - Curry._1(f, a[i]); + f(a[i]); } } @@ -106,7 +105,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]); } } @@ -115,9 +114,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; } @@ -135,16 +134,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]); } } @@ -153,9 +152,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; } @@ -214,7 +213,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; } @@ -222,7 +221,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; } @@ -235,7 +234,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; @@ -251,7 +250,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; @@ -298,15 +297,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) { @@ -324,7 +323,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)); @@ -374,7 +373,7 @@ function sort(cmp, a) { Error: new Error() }; } - 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)); @@ -417,7 +416,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) { @@ -443,7 +442,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 8e0ca501cb..c9ebd57ecd 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 Js_math from "./js_math.js"; import * as Caml_option from "./caml_option.js"; @@ -110,7 +109,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) { @@ -120,7 +121,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) { @@ -176,7 +179,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) { @@ -291,7 +296,9 @@ function forEachU(a, f) { } function forEach(a, f) { - forEachU(a, Curry.__1(f)); + forEachU(a, (function (a) { + f(a); + })); } function mapU(a, f) { @@ -304,7 +311,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) { @@ -312,7 +321,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) { @@ -330,7 +341,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) { @@ -348,7 +361,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) { @@ -368,7 +383,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) { @@ -388,7 +405,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) { @@ -409,7 +428,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) { @@ -419,7 +440,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) { @@ -432,7 +455,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) { @@ -444,7 +469,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) { @@ -456,7 +483,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) { @@ -469,7 +498,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) { @@ -481,7 +512,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) { @@ -501,7 +534,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) { @@ -521,7 +556,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) { @@ -543,7 +580,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) { @@ -563,7 +602,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) { @@ -577,7 +618,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) { @@ -605,7 +648,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) { @@ -633,7 +678,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) { @@ -672,7 +719,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) { @@ -684,7 +733,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 888b61b2ab..926592fb82 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"; @@ -523,7 +522,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) { @@ -542,7 +543,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) { @@ -558,7 +561,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) { @@ -584,7 +589,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) { @@ -758,7 +765,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) { @@ -774,7 +783,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) { @@ -794,7 +805,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) { @@ -811,7 +824,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) { @@ -832,7 +847,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) { @@ -854,7 +871,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) { @@ -882,7 +901,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) { @@ -903,7 +924,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) { @@ -925,7 +948,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) { @@ -946,7 +971,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) { @@ -964,7 +991,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) { @@ -982,7 +1011,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) { @@ -1005,7 +1036,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) { @@ -1053,7 +1086,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) { @@ -1080,7 +1115,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) { @@ -1103,7 +1140,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) { @@ -1121,7 +1160,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) { @@ -1140,7 +1181,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) { @@ -1158,7 +1201,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) { @@ -1183,7 +1228,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) { @@ -1226,7 +1273,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) { @@ -1236,7 +1285,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) { @@ -1255,7 +1306,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) { @@ -1280,7 +1333,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) { @@ -1309,7 +1364,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) { @@ -1334,7 +1391,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) { @@ -1369,7 +1428,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 046f2e155c..a0773e3a24 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, @@ -175,7 +174,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) { @@ -200,7 +201,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) { @@ -220,7 +223,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 5b84c6d20e..5195786c5a 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) { @@ -44,7 +47,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) { @@ -55,7 +60,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) { @@ -66,7 +73,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) { @@ -106,7 +115,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) { @@ -124,7 +135,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 1d6f823624..cba34cf036 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") { @@ -21,7 +20,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) { @@ -39,7 +40,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) { @@ -54,7 +57,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) { @@ -96,7 +101,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) { @@ -114,7 +121,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 7c3ed870c4..3db293a48f 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) { @@ -553,7 +562,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) { @@ -567,7 +578,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) { @@ -593,7 +606,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 1b58f322b7..11421d0adf 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) { @@ -817,7 +836,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) { @@ -850,7 +871,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 29491a4b1e..fe16cd20d1 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"; @@ -209,7 +208,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) { @@ -251,7 +252,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) { @@ -286,7 +289,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 519c56a02b..ace4eabac3 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"; @@ -209,7 +208,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) { @@ -251,7 +252,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) { @@ -286,7 +289,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 4740941e82..ec9db9354d 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,36 +25,36 @@ function to_bytes(b) { } function sub(b, ofs, len) { - if (ofs < 0 || len < 0 || ofs > (b.position - len | 0)) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Buffer.sub", - Error: new Error() - }; + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.sub", + Error: new Error() + }; } 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 { - RE_EXN_ID: "Invalid_argument", - _1: "Buffer.blit", - Error: new Error() - }; + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.blit", + Error: new Error() + }; } function nth(b, ofs) { - if (ofs < 0 || ofs >= b.position) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Buffer.nth", - Error: new Error() - }; + if (!(ofs < 0 || ofs >= b.position)) { + return b.buffer[ofs]; } - return b.buffer[ofs]; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.nth", + Error: new Error() + }; } function length(b) { @@ -434,7 +433,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; @@ -442,14 +441,15 @@ function add_substitute(b, f, s) { } function truncate(b, len) { - if (len < 0 || len > b.position) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Buffer.truncate", - Error: new Error() - }; + if (!(len < 0 || len > b.position)) { + b.position = len; + return; } - b.position = len; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.truncate", + Error: new Error() + }; } export { diff --git a/lib/es6/bytes.js b/lib/es6/bytes.js index bc4e0d72a4..d4e6d977e6 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; } @@ -147,14 +146,14 @@ function $plus$plus(a, b) { if (match$1) { return c; } - if (match$2) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.extend", - Error: new Error() - }; + if (!match$2) { + return c; } - return c; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.extend", + Error: new Error() + }; } function extend(s, left, right) { @@ -177,62 +176,63 @@ function extend(s, left, right) { } function fill(s, ofs, len, c) { - if (ofs < 0 || len < 0 || ofs > (s.length - len | 0)) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.fill / Bytes.fill", - Error: new Error() - }; + if (!(ofs < 0 || len < 0 || ofs > (s.length - len | 0))) { + return unsafe_fill(s, ofs, len, c); } - unsafe_fill(s, ofs, len, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.fill / Bytes.fill", + Error: new Error() + }; } 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 { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.blit", - Error: new Error() - }; + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.blit", + Error: new Error() + }; } 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 { - RE_EXN_ID: "Invalid_argument", - _1: "String.blit / Bytes.blit_string", - Error: new Error() - }; - } - 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 { + RE_EXN_ID: "Invalid_argument", + _1: "String.blit / Bytes.blit_string", + Error: new Error() + }; } 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]); } } @@ -439,7 +439,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; } @@ -451,7 +451,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; } @@ -469,7 +469,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; } @@ -522,26 +522,26 @@ function index_opt(s, c) { function index_from(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from / Bytes.index_from", - Error: new Error() - }; + if (!(i < 0 || i > l)) { + return index_rec(s, l, i, c); } - return index_rec(s, l, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from", + Error: new Error() + }; } function index_from_opt(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from_opt / Bytes.index_from_opt", - Error: new Error() - }; + if (!(i < 0 || i > l)) { + return index_rec_opt(s, l, i, c); } - return index_rec_opt(s, l, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt", + Error: new Error() + }; } function rindex_rec(s, _i, c) { @@ -566,14 +566,14 @@ function rindex(s, c) { } function rindex_from(s, i, c) { - if (i < -1 || i >= s.length) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from / Bytes.rindex_from", - Error: new Error() - }; + if (!(i < -1 || i >= s.length)) { + return rindex_rec(s, i, c); } - return rindex_rec(s, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from", + Error: new Error() + }; } function rindex_rec_opt(s, _i, c) { @@ -595,14 +595,14 @@ function rindex_opt(s, c) { } function rindex_from_opt(s, i, c) { - if (i < -1 || i >= s.length) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from_opt / Bytes.rindex_from_opt", - Error: new Error() - }; + if (!(i < -1 || i >= s.length)) { + return rindex_rec_opt(s, i, c); } - return rindex_rec_opt(s, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt", + Error: new Error() + }; } function contains_from(s, i, c) { diff --git a/lib/es6/bytesLabels.js b/lib/es6/bytesLabels.js index bc4e0d72a4..d4e6d977e6 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; } @@ -147,14 +146,14 @@ function $plus$plus(a, b) { if (match$1) { return c; } - if (match$2) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.extend", - Error: new Error() - }; + if (!match$2) { + return c; } - return c; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.extend", + Error: new Error() + }; } function extend(s, left, right) { @@ -177,62 +176,63 @@ function extend(s, left, right) { } function fill(s, ofs, len, c) { - if (ofs < 0 || len < 0 || ofs > (s.length - len | 0)) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.fill / Bytes.fill", - Error: new Error() - }; + if (!(ofs < 0 || len < 0 || ofs > (s.length - len | 0))) { + return unsafe_fill(s, ofs, len, c); } - unsafe_fill(s, ofs, len, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.fill / Bytes.fill", + Error: new Error() + }; } 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 { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.blit", - Error: new Error() - }; + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.blit", + Error: new Error() + }; } 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 { - RE_EXN_ID: "Invalid_argument", - _1: "String.blit / Bytes.blit_string", - Error: new Error() - }; - } - 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 { + RE_EXN_ID: "Invalid_argument", + _1: "String.blit / Bytes.blit_string", + Error: new Error() + }; } 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]); } } @@ -439,7 +439,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; } @@ -451,7 +451,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; } @@ -469,7 +469,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; } @@ -522,26 +522,26 @@ function index_opt(s, c) { function index_from(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from / Bytes.index_from", - Error: new Error() - }; + if (!(i < 0 || i > l)) { + return index_rec(s, l, i, c); } - return index_rec(s, l, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from", + Error: new Error() + }; } function index_from_opt(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from_opt / Bytes.index_from_opt", - Error: new Error() - }; + if (!(i < 0 || i > l)) { + return index_rec_opt(s, l, i, c); } - return index_rec_opt(s, l, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt", + Error: new Error() + }; } function rindex_rec(s, _i, c) { @@ -566,14 +566,14 @@ function rindex(s, c) { } function rindex_from(s, i, c) { - if (i < -1 || i >= s.length) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from / Bytes.rindex_from", - Error: new Error() - }; + if (!(i < -1 || i >= s.length)) { + return rindex_rec(s, i, c); } - return rindex_rec(s, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from", + Error: new Error() + }; } function rindex_rec_opt(s, _i, c) { @@ -595,14 +595,14 @@ function rindex_opt(s, c) { } function rindex_from_opt(s, i, c) { - if (i < -1 || i >= s.length) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from_opt / Bytes.rindex_from_opt", - Error: new Error() - }; + if (!(i < -1 || i >= s.length)) { + return rindex_rec_opt(s, i, c); } - return rindex_rec_opt(s, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt", + Error: new Error() + }; } 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_obj.js b/lib/es6/caml_obj.js index 0e56757bd4..7c577e4a6c 100644 --- a/lib/es6/caml_obj.js +++ b/lib/es6/caml_obj.js @@ -225,21 +225,19 @@ function aux_obj_compare(a, b) { return; } }; - let partial_arg = [ - a, - b, - min_key_rhs - ]; - let do_key_a = function (param) { - return do_key(partial_arg, param); + let do_key_a = function (key) { + do_key([ + a, + b, + min_key_rhs + ], key); }; - let partial_arg$1 = [ - b, - a, - min_key_lhs - ]; - let do_key_b = function (param) { - return do_key(partial_arg$1, param); + let do_key_b = function (key) { + do_key([ + b, + a, + min_key_lhs + ], key); }; for_in(a, do_key_a); for_in(b, do_key_b); diff --git a/lib/es6/caml_sys.js b/lib/es6/caml_sys.js index e898165039..864a14fabf 100644 --- a/lib/es6/caml_sys.js +++ b/lib/es6/caml_sys.js @@ -27,7 +27,7 @@ let os_type = (function(_){ } }); -function sys_time(param) { +function sys_time() { if (typeof process === "undefined" || process.uptime === undefined) { return -1; } else { @@ -42,7 +42,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 3851e7f014..efa431fdec 100644 --- a/lib/es6/char.js +++ b/lib/es6/char.js @@ -3,14 +3,14 @@ import * as Bytes from "./bytes.js"; function chr(n) { - if (n < 0 || n > 255) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Char.chr", - Error: new Error() - }; + if (!(n < 0 || n > 255)) { + return n; } - return n; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Char.chr", + Error: new Error() + }; } function escaped(param) { diff --git a/lib/es6/curry.js b/lib/es6/curry.js index 6ce524794b..ef86cd689d 100644 --- a/lib/es6/curry.js +++ b/lib/es6/curry.js @@ -33,29 +33,29 @@ function _1(o, a0) { case 1 : return o(a0); case 2 : - return function (param) { - return o(a0, param); - }; + return (function (prim0, prim1, prim2) { + return prim0(prim1, prim2); + })(o, a0); case 3 : - return function (param, param$1) { - return o(a0, param, param$1); - }; + return (function (prim0, prim1, prim2, prim3) { + return prim0(prim1, prim2, prim3); + })(o, a0); case 4 : - return function (param, param$1, param$2) { - return o(a0, param, param$1, param$2); - }; + return (function (prim0, prim1, prim2, prim3, prim4) { + return prim0(prim1, prim2, prim3, prim4); + })(o, a0); case 5 : - return function (param, param$1, param$2, param$3) { - return o(a0, param, param$1, param$2, param$3); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5) { + return prim0(prim1, prim2, prim3, prim4, prim5); + })(o, a0); case 6 : - return function (param, param$1, param$2, param$3, param$4) { - return o(a0, param, param$1, param$2, param$3, param$4); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5, prim6) { + return prim0(prim1, prim2, prim3, prim4, prim5, prim6); + })(o, a0); case 7 : - return function (param, param$1, param$2, param$3, param$4, param$5) { - return o(a0, param, param$1, param$2, param$3, param$4, param$5); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5, prim6, prim7) { + return prim0(prim1, prim2, prim3, prim4, prim5, prim6, prim7); + })(o, a0); default: return app(o, [a0]); } @@ -84,25 +84,25 @@ function _2(o, a0, a1) { case 2 : return o(a0, a1); case 3 : - return function (param) { - return o(a0, a1, param); - }; + return (function (prim0, prim1, prim2, prim3) { + return prim0(prim1, prim2, prim3); + })(o, a0, a1); case 4 : - return function (param, param$1) { - return o(a0, a1, param, param$1); - }; + return (function (prim0, prim1, prim2, prim3, prim4) { + return prim0(prim1, prim2, prim3, prim4); + })(o, a0, a1); case 5 : - return function (param, param$1, param$2) { - return o(a0, a1, param, param$1, param$2); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5) { + return prim0(prim1, prim2, prim3, prim4, prim5); + })(o, a0, a1); case 6 : - return function (param, param$1, param$2, param$3) { - return o(a0, a1, param, param$1, param$2, param$3); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5, prim6) { + return prim0(prim1, prim2, prim3, prim4, prim5, prim6); + })(o, a0, a1); case 7 : - return function (param, param$1, param$2, param$3, param$4) { - return o(a0, a1, param, param$1, param$2, param$3, param$4); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5, prim6, prim7) { + return prim0(prim1, prim2, prim3, prim4, prim5, prim6, prim7); + })(o, a0, a1); default: return app(o, [ a0, @@ -139,21 +139,21 @@ function _3(o, a0, a1, a2) { case 3 : return o(a0, a1, a2); case 4 : - return function (param) { - return o(a0, a1, a2, param); - }; + return (function (prim0, prim1, prim2, prim3, prim4) { + return prim0(prim1, prim2, prim3, prim4); + })(o, a0, a1, a2); case 5 : - return function (param, param$1) { - return o(a0, a1, a2, param, param$1); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5) { + return prim0(prim1, prim2, prim3, prim4, prim5); + })(o, a0, a1, a2); case 6 : - return function (param, param$1, param$2) { - return o(a0, a1, a2, param, param$1, param$2); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5, prim6) { + return prim0(prim1, prim2, prim3, prim4, prim5, prim6); + })(o, a0, a1, a2); case 7 : - return function (param, param$1, param$2, param$3) { - return o(a0, a1, a2, param, param$1, param$2, param$3); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5, prim6, prim7) { + return prim0(prim1, prim2, prim3, prim4, prim5, prim6, prim7); + })(o, a0, a1, a2); default: return app(o, [ a0, @@ -197,17 +197,17 @@ function _4(o, a0, a1, a2, a3) { case 4 : return o(a0, a1, a2, a3); case 5 : - return function (param) { - return o(a0, a1, a2, a3, param); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5) { + return prim0(prim1, prim2, prim3, prim4, prim5); + })(o, a0, a1, a2, a3); case 6 : - return function (param, param$1) { - return o(a0, a1, a2, a3, param, param$1); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5, prim6) { + return prim0(prim1, prim2, prim3, prim4, prim5, prim6); + })(o, a0, a1, a2, a3); case 7 : - return function (param, param$1, param$2) { - return o(a0, a1, a2, a3, param, param$1, param$2); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5, prim6, prim7) { + return prim0(prim1, prim2, prim3, prim4, prim5, prim6, prim7); + })(o, a0, a1, a2, a3); default: return app(o, [ a0, @@ -259,13 +259,13 @@ function _5(o, a0, a1, a2, a3, a4) { case 5 : return o(a0, a1, a2, a3, a4); case 6 : - return function (param) { - return o(a0, a1, a2, a3, a4, param); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5, prim6) { + return prim0(prim1, prim2, prim3, prim4, prim5, prim6); + })(o, a0, a1, a2, a3, a4); case 7 : - return function (param, param$1) { - return o(a0, a1, a2, a3, a4, param, param$1); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5, prim6, prim7) { + return prim0(prim1, prim2, prim3, prim4, prim5, prim6, prim7); + })(o, a0, a1, a2, a3, a4); default: return app(o, [ a0, @@ -326,9 +326,9 @@ function _6(o, a0, a1, a2, a3, a4, a5) { case 6 : return o(a0, a1, a2, a3, a4, a5); case 7 : - return function (param) { - return o(a0, a1, a2, a3, a4, a5, param); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5, prim6, prim7) { + return prim0(prim1, prim2, prim3, prim4, prim5, prim6, prim7); + })(o, a0, a1, a2, a3, a4, a5); default: return app(o, [ a0, diff --git a/lib/es6/digest.js b/lib/es6/digest.js index ff4c201aec..68f01c21e8 100644 --- a/lib/es6/digest.js +++ b/lib/es6/digest.js @@ -16,14 +16,14 @@ function bytes(b) { } function substring(str, ofs, len) { - if (ofs < 0 || len < 0 || ofs > (str.length - len | 0)) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Digest.substring", - Error: new Error() - }; + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Digest.substring", + Error: new Error() + }; } function subbytes(b, ofs, len) { diff --git a/lib/es6/filename.js b/lib/es6/filename.js index 05a7cf1555..4a6b972d9d 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; @@ -129,28 +127,28 @@ catch (raw_exn){ } } -function quote(param) { +function quote(a) { let quotequote = "'\\''"; - let l = param.length; + let l = a.length; let b = $$Buffer.create(l + 20 | 0); $$Buffer.add_char(b, /* '\'' */39); for(let i = 0; i < l; ++i){ - if (Caml_string.get(param, i) === /* '\'' */39) { + if (Caml_string.get(a, i) === /* '\'' */39) { $$Buffer.add_string(b, quotequote); } else { - $$Buffer.add_char(b, Caml_string.get(param, i)); + $$Buffer.add_char(b, Caml_string.get(a, i)); } } $$Buffer.add_char(b, /* '\'' */39); return $$Buffer.contents(b); } -function basename(param) { - return generic_basename(is_dir_sep, current_dir_name, param); +function basename(a) { + return generic_basename(is_dir_sep, current_dir_name, a); } -function dirname(param) { - return generic_dirname(is_dir_sep, current_dir_name, param); +function dirname(a) { + return generic_dirname(is_dir_sep, current_dir_name, a); } let current_dir_name$1 = "."; @@ -193,7 +191,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; @@ -306,12 +304,12 @@ function basename$1(s) { let current_dir_name$2 = "."; -function basename$2(param) { - return generic_basename(is_dir_sep$1, current_dir_name$2, param); +function basename$2(a) { + return generic_basename(is_dir_sep$1, current_dir_name$2, a); } -function dirname$2(param) { - return generic_dirname(is_dir_sep$1, current_dir_name$2, param); +function dirname$2(a) { + return generic_dirname(is_dir_sep$1, current_dir_name$2, a); } let match; @@ -371,7 +369,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); @@ -380,28 +378,28 @@ function concat(dirname, filename) { function chop_suffix(name, suff) { let n = name.length - suff.length | 0; - if (n < 0) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Filename.chop_suffix", - Error: new Error() - }; + if (n >= 0) { + return $$String.sub(name, 0, n); } - return $$String.sub(name, 0, n); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Filename.chop_suffix", + Error: new Error() + }; } 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) { @@ -427,14 +425,14 @@ function extension(name) { function chop_extension(name) { let l = extension_len(name); - if (l === 0) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Filename.chop_extension", - Error: new Error() - }; + if (l !== 0) { + return $$String.sub(name, 0, name.length - l | 0); } - return $$String.sub(name, 0, name.length - l | 0); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Filename.chop_extension", + Error: new Error() + }; } function remove_extension(name) { @@ -454,7 +452,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 622b3627a4..ea09748a39 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,13 +35,13 @@ 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; } -function make_lexer(keywords) { +function make_lexer(keywords, input) { let kwd_table = Hashtbl.create(undefined, 17); List.iter((function (s) { Hashtbl.add(kwd_table, s, { @@ -100,8 +100,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(); @@ -165,11 +165,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 : @@ -180,7 +179,7 @@ function make_lexer(keywords) { case 55 : case 56 : case 57 : - exit = 4; + exit = 5; break; case 0 : case 1 : @@ -229,7 +228,7 @@ function make_lexer(keywords) { case 62 : case 63 : case 64 : - exit = 3; + exit = 4; break; } @@ -238,7 +237,7 @@ function make_lexer(keywords) { switch (c) { case 92 : case 94 : - exit = 3; + exit = 4; break; case 91 : case 93 : @@ -246,14 +245,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) { @@ -261,42 +260,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); @@ -308,80 +314,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 !== 124) { - return ident_or_keyword(get_string()); + } else if (c >= 65) { + if (c === 92) { + exit = 2; + } + + } 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) { @@ -417,6 +424,12 @@ function make_lexer(keywords) { }; }; } + if (exit === 2) { + Stream.junk(strm__); + store(/* 'E' */69); + return exponent_part(strm__); + } + } return { TAG: "Int", @@ -426,13 +439,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) { @@ -641,14 +656,12 @@ function make_lexer(keywords) { } }; }; - return function (input) { - return Stream.from(function (_count) { - return next_token(input); - }); - }; + return Stream.from(function (_count) { + return next_token(input); + }); } export { make_lexer, } -/* No side effect */ +/* Hashtbl Not a pure module */ diff --git a/lib/es6/hashtbl.js b/lib/es6/hashtbl.js index 635889677c..78bd671783 100644 --- a/lib/es6/hashtbl.js +++ b/lib/es6/hashtbl.js @@ -1,8 +1,8 @@ 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"; @@ -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(); }); @@ -177,7 +177,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); @@ -445,7 +445,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; }; @@ -489,7 +489,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); @@ -539,7 +539,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; }; @@ -601,7 +601,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); @@ -630,7 +630,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); @@ -655,7 +655,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") { @@ -667,7 +667,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") { @@ -679,7 +679,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; @@ -694,7 +694,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; @@ -710,7 +710,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") { @@ -719,7 +719,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") { @@ -728,7 +728,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; @@ -740,7 +740,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; @@ -758,7 +758,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) @@ -778,7 +778,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; @@ -815,7 +815,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; @@ -845,7 +845,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); @@ -874,7 +874,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); @@ -899,7 +899,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") { @@ -911,7 +911,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") { @@ -923,7 +923,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; @@ -938,7 +938,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; @@ -954,7 +954,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") { @@ -963,7 +963,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") { @@ -972,7 +972,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; @@ -984,7 +984,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; @@ -1002,7 +1002,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) @@ -1022,7 +1022,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; @@ -1059,7 +1059,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; @@ -1117,4 +1117,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 deleted file mode 100644 index 9a90149cb2..0000000000 --- a/lib/es6/js_array.js +++ /dev/null @@ -1,223 +0,0 @@ - - -import * as Curry from "./curry.js"; -import * as Caml_option from "./caml_option.js"; -import * as Caml_splice_call from "./caml_splice_call.js"; - -function copyWithin(to_, obj) { - return obj.copyWithin(to_); -} - -function copyWithinFrom(to_, from, obj) { - return obj.copyWithin(to_, from); -} - -function copyWithinFromRange(to_, start, end_, obj) { - return obj.copyWithin(to_, start, end_); -} - -function fillInPlace(arg1, obj) { - return obj.fill(arg1); -} - -function fillFromInPlace(arg1, from, obj) { - return obj.fill(arg1, from); -} - -function fillRangeInPlace(arg1, start, end_, obj) { - return obj.fill(arg1, start, end_); -} - -function push(arg1, obj) { - return obj.push(arg1); -} - -function pushMany(arg1, obj) { - return Caml_splice_call.spliceObjApply(obj, "push", [arg1]); -} - -function sortInPlaceWith(arg1, obj) { - return obj.sort(Curry.__2(arg1)); -} - -function spliceInPlace(pos, remove, add, obj) { - return Caml_splice_call.spliceObjApply(obj, "splice", [ - pos, - remove, - add - ]); -} - -function removeFromInPlace(pos, obj) { - return obj.splice(pos); -} - -function removeCountInPlace(pos, count, obj) { - return obj.splice(pos, count); -} - -function unshift(arg1, obj) { - return obj.unshift(arg1); -} - -function unshiftMany(arg1, obj) { - return Caml_splice_call.spliceObjApply(obj, "unshift", [arg1]); -} - -function concat(arg1, obj) { - return obj.concat(arg1); -} - -function concatMany(arg1, obj) { - return Caml_splice_call.spliceObjApply(obj, "concat", [arg1]); -} - -function includes(arg1, obj) { - return obj.includes(arg1); -} - -function indexOf(arg1, obj) { - return obj.indexOf(arg1); -} - -function indexOfFrom(arg1, from, obj) { - return obj.indexOf(arg1, from); -} - -function joinWith(arg1, obj) { - return obj.join(arg1); -} - -function lastIndexOf(arg1, obj) { - return obj.lastIndexOf(arg1); -} - -function lastIndexOfFrom(arg1, from, obj) { - return obj.lastIndexOf(arg1, from); -} - -function slice(start, end_, obj) { - return obj.slice(start, end_); -} - -function sliceFrom(arg1, obj) { - return obj.slice(arg1); -} - -function every(arg1, obj) { - return obj.every(Curry.__1(arg1)); -} - -function everyi(arg1, obj) { - return obj.every(Curry.__2(arg1)); -} - -function filter(arg1, obj) { - return obj.filter(Curry.__1(arg1)); -} - -function filteri(arg1, obj) { - return obj.filter(Curry.__2(arg1)); -} - -function find(arg1, obj) { - return Caml_option.undefined_to_opt(obj.find(Curry.__1(arg1))); -} - -function findi(arg1, obj) { - return Caml_option.undefined_to_opt(obj.find(Curry.__2(arg1))); -} - -function findIndex(arg1, obj) { - return obj.findIndex(Curry.__1(arg1)); -} - -function findIndexi(arg1, obj) { - return obj.findIndex(Curry.__2(arg1)); -} - -function forEach(arg1, obj) { - obj.forEach(Curry.__1(arg1)); -} - -function forEachi(arg1, obj) { - obj.forEach(Curry.__2(arg1)); -} - -function map(arg1, obj) { - return obj.map(Curry.__1(arg1)); -} - -function mapi(arg1, obj) { - return obj.map(Curry.__2(arg1)); -} - -function reduce(arg1, arg2, obj) { - return obj.reduce(Curry.__2(arg1), arg2); -} - -function reducei(arg1, arg2, obj) { - return obj.reduce(Curry.__3(arg1), arg2); -} - -function reduceRight(arg1, arg2, obj) { - return obj.reduceRight(Curry.__2(arg1), arg2); -} - -function reduceRighti(arg1, arg2, obj) { - return obj.reduceRight(Curry.__3(arg1), arg2); -} - -function some(arg1, obj) { - return obj.some(Curry.__1(arg1)); -} - -function somei(arg1, obj) { - return obj.some(Curry.__2(arg1)); -} - -export { - copyWithin, - copyWithinFrom, - copyWithinFromRange, - fillInPlace, - fillFromInPlace, - fillRangeInPlace, - push, - pushMany, - sortInPlaceWith, - spliceInPlace, - removeFromInPlace, - removeCountInPlace, - unshift, - unshiftMany, - concat, - concatMany, - includes, - indexOf, - indexOfFrom, - joinWith, - lastIndexOf, - lastIndexOfFrom, - slice, - sliceFrom, - every, - everyi, - filter, - filteri, - find, - findi, - findIndex, - findIndexi, - forEach, - forEachi, - map, - mapi, - reduce, - reducei, - reduceRight, - reduceRighti, - some, - somei, -} -/* No side effect */ 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/es6/js_string.js b/lib/es6/js_string.js deleted file mode 100644 index 22c26408bb..0000000000 --- a/lib/es6/js_string.js +++ /dev/null @@ -1,199 +0,0 @@ - - -import * as Curry from "./curry.js"; -import * as Caml_option from "./caml_option.js"; -import * as Caml_splice_call from "./caml_splice_call.js"; - -function charAt(arg1, obj) { - return obj.charAt(arg1); -} - -function charCodeAt(arg1, obj) { - return obj.charCodeAt(arg1); -} - -function codePointAt(arg1, obj) { - return obj.codePointAt(arg1); -} - -function concat(arg1, obj) { - return obj.concat(arg1); -} - -function concatMany(arg1, obj) { - return Caml_splice_call.spliceObjApply(obj, "concat", [arg1]); -} - -function endsWith(arg1, obj) { - return obj.endsWith(arg1); -} - -function endsWithFrom(arg1, arg2, obj) { - return obj.endsWith(arg1, arg2); -} - -function includes(arg1, obj) { - return obj.includes(arg1); -} - -function includesFrom(arg1, arg2, obj) { - return obj.includes(arg1, arg2); -} - -function indexOf(arg1, obj) { - return obj.indexOf(arg1); -} - -function indexOfFrom(arg1, arg2, obj) { - return obj.indexOf(arg1, arg2); -} - -function lastIndexOf(arg1, obj) { - return obj.lastIndexOf(arg1); -} - -function lastIndexOfFrom(arg1, arg2, obj) { - return obj.lastIndexOf(arg1, arg2); -} - -function localeCompare(arg1, obj) { - return obj.localeCompare(arg1); -} - -function match_(arg1, obj) { - return Caml_option.null_to_opt(obj.match(arg1)); -} - -function normalizeByForm(arg1, obj) { - return obj.normalize(arg1); -} - -function repeat(arg1, obj) { - return obj.repeat(arg1); -} - -function replace(arg1, arg2, obj) { - return obj.replace(arg1, arg2); -} - -function replaceByRe(arg1, arg2, obj) { - return obj.replace(arg1, arg2); -} - -function unsafeReplaceBy0(arg1, arg2, obj) { - return obj.replace(arg1, Curry.__3(arg2)); -} - -function unsafeReplaceBy1(arg1, arg2, obj) { - return obj.replace(arg1, Curry.__4(arg2)); -} - -function unsafeReplaceBy2(arg1, arg2, obj) { - return obj.replace(arg1, Curry.__5(arg2)); -} - -function unsafeReplaceBy3(arg1, arg2, obj) { - return obj.replace(arg1, Curry.__6(arg2)); -} - -function search(arg1, obj) { - return obj.search(arg1); -} - -function slice(from, to_, obj) { - return obj.slice(from, to_); -} - -function sliceToEnd(from, obj) { - return obj.slice(from); -} - -function split(arg1, obj) { - return obj.split(arg1); -} - -function splitAtMost(arg1, limit, obj) { - return obj.split(arg1, limit); -} - -function splitByRe(arg1, obj) { - return obj.split(arg1); -} - -function splitByReAtMost(arg1, limit, obj) { - return obj.split(arg1, limit); -} - -function startsWith(arg1, obj) { - return obj.startsWith(arg1); -} - -function startsWithFrom(arg1, arg2, obj) { - return obj.startsWith(arg1, arg2); -} - -function substr(from, obj) { - return obj.substr(from); -} - -function substrAtMost(from, length, obj) { - return obj.substr(from, length); -} - -function substring(from, to_, obj) { - return obj.substring(from, to_); -} - -function substringToEnd(from, obj) { - return obj.substring(from); -} - -function anchor(arg1, obj) { - return obj.anchor(arg1); -} - -function link(arg1, obj) { - return obj.link(arg1); -} - -export { - charAt, - charCodeAt, - codePointAt, - concat, - concatMany, - endsWith, - endsWithFrom, - includes, - includesFrom, - indexOf, - indexOfFrom, - lastIndexOf, - lastIndexOfFrom, - localeCompare, - match_, - normalizeByForm, - repeat, - replace, - replaceByRe, - unsafeReplaceBy0, - unsafeReplaceBy1, - unsafeReplaceBy2, - unsafeReplaceBy3, - search, - slice, - sliceToEnd, - split, - splitAtMost, - splitByRe, - splitByReAtMost, - startsWith, - startsWithFrom, - substr, - substrAtMost, - substring, - substringToEnd, - anchor, - link, -} -/* No side effect */ diff --git a/lib/es6/js_typed_array.js b/lib/es6/js_typed_array.js deleted file mode 100644 index 3516646992..0000000000 --- a/lib/es6/js_typed_array.js +++ /dev/null @@ -1,1733 +0,0 @@ - - - -function slice(start, end_, obj) { - return obj.slice(start, end_); -} - -function sliceFrom(arg1, obj) { - return obj.slice(arg1); -} - -let $$ArrayBuffer = { - slice: slice, - sliceFrom: sliceFrom -}; - -function setArray(arg1, obj) { - obj.set(arg1); -} - -function setArrayOffset(arg1, arg2, obj) { - obj.set(arg1, arg2); -} - -function copyWithin(to_, obj) { - return obj.copyWithin(to_); -} - -function copyWithinFrom(to_, from, obj) { - return obj.copyWithin(to_, from); -} - -function copyWithinFromRange(to_, start, end_, obj) { - return obj.copyWithin(to_, start, end_); -} - -function fillInPlace(arg1, obj) { - return obj.fill(arg1); -} - -function fillFromInPlace(arg1, from, obj) { - return obj.fill(arg1, from); -} - -function fillRangeInPlace(arg1, start, end_, obj) { - return obj.fill(arg1, start, end_); -} - -function sortInPlaceWith(arg1, obj) { - return obj.sort(arg1); -} - -function includes(arg1, obj) { - return obj.includes(arg1); -} - -function indexOf(arg1, obj) { - return obj.indexOf(arg1); -} - -function indexOfFrom(arg1, from, obj) { - return obj.indexOf(arg1, from); -} - -function joinWith(arg1, obj) { - return obj.join(arg1); -} - -function lastIndexOf(arg1, obj) { - return obj.lastIndexOf(arg1); -} - -function lastIndexOfFrom(arg1, from, obj) { - return obj.lastIndexOf(arg1, from); -} - -function slice$1(start, end_, obj) { - return obj.slice(start, end_); -} - -function sliceFrom$1(arg1, obj) { - return obj.slice(arg1); -} - -function subarray(start, end_, obj) { - return obj.subarray(start, end_); -} - -function subarrayFrom(arg1, obj) { - return obj.subarray(arg1); -} - -function every(arg1, obj) { - return obj.every(arg1); -} - -function everyi(arg1, obj) { - return obj.every(arg1); -} - -function filter(arg1, obj) { - return obj.filter(arg1); -} - -function filteri(arg1, obj) { - return obj.filter(arg1); -} - -function find(arg1, obj) { - return obj.find(arg1); -} - -function findi(arg1, obj) { - return obj.find(arg1); -} - -function findIndex(arg1, obj) { - return obj.findIndex(arg1); -} - -function findIndexi(arg1, obj) { - return obj.findIndex(arg1); -} - -function forEach(arg1, obj) { - obj.forEach(arg1); -} - -function forEachi(arg1, obj) { - obj.forEach(arg1); -} - -function map(arg1, obj) { - return obj.map(arg1); -} - -function mapi(arg1, obj) { - return obj.map(arg1); -} - -function reduce(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reducei(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reduceRight(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function reduceRighti(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function some(arg1, obj) { - return obj.some(arg1); -} - -function somei(arg1, obj) { - return obj.some(arg1); -} - -let $$Int8Array = { - setArray: setArray, - setArrayOffset: setArrayOffset, - copyWithin: copyWithin, - copyWithinFrom: copyWithinFrom, - copyWithinFromRange: copyWithinFromRange, - fillInPlace: fillInPlace, - fillFromInPlace: fillFromInPlace, - fillRangeInPlace: fillRangeInPlace, - sortInPlaceWith: sortInPlaceWith, - includes: includes, - indexOf: indexOf, - indexOfFrom: indexOfFrom, - joinWith: joinWith, - lastIndexOf: lastIndexOf, - lastIndexOfFrom: lastIndexOfFrom, - slice: slice$1, - sliceFrom: sliceFrom$1, - subarray: subarray, - subarrayFrom: subarrayFrom, - every: every, - everyi: everyi, - filter: filter, - filteri: filteri, - find: find, - findi: findi, - findIndex: findIndex, - findIndexi: findIndexi, - forEach: forEach, - forEachi: forEachi, - map: map, - mapi: mapi, - reduce: reduce, - reducei: reducei, - reduceRight: reduceRight, - reduceRighti: reduceRighti, - some: some, - somei: somei -}; - -function setArray$1(arg1, obj) { - obj.set(arg1); -} - -function setArrayOffset$1(arg1, arg2, obj) { - obj.set(arg1, arg2); -} - -function copyWithin$1(to_, obj) { - return obj.copyWithin(to_); -} - -function copyWithinFrom$1(to_, from, obj) { - return obj.copyWithin(to_, from); -} - -function copyWithinFromRange$1(to_, start, end_, obj) { - return obj.copyWithin(to_, start, end_); -} - -function fillInPlace$1(arg1, obj) { - return obj.fill(arg1); -} - -function fillFromInPlace$1(arg1, from, obj) { - return obj.fill(arg1, from); -} - -function fillRangeInPlace$1(arg1, start, end_, obj) { - return obj.fill(arg1, start, end_); -} - -function sortInPlaceWith$1(arg1, obj) { - return obj.sort(arg1); -} - -function includes$1(arg1, obj) { - return obj.includes(arg1); -} - -function indexOf$1(arg1, obj) { - return obj.indexOf(arg1); -} - -function indexOfFrom$1(arg1, from, obj) { - return obj.indexOf(arg1, from); -} - -function joinWith$1(arg1, obj) { - return obj.join(arg1); -} - -function lastIndexOf$1(arg1, obj) { - return obj.lastIndexOf(arg1); -} - -function lastIndexOfFrom$1(arg1, from, obj) { - return obj.lastIndexOf(arg1, from); -} - -function slice$2(start, end_, obj) { - return obj.slice(start, end_); -} - -function sliceFrom$2(arg1, obj) { - return obj.slice(arg1); -} - -function subarray$1(start, end_, obj) { - return obj.subarray(start, end_); -} - -function subarrayFrom$1(arg1, obj) { - return obj.subarray(arg1); -} - -function every$1(arg1, obj) { - return obj.every(arg1); -} - -function everyi$1(arg1, obj) { - return obj.every(arg1); -} - -function filter$1(arg1, obj) { - return obj.filter(arg1); -} - -function filteri$1(arg1, obj) { - return obj.filter(arg1); -} - -function find$1(arg1, obj) { - return obj.find(arg1); -} - -function findi$1(arg1, obj) { - return obj.find(arg1); -} - -function findIndex$1(arg1, obj) { - return obj.findIndex(arg1); -} - -function findIndexi$1(arg1, obj) { - return obj.findIndex(arg1); -} - -function forEach$1(arg1, obj) { - obj.forEach(arg1); -} - -function forEachi$1(arg1, obj) { - obj.forEach(arg1); -} - -function map$1(arg1, obj) { - return obj.map(arg1); -} - -function mapi$1(arg1, obj) { - return obj.map(arg1); -} - -function reduce$1(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reducei$1(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reduceRight$1(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function reduceRighti$1(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function some$1(arg1, obj) { - return obj.some(arg1); -} - -function somei$1(arg1, obj) { - return obj.some(arg1); -} - -let $$Uint8Array = { - setArray: setArray$1, - setArrayOffset: setArrayOffset$1, - copyWithin: copyWithin$1, - copyWithinFrom: copyWithinFrom$1, - copyWithinFromRange: copyWithinFromRange$1, - fillInPlace: fillInPlace$1, - fillFromInPlace: fillFromInPlace$1, - fillRangeInPlace: fillRangeInPlace$1, - sortInPlaceWith: sortInPlaceWith$1, - includes: includes$1, - indexOf: indexOf$1, - indexOfFrom: indexOfFrom$1, - joinWith: joinWith$1, - lastIndexOf: lastIndexOf$1, - lastIndexOfFrom: lastIndexOfFrom$1, - slice: slice$2, - sliceFrom: sliceFrom$2, - subarray: subarray$1, - subarrayFrom: subarrayFrom$1, - every: every$1, - everyi: everyi$1, - filter: filter$1, - filteri: filteri$1, - find: find$1, - findi: findi$1, - findIndex: findIndex$1, - findIndexi: findIndexi$1, - forEach: forEach$1, - forEachi: forEachi$1, - map: map$1, - mapi: mapi$1, - reduce: reduce$1, - reducei: reducei$1, - reduceRight: reduceRight$1, - reduceRighti: reduceRighti$1, - some: some$1, - somei: somei$1 -}; - -function setArray$2(arg1, obj) { - obj.set(arg1); -} - -function setArrayOffset$2(arg1, arg2, obj) { - obj.set(arg1, arg2); -} - -function copyWithin$2(to_, obj) { - return obj.copyWithin(to_); -} - -function copyWithinFrom$2(to_, from, obj) { - return obj.copyWithin(to_, from); -} - -function copyWithinFromRange$2(to_, start, end_, obj) { - return obj.copyWithin(to_, start, end_); -} - -function fillInPlace$2(arg1, obj) { - return obj.fill(arg1); -} - -function fillFromInPlace$2(arg1, from, obj) { - return obj.fill(arg1, from); -} - -function fillRangeInPlace$2(arg1, start, end_, obj) { - return obj.fill(arg1, start, end_); -} - -function sortInPlaceWith$2(arg1, obj) { - return obj.sort(arg1); -} - -function includes$2(arg1, obj) { - return obj.includes(arg1); -} - -function indexOf$2(arg1, obj) { - return obj.indexOf(arg1); -} - -function indexOfFrom$2(arg1, from, obj) { - return obj.indexOf(arg1, from); -} - -function joinWith$2(arg1, obj) { - return obj.join(arg1); -} - -function lastIndexOf$2(arg1, obj) { - return obj.lastIndexOf(arg1); -} - -function lastIndexOfFrom$2(arg1, from, obj) { - return obj.lastIndexOf(arg1, from); -} - -function slice$3(start, end_, obj) { - return obj.slice(start, end_); -} - -function sliceFrom$3(arg1, obj) { - return obj.slice(arg1); -} - -function subarray$2(start, end_, obj) { - return obj.subarray(start, end_); -} - -function subarrayFrom$2(arg1, obj) { - return obj.subarray(arg1); -} - -function every$2(arg1, obj) { - return obj.every(arg1); -} - -function everyi$2(arg1, obj) { - return obj.every(arg1); -} - -function filter$2(arg1, obj) { - return obj.filter(arg1); -} - -function filteri$2(arg1, obj) { - return obj.filter(arg1); -} - -function find$2(arg1, obj) { - return obj.find(arg1); -} - -function findi$2(arg1, obj) { - return obj.find(arg1); -} - -function findIndex$2(arg1, obj) { - return obj.findIndex(arg1); -} - -function findIndexi$2(arg1, obj) { - return obj.findIndex(arg1); -} - -function forEach$2(arg1, obj) { - obj.forEach(arg1); -} - -function forEachi$2(arg1, obj) { - obj.forEach(arg1); -} - -function map$2(arg1, obj) { - return obj.map(arg1); -} - -function mapi$2(arg1, obj) { - return obj.map(arg1); -} - -function reduce$2(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reducei$2(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reduceRight$2(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function reduceRighti$2(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function some$2(arg1, obj) { - return obj.some(arg1); -} - -function somei$2(arg1, obj) { - return obj.some(arg1); -} - -let $$Uint8ClampedArray = { - setArray: setArray$2, - setArrayOffset: setArrayOffset$2, - copyWithin: copyWithin$2, - copyWithinFrom: copyWithinFrom$2, - copyWithinFromRange: copyWithinFromRange$2, - fillInPlace: fillInPlace$2, - fillFromInPlace: fillFromInPlace$2, - fillRangeInPlace: fillRangeInPlace$2, - sortInPlaceWith: sortInPlaceWith$2, - includes: includes$2, - indexOf: indexOf$2, - indexOfFrom: indexOfFrom$2, - joinWith: joinWith$2, - lastIndexOf: lastIndexOf$2, - lastIndexOfFrom: lastIndexOfFrom$2, - slice: slice$3, - sliceFrom: sliceFrom$3, - subarray: subarray$2, - subarrayFrom: subarrayFrom$2, - every: every$2, - everyi: everyi$2, - filter: filter$2, - filteri: filteri$2, - find: find$2, - findi: findi$2, - findIndex: findIndex$2, - findIndexi: findIndexi$2, - forEach: forEach$2, - forEachi: forEachi$2, - map: map$2, - mapi: mapi$2, - reduce: reduce$2, - reducei: reducei$2, - reduceRight: reduceRight$2, - reduceRighti: reduceRighti$2, - some: some$2, - somei: somei$2 -}; - -function setArray$3(arg1, obj) { - obj.set(arg1); -} - -function setArrayOffset$3(arg1, arg2, obj) { - obj.set(arg1, arg2); -} - -function copyWithin$3(to_, obj) { - return obj.copyWithin(to_); -} - -function copyWithinFrom$3(to_, from, obj) { - return obj.copyWithin(to_, from); -} - -function copyWithinFromRange$3(to_, start, end_, obj) { - return obj.copyWithin(to_, start, end_); -} - -function fillInPlace$3(arg1, obj) { - return obj.fill(arg1); -} - -function fillFromInPlace$3(arg1, from, obj) { - return obj.fill(arg1, from); -} - -function fillRangeInPlace$3(arg1, start, end_, obj) { - return obj.fill(arg1, start, end_); -} - -function sortInPlaceWith$3(arg1, obj) { - return obj.sort(arg1); -} - -function includes$3(arg1, obj) { - return obj.includes(arg1); -} - -function indexOf$3(arg1, obj) { - return obj.indexOf(arg1); -} - -function indexOfFrom$3(arg1, from, obj) { - return obj.indexOf(arg1, from); -} - -function joinWith$3(arg1, obj) { - return obj.join(arg1); -} - -function lastIndexOf$3(arg1, obj) { - return obj.lastIndexOf(arg1); -} - -function lastIndexOfFrom$3(arg1, from, obj) { - return obj.lastIndexOf(arg1, from); -} - -function slice$4(start, end_, obj) { - return obj.slice(start, end_); -} - -function sliceFrom$4(arg1, obj) { - return obj.slice(arg1); -} - -function subarray$3(start, end_, obj) { - return obj.subarray(start, end_); -} - -function subarrayFrom$3(arg1, obj) { - return obj.subarray(arg1); -} - -function every$3(arg1, obj) { - return obj.every(arg1); -} - -function everyi$3(arg1, obj) { - return obj.every(arg1); -} - -function filter$3(arg1, obj) { - return obj.filter(arg1); -} - -function filteri$3(arg1, obj) { - return obj.filter(arg1); -} - -function find$3(arg1, obj) { - return obj.find(arg1); -} - -function findi$3(arg1, obj) { - return obj.find(arg1); -} - -function findIndex$3(arg1, obj) { - return obj.findIndex(arg1); -} - -function findIndexi$3(arg1, obj) { - return obj.findIndex(arg1); -} - -function forEach$3(arg1, obj) { - obj.forEach(arg1); -} - -function forEachi$3(arg1, obj) { - obj.forEach(arg1); -} - -function map$3(arg1, obj) { - return obj.map(arg1); -} - -function mapi$3(arg1, obj) { - return obj.map(arg1); -} - -function reduce$3(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reducei$3(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reduceRight$3(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function reduceRighti$3(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function some$3(arg1, obj) { - return obj.some(arg1); -} - -function somei$3(arg1, obj) { - return obj.some(arg1); -} - -let $$Int16Array = { - setArray: setArray$3, - setArrayOffset: setArrayOffset$3, - copyWithin: copyWithin$3, - copyWithinFrom: copyWithinFrom$3, - copyWithinFromRange: copyWithinFromRange$3, - fillInPlace: fillInPlace$3, - fillFromInPlace: fillFromInPlace$3, - fillRangeInPlace: fillRangeInPlace$3, - sortInPlaceWith: sortInPlaceWith$3, - includes: includes$3, - indexOf: indexOf$3, - indexOfFrom: indexOfFrom$3, - joinWith: joinWith$3, - lastIndexOf: lastIndexOf$3, - lastIndexOfFrom: lastIndexOfFrom$3, - slice: slice$4, - sliceFrom: sliceFrom$4, - subarray: subarray$3, - subarrayFrom: subarrayFrom$3, - every: every$3, - everyi: everyi$3, - filter: filter$3, - filteri: filteri$3, - find: find$3, - findi: findi$3, - findIndex: findIndex$3, - findIndexi: findIndexi$3, - forEach: forEach$3, - forEachi: forEachi$3, - map: map$3, - mapi: mapi$3, - reduce: reduce$3, - reducei: reducei$3, - reduceRight: reduceRight$3, - reduceRighti: reduceRighti$3, - some: some$3, - somei: somei$3 -}; - -function setArray$4(arg1, obj) { - obj.set(arg1); -} - -function setArrayOffset$4(arg1, arg2, obj) { - obj.set(arg1, arg2); -} - -function copyWithin$4(to_, obj) { - return obj.copyWithin(to_); -} - -function copyWithinFrom$4(to_, from, obj) { - return obj.copyWithin(to_, from); -} - -function copyWithinFromRange$4(to_, start, end_, obj) { - return obj.copyWithin(to_, start, end_); -} - -function fillInPlace$4(arg1, obj) { - return obj.fill(arg1); -} - -function fillFromInPlace$4(arg1, from, obj) { - return obj.fill(arg1, from); -} - -function fillRangeInPlace$4(arg1, start, end_, obj) { - return obj.fill(arg1, start, end_); -} - -function sortInPlaceWith$4(arg1, obj) { - return obj.sort(arg1); -} - -function includes$4(arg1, obj) { - return obj.includes(arg1); -} - -function indexOf$4(arg1, obj) { - return obj.indexOf(arg1); -} - -function indexOfFrom$4(arg1, from, obj) { - return obj.indexOf(arg1, from); -} - -function joinWith$4(arg1, obj) { - return obj.join(arg1); -} - -function lastIndexOf$4(arg1, obj) { - return obj.lastIndexOf(arg1); -} - -function lastIndexOfFrom$4(arg1, from, obj) { - return obj.lastIndexOf(arg1, from); -} - -function slice$5(start, end_, obj) { - return obj.slice(start, end_); -} - -function sliceFrom$5(arg1, obj) { - return obj.slice(arg1); -} - -function subarray$4(start, end_, obj) { - return obj.subarray(start, end_); -} - -function subarrayFrom$4(arg1, obj) { - return obj.subarray(arg1); -} - -function every$4(arg1, obj) { - return obj.every(arg1); -} - -function everyi$4(arg1, obj) { - return obj.every(arg1); -} - -function filter$4(arg1, obj) { - return obj.filter(arg1); -} - -function filteri$4(arg1, obj) { - return obj.filter(arg1); -} - -function find$4(arg1, obj) { - return obj.find(arg1); -} - -function findi$4(arg1, obj) { - return obj.find(arg1); -} - -function findIndex$4(arg1, obj) { - return obj.findIndex(arg1); -} - -function findIndexi$4(arg1, obj) { - return obj.findIndex(arg1); -} - -function forEach$4(arg1, obj) { - obj.forEach(arg1); -} - -function forEachi$4(arg1, obj) { - obj.forEach(arg1); -} - -function map$4(arg1, obj) { - return obj.map(arg1); -} - -function mapi$4(arg1, obj) { - return obj.map(arg1); -} - -function reduce$4(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reducei$4(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reduceRight$4(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function reduceRighti$4(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function some$4(arg1, obj) { - return obj.some(arg1); -} - -function somei$4(arg1, obj) { - return obj.some(arg1); -} - -let $$Uint16Array = { - setArray: setArray$4, - setArrayOffset: setArrayOffset$4, - copyWithin: copyWithin$4, - copyWithinFrom: copyWithinFrom$4, - copyWithinFromRange: copyWithinFromRange$4, - fillInPlace: fillInPlace$4, - fillFromInPlace: fillFromInPlace$4, - fillRangeInPlace: fillRangeInPlace$4, - sortInPlaceWith: sortInPlaceWith$4, - includes: includes$4, - indexOf: indexOf$4, - indexOfFrom: indexOfFrom$4, - joinWith: joinWith$4, - lastIndexOf: lastIndexOf$4, - lastIndexOfFrom: lastIndexOfFrom$4, - slice: slice$5, - sliceFrom: sliceFrom$5, - subarray: subarray$4, - subarrayFrom: subarrayFrom$4, - every: every$4, - everyi: everyi$4, - filter: filter$4, - filteri: filteri$4, - find: find$4, - findi: findi$4, - findIndex: findIndex$4, - findIndexi: findIndexi$4, - forEach: forEach$4, - forEachi: forEachi$4, - map: map$4, - mapi: mapi$4, - reduce: reduce$4, - reducei: reducei$4, - reduceRight: reduceRight$4, - reduceRighti: reduceRighti$4, - some: some$4, - somei: somei$4 -}; - -function setArray$5(arg1, obj) { - obj.set(arg1); -} - -function setArrayOffset$5(arg1, arg2, obj) { - obj.set(arg1, arg2); -} - -function copyWithin$5(to_, obj) { - return obj.copyWithin(to_); -} - -function copyWithinFrom$5(to_, from, obj) { - return obj.copyWithin(to_, from); -} - -function copyWithinFromRange$5(to_, start, end_, obj) { - return obj.copyWithin(to_, start, end_); -} - -function fillInPlace$5(arg1, obj) { - return obj.fill(arg1); -} - -function fillFromInPlace$5(arg1, from, obj) { - return obj.fill(arg1, from); -} - -function fillRangeInPlace$5(arg1, start, end_, obj) { - return obj.fill(arg1, start, end_); -} - -function sortInPlaceWith$5(arg1, obj) { - return obj.sort(arg1); -} - -function includes$5(arg1, obj) { - return obj.includes(arg1); -} - -function indexOf$5(arg1, obj) { - return obj.indexOf(arg1); -} - -function indexOfFrom$5(arg1, from, obj) { - return obj.indexOf(arg1, from); -} - -function joinWith$5(arg1, obj) { - return obj.join(arg1); -} - -function lastIndexOf$5(arg1, obj) { - return obj.lastIndexOf(arg1); -} - -function lastIndexOfFrom$5(arg1, from, obj) { - return obj.lastIndexOf(arg1, from); -} - -function slice$6(start, end_, obj) { - return obj.slice(start, end_); -} - -function sliceFrom$6(arg1, obj) { - return obj.slice(arg1); -} - -function subarray$5(start, end_, obj) { - return obj.subarray(start, end_); -} - -function subarrayFrom$5(arg1, obj) { - return obj.subarray(arg1); -} - -function every$5(arg1, obj) { - return obj.every(arg1); -} - -function everyi$5(arg1, obj) { - return obj.every(arg1); -} - -function filter$5(arg1, obj) { - return obj.filter(arg1); -} - -function filteri$5(arg1, obj) { - return obj.filter(arg1); -} - -function find$5(arg1, obj) { - return obj.find(arg1); -} - -function findi$5(arg1, obj) { - return obj.find(arg1); -} - -function findIndex$5(arg1, obj) { - return obj.findIndex(arg1); -} - -function findIndexi$5(arg1, obj) { - return obj.findIndex(arg1); -} - -function forEach$5(arg1, obj) { - obj.forEach(arg1); -} - -function forEachi$5(arg1, obj) { - obj.forEach(arg1); -} - -function map$5(arg1, obj) { - return obj.map(arg1); -} - -function mapi$5(arg1, obj) { - return obj.map(arg1); -} - -function reduce$5(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reducei$5(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reduceRight$5(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function reduceRighti$5(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function some$5(arg1, obj) { - return obj.some(arg1); -} - -function somei$5(arg1, obj) { - return obj.some(arg1); -} - -let $$Int32Array = { - setArray: setArray$5, - setArrayOffset: setArrayOffset$5, - copyWithin: copyWithin$5, - copyWithinFrom: copyWithinFrom$5, - copyWithinFromRange: copyWithinFromRange$5, - fillInPlace: fillInPlace$5, - fillFromInPlace: fillFromInPlace$5, - fillRangeInPlace: fillRangeInPlace$5, - sortInPlaceWith: sortInPlaceWith$5, - includes: includes$5, - indexOf: indexOf$5, - indexOfFrom: indexOfFrom$5, - joinWith: joinWith$5, - lastIndexOf: lastIndexOf$5, - lastIndexOfFrom: lastIndexOfFrom$5, - slice: slice$6, - sliceFrom: sliceFrom$6, - subarray: subarray$5, - subarrayFrom: subarrayFrom$5, - every: every$5, - everyi: everyi$5, - filter: filter$5, - filteri: filteri$5, - find: find$5, - findi: findi$5, - findIndex: findIndex$5, - findIndexi: findIndexi$5, - forEach: forEach$5, - forEachi: forEachi$5, - map: map$5, - mapi: mapi$5, - reduce: reduce$5, - reducei: reducei$5, - reduceRight: reduceRight$5, - reduceRighti: reduceRighti$5, - some: some$5, - somei: somei$5 -}; - -function setArray$6(arg1, obj) { - obj.set(arg1); -} - -function setArrayOffset$6(arg1, arg2, obj) { - obj.set(arg1, arg2); -} - -function copyWithin$6(to_, obj) { - return obj.copyWithin(to_); -} - -function copyWithinFrom$6(to_, from, obj) { - return obj.copyWithin(to_, from); -} - -function copyWithinFromRange$6(to_, start, end_, obj) { - return obj.copyWithin(to_, start, end_); -} - -function fillInPlace$6(arg1, obj) { - return obj.fill(arg1); -} - -function fillFromInPlace$6(arg1, from, obj) { - return obj.fill(arg1, from); -} - -function fillRangeInPlace$6(arg1, start, end_, obj) { - return obj.fill(arg1, start, end_); -} - -function sortInPlaceWith$6(arg1, obj) { - return obj.sort(arg1); -} - -function includes$6(arg1, obj) { - return obj.includes(arg1); -} - -function indexOf$6(arg1, obj) { - return obj.indexOf(arg1); -} - -function indexOfFrom$6(arg1, from, obj) { - return obj.indexOf(arg1, from); -} - -function joinWith$6(arg1, obj) { - return obj.join(arg1); -} - -function lastIndexOf$6(arg1, obj) { - return obj.lastIndexOf(arg1); -} - -function lastIndexOfFrom$6(arg1, from, obj) { - return obj.lastIndexOf(arg1, from); -} - -function slice$7(start, end_, obj) { - return obj.slice(start, end_); -} - -function sliceFrom$7(arg1, obj) { - return obj.slice(arg1); -} - -function subarray$6(start, end_, obj) { - return obj.subarray(start, end_); -} - -function subarrayFrom$6(arg1, obj) { - return obj.subarray(arg1); -} - -function every$6(arg1, obj) { - return obj.every(arg1); -} - -function everyi$6(arg1, obj) { - return obj.every(arg1); -} - -function filter$6(arg1, obj) { - return obj.filter(arg1); -} - -function filteri$6(arg1, obj) { - return obj.filter(arg1); -} - -function find$6(arg1, obj) { - return obj.find(arg1); -} - -function findi$6(arg1, obj) { - return obj.find(arg1); -} - -function findIndex$6(arg1, obj) { - return obj.findIndex(arg1); -} - -function findIndexi$6(arg1, obj) { - return obj.findIndex(arg1); -} - -function forEach$6(arg1, obj) { - obj.forEach(arg1); -} - -function forEachi$6(arg1, obj) { - obj.forEach(arg1); -} - -function map$6(arg1, obj) { - return obj.map(arg1); -} - -function mapi$6(arg1, obj) { - return obj.map(arg1); -} - -function reduce$6(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reducei$6(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reduceRight$6(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function reduceRighti$6(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function some$6(arg1, obj) { - return obj.some(arg1); -} - -function somei$6(arg1, obj) { - return obj.some(arg1); -} - -let $$Uint32Array = { - setArray: setArray$6, - setArrayOffset: setArrayOffset$6, - copyWithin: copyWithin$6, - copyWithinFrom: copyWithinFrom$6, - copyWithinFromRange: copyWithinFromRange$6, - fillInPlace: fillInPlace$6, - fillFromInPlace: fillFromInPlace$6, - fillRangeInPlace: fillRangeInPlace$6, - sortInPlaceWith: sortInPlaceWith$6, - includes: includes$6, - indexOf: indexOf$6, - indexOfFrom: indexOfFrom$6, - joinWith: joinWith$6, - lastIndexOf: lastIndexOf$6, - lastIndexOfFrom: lastIndexOfFrom$6, - slice: slice$7, - sliceFrom: sliceFrom$7, - subarray: subarray$6, - subarrayFrom: subarrayFrom$6, - every: every$6, - everyi: everyi$6, - filter: filter$6, - filteri: filteri$6, - find: find$6, - findi: findi$6, - findIndex: findIndex$6, - findIndexi: findIndexi$6, - forEach: forEach$6, - forEachi: forEachi$6, - map: map$6, - mapi: mapi$6, - reduce: reduce$6, - reducei: reducei$6, - reduceRight: reduceRight$6, - reduceRighti: reduceRighti$6, - some: some$6, - somei: somei$6 -}; - -function setArray$7(arg1, obj) { - obj.set(arg1); -} - -function setArrayOffset$7(arg1, arg2, obj) { - obj.set(arg1, arg2); -} - -function copyWithin$7(to_, obj) { - return obj.copyWithin(to_); -} - -function copyWithinFrom$7(to_, from, obj) { - return obj.copyWithin(to_, from); -} - -function copyWithinFromRange$7(to_, start, end_, obj) { - return obj.copyWithin(to_, start, end_); -} - -function fillInPlace$7(arg1, obj) { - return obj.fill(arg1); -} - -function fillFromInPlace$7(arg1, from, obj) { - return obj.fill(arg1, from); -} - -function fillRangeInPlace$7(arg1, start, end_, obj) { - return obj.fill(arg1, start, end_); -} - -function sortInPlaceWith$7(arg1, obj) { - return obj.sort(arg1); -} - -function includes$7(arg1, obj) { - return obj.includes(arg1); -} - -function indexOf$7(arg1, obj) { - return obj.indexOf(arg1); -} - -function indexOfFrom$7(arg1, from, obj) { - return obj.indexOf(arg1, from); -} - -function joinWith$7(arg1, obj) { - return obj.join(arg1); -} - -function lastIndexOf$7(arg1, obj) { - return obj.lastIndexOf(arg1); -} - -function lastIndexOfFrom$7(arg1, from, obj) { - return obj.lastIndexOf(arg1, from); -} - -function slice$8(start, end_, obj) { - return obj.slice(start, end_); -} - -function sliceFrom$8(arg1, obj) { - return obj.slice(arg1); -} - -function subarray$7(start, end_, obj) { - return obj.subarray(start, end_); -} - -function subarrayFrom$7(arg1, obj) { - return obj.subarray(arg1); -} - -function every$7(arg1, obj) { - return obj.every(arg1); -} - -function everyi$7(arg1, obj) { - return obj.every(arg1); -} - -function filter$7(arg1, obj) { - return obj.filter(arg1); -} - -function filteri$7(arg1, obj) { - return obj.filter(arg1); -} - -function find$7(arg1, obj) { - return obj.find(arg1); -} - -function findi$7(arg1, obj) { - return obj.find(arg1); -} - -function findIndex$7(arg1, obj) { - return obj.findIndex(arg1); -} - -function findIndexi$7(arg1, obj) { - return obj.findIndex(arg1); -} - -function forEach$7(arg1, obj) { - obj.forEach(arg1); -} - -function forEachi$7(arg1, obj) { - obj.forEach(arg1); -} - -function map$7(arg1, obj) { - return obj.map(arg1); -} - -function mapi$7(arg1, obj) { - return obj.map(arg1); -} - -function reduce$7(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reducei$7(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reduceRight$7(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function reduceRighti$7(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function some$7(arg1, obj) { - return obj.some(arg1); -} - -function somei$7(arg1, obj) { - return obj.some(arg1); -} - -let $$Float32Array = { - setArray: setArray$7, - setArrayOffset: setArrayOffset$7, - copyWithin: copyWithin$7, - copyWithinFrom: copyWithinFrom$7, - copyWithinFromRange: copyWithinFromRange$7, - fillInPlace: fillInPlace$7, - fillFromInPlace: fillFromInPlace$7, - fillRangeInPlace: fillRangeInPlace$7, - sortInPlaceWith: sortInPlaceWith$7, - includes: includes$7, - indexOf: indexOf$7, - indexOfFrom: indexOfFrom$7, - joinWith: joinWith$7, - lastIndexOf: lastIndexOf$7, - lastIndexOfFrom: lastIndexOfFrom$7, - slice: slice$8, - sliceFrom: sliceFrom$8, - subarray: subarray$7, - subarrayFrom: subarrayFrom$7, - every: every$7, - everyi: everyi$7, - filter: filter$7, - filteri: filteri$7, - find: find$7, - findi: findi$7, - findIndex: findIndex$7, - findIndexi: findIndexi$7, - forEach: forEach$7, - forEachi: forEachi$7, - map: map$7, - mapi: mapi$7, - reduce: reduce$7, - reducei: reducei$7, - reduceRight: reduceRight$7, - reduceRighti: reduceRighti$7, - some: some$7, - somei: somei$7 -}; - -function setArray$8(arg1, obj) { - obj.set(arg1); -} - -function setArrayOffset$8(arg1, arg2, obj) { - obj.set(arg1, arg2); -} - -function copyWithin$8(to_, obj) { - return obj.copyWithin(to_); -} - -function copyWithinFrom$8(to_, from, obj) { - return obj.copyWithin(to_, from); -} - -function copyWithinFromRange$8(to_, start, end_, obj) { - return obj.copyWithin(to_, start, end_); -} - -function fillInPlace$8(arg1, obj) { - return obj.fill(arg1); -} - -function fillFromInPlace$8(arg1, from, obj) { - return obj.fill(arg1, from); -} - -function fillRangeInPlace$8(arg1, start, end_, obj) { - return obj.fill(arg1, start, end_); -} - -function sortInPlaceWith$8(arg1, obj) { - return obj.sort(arg1); -} - -function includes$8(arg1, obj) { - return obj.includes(arg1); -} - -function indexOf$8(arg1, obj) { - return obj.indexOf(arg1); -} - -function indexOfFrom$8(arg1, from, obj) { - return obj.indexOf(arg1, from); -} - -function joinWith$8(arg1, obj) { - return obj.join(arg1); -} - -function lastIndexOf$8(arg1, obj) { - return obj.lastIndexOf(arg1); -} - -function lastIndexOfFrom$8(arg1, from, obj) { - return obj.lastIndexOf(arg1, from); -} - -function slice$9(start, end_, obj) { - return obj.slice(start, end_); -} - -function sliceFrom$9(arg1, obj) { - return obj.slice(arg1); -} - -function subarray$8(start, end_, obj) { - return obj.subarray(start, end_); -} - -function subarrayFrom$8(arg1, obj) { - return obj.subarray(arg1); -} - -function every$8(arg1, obj) { - return obj.every(arg1); -} - -function everyi$8(arg1, obj) { - return obj.every(arg1); -} - -function filter$8(arg1, obj) { - return obj.filter(arg1); -} - -function filteri$8(arg1, obj) { - return obj.filter(arg1); -} - -function find$8(arg1, obj) { - return obj.find(arg1); -} - -function findi$8(arg1, obj) { - return obj.find(arg1); -} - -function findIndex$8(arg1, obj) { - return obj.findIndex(arg1); -} - -function findIndexi$8(arg1, obj) { - return obj.findIndex(arg1); -} - -function forEach$8(arg1, obj) { - obj.forEach(arg1); -} - -function forEachi$8(arg1, obj) { - obj.forEach(arg1); -} - -function map$8(arg1, obj) { - return obj.map(arg1); -} - -function mapi$8(arg1, obj) { - return obj.map(arg1); -} - -function reduce$8(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reducei$8(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reduceRight$8(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function reduceRighti$8(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function some$8(arg1, obj) { - return obj.some(arg1); -} - -function somei$8(arg1, obj) { - return obj.some(arg1); -} - -let $$Float64Array = { - setArray: setArray$8, - setArrayOffset: setArrayOffset$8, - copyWithin: copyWithin$8, - copyWithinFrom: copyWithinFrom$8, - copyWithinFromRange: copyWithinFromRange$8, - fillInPlace: fillInPlace$8, - fillFromInPlace: fillFromInPlace$8, - fillRangeInPlace: fillRangeInPlace$8, - sortInPlaceWith: sortInPlaceWith$8, - includes: includes$8, - indexOf: indexOf$8, - indexOfFrom: indexOfFrom$8, - joinWith: joinWith$8, - lastIndexOf: lastIndexOf$8, - lastIndexOfFrom: lastIndexOfFrom$8, - slice: slice$9, - sliceFrom: sliceFrom$9, - subarray: subarray$8, - subarrayFrom: subarrayFrom$8, - every: every$8, - everyi: everyi$8, - filter: filter$8, - filteri: filteri$8, - find: find$8, - findi: findi$8, - findIndex: findIndex$8, - findIndexi: findIndexi$8, - forEach: forEach$8, - forEachi: forEachi$8, - map: map$8, - mapi: mapi$8, - reduce: reduce$8, - reducei: reducei$8, - reduceRight: reduceRight$8, - reduceRighti: reduceRighti$8, - some: some$8, - somei: somei$8 -}; - -let $$DataView = {}; - -let Int32_array; - -let Float32_array; - -let Float64_array; - -export { - $$ArrayBuffer, - $$Int8Array, - $$Uint8Array, - $$Uint8ClampedArray, - $$Int16Array, - $$Uint16Array, - $$Int32Array, - Int32_array, - $$Uint32Array, - $$Float32Array, - Float32_array, - $$Float64Array, - Float64_array, - $$DataView, -} -/* No side effect */ diff --git a/lib/es6/jsxC.js b/lib/es6/jsx.js similarity index 100% rename from lib/es6/jsxC.js rename to lib/es6/jsx.js diff --git a/lib/es6/jsxDOMC.js b/lib/es6/jsxDOM.js similarity index 100% rename from lib/es6/jsxDOMC.js rename to lib/es6/jsxDOM.js diff --git a/lib/es6/jsxEventC.js b/lib/es6/jsxEvent.js similarity index 100% rename from lib/es6/jsxEventC.js rename to lib/es6/jsxEvent.js diff --git a/lib/es6/jsxEventU.js b/lib/es6/jsxEventU.js deleted file mode 100644 index 4a8684de93..0000000000 --- a/lib/es6/jsxEventU.js +++ /dev/null @@ -1,59 +0,0 @@ - - - -function MakeEventWithType(Type) { - return {}; -} - -let Synthetic = {}; - -let Clipboard = {}; - -let Composition = {}; - -let Keyboard = {}; - -let Focus = {}; - -let Form = {}; - -let Mouse = {}; - -let Pointer = {}; - -let $$Selection = {}; - -let $$Touch = {}; - -let UI = {}; - -let Wheel = {}; - -let Media = {}; - -let $$Image = {}; - -let $$Animation = {}; - -let Transition = {}; - -export { - MakeEventWithType, - Synthetic, - Clipboard, - Composition, - Keyboard, - Focus, - Form, - Mouse, - Pointer, - $$Selection, - $$Touch, - UI, - Wheel, - Media, - $$Image, - $$Animation, - Transition, -} -/* No side effect */ diff --git a/lib/es6/jsxPPXReactSupportC.js b/lib/es6/jsxPPXReactSupport.js similarity index 97% rename from lib/es6/jsxPPXReactSupportC.js rename to lib/es6/jsxPPXReactSupport.js index 85203df4e9..c6995106b8 100644 --- a/lib/es6/jsxPPXReactSupportC.js +++ b/lib/es6/jsxPPXReactSupport.js @@ -19,10 +19,7 @@ function createElementVariadicWithKey(key, component, props, elements) { ]); } -let Jsx; - export { - Jsx, createElementWithKey, createElementVariadicWithKey, } diff --git a/lib/es6/jsxPPXReactSupportU.js b/lib/es6/jsxPPXReactSupportU.js deleted file mode 100644 index 85203df4e9..0000000000 --- a/lib/es6/jsxPPXReactSupportU.js +++ /dev/null @@ -1,29 +0,0 @@ - - -import * as React from "react"; -import * as Caml_splice_call from "./caml_splice_call.js"; - -function createElementWithKey(key, component, props) { - return React.createElement(component, key !== undefined ? Object.assign({ - key: key - }, props) : props); -} - -function createElementVariadicWithKey(key, component, props, elements) { - return Caml_splice_call.spliceApply(React.createElement, [ - component, - key !== undefined ? Object.assign({ - key: key - }, props) : props, - elements - ]); -} - -let Jsx; - -export { - Jsx, - createElementWithKey, - createElementVariadicWithKey, -} -/* react Not a pure module */ 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 531f2fd3ba..b0edb4cabb 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"; @@ -44,17 +43,17 @@ let zero_pos = { }; function from_function(f) { - let partial_arg = Caml_bytes.create(512); return { - refill_buff: (function (param) { - let read = Curry._2(f, partial_arg, partial_arg.length); - let n = read > 0 ? read : (param.lex_eof_reached = true, 0); - if ((param.lex_buffer_len + n | 0) > param.lex_buffer.length) { - if (((param.lex_buffer_len - param.lex_start_pos | 0) + n | 0) <= param.lex_buffer.length) { - Bytes.blit(param.lex_buffer, param.lex_start_pos, param.lex_buffer, 0, param.lex_buffer_len - param.lex_start_pos | 0); + refill_buff: (function (a) { + let aux_buffer = Caml_bytes.create(512); + let read = f(aux_buffer, aux_buffer.length); + let n = read > 0 ? read : (a.lex_eof_reached = true, 0); + if ((a.lex_buffer_len + n | 0) > a.lex_buffer.length) { + if (((a.lex_buffer_len - a.lex_start_pos | 0) + n | 0) <= a.lex_buffer.length) { + Bytes.blit(a.lex_buffer, a.lex_start_pos, a.lex_buffer, 0, a.lex_buffer_len - a.lex_start_pos | 0); } else { - let newlen = (param.lex_buffer.length << 1); - if (((param.lex_buffer_len - param.lex_start_pos | 0) + n | 0) > newlen) { + let newlen = (a.lex_buffer.length << 1); + if (((a.lex_buffer_len - a.lex_start_pos | 0) + n | 0) > newlen) { throw { RE_EXN_ID: "Failure", _1: "Lexing.lex_refill: cannot grow buffer", @@ -62,16 +61,16 @@ function from_function(f) { }; } let newbuf = Caml_bytes.create(newlen); - Bytes.blit(param.lex_buffer, param.lex_start_pos, newbuf, 0, param.lex_buffer_len - param.lex_start_pos | 0); - param.lex_buffer = newbuf; + Bytes.blit(a.lex_buffer, a.lex_start_pos, newbuf, 0, a.lex_buffer_len - a.lex_start_pos | 0); + a.lex_buffer = newbuf; } - let s = param.lex_start_pos; - param.lex_abs_pos = param.lex_abs_pos + s | 0; - param.lex_curr_pos = param.lex_curr_pos - s | 0; - param.lex_start_pos = 0; - param.lex_last_pos = param.lex_last_pos - s | 0; - param.lex_buffer_len = param.lex_buffer_len - s | 0; - let t = param.lex_mem; + let s = a.lex_start_pos; + a.lex_abs_pos = a.lex_abs_pos + s | 0; + a.lex_curr_pos = a.lex_curr_pos - s | 0; + a.lex_start_pos = 0; + a.lex_last_pos = a.lex_last_pos - s | 0; + a.lex_buffer_len = a.lex_buffer_len - s | 0; + let t = a.lex_mem; for(let i = 0 ,i_finish = t.length; i < i_finish; ++i){ let v = Caml_array.get(t, i); if (v >= 0) { @@ -80,8 +79,8 @@ function from_function(f) { } } - Bytes.blit(partial_arg, 0, param.lex_buffer, param.lex_buffer_len, n); - param.lex_buffer_len = param.lex_buffer_len + n | 0; + Bytes.blit(aux_buffer, 0, a.lex_buffer, a.lex_buffer_len, n); + a.lex_buffer_len = a.lex_buffer_len + n | 0; }), lex_buffer: Caml_bytes.create(1024), lex_buffer_len: 0, diff --git a/lib/es6/list.js b/lib/es6/list.js index da328481b8..8ff2e943dd 100644 --- a/lib/es6/list.js +++ b/lib/es6/list.js @@ -1,6 +1,5 @@ -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"; @@ -132,7 +131,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; @@ -143,7 +142,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) @@ -151,18 +150,18 @@ function init_aux(i, n, f) { } function init(len, f) { - if (len < 0) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "List.init", - Error: new Error() - }; - } - 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 { + RE_EXN_ID: "Invalid_argument", + _1: "List.init", + Error: new Error() + }; } function flatten(param) { @@ -177,7 +176,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) @@ -188,7 +187,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) @@ -210,7 +209,7 @@ function rev_map(f, l) { } _param = param.tl; _accu = { - hd: Curry._1(f, param.hd), + hd: f(param.hd), tl: accu }; continue; @@ -223,7 +222,7 @@ function iter(f, _param) { if (!param) { return; } - Curry._1(f, param.hd); + f(param.hd); _param = param.tl; continue; }; @@ -238,7 +237,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; @@ -253,14 +252,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; } @@ -269,7 +268,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) @@ -304,7 +303,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; @@ -315,14 +314,14 @@ function rev_map2(f, l1, l2) { Error: new Error() }; } - if (l2$1) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2", - Error: new Error() - }; + if (!l2$1) { + return accu; } - return accu; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2", + Error: new Error() + }; }; } @@ -332,7 +331,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; @@ -363,7 +362,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 { @@ -372,21 +371,21 @@ function fold_left2(f, _accu, _l1, _l2) { Error: new Error() }; } - if (l2) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_left2", - Error: new Error() - }; + if (!l2) { + return accu; } - return accu; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2", + Error: new Error() + }; }; } 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 { RE_EXN_ID: "Invalid_argument", @@ -394,14 +393,14 @@ function fold_right2(f, l1, l2, accu) { Error: new Error() }; } - if (l2) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2", - Error: new Error() - }; + if (!l2) { + return accu; } - return accu; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2", + Error: new Error() + }; } function for_all(p, _param) { @@ -410,7 +409,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; @@ -424,7 +423,7 @@ function exists(p, _param) { if (!param) { return false; } - if (Curry._1(p, param.hd)) { + if (p(param.hd)) { return true; } _param = param.tl; @@ -438,7 +437,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; @@ -468,7 +467,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; @@ -651,7 +650,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; @@ -671,7 +670,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; @@ -679,29 +678,27 @@ function find_opt(p, _param) { }; } -function find_all(p) { - return function (param) { - let _accu = /* [] */0; - let _param = param; - while(true) { - let param$1 = _param; - let accu = _accu; - if (!param$1) { - return rev_append(accu, /* [] */0); - } - let l = param$1.tl; - let x = param$1.hd; - if (Curry._1(p, x)) { - _param = l; - _accu = { - hd: x, - tl: accu - }; - continue; - } - _param = l; +function find_all(p, l) { + let _accu = /* [] */0; + let _param = l; + while(true) { + let param = _param; + let accu = _accu; + if (!param) { + return rev_append(accu, /* [] */0); + } + let l$1 = param.tl; + let x = param.hd; + if (p(x)) { + _param = l$1; + _accu = { + hd: x, + tl: accu + }; continue; - }; + } + _param = l$1; + continue; }; } @@ -721,7 +718,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, @@ -795,7 +792,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) @@ -843,8 +840,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: { @@ -855,7 +852,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x1, x3) <= 0) { + } else if (cmp(x1, x3) <= 0) { return { hd: x1, tl: { @@ -878,7 +875,7 @@ function stable_sort(cmp, l) { } }; } - } else if (Curry._2(cmp, x1, x3) <= 0) { + } else if (cmp(x1, x3) <= 0) { return { hd: x2, tl: { @@ -889,7 +886,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x2, x3) <= 0) { + } else if (cmp(x2, x3) <= 0) { return { hd: x2, tl: { @@ -923,7 +920,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: { @@ -963,7 +960,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 @@ -989,8 +986,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: { @@ -1001,7 +998,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x1, x3) > 0) { + } else if (cmp(x1, x3) > 0) { return { hd: x1, tl: { @@ -1024,7 +1021,7 @@ function stable_sort(cmp, l) { } }; } - } else if (Curry._2(cmp, x1, x3) > 0) { + } else if (cmp(x1, x3) > 0) { return { hd: x2, tl: { @@ -1035,7 +1032,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x2, x3) > 0) { + } else if (cmp(x2, x3) > 0) { return { hd: x2, tl: { @@ -1069,7 +1066,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: { @@ -1109,7 +1106,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 @@ -1144,9 +1141,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, @@ -1171,7 +1168,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, @@ -1193,7 +1190,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, @@ -1226,7 +1223,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, @@ -1248,7 +1245,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, @@ -1291,7 +1288,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, @@ -1339,7 +1336,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, @@ -1375,9 +1372,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, @@ -1402,7 +1399,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, @@ -1424,7 +1421,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, @@ -1457,7 +1454,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, @@ -1479,7 +1476,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, @@ -1522,7 +1519,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, @@ -1570,7 +1567,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, diff --git a/lib/es6/listLabels.js b/lib/es6/listLabels.js index 6a1c78322d..81583b01cb 100644 --- a/lib/es6/listLabels.js +++ b/lib/es6/listLabels.js @@ -1,6 +1,5 @@ -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"; @@ -132,7 +131,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; @@ -143,7 +142,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) @@ -151,18 +150,18 @@ function init_aux(i, n, f) { } function init(len, f) { - if (len < 0) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "List.init", - Error: new Error() - }; - } - 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 { + RE_EXN_ID: "Invalid_argument", + _1: "List.init", + Error: new Error() + }; } function flatten(param) { @@ -177,7 +176,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) @@ -188,7 +187,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) @@ -210,7 +209,7 @@ function rev_map(f, l) { } _param = param.tl; _accu = { - hd: Curry._1(f, param.hd), + hd: f(param.hd), tl: accu }; continue; @@ -223,7 +222,7 @@ function iter(f, _param) { if (!param) { return; } - Curry._1(f, param.hd); + f(param.hd); _param = param.tl; continue; }; @@ -238,7 +237,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; @@ -253,14 +252,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; } @@ -269,7 +268,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) @@ -304,7 +303,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; @@ -315,14 +314,14 @@ function rev_map2(f, l1, l2) { Error: new Error() }; } - if (l2$1) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2", - Error: new Error() - }; + if (!l2$1) { + return accu; } - return accu; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2", + Error: new Error() + }; }; } @@ -332,7 +331,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; @@ -363,7 +362,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 { @@ -372,21 +371,21 @@ function fold_left2(f, _accu, _l1, _l2) { Error: new Error() }; } - if (l2) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_left2", - Error: new Error() - }; + if (!l2) { + return accu; } - return accu; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2", + Error: new Error() + }; }; } 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 { RE_EXN_ID: "Invalid_argument", @@ -394,14 +393,14 @@ function fold_right2(f, l1, l2, accu) { Error: new Error() }; } - if (l2) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2", - Error: new Error() - }; + if (!l2) { + return accu; } - return accu; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2", + Error: new Error() + }; } function for_all(p, _param) { @@ -410,7 +409,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; @@ -424,7 +423,7 @@ function exists(p, _param) { if (!param) { return false; } - if (Curry._1(p, param.hd)) { + if (p(param.hd)) { return true; } _param = param.tl; @@ -438,7 +437,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; @@ -468,7 +467,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; @@ -651,7 +650,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; @@ -671,7 +670,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; @@ -679,29 +678,27 @@ function find_opt(p, _param) { }; } -function find_all(p) { - return function (param) { - let _accu = /* [] */0; - let _param = param; - while(true) { - let param$1 = _param; - let accu = _accu; - if (!param$1) { - return rev_append(accu, /* [] */0); - } - let l = param$1.tl; - let x = param$1.hd; - if (Curry._1(p, x)) { - _param = l; - _accu = { - hd: x, - tl: accu - }; - continue; - } - _param = l; +function find_all(p, l) { + let _accu = /* [] */0; + let _param = l; + while(true) { + let param = _param; + let accu = _accu; + if (!param) { + return rev_append(accu, /* [] */0); + } + let l$1 = param.tl; + let x = param.hd; + if (p(x)) { + _param = l$1; + _accu = { + hd: x, + tl: accu + }; continue; - }; + } + _param = l$1; + continue; }; } @@ -721,7 +718,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, @@ -795,7 +792,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) @@ -843,8 +840,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: { @@ -855,7 +852,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x1, x3) <= 0) { + } else if (cmp(x1, x3) <= 0) { return { hd: x1, tl: { @@ -878,7 +875,7 @@ function stable_sort(cmp, l) { } }; } - } else if (Curry._2(cmp, x1, x3) <= 0) { + } else if (cmp(x1, x3) <= 0) { return { hd: x2, tl: { @@ -889,7 +886,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x2, x3) <= 0) { + } else if (cmp(x2, x3) <= 0) { return { hd: x2, tl: { @@ -923,7 +920,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: { @@ -963,7 +960,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 @@ -989,8 +986,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: { @@ -1001,7 +998,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x1, x3) > 0) { + } else if (cmp(x1, x3) > 0) { return { hd: x1, tl: { @@ -1024,7 +1021,7 @@ function stable_sort(cmp, l) { } }; } - } else if (Curry._2(cmp, x1, x3) > 0) { + } else if (cmp(x1, x3) > 0) { return { hd: x2, tl: { @@ -1035,7 +1032,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x2, x3) > 0) { + } else if (cmp(x2, x3) > 0) { return { hd: x2, tl: { @@ -1069,7 +1066,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: { @@ -1109,7 +1106,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 @@ -1144,9 +1141,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, @@ -1171,7 +1168,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, @@ -1193,7 +1190,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, @@ -1226,7 +1223,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, @@ -1248,7 +1245,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, @@ -1291,7 +1288,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, @@ -1339,7 +1336,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, @@ -1375,9 +1372,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, @@ -1402,7 +1399,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, @@ -1424,7 +1421,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, @@ -1457,7 +1454,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, @@ -1479,7 +1476,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, @@ -1522,7 +1519,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, @@ -1570,7 +1567,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, diff --git a/lib/es6/map.js b/lib/es6/map.js index 4caa3d1cef..6a91ba5fd5 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) { @@ -117,7 +116,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; @@ -156,7 +155,7 @@ function Make(funarg) { Error: new Error() }; } - let c = Curry._2(funarg.compare, x, param.v); + let c = funarg.compare(x, param.v); if (c === 0) { return param.d; } @@ -174,7 +173,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; @@ -189,7 +188,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; @@ -210,7 +209,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; @@ -225,7 +224,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; @@ -249,7 +248,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; @@ -264,7 +263,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; @@ -285,7 +284,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; @@ -300,7 +299,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; @@ -320,7 +319,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); } @@ -334,7 +333,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; } @@ -449,7 +448,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); } @@ -470,7 +469,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", @@ -488,9 +487,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); } @@ -530,7 +529,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; }; @@ -540,7 +539,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", @@ -557,7 +556,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", @@ -575,7 +574,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; }; @@ -586,7 +585,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)) { @@ -602,7 +601,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)) { @@ -672,7 +671,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, @@ -705,7 +704,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])); } } @@ -722,7 +721,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") { @@ -741,7 +740,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); } @@ -751,7 +750,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); } @@ -765,7 +764,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) { @@ -789,7 +788,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]; @@ -839,11 +838,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; } @@ -868,10 +867,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 445afe4557..2532b9eb82 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) { @@ -117,7 +116,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; @@ -156,7 +155,7 @@ function Make(Ord) { Error: new Error() }; } - let c = Curry._2(Ord.compare, x, param.v); + let c = Ord.compare(x, param.v); if (c === 0) { return param.d; } @@ -176,7 +175,7 @@ function Make(Ord) { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.l; _d0 = param.d; _v0 = v; @@ -196,7 +195,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; @@ -215,7 +214,7 @@ function Make(Ord) { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.l; _d0 = param.d; _v0 = v; @@ -232,7 +231,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; @@ -251,7 +250,7 @@ function Make(Ord) { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.r; _d0 = param.d; _v0 = v; @@ -271,7 +270,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; @@ -290,7 +289,7 @@ function Make(Ord) { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.r; _d0 = param.d; _v0 = v; @@ -307,7 +306,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; @@ -320,7 +319,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); } @@ -334,7 +333,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; } @@ -449,7 +448,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); } @@ -470,7 +469,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", @@ -488,9 +487,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); } @@ -530,7 +529,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; }; @@ -540,7 +539,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", @@ -557,7 +556,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", @@ -575,7 +574,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; }; @@ -586,7 +585,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)) { @@ -602,7 +601,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)) { @@ -672,7 +671,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, @@ -705,7 +704,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])); } } @@ -722,7 +721,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") { @@ -741,7 +740,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); } @@ -751,7 +750,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); } @@ -765,7 +764,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) { @@ -789,7 +788,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]; @@ -839,11 +838,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; } @@ -868,10 +867,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 a77c3216dc..d36cab5dd0 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"; @@ -147,7 +146,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; @@ -186,7 +185,7 @@ let $$Map = { Error: new Error() }; } - let c = Curry._2(funarg.compare, x, param.v); + let c = funarg.compare(x, param.v); if (c === 0) { return param.d; } @@ -206,7 +205,7 @@ let $$Map = { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.l; _d0 = param.d; _v0 = v; @@ -226,7 +225,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; @@ -245,7 +244,7 @@ let $$Map = { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.l; _d0 = param.d; _v0 = v; @@ -262,7 +261,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; @@ -281,7 +280,7 @@ let $$Map = { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.r; _d0 = param.d; _v0 = v; @@ -301,7 +300,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; @@ -320,7 +319,7 @@ let $$Map = { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.r; _d0 = param.d; _v0 = v; @@ -337,7 +336,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; @@ -350,7 +349,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); } @@ -364,7 +363,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; } @@ -479,7 +478,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); } @@ -500,7 +499,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", @@ -518,9 +517,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); } @@ -560,7 +559,7 @@ let $$Map = { return; } iter(f, param.l); - Curry._2(f, param.v, param.d); + f(param.v, param.d); _param = param.r; continue; }; @@ -570,7 +569,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", @@ -587,7 +586,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", @@ -605,7 +604,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; }; @@ -616,7 +615,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)) { @@ -632,7 +631,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)) { @@ -702,7 +701,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, @@ -735,7 +734,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])); } } @@ -752,7 +751,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") { @@ -771,7 +770,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); } @@ -781,7 +780,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); } @@ -795,7 +794,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) { @@ -819,7 +818,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]; @@ -869,11 +868,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; } @@ -898,10 +897,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); @@ -1070,7 +1069,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; } @@ -1235,7 +1234,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, @@ -1271,7 +1270,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; } @@ -1286,7 +1285,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); } @@ -1396,7 +1395,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; } @@ -1426,7 +1425,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; @@ -1468,7 +1467,7 @@ let $$Set = { return; } iter(f, param.l); - Curry._1(f, param.v); + f(param.v); _param = param.r; continue; }; @@ -1480,7 +1479,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; }; @@ -1491,7 +1490,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)) { @@ -1507,7 +1506,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)) { @@ -1525,7 +1524,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) { @@ -1548,7 +1547,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]; @@ -1599,7 +1598,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; } @@ -1615,7 +1614,7 @@ let $$Set = { return v0; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.l; _v0 = v; continue; @@ -1634,7 +1633,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; @@ -1649,7 +1648,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; @@ -1665,7 +1664,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; @@ -1680,7 +1679,7 @@ let $$Set = { return v0; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.r; _v0 = v; continue; @@ -1699,7 +1698,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; @@ -1714,7 +1713,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; @@ -1730,7 +1729,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; @@ -1744,7 +1743,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); } @@ -1753,7 +1752,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)); @@ -1767,7 +1766,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; @@ -1956,4 +1955,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 6e3c9d0597..b4c403f2af 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; @@ -107,7 +106,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){ @@ -125,7 +124,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; @@ -161,7 +160,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; @@ -178,7 +177,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); } @@ -190,11 +189,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; } @@ -207,7 +206,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 b78aff7d9c..62711d8580 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"; @@ -171,11 +170,11 @@ function $at(l1, l2) { } } -function print_newline(param) { +function print_newline() { console.log(""); } -function prerr_newline(param) { +function prerr_newline() { console.error(""); } @@ -184,7 +183,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) { @@ -199,14 +198,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/pervasivesU.js b/lib/es6/pervasivesU.js deleted file mode 100644 index bc7456a932..0000000000 --- a/lib/es6/pervasivesU.js +++ /dev/null @@ -1,268 +0,0 @@ - - -import * as Caml_sys from "./caml_sys.js"; -import * as Caml_format from "./caml_format.js"; -import * as Caml_string from "./caml_string.js"; -import * as Caml_exceptions from "./caml_exceptions.js"; -import * as Caml_js_exceptions from "./caml_js_exceptions.js"; - -let JsxModules = { - Jsx: undefined, - JsxEvent: undefined, - JsxDOM: undefined -}; - -function failwith(s) { - throw { - RE_EXN_ID: "Failure", - _1: s, - Error: new Error() - }; -} - -function invalid_arg(s) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: s, - Error: new Error() - }; -} - -let Exit = /* @__PURE__ */Caml_exceptions.create("PervasivesU.Exit"); - -function abs(x) { - if (x >= 0) { - return x; - } else { - return -x | 0; - } -} - -function lnot(x) { - return x ^ -1; -} - -let min_int = -2147483648; - -function classify_float(x) { - if (isFinite(x)) { - if (Math.abs(x) >= 2.22507385850720138e-308) { - return "FP_normal"; - } else if (x !== 0) { - return "FP_subnormal"; - } else { - return "FP_zero"; - } - } else if (isNaN(x)) { - return "FP_nan"; - } else { - return "FP_infinite"; - } -} - -function char_of_int(n) { - if (n < 0 || n > 255) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "char_of_int", - Error: new Error() - }; - } - return n; -} - -function string_of_bool(b) { - if (b) { - return "true"; - } else { - return "false"; - } -} - -function bool_of_string(param) { - switch (param) { - case "false" : - return false; - case "true" : - return true; - default: - throw { - RE_EXN_ID: "Invalid_argument", - _1: "bool_of_string", - Error: new Error() - }; - } -} - -function bool_of_string_opt(param) { - switch (param) { - case "false" : - return false; - case "true" : - return true; - default: - return; - } -} - -function int_of_string_opt(s) { - try { - return Caml_format.int_of_string(s); - } - catch (raw_exn){ - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); - if (exn.RE_EXN_ID === "Failure") { - return; - } - throw exn; - } -} - -function valid_float_lexem(s) { - let l = s.length; - let _i = 0; - while(true) { - let i = _i; - if (i >= l) { - return s + "."; - } - let match = Caml_string.get(s, i); - if (match >= 48) { - if (match >= 58) { - return s; - } - _i = i + 1 | 0; - continue; - } - if (match !== 45) { - return s; - } - _i = i + 1 | 0; - continue; - }; -} - -function string_of_float(f) { - return valid_float_lexem(Caml_format.format_float("%.12g", f)); -} - -function float_of_string_opt(s) { - try { - return Caml_format.float_of_string(s); - } - catch (raw_exn){ - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); - if (exn.RE_EXN_ID === "Failure") { - return; - } - throw exn; - } -} - -function $at(l1, l2) { - if (l1) { - return { - hd: l1.hd, - tl: $at(l1.tl, l2) - }; - } else { - return l2; - } -} - -function print_newline() { - console.log(""); -} - -function prerr_newline() { - console.error(""); -} - -function print_int(i) { - console.log(String(i)); -} - -function print_float(i) { - console.log(string_of_float(i)); -} - -function print_string(prim) { - console.log(prim); -} - -let exit_function = { - contents: (function (prim) { - - }) -}; - -function at_exit(f) { - let g = exit_function.contents; - exit_function.contents = (function () { - f(); - g(); - }); -} - -function exit(retcode) { - exit_function.contents(); - return Caml_sys.sys_exit(retcode); -} - -let Jsx; - -let JsxEvent; - -let JsxDOM; - -let JsxPPXReactSupport; - -let max_int = 2147483647; - -let infinity = Infinity; - -let neg_infinity = -Infinity; - -let max_float = 1.79769313486231571e+308; - -let min_float = 2.22507385850720138e-308; - -let epsilon_float = 2.22044604925031308e-16; - -export { - Jsx, - JsxEvent, - JsxDOM, - JsxPPXReactSupport, - JsxModules, - invalid_arg, - failwith, - Exit, - abs, - max_int, - min_int, - lnot, - infinity, - neg_infinity, - max_float, - min_float, - epsilon_float, - classify_float, - char_of_int, - string_of_bool, - bool_of_string, - bool_of_string_opt, - int_of_string_opt, - string_of_float, - float_of_string_opt, - $at, - print_string, - print_int, - print_float, - print_newline, - prerr_newline, - exit, - at_exit, - valid_float_lexem, -} -/* No side effect */ diff --git a/lib/es6/queue.js b/lib/es6/queue.js index 11051aa5b2..52a12f822b 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", @@ -115,7 +114,7 @@ function iter(f, q) { return; } let next = cell.next; - Curry._1(f, cell.content); + f(cell.content); _cell = next; continue; }; @@ -131,7 +130,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 58654de440..1b0d69c34e 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,61 +74,61 @@ function bits(s) { } function $$int(s, bound) { - if (bound > 1073741823 || bound <= 0) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Random.int", - Error: new Error() + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Random.int", + Error: new Error() }; } function int32(s, bound) { - if (bound <= 0) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Random.int32", - Error: new Error() + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Random.int32", + Error: new Error() }; } function int64(s, bound) { - if (Caml.i64_le(bound, Caml_int64.zero)) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Random.int64", - Error: new Error() + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Random.int64", + Error: new Error() }; } @@ -207,7 +207,7 @@ let $$default = { idx: 0 }; -function bits$1(param) { +function bits$1() { return bits($$default); } @@ -224,10 +224,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); } @@ -239,11 +239,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 97274c993f..090dfda109 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) { @@ -97,7 +96,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; } @@ -253,7 +252,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, @@ -289,7 +288,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; } @@ -304,7 +303,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; @@ -422,7 +421,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; } @@ -449,7 +448,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; @@ -491,7 +490,7 @@ function Make(funarg) { return; } iter(f, param.l); - Curry._1(f, param.v); + f(param.v); _param = param.r; continue; }; @@ -503,7 +502,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; }; @@ -514,7 +513,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)) { @@ -530,7 +529,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)) { @@ -548,7 +547,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) { @@ -571,7 +570,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]; @@ -622,7 +621,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; } @@ -640,7 +639,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) { @@ -650,7 +649,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; @@ -670,7 +669,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) { @@ -680,7 +679,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; @@ -703,7 +702,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) { @@ -713,7 +712,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; @@ -733,7 +732,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) { @@ -743,7 +742,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; @@ -763,7 +762,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); } @@ -779,11 +778,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 64e141dfd4..440455736b 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) { @@ -97,7 +96,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; } @@ -262,7 +261,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, @@ -298,7 +297,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; } @@ -313,7 +312,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); } @@ -423,7 +422,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; } @@ -453,7 +452,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; @@ -495,7 +494,7 @@ function Make(Ord) { return; } iter(f, param.l); - Curry._1(f, param.v); + f(param.v); _param = param.r; continue; }; @@ -507,7 +506,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; }; @@ -518,7 +517,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)) { @@ -534,7 +533,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)) { @@ -552,7 +551,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) { @@ -575,7 +574,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]; @@ -626,7 +625,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; } @@ -642,7 +641,7 @@ function Make(Ord) { return v0; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.l; _v0 = v; continue; @@ -661,7 +660,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; @@ -676,7 +675,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; @@ -692,7 +691,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; @@ -707,7 +706,7 @@ function Make(Ord) { return v0; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.r; _v0 = v; continue; @@ -726,7 +725,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; @@ -741,7 +740,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; @@ -757,7 +756,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; @@ -771,7 +770,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); } @@ -780,7 +779,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)); @@ -794,7 +793,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 2f4f8b4c1f..feb9e6ae43 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 { RE_EXN_ID: "Invalid_argument", _1: "Sort.array", @@ -122,10 +121,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) { @@ -147,10 +146,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 1f886bf6b9..2ae12c6064 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 9030e2155a..630b7c9c65 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"; @@ -83,7 +83,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", @@ -135,7 +135,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; @@ -255,17 +255,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) { @@ -360,10 +362,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) }; }) @@ -376,10 +378,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) }; }) @@ -392,10 +394,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" }; }) @@ -408,8 +410,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()); }) } }; @@ -423,7 +425,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 2cd1d65a20..054cc87779 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)); } } @@ -128,26 +127,26 @@ function index_opt(s, c) { function index_from(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from / Bytes.index_from", - Error: new Error() - }; + if (!(i < 0 || i > l)) { + return index_rec(s, l, i, c); } - return index_rec(s, l, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from", + Error: new Error() + }; } function index_from_opt(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from_opt / Bytes.index_from_opt", - Error: new Error() - }; + if (!(i < 0 || i > l)) { + return index_rec_opt(s, l, i, c); } - return index_rec_opt(s, l, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt", + Error: new Error() + }; } function rindex_rec(s, _i, c) { @@ -172,14 +171,14 @@ function rindex(s, c) { } function rindex_from(s, i, c) { - if (i < -1 || i >= s.length) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from / Bytes.rindex_from", - Error: new Error() - }; + if (!(i < -1 || i >= s.length)) { + return rindex_rec(s, i, c); } - return rindex_rec(s, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from", + Error: new Error() + }; } function rindex_rec_opt(s, _i, c) { @@ -201,14 +200,14 @@ function rindex_opt(s, c) { } function rindex_from_opt(s, i, c) { - if (i < -1 || i >= s.length) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from_opt / Bytes.rindex_from_opt", - Error: new Error() - }; + if (!(i < -1 || i >= s.length)) { + return rindex_rec_opt(s, i, c); } - return rindex_rec_opt(s, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt", + Error: new Error() + }; } function contains_from(s, i, c) { diff --git a/lib/es6/stringLabels.js b/lib/es6/stringLabels.js index 6c3f936fa9..38b579e635 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)); } } @@ -130,26 +131,26 @@ function index_opt(s, c) { function index_from(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from / Bytes.index_from", - Error: new Error() - }; + if (!(i < 0 || i > l)) { + return index_rec(s, l, i, c); } - return index_rec(s, l, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from", + Error: new Error() + }; } function index_from_opt(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from_opt / Bytes.index_from_opt", - Error: new Error() - }; + if (!(i < 0 || i > l)) { + return index_rec_opt(s, l, i, c); } - return index_rec_opt(s, l, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt", + Error: new Error() + }; } function rindex_rec(s, _i, c) { @@ -174,14 +175,14 @@ function rindex(s, c) { } function rindex_from(s, i, c) { - if (i < -1 || i >= s.length) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from / Bytes.rindex_from", - Error: new Error() - }; + if (!(i < -1 || i >= s.length)) { + return rindex_rec(s, i, c); } - return rindex_rec(s, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from", + Error: new Error() + }; } function rindex_rec_opt(s, _i, c) { @@ -203,14 +204,14 @@ function rindex_opt(s, c) { } function rindex_from_opt(s, i, c) { - if (i < -1 || i >= s.length) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from_opt / Bytes.rindex_from_opt", - Error: new Error() - }; + if (!(i < -1 || i >= s.length)) { + return rindex_rec_opt(s, i, c); } - return rindex_rec_opt(s, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt", + Error: new Error() + }; } function contains_from(s, i, c) { diff --git a/lib/es6/sys.js b/lib/es6/sys.js index 4560a77f53..75fb92a70a 100644 --- a/lib/es6/sys.js +++ b/lib/es6/sys.js @@ -45,14 +45,26 @@ 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 { + RE_EXN_ID: Break, + Error: new Error() + }; + }) + }); + } 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 8ffb9e2054..eb2e23e965 100644 --- a/lib/es6/uchar.js +++ b/lib/es6/uchar.js @@ -15,28 +15,28 @@ function succ(u) { if (u === 55295) { return 57344; } - if (u === 1114111) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "U+10FFFF has no successor", - Error: new Error() - }; + if (u !== 1114111) { + return u + 1 | 0; } - return u + 1 | 0; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "U+10FFFF has no successor", + Error: new Error() + }; } function pred(u) { if (u === 57344) { return 55295; } - if (u === 0) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "U+0000 has no predecessor", - Error: new Error() - }; + if (u !== 0) { + return u - 1 | 0; } - return u - 1 | 0; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "U+0000 has no predecessor", + Error: new Error() + }; } function is_valid(i) { diff --git a/lib/js/arg.js b/lib/js/arg.js index 4fd41bf5dc..6dd7c7a955 100644 --- a/lib/js/arg.js +++ b/lib/js/arg.js @@ -4,7 +4,6 @@ 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"); @@ -58,7 +57,7 @@ function make_symlist(prefix, sep, suffix, l) { } } -function help_action(param) { +function help_action() { throw { RE_EXN_ID: Stop, _1: { @@ -121,18 +120,18 @@ function add_help(speclist) { function usage_b(buf, speclist, errmsg) { $$Buffer.add_string(buf, errmsg + "\n"); - List.iter((function (param) { - let doc = param[2]; + List.iter((function (l) { + let doc = l[2]; if (doc.length === 0) { return; } - let spec = param[1]; - let key = param[0]; + let spec = l[1]; + let key = l[0]; if (spec.TAG !== "Symbol") { return $$Buffer.add_string(buf, " " + key + " " + doc + "\n"); } let sym = make_symlist("{", "|", "}", spec._0); - return $$Buffer.add_string(buf, " " + key + " " + sym + doc + "\n"); + $$Buffer.add_string(buf, " " + key + " " + sym + doc + "\n"); }), add_help(speclist)); } @@ -276,7 +275,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; } @@ -291,7 +290,7 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist Error: new Error() }; }; - let get_arg = function (param) { + let get_arg = function () { if (follow !== undefined) { return follow; } @@ -307,7 +306,7 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist Error: new Error() }; }; - let consume_arg = function (param) { + let consume_arg = function () { if (follow !== undefined) { return; } else { @@ -318,12 +317,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 { RE_EXN_ID: Stop, @@ -347,7 +346,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(); @@ -356,7 +355,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 { RE_EXN_ID: Stop, @@ -392,7 +391,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 { RE_EXN_ID: Stop, @@ -430,7 +429,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 { @@ -446,7 +445,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; @@ -459,7 +458,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); @@ -479,7 +478,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){ @@ -654,14 +653,14 @@ function align(limitOpt, speclist) { let completed = add_help(speclist); let len = List.fold_left(max_arg_len, 0, completed); let len$1 = len < limit ? len : limit; - return List.map((function (param) { - let spec = param[1]; - let kwd = param[0]; - if (param[2] === "") { - return param; + return List.map((function (l) { + let spec = l[1]; + let kwd = l[0]; + if (l[2] === "") { + return l; } if (spec.TAG === "Symbol") { - let msg = param[2]; + let msg = l[2]; let cutcol = second_word(msg); let spaces = " ".repeat(Caml.int_max(0, len$1 - cutcol | 0) + 3 | 0); return [ @@ -670,7 +669,7 @@ function align(limitOpt, speclist) { "\n" + (spaces + replace_leading_tab(msg)) ]; } - let msg$1 = param[2]; + let msg$1 = l[2]; let cutcol$1 = second_word(msg$1); let kwd_len = kwd.length; let diff = (len$1 - kwd_len | 0) - cutcol$1 | 0; diff --git a/lib/js/array.js b/lib/js/array.js index c615dd5f7e..8db9c895c6 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"); @@ -21,9 +20,9 @@ function init(l, f) { Error: new Error() }; } - 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; } @@ -57,14 +56,14 @@ function append(a1, a2) { } function sub(a, ofs, len) { - if (ofs < 0 || len < 0 || ofs > (a.length - len | 0)) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Array.sub", - Error: new Error() - }; + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Array.sub", + Error: new Error() + }; } function fill(a, ofs, len, v) { @@ -81,19 +80,19 @@ 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 { - RE_EXN_ID: "Invalid_argument", - _1: "Array.blit", - Error: new Error() - }; + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Array.blit", + Error: new Error() + }; } function iter(f, a) { for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ - Curry._1(f, a[i]); + f(a[i]); } } @@ -106,7 +105,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]); } } @@ -115,9 +114,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; } @@ -135,16 +134,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]); } } @@ -153,9 +152,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; } @@ -214,7 +213,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; } @@ -222,7 +221,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; } @@ -235,7 +234,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; @@ -251,7 +250,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; @@ -298,15 +297,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) { @@ -324,7 +323,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)); @@ -374,7 +373,7 @@ function sort(cmp, a) { Error: new Error() }; } - 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)); @@ -417,7 +416,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) { @@ -443,7 +442,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 ed3f4feae2..82732795d2 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"); @@ -21,9 +20,9 @@ function init(l, f) { Error: new Error() }; } - 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; } @@ -57,14 +56,14 @@ function append(a1, a2) { } function sub(a, ofs, len) { - if (ofs < 0 || len < 0 || ofs > (a.length - len | 0)) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Array.sub", - Error: new Error() - }; + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Array.sub", + Error: new Error() + }; } function fill(a, ofs, len, v) { @@ -81,19 +80,19 @@ 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 { - RE_EXN_ID: "Invalid_argument", - _1: "Array.blit", - Error: new Error() - }; + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Array.blit", + Error: new Error() + }; } function iter(f, a) { for(let i = 0 ,i_finish = a.length; i < i_finish; ++i){ - Curry._1(f, a[i]); + f(a[i]); } } @@ -106,7 +105,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]); } } @@ -115,9 +114,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; } @@ -135,16 +134,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]); } } @@ -153,9 +152,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; } @@ -214,7 +213,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; } @@ -222,7 +221,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; } @@ -235,7 +234,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; @@ -251,7 +250,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; @@ -298,15 +297,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) { @@ -324,7 +323,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)); @@ -374,7 +373,7 @@ function sort(cmp, a) { Error: new Error() }; } - 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)); @@ -417,7 +416,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) { @@ -443,7 +442,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 c20902dd62..b805fdd91b 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 Js_math = require("./js_math.js"); let Caml_option = require("./caml_option.js"); @@ -110,7 +109,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) { @@ -120,7 +121,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) { @@ -176,7 +179,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) { @@ -291,7 +296,9 @@ function forEachU(a, f) { } function forEach(a, f) { - forEachU(a, Curry.__1(f)); + forEachU(a, (function (a) { + f(a); + })); } function mapU(a, f) { @@ -304,7 +311,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) { @@ -312,7 +321,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) { @@ -330,7 +341,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) { @@ -348,7 +361,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) { @@ -368,7 +383,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) { @@ -388,7 +405,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) { @@ -409,7 +428,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) { @@ -419,7 +440,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) { @@ -432,7 +455,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) { @@ -444,7 +469,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) { @@ -456,7 +483,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) { @@ -469,7 +498,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) { @@ -481,7 +512,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) { @@ -501,7 +534,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) { @@ -521,7 +556,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) { @@ -543,7 +580,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) { @@ -563,7 +602,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) { @@ -577,7 +618,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) { @@ -605,7 +648,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) { @@ -633,7 +678,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) { @@ -672,7 +719,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) { @@ -684,7 +733,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 35818de614..569aba693a 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"); @@ -523,7 +522,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) { @@ -542,7 +543,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) { @@ -558,7 +561,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) { @@ -584,7 +589,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) { @@ -758,7 +765,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) { @@ -774,7 +783,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) { @@ -794,7 +805,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) { @@ -811,7 +824,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) { @@ -832,7 +847,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) { @@ -854,7 +871,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) { @@ -882,7 +901,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) { @@ -903,7 +924,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) { @@ -925,7 +948,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) { @@ -946,7 +971,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) { @@ -964,7 +991,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) { @@ -982,7 +1011,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) { @@ -1005,7 +1036,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) { @@ -1053,7 +1086,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) { @@ -1080,7 +1115,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) { @@ -1103,7 +1140,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) { @@ -1121,7 +1160,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) { @@ -1140,7 +1181,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) { @@ -1158,7 +1201,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) { @@ -1183,7 +1228,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) { @@ -1226,7 +1273,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) { @@ -1236,7 +1285,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) { @@ -1255,7 +1306,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) { @@ -1280,7 +1333,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) { @@ -1309,7 +1364,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) { @@ -1334,7 +1391,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) { @@ -1369,7 +1428,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 4503e343bc..ada059b414 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, @@ -175,7 +174,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) { @@ -200,7 +201,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) { @@ -220,7 +223,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 3f526210c8..08e72edbc3 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) { @@ -44,7 +47,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) { @@ -55,7 +60,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) { @@ -66,7 +73,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) { @@ -106,7 +115,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) { @@ -124,7 +135,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 b48d49f92a..4dbb5140c4 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") { @@ -21,7 +20,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) { @@ -39,7 +40,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) { @@ -54,7 +57,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) { @@ -96,7 +101,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) { @@ -114,7 +121,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 a68efe2605..1398e9c47e 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) { @@ -553,7 +562,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) { @@ -567,7 +578,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) { @@ -593,7 +606,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 2d7e6c11c2..f5847da1ce 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) { @@ -817,7 +836,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) { @@ -850,7 +871,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 023bb494f0..8b05835f9b 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"); @@ -209,7 +208,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) { @@ -251,7 +252,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) { @@ -286,7 +289,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 bd5107501a..fe06d43b4d 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"); @@ -209,7 +208,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) { @@ -251,7 +252,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) { @@ -286,7 +289,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 b0d8373923..af6bf4096e 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,36 +25,36 @@ function to_bytes(b) { } function sub(b, ofs, len) { - if (ofs < 0 || len < 0 || ofs > (b.position - len | 0)) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Buffer.sub", - Error: new Error() - }; + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.sub", + Error: new Error() + }; } 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 { - RE_EXN_ID: "Invalid_argument", - _1: "Buffer.blit", - Error: new Error() - }; + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.blit", + Error: new Error() + }; } function nth(b, ofs) { - if (ofs < 0 || ofs >= b.position) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Buffer.nth", - Error: new Error() - }; + if (!(ofs < 0 || ofs >= b.position)) { + return b.buffer[ofs]; } - return b.buffer[ofs]; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.nth", + Error: new Error() + }; } function length(b) { @@ -434,7 +433,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; @@ -442,14 +441,15 @@ function add_substitute(b, f, s) { } function truncate(b, len) { - if (len < 0 || len > b.position) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Buffer.truncate", - Error: new Error() - }; + if (!(len < 0 || len > b.position)) { + b.position = len; + return; } - b.position = len; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.truncate", + Error: new Error() + }; } exports.create = create; diff --git a/lib/js/bytes.js b/lib/js/bytes.js index 871b713ba1..e38744fb96 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; } @@ -147,14 +146,14 @@ function $plus$plus(a, b) { if (match$1) { return c; } - if (match$2) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.extend", - Error: new Error() - }; + if (!match$2) { + return c; } - return c; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.extend", + Error: new Error() + }; } function extend(s, left, right) { @@ -177,62 +176,63 @@ function extend(s, left, right) { } function fill(s, ofs, len, c) { - if (ofs < 0 || len < 0 || ofs > (s.length - len | 0)) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.fill / Bytes.fill", - Error: new Error() - }; + if (!(ofs < 0 || len < 0 || ofs > (s.length - len | 0))) { + return unsafe_fill(s, ofs, len, c); } - unsafe_fill(s, ofs, len, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.fill / Bytes.fill", + Error: new Error() + }; } 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 { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.blit", - Error: new Error() - }; + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.blit", + Error: new Error() + }; } 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 { - RE_EXN_ID: "Invalid_argument", - _1: "String.blit / Bytes.blit_string", - Error: new Error() - }; - } - 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 { + RE_EXN_ID: "Invalid_argument", + _1: "String.blit / Bytes.blit_string", + Error: new Error() + }; } 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]); } } @@ -439,7 +439,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; } @@ -451,7 +451,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; } @@ -469,7 +469,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; } @@ -522,26 +522,26 @@ function index_opt(s, c) { function index_from(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from / Bytes.index_from", - Error: new Error() - }; + if (!(i < 0 || i > l)) { + return index_rec(s, l, i, c); } - return index_rec(s, l, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from", + Error: new Error() + }; } function index_from_opt(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from_opt / Bytes.index_from_opt", - Error: new Error() - }; + if (!(i < 0 || i > l)) { + return index_rec_opt(s, l, i, c); } - return index_rec_opt(s, l, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt", + Error: new Error() + }; } function rindex_rec(s, _i, c) { @@ -566,14 +566,14 @@ function rindex(s, c) { } function rindex_from(s, i, c) { - if (i < -1 || i >= s.length) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from / Bytes.rindex_from", - Error: new Error() - }; + if (!(i < -1 || i >= s.length)) { + return rindex_rec(s, i, c); } - return rindex_rec(s, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from", + Error: new Error() + }; } function rindex_rec_opt(s, _i, c) { @@ -595,14 +595,14 @@ function rindex_opt(s, c) { } function rindex_from_opt(s, i, c) { - if (i < -1 || i >= s.length) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from_opt / Bytes.rindex_from_opt", - Error: new Error() - }; + if (!(i < -1 || i >= s.length)) { + return rindex_rec_opt(s, i, c); } - return rindex_rec_opt(s, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt", + Error: new Error() + }; } function contains_from(s, i, c) { diff --git a/lib/js/bytesLabels.js b/lib/js/bytesLabels.js index 871b713ba1..e38744fb96 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; } @@ -147,14 +146,14 @@ function $plus$plus(a, b) { if (match$1) { return c; } - if (match$2) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.extend", - Error: new Error() - }; + if (!match$2) { + return c; } - return c; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.extend", + Error: new Error() + }; } function extend(s, left, right) { @@ -177,62 +176,63 @@ function extend(s, left, right) { } function fill(s, ofs, len, c) { - if (ofs < 0 || len < 0 || ofs > (s.length - len | 0)) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.fill / Bytes.fill", - Error: new Error() - }; + if (!(ofs < 0 || len < 0 || ofs > (s.length - len | 0))) { + return unsafe_fill(s, ofs, len, c); } - unsafe_fill(s, ofs, len, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.fill / Bytes.fill", + Error: new Error() + }; } 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 { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.blit", - Error: new Error() - }; + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.blit", + Error: new Error() + }; } 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 { - RE_EXN_ID: "Invalid_argument", - _1: "String.blit / Bytes.blit_string", - Error: new Error() - }; - } - 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 { + RE_EXN_ID: "Invalid_argument", + _1: "String.blit / Bytes.blit_string", + Error: new Error() + }; } 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]); } } @@ -439,7 +439,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; } @@ -451,7 +451,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; } @@ -469,7 +469,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; } @@ -522,26 +522,26 @@ function index_opt(s, c) { function index_from(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from / Bytes.index_from", - Error: new Error() - }; + if (!(i < 0 || i > l)) { + return index_rec(s, l, i, c); } - return index_rec(s, l, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from", + Error: new Error() + }; } function index_from_opt(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from_opt / Bytes.index_from_opt", - Error: new Error() - }; + if (!(i < 0 || i > l)) { + return index_rec_opt(s, l, i, c); } - return index_rec_opt(s, l, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt", + Error: new Error() + }; } function rindex_rec(s, _i, c) { @@ -566,14 +566,14 @@ function rindex(s, c) { } function rindex_from(s, i, c) { - if (i < -1 || i >= s.length) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from / Bytes.rindex_from", - Error: new Error() - }; + if (!(i < -1 || i >= s.length)) { + return rindex_rec(s, i, c); } - return rindex_rec(s, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from", + Error: new Error() + }; } function rindex_rec_opt(s, _i, c) { @@ -595,14 +595,14 @@ function rindex_opt(s, c) { } function rindex_from_opt(s, i, c) { - if (i < -1 || i >= s.length) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from_opt / Bytes.rindex_from_opt", - Error: new Error() - }; + if (!(i < -1 || i >= s.length)) { + return rindex_rec_opt(s, i, c); } - return rindex_rec_opt(s, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt", + Error: new Error() + }; } 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_obj.js b/lib/js/caml_obj.js index 83c4bdf22e..d8490b2d88 100644 --- a/lib/js/caml_obj.js +++ b/lib/js/caml_obj.js @@ -225,21 +225,19 @@ function aux_obj_compare(a, b) { return; } }; - let partial_arg = [ - a, - b, - min_key_rhs - ]; - let do_key_a = function (param) { - return do_key(partial_arg, param); + let do_key_a = function (key) { + do_key([ + a, + b, + min_key_rhs + ], key); }; - let partial_arg$1 = [ - b, - a, - min_key_lhs - ]; - let do_key_b = function (param) { - return do_key(partial_arg$1, param); + let do_key_b = function (key) { + do_key([ + b, + a, + min_key_lhs + ], key); }; for_in(a, do_key_a); for_in(b, do_key_b); diff --git a/lib/js/caml_sys.js b/lib/js/caml_sys.js index aede4c5f7a..d2b6072de6 100644 --- a/lib/js/caml_sys.js +++ b/lib/js/caml_sys.js @@ -27,7 +27,7 @@ let os_type = (function(_){ } }); -function sys_time(param) { +function sys_time() { if (typeof process === "undefined" || process.uptime === undefined) { return -1; } else { @@ -42,7 +42,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 ee681e2de2..965aa98f47 100644 --- a/lib/js/char.js +++ b/lib/js/char.js @@ -3,14 +3,14 @@ let Bytes = require("./bytes.js"); function chr(n) { - if (n < 0 || n > 255) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Char.chr", - Error: new Error() - }; + if (!(n < 0 || n > 255)) { + return n; } - return n; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Char.chr", + Error: new Error() + }; } function escaped(param) { diff --git a/lib/js/curry.js b/lib/js/curry.js index df8a8980c4..51db824ba7 100644 --- a/lib/js/curry.js +++ b/lib/js/curry.js @@ -33,29 +33,29 @@ function _1(o, a0) { case 1 : return o(a0); case 2 : - return function (param) { - return o(a0, param); - }; + return (function (prim0, prim1, prim2) { + return prim0(prim1, prim2); + })(o, a0); case 3 : - return function (param, param$1) { - return o(a0, param, param$1); - }; + return (function (prim0, prim1, prim2, prim3) { + return prim0(prim1, prim2, prim3); + })(o, a0); case 4 : - return function (param, param$1, param$2) { - return o(a0, param, param$1, param$2); - }; + return (function (prim0, prim1, prim2, prim3, prim4) { + return prim0(prim1, prim2, prim3, prim4); + })(o, a0); case 5 : - return function (param, param$1, param$2, param$3) { - return o(a0, param, param$1, param$2, param$3); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5) { + return prim0(prim1, prim2, prim3, prim4, prim5); + })(o, a0); case 6 : - return function (param, param$1, param$2, param$3, param$4) { - return o(a0, param, param$1, param$2, param$3, param$4); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5, prim6) { + return prim0(prim1, prim2, prim3, prim4, prim5, prim6); + })(o, a0); case 7 : - return function (param, param$1, param$2, param$3, param$4, param$5) { - return o(a0, param, param$1, param$2, param$3, param$4, param$5); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5, prim6, prim7) { + return prim0(prim1, prim2, prim3, prim4, prim5, prim6, prim7); + })(o, a0); default: return app(o, [a0]); } @@ -84,25 +84,25 @@ function _2(o, a0, a1) { case 2 : return o(a0, a1); case 3 : - return function (param) { - return o(a0, a1, param); - }; + return (function (prim0, prim1, prim2, prim3) { + return prim0(prim1, prim2, prim3); + })(o, a0, a1); case 4 : - return function (param, param$1) { - return o(a0, a1, param, param$1); - }; + return (function (prim0, prim1, prim2, prim3, prim4) { + return prim0(prim1, prim2, prim3, prim4); + })(o, a0, a1); case 5 : - return function (param, param$1, param$2) { - return o(a0, a1, param, param$1, param$2); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5) { + return prim0(prim1, prim2, prim3, prim4, prim5); + })(o, a0, a1); case 6 : - return function (param, param$1, param$2, param$3) { - return o(a0, a1, param, param$1, param$2, param$3); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5, prim6) { + return prim0(prim1, prim2, prim3, prim4, prim5, prim6); + })(o, a0, a1); case 7 : - return function (param, param$1, param$2, param$3, param$4) { - return o(a0, a1, param, param$1, param$2, param$3, param$4); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5, prim6, prim7) { + return prim0(prim1, prim2, prim3, prim4, prim5, prim6, prim7); + })(o, a0, a1); default: return app(o, [ a0, @@ -139,21 +139,21 @@ function _3(o, a0, a1, a2) { case 3 : return o(a0, a1, a2); case 4 : - return function (param) { - return o(a0, a1, a2, param); - }; + return (function (prim0, prim1, prim2, prim3, prim4) { + return prim0(prim1, prim2, prim3, prim4); + })(o, a0, a1, a2); case 5 : - return function (param, param$1) { - return o(a0, a1, a2, param, param$1); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5) { + return prim0(prim1, prim2, prim3, prim4, prim5); + })(o, a0, a1, a2); case 6 : - return function (param, param$1, param$2) { - return o(a0, a1, a2, param, param$1, param$2); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5, prim6) { + return prim0(prim1, prim2, prim3, prim4, prim5, prim6); + })(o, a0, a1, a2); case 7 : - return function (param, param$1, param$2, param$3) { - return o(a0, a1, a2, param, param$1, param$2, param$3); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5, prim6, prim7) { + return prim0(prim1, prim2, prim3, prim4, prim5, prim6, prim7); + })(o, a0, a1, a2); default: return app(o, [ a0, @@ -197,17 +197,17 @@ function _4(o, a0, a1, a2, a3) { case 4 : return o(a0, a1, a2, a3); case 5 : - return function (param) { - return o(a0, a1, a2, a3, param); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5) { + return prim0(prim1, prim2, prim3, prim4, prim5); + })(o, a0, a1, a2, a3); case 6 : - return function (param, param$1) { - return o(a0, a1, a2, a3, param, param$1); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5, prim6) { + return prim0(prim1, prim2, prim3, prim4, prim5, prim6); + })(o, a0, a1, a2, a3); case 7 : - return function (param, param$1, param$2) { - return o(a0, a1, a2, a3, param, param$1, param$2); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5, prim6, prim7) { + return prim0(prim1, prim2, prim3, prim4, prim5, prim6, prim7); + })(o, a0, a1, a2, a3); default: return app(o, [ a0, @@ -259,13 +259,13 @@ function _5(o, a0, a1, a2, a3, a4) { case 5 : return o(a0, a1, a2, a3, a4); case 6 : - return function (param) { - return o(a0, a1, a2, a3, a4, param); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5, prim6) { + return prim0(prim1, prim2, prim3, prim4, prim5, prim6); + })(o, a0, a1, a2, a3, a4); case 7 : - return function (param, param$1) { - return o(a0, a1, a2, a3, a4, param, param$1); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5, prim6, prim7) { + return prim0(prim1, prim2, prim3, prim4, prim5, prim6, prim7); + })(o, a0, a1, a2, a3, a4); default: return app(o, [ a0, @@ -326,9 +326,9 @@ function _6(o, a0, a1, a2, a3, a4, a5) { case 6 : return o(a0, a1, a2, a3, a4, a5); case 7 : - return function (param) { - return o(a0, a1, a2, a3, a4, a5, param); - }; + return (function (prim0, prim1, prim2, prim3, prim4, prim5, prim6, prim7) { + return prim0(prim1, prim2, prim3, prim4, prim5, prim6, prim7); + })(o, a0, a1, a2, a3, a4, a5); default: return app(o, [ a0, diff --git a/lib/js/digest.js b/lib/js/digest.js index 3480dcfa39..c62bcdd921 100644 --- a/lib/js/digest.js +++ b/lib/js/digest.js @@ -16,14 +16,14 @@ function bytes(b) { } function substring(str, ofs, len) { - if (ofs < 0 || len < 0 || ofs > (str.length - len | 0)) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Digest.substring", - Error: new Error() - }; + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Digest.substring", + Error: new Error() + }; } function subbytes(b, ofs, len) { diff --git a/lib/js/filename.js b/lib/js/filename.js index 4418e933d9..8ce64cc18a 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; @@ -129,28 +127,28 @@ catch (raw_exn){ } } -function quote(param) { +function quote(a) { let quotequote = "'\\''"; - let l = param.length; + let l = a.length; let b = $$Buffer.create(l + 20 | 0); $$Buffer.add_char(b, /* '\'' */39); for(let i = 0; i < l; ++i){ - if (Caml_string.get(param, i) === /* '\'' */39) { + if (Caml_string.get(a, i) === /* '\'' */39) { $$Buffer.add_string(b, quotequote); } else { - $$Buffer.add_char(b, Caml_string.get(param, i)); + $$Buffer.add_char(b, Caml_string.get(a, i)); } } $$Buffer.add_char(b, /* '\'' */39); return $$Buffer.contents(b); } -function basename(param) { - return generic_basename(is_dir_sep, current_dir_name, param); +function basename(a) { + return generic_basename(is_dir_sep, current_dir_name, a); } -function dirname(param) { - return generic_dirname(is_dir_sep, current_dir_name, param); +function dirname(a) { + return generic_dirname(is_dir_sep, current_dir_name, a); } let current_dir_name$1 = "."; @@ -193,7 +191,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; @@ -306,12 +304,12 @@ function basename$1(s) { let current_dir_name$2 = "."; -function basename$2(param) { - return generic_basename(is_dir_sep$1, current_dir_name$2, param); +function basename$2(a) { + return generic_basename(is_dir_sep$1, current_dir_name$2, a); } -function dirname$2(param) { - return generic_dirname(is_dir_sep$1, current_dir_name$2, param); +function dirname$2(a) { + return generic_dirname(is_dir_sep$1, current_dir_name$2, a); } let match; @@ -371,7 +369,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); @@ -380,28 +378,28 @@ function concat(dirname, filename) { function chop_suffix(name, suff) { let n = name.length - suff.length | 0; - if (n < 0) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Filename.chop_suffix", - Error: new Error() - }; + if (n >= 0) { + return $$String.sub(name, 0, n); } - return $$String.sub(name, 0, n); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Filename.chop_suffix", + Error: new Error() + }; } 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) { @@ -427,14 +425,14 @@ function extension(name) { function chop_extension(name) { let l = extension_len(name); - if (l === 0) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Filename.chop_extension", - Error: new Error() - }; + if (l !== 0) { + return $$String.sub(name, 0, name.length - l | 0); } - return $$String.sub(name, 0, name.length - l | 0); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Filename.chop_extension", + Error: new Error() + }; } function remove_extension(name) { @@ -454,7 +452,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 c42d0df061..cdcdc1bf82 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,13 +35,13 @@ 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; } -function make_lexer(keywords) { +function make_lexer(keywords, input) { let kwd_table = Hashtbl.create(undefined, 17); List.iter((function (s) { Hashtbl.add(kwd_table, s, { @@ -100,8 +100,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(); @@ -165,11 +165,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 : @@ -180,7 +179,7 @@ function make_lexer(keywords) { case 55 : case 56 : case 57 : - exit = 4; + exit = 5; break; case 0 : case 1 : @@ -229,7 +228,7 @@ function make_lexer(keywords) { case 62 : case 63 : case 64 : - exit = 3; + exit = 4; break; } @@ -238,7 +237,7 @@ function make_lexer(keywords) { switch (c) { case 92 : case 94 : - exit = 3; + exit = 4; break; case 91 : case 93 : @@ -246,14 +245,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) { @@ -261,42 +260,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); @@ -308,80 +314,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 !== 124) { - return ident_or_keyword(get_string()); + } else if (c >= 65) { + if (c === 92) { + exit = 2; + } + + } 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) { @@ -417,6 +424,12 @@ function make_lexer(keywords) { }; }; } + if (exit === 2) { + Stream.junk(strm__); + store(/* 'E' */69); + return exponent_part(strm__); + } + } return { TAG: "Int", @@ -426,13 +439,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) { @@ -641,12 +656,10 @@ function make_lexer(keywords) { } }; }; - return function (input) { - return Stream.from(function (_count) { - return next_token(input); - }); - }; + return Stream.from(function (_count) { + return next_token(input); + }); } 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 3f46d16e4a..83dcf278c0 100644 --- a/lib/js/hashtbl.js +++ b/lib/js/hashtbl.js @@ -1,8 +1,8 @@ '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"); @@ -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(); }); @@ -177,7 +177,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); @@ -445,7 +445,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; }; @@ -489,7 +489,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); @@ -539,7 +539,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; }; @@ -601,7 +601,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); @@ -630,7 +630,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); @@ -655,7 +655,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") { @@ -667,7 +667,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") { @@ -679,7 +679,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; @@ -694,7 +694,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; @@ -710,7 +710,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") { @@ -719,7 +719,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") { @@ -728,7 +728,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; @@ -740,7 +740,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; @@ -758,7 +758,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) @@ -778,7 +778,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; @@ -815,7 +815,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; @@ -845,7 +845,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); @@ -874,7 +874,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); @@ -899,7 +899,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") { @@ -911,7 +911,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") { @@ -923,7 +923,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; @@ -938,7 +938,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; @@ -954,7 +954,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") { @@ -963,7 +963,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") { @@ -972,7 +972,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; @@ -984,7 +984,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; @@ -1002,7 +1002,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) @@ -1022,7 +1022,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; @@ -1059,7 +1059,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; @@ -1115,4 +1115,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 deleted file mode 100644 index 8da31ce1cf..0000000000 --- a/lib/js/js_array.js +++ /dev/null @@ -1,221 +0,0 @@ -'use strict'; - -let Curry = require("./curry.js"); -let Caml_option = require("./caml_option.js"); -let Caml_splice_call = require("./caml_splice_call.js"); - -function copyWithin(to_, obj) { - return obj.copyWithin(to_); -} - -function copyWithinFrom(to_, from, obj) { - return obj.copyWithin(to_, from); -} - -function copyWithinFromRange(to_, start, end_, obj) { - return obj.copyWithin(to_, start, end_); -} - -function fillInPlace(arg1, obj) { - return obj.fill(arg1); -} - -function fillFromInPlace(arg1, from, obj) { - return obj.fill(arg1, from); -} - -function fillRangeInPlace(arg1, start, end_, obj) { - return obj.fill(arg1, start, end_); -} - -function push(arg1, obj) { - return obj.push(arg1); -} - -function pushMany(arg1, obj) { - return Caml_splice_call.spliceObjApply(obj, "push", [arg1]); -} - -function sortInPlaceWith(arg1, obj) { - return obj.sort(Curry.__2(arg1)); -} - -function spliceInPlace(pos, remove, add, obj) { - return Caml_splice_call.spliceObjApply(obj, "splice", [ - pos, - remove, - add - ]); -} - -function removeFromInPlace(pos, obj) { - return obj.splice(pos); -} - -function removeCountInPlace(pos, count, obj) { - return obj.splice(pos, count); -} - -function unshift(arg1, obj) { - return obj.unshift(arg1); -} - -function unshiftMany(arg1, obj) { - return Caml_splice_call.spliceObjApply(obj, "unshift", [arg1]); -} - -function concat(arg1, obj) { - return obj.concat(arg1); -} - -function concatMany(arg1, obj) { - return Caml_splice_call.spliceObjApply(obj, "concat", [arg1]); -} - -function includes(arg1, obj) { - return obj.includes(arg1); -} - -function indexOf(arg1, obj) { - return obj.indexOf(arg1); -} - -function indexOfFrom(arg1, from, obj) { - return obj.indexOf(arg1, from); -} - -function joinWith(arg1, obj) { - return obj.join(arg1); -} - -function lastIndexOf(arg1, obj) { - return obj.lastIndexOf(arg1); -} - -function lastIndexOfFrom(arg1, from, obj) { - return obj.lastIndexOf(arg1, from); -} - -function slice(start, end_, obj) { - return obj.slice(start, end_); -} - -function sliceFrom(arg1, obj) { - return obj.slice(arg1); -} - -function every(arg1, obj) { - return obj.every(Curry.__1(arg1)); -} - -function everyi(arg1, obj) { - return obj.every(Curry.__2(arg1)); -} - -function filter(arg1, obj) { - return obj.filter(Curry.__1(arg1)); -} - -function filteri(arg1, obj) { - return obj.filter(Curry.__2(arg1)); -} - -function find(arg1, obj) { - return Caml_option.undefined_to_opt(obj.find(Curry.__1(arg1))); -} - -function findi(arg1, obj) { - return Caml_option.undefined_to_opt(obj.find(Curry.__2(arg1))); -} - -function findIndex(arg1, obj) { - return obj.findIndex(Curry.__1(arg1)); -} - -function findIndexi(arg1, obj) { - return obj.findIndex(Curry.__2(arg1)); -} - -function forEach(arg1, obj) { - obj.forEach(Curry.__1(arg1)); -} - -function forEachi(arg1, obj) { - obj.forEach(Curry.__2(arg1)); -} - -function map(arg1, obj) { - return obj.map(Curry.__1(arg1)); -} - -function mapi(arg1, obj) { - return obj.map(Curry.__2(arg1)); -} - -function reduce(arg1, arg2, obj) { - return obj.reduce(Curry.__2(arg1), arg2); -} - -function reducei(arg1, arg2, obj) { - return obj.reduce(Curry.__3(arg1), arg2); -} - -function reduceRight(arg1, arg2, obj) { - return obj.reduceRight(Curry.__2(arg1), arg2); -} - -function reduceRighti(arg1, arg2, obj) { - return obj.reduceRight(Curry.__3(arg1), arg2); -} - -function some(arg1, obj) { - return obj.some(Curry.__1(arg1)); -} - -function somei(arg1, obj) { - return obj.some(Curry.__2(arg1)); -} - -exports.copyWithin = copyWithin; -exports.copyWithinFrom = copyWithinFrom; -exports.copyWithinFromRange = copyWithinFromRange; -exports.fillInPlace = fillInPlace; -exports.fillFromInPlace = fillFromInPlace; -exports.fillRangeInPlace = fillRangeInPlace; -exports.push = push; -exports.pushMany = pushMany; -exports.sortInPlaceWith = sortInPlaceWith; -exports.spliceInPlace = spliceInPlace; -exports.removeFromInPlace = removeFromInPlace; -exports.removeCountInPlace = removeCountInPlace; -exports.unshift = unshift; -exports.unshiftMany = unshiftMany; -exports.concat = concat; -exports.concatMany = concatMany; -exports.includes = includes; -exports.indexOf = indexOf; -exports.indexOfFrom = indexOfFrom; -exports.joinWith = joinWith; -exports.lastIndexOf = lastIndexOf; -exports.lastIndexOfFrom = lastIndexOfFrom; -exports.slice = slice; -exports.sliceFrom = sliceFrom; -exports.every = every; -exports.everyi = everyi; -exports.filter = filter; -exports.filteri = filteri; -exports.find = find; -exports.findi = findi; -exports.findIndex = findIndex; -exports.findIndexi = findIndexi; -exports.forEach = forEach; -exports.forEachi = forEachi; -exports.map = map; -exports.mapi = mapi; -exports.reduce = reduce; -exports.reducei = reducei; -exports.reduceRight = reduceRight; -exports.reduceRighti = reduceRighti; -exports.some = some; -exports.somei = somei; -/* No side effect */ 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_; diff --git a/lib/js/js_string.js b/lib/js/js_string.js deleted file mode 100644 index 74854d2836..0000000000 --- a/lib/js/js_string.js +++ /dev/null @@ -1,197 +0,0 @@ -'use strict'; - -let Curry = require("./curry.js"); -let Caml_option = require("./caml_option.js"); -let Caml_splice_call = require("./caml_splice_call.js"); - -function charAt(arg1, obj) { - return obj.charAt(arg1); -} - -function charCodeAt(arg1, obj) { - return obj.charCodeAt(arg1); -} - -function codePointAt(arg1, obj) { - return obj.codePointAt(arg1); -} - -function concat(arg1, obj) { - return obj.concat(arg1); -} - -function concatMany(arg1, obj) { - return Caml_splice_call.spliceObjApply(obj, "concat", [arg1]); -} - -function endsWith(arg1, obj) { - return obj.endsWith(arg1); -} - -function endsWithFrom(arg1, arg2, obj) { - return obj.endsWith(arg1, arg2); -} - -function includes(arg1, obj) { - return obj.includes(arg1); -} - -function includesFrom(arg1, arg2, obj) { - return obj.includes(arg1, arg2); -} - -function indexOf(arg1, obj) { - return obj.indexOf(arg1); -} - -function indexOfFrom(arg1, arg2, obj) { - return obj.indexOf(arg1, arg2); -} - -function lastIndexOf(arg1, obj) { - return obj.lastIndexOf(arg1); -} - -function lastIndexOfFrom(arg1, arg2, obj) { - return obj.lastIndexOf(arg1, arg2); -} - -function localeCompare(arg1, obj) { - return obj.localeCompare(arg1); -} - -function match_(arg1, obj) { - return Caml_option.null_to_opt(obj.match(arg1)); -} - -function normalizeByForm(arg1, obj) { - return obj.normalize(arg1); -} - -function repeat(arg1, obj) { - return obj.repeat(arg1); -} - -function replace(arg1, arg2, obj) { - return obj.replace(arg1, arg2); -} - -function replaceByRe(arg1, arg2, obj) { - return obj.replace(arg1, arg2); -} - -function unsafeReplaceBy0(arg1, arg2, obj) { - return obj.replace(arg1, Curry.__3(arg2)); -} - -function unsafeReplaceBy1(arg1, arg2, obj) { - return obj.replace(arg1, Curry.__4(arg2)); -} - -function unsafeReplaceBy2(arg1, arg2, obj) { - return obj.replace(arg1, Curry.__5(arg2)); -} - -function unsafeReplaceBy3(arg1, arg2, obj) { - return obj.replace(arg1, Curry.__6(arg2)); -} - -function search(arg1, obj) { - return obj.search(arg1); -} - -function slice(from, to_, obj) { - return obj.slice(from, to_); -} - -function sliceToEnd(from, obj) { - return obj.slice(from); -} - -function split(arg1, obj) { - return obj.split(arg1); -} - -function splitAtMost(arg1, limit, obj) { - return obj.split(arg1, limit); -} - -function splitByRe(arg1, obj) { - return obj.split(arg1); -} - -function splitByReAtMost(arg1, limit, obj) { - return obj.split(arg1, limit); -} - -function startsWith(arg1, obj) { - return obj.startsWith(arg1); -} - -function startsWithFrom(arg1, arg2, obj) { - return obj.startsWith(arg1, arg2); -} - -function substr(from, obj) { - return obj.substr(from); -} - -function substrAtMost(from, length, obj) { - return obj.substr(from, length); -} - -function substring(from, to_, obj) { - return obj.substring(from, to_); -} - -function substringToEnd(from, obj) { - return obj.substring(from); -} - -function anchor(arg1, obj) { - return obj.anchor(arg1); -} - -function link(arg1, obj) { - return obj.link(arg1); -} - -exports.charAt = charAt; -exports.charCodeAt = charCodeAt; -exports.codePointAt = codePointAt; -exports.concat = concat; -exports.concatMany = concatMany; -exports.endsWith = endsWith; -exports.endsWithFrom = endsWithFrom; -exports.includes = includes; -exports.includesFrom = includesFrom; -exports.indexOf = indexOf; -exports.indexOfFrom = indexOfFrom; -exports.lastIndexOf = lastIndexOf; -exports.lastIndexOfFrom = lastIndexOfFrom; -exports.localeCompare = localeCompare; -exports.match_ = match_; -exports.normalizeByForm = normalizeByForm; -exports.repeat = repeat; -exports.replace = replace; -exports.replaceByRe = replaceByRe; -exports.unsafeReplaceBy0 = unsafeReplaceBy0; -exports.unsafeReplaceBy1 = unsafeReplaceBy1; -exports.unsafeReplaceBy2 = unsafeReplaceBy2; -exports.unsafeReplaceBy3 = unsafeReplaceBy3; -exports.search = search; -exports.slice = slice; -exports.sliceToEnd = sliceToEnd; -exports.split = split; -exports.splitAtMost = splitAtMost; -exports.splitByRe = splitByRe; -exports.splitByReAtMost = splitByReAtMost; -exports.startsWith = startsWith; -exports.startsWithFrom = startsWithFrom; -exports.substr = substr; -exports.substrAtMost = substrAtMost; -exports.substring = substring; -exports.substringToEnd = substringToEnd; -exports.anchor = anchor; -exports.link = link; -/* No side effect */ diff --git a/lib/js/js_typed_array.js b/lib/js/js_typed_array.js deleted file mode 100644 index cadb668ff9..0000000000 --- a/lib/js/js_typed_array.js +++ /dev/null @@ -1,1731 +0,0 @@ -'use strict'; - - -function slice(start, end_, obj) { - return obj.slice(start, end_); -} - -function sliceFrom(arg1, obj) { - return obj.slice(arg1); -} - -let $$ArrayBuffer = { - slice: slice, - sliceFrom: sliceFrom -}; - -function setArray(arg1, obj) { - obj.set(arg1); -} - -function setArrayOffset(arg1, arg2, obj) { - obj.set(arg1, arg2); -} - -function copyWithin(to_, obj) { - return obj.copyWithin(to_); -} - -function copyWithinFrom(to_, from, obj) { - return obj.copyWithin(to_, from); -} - -function copyWithinFromRange(to_, start, end_, obj) { - return obj.copyWithin(to_, start, end_); -} - -function fillInPlace(arg1, obj) { - return obj.fill(arg1); -} - -function fillFromInPlace(arg1, from, obj) { - return obj.fill(arg1, from); -} - -function fillRangeInPlace(arg1, start, end_, obj) { - return obj.fill(arg1, start, end_); -} - -function sortInPlaceWith(arg1, obj) { - return obj.sort(arg1); -} - -function includes(arg1, obj) { - return obj.includes(arg1); -} - -function indexOf(arg1, obj) { - return obj.indexOf(arg1); -} - -function indexOfFrom(arg1, from, obj) { - return obj.indexOf(arg1, from); -} - -function joinWith(arg1, obj) { - return obj.join(arg1); -} - -function lastIndexOf(arg1, obj) { - return obj.lastIndexOf(arg1); -} - -function lastIndexOfFrom(arg1, from, obj) { - return obj.lastIndexOf(arg1, from); -} - -function slice$1(start, end_, obj) { - return obj.slice(start, end_); -} - -function sliceFrom$1(arg1, obj) { - return obj.slice(arg1); -} - -function subarray(start, end_, obj) { - return obj.subarray(start, end_); -} - -function subarrayFrom(arg1, obj) { - return obj.subarray(arg1); -} - -function every(arg1, obj) { - return obj.every(arg1); -} - -function everyi(arg1, obj) { - return obj.every(arg1); -} - -function filter(arg1, obj) { - return obj.filter(arg1); -} - -function filteri(arg1, obj) { - return obj.filter(arg1); -} - -function find(arg1, obj) { - return obj.find(arg1); -} - -function findi(arg1, obj) { - return obj.find(arg1); -} - -function findIndex(arg1, obj) { - return obj.findIndex(arg1); -} - -function findIndexi(arg1, obj) { - return obj.findIndex(arg1); -} - -function forEach(arg1, obj) { - obj.forEach(arg1); -} - -function forEachi(arg1, obj) { - obj.forEach(arg1); -} - -function map(arg1, obj) { - return obj.map(arg1); -} - -function mapi(arg1, obj) { - return obj.map(arg1); -} - -function reduce(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reducei(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reduceRight(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function reduceRighti(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function some(arg1, obj) { - return obj.some(arg1); -} - -function somei(arg1, obj) { - return obj.some(arg1); -} - -let $$Int8Array = { - setArray: setArray, - setArrayOffset: setArrayOffset, - copyWithin: copyWithin, - copyWithinFrom: copyWithinFrom, - copyWithinFromRange: copyWithinFromRange, - fillInPlace: fillInPlace, - fillFromInPlace: fillFromInPlace, - fillRangeInPlace: fillRangeInPlace, - sortInPlaceWith: sortInPlaceWith, - includes: includes, - indexOf: indexOf, - indexOfFrom: indexOfFrom, - joinWith: joinWith, - lastIndexOf: lastIndexOf, - lastIndexOfFrom: lastIndexOfFrom, - slice: slice$1, - sliceFrom: sliceFrom$1, - subarray: subarray, - subarrayFrom: subarrayFrom, - every: every, - everyi: everyi, - filter: filter, - filteri: filteri, - find: find, - findi: findi, - findIndex: findIndex, - findIndexi: findIndexi, - forEach: forEach, - forEachi: forEachi, - map: map, - mapi: mapi, - reduce: reduce, - reducei: reducei, - reduceRight: reduceRight, - reduceRighti: reduceRighti, - some: some, - somei: somei -}; - -function setArray$1(arg1, obj) { - obj.set(arg1); -} - -function setArrayOffset$1(arg1, arg2, obj) { - obj.set(arg1, arg2); -} - -function copyWithin$1(to_, obj) { - return obj.copyWithin(to_); -} - -function copyWithinFrom$1(to_, from, obj) { - return obj.copyWithin(to_, from); -} - -function copyWithinFromRange$1(to_, start, end_, obj) { - return obj.copyWithin(to_, start, end_); -} - -function fillInPlace$1(arg1, obj) { - return obj.fill(arg1); -} - -function fillFromInPlace$1(arg1, from, obj) { - return obj.fill(arg1, from); -} - -function fillRangeInPlace$1(arg1, start, end_, obj) { - return obj.fill(arg1, start, end_); -} - -function sortInPlaceWith$1(arg1, obj) { - return obj.sort(arg1); -} - -function includes$1(arg1, obj) { - return obj.includes(arg1); -} - -function indexOf$1(arg1, obj) { - return obj.indexOf(arg1); -} - -function indexOfFrom$1(arg1, from, obj) { - return obj.indexOf(arg1, from); -} - -function joinWith$1(arg1, obj) { - return obj.join(arg1); -} - -function lastIndexOf$1(arg1, obj) { - return obj.lastIndexOf(arg1); -} - -function lastIndexOfFrom$1(arg1, from, obj) { - return obj.lastIndexOf(arg1, from); -} - -function slice$2(start, end_, obj) { - return obj.slice(start, end_); -} - -function sliceFrom$2(arg1, obj) { - return obj.slice(arg1); -} - -function subarray$1(start, end_, obj) { - return obj.subarray(start, end_); -} - -function subarrayFrom$1(arg1, obj) { - return obj.subarray(arg1); -} - -function every$1(arg1, obj) { - return obj.every(arg1); -} - -function everyi$1(arg1, obj) { - return obj.every(arg1); -} - -function filter$1(arg1, obj) { - return obj.filter(arg1); -} - -function filteri$1(arg1, obj) { - return obj.filter(arg1); -} - -function find$1(arg1, obj) { - return obj.find(arg1); -} - -function findi$1(arg1, obj) { - return obj.find(arg1); -} - -function findIndex$1(arg1, obj) { - return obj.findIndex(arg1); -} - -function findIndexi$1(arg1, obj) { - return obj.findIndex(arg1); -} - -function forEach$1(arg1, obj) { - obj.forEach(arg1); -} - -function forEachi$1(arg1, obj) { - obj.forEach(arg1); -} - -function map$1(arg1, obj) { - return obj.map(arg1); -} - -function mapi$1(arg1, obj) { - return obj.map(arg1); -} - -function reduce$1(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reducei$1(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reduceRight$1(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function reduceRighti$1(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function some$1(arg1, obj) { - return obj.some(arg1); -} - -function somei$1(arg1, obj) { - return obj.some(arg1); -} - -let $$Uint8Array = { - setArray: setArray$1, - setArrayOffset: setArrayOffset$1, - copyWithin: copyWithin$1, - copyWithinFrom: copyWithinFrom$1, - copyWithinFromRange: copyWithinFromRange$1, - fillInPlace: fillInPlace$1, - fillFromInPlace: fillFromInPlace$1, - fillRangeInPlace: fillRangeInPlace$1, - sortInPlaceWith: sortInPlaceWith$1, - includes: includes$1, - indexOf: indexOf$1, - indexOfFrom: indexOfFrom$1, - joinWith: joinWith$1, - lastIndexOf: lastIndexOf$1, - lastIndexOfFrom: lastIndexOfFrom$1, - slice: slice$2, - sliceFrom: sliceFrom$2, - subarray: subarray$1, - subarrayFrom: subarrayFrom$1, - every: every$1, - everyi: everyi$1, - filter: filter$1, - filteri: filteri$1, - find: find$1, - findi: findi$1, - findIndex: findIndex$1, - findIndexi: findIndexi$1, - forEach: forEach$1, - forEachi: forEachi$1, - map: map$1, - mapi: mapi$1, - reduce: reduce$1, - reducei: reducei$1, - reduceRight: reduceRight$1, - reduceRighti: reduceRighti$1, - some: some$1, - somei: somei$1 -}; - -function setArray$2(arg1, obj) { - obj.set(arg1); -} - -function setArrayOffset$2(arg1, arg2, obj) { - obj.set(arg1, arg2); -} - -function copyWithin$2(to_, obj) { - return obj.copyWithin(to_); -} - -function copyWithinFrom$2(to_, from, obj) { - return obj.copyWithin(to_, from); -} - -function copyWithinFromRange$2(to_, start, end_, obj) { - return obj.copyWithin(to_, start, end_); -} - -function fillInPlace$2(arg1, obj) { - return obj.fill(arg1); -} - -function fillFromInPlace$2(arg1, from, obj) { - return obj.fill(arg1, from); -} - -function fillRangeInPlace$2(arg1, start, end_, obj) { - return obj.fill(arg1, start, end_); -} - -function sortInPlaceWith$2(arg1, obj) { - return obj.sort(arg1); -} - -function includes$2(arg1, obj) { - return obj.includes(arg1); -} - -function indexOf$2(arg1, obj) { - return obj.indexOf(arg1); -} - -function indexOfFrom$2(arg1, from, obj) { - return obj.indexOf(arg1, from); -} - -function joinWith$2(arg1, obj) { - return obj.join(arg1); -} - -function lastIndexOf$2(arg1, obj) { - return obj.lastIndexOf(arg1); -} - -function lastIndexOfFrom$2(arg1, from, obj) { - return obj.lastIndexOf(arg1, from); -} - -function slice$3(start, end_, obj) { - return obj.slice(start, end_); -} - -function sliceFrom$3(arg1, obj) { - return obj.slice(arg1); -} - -function subarray$2(start, end_, obj) { - return obj.subarray(start, end_); -} - -function subarrayFrom$2(arg1, obj) { - return obj.subarray(arg1); -} - -function every$2(arg1, obj) { - return obj.every(arg1); -} - -function everyi$2(arg1, obj) { - return obj.every(arg1); -} - -function filter$2(arg1, obj) { - return obj.filter(arg1); -} - -function filteri$2(arg1, obj) { - return obj.filter(arg1); -} - -function find$2(arg1, obj) { - return obj.find(arg1); -} - -function findi$2(arg1, obj) { - return obj.find(arg1); -} - -function findIndex$2(arg1, obj) { - return obj.findIndex(arg1); -} - -function findIndexi$2(arg1, obj) { - return obj.findIndex(arg1); -} - -function forEach$2(arg1, obj) { - obj.forEach(arg1); -} - -function forEachi$2(arg1, obj) { - obj.forEach(arg1); -} - -function map$2(arg1, obj) { - return obj.map(arg1); -} - -function mapi$2(arg1, obj) { - return obj.map(arg1); -} - -function reduce$2(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reducei$2(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reduceRight$2(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function reduceRighti$2(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function some$2(arg1, obj) { - return obj.some(arg1); -} - -function somei$2(arg1, obj) { - return obj.some(arg1); -} - -let $$Uint8ClampedArray = { - setArray: setArray$2, - setArrayOffset: setArrayOffset$2, - copyWithin: copyWithin$2, - copyWithinFrom: copyWithinFrom$2, - copyWithinFromRange: copyWithinFromRange$2, - fillInPlace: fillInPlace$2, - fillFromInPlace: fillFromInPlace$2, - fillRangeInPlace: fillRangeInPlace$2, - sortInPlaceWith: sortInPlaceWith$2, - includes: includes$2, - indexOf: indexOf$2, - indexOfFrom: indexOfFrom$2, - joinWith: joinWith$2, - lastIndexOf: lastIndexOf$2, - lastIndexOfFrom: lastIndexOfFrom$2, - slice: slice$3, - sliceFrom: sliceFrom$3, - subarray: subarray$2, - subarrayFrom: subarrayFrom$2, - every: every$2, - everyi: everyi$2, - filter: filter$2, - filteri: filteri$2, - find: find$2, - findi: findi$2, - findIndex: findIndex$2, - findIndexi: findIndexi$2, - forEach: forEach$2, - forEachi: forEachi$2, - map: map$2, - mapi: mapi$2, - reduce: reduce$2, - reducei: reducei$2, - reduceRight: reduceRight$2, - reduceRighti: reduceRighti$2, - some: some$2, - somei: somei$2 -}; - -function setArray$3(arg1, obj) { - obj.set(arg1); -} - -function setArrayOffset$3(arg1, arg2, obj) { - obj.set(arg1, arg2); -} - -function copyWithin$3(to_, obj) { - return obj.copyWithin(to_); -} - -function copyWithinFrom$3(to_, from, obj) { - return obj.copyWithin(to_, from); -} - -function copyWithinFromRange$3(to_, start, end_, obj) { - return obj.copyWithin(to_, start, end_); -} - -function fillInPlace$3(arg1, obj) { - return obj.fill(arg1); -} - -function fillFromInPlace$3(arg1, from, obj) { - return obj.fill(arg1, from); -} - -function fillRangeInPlace$3(arg1, start, end_, obj) { - return obj.fill(arg1, start, end_); -} - -function sortInPlaceWith$3(arg1, obj) { - return obj.sort(arg1); -} - -function includes$3(arg1, obj) { - return obj.includes(arg1); -} - -function indexOf$3(arg1, obj) { - return obj.indexOf(arg1); -} - -function indexOfFrom$3(arg1, from, obj) { - return obj.indexOf(arg1, from); -} - -function joinWith$3(arg1, obj) { - return obj.join(arg1); -} - -function lastIndexOf$3(arg1, obj) { - return obj.lastIndexOf(arg1); -} - -function lastIndexOfFrom$3(arg1, from, obj) { - return obj.lastIndexOf(arg1, from); -} - -function slice$4(start, end_, obj) { - return obj.slice(start, end_); -} - -function sliceFrom$4(arg1, obj) { - return obj.slice(arg1); -} - -function subarray$3(start, end_, obj) { - return obj.subarray(start, end_); -} - -function subarrayFrom$3(arg1, obj) { - return obj.subarray(arg1); -} - -function every$3(arg1, obj) { - return obj.every(arg1); -} - -function everyi$3(arg1, obj) { - return obj.every(arg1); -} - -function filter$3(arg1, obj) { - return obj.filter(arg1); -} - -function filteri$3(arg1, obj) { - return obj.filter(arg1); -} - -function find$3(arg1, obj) { - return obj.find(arg1); -} - -function findi$3(arg1, obj) { - return obj.find(arg1); -} - -function findIndex$3(arg1, obj) { - return obj.findIndex(arg1); -} - -function findIndexi$3(arg1, obj) { - return obj.findIndex(arg1); -} - -function forEach$3(arg1, obj) { - obj.forEach(arg1); -} - -function forEachi$3(arg1, obj) { - obj.forEach(arg1); -} - -function map$3(arg1, obj) { - return obj.map(arg1); -} - -function mapi$3(arg1, obj) { - return obj.map(arg1); -} - -function reduce$3(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reducei$3(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reduceRight$3(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function reduceRighti$3(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function some$3(arg1, obj) { - return obj.some(arg1); -} - -function somei$3(arg1, obj) { - return obj.some(arg1); -} - -let $$Int16Array = { - setArray: setArray$3, - setArrayOffset: setArrayOffset$3, - copyWithin: copyWithin$3, - copyWithinFrom: copyWithinFrom$3, - copyWithinFromRange: copyWithinFromRange$3, - fillInPlace: fillInPlace$3, - fillFromInPlace: fillFromInPlace$3, - fillRangeInPlace: fillRangeInPlace$3, - sortInPlaceWith: sortInPlaceWith$3, - includes: includes$3, - indexOf: indexOf$3, - indexOfFrom: indexOfFrom$3, - joinWith: joinWith$3, - lastIndexOf: lastIndexOf$3, - lastIndexOfFrom: lastIndexOfFrom$3, - slice: slice$4, - sliceFrom: sliceFrom$4, - subarray: subarray$3, - subarrayFrom: subarrayFrom$3, - every: every$3, - everyi: everyi$3, - filter: filter$3, - filteri: filteri$3, - find: find$3, - findi: findi$3, - findIndex: findIndex$3, - findIndexi: findIndexi$3, - forEach: forEach$3, - forEachi: forEachi$3, - map: map$3, - mapi: mapi$3, - reduce: reduce$3, - reducei: reducei$3, - reduceRight: reduceRight$3, - reduceRighti: reduceRighti$3, - some: some$3, - somei: somei$3 -}; - -function setArray$4(arg1, obj) { - obj.set(arg1); -} - -function setArrayOffset$4(arg1, arg2, obj) { - obj.set(arg1, arg2); -} - -function copyWithin$4(to_, obj) { - return obj.copyWithin(to_); -} - -function copyWithinFrom$4(to_, from, obj) { - return obj.copyWithin(to_, from); -} - -function copyWithinFromRange$4(to_, start, end_, obj) { - return obj.copyWithin(to_, start, end_); -} - -function fillInPlace$4(arg1, obj) { - return obj.fill(arg1); -} - -function fillFromInPlace$4(arg1, from, obj) { - return obj.fill(arg1, from); -} - -function fillRangeInPlace$4(arg1, start, end_, obj) { - return obj.fill(arg1, start, end_); -} - -function sortInPlaceWith$4(arg1, obj) { - return obj.sort(arg1); -} - -function includes$4(arg1, obj) { - return obj.includes(arg1); -} - -function indexOf$4(arg1, obj) { - return obj.indexOf(arg1); -} - -function indexOfFrom$4(arg1, from, obj) { - return obj.indexOf(arg1, from); -} - -function joinWith$4(arg1, obj) { - return obj.join(arg1); -} - -function lastIndexOf$4(arg1, obj) { - return obj.lastIndexOf(arg1); -} - -function lastIndexOfFrom$4(arg1, from, obj) { - return obj.lastIndexOf(arg1, from); -} - -function slice$5(start, end_, obj) { - return obj.slice(start, end_); -} - -function sliceFrom$5(arg1, obj) { - return obj.slice(arg1); -} - -function subarray$4(start, end_, obj) { - return obj.subarray(start, end_); -} - -function subarrayFrom$4(arg1, obj) { - return obj.subarray(arg1); -} - -function every$4(arg1, obj) { - return obj.every(arg1); -} - -function everyi$4(arg1, obj) { - return obj.every(arg1); -} - -function filter$4(arg1, obj) { - return obj.filter(arg1); -} - -function filteri$4(arg1, obj) { - return obj.filter(arg1); -} - -function find$4(arg1, obj) { - return obj.find(arg1); -} - -function findi$4(arg1, obj) { - return obj.find(arg1); -} - -function findIndex$4(arg1, obj) { - return obj.findIndex(arg1); -} - -function findIndexi$4(arg1, obj) { - return obj.findIndex(arg1); -} - -function forEach$4(arg1, obj) { - obj.forEach(arg1); -} - -function forEachi$4(arg1, obj) { - obj.forEach(arg1); -} - -function map$4(arg1, obj) { - return obj.map(arg1); -} - -function mapi$4(arg1, obj) { - return obj.map(arg1); -} - -function reduce$4(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reducei$4(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reduceRight$4(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function reduceRighti$4(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function some$4(arg1, obj) { - return obj.some(arg1); -} - -function somei$4(arg1, obj) { - return obj.some(arg1); -} - -let $$Uint16Array = { - setArray: setArray$4, - setArrayOffset: setArrayOffset$4, - copyWithin: copyWithin$4, - copyWithinFrom: copyWithinFrom$4, - copyWithinFromRange: copyWithinFromRange$4, - fillInPlace: fillInPlace$4, - fillFromInPlace: fillFromInPlace$4, - fillRangeInPlace: fillRangeInPlace$4, - sortInPlaceWith: sortInPlaceWith$4, - includes: includes$4, - indexOf: indexOf$4, - indexOfFrom: indexOfFrom$4, - joinWith: joinWith$4, - lastIndexOf: lastIndexOf$4, - lastIndexOfFrom: lastIndexOfFrom$4, - slice: slice$5, - sliceFrom: sliceFrom$5, - subarray: subarray$4, - subarrayFrom: subarrayFrom$4, - every: every$4, - everyi: everyi$4, - filter: filter$4, - filteri: filteri$4, - find: find$4, - findi: findi$4, - findIndex: findIndex$4, - findIndexi: findIndexi$4, - forEach: forEach$4, - forEachi: forEachi$4, - map: map$4, - mapi: mapi$4, - reduce: reduce$4, - reducei: reducei$4, - reduceRight: reduceRight$4, - reduceRighti: reduceRighti$4, - some: some$4, - somei: somei$4 -}; - -function setArray$5(arg1, obj) { - obj.set(arg1); -} - -function setArrayOffset$5(arg1, arg2, obj) { - obj.set(arg1, arg2); -} - -function copyWithin$5(to_, obj) { - return obj.copyWithin(to_); -} - -function copyWithinFrom$5(to_, from, obj) { - return obj.copyWithin(to_, from); -} - -function copyWithinFromRange$5(to_, start, end_, obj) { - return obj.copyWithin(to_, start, end_); -} - -function fillInPlace$5(arg1, obj) { - return obj.fill(arg1); -} - -function fillFromInPlace$5(arg1, from, obj) { - return obj.fill(arg1, from); -} - -function fillRangeInPlace$5(arg1, start, end_, obj) { - return obj.fill(arg1, start, end_); -} - -function sortInPlaceWith$5(arg1, obj) { - return obj.sort(arg1); -} - -function includes$5(arg1, obj) { - return obj.includes(arg1); -} - -function indexOf$5(arg1, obj) { - return obj.indexOf(arg1); -} - -function indexOfFrom$5(arg1, from, obj) { - return obj.indexOf(arg1, from); -} - -function joinWith$5(arg1, obj) { - return obj.join(arg1); -} - -function lastIndexOf$5(arg1, obj) { - return obj.lastIndexOf(arg1); -} - -function lastIndexOfFrom$5(arg1, from, obj) { - return obj.lastIndexOf(arg1, from); -} - -function slice$6(start, end_, obj) { - return obj.slice(start, end_); -} - -function sliceFrom$6(arg1, obj) { - return obj.slice(arg1); -} - -function subarray$5(start, end_, obj) { - return obj.subarray(start, end_); -} - -function subarrayFrom$5(arg1, obj) { - return obj.subarray(arg1); -} - -function every$5(arg1, obj) { - return obj.every(arg1); -} - -function everyi$5(arg1, obj) { - return obj.every(arg1); -} - -function filter$5(arg1, obj) { - return obj.filter(arg1); -} - -function filteri$5(arg1, obj) { - return obj.filter(arg1); -} - -function find$5(arg1, obj) { - return obj.find(arg1); -} - -function findi$5(arg1, obj) { - return obj.find(arg1); -} - -function findIndex$5(arg1, obj) { - return obj.findIndex(arg1); -} - -function findIndexi$5(arg1, obj) { - return obj.findIndex(arg1); -} - -function forEach$5(arg1, obj) { - obj.forEach(arg1); -} - -function forEachi$5(arg1, obj) { - obj.forEach(arg1); -} - -function map$5(arg1, obj) { - return obj.map(arg1); -} - -function mapi$5(arg1, obj) { - return obj.map(arg1); -} - -function reduce$5(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reducei$5(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reduceRight$5(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function reduceRighti$5(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function some$5(arg1, obj) { - return obj.some(arg1); -} - -function somei$5(arg1, obj) { - return obj.some(arg1); -} - -let $$Int32Array = { - setArray: setArray$5, - setArrayOffset: setArrayOffset$5, - copyWithin: copyWithin$5, - copyWithinFrom: copyWithinFrom$5, - copyWithinFromRange: copyWithinFromRange$5, - fillInPlace: fillInPlace$5, - fillFromInPlace: fillFromInPlace$5, - fillRangeInPlace: fillRangeInPlace$5, - sortInPlaceWith: sortInPlaceWith$5, - includes: includes$5, - indexOf: indexOf$5, - indexOfFrom: indexOfFrom$5, - joinWith: joinWith$5, - lastIndexOf: lastIndexOf$5, - lastIndexOfFrom: lastIndexOfFrom$5, - slice: slice$6, - sliceFrom: sliceFrom$6, - subarray: subarray$5, - subarrayFrom: subarrayFrom$5, - every: every$5, - everyi: everyi$5, - filter: filter$5, - filteri: filteri$5, - find: find$5, - findi: findi$5, - findIndex: findIndex$5, - findIndexi: findIndexi$5, - forEach: forEach$5, - forEachi: forEachi$5, - map: map$5, - mapi: mapi$5, - reduce: reduce$5, - reducei: reducei$5, - reduceRight: reduceRight$5, - reduceRighti: reduceRighti$5, - some: some$5, - somei: somei$5 -}; - -function setArray$6(arg1, obj) { - obj.set(arg1); -} - -function setArrayOffset$6(arg1, arg2, obj) { - obj.set(arg1, arg2); -} - -function copyWithin$6(to_, obj) { - return obj.copyWithin(to_); -} - -function copyWithinFrom$6(to_, from, obj) { - return obj.copyWithin(to_, from); -} - -function copyWithinFromRange$6(to_, start, end_, obj) { - return obj.copyWithin(to_, start, end_); -} - -function fillInPlace$6(arg1, obj) { - return obj.fill(arg1); -} - -function fillFromInPlace$6(arg1, from, obj) { - return obj.fill(arg1, from); -} - -function fillRangeInPlace$6(arg1, start, end_, obj) { - return obj.fill(arg1, start, end_); -} - -function sortInPlaceWith$6(arg1, obj) { - return obj.sort(arg1); -} - -function includes$6(arg1, obj) { - return obj.includes(arg1); -} - -function indexOf$6(arg1, obj) { - return obj.indexOf(arg1); -} - -function indexOfFrom$6(arg1, from, obj) { - return obj.indexOf(arg1, from); -} - -function joinWith$6(arg1, obj) { - return obj.join(arg1); -} - -function lastIndexOf$6(arg1, obj) { - return obj.lastIndexOf(arg1); -} - -function lastIndexOfFrom$6(arg1, from, obj) { - return obj.lastIndexOf(arg1, from); -} - -function slice$7(start, end_, obj) { - return obj.slice(start, end_); -} - -function sliceFrom$7(arg1, obj) { - return obj.slice(arg1); -} - -function subarray$6(start, end_, obj) { - return obj.subarray(start, end_); -} - -function subarrayFrom$6(arg1, obj) { - return obj.subarray(arg1); -} - -function every$6(arg1, obj) { - return obj.every(arg1); -} - -function everyi$6(arg1, obj) { - return obj.every(arg1); -} - -function filter$6(arg1, obj) { - return obj.filter(arg1); -} - -function filteri$6(arg1, obj) { - return obj.filter(arg1); -} - -function find$6(arg1, obj) { - return obj.find(arg1); -} - -function findi$6(arg1, obj) { - return obj.find(arg1); -} - -function findIndex$6(arg1, obj) { - return obj.findIndex(arg1); -} - -function findIndexi$6(arg1, obj) { - return obj.findIndex(arg1); -} - -function forEach$6(arg1, obj) { - obj.forEach(arg1); -} - -function forEachi$6(arg1, obj) { - obj.forEach(arg1); -} - -function map$6(arg1, obj) { - return obj.map(arg1); -} - -function mapi$6(arg1, obj) { - return obj.map(arg1); -} - -function reduce$6(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reducei$6(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reduceRight$6(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function reduceRighti$6(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function some$6(arg1, obj) { - return obj.some(arg1); -} - -function somei$6(arg1, obj) { - return obj.some(arg1); -} - -let $$Uint32Array = { - setArray: setArray$6, - setArrayOffset: setArrayOffset$6, - copyWithin: copyWithin$6, - copyWithinFrom: copyWithinFrom$6, - copyWithinFromRange: copyWithinFromRange$6, - fillInPlace: fillInPlace$6, - fillFromInPlace: fillFromInPlace$6, - fillRangeInPlace: fillRangeInPlace$6, - sortInPlaceWith: sortInPlaceWith$6, - includes: includes$6, - indexOf: indexOf$6, - indexOfFrom: indexOfFrom$6, - joinWith: joinWith$6, - lastIndexOf: lastIndexOf$6, - lastIndexOfFrom: lastIndexOfFrom$6, - slice: slice$7, - sliceFrom: sliceFrom$7, - subarray: subarray$6, - subarrayFrom: subarrayFrom$6, - every: every$6, - everyi: everyi$6, - filter: filter$6, - filteri: filteri$6, - find: find$6, - findi: findi$6, - findIndex: findIndex$6, - findIndexi: findIndexi$6, - forEach: forEach$6, - forEachi: forEachi$6, - map: map$6, - mapi: mapi$6, - reduce: reduce$6, - reducei: reducei$6, - reduceRight: reduceRight$6, - reduceRighti: reduceRighti$6, - some: some$6, - somei: somei$6 -}; - -function setArray$7(arg1, obj) { - obj.set(arg1); -} - -function setArrayOffset$7(arg1, arg2, obj) { - obj.set(arg1, arg2); -} - -function copyWithin$7(to_, obj) { - return obj.copyWithin(to_); -} - -function copyWithinFrom$7(to_, from, obj) { - return obj.copyWithin(to_, from); -} - -function copyWithinFromRange$7(to_, start, end_, obj) { - return obj.copyWithin(to_, start, end_); -} - -function fillInPlace$7(arg1, obj) { - return obj.fill(arg1); -} - -function fillFromInPlace$7(arg1, from, obj) { - return obj.fill(arg1, from); -} - -function fillRangeInPlace$7(arg1, start, end_, obj) { - return obj.fill(arg1, start, end_); -} - -function sortInPlaceWith$7(arg1, obj) { - return obj.sort(arg1); -} - -function includes$7(arg1, obj) { - return obj.includes(arg1); -} - -function indexOf$7(arg1, obj) { - return obj.indexOf(arg1); -} - -function indexOfFrom$7(arg1, from, obj) { - return obj.indexOf(arg1, from); -} - -function joinWith$7(arg1, obj) { - return obj.join(arg1); -} - -function lastIndexOf$7(arg1, obj) { - return obj.lastIndexOf(arg1); -} - -function lastIndexOfFrom$7(arg1, from, obj) { - return obj.lastIndexOf(arg1, from); -} - -function slice$8(start, end_, obj) { - return obj.slice(start, end_); -} - -function sliceFrom$8(arg1, obj) { - return obj.slice(arg1); -} - -function subarray$7(start, end_, obj) { - return obj.subarray(start, end_); -} - -function subarrayFrom$7(arg1, obj) { - return obj.subarray(arg1); -} - -function every$7(arg1, obj) { - return obj.every(arg1); -} - -function everyi$7(arg1, obj) { - return obj.every(arg1); -} - -function filter$7(arg1, obj) { - return obj.filter(arg1); -} - -function filteri$7(arg1, obj) { - return obj.filter(arg1); -} - -function find$7(arg1, obj) { - return obj.find(arg1); -} - -function findi$7(arg1, obj) { - return obj.find(arg1); -} - -function findIndex$7(arg1, obj) { - return obj.findIndex(arg1); -} - -function findIndexi$7(arg1, obj) { - return obj.findIndex(arg1); -} - -function forEach$7(arg1, obj) { - obj.forEach(arg1); -} - -function forEachi$7(arg1, obj) { - obj.forEach(arg1); -} - -function map$7(arg1, obj) { - return obj.map(arg1); -} - -function mapi$7(arg1, obj) { - return obj.map(arg1); -} - -function reduce$7(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reducei$7(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reduceRight$7(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function reduceRighti$7(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function some$7(arg1, obj) { - return obj.some(arg1); -} - -function somei$7(arg1, obj) { - return obj.some(arg1); -} - -let $$Float32Array = { - setArray: setArray$7, - setArrayOffset: setArrayOffset$7, - copyWithin: copyWithin$7, - copyWithinFrom: copyWithinFrom$7, - copyWithinFromRange: copyWithinFromRange$7, - fillInPlace: fillInPlace$7, - fillFromInPlace: fillFromInPlace$7, - fillRangeInPlace: fillRangeInPlace$7, - sortInPlaceWith: sortInPlaceWith$7, - includes: includes$7, - indexOf: indexOf$7, - indexOfFrom: indexOfFrom$7, - joinWith: joinWith$7, - lastIndexOf: lastIndexOf$7, - lastIndexOfFrom: lastIndexOfFrom$7, - slice: slice$8, - sliceFrom: sliceFrom$8, - subarray: subarray$7, - subarrayFrom: subarrayFrom$7, - every: every$7, - everyi: everyi$7, - filter: filter$7, - filteri: filteri$7, - find: find$7, - findi: findi$7, - findIndex: findIndex$7, - findIndexi: findIndexi$7, - forEach: forEach$7, - forEachi: forEachi$7, - map: map$7, - mapi: mapi$7, - reduce: reduce$7, - reducei: reducei$7, - reduceRight: reduceRight$7, - reduceRighti: reduceRighti$7, - some: some$7, - somei: somei$7 -}; - -function setArray$8(arg1, obj) { - obj.set(arg1); -} - -function setArrayOffset$8(arg1, arg2, obj) { - obj.set(arg1, arg2); -} - -function copyWithin$8(to_, obj) { - return obj.copyWithin(to_); -} - -function copyWithinFrom$8(to_, from, obj) { - return obj.copyWithin(to_, from); -} - -function copyWithinFromRange$8(to_, start, end_, obj) { - return obj.copyWithin(to_, start, end_); -} - -function fillInPlace$8(arg1, obj) { - return obj.fill(arg1); -} - -function fillFromInPlace$8(arg1, from, obj) { - return obj.fill(arg1, from); -} - -function fillRangeInPlace$8(arg1, start, end_, obj) { - return obj.fill(arg1, start, end_); -} - -function sortInPlaceWith$8(arg1, obj) { - return obj.sort(arg1); -} - -function includes$8(arg1, obj) { - return obj.includes(arg1); -} - -function indexOf$8(arg1, obj) { - return obj.indexOf(arg1); -} - -function indexOfFrom$8(arg1, from, obj) { - return obj.indexOf(arg1, from); -} - -function joinWith$8(arg1, obj) { - return obj.join(arg1); -} - -function lastIndexOf$8(arg1, obj) { - return obj.lastIndexOf(arg1); -} - -function lastIndexOfFrom$8(arg1, from, obj) { - return obj.lastIndexOf(arg1, from); -} - -function slice$9(start, end_, obj) { - return obj.slice(start, end_); -} - -function sliceFrom$9(arg1, obj) { - return obj.slice(arg1); -} - -function subarray$8(start, end_, obj) { - return obj.subarray(start, end_); -} - -function subarrayFrom$8(arg1, obj) { - return obj.subarray(arg1); -} - -function every$8(arg1, obj) { - return obj.every(arg1); -} - -function everyi$8(arg1, obj) { - return obj.every(arg1); -} - -function filter$8(arg1, obj) { - return obj.filter(arg1); -} - -function filteri$8(arg1, obj) { - return obj.filter(arg1); -} - -function find$8(arg1, obj) { - return obj.find(arg1); -} - -function findi$8(arg1, obj) { - return obj.find(arg1); -} - -function findIndex$8(arg1, obj) { - return obj.findIndex(arg1); -} - -function findIndexi$8(arg1, obj) { - return obj.findIndex(arg1); -} - -function forEach$8(arg1, obj) { - obj.forEach(arg1); -} - -function forEachi$8(arg1, obj) { - obj.forEach(arg1); -} - -function map$8(arg1, obj) { - return obj.map(arg1); -} - -function mapi$8(arg1, obj) { - return obj.map(arg1); -} - -function reduce$8(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reducei$8(arg1, arg2, obj) { - return obj.reduce(arg1, arg2); -} - -function reduceRight$8(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function reduceRighti$8(arg1, arg2, obj) { - return obj.reduceRight(arg1, arg2); -} - -function some$8(arg1, obj) { - return obj.some(arg1); -} - -function somei$8(arg1, obj) { - return obj.some(arg1); -} - -let $$Float64Array = { - setArray: setArray$8, - setArrayOffset: setArrayOffset$8, - copyWithin: copyWithin$8, - copyWithinFrom: copyWithinFrom$8, - copyWithinFromRange: copyWithinFromRange$8, - fillInPlace: fillInPlace$8, - fillFromInPlace: fillFromInPlace$8, - fillRangeInPlace: fillRangeInPlace$8, - sortInPlaceWith: sortInPlaceWith$8, - includes: includes$8, - indexOf: indexOf$8, - indexOfFrom: indexOfFrom$8, - joinWith: joinWith$8, - lastIndexOf: lastIndexOf$8, - lastIndexOfFrom: lastIndexOfFrom$8, - slice: slice$9, - sliceFrom: sliceFrom$9, - subarray: subarray$8, - subarrayFrom: subarrayFrom$8, - every: every$8, - everyi: everyi$8, - filter: filter$8, - filteri: filteri$8, - find: find$8, - findi: findi$8, - findIndex: findIndex$8, - findIndexi: findIndexi$8, - forEach: forEach$8, - forEachi: forEachi$8, - map: map$8, - mapi: mapi$8, - reduce: reduce$8, - reducei: reducei$8, - reduceRight: reduceRight$8, - reduceRighti: reduceRighti$8, - some: some$8, - somei: somei$8 -}; - -let $$DataView = {}; - -let Int32_array; - -let Float32_array; - -let Float64_array; - -exports.$$ArrayBuffer = $$ArrayBuffer; -exports.$$Int8Array = $$Int8Array; -exports.$$Uint8Array = $$Uint8Array; -exports.$$Uint8ClampedArray = $$Uint8ClampedArray; -exports.$$Int16Array = $$Int16Array; -exports.$$Uint16Array = $$Uint16Array; -exports.$$Int32Array = $$Int32Array; -exports.Int32_array = Int32_array; -exports.$$Uint32Array = $$Uint32Array; -exports.$$Float32Array = $$Float32Array; -exports.Float32_array = Float32_array; -exports.$$Float64Array = $$Float64Array; -exports.Float64_array = Float64_array; -exports.$$DataView = $$DataView; -/* No side effect */ diff --git a/lib/es6/jsxDOMU.js b/lib/js/jsx.js similarity index 100% rename from lib/es6/jsxDOMU.js rename to lib/js/jsx.js diff --git a/lib/js/jsxC.js b/lib/js/jsxC.js deleted file mode 100644 index ae1b9f17e6..0000000000 --- a/lib/js/jsxC.js +++ /dev/null @@ -1 +0,0 @@ -/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */ diff --git a/lib/es6/jsxU.js b/lib/js/jsxDOM.js similarity index 100% rename from lib/es6/jsxU.js rename to lib/js/jsxDOM.js diff --git a/lib/js/jsxDOMC.js b/lib/js/jsxDOMC.js deleted file mode 100644 index ae1b9f17e6..0000000000 --- a/lib/js/jsxDOMC.js +++ /dev/null @@ -1 +0,0 @@ -/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */ diff --git a/lib/js/jsxDOMU.js b/lib/js/jsxDOMU.js deleted file mode 100644 index ae1b9f17e6..0000000000 --- a/lib/js/jsxDOMU.js +++ /dev/null @@ -1 +0,0 @@ -/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */ diff --git a/lib/js/jsxEventC.js b/lib/js/jsxEvent.js similarity index 100% rename from lib/js/jsxEventC.js rename to lib/js/jsxEvent.js diff --git a/lib/js/jsxEventU.js b/lib/js/jsxEventU.js deleted file mode 100644 index 8570b3b8d5..0000000000 --- a/lib/js/jsxEventU.js +++ /dev/null @@ -1,57 +0,0 @@ -'use strict'; - - -function MakeEventWithType(Type) { - return {}; -} - -let Synthetic = {}; - -let Clipboard = {}; - -let Composition = {}; - -let Keyboard = {}; - -let Focus = {}; - -let Form = {}; - -let Mouse = {}; - -let Pointer = {}; - -let $$Selection = {}; - -let $$Touch = {}; - -let UI = {}; - -let Wheel = {}; - -let Media = {}; - -let $$Image = {}; - -let $$Animation = {}; - -let Transition = {}; - -exports.MakeEventWithType = MakeEventWithType; -exports.Synthetic = Synthetic; -exports.Clipboard = Clipboard; -exports.Composition = Composition; -exports.Keyboard = Keyboard; -exports.Focus = Focus; -exports.Form = Form; -exports.Mouse = Mouse; -exports.Pointer = Pointer; -exports.$$Selection = $$Selection; -exports.$$Touch = $$Touch; -exports.UI = UI; -exports.Wheel = Wheel; -exports.Media = Media; -exports.$$Image = $$Image; -exports.$$Animation = $$Animation; -exports.Transition = Transition; -/* No side effect */ diff --git a/lib/js/jsxPPXReactSupportC.js b/lib/js/jsxPPXReactSupport.js similarity index 95% rename from lib/js/jsxPPXReactSupportC.js rename to lib/js/jsxPPXReactSupport.js index ec0aec1033..dcf807669c 100644 --- a/lib/js/jsxPPXReactSupportC.js +++ b/lib/js/jsxPPXReactSupport.js @@ -19,9 +19,6 @@ function createElementVariadicWithKey(key, component, props, elements) { ]); } -let Jsx; - -exports.Jsx = Jsx; exports.createElementWithKey = createElementWithKey; exports.createElementVariadicWithKey = createElementVariadicWithKey; /* react Not a pure module */ diff --git a/lib/js/jsxPPXReactSupportU.js b/lib/js/jsxPPXReactSupportU.js deleted file mode 100644 index ec0aec1033..0000000000 --- a/lib/js/jsxPPXReactSupportU.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict'; - -let React = require("react"); -let Caml_splice_call = require("./caml_splice_call.js"); - -function createElementWithKey(key, component, props) { - return React.createElement(component, key !== undefined ? Object.assign({ - key: key - }, props) : props); -} - -function createElementVariadicWithKey(key, component, props, elements) { - return Caml_splice_call.spliceApply(React.createElement, [ - component, - key !== undefined ? Object.assign({ - key: key - }, props) : props, - elements - ]); -} - -let Jsx; - -exports.Jsx = Jsx; -exports.createElementWithKey = createElementWithKey; -exports.createElementVariadicWithKey = createElementVariadicWithKey; -/* react Not a pure module */ diff --git a/lib/js/jsxU.js b/lib/js/jsxU.js deleted file mode 100644 index ae1b9f17e6..0000000000 --- a/lib/js/jsxU.js +++ /dev/null @@ -1 +0,0 @@ -/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */ 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 7e6fa564a9..ffb8f359ce 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"); @@ -44,17 +43,17 @@ let zero_pos = { }; function from_function(f) { - let partial_arg = Caml_bytes.create(512); return { - refill_buff: (function (param) { - let read = Curry._2(f, partial_arg, partial_arg.length); - let n = read > 0 ? read : (param.lex_eof_reached = true, 0); - if ((param.lex_buffer_len + n | 0) > param.lex_buffer.length) { - if (((param.lex_buffer_len - param.lex_start_pos | 0) + n | 0) <= param.lex_buffer.length) { - Bytes.blit(param.lex_buffer, param.lex_start_pos, param.lex_buffer, 0, param.lex_buffer_len - param.lex_start_pos | 0); + refill_buff: (function (a) { + let aux_buffer = Caml_bytes.create(512); + let read = f(aux_buffer, aux_buffer.length); + let n = read > 0 ? read : (a.lex_eof_reached = true, 0); + if ((a.lex_buffer_len + n | 0) > a.lex_buffer.length) { + if (((a.lex_buffer_len - a.lex_start_pos | 0) + n | 0) <= a.lex_buffer.length) { + Bytes.blit(a.lex_buffer, a.lex_start_pos, a.lex_buffer, 0, a.lex_buffer_len - a.lex_start_pos | 0); } else { - let newlen = (param.lex_buffer.length << 1); - if (((param.lex_buffer_len - param.lex_start_pos | 0) + n | 0) > newlen) { + let newlen = (a.lex_buffer.length << 1); + if (((a.lex_buffer_len - a.lex_start_pos | 0) + n | 0) > newlen) { throw { RE_EXN_ID: "Failure", _1: "Lexing.lex_refill: cannot grow buffer", @@ -62,16 +61,16 @@ function from_function(f) { }; } let newbuf = Caml_bytes.create(newlen); - Bytes.blit(param.lex_buffer, param.lex_start_pos, newbuf, 0, param.lex_buffer_len - param.lex_start_pos | 0); - param.lex_buffer = newbuf; + Bytes.blit(a.lex_buffer, a.lex_start_pos, newbuf, 0, a.lex_buffer_len - a.lex_start_pos | 0); + a.lex_buffer = newbuf; } - let s = param.lex_start_pos; - param.lex_abs_pos = param.lex_abs_pos + s | 0; - param.lex_curr_pos = param.lex_curr_pos - s | 0; - param.lex_start_pos = 0; - param.lex_last_pos = param.lex_last_pos - s | 0; - param.lex_buffer_len = param.lex_buffer_len - s | 0; - let t = param.lex_mem; + let s = a.lex_start_pos; + a.lex_abs_pos = a.lex_abs_pos + s | 0; + a.lex_curr_pos = a.lex_curr_pos - s | 0; + a.lex_start_pos = 0; + a.lex_last_pos = a.lex_last_pos - s | 0; + a.lex_buffer_len = a.lex_buffer_len - s | 0; + let t = a.lex_mem; for(let i = 0 ,i_finish = t.length; i < i_finish; ++i){ let v = Caml_array.get(t, i); if (v >= 0) { @@ -80,8 +79,8 @@ function from_function(f) { } } - Bytes.blit(partial_arg, 0, param.lex_buffer, param.lex_buffer_len, n); - param.lex_buffer_len = param.lex_buffer_len + n | 0; + Bytes.blit(aux_buffer, 0, a.lex_buffer, a.lex_buffer_len, n); + a.lex_buffer_len = a.lex_buffer_len + n | 0; }), lex_buffer: Caml_bytes.create(1024), lex_buffer_len: 0, diff --git a/lib/js/list.js b/lib/js/list.js index 1064c4f1ce..cd0053a5af 100644 --- a/lib/js/list.js +++ b/lib/js/list.js @@ -1,6 +1,5 @@ '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"); @@ -132,7 +131,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; @@ -143,7 +142,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) @@ -151,18 +150,18 @@ function init_aux(i, n, f) { } function init(len, f) { - if (len < 0) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "List.init", - Error: new Error() - }; - } - 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 { + RE_EXN_ID: "Invalid_argument", + _1: "List.init", + Error: new Error() + }; } function flatten(param) { @@ -177,7 +176,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) @@ -188,7 +187,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) @@ -210,7 +209,7 @@ function rev_map(f, l) { } _param = param.tl; _accu = { - hd: Curry._1(f, param.hd), + hd: f(param.hd), tl: accu }; continue; @@ -223,7 +222,7 @@ function iter(f, _param) { if (!param) { return; } - Curry._1(f, param.hd); + f(param.hd); _param = param.tl; continue; }; @@ -238,7 +237,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; @@ -253,14 +252,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; } @@ -269,7 +268,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) @@ -304,7 +303,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; @@ -315,14 +314,14 @@ function rev_map2(f, l1, l2) { Error: new Error() }; } - if (l2$1) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2", - Error: new Error() - }; + if (!l2$1) { + return accu; } - return accu; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2", + Error: new Error() + }; }; } @@ -332,7 +331,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; @@ -363,7 +362,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 { @@ -372,21 +371,21 @@ function fold_left2(f, _accu, _l1, _l2) { Error: new Error() }; } - if (l2) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_left2", - Error: new Error() - }; + if (!l2) { + return accu; } - return accu; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2", + Error: new Error() + }; }; } 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 { RE_EXN_ID: "Invalid_argument", @@ -394,14 +393,14 @@ function fold_right2(f, l1, l2, accu) { Error: new Error() }; } - if (l2) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2", - Error: new Error() - }; + if (!l2) { + return accu; } - return accu; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2", + Error: new Error() + }; } function for_all(p, _param) { @@ -410,7 +409,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; @@ -424,7 +423,7 @@ function exists(p, _param) { if (!param) { return false; } - if (Curry._1(p, param.hd)) { + if (p(param.hd)) { return true; } _param = param.tl; @@ -438,7 +437,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; @@ -468,7 +467,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; @@ -651,7 +650,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; @@ -671,7 +670,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; @@ -679,29 +678,27 @@ function find_opt(p, _param) { }; } -function find_all(p) { - return function (param) { - let _accu = /* [] */0; - let _param = param; - while(true) { - let param$1 = _param; - let accu = _accu; - if (!param$1) { - return rev_append(accu, /* [] */0); - } - let l = param$1.tl; - let x = param$1.hd; - if (Curry._1(p, x)) { - _param = l; - _accu = { - hd: x, - tl: accu - }; - continue; - } - _param = l; +function find_all(p, l) { + let _accu = /* [] */0; + let _param = l; + while(true) { + let param = _param; + let accu = _accu; + if (!param) { + return rev_append(accu, /* [] */0); + } + let l$1 = param.tl; + let x = param.hd; + if (p(x)) { + _param = l$1; + _accu = { + hd: x, + tl: accu + }; continue; - }; + } + _param = l$1; + continue; }; } @@ -721,7 +718,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, @@ -795,7 +792,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) @@ -843,8 +840,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: { @@ -855,7 +852,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x1, x3) <= 0) { + } else if (cmp(x1, x3) <= 0) { return { hd: x1, tl: { @@ -878,7 +875,7 @@ function stable_sort(cmp, l) { } }; } - } else if (Curry._2(cmp, x1, x3) <= 0) { + } else if (cmp(x1, x3) <= 0) { return { hd: x2, tl: { @@ -889,7 +886,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x2, x3) <= 0) { + } else if (cmp(x2, x3) <= 0) { return { hd: x2, tl: { @@ -923,7 +920,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: { @@ -963,7 +960,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 @@ -989,8 +986,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: { @@ -1001,7 +998,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x1, x3) > 0) { + } else if (cmp(x1, x3) > 0) { return { hd: x1, tl: { @@ -1024,7 +1021,7 @@ function stable_sort(cmp, l) { } }; } - } else if (Curry._2(cmp, x1, x3) > 0) { + } else if (cmp(x1, x3) > 0) { return { hd: x2, tl: { @@ -1035,7 +1032,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x2, x3) > 0) { + } else if (cmp(x2, x3) > 0) { return { hd: x2, tl: { @@ -1069,7 +1066,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: { @@ -1109,7 +1106,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 @@ -1144,9 +1141,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, @@ -1171,7 +1168,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, @@ -1193,7 +1190,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, @@ -1226,7 +1223,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, @@ -1248,7 +1245,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, @@ -1291,7 +1288,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, @@ -1339,7 +1336,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, @@ -1375,9 +1372,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, @@ -1402,7 +1399,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, @@ -1424,7 +1421,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, @@ -1457,7 +1454,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, @@ -1479,7 +1476,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, @@ -1522,7 +1519,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, @@ -1570,7 +1567,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, diff --git a/lib/js/listLabels.js b/lib/js/listLabels.js index 372eb5de53..3fd911f067 100644 --- a/lib/js/listLabels.js +++ b/lib/js/listLabels.js @@ -1,6 +1,5 @@ '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"); @@ -132,7 +131,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; @@ -143,7 +142,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) @@ -151,18 +150,18 @@ function init_aux(i, n, f) { } function init(len, f) { - if (len < 0) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "List.init", - Error: new Error() - }; - } - 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 { + RE_EXN_ID: "Invalid_argument", + _1: "List.init", + Error: new Error() + }; } function flatten(param) { @@ -177,7 +176,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) @@ -188,7 +187,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) @@ -210,7 +209,7 @@ function rev_map(f, l) { } _param = param.tl; _accu = { - hd: Curry._1(f, param.hd), + hd: f(param.hd), tl: accu }; continue; @@ -223,7 +222,7 @@ function iter(f, _param) { if (!param) { return; } - Curry._1(f, param.hd); + f(param.hd); _param = param.tl; continue; }; @@ -238,7 +237,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; @@ -253,14 +252,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; } @@ -269,7 +268,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) @@ -304,7 +303,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; @@ -315,14 +314,14 @@ function rev_map2(f, l1, l2) { Error: new Error() }; } - if (l2$1) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2", - Error: new Error() - }; + if (!l2$1) { + return accu; } - return accu; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2", + Error: new Error() + }; }; } @@ -332,7 +331,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; @@ -363,7 +362,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 { @@ -372,21 +371,21 @@ function fold_left2(f, _accu, _l1, _l2) { Error: new Error() }; } - if (l2) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_left2", - Error: new Error() - }; + if (!l2) { + return accu; } - return accu; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2", + Error: new Error() + }; }; } 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 { RE_EXN_ID: "Invalid_argument", @@ -394,14 +393,14 @@ function fold_right2(f, l1, l2, accu) { Error: new Error() }; } - if (l2) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2", - Error: new Error() - }; + if (!l2) { + return accu; } - return accu; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2", + Error: new Error() + }; } function for_all(p, _param) { @@ -410,7 +409,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; @@ -424,7 +423,7 @@ function exists(p, _param) { if (!param) { return false; } - if (Curry._1(p, param.hd)) { + if (p(param.hd)) { return true; } _param = param.tl; @@ -438,7 +437,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; @@ -468,7 +467,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; @@ -651,7 +650,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; @@ -671,7 +670,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; @@ -679,29 +678,27 @@ function find_opt(p, _param) { }; } -function find_all(p) { - return function (param) { - let _accu = /* [] */0; - let _param = param; - while(true) { - let param$1 = _param; - let accu = _accu; - if (!param$1) { - return rev_append(accu, /* [] */0); - } - let l = param$1.tl; - let x = param$1.hd; - if (Curry._1(p, x)) { - _param = l; - _accu = { - hd: x, - tl: accu - }; - continue; - } - _param = l; +function find_all(p, l) { + let _accu = /* [] */0; + let _param = l; + while(true) { + let param = _param; + let accu = _accu; + if (!param) { + return rev_append(accu, /* [] */0); + } + let l$1 = param.tl; + let x = param.hd; + if (p(x)) { + _param = l$1; + _accu = { + hd: x, + tl: accu + }; continue; - }; + } + _param = l$1; + continue; }; } @@ -721,7 +718,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, @@ -795,7 +792,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) @@ -843,8 +840,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: { @@ -855,7 +852,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x1, x3) <= 0) { + } else if (cmp(x1, x3) <= 0) { return { hd: x1, tl: { @@ -878,7 +875,7 @@ function stable_sort(cmp, l) { } }; } - } else if (Curry._2(cmp, x1, x3) <= 0) { + } else if (cmp(x1, x3) <= 0) { return { hd: x2, tl: { @@ -889,7 +886,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x2, x3) <= 0) { + } else if (cmp(x2, x3) <= 0) { return { hd: x2, tl: { @@ -923,7 +920,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: { @@ -963,7 +960,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 @@ -989,8 +986,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: { @@ -1001,7 +998,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x1, x3) > 0) { + } else if (cmp(x1, x3) > 0) { return { hd: x1, tl: { @@ -1024,7 +1021,7 @@ function stable_sort(cmp, l) { } }; } - } else if (Curry._2(cmp, x1, x3) > 0) { + } else if (cmp(x1, x3) > 0) { return { hd: x2, tl: { @@ -1035,7 +1032,7 @@ function stable_sort(cmp, l) { } } }; - } else if (Curry._2(cmp, x2, x3) > 0) { + } else if (cmp(x2, x3) > 0) { return { hd: x2, tl: { @@ -1069,7 +1066,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: { @@ -1109,7 +1106,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 @@ -1144,9 +1141,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, @@ -1171,7 +1168,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, @@ -1193,7 +1190,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, @@ -1226,7 +1223,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, @@ -1248,7 +1245,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, @@ -1291,7 +1288,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, @@ -1339,7 +1336,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, @@ -1375,9 +1372,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, @@ -1402,7 +1399,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, @@ -1424,7 +1421,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, @@ -1457,7 +1454,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, @@ -1479,7 +1476,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, @@ -1522,7 +1519,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, @@ -1570,7 +1567,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, diff --git a/lib/js/map.js b/lib/js/map.js index 97ecf67e08..891888c8fb 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) { @@ -117,7 +116,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; @@ -156,7 +155,7 @@ function Make(funarg) { Error: new Error() }; } - let c = Curry._2(funarg.compare, x, param.v); + let c = funarg.compare(x, param.v); if (c === 0) { return param.d; } @@ -174,7 +173,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; @@ -189,7 +188,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; @@ -210,7 +209,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; @@ -225,7 +224,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; @@ -249,7 +248,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; @@ -264,7 +263,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; @@ -285,7 +284,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; @@ -300,7 +299,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; @@ -320,7 +319,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); } @@ -334,7 +333,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; } @@ -449,7 +448,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); } @@ -470,7 +469,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", @@ -488,9 +487,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); } @@ -530,7 +529,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; }; @@ -540,7 +539,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", @@ -557,7 +556,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", @@ -575,7 +574,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; }; @@ -586,7 +585,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)) { @@ -602,7 +601,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)) { @@ -672,7 +671,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, @@ -705,7 +704,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])); } } @@ -722,7 +721,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") { @@ -741,7 +740,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); } @@ -751,7 +750,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); } @@ -765,7 +764,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) { @@ -789,7 +788,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]; @@ -839,11 +838,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; } @@ -868,10 +867,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 50d502cfd0..0c1bb77e81 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) { @@ -117,7 +116,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; @@ -156,7 +155,7 @@ function Make(Ord) { Error: new Error() }; } - let c = Curry._2(Ord.compare, x, param.v); + let c = Ord.compare(x, param.v); if (c === 0) { return param.d; } @@ -176,7 +175,7 @@ function Make(Ord) { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.l; _d0 = param.d; _v0 = v; @@ -196,7 +195,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; @@ -215,7 +214,7 @@ function Make(Ord) { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.l; _d0 = param.d; _v0 = v; @@ -232,7 +231,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; @@ -251,7 +250,7 @@ function Make(Ord) { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.r; _d0 = param.d; _v0 = v; @@ -271,7 +270,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; @@ -290,7 +289,7 @@ function Make(Ord) { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.r; _d0 = param.d; _v0 = v; @@ -307,7 +306,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; @@ -320,7 +319,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); } @@ -334,7 +333,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; } @@ -449,7 +448,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); } @@ -470,7 +469,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", @@ -488,9 +487,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); } @@ -530,7 +529,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; }; @@ -540,7 +539,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", @@ -557,7 +556,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", @@ -575,7 +574,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; }; @@ -586,7 +585,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)) { @@ -602,7 +601,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)) { @@ -672,7 +671,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, @@ -705,7 +704,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])); } } @@ -722,7 +721,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") { @@ -741,7 +740,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); } @@ -751,7 +750,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); } @@ -765,7 +764,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) { @@ -789,7 +788,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]; @@ -839,11 +838,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; } @@ -868,10 +867,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 19be5927e4..3f39ccf6ee 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"); @@ -147,7 +146,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; @@ -186,7 +185,7 @@ let $$Map = { Error: new Error() }; } - let c = Curry._2(funarg.compare, x, param.v); + let c = funarg.compare(x, param.v); if (c === 0) { return param.d; } @@ -206,7 +205,7 @@ let $$Map = { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.l; _d0 = param.d; _v0 = v; @@ -226,7 +225,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; @@ -245,7 +244,7 @@ let $$Map = { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.l; _d0 = param.d; _v0 = v; @@ -262,7 +261,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; @@ -281,7 +280,7 @@ let $$Map = { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.r; _d0 = param.d; _v0 = v; @@ -301,7 +300,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; @@ -320,7 +319,7 @@ let $$Map = { ]; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.r; _d0 = param.d; _v0 = v; @@ -337,7 +336,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; @@ -350,7 +349,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); } @@ -364,7 +363,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; } @@ -479,7 +478,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); } @@ -500,7 +499,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", @@ -518,9 +517,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); } @@ -560,7 +559,7 @@ let $$Map = { return; } iter(f, param.l); - Curry._2(f, param.v, param.d); + f(param.v, param.d); _param = param.r; continue; }; @@ -570,7 +569,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", @@ -587,7 +586,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", @@ -605,7 +604,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; }; @@ -616,7 +615,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)) { @@ -632,7 +631,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)) { @@ -702,7 +701,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, @@ -735,7 +734,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])); } } @@ -752,7 +751,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") { @@ -771,7 +770,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); } @@ -781,7 +780,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); } @@ -795,7 +794,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) { @@ -819,7 +818,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]; @@ -869,11 +868,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; } @@ -898,10 +897,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); @@ -1070,7 +1069,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; } @@ -1235,7 +1234,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, @@ -1271,7 +1270,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; } @@ -1286,7 +1285,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); } @@ -1396,7 +1395,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; } @@ -1426,7 +1425,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; @@ -1468,7 +1467,7 @@ let $$Set = { return; } iter(f, param.l); - Curry._1(f, param.v); + f(param.v); _param = param.r; continue; }; @@ -1480,7 +1479,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; }; @@ -1491,7 +1490,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)) { @@ -1507,7 +1506,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)) { @@ -1525,7 +1524,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) { @@ -1548,7 +1547,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]; @@ -1599,7 +1598,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; } @@ -1615,7 +1614,7 @@ let $$Set = { return v0; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.l; _v0 = v; continue; @@ -1634,7 +1633,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; @@ -1649,7 +1648,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; @@ -1665,7 +1664,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; @@ -1680,7 +1679,7 @@ let $$Set = { return v0; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.r; _v0 = v; continue; @@ -1699,7 +1698,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; @@ -1714,7 +1713,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; @@ -1730,7 +1729,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; @@ -1744,7 +1743,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); } @@ -1753,7 +1752,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)); @@ -1767,7 +1766,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; @@ -1954,4 +1953,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 199bac3a30..ee639fe736 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; @@ -107,7 +106,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){ @@ -125,7 +124,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; @@ -161,7 +160,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; @@ -178,7 +177,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); } @@ -190,11 +189,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; } @@ -207,7 +206,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 7adf63be04..b4c2a0df7a 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"); @@ -171,11 +170,11 @@ function $at(l1, l2) { } } -function print_newline(param) { +function print_newline() { console.log(""); } -function prerr_newline(param) { +function prerr_newline() { console.error(""); } @@ -184,7 +183,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) { @@ -199,14 +198,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/pervasivesU.js b/lib/js/pervasivesU.js deleted file mode 100644 index 97d3f65193..0000000000 --- a/lib/js/pervasivesU.js +++ /dev/null @@ -1,266 +0,0 @@ -'use strict'; - -let Caml_sys = require("./caml_sys.js"); -let Caml_format = require("./caml_format.js"); -let Caml_string = require("./caml_string.js"); -let Caml_exceptions = require("./caml_exceptions.js"); -let Caml_js_exceptions = require("./caml_js_exceptions.js"); - -let JsxModules = { - Jsx: undefined, - JsxEvent: undefined, - JsxDOM: undefined -}; - -function failwith(s) { - throw { - RE_EXN_ID: "Failure", - _1: s, - Error: new Error() - }; -} - -function invalid_arg(s) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: s, - Error: new Error() - }; -} - -let Exit = /* @__PURE__ */Caml_exceptions.create("PervasivesU.Exit"); - -function abs(x) { - if (x >= 0) { - return x; - } else { - return -x | 0; - } -} - -function lnot(x) { - return x ^ -1; -} - -let min_int = -2147483648; - -function classify_float(x) { - if (isFinite(x)) { - if (Math.abs(x) >= 2.22507385850720138e-308) { - return "FP_normal"; - } else if (x !== 0) { - return "FP_subnormal"; - } else { - return "FP_zero"; - } - } else if (isNaN(x)) { - return "FP_nan"; - } else { - return "FP_infinite"; - } -} - -function char_of_int(n) { - if (n < 0 || n > 255) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "char_of_int", - Error: new Error() - }; - } - return n; -} - -function string_of_bool(b) { - if (b) { - return "true"; - } else { - return "false"; - } -} - -function bool_of_string(param) { - switch (param) { - case "false" : - return false; - case "true" : - return true; - default: - throw { - RE_EXN_ID: "Invalid_argument", - _1: "bool_of_string", - Error: new Error() - }; - } -} - -function bool_of_string_opt(param) { - switch (param) { - case "false" : - return false; - case "true" : - return true; - default: - return; - } -} - -function int_of_string_opt(s) { - try { - return Caml_format.int_of_string(s); - } - catch (raw_exn){ - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); - if (exn.RE_EXN_ID === "Failure") { - return; - } - throw exn; - } -} - -function valid_float_lexem(s) { - let l = s.length; - let _i = 0; - while(true) { - let i = _i; - if (i >= l) { - return s + "."; - } - let match = Caml_string.get(s, i); - if (match >= 48) { - if (match >= 58) { - return s; - } - _i = i + 1 | 0; - continue; - } - if (match !== 45) { - return s; - } - _i = i + 1 | 0; - continue; - }; -} - -function string_of_float(f) { - return valid_float_lexem(Caml_format.format_float("%.12g", f)); -} - -function float_of_string_opt(s) { - try { - return Caml_format.float_of_string(s); - } - catch (raw_exn){ - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); - if (exn.RE_EXN_ID === "Failure") { - return; - } - throw exn; - } -} - -function $at(l1, l2) { - if (l1) { - return { - hd: l1.hd, - tl: $at(l1.tl, l2) - }; - } else { - return l2; - } -} - -function print_newline() { - console.log(""); -} - -function prerr_newline() { - console.error(""); -} - -function print_int(i) { - console.log(String(i)); -} - -function print_float(i) { - console.log(string_of_float(i)); -} - -function print_string(prim) { - console.log(prim); -} - -let exit_function = { - contents: (function (prim) { - - }) -}; - -function at_exit(f) { - let g = exit_function.contents; - exit_function.contents = (function () { - f(); - g(); - }); -} - -function exit(retcode) { - exit_function.contents(); - return Caml_sys.sys_exit(retcode); -} - -let Jsx; - -let JsxEvent; - -let JsxDOM; - -let JsxPPXReactSupport; - -let max_int = 2147483647; - -let infinity = Infinity; - -let neg_infinity = -Infinity; - -let max_float = 1.79769313486231571e+308; - -let min_float = 2.22507385850720138e-308; - -let epsilon_float = 2.22044604925031308e-16; - -exports.Jsx = Jsx; -exports.JsxEvent = JsxEvent; -exports.JsxDOM = JsxDOM; -exports.JsxPPXReactSupport = JsxPPXReactSupport; -exports.JsxModules = JsxModules; -exports.invalid_arg = invalid_arg; -exports.failwith = failwith; -exports.Exit = Exit; -exports.abs = abs; -exports.max_int = max_int; -exports.min_int = min_int; -exports.lnot = lnot; -exports.infinity = infinity; -exports.neg_infinity = neg_infinity; -exports.max_float = max_float; -exports.min_float = min_float; -exports.epsilon_float = epsilon_float; -exports.classify_float = classify_float; -exports.char_of_int = char_of_int; -exports.string_of_bool = string_of_bool; -exports.bool_of_string = bool_of_string; -exports.bool_of_string_opt = bool_of_string_opt; -exports.int_of_string_opt = int_of_string_opt; -exports.string_of_float = string_of_float; -exports.float_of_string_opt = float_of_string_opt; -exports.$at = $at; -exports.print_string = print_string; -exports.print_int = print_int; -exports.print_float = print_float; -exports.print_newline = print_newline; -exports.prerr_newline = prerr_newline; -exports.exit = exit; -exports.at_exit = at_exit; -exports.valid_float_lexem = valid_float_lexem; -/* No side effect */ diff --git a/lib/js/queue.js b/lib/js/queue.js index 924f3e0496..69431214a1 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", @@ -115,7 +114,7 @@ function iter(f, q) { return; } let next = cell.next; - Curry._1(f, cell.content); + f(cell.content); _cell = next; continue; }; @@ -131,7 +130,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 62741eebc1..e218706322 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,61 +74,61 @@ function bits(s) { } function $$int(s, bound) { - if (bound > 1073741823 || bound <= 0) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Random.int", - Error: new Error() + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Random.int", + Error: new Error() }; } function int32(s, bound) { - if (bound <= 0) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Random.int32", - Error: new Error() + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Random.int32", + Error: new Error() }; } function int64(s, bound) { - if (Caml.i64_le(bound, Caml_int64.zero)) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "Random.int64", - Error: new Error() + 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 { + RE_EXN_ID: "Invalid_argument", + _1: "Random.int64", + Error: new Error() }; } @@ -207,7 +207,7 @@ let $$default = { idx: 0 }; -function bits$1(param) { +function bits$1() { return bits($$default); } @@ -224,10 +224,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); } @@ -239,11 +239,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 df70fe959f..a3c4ab4786 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) { @@ -97,7 +96,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; } @@ -253,7 +252,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, @@ -289,7 +288,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; } @@ -304,7 +303,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; @@ -422,7 +421,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; } @@ -449,7 +448,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; @@ -491,7 +490,7 @@ function Make(funarg) { return; } iter(f, param.l); - Curry._1(f, param.v); + f(param.v); _param = param.r; continue; }; @@ -503,7 +502,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; }; @@ -514,7 +513,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)) { @@ -530,7 +529,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)) { @@ -548,7 +547,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) { @@ -571,7 +570,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]; @@ -622,7 +621,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; } @@ -640,7 +639,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) { @@ -650,7 +649,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; @@ -670,7 +669,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) { @@ -680,7 +679,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; @@ -703,7 +702,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) { @@ -713,7 +712,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; @@ -733,7 +732,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) { @@ -743,7 +742,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; @@ -763,7 +762,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); } @@ -779,11 +778,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 ca7d416d3e..b21e6e6eef 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) { @@ -97,7 +96,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; } @@ -262,7 +261,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, @@ -298,7 +297,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; } @@ -313,7 +312,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); } @@ -423,7 +422,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; } @@ -453,7 +452,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; @@ -495,7 +494,7 @@ function Make(Ord) { return; } iter(f, param.l); - Curry._1(f, param.v); + f(param.v); _param = param.r; continue; }; @@ -507,7 +506,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; }; @@ -518,7 +517,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)) { @@ -534,7 +533,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)) { @@ -552,7 +551,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) { @@ -575,7 +574,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]; @@ -626,7 +625,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; } @@ -642,7 +641,7 @@ function Make(Ord) { return v0; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.l; _v0 = v; continue; @@ -661,7 +660,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; @@ -676,7 +675,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; @@ -692,7 +691,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; @@ -707,7 +706,7 @@ function Make(Ord) { return v0; } let v = param.v; - if (Curry._1(f, v)) { + if (f(v)) { _param = param.r; _v0 = v; continue; @@ -726,7 +725,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; @@ -741,7 +740,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; @@ -757,7 +756,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; @@ -771,7 +770,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); } @@ -780,7 +779,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)); @@ -794,7 +793,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 3f0ee1d4c8..945d58f960 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 { RE_EXN_ID: "Invalid_argument", _1: "Sort.array", @@ -122,10 +121,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) { @@ -147,10 +146,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 741be44433..8e9b67f45e 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 edac95596b..edd879cc60 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"); @@ -83,7 +83,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", @@ -135,7 +135,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; @@ -255,17 +255,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) { @@ -360,10 +362,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) }; }) @@ -376,10 +378,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) }; }) @@ -392,10 +394,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" }; }) @@ -408,8 +410,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()); }) } }; @@ -423,7 +425,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 1b05edb5d0..f693673cc0 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)); } } @@ -128,26 +127,26 @@ function index_opt(s, c) { function index_from(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from / Bytes.index_from", - Error: new Error() - }; + if (!(i < 0 || i > l)) { + return index_rec(s, l, i, c); } - return index_rec(s, l, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from", + Error: new Error() + }; } function index_from_opt(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from_opt / Bytes.index_from_opt", - Error: new Error() - }; + if (!(i < 0 || i > l)) { + return index_rec_opt(s, l, i, c); } - return index_rec_opt(s, l, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt", + Error: new Error() + }; } function rindex_rec(s, _i, c) { @@ -172,14 +171,14 @@ function rindex(s, c) { } function rindex_from(s, i, c) { - if (i < -1 || i >= s.length) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from / Bytes.rindex_from", - Error: new Error() - }; + if (!(i < -1 || i >= s.length)) { + return rindex_rec(s, i, c); } - return rindex_rec(s, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from", + Error: new Error() + }; } function rindex_rec_opt(s, _i, c) { @@ -201,14 +200,14 @@ function rindex_opt(s, c) { } function rindex_from_opt(s, i, c) { - if (i < -1 || i >= s.length) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from_opt / Bytes.rindex_from_opt", - Error: new Error() - }; + if (!(i < -1 || i >= s.length)) { + return rindex_rec_opt(s, i, c); } - return rindex_rec_opt(s, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt", + Error: new Error() + }; } function contains_from(s, i, c) { diff --git a/lib/js/stringLabels.js b/lib/js/stringLabels.js index ae0939f29c..b2ae4a3021 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)); } } @@ -130,26 +131,26 @@ function index_opt(s, c) { function index_from(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from / Bytes.index_from", - Error: new Error() - }; + if (!(i < 0 || i > l)) { + return index_rec(s, l, i, c); } - return index_rec(s, l, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from", + Error: new Error() + }; } function index_from_opt(s, i, c) { let l = s.length; - if (i < 0 || i > l) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from_opt / Bytes.index_from_opt", - Error: new Error() - }; + if (!(i < 0 || i > l)) { + return index_rec_opt(s, l, i, c); } - return index_rec_opt(s, l, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt", + Error: new Error() + }; } function rindex_rec(s, _i, c) { @@ -174,14 +175,14 @@ function rindex(s, c) { } function rindex_from(s, i, c) { - if (i < -1 || i >= s.length) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from / Bytes.rindex_from", - Error: new Error() - }; + if (!(i < -1 || i >= s.length)) { + return rindex_rec(s, i, c); } - return rindex_rec(s, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from", + Error: new Error() + }; } function rindex_rec_opt(s, _i, c) { @@ -203,14 +204,14 @@ function rindex_opt(s, c) { } function rindex_from_opt(s, i, c) { - if (i < -1 || i >= s.length) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from_opt / Bytes.rindex_from_opt", - Error: new Error() - }; + if (!(i < -1 || i >= s.length)) { + return rindex_rec_opt(s, i, c); } - return rindex_rec_opt(s, i, c); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt", + Error: new Error() + }; } function contains_from(s, i, c) { diff --git a/lib/js/sys.js b/lib/js/sys.js index 38e33bb84a..fe4a466a96 100644 --- a/lib/js/sys.js +++ b/lib/js/sys.js @@ -45,14 +45,26 @@ 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 { + RE_EXN_ID: Break, + Error: new Error() + }; + }) + }); + } 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 afb17c438f..4c401e1f02 100644 --- a/lib/js/uchar.js +++ b/lib/js/uchar.js @@ -15,28 +15,28 @@ function succ(u) { if (u === 55295) { return 57344; } - if (u === 1114111) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "U+10FFFF has no successor", - Error: new Error() - }; + if (u !== 1114111) { + return u + 1 | 0; } - return u + 1 | 0; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "U+10FFFF has no successor", + Error: new Error() + }; } function pred(u) { if (u === 57344) { return 55295; } - if (u === 0) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "U+0000 has no predecessor", - Error: new Error() - }; + if (u !== 0) { + return u - 1 | 0; } - return u - 1 | 0; + throw { + RE_EXN_ID: "Invalid_argument", + _1: "U+0000 has no predecessor", + Error: new Error() + }; } function is_valid(i) { diff --git a/scripts/ninja.js b/scripts/ninja.js index bce31a4465..f8ad615013 100755 --- a/scripts/ninja.js +++ b/scripts/ninja.js @@ -19,13 +19,13 @@ var runtimeMlFiles = runtimeFiles.filter( x => !x.startsWith("bs_stdlib_mini") && (x.endsWith(".ml") || x.endsWith(".res")) && - x !== "js.ml" + x !== "js.res" ); var runtimeMliFiles = runtimeFiles.filter( x => !x.startsWith("bs_stdlib_mini") && (x.endsWith(".mli") || x.endsWith(".resi")) && - x !== "js.mli" + x !== "js.resi" ); var runtimeSourceFiles = runtimeMlFiles.concat(runtimeMliFiles); var runtimeJsFiles = [...new Set(runtimeSourceFiles.map(baseName))]; @@ -832,6 +832,7 @@ async function runtimeNinja(devmode = true) { var compilerTarget = pseudoTarget("$bsc"); 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_flags = $bsc_no_open_flags -open Bs_stdlib_mini @@ -848,7 +849,7 @@ ${ninjaQuickBuildList([ ], [ ["js.cmj", "js.cmi"], - "js.ml", + "js.res", "cc", ninjaCwd, [["bsc_flags", "$bsc_no_open_flags"]], @@ -939,7 +940,7 @@ ${ninjaQuickBuildList([ ], [ ["js.cmj", "js.cmi"], - "js.ml", + "js.res", "cc", ninjaCwd, [["bsc_flags", "$bsc_primitive_flags"]], @@ -961,14 +962,14 @@ ${ninjaQuickBuildList([ var jsPrefixSourceFiles = othersDirFiles.filter( x => x.startsWith("js") && + x !== "js.res" && (x.endsWith(".ml") || x.endsWith(".mli") || x.endsWith(".res") || x.endsWith(".resi")) && !x.includes(".cppo") && !x.includes(".pp") && - !x.includes("#") && - x !== "js.ml" + !x.includes("#") ); var othersFiles = othersDirFiles.filter( x =>