From bc63f2b7cfd342d2b1fd79eb779c80cd9660b280 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Thu, 15 Mar 2018 04:37:56 -0700 Subject: [PATCH] [Docs][Belt] Categorize uncurried helpers into their dedicated section, part 2 (#2630) Follow-up of #2628 --- jscomp/others/belt_Array.mli | 168 ++++++++++++++---------- jscomp/others/belt_HashMapInt.mli | 25 ++-- jscomp/others/belt_HashMapString.mli | 25 ++-- jscomp/others/belt_HashSetInt.mli | 34 +++-- jscomp/others/belt_HashSetString.mli | 34 +++-- jscomp/others/belt_MutableMapInt.mli | 78 ++++++----- jscomp/others/belt_MutableMapString.mli | 78 ++++++----- jscomp/others/belt_MutableSetInt.mli | 48 ++++--- jscomp/others/belt_MutableSetString.mli | 48 ++++--- jscomp/others/belt_SetDict.mli | 64 +++++---- jscomp/others/hashmap.cppo.mli | 27 ++-- jscomp/others/hashset.cppo.mli | 36 ++--- jscomp/others/mapm.cppo.mli | 76 ++++++----- jscomp/others/setm.cppo.mli | 50 +++---- lib/js/belt_Array.js | 36 ++--- lib/js/belt_HashMapInt.js | 18 +-- lib/js/belt_HashMapString.js | 18 +-- lib/js/belt_HashSetInt.js | 12 +- lib/js/belt_HashSetString.js | 12 +- lib/js/belt_MutableMapInt.js | 18 +-- lib/js/belt_MutableMapString.js | 18 +-- lib/js/belt_MutableSetInt.js | 12 +- lib/js/belt_MutableSetString.js | 12 +- lib/js/belt_SetDict.js | 36 ++--- 24 files changed, 547 insertions(+), 436 deletions(-) diff --git a/jscomp/others/belt_Array.mli b/jscomp/others/belt_Array.mli index cdabbf9c3c..560f916222 100644 --- a/jscomp/others/belt_Array.mli +++ b/jscomp/others/belt_Array.mli @@ -13,20 +13,20 @@ (* Adapted significantly by Authors of BuckleScript *) -(** {!Belt.Array} - Utililites for Array functions +(** {!Belt.Array} + Utililites for Array functions *) external length: 'a array -> int = "%array_length" (** [length xs] return the size of the array *) - + external size: 'a array -> int = "%array_length" (** {b See} {!length} *) val get: 'a array -> int -> 'a option -val getExn: 'a array -> int -> 'a +val getExn: 'a array -> int -> 'a (** [getExn arr i] {b raise} an exception if [i] is out of range @@ -40,22 +40,22 @@ external getUnsafe: 'a array -> int -> 'a = "%array_unsafe_get" no bounds checking, this would cause type error if [i] does not stay within range *) - + external getUndefined: 'a array -> int -> 'a Js.undefined = "%array_unsafe_get" (** [getUndefined arr i] - It does the samething in the runtime as {!getUnsafe}, - it is {i type safe} since the return type still track whether it is + It does the samething in the runtime as {!getUnsafe}, + it is {i type safe} since the return type still track whether it is in range or not *) val set: 'a array -> int -> 'a -> bool -(** [set arr n x] modifies [arr] in place, - it replaces the nth element of [arr] with [x] +(** [set arr n x] modifies [arr] in place, + it replaces the nth element of [arr] with [x] @return false means not updated due to out of range *) -val setExn: 'a array -> int -> 'a -> unit +val setExn: 'a array -> int -> 'a -> unit (** [setExn arr i x] {b raise} an exception if [i] is out of range *) @@ -64,7 +64,7 @@ external setUnsafe: 'a array -> int -> 'a -> unit = "%array_unsafe_set" val shuffleInPlace: 'a array -> unit -val shuffle: 'a array -> 'a array +val shuffle: 'a array -> 'a array (** [shuffle xs] @return a fresh array *) @@ -79,13 +79,13 @@ external makeUninitialized: int -> 'a Js.undefined array = "Array" [@@bs.new] external makeUninitializedUnsafe: int -> 'a array = "Array" [@@bs.new] (** [makeUninitializedUnsafe n] - {b Unsafe} + {b Unsafe} *) val make: int -> 'a -> 'a array -(** [make n e] - return an array of size [n] filled with value [e] +(** [make n e] + return an array of size [n] filled with value [e] @return an empty array when [n] is negative. *) @@ -102,23 +102,22 @@ val rangeBy: int -> int -> step:int -> int array @return empty array when step is 0 or negative it also return empty array when [start > finish] - + @example {[ rangeBy 0 10 ~step:3 = [|0;3;6;9|];; rangeBy 0 12 ~step:3 = [|0;3;6;9;12|];; rangeBy 33 0 ~step:1 = [||];; rangeBy 33 0 ~step:(-1) = [||];; rangeBy 3 12 ~step:(-1) = [||];; - rangeBy 3 3 ~step:0 = [||] ;; + rangeBy 3 3 ~step:0 = [||] ;; rangeBy 3 3 ~step:(1) = [|3|] ;; ]} -*) +*) -val makeByU: int -> (int -> 'a [@bs]) -> 'a array val makeBy: int -> (int -> 'a ) -> 'a array -(** [makeBy n f] - - return an empty array when [n] is negative +(** [makeBy n f] + + return an empty array when [n] is negative return an array of size [n] populated by [f i] start from [0] to [n - 1] @example {[ @@ -126,17 +125,16 @@ val makeBy: int -> (int -> 'a ) -> 'a array ]} *) -val makeByAndShuffleU: int -> (int -> 'a [@bs]) -> 'a array -val makeByAndShuffle: int -> (int -> 'a ) -> 'a array +val makeByAndShuffle: int -> (int -> 'a ) -> 'a array (** [makeByAndShuffle n f] Equivalent to [shuffle (makeBy n f)] -*) +*) val zip: 'a array -> 'b array -> ('a * 'b) array -(** [zip a b] - +(** [zip a b] + Stop with the shorter array @example {[ @@ -145,11 +143,10 @@ val zip: 'a array -> 'b array -> ('a * 'b) array *) - val zipByU: 'a array -> 'b array -> ('a -> 'b -> 'c [@bs]) -> 'c array - val zipBy: 'a array -> 'b array -> ('a -> 'b -> 'c ) -> 'c array +val zipBy: 'a array -> 'b array -> ('a -> 'b -> 'c ) -> 'c array (** [zipBy xs ys f] - + Stops with shorter array Equivalent to [map (zip xs ys) (fun (a,b) -> f a b) ] @@ -160,7 +157,7 @@ val concat: 'a array -> 'a array -> 'a array @return a fresh array containing the concatenation of the arrays [v1] and [v2], so even if [v1] or [v2] - is empty, it can not be shared + is empty, it can not be shared *) val concatMany: 'a array array -> 'a array @@ -172,25 +169,25 @@ val concatMany: 'a array array -> 'a array val slice: 'a array -> offset:int -> len:int -> 'a array (** [slice arr offset len] - + [offset] can be negative, [slice arr -1 1] means get the last element as a singleton array [slice arr -(very_large_index) len] will do a copy of the array - + if the array does not have enough data, [slice] extracts through the end of sequence *) val copy: 'a array -> 'a array -(** [copy a] +(** [copy a] @return a copy of [a], that is, a fresh array containing the same elements as [a]. *) val fill: 'a array -> offset:int -> len:int -> 'a -> unit -(** [fill arr ~offset ~len x] +(** [fill arr ~offset ~len x] Modifies [arr] in place, storing [x] in elements number [offset] to [offset + len - 1]. @@ -208,44 +205,41 @@ val fill: 'a array -> offset:int -> len:int -> 'a -> unit ]} *) -val blit: +val blit: src:'a array -> srcOffset:int -> dst:'a array -> dstOffset:int -> len:int -> unit -(** [blit ~src:v1 ~srcOffset:o1 ~dst:v2 ~dstOffset:o2 ~len] +(** [blit ~src:v1 ~srcOffset:o1 ~dst:v2 ~dstOffset:o2 ~len] copies [len] elements from array [v1], starting at element number [o1], to array [v2], - starting at element number [o2]. - + starting at element number [o2]. + It works correctly even if [v1] and [v2] are the same array, and the source and destination chunks overlap. - [offset] can be negative, [-1] means [len - 1], if [len + offset] is still - negative, it will be set as 0 + [offset] can be negative, [-1] means [len - 1], if [len + offset] is still + negative, it will be set as 0 *) val blitUnsafe: - src:'a array -> srcOffset:int -> dst:'a array -> dstOffset:int -> len:int -> unit + src:'a array -> srcOffset:int -> dst:'a array -> dstOffset:int -> len:int -> unit (** {b Unsafe} blit without bounds checking *) -val forEachU: 'a array -> ('a -> unit [@bs]) -> unit val forEach: 'a array -> ('a -> unit ) -> unit (** [forEach xs f] Call f on each element of [xs] from the beginning to end *) - -val mapU: 'a array -> ('a -> 'b [@bs]) -> 'b array + val map: 'a array -> ('a -> 'b ) -> 'b array (** [map xs f ] @return a new array by calling [f] to element of [xs] from the beginning to end *) - -val keepU: 'a array -> ('a -> bool [@bs]) -> 'a array + val keep: 'a array -> ('a -> bool ) -> 'a array (** [keep xs p ] @return a new array that keep all elements satisfy [p] @@ -255,8 +249,7 @@ val keep: 'a array -> ('a -> bool ) -> 'a array ]} *) -val keepMapU: 'a array -> ('a -> 'b option [@bs]) -> 'b array -val keepMap: 'a array -> ('a -> 'b option) -> 'b array +val keepMap: 'a array -> ('a -> 'b option) -> 'b array (** [keepMap xs p] @return a new array that keep all elements that return a non-None applied [p] @@ -266,7 +259,6 @@ val keepMap: 'a array -> ('a -> 'b option) -> 'b array ]} *) -val forEachWithIndexU: 'a array -> (int -> 'a -> unit [@bs]) -> unit val forEachWithIndex: 'a array -> (int -> 'a -> unit ) -> unit (** [forEachWithIndex xs f] @@ -274,66 +266,57 @@ val forEachWithIndex: 'a array -> (int -> 'a -> unit ) -> unit more argument: the index starting from 0 *) -val mapWithIndexU: 'a array -> (int -> 'a -> 'b [@bs]) -> 'b array -val mapWithIndex: 'a array -> (int -> 'a -> 'b ) -> 'b array +val mapWithIndex: 'a array -> (int -> 'a -> 'b ) -> 'b array (** [mapWithIndex xs f ] The same with {!map} except that [f] is supplied with one more argument: the index starting from 0 *) - -val reduceU: 'b array -> 'a -> ('a -> 'b -> 'a [@bs]) ->'a + val reduce: 'b array -> 'a -> ('a -> 'b -> 'a ) ->'a (** [reduce xs init f] @example {[ reduce [|2;3;4|] 1 (+) = 10 ]} - + *) -val reduceReverseU: 'b array -> 'a -> ('a -> 'b -> 'a [@bs]) -> 'a val reduceReverse: 'b array -> 'a -> ('a -> 'b -> 'a ) -> 'a (** [reduceReverse xs init f] @example {[ - reduceReverse [|1;2;3;4|] 100 (-) = 90 + reduceReverse [|1;2;3;4|] 100 (-) = 90 ]} *) -val reduceReverse2U: - 'a array -> 'b array -> 'c -> ('c -> 'a -> 'b -> 'c [@bs]) -> 'c -val reduceReverse2: +val reduceReverse2: 'a array -> 'b array -> 'c -> ('c -> 'a -> 'b -> 'c) -> 'c (** @example {[ reduceReverse2 [|1;2;3|] [|1;2|] 0 (fun acc x y -> acc + x + y) = 6 ]} *) - -val someU: 'a array -> ('a -> bool [@bs]) -> bool + val some: 'a array -> ('a -> bool) -> bool (** [some xs p] @return true if one of element satifies [p] *) - -val everyU: 'a array -> ('a -> bool [@bs]) -> bool + val every: 'a array -> ('a -> bool ) -> bool (** [every xs p] @return true if all elements satisfy [p] *) - -val every2U: 'a array -> 'b array -> ('a -> 'b -> bool [@bs]) -> bool + val every2: 'a array -> 'b array -> ('a -> 'b -> bool ) -> bool (** [every2 xs ys p] only tests the length of shorter @example {[ every2 [|1;2;3|] [|0;1|] (>) = true;; (every2 [||] [|1|] (fun x y -> x > y)) = true;; - (every2 [|2;3|] [|1|] (fun x y -> x > y)) = true;; + (every2 [|2;3|] [|1|] (fun x y -> x > y)) = true;; ]} *) -val some2U: 'a array -> 'b array -> ('a -> 'b -> bool [@bs]) -> bool val some2: 'a array -> 'b array -> ('a -> 'b -> bool ) -> bool (** [some2 xs ys p] only tests the length of shorter @@ -343,22 +326,61 @@ val some2: 'a array -> 'b array -> ('a -> 'b -> bool ) -> bool (some2 [|2;3|] [|1;4|] (fun x y -> x > y)) = true;; ]} *) - -val cmpU: 'a array -> 'a array -> ('a -> 'a -> int [@bs]) -> int + val cmp: 'a array -> 'a array -> ('a -> 'a -> int ) -> int (** [cmp a b] - - - Compared by length if [length a <> length b] + + - Compared by length if [length a <> length b] - Otherwise compare one by one [f ai bi] *) -val eqU: 'a array -> 'a array -> ('a -> 'a -> bool [@bs]) -> bool val eq: 'a array -> 'a array -> ('a -> 'a -> bool ) -> bool (** [eq a b] - + - return false if length is not the same - equal one by one using [f ai bi] *) external truncateToLengthUnsafe: 'a array -> int -> unit = "length" [@@bs.set] (** {b Unsafe} *) + + +(** {1 Uncurried version} *) + + +val makeByU: int -> (int -> 'a [@bs]) -> 'a array + +val makeByAndShuffleU: int -> (int -> 'a [@bs]) -> 'a array + +val zipByU: 'a array -> 'b array -> ('a -> 'b -> 'c [@bs]) -> 'c array + +val forEachU: 'a array -> ('a -> unit [@bs]) -> unit + +val mapU: 'a array -> ('a -> 'b [@bs]) -> 'b array + +val keepU: 'a array -> ('a -> bool [@bs]) -> 'a array + +val keepMapU: 'a array -> ('a -> 'b option [@bs]) -> 'b array + +val forEachWithIndexU: 'a array -> (int -> 'a -> unit [@bs]) -> unit + +val mapWithIndexU: 'a array -> (int -> 'a -> 'b [@bs]) -> 'b array + +val reduceU: 'b array -> 'a -> ('a -> 'b -> 'a [@bs]) ->'a + +val reduceReverseU: 'b array -> 'a -> ('a -> 'b -> 'a [@bs]) -> 'a + +val reduceReverse2U: + 'a array -> 'b array -> 'c -> ('c -> 'a -> 'b -> 'c [@bs]) -> 'c + +val someU: 'a array -> ('a -> bool [@bs]) -> bool + +val everyU: 'a array -> ('a -> bool [@bs]) -> bool + +val every2U: 'a array -> 'b array -> ('a -> 'b -> bool [@bs]) -> bool + +val some2U: 'a array -> 'b array -> ('a -> 'b -> bool [@bs]) -> bool + +val cmpU: 'a array -> 'a array -> ('a -> 'a -> int [@bs]) -> int + +val eqU: 'a array -> 'a array -> ('a -> 'a -> bool [@bs]) -> bool diff --git a/jscomp/others/belt_HashMapInt.mli b/jscomp/others/belt_HashMapInt.mli index c3bae1e71f..bf23600361 100644 --- a/jscomp/others/belt_HashMapInt.mli +++ b/jscomp/others/belt_HashMapInt.mli @@ -3,40 +3,37 @@ type key = int # 10 "hashmap.cppo.mli" -type 'b t +type 'b t -val make: hintSize:int -> 'b t +val make: hintSize:int -> 'b t val clear: 'b t -> unit val isEmpty: _ t -> bool - + val set: 'a t -> key -> 'a -> unit (** [setDone tbl k v] if [k] does not exist, add the binding [k,v], otherwise, update the old value with the new [v] *) - -val copy: 'a t -> 'a t + +val copy: 'a t -> 'a t val get: 'a t -> key -> 'a option val has: 'b t -> key -> bool val remove: 'a t -> key -> unit -val forEachU: 'b t -> (key -> 'b -> unit [@bs]) -> unit val forEach: 'b t -> (key -> 'b -> unit) -> unit -val reduceU: 'b t -> 'c -> ('c -> key -> 'b -> 'c [@bs]) -> 'c val reduce: 'b t -> 'c -> ('c -> key -> 'b -> 'c) -> 'c -val keepMapInPlaceU: 'a t -> (key -> 'a -> 'a option [@bs]) -> unit val keepMapInPlace: 'a t -> (key -> 'a -> 'a option) -> unit - -val size: _ t -> int + +val size: _ t -> int val toArray: 'a t -> (key * 'a) array @@ -49,3 +46,11 @@ val logStats: _ t -> unit val ofArray: (key * 'a) array -> 'a t [@@ocaml.deprecated "Use fromArray instead"] + + +(** {1 Uncurried version} *) + + +val forEachU: 'b t -> (key -> 'b -> unit [@bs]) -> unit +val reduceU: 'b t -> 'c -> ('c -> key -> 'b -> 'c [@bs]) -> 'c +val keepMapInPlaceU: 'a t -> (key -> 'a -> 'a option [@bs]) -> unit diff --git a/jscomp/others/belt_HashMapString.mli b/jscomp/others/belt_HashMapString.mli index a261235eef..06fe96b3bc 100644 --- a/jscomp/others/belt_HashMapString.mli +++ b/jscomp/others/belt_HashMapString.mli @@ -3,40 +3,37 @@ type key = string # 10 "hashmap.cppo.mli" -type 'b t +type 'b t -val make: hintSize:int -> 'b t +val make: hintSize:int -> 'b t val clear: 'b t -> unit val isEmpty: _ t -> bool - + val set: 'a t -> key -> 'a -> unit (** [setDone tbl k v] if [k] does not exist, add the binding [k,v], otherwise, update the old value with the new [v] *) - -val copy: 'a t -> 'a t + +val copy: 'a t -> 'a t val get: 'a t -> key -> 'a option val has: 'b t -> key -> bool val remove: 'a t -> key -> unit -val forEachU: 'b t -> (key -> 'b -> unit [@bs]) -> unit val forEach: 'b t -> (key -> 'b -> unit) -> unit -val reduceU: 'b t -> 'c -> ('c -> key -> 'b -> 'c [@bs]) -> 'c val reduce: 'b t -> 'c -> ('c -> key -> 'b -> 'c) -> 'c -val keepMapInPlaceU: 'a t -> (key -> 'a -> 'a option [@bs]) -> unit val keepMapInPlace: 'a t -> (key -> 'a -> 'a option) -> unit - -val size: _ t -> int + +val size: _ t -> int val toArray: 'a t -> (key * 'a) array @@ -49,3 +46,11 @@ val logStats: _ t -> unit val ofArray: (key * 'a) array -> 'a t [@@ocaml.deprecated "Use fromArray instead"] + + +(** {1 Uncurried version} *) + + +val forEachU: 'b t -> (key -> 'b -> unit [@bs]) -> unit +val reduceU: 'b t -> 'c -> ('c -> key -> 'b -> 'c [@bs]) -> 'c +val keepMapInPlaceU: 'a t -> (key -> 'a -> 'a option [@bs]) -> unit diff --git a/jscomp/others/belt_HashSetInt.mli b/jscomp/others/belt_HashSetInt.mli index 9acd8f8f96..cdd07991ad 100644 --- a/jscomp/others/belt_HashSetInt.mli +++ b/jscomp/others/belt_HashSetInt.mli @@ -1,7 +1,7 @@ # 2 "hashset.cppo.mli" (* Copyright (C) 2017 Authors of BuckleScript - * + * * 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 @@ -19,7 +19,7 @@ * 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. *) @@ -40,37 +40,43 @@ type key = int # 44 "hashset.cppo.mli" type t -val make: hintSize:int -> t +val make: hintSize:int -> t val clear: t -> unit val isEmpty: t -> bool - + val add: t -> key -> unit val copy: t -> t - + val has: t -> key -> bool - + val remove: t -> key -> unit -val forEachU: t -> (key -> unit [@bs]) -> unit val forEach: t -> (key -> unit) -> unit - -val reduceU: t -> 'c -> ( 'c -> key -> 'c [@bs]) -> 'c + val reduce: t -> 'c -> ( 'c -> key -> 'c) -> 'c - -val size: t -> int + +val size: t -> int val logStats: t -> unit -val toArray: t -> key array +val toArray: t -> key array -val ofArray: key array -> t +val ofArray: key array -> t [@@ocaml.deprecated "Use fromArray instead"] -val fromArray: key array -> t +val fromArray: key array -> t val mergeMany: t -> key array -> unit val getBucketHistogram: t -> int array + + +(** {1 Uncurried version} *) + + +val forEachU: t -> (key -> unit [@bs]) -> unit + +val reduceU: t -> 'c -> ( 'c -> key -> 'c [@bs]) -> 'c diff --git a/jscomp/others/belt_HashSetString.mli b/jscomp/others/belt_HashSetString.mli index 2c6ce99a1d..423f1e7ed0 100644 --- a/jscomp/others/belt_HashSetString.mli +++ b/jscomp/others/belt_HashSetString.mli @@ -1,7 +1,7 @@ # 2 "hashset.cppo.mli" (* Copyright (C) 2017 Authors of BuckleScript - * + * * 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 @@ -19,7 +19,7 @@ * 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. *) @@ -40,37 +40,43 @@ type key = string # 44 "hashset.cppo.mli" type t -val make: hintSize:int -> t +val make: hintSize:int -> t val clear: t -> unit val isEmpty: t -> bool - + val add: t -> key -> unit val copy: t -> t - + val has: t -> key -> bool - + val remove: t -> key -> unit -val forEachU: t -> (key -> unit [@bs]) -> unit val forEach: t -> (key -> unit) -> unit - -val reduceU: t -> 'c -> ( 'c -> key -> 'c [@bs]) -> 'c + val reduce: t -> 'c -> ( 'c -> key -> 'c) -> 'c - -val size: t -> int + +val size: t -> int val logStats: t -> unit -val toArray: t -> key array +val toArray: t -> key array -val ofArray: key array -> t +val ofArray: key array -> t [@@ocaml.deprecated "Use fromArray instead"] -val fromArray: key array -> t +val fromArray: key array -> t val mergeMany: t -> key array -> unit val getBucketHistogram: t -> int array + + +(** {1 Uncurried version} *) + + +val forEachU: t -> (key -> unit [@bs]) -> unit + +val reduceU: t -> 'c -> ( 'c -> key -> 'c [@bs]) -> 'c diff --git a/jscomp/others/belt_MutableMapInt.mli b/jscomp/others/belt_MutableMapInt.mli index 0cf401e2c3..d8d2cd3bed 100644 --- a/jscomp/others/belt_MutableMapInt.mli +++ b/jscomp/others/belt_MutableMapInt.mli @@ -1,6 +1,6 @@ # 1 "mapm.cppo.mli" (* Copyright (C) 2017 Authors of BuckleScript - * + * * 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 @@ -18,14 +18,14 @@ * 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. *) -# 28 +# 28 "mapm.cppo.mli" type key = int -# 32 +# 32 "mapm.cppo.mli" type 'a t @@ -35,42 +35,36 @@ val isEmpty: 'a t -> bool val has: 'a t -> key -> bool -val cmpU: 'a t -> 'a t -> ('a -> 'a -> int [@bs]) -> int -val cmp: 'a t -> 'a t -> ('a -> 'a -> int) -> int +val cmp: 'a t -> 'a t -> ('a -> 'a -> int) -> int (** [cmp m1 m2 cmp] First compare by size, if size is the same, compare by key, value pair *) -val eqU: 'a t -> 'a t -> ('a -> 'a -> bool [@bs]) -> bool -val eq: 'a t -> 'a t -> ('a -> 'a -> bool ) -> bool +val eq: 'a t -> 'a t -> ('a -> 'a -> bool ) -> bool (** [eq m1 m2 cmp] *) - -val forEachU: 'a t -> (key -> 'a -> unit [@bs]) -> unit -val forEach: 'a t -> (key -> 'a -> unit) -> unit + +val forEach: 'a t -> (key -> 'a -> unit) -> unit (** [forEach m f] applies [f] to all bindings in map [m]. [f] receives the key as first argument, and the associated value as second argument. The application order of [f] is in increasing order. *) -val reduceU: 'a t -> 'b -> ('b -> key -> 'a -> 'b [@bs]) -> 'b val reduce: 'a t -> 'b -> ('b -> key -> 'a -> 'b ) -> 'b (** [reduce m a f] computes [(f kN dN ... (f k1 d1 a)...)], where [k1 ... kN] are the keys of all bindings in [m] (in increasing order), and [d1 ... dN] are the associated data. *) -val everyU: 'a t -> (key -> 'a -> bool [@bs]) -> bool -val every: 'a t -> (key -> 'a -> bool) -> bool +val every: 'a t -> (key -> 'a -> bool) -> bool (** [every m p] checks if all the bindings of the map satisfy the predicate [p]. - The application order of [p] is unspecified. + The application order of [p] is unspecified. *) -val someU: 'a t -> (key -> 'a -> bool [@bs]) -> bool -val some: 'a t -> (key -> 'a -> bool) -> bool +val some: 'a t -> (key -> 'a -> bool) -> bool (** [some m p] checks if at least one binding of the map satisfy the predicate [p]. - The application order of [p] is unspecified. + The application order of [p] is unspecified. *) @@ -79,17 +73,17 @@ val some: 'a t -> (key -> 'a -> bool) -> bool val size: 'a t -> int val toList: 'a t -> (key * 'a) list (** In increasing order *) -val toArray: 'a t -> (key * 'a) array +val toArray: 'a t -> (key * 'a) array -val ofArray: (key * 'a) array -> 'a t +val ofArray: (key * 'a) array -> 'a t [@@ocaml.deprecated "Use fromArray instead"] -val fromArray: (key * 'a) array -> 'a t -val keysToArray: 'a t -> key array +val fromArray: (key * 'a) array -> 'a t +val keysToArray: 'a t -> key array val valuesToArray: 'a t -> 'a array -val minKey: _ t -> key option +val minKey: _ t -> key option val minKeyUndefined: _ t -> key Js.undefined -val maxKey: _ t -> key option +val maxKey: _ t -> key option val maxKeyUndefined: _ t -> key Js.undefined val minimum: 'a t -> (key * 'a) option val minUndefined: 'a t -> (key * 'a) Js.undefined @@ -102,28 +96,26 @@ val getExn: 'a t -> key -> 'a val checkInvariantInternal: _ t -> unit (** {b raise} when invariant is not held -*) - +*) + (****************************************************************************) (*TODO: add functional [merge, partition, keep, split]*) -val remove: 'a t -> key -> unit +val remove: 'a t -> key -> unit (** [remove m x] do the in-place modification *) val removeMany: 'a t -> key array -> unit - -val set: 'a t -> key -> 'a -> unit + +val set: 'a t -> key -> 'a -> unit (** [add m x y] do the in-place modification, return [m] for chaining. If [x] was already bound in [m], its previous binding disappears. *) -val updateU: 'a t -> key -> ('a option -> 'a option [@bs]) -> unit -val update: 'a t -> key -> ('a option -> 'a option) -> unit +val update: 'a t -> key -> ('a option -> 'a option) -> unit -val mapU: 'a t -> ('a -> 'b [@bs]) -> 'b t val map: 'a t -> ('a -> 'b) -> 'b t (** [map m f] returns a map with same domain as [m], where the associated value [a] of all bindings of [m] has been @@ -131,8 +123,26 @@ val map: 'a t -> ('a -> 'b) -> 'b t The bindings are passed to [f] in increasing order with respect to the ordering over the type of the keys. *) -val mapWithKeyU: 'a t -> (key -> 'a -> 'b [@bs]) -> 'b t -val mapWithKey: 'a t -> (key -> 'a -> 'b) -> 'b t +val mapWithKey: 'a t -> (key -> 'a -> 'b) -> 'b t +(** {1 Uncurried version} *) + +val cmpU: 'a t -> 'a t -> ('a -> 'a -> int [@bs]) -> int + +val eqU: 'a t -> 'a t -> ('a -> 'a -> bool [@bs]) -> bool + +val forEachU: 'a t -> (key -> 'a -> unit [@bs]) -> unit + +val reduceU: 'a t -> 'b -> ('b -> key -> 'a -> 'b [@bs]) -> 'b + +val everyU: 'a t -> (key -> 'a -> bool [@bs]) -> bool + +val someU: 'a t -> (key -> 'a -> bool [@bs]) -> bool + +val updateU: 'a t -> key -> ('a option -> 'a option [@bs]) -> unit + +val mapU: 'a t -> ('a -> 'b [@bs]) -> 'b t + +val mapWithKeyU: 'a t -> (key -> 'a -> 'b [@bs]) -> 'b t diff --git a/jscomp/others/belt_MutableMapString.mli b/jscomp/others/belt_MutableMapString.mli index 7d3ec5dc2b..29ea8fb520 100644 --- a/jscomp/others/belt_MutableMapString.mli +++ b/jscomp/others/belt_MutableMapString.mli @@ -1,6 +1,6 @@ # 1 "mapm.cppo.mli" (* Copyright (C) 2017 Authors of BuckleScript - * + * * 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 @@ -18,14 +18,14 @@ * 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. *) -# 26 +# 26 "mapm.cppo.mli" type key = string -# 32 +# 32 "mapm.cppo.mli" type 'a t @@ -35,42 +35,36 @@ val isEmpty: 'a t -> bool val has: 'a t -> key -> bool -val cmpU: 'a t -> 'a t -> ('a -> 'a -> int [@bs]) -> int -val cmp: 'a t -> 'a t -> ('a -> 'a -> int) -> int +val cmp: 'a t -> 'a t -> ('a -> 'a -> int) -> int (** [cmp m1 m2 cmp] First compare by size, if size is the same, compare by key, value pair *) -val eqU: 'a t -> 'a t -> ('a -> 'a -> bool [@bs]) -> bool -val eq: 'a t -> 'a t -> ('a -> 'a -> bool ) -> bool +val eq: 'a t -> 'a t -> ('a -> 'a -> bool ) -> bool (** [eq m1 m2 cmp] *) - -val forEachU: 'a t -> (key -> 'a -> unit [@bs]) -> unit -val forEach: 'a t -> (key -> 'a -> unit) -> unit + +val forEach: 'a t -> (key -> 'a -> unit) -> unit (** [forEach m f] applies [f] to all bindings in map [m]. [f] receives the key as first argument, and the associated value as second argument. The application order of [f] is in increasing order. *) -val reduceU: 'a t -> 'b -> ('b -> key -> 'a -> 'b [@bs]) -> 'b val reduce: 'a t -> 'b -> ('b -> key -> 'a -> 'b ) -> 'b (** [reduce m a f] computes [(f kN dN ... (f k1 d1 a)...)], where [k1 ... kN] are the keys of all bindings in [m] (in increasing order), and [d1 ... dN] are the associated data. *) -val everyU: 'a t -> (key -> 'a -> bool [@bs]) -> bool -val every: 'a t -> (key -> 'a -> bool) -> bool +val every: 'a t -> (key -> 'a -> bool) -> bool (** [every m p] checks if all the bindings of the map satisfy the predicate [p]. - The application order of [p] is unspecified. + The application order of [p] is unspecified. *) -val someU: 'a t -> (key -> 'a -> bool [@bs]) -> bool -val some: 'a t -> (key -> 'a -> bool) -> bool +val some: 'a t -> (key -> 'a -> bool) -> bool (** [some m p] checks if at least one binding of the map satisfy the predicate [p]. - The application order of [p] is unspecified. + The application order of [p] is unspecified. *) @@ -79,17 +73,17 @@ val some: 'a t -> (key -> 'a -> bool) -> bool val size: 'a t -> int val toList: 'a t -> (key * 'a) list (** In increasing order *) -val toArray: 'a t -> (key * 'a) array +val toArray: 'a t -> (key * 'a) array -val ofArray: (key * 'a) array -> 'a t +val ofArray: (key * 'a) array -> 'a t [@@ocaml.deprecated "Use fromArray instead"] -val fromArray: (key * 'a) array -> 'a t -val keysToArray: 'a t -> key array +val fromArray: (key * 'a) array -> 'a t +val keysToArray: 'a t -> key array val valuesToArray: 'a t -> 'a array -val minKey: _ t -> key option +val minKey: _ t -> key option val minKeyUndefined: _ t -> key Js.undefined -val maxKey: _ t -> key option +val maxKey: _ t -> key option val maxKeyUndefined: _ t -> key Js.undefined val minimum: 'a t -> (key * 'a) option val minUndefined: 'a t -> (key * 'a) Js.undefined @@ -102,28 +96,26 @@ val getExn: 'a t -> key -> 'a val checkInvariantInternal: _ t -> unit (** {b raise} when invariant is not held -*) - +*) + (****************************************************************************) (*TODO: add functional [merge, partition, keep, split]*) -val remove: 'a t -> key -> unit +val remove: 'a t -> key -> unit (** [remove m x] do the in-place modification *) val removeMany: 'a t -> key array -> unit - -val set: 'a t -> key -> 'a -> unit + +val set: 'a t -> key -> 'a -> unit (** [add m x y] do the in-place modification, return [m] for chaining. If [x] was already bound in [m], its previous binding disappears. *) -val updateU: 'a t -> key -> ('a option -> 'a option [@bs]) -> unit -val update: 'a t -> key -> ('a option -> 'a option) -> unit +val update: 'a t -> key -> ('a option -> 'a option) -> unit -val mapU: 'a t -> ('a -> 'b [@bs]) -> 'b t val map: 'a t -> ('a -> 'b) -> 'b t (** [map m f] returns a map with same domain as [m], where the associated value [a] of all bindings of [m] has been @@ -131,8 +123,26 @@ val map: 'a t -> ('a -> 'b) -> 'b t The bindings are passed to [f] in increasing order with respect to the ordering over the type of the keys. *) -val mapWithKeyU: 'a t -> (key -> 'a -> 'b [@bs]) -> 'b t -val mapWithKey: 'a t -> (key -> 'a -> 'b) -> 'b t +val mapWithKey: 'a t -> (key -> 'a -> 'b) -> 'b t +(** {1 Uncurried version} *) + +val cmpU: 'a t -> 'a t -> ('a -> 'a -> int [@bs]) -> int + +val eqU: 'a t -> 'a t -> ('a -> 'a -> bool [@bs]) -> bool + +val forEachU: 'a t -> (key -> 'a -> unit [@bs]) -> unit + +val reduceU: 'a t -> 'b -> ('b -> key -> 'a -> 'b [@bs]) -> 'b + +val everyU: 'a t -> (key -> 'a -> bool [@bs]) -> bool + +val someU: 'a t -> (key -> 'a -> bool [@bs]) -> bool + +val updateU: 'a t -> key -> ('a option -> 'a option [@bs]) -> unit + +val mapU: 'a t -> ('a -> 'b [@bs]) -> 'b t + +val mapWithKeyU: 'a t -> (key -> 'a -> 'b [@bs]) -> 'b t diff --git a/jscomp/others/belt_MutableSetInt.mli b/jscomp/others/belt_MutableSetInt.mli index eb2b8b449c..cbebfeb544 100644 --- a/jscomp/others/belt_MutableSetInt.mli +++ b/jscomp/others/belt_MutableSetInt.mli @@ -1,6 +1,6 @@ # 1 "setm.cppo.mli" (* Copyright (C) 2017 Authors of BuckleScript - * + * * 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 @@ -18,7 +18,7 @@ * 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. *) @@ -40,7 +40,7 @@ type value = int type t (** The type of sets. *) - + val make: unit -> t val fromArray: value array -> t @@ -51,51 +51,45 @@ val ofArray: value array -> t val ofSortedArrayUnsafe: value array -> t [@@ocaml.deprecated "Use fromSortedArrayUnsafe instead"] -val copy: t -> t +val copy: t -> t val isEmpty: t -> bool val has: t -> value -> bool val add: t -> value -> unit -val addCheck: t -> value -> bool +val addCheck: t -> value -> bool val mergeMany: t -> value array -> unit val remove: t -> value -> unit -val removeCheck: t -> value -> bool +val removeCheck: t -> value -> bool val removeMany: t -> value array -> unit - + val union: t -> t -> t val intersect: t -> t -> t val diff: t -> t -> t val subset: t -> t -> bool - + val cmp: t -> t -> int val eq: t -> t -> bool -val forEachU: t -> (value -> unit [@bs]) -> unit val forEach: t -> (value -> unit ) -> unit (** In increasing order*) -val reduceU: t -> 'a -> ('a -> value -> 'a [@bs]) -> 'a -val reduce: t -> 'a -> ('a -> value -> 'a ) -> 'a +val reduce: t -> 'a -> ('a -> value -> 'a ) -> 'a (** Iterate in increasing order. *) -val everyU: t -> (value -> bool [@bs]) -> bool -val every: t -> (value -> bool) -> bool +val every: t -> (value -> bool) -> bool (** [every p s] checks if all elements of the set satisfy the predicate [p]. Order unspecified. *) -val someU: t -> (value -> bool [@bs]) -> bool -val some: t -> (value -> bool) -> bool +val some: t -> (value -> bool) -> bool (** [some p s] checks if at least one element of the set satisfies the predicate [p]. Oder unspecified. *) -val keepU: t -> (value -> bool [@bs]) -> t -val keep: t -> (value -> bool) -> t +val keep: t -> (value -> bool) -> t (** [keep s p] returns a fresh copy of the set of all elements in [s] that satisfy predicate [p]. *) -val partitionU: t -> (value -> bool [@bs]) -> t * t -val partition: t -> (value -> bool) -> t * t +val partition: t -> (value -> bool) -> t * t (** [partition s p] returns a fresh copy pair of sets [(s1, s2)], where [s1] is the set of all the elements of [s] that satisfy the predicate [p], and [s2] is the set of all the elements of @@ -115,7 +109,7 @@ val maxUndefined: t -> value Js.undefined val get: t -> value -> value option val getUndefined: t -> value -> value Js.undefined val getExn: t -> value -> value -val split: t -> value -> (t * t) * bool +val split: t -> value -> (t * t) * bool (** [split s key] return a fresh copy of each *) @@ -123,8 +117,20 @@ val split: t -> value -> (t * t) * bool val checkInvariantInternal: t -> unit (** {b raise} when invariant is not held -*) +*) +(** {1 Uncurried version} *) +val forEachU: t -> (value -> unit [@bs]) -> unit + +val reduceU: t -> 'a -> ('a -> value -> 'a [@bs]) -> 'a + +val everyU: t -> (value -> bool [@bs]) -> bool + +val someU: t -> (value -> bool [@bs]) -> bool + +val keepU: t -> (value -> bool [@bs]) -> t + +val partitionU: t -> (value -> bool [@bs]) -> t * t diff --git a/jscomp/others/belt_MutableSetString.mli b/jscomp/others/belt_MutableSetString.mli index 27632c8112..beca4cc91e 100644 --- a/jscomp/others/belt_MutableSetString.mli +++ b/jscomp/others/belt_MutableSetString.mli @@ -1,6 +1,6 @@ # 1 "setm.cppo.mli" (* Copyright (C) 2017 Authors of BuckleScript - * + * * 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 @@ -18,7 +18,7 @@ * 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. *) @@ -40,7 +40,7 @@ type value = string type t (** The type of sets. *) - + val make: unit -> t val fromArray: value array -> t @@ -51,51 +51,45 @@ val ofArray: value array -> t val ofSortedArrayUnsafe: value array -> t [@@ocaml.deprecated "Use fromSortedArrayUnsafe instead"] -val copy: t -> t +val copy: t -> t val isEmpty: t -> bool val has: t -> value -> bool val add: t -> value -> unit -val addCheck: t -> value -> bool +val addCheck: t -> value -> bool val mergeMany: t -> value array -> unit val remove: t -> value -> unit -val removeCheck: t -> value -> bool +val removeCheck: t -> value -> bool val removeMany: t -> value array -> unit - + val union: t -> t -> t val intersect: t -> t -> t val diff: t -> t -> t val subset: t -> t -> bool - + val cmp: t -> t -> int val eq: t -> t -> bool -val forEachU: t -> (value -> unit [@bs]) -> unit val forEach: t -> (value -> unit ) -> unit (** In increasing order*) -val reduceU: t -> 'a -> ('a -> value -> 'a [@bs]) -> 'a -val reduce: t -> 'a -> ('a -> value -> 'a ) -> 'a +val reduce: t -> 'a -> ('a -> value -> 'a ) -> 'a (** Iterate in increasing order. *) -val everyU: t -> (value -> bool [@bs]) -> bool -val every: t -> (value -> bool) -> bool +val every: t -> (value -> bool) -> bool (** [every p s] checks if all elements of the set satisfy the predicate [p]. Order unspecified. *) -val someU: t -> (value -> bool [@bs]) -> bool -val some: t -> (value -> bool) -> bool +val some: t -> (value -> bool) -> bool (** [some p s] checks if at least one element of the set satisfies the predicate [p]. Oder unspecified. *) -val keepU: t -> (value -> bool [@bs]) -> t -val keep: t -> (value -> bool) -> t +val keep: t -> (value -> bool) -> t (** [keep s p] returns a fresh copy of the set of all elements in [s] that satisfy predicate [p]. *) -val partitionU: t -> (value -> bool [@bs]) -> t * t -val partition: t -> (value -> bool) -> t * t +val partition: t -> (value -> bool) -> t * t (** [partition s p] returns a fresh copy pair of sets [(s1, s2)], where [s1] is the set of all the elements of [s] that satisfy the predicate [p], and [s2] is the set of all the elements of @@ -115,7 +109,7 @@ val maxUndefined: t -> value Js.undefined val get: t -> value -> value option val getUndefined: t -> value -> value Js.undefined val getExn: t -> value -> value -val split: t -> value -> (t * t) * bool +val split: t -> value -> (t * t) * bool (** [split s key] return a fresh copy of each *) @@ -123,8 +117,20 @@ val split: t -> value -> (t * t) * bool val checkInvariantInternal: t -> unit (** {b raise} when invariant is not held -*) +*) +(** {1 Uncurried version} *) +val forEachU: t -> (value -> unit [@bs]) -> unit + +val reduceU: t -> 'a -> ('a -> value -> 'a [@bs]) -> 'a + +val everyU: t -> (value -> bool [@bs]) -> bool + +val someU: t -> (value -> bool [@bs]) -> bool + +val keepU: t -> (value -> bool [@bs]) -> t + +val partitionU: t -> (value -> bool [@bs]) -> t * t diff --git a/jscomp/others/belt_SetDict.mli b/jscomp/others/belt_SetDict.mli index 95629b96e6..9d55a43baf 100644 --- a/jscomp/others/belt_SetDict.mli +++ b/jscomp/others/belt_SetDict.mli @@ -1,5 +1,5 @@ (* Copyright (C) 2017 Authors of BuckleScript - * + * * 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 @@ -17,7 +17,7 @@ * 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. *) @@ -25,7 +25,7 @@ type ('key, 'id) t type ('key, 'id) cmp = ('key, 'id) Belt_Id.cmp - + val empty: ('value, 'id) t val ofArray: 'k array -> cmp:('k, 'id) cmp -> ('k, 'id) t @@ -36,7 +36,7 @@ val ofSortedArrayUnsafe: 'value array -> ('value,'id) t val fromArray: 'k array -> cmp:('k, 'id) cmp -> ('k, 'id) t val fromSortedArrayUnsafe: 'value array -> ('value,'id) t - + val isEmpty: _ t -> bool val has: ('k, 'id) t -> 'k -> @@ -44,16 +44,16 @@ val has: bool -val add: +val add: ('k, 'id) t -> 'k -> cmp:('k, 'id) cmp -> ('k, 'id) t (** [add s x] If [x] was already in [s], [s] is returned unchanged. *) - + val mergeMany: ('value, 'id) t -> 'value array -> cmp:('value, 'id) cmp -> - ('value, 'id) t + ('value, 'id) t val remove: ('value, 'id) t -> @@ -65,7 +65,7 @@ val remove: val removeMany: ('value, 'id) t -> 'value array -> cmp:('value, 'id) cmp -> - ('value, 'id) t + ('value, 'id) t val union: @@ -76,13 +76,13 @@ val intersect: ('value, 'id) t -> ('value, 'id) t -> cmp:('value, 'id) cmp -> ('value, 'id) t - + val diff: ('value, 'id) t -> ('value, 'id) t -> cmp:('value, 'id) cmp -> ('value, 'id) t val subset: ('value, 'id) t -> ('value, 'id) t -> cmp:('value, 'id) cmp -> - bool + bool val cmp: ('value, 'id) t -> ('value, 'id) t -> cmp:('value, 'id) cmp -> @@ -93,32 +93,26 @@ val eq: ('value, 'id) t -> ('value, 'id) t -> cmp:('value, 'id) cmp -> bool -val forEachU: ('value, 'id) t -> ('value -> unit [@bs]) -> unit -val forEach: ('value, 'id) t -> ('value -> unit ) -> unit +val forEach: ('value, 'id) t -> ('value -> unit ) -> unit (** [forEach s f] applies [f] in turn to all elements of [s]. In increasing order *) - -val reduceU: ('value, 'id) t -> 'a -> ('a -> 'value -> 'a [@bs]) -> 'a -val reduce: ('value, 'id) t -> 'a -> ('a -> 'value -> 'a) -> 'a + +val reduce: ('value, 'id) t -> 'a -> ('a -> 'value -> 'a) -> 'a (** In increasing order. *) -val everyU: ('value, 'id) t -> ('value -> bool [@bs]) -> bool -val every: ('value, 'id) t -> ('value -> bool) -> bool +val every: ('value, 'id) t -> ('value -> bool) -> bool (** [every p s] checks if all elements of the set satisfy the predicate [p]. Order unspecified *) -val someU: ('value, 'id) t -> ('value -> bool [@bs]) -> bool -val some: ('value, 'id) t -> ('value -> bool) -> bool +val some: ('value, 'id) t -> ('value -> bool) -> bool (** [some p s] checks if at least one element of the set satisfies the predicate [p]. *) -val keepU: ('value, 'id) t -> ('value -> bool [@bs]) -> ('value, 'id) t val keep: ('value, 'id) t -> ('value -> bool) -> ('value, 'id) t (** [keep m p] returns the set of all elements in [s] - that satisfy predicate [p]. *) + that satisfy predicate [p]. *) -val partitionU: ('value, 'id) t -> ('value -> bool [@bs]) -> ('value, 'id) t * ('value, 'id) t -val partition: ('value, 'id) t -> ('value -> bool ) -> ('value, 'id) t * ('value, 'id) t +val partition: ('value, 'id) t -> ('value -> bool ) -> ('value, 'id) t * ('value, 'id) t (** [partition m p] returns a pair of sets [(s1, s2)], where [s1] is the set of all the elements of [s] that satisfy the predicate [p], and [s2] is the set of all the elements of @@ -138,21 +132,35 @@ val maxUndefined: ('value, 'id) t -> 'value Js.undefined val get: ('value, 'id) t -> 'value -> cmp:('value, 'id) cmp -> - 'value option + 'value option val getUndefined: ('value, 'id) t -> 'value -> cmp:('value, 'id) cmp -> 'value Js.undefined val getExn: ('value, 'id) t -> 'value -> cmp:('value, 'id) cmp -> - 'value + 'value val split: ('value, 'id) t -> 'value -> cmp:('value, 'id) cmp -> (('value, 'id) t * ('value, 'id) t) * bool - + val checkInvariantInternal: _ t -> unit (** {b raise} when invariant is not held -*) - +*) + + +(** {1 Uncurried version} *) + + +val forEachU: ('value, 'id) t -> ('value -> unit [@bs]) -> unit + +val reduceU: ('value, 'id) t -> 'a -> ('a -> 'value -> 'a [@bs]) -> 'a +val everyU: ('value, 'id) t -> ('value -> bool [@bs]) -> bool + +val someU: ('value, 'id) t -> ('value -> bool [@bs]) -> bool + +val keepU: ('value, 'id) t -> ('value -> bool [@bs]) -> ('value, 'id) t + +val partitionU: ('value, 'id) t -> ('value -> bool [@bs]) -> ('value, 'id) t * ('value, 'id) t diff --git a/jscomp/others/hashmap.cppo.mli b/jscomp/others/hashmap.cppo.mli index 5ce40573dd..7fff96be34 100644 --- a/jscomp/others/hashmap.cppo.mli +++ b/jscomp/others/hashmap.cppo.mli @@ -4,43 +4,40 @@ type key = string type key = int #else [%error "unknown type"] -#endif +#endif -type 'b t +type 'b t -val make: hintSize:int -> 'b t +val make: hintSize:int -> 'b t val clear: 'b t -> unit val isEmpty: _ t -> bool - + val set: 'a t -> key -> 'a -> unit (** [setDone tbl k v] if [k] does not exist, add the binding [k,v], otherwise, update the old value with the new [v] *) - -val copy: 'a t -> 'a t + +val copy: 'a t -> 'a t val get: 'a t -> key -> 'a option val has: 'b t -> key -> bool val remove: 'a t -> key -> unit -val forEachU: 'b t -> (key -> 'b -> unit [@bs]) -> unit val forEach: 'b t -> (key -> 'b -> unit) -> unit -val reduceU: 'b t -> 'c -> ('c -> key -> 'b -> 'c [@bs]) -> 'c val reduce: 'b t -> 'c -> ('c -> key -> 'b -> 'c) -> 'c -val keepMapInPlaceU: 'a t -> (key -> 'a -> 'a option [@bs]) -> unit val keepMapInPlace: 'a t -> (key -> 'a -> 'a option) -> unit - -val size: _ t -> int + +val size: _ t -> int val toArray: 'a t -> (key * 'a) array @@ -53,3 +50,11 @@ val logStats: _ t -> unit val ofArray: (key * 'a) array -> 'a t [@@ocaml.deprecated "Use fromArray instead"] + + +(** {1 Uncurried version} *) + + +val forEachU: 'b t -> (key -> 'b -> unit [@bs]) -> unit +val reduceU: 'b t -> 'c -> ('c -> key -> 'b -> 'c [@bs]) -> 'c +val keepMapInPlaceU: 'a t -> (key -> 'a -> 'a option [@bs]) -> unit diff --git a/jscomp/others/hashset.cppo.mli b/jscomp/others/hashset.cppo.mli index dd8042da3a..d2177af2e4 100644 --- a/jscomp/others/hashset.cppo.mli +++ b/jscomp/others/hashset.cppo.mli @@ -1,6 +1,6 @@ (* Copyright (C) 2017 Authors of BuckleScript - * + * * 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 @@ -18,7 +18,7 @@ * 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. *) @@ -38,42 +38,48 @@ type key = string type key = int #else [%error "unknown type"] -#endif +#endif type t -val make: hintSize:int -> t +val make: hintSize:int -> t val clear: t -> unit val isEmpty: t -> bool - + val add: t -> key -> unit val copy: t -> t - + val has: t -> key -> bool - + val remove: t -> key -> unit -val forEachU: t -> (key -> unit [@bs]) -> unit val forEach: t -> (key -> unit) -> unit - -val reduceU: t -> 'c -> ( 'c -> key -> 'c [@bs]) -> 'c + val reduce: t -> 'c -> ( 'c -> key -> 'c) -> 'c - -val size: t -> int + +val size: t -> int val logStats: t -> unit -val toArray: t -> key array +val toArray: t -> key array -val ofArray: key array -> t +val ofArray: key array -> t [@@ocaml.deprecated "Use fromArray instead"] -val fromArray: key array -> t +val fromArray: key array -> t val mergeMany: t -> key array -> unit val getBucketHistogram: t -> int array + + +(** {1 Uncurried version} *) + + +val forEachU: t -> (key -> unit [@bs]) -> unit + +val reduceU: t -> 'c -> ( 'c -> key -> 'c [@bs]) -> 'c diff --git a/jscomp/others/mapm.cppo.mli b/jscomp/others/mapm.cppo.mli index fb7a694766..a0ef38fb45 100644 --- a/jscomp/others/mapm.cppo.mli +++ b/jscomp/others/mapm.cppo.mli @@ -1,5 +1,5 @@ (* Copyright (C) 2017 Authors of BuckleScript - * + * * 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 @@ -17,7 +17,7 @@ * 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. *) @@ -28,7 +28,7 @@ type key = string type key = int #else [%error "unknown type"] -#endif +#endif type 'a t @@ -38,42 +38,36 @@ val isEmpty: 'a t -> bool val has: 'a t -> key -> bool -val cmpU: 'a t -> 'a t -> ('a -> 'a -> int [@bs]) -> int -val cmp: 'a t -> 'a t -> ('a -> 'a -> int) -> int +val cmp: 'a t -> 'a t -> ('a -> 'a -> int) -> int (** [cmp m1 m2 cmp] First compare by size, if size is the same, compare by key, value pair *) -val eqU: 'a t -> 'a t -> ('a -> 'a -> bool [@bs]) -> bool -val eq: 'a t -> 'a t -> ('a -> 'a -> bool ) -> bool +val eq: 'a t -> 'a t -> ('a -> 'a -> bool ) -> bool (** [eq m1 m2 cmp] *) - -val forEachU: 'a t -> (key -> 'a -> unit [@bs]) -> unit -val forEach: 'a t -> (key -> 'a -> unit) -> unit + +val forEach: 'a t -> (key -> 'a -> unit) -> unit (** [forEach m f] applies [f] to all bindings in map [m]. [f] receives the key as first argument, and the associated value as second argument. The application order of [f] is in increasing order. *) -val reduceU: 'a t -> 'b -> ('b -> key -> 'a -> 'b [@bs]) -> 'b val reduce: 'a t -> 'b -> ('b -> key -> 'a -> 'b ) -> 'b (** [reduce m a f] computes [(f kN dN ... (f k1 d1 a)...)], where [k1 ... kN] are the keys of all bindings in [m] (in increasing order), and [d1 ... dN] are the associated data. *) -val everyU: 'a t -> (key -> 'a -> bool [@bs]) -> bool -val every: 'a t -> (key -> 'a -> bool) -> bool +val every: 'a t -> (key -> 'a -> bool) -> bool (** [every m p] checks if all the bindings of the map satisfy the predicate [p]. - The application order of [p] is unspecified. + The application order of [p] is unspecified. *) -val someU: 'a t -> (key -> 'a -> bool [@bs]) -> bool -val some: 'a t -> (key -> 'a -> bool) -> bool +val some: 'a t -> (key -> 'a -> bool) -> bool (** [some m p] checks if at least one binding of the map satisfy the predicate [p]. - The application order of [p] is unspecified. + The application order of [p] is unspecified. *) @@ -82,17 +76,17 @@ val some: 'a t -> (key -> 'a -> bool) -> bool val size: 'a t -> int val toList: 'a t -> (key * 'a) list (** In increasing order *) -val toArray: 'a t -> (key * 'a) array +val toArray: 'a t -> (key * 'a) array -val ofArray: (key * 'a) array -> 'a t +val ofArray: (key * 'a) array -> 'a t [@@ocaml.deprecated "Use fromArray instead"] -val fromArray: (key * 'a) array -> 'a t -val keysToArray: 'a t -> key array +val fromArray: (key * 'a) array -> 'a t +val keysToArray: 'a t -> key array val valuesToArray: 'a t -> 'a array -val minKey: _ t -> key option +val minKey: _ t -> key option val minKeyUndefined: _ t -> key Js.undefined -val maxKey: _ t -> key option +val maxKey: _ t -> key option val maxKeyUndefined: _ t -> key Js.undefined val minimum: 'a t -> (key * 'a) option val minUndefined: 'a t -> (key * 'a) Js.undefined @@ -105,28 +99,26 @@ val getExn: 'a t -> key -> 'a val checkInvariantInternal: _ t -> unit (** {b raise} when invariant is not held -*) - +*) + (****************************************************************************) (*TODO: add functional [merge, partition, keep, split]*) -val remove: 'a t -> key -> unit +val remove: 'a t -> key -> unit (** [remove m x] do the in-place modification *) val removeMany: 'a t -> key array -> unit - -val set: 'a t -> key -> 'a -> unit + +val set: 'a t -> key -> 'a -> unit (** [add m x y] do the in-place modification, return [m] for chaining. If [x] was already bound in [m], its previous binding disappears. *) -val updateU: 'a t -> key -> ('a option -> 'a option [@bs]) -> unit -val update: 'a t -> key -> ('a option -> 'a option) -> unit +val update: 'a t -> key -> ('a option -> 'a option) -> unit -val mapU: 'a t -> ('a -> 'b [@bs]) -> 'b t val map: 'a t -> ('a -> 'b) -> 'b t (** [map m f] returns a map with same domain as [m], where the associated value [a] of all bindings of [m] has been @@ -134,8 +126,26 @@ val map: 'a t -> ('a -> 'b) -> 'b t The bindings are passed to [f] in increasing order with respect to the ordering over the type of the keys. *) -val mapWithKeyU: 'a t -> (key -> 'a -> 'b [@bs]) -> 'b t -val mapWithKey: 'a t -> (key -> 'a -> 'b) -> 'b t +val mapWithKey: 'a t -> (key -> 'a -> 'b) -> 'b t +(** {1 Uncurried version} *) + +val cmpU: 'a t -> 'a t -> ('a -> 'a -> int [@bs]) -> int + +val eqU: 'a t -> 'a t -> ('a -> 'a -> bool [@bs]) -> bool + +val forEachU: 'a t -> (key -> 'a -> unit [@bs]) -> unit + +val reduceU: 'a t -> 'b -> ('b -> key -> 'a -> 'b [@bs]) -> 'b + +val everyU: 'a t -> (key -> 'a -> bool [@bs]) -> bool + +val someU: 'a t -> (key -> 'a -> bool [@bs]) -> bool + +val updateU: 'a t -> key -> ('a option -> 'a option [@bs]) -> unit + +val mapU: 'a t -> ('a -> 'b [@bs]) -> 'b t + +val mapWithKeyU: 'a t -> (key -> 'a -> 'b [@bs]) -> 'b t diff --git a/jscomp/others/setm.cppo.mli b/jscomp/others/setm.cppo.mli index dff7322a14..570f1e76ce 100644 --- a/jscomp/others/setm.cppo.mli +++ b/jscomp/others/setm.cppo.mli @@ -1,5 +1,5 @@ (* Copyright (C) 2017 Authors of BuckleScript - * + * * 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 @@ -17,7 +17,7 @@ * 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. *) @@ -37,13 +37,13 @@ type value = string type value = int #else [%error "unknown type"] -#endif +#endif (** The type of the set elements. *) type t (** The type of sets. *) - + val make: unit -> t val fromArray: value array -> t @@ -54,51 +54,45 @@ val ofArray: value array -> t val ofSortedArrayUnsafe: value array -> t [@@ocaml.deprecated "Use fromSortedArrayUnsafe instead"] -val copy: t -> t +val copy: t -> t val isEmpty: t -> bool val has: t -> value -> bool val add: t -> value -> unit -val addCheck: t -> value -> bool +val addCheck: t -> value -> bool val mergeMany: t -> value array -> unit val remove: t -> value -> unit -val removeCheck: t -> value -> bool +val removeCheck: t -> value -> bool val removeMany: t -> value array -> unit - + val union: t -> t -> t val intersect: t -> t -> t val diff: t -> t -> t val subset: t -> t -> bool - + val cmp: t -> t -> int val eq: t -> t -> bool -val forEachU: t -> (value -> unit [@bs]) -> unit val forEach: t -> (value -> unit ) -> unit (** In increasing order*) -val reduceU: t -> 'a -> ('a -> value -> 'a [@bs]) -> 'a -val reduce: t -> 'a -> ('a -> value -> 'a ) -> 'a +val reduce: t -> 'a -> ('a -> value -> 'a ) -> 'a (** Iterate in increasing order. *) -val everyU: t -> (value -> bool [@bs]) -> bool -val every: t -> (value -> bool) -> bool +val every: t -> (value -> bool) -> bool (** [every p s] checks if all elements of the set satisfy the predicate [p]. Order unspecified. *) -val someU: t -> (value -> bool [@bs]) -> bool -val some: t -> (value -> bool) -> bool +val some: t -> (value -> bool) -> bool (** [some p s] checks if at least one element of the set satisfies the predicate [p]. Oder unspecified. *) -val keepU: t -> (value -> bool [@bs]) -> t -val keep: t -> (value -> bool) -> t +val keep: t -> (value -> bool) -> t (** [keep s p] returns a fresh copy of the set of all elements in [s] that satisfy predicate [p]. *) -val partitionU: t -> (value -> bool [@bs]) -> t * t -val partition: t -> (value -> bool) -> t * t +val partition: t -> (value -> bool) -> t * t (** [partition s p] returns a fresh copy pair of sets [(s1, s2)], where [s1] is the set of all the elements of [s] that satisfy the predicate [p], and [s2] is the set of all the elements of @@ -118,7 +112,7 @@ val maxUndefined: t -> value Js.undefined val get: t -> value -> value option val getUndefined: t -> value -> value Js.undefined val getExn: t -> value -> value -val split: t -> value -> (t * t) * bool +val split: t -> value -> (t * t) * bool (** [split s key] return a fresh copy of each *) @@ -126,8 +120,20 @@ val split: t -> value -> (t * t) * bool val checkInvariantInternal: t -> unit (** {b raise} when invariant is not held -*) +*) +(** {1 Uncurried version} *) +val forEachU: t -> (value -> unit [@bs]) -> unit + +val reduceU: t -> 'a -> ('a -> value -> 'a [@bs]) -> 'a + +val everyU: t -> (value -> bool [@bs]) -> bool + +val someU: t -> (value -> bool [@bs]) -> bool + +val keepU: t -> (value -> bool [@bs]) -> t + +val partitionU: t -> (value -> bool [@bs]) -> t * t diff --git a/lib/js/belt_Array.js b/lib/js/belt_Array.js index 28a3215275..f6f421e195 100644 --- a/lib/js/belt_Array.js +++ b/lib/js/belt_Array.js @@ -566,12 +566,9 @@ exports.reverse = reverse; exports.make = make; exports.range = range; exports.rangeBy = rangeBy; -exports.makeByU = makeByU; exports.makeBy = makeBy; -exports.makeByAndShuffleU = makeByAndShuffleU; exports.makeByAndShuffle = makeByAndShuffle; exports.zip = zip; -exports.zipByU = zipByU; exports.zipBy = zipBy; exports.concat = concat; exports.concatMany = concatMany; @@ -580,34 +577,37 @@ exports.copy = copy; exports.fill = fill; exports.blit = blit; exports.blitUnsafe = blitUnsafe; -exports.forEachU = forEachU; exports.forEach = forEach; -exports.mapU = mapU; exports.map = map; -exports.keepU = keepU; exports.keep = keep; -exports.keepMapU = keepMapU; exports.keepMap = keepMap; -exports.forEachWithIndexU = forEachWithIndexU; exports.forEachWithIndex = forEachWithIndex; -exports.mapWithIndexU = mapWithIndexU; exports.mapWithIndex = mapWithIndex; -exports.reduceU = reduceU; exports.reduce = reduce; -exports.reduceReverseU = reduceReverseU; exports.reduceReverse = reduceReverse; -exports.reduceReverse2U = reduceReverse2U; exports.reduceReverse2 = reduceReverse2; -exports.someU = someU; exports.some = some; -exports.everyU = everyU; exports.every = every; -exports.every2U = every2U; exports.every2 = every2; -exports.some2U = some2U; exports.some2 = some2; -exports.cmpU = cmpU; exports.cmp = cmp; -exports.eqU = eqU; exports.eq = eq; +exports.makeByU = makeByU; +exports.makeByAndShuffleU = makeByAndShuffleU; +exports.zipByU = zipByU; +exports.forEachU = forEachU; +exports.mapU = mapU; +exports.keepU = keepU; +exports.keepMapU = keepMapU; +exports.forEachWithIndexU = forEachWithIndexU; +exports.mapWithIndexU = mapWithIndexU; +exports.reduceU = reduceU; +exports.reduceReverseU = reduceReverseU; +exports.reduceReverse2U = reduceReverse2U; +exports.someU = someU; +exports.everyU = everyU; +exports.every2U = every2U; +exports.some2U = some2U; +exports.cmpU = cmpU; +exports.eqU = eqU; /* No side effect */ diff --git a/lib/js/belt_HashMapInt.js b/lib/js/belt_HashMapInt.js index ffc502442a..e66afa416d 100644 --- a/lib/js/belt_HashMapInt.js +++ b/lib/js/belt_HashMapInt.js @@ -243,16 +243,10 @@ var isEmpty = Belt_internalBucketsType.isEmpty; var copy = Belt_internalBuckets.copy; -var forEachU = Belt_internalBuckets.forEachU; - var forEach = Belt_internalBuckets.forEach; -var reduceU = Belt_internalBuckets.reduceU; - var reduce = Belt_internalBuckets.reduce; -var keepMapInPlaceU = Belt_internalBuckets.keepMapInPlaceU; - var keepMapInPlace = Belt_internalBuckets.keepMapInPlace; var toArray = Belt_internalBuckets.toArray; @@ -267,6 +261,12 @@ var logStats = Belt_internalBuckets.logStats; var ofArray = fromArray; +var forEachU = Belt_internalBuckets.forEachU; + +var reduceU = Belt_internalBuckets.reduceU; + +var keepMapInPlaceU = Belt_internalBuckets.keepMapInPlaceU; + exports.make = make; exports.clear = clear; exports.isEmpty = isEmpty; @@ -275,11 +275,8 @@ exports.copy = copy; exports.get = get; exports.has = has; exports.remove = remove; -exports.forEachU = forEachU; exports.forEach = forEach; -exports.reduceU = reduceU; exports.reduce = reduce; -exports.keepMapInPlaceU = keepMapInPlaceU; exports.keepMapInPlace = keepMapInPlace; exports.size = size; exports.toArray = toArray; @@ -290,4 +287,7 @@ exports.mergeMany = mergeMany; exports.getBucketHistogram = getBucketHistogram; exports.logStats = logStats; exports.ofArray = ofArray; +exports.forEachU = forEachU; +exports.reduceU = reduceU; +exports.keepMapInPlaceU = keepMapInPlaceU; /* No side effect */ diff --git a/lib/js/belt_HashMapString.js b/lib/js/belt_HashMapString.js index 778fbc2c18..8a95b530bc 100644 --- a/lib/js/belt_HashMapString.js +++ b/lib/js/belt_HashMapString.js @@ -243,16 +243,10 @@ var isEmpty = Belt_internalBucketsType.isEmpty; var copy = Belt_internalBuckets.copy; -var forEachU = Belt_internalBuckets.forEachU; - var forEach = Belt_internalBuckets.forEach; -var reduceU = Belt_internalBuckets.reduceU; - var reduce = Belt_internalBuckets.reduce; -var keepMapInPlaceU = Belt_internalBuckets.keepMapInPlaceU; - var keepMapInPlace = Belt_internalBuckets.keepMapInPlace; var toArray = Belt_internalBuckets.toArray; @@ -267,6 +261,12 @@ var logStats = Belt_internalBuckets.logStats; var ofArray = fromArray; +var forEachU = Belt_internalBuckets.forEachU; + +var reduceU = Belt_internalBuckets.reduceU; + +var keepMapInPlaceU = Belt_internalBuckets.keepMapInPlaceU; + exports.make = make; exports.clear = clear; exports.isEmpty = isEmpty; @@ -275,11 +275,8 @@ exports.copy = copy; exports.get = get; exports.has = has; exports.remove = remove; -exports.forEachU = forEachU; exports.forEach = forEach; -exports.reduceU = reduceU; exports.reduce = reduce; -exports.keepMapInPlaceU = keepMapInPlaceU; exports.keepMapInPlace = keepMapInPlace; exports.size = size; exports.toArray = toArray; @@ -290,4 +287,7 @@ exports.mergeMany = mergeMany; exports.getBucketHistogram = getBucketHistogram; exports.logStats = logStats; exports.ofArray = ofArray; +exports.forEachU = forEachU; +exports.reduceU = reduceU; +exports.keepMapInPlaceU = keepMapInPlaceU; /* No side effect */ diff --git a/lib/js/belt_HashSetInt.js b/lib/js/belt_HashSetInt.js index eded1d178a..116049ca00 100644 --- a/lib/js/belt_HashSetInt.js +++ b/lib/js/belt_HashSetInt.js @@ -189,12 +189,8 @@ var isEmpty = Belt_internalBucketsType.isEmpty; var copy = Belt_internalSetBuckets.copy; -var forEachU = Belt_internalSetBuckets.forEachU; - var forEach = Belt_internalSetBuckets.forEach; -var reduceU = Belt_internalSetBuckets.reduceU; - var reduce = Belt_internalSetBuckets.reduce; var logStats = Belt_internalSetBuckets.logStats; @@ -205,6 +201,10 @@ var ofArray = fromArray; var getBucketHistogram = Belt_internalSetBuckets.getBucketHistogram; +var forEachU = Belt_internalSetBuckets.forEachU; + +var reduceU = Belt_internalSetBuckets.reduceU; + exports.make = make; exports.clear = clear; exports.isEmpty = isEmpty; @@ -212,9 +212,7 @@ exports.add = add; exports.copy = copy; exports.has = has; exports.remove = remove; -exports.forEachU = forEachU; exports.forEach = forEach; -exports.reduceU = reduceU; exports.reduce = reduce; exports.size = size; exports.logStats = logStats; @@ -223,4 +221,6 @@ exports.ofArray = ofArray; exports.fromArray = fromArray; exports.mergeMany = mergeMany; exports.getBucketHistogram = getBucketHistogram; +exports.forEachU = forEachU; +exports.reduceU = reduceU; /* No side effect */ diff --git a/lib/js/belt_HashSetString.js b/lib/js/belt_HashSetString.js index d5005e5483..a2157c4e66 100644 --- a/lib/js/belt_HashSetString.js +++ b/lib/js/belt_HashSetString.js @@ -189,12 +189,8 @@ var isEmpty = Belt_internalBucketsType.isEmpty; var copy = Belt_internalSetBuckets.copy; -var forEachU = Belt_internalSetBuckets.forEachU; - var forEach = Belt_internalSetBuckets.forEach; -var reduceU = Belt_internalSetBuckets.reduceU; - var reduce = Belt_internalSetBuckets.reduce; var logStats = Belt_internalSetBuckets.logStats; @@ -205,6 +201,10 @@ var ofArray = fromArray; var getBucketHistogram = Belt_internalSetBuckets.getBucketHistogram; +var forEachU = Belt_internalSetBuckets.forEachU; + +var reduceU = Belt_internalSetBuckets.reduceU; + exports.make = make; exports.clear = clear; exports.isEmpty = isEmpty; @@ -212,9 +212,7 @@ exports.add = add; exports.copy = copy; exports.has = has; exports.remove = remove; -exports.forEachU = forEachU; exports.forEach = forEach; -exports.reduceU = reduceU; exports.reduce = reduce; exports.size = size; exports.logStats = logStats; @@ -223,4 +221,6 @@ exports.ofArray = ofArray; exports.fromArray = fromArray; exports.mergeMany = mergeMany; exports.getBucketHistogram = getBucketHistogram; +exports.forEachU = forEachU; +exports.reduceU = reduceU; /* No side effect */ diff --git a/lib/js/belt_MutableMapInt.js b/lib/js/belt_MutableMapInt.js index f03a3eb7fe..7cfa1f3d68 100644 --- a/lib/js/belt_MutableMapInt.js +++ b/lib/js/belt_MutableMapInt.js @@ -330,17 +330,11 @@ exports.make = make; exports.clear = clear; exports.isEmpty = isEmpty; exports.has = has; -exports.cmpU = cmpU; exports.cmp = cmp; -exports.eqU = eqU; exports.eq = eq; -exports.forEachU = forEachU; exports.forEach = forEach; -exports.reduceU = reduceU; exports.reduce = reduce; -exports.everyU = everyU; exports.every = every; -exports.someU = someU; exports.some = some; exports.size = size; exports.toList = toList; @@ -365,10 +359,16 @@ exports.checkInvariantInternal = checkInvariantInternal; exports.remove = remove; exports.removeMany = removeMany; exports.set = set; -exports.updateU = updateU; exports.update = update; -exports.mapU = mapU; exports.map = map; -exports.mapWithKeyU = mapWithKeyU; exports.mapWithKey = mapWithKey; +exports.cmpU = cmpU; +exports.eqU = eqU; +exports.forEachU = forEachU; +exports.reduceU = reduceU; +exports.everyU = everyU; +exports.someU = someU; +exports.updateU = updateU; +exports.mapU = mapU; +exports.mapWithKeyU = mapWithKeyU; /* No side effect */ diff --git a/lib/js/belt_MutableMapString.js b/lib/js/belt_MutableMapString.js index 54d0ada188..d4b0ed2b2e 100644 --- a/lib/js/belt_MutableMapString.js +++ b/lib/js/belt_MutableMapString.js @@ -330,17 +330,11 @@ exports.make = make; exports.clear = clear; exports.isEmpty = isEmpty; exports.has = has; -exports.cmpU = cmpU; exports.cmp = cmp; -exports.eqU = eqU; exports.eq = eq; -exports.forEachU = forEachU; exports.forEach = forEach; -exports.reduceU = reduceU; exports.reduce = reduce; -exports.everyU = everyU; exports.every = every; -exports.someU = someU; exports.some = some; exports.size = size; exports.toList = toList; @@ -365,10 +359,16 @@ exports.checkInvariantInternal = checkInvariantInternal; exports.remove = remove; exports.removeMany = removeMany; exports.set = set; -exports.updateU = updateU; exports.update = update; -exports.mapU = mapU; exports.map = map; -exports.mapWithKeyU = mapWithKeyU; exports.mapWithKey = mapWithKey; +exports.cmpU = cmpU; +exports.eqU = eqU; +exports.forEachU = forEachU; +exports.reduceU = reduceU; +exports.everyU = everyU; +exports.someU = someU; +exports.updateU = updateU; +exports.mapU = mapU; +exports.mapWithKeyU = mapWithKeyU; /* No side effect */ diff --git a/lib/js/belt_MutableSetInt.js b/lib/js/belt_MutableSetInt.js index eb7dae4d2b..2149ff5573 100644 --- a/lib/js/belt_MutableSetInt.js +++ b/lib/js/belt_MutableSetInt.js @@ -495,17 +495,11 @@ exports.diff = diff; exports.subset = subset; exports.cmp = cmp; exports.eq = eq; -exports.forEachU = forEachU; exports.forEach = forEach; -exports.reduceU = reduceU; exports.reduce = reduce; -exports.everyU = everyU; exports.every = every; -exports.someU = someU; exports.some = some; -exports.keepU = keepU; exports.keep = keep; -exports.partitionU = partitionU; exports.partition = partition; exports.size = size; exports.toList = toList; @@ -519,4 +513,10 @@ exports.getUndefined = getUndefined; exports.getExn = getExn; exports.split = split; exports.checkInvariantInternal = checkInvariantInternal; +exports.forEachU = forEachU; +exports.reduceU = reduceU; +exports.everyU = everyU; +exports.someU = someU; +exports.keepU = keepU; +exports.partitionU = partitionU; /* No side effect */ diff --git a/lib/js/belt_MutableSetString.js b/lib/js/belt_MutableSetString.js index 418dedd8ac..6c9d2ab87f 100644 --- a/lib/js/belt_MutableSetString.js +++ b/lib/js/belt_MutableSetString.js @@ -495,17 +495,11 @@ exports.diff = diff; exports.subset = subset; exports.cmp = cmp; exports.eq = eq; -exports.forEachU = forEachU; exports.forEach = forEach; -exports.reduceU = reduceU; exports.reduce = reduce; -exports.everyU = everyU; exports.every = every; -exports.someU = someU; exports.some = some; -exports.keepU = keepU; exports.keep = keep; -exports.partitionU = partitionU; exports.partition = partition; exports.size = size; exports.toList = toList; @@ -519,4 +513,10 @@ exports.getUndefined = getUndefined; exports.getExn = getExn; exports.split = split; exports.checkInvariantInternal = checkInvariantInternal; +exports.forEachU = forEachU; +exports.reduceU = reduceU; +exports.everyU = everyU; +exports.someU = someU; +exports.keepU = keepU; +exports.partitionU = partitionU; /* No side effect */ diff --git a/lib/js/belt_SetDict.js b/lib/js/belt_SetDict.js index 8d4fa93fef..c8e0861ae5 100644 --- a/lib/js/belt_SetDict.js +++ b/lib/js/belt_SetDict.js @@ -274,28 +274,16 @@ var cmp = Belt_internalAVLset.cmp; var eq = Belt_internalAVLset.eq; -var forEachU = Belt_internalAVLset.forEachU; - var forEach = Belt_internalAVLset.forEach; -var reduceU = Belt_internalAVLset.reduceU; - var reduce = Belt_internalAVLset.reduce; -var everyU = Belt_internalAVLset.everyU; - var every = Belt_internalAVLset.every; -var someU = Belt_internalAVLset.someU; - var some = Belt_internalAVLset.some; -var keepU = Belt_internalAVLset.keepSharedU; - var keep = Belt_internalAVLset.keepShared; -var partitionU = Belt_internalAVLset.partitionSharedU; - var partition = Belt_internalAVLset.partitionShared; var size = Belt_internalAVLset.size; @@ -320,6 +308,18 @@ var getExn = Belt_internalAVLset.getExn; var checkInvariantInternal = Belt_internalAVLset.checkInvariantInternal; +var forEachU = Belt_internalAVLset.forEachU; + +var reduceU = Belt_internalAVLset.reduceU; + +var everyU = Belt_internalAVLset.everyU; + +var someU = Belt_internalAVLset.someU; + +var keepU = Belt_internalAVLset.keepSharedU; + +var partitionU = Belt_internalAVLset.partitionSharedU; + exports.empty = empty; exports.ofArray = ofArray; exports.ofSortedArrayUnsafe = ofSortedArrayUnsafe; @@ -337,17 +337,11 @@ exports.diff = diff; exports.subset = subset; exports.cmp = cmp; exports.eq = eq; -exports.forEachU = forEachU; exports.forEach = forEach; -exports.reduceU = reduceU; exports.reduce = reduce; -exports.everyU = everyU; exports.every = every; -exports.someU = someU; exports.some = some; -exports.keepU = keepU; exports.keep = keep; -exports.partitionU = partitionU; exports.partition = partition; exports.size = size; exports.toList = toList; @@ -361,4 +355,10 @@ exports.getUndefined = getUndefined; exports.getExn = getExn; exports.split = split; exports.checkInvariantInternal = checkInvariantInternal; +exports.forEachU = forEachU; +exports.reduceU = reduceU; +exports.everyU = everyU; +exports.someU = someU; +exports.keepU = keepU; +exports.partitionU = partitionU; /* No side effect */