From 0596495af8f8dad290683c0872522342604007ff Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Thu, 15 Mar 2018 01:03:21 -0700 Subject: [PATCH] [Docs][Belt] Categorize uncurried helpers into their dedicated section Addresses the feedback that the doc pages are hard to visually search. The uncurried APIs are basically expected to be there every time there's a higher-order function in the signature, so no need to even scroll down either. --- jscomp/others/belt_HashMap.mli | 38 +++--- jscomp/others/belt_HashSet.mli | 24 ++-- jscomp/others/belt_Id.mli | 35 +++--- jscomp/others/belt_List.mli | 180 ++++++++++++++++------------ jscomp/others/belt_Map.mli | 76 +++++++----- jscomp/others/belt_MapDict.mli | 148 +++++++++++++---------- jscomp/others/belt_MapInt.mli | 83 +++++++------ jscomp/others/belt_MapString.mli | 83 +++++++------ jscomp/others/belt_MutableMap.mli | 36 ++++-- jscomp/others/belt_MutableQueue.mli | 27 +++-- jscomp/others/belt_MutableSet.mli | 22 +++- jscomp/others/belt_MutableStack.mli | 21 ++-- jscomp/others/belt_Range.mli | 34 ++++-- jscomp/others/belt_Set.mli | 21 +++- jscomp/others/belt_SetInt.mli | 52 ++++---- jscomp/others/belt_SetString.mli | 52 ++++---- jscomp/others/belt_SortArray.mli | 110 +++++++++-------- jscomp/others/map.cppo.mli | 85 ++++++------- jscomp/others/set.cppo.mli | 56 +++++---- lib/js/belt_HashMap.js | 18 +-- lib/js/belt_HashSet.js | 12 +- lib/js/belt_Id.js | 4 +- lib/js/belt_List.js | 56 ++++----- lib/js/belt_Map.js | 24 ++-- lib/js/belt_MapDict.js | 64 +++++----- lib/js/belt_MapInt.js | 68 +++++------ lib/js/belt_MapString.js | 68 +++++------ lib/js/belt_MutableMap.js | 18 +-- lib/js/belt_MutableQueue.js | 6 +- lib/js/belt_MutableSet.js | 12 +- lib/js/belt_MutableStack.js | 4 +- lib/js/belt_Range.js | 10 +- lib/js/belt_Set.js | 12 +- lib/js/belt_SetInt.js | 36 +++--- lib/js/belt_SetString.js | 36 +++--- lib/js/belt_SortArray.js | 10 +- 36 files changed, 906 insertions(+), 735 deletions(-) diff --git a/jscomp/others/belt_HashMap.mli b/jscomp/others/belt_HashMap.mli index a8e6425bcf..4e36387928 100644 --- a/jscomp/others/belt_HashMap.mli +++ b/jscomp/others/belt_HashMap.mli @@ -30,7 +30,7 @@ For example: {[ - type t = int + type t = int module I0 = (val Belt.Id.hashableU ~hash:(fun[\@bs] (a : t) -> a & 0xff_ff) @@ -75,13 +75,13 @@ module Int = Belt_HashMapInt (** Specalized when key type is [string], more efficient - than the gerneic type *) + than the gerneic type *) module String = Belt_HashMapString -type ('key,'value,'id) t +type ('key,'value,'id) t (** The type of hash tables from type ['key] to type ['value]. *) type ('a, 'id) id = ('a, 'id) Belt_Id.hashable @@ -93,32 +93,30 @@ val make: hintSize:int -> id:('key, 'id) id -> ('key,'value,'id) t val clear: ('key, 'value, 'id ) t -> unit (** Empty a hash table. *) -val isEmpty: _ t -> bool +val isEmpty: _ t -> bool val set: ('key, 'value, 'id ) t -> 'key -> 'value -> unit (** [set tbl k v] if [k] does not exist, add the binding [k,v], otherwise, update the old value with the new [v] *) - + val copy: ('key, 'value, 'id ) t -> ('key, 'value, 'id ) t - + val get: ('key, 'value, 'id ) t -> 'key -> 'value option - + val has: ('key, 'value, 'id ) t -> 'key -> bool (** [has tbl x] checks if [x] is bound in [tbl]. *) val remove: ('key, 'value, 'id ) t -> 'key -> unit -val forEachU: ('key, 'value, 'id ) t -> ('key -> 'value -> unit [@bs]) -> unit val forEach: ('key, 'value, 'id ) t -> ('key -> 'value -> unit) -> unit (** [forEach tbl f] applies [f] to all bindings in table [tbl]. [f] receives the key as first argument, and the associated value as second argument. Each binding is presented exactly once to [f]. *) -val reduceU: ('key, 'value, 'id ) t -> 'c -> ('c -> 'key -> 'value -> 'c [@bs]) -> 'c val reduce: ('key, 'value, 'id ) t -> 'c -> ('c -> 'key -> 'value -> 'c) -> 'c (** [reduce tbl init f] computes [(f kN dN ... (f k1 d1 init)...)], @@ -133,11 +131,10 @@ val reduce: ('key, 'value, 'id ) t -> 'c -> ('c -> 'key -> 'value -> 'c) -> 'c *) -val keepMapInPlaceU: ('key, 'value, 'id ) t -> ('key -> 'value -> 'value option [@bs]) -> unit val keepMapInPlace: ('key, 'value, 'id ) t -> ('key -> 'value -> 'value option ) -> unit -val size: _ t -> int +val size: _ t -> int (** [size tbl] returns the number of bindings in [tbl]. It takes constant time. *) @@ -146,14 +143,23 @@ val size: _ t -> int -val toArray: ('key, 'value, 'id ) t -> ('key * 'value) array -val keysToArray: ('key, _, _) t -> 'key array -val valuesToArray: (_,'value,_) t -> 'value array -val fromArray: ('key * 'value) array -> id:('key,'id) id -> ('key, 'value, 'id ) t +val toArray: ('key, 'value, 'id ) t -> ('key * 'value) array +val keysToArray: ('key, _, _) t -> 'key array +val valuesToArray: (_,'value,_) t -> 'value array +val fromArray: ('key * 'value) array -> id:('key,'id) id -> ('key, 'value, 'id ) t val mergeMany: ('key, 'value, 'id ) t -> ('key * 'value) array -> unit val getBucketHistogram: _ t -> int array val logStats: _ t -> unit -val ofArray: ('key * 'value) array -> id:('key,'id) id -> ('key, 'value, 'id ) t +val ofArray: ('key * 'value) array -> id:('key,'id) id -> ('key, 'value, 'id ) t [@@ocaml.deprecated "Use fromArray instead"] + +(** {1 Uncurried version} *) + + +val forEachU: ('key, 'value, 'id ) t -> ('key -> 'value -> unit [@bs]) -> unit + +val reduceU: ('key, 'value, 'id ) t -> 'c -> ('c -> 'key -> 'value -> 'c [@bs]) -> 'c + +val keepMapInPlaceU: ('key, 'value, 'id ) t -> ('key -> 'value -> 'value option [@bs]) -> unit diff --git a/jscomp/others/belt_HashSet.mli b/jscomp/others/belt_HashSet.mli index b46985a487..6390912f84 100644 --- a/jscomp/others/belt_HashSet.mli +++ b/jscomp/others/belt_HashSet.mli @@ -30,7 +30,7 @@ For example: {[ - type t = int + type t = int module I0 = (val Belt.Id.hashableU ~hash:(fun[\@bs] (a : t) -> a & 0xff_ff) @@ -74,7 +74,7 @@ module Int = Belt_HashSetInt (** Specalized when key type is [string], more efficient - than the gerneic type *) + than the gerneic type *) module String = Belt_HashSetString (* TODO: add a poly module @@ -83,8 +83,8 @@ module String = Belt_HashSetString - generic equal handles JS data structure - eq/hash consistent *) - -type ('a, 'id) t + +type ('a, 'id) t (** The type of hash tables from type ['a] to type ['b]. *) @@ -102,27 +102,31 @@ val has: ('a, 'id) t -> 'a -> bool val remove: ('a, 'id) t -> 'a -> unit -val forEachU: ('a, 'id) t -> ('a -> unit [@bs]) -> unit val forEach: ('a, 'id) t -> ('a -> unit) -> unit (** Order unspecified. *) -val reduceU: ('a, 'id) t -> 'c -> ('c -> 'a -> 'c [@bs]) -> 'c val reduce: ('a, 'id) t -> 'c -> ('c -> 'a -> 'c) -> 'c (** Order unspecified. *) -val size: ('a, 'id) t -> int +val size: ('a, 'id) t -> int val logStats: _ t -> unit -val toArray: ('a,'id) t -> 'a array +val toArray: ('a,'id) t -> 'a array -val ofArray: 'a array -> id:('a,'id) id -> ('a,'id) t +val ofArray: 'a array -> id:('a,'id) id -> ('a,'id) t [@@ocaml.deprecated "Use fromArray instead"] -val fromArray: 'a array -> id:('a,'id) id -> ('a,'id) t +val fromArray: 'a array -> id:('a,'id) id -> ('a,'id) t val mergeMany: ('a,'id) t -> 'a array -> unit val getBucketHistogram: _ t -> int array +(** {1 Uncurried version} *) + + +val forEachU: ('a, 'id) t -> ('a -> unit [@bs]) -> unit + +val reduceU: ('a, 'id) t -> 'c -> ('c -> 'a -> 'c [@bs]) -> 'c diff --git a/jscomp/others/belt_Id.mli b/jscomp/others/belt_Id.mli index 719051a100..4cdb903abe 100644 --- a/jscomp/others/belt_Id.mli +++ b/jscomp/others/belt_Id.mli @@ -74,13 +74,6 @@ type ('key, 'id) comparable = mismatch if they use different comparison function *) -module MakeComparableU : - functor (M : sig - type t - val cmp : t -> t -> int [@bs] - end) -> - Comparable with type t = M.t - module MakeComparable : functor (M : sig type t @@ -118,14 +111,6 @@ type ('key, 'id) hashable = mismatch if they use different comparison function *) -module MakeHashableU : - functor (M : sig - type t - val hash : t -> int [@bs] - val eq : t -> t -> bool [@bs] - end) -> - Hashable with type t = M.t - module MakeHashable : functor (M : sig type t @@ -153,3 +138,23 @@ external getHashInternal : ('a,'id) hash -> ('a -> int [@bs]) = "%identity" external getEqInternal : ('a, 'id) eq -> ('a -> 'a -> bool [@bs]) = "%identity" external getCmpInternal : ('a,'id) cmp -> ('a -> 'a -> int [@bs]) = "%identity" (**/**) + + +(** {1 Uncurried version} *) + + +module MakeComparableU : + functor (M : sig + type t + val cmp : t -> t -> int [@bs] + end) -> + Comparable with type t = M.t + + +module MakeHashableU : + functor (M : sig + type t + val hash : t -> int [@bs] + val eq : t -> t -> bool [@bs] + end) -> + Hashable with type t = M.t diff --git a/jscomp/others/belt_List.mli b/jscomp/others/belt_List.mli index 096c409bac..fc5c6f9a76 100644 --- a/jscomp/others/belt_List.mli +++ b/jscomp/others/belt_List.mli @@ -23,13 +23,13 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** {!Belt.List} - + Utilities for List data type. - + This module is compatible with original ocaml stdlib. In general, all functions comes with the original stdlib also applies to this collection, however, this module provides faster - and stack safer utilities + and stack safer utilities *) @@ -52,11 +52,11 @@ val head: 'a t -> 'a option head [1;2;3] = Some 1 ;; ]} *) -val headExn: 'a t -> 'a +val headExn: 'a t -> 'a (** [headExn h] {b See} {!head} - + {b raise} an exception if [h] is empty *) @@ -68,12 +68,12 @@ val tail: 'a t -> 'a t option tail [1;2] = Some [2];; ]} *) - -val tailExn: 'a t -> 'a t + +val tailExn: 'a t -> 'a t (** [tailExn h] {b See} {!tail} - + {b raise} an exception if [h] is empty *) @@ -99,40 +99,39 @@ val getExn: 'a t -> int -> 'a (** [getExn xs n] {b See} {!get} - + {b raise} an exception if [n] is larger than the length -*) +*) val make: int -> 'a -> 'a t -(** [make n v] - - - return a list of length [n] with each element filled with [v] +(** [make n v] + + - return a list of length [n] with each element filled with [v] - return the empty list if [n] is negative @example {[ make 3 1 = [1;1;1] ]} *) - -val makeByU: int -> (int -> 'a [@bs]) -> 'a t + val makeBy: int -> (int -> 'a) -> 'a t -(** [makeBy n f] - +(** [makeBy n f] + - return a list of length [n] with element [i] initialized with [f i] - return the empty list if [n] is negative @example {[ makeBy 5 (fun i -> i) = [0;1;2;3;4] ]} -*) +*) -val shuffle: 'a t -> 'a t +val shuffle: 'a t -> 'a t (** [shuffle xs] @return a new list in random order *) -val drop: 'a t -> int -> 'a t option +val drop: 'a t -> int -> 'a t option (** [drop xs n] return the list obtained by dropping the first [n] elements, @@ -145,7 +144,7 @@ val drop: 'a t -> int -> 'a t option ]} *) -val take: 'a t -> int -> 'a t option +val take: 'a t -> int -> 'a t option (** [take xs n] return a list with the first [n] elements from [xs], @@ -158,7 +157,7 @@ val take: 'a t -> int -> 'a t option ]} *) -val splitAt: 'a t -> int -> ('a list * 'a list) option +val splitAt: 'a t -> int -> ('a list * 'a list) option (** [splitAt xs n] split the list [xs] at position [n] @@ -166,9 +165,9 @@ val splitAt: 'a t -> int -> ('a list * 'a list) option @example{[ splitAt [0;1;2;3;4] 2 = Some ([0;1], [2;3;4]) - ]} + ]} *) - + val concat: 'a t -> 'a t -> 'a t (** [concat xs ys] @@ -197,7 +196,7 @@ val reverseConcat: 'a t -> 'a t -> 'a t reverseConcat [1;2] [3;4] = [2;1;3;4] ]} *) - + val flatten: 'a t t -> 'a t (** [flatten ls] @@ -208,7 +207,6 @@ val flatten: 'a t t -> 'a t ]} *) -val mapU: 'a t -> ('a -> 'b [@bs]) -> 'b t val map: 'a t -> ('a -> 'b) -> 'b t (** [map xs f] @@ -231,16 +229,14 @@ val zip: 'a t -> 'b t -> ('a * 'b) t ]} *) -val zipByU: 'a t -> 'b t -> ('a -> 'b -> 'c [@bs]) -> 'c t val zipBy: 'a t -> 'b t -> ('a -> 'b -> 'c) -> 'c t (** [zipBy xs ys f] {b See} {!zip} - + Equivalent to [zip xs ys |> List.map (fun (x,y) -> f x y)] *) -val mapWithIndexU: 'a t -> (int -> 'a -> 'b [@bs]) -> 'b t val mapWithIndex: 'a t -> (int -> 'a -> 'b) -> 'b t (** @example {[ mapWithIndex [1;2;3] (fun i x -> i + x) = @@ -248,10 +244,10 @@ val mapWithIndex: 'a t -> (int -> 'a -> 'b) -> 'b t ]} *) -val ofArray: 'a array -> 'a t +val ofArray: 'a array -> 'a t [@@ocaml.deprecated "Use fromArray instead"] -val fromArray: 'a array -> 'a t +val fromArray: 'a array -> 'a t (** @example {[ fromArray [|1;2;3|] = [1;2;3] ]} @@ -273,15 +269,13 @@ val reverse: 'a t -> 'a t reverse [1;2;3] = [3;2;1] ]} *) - -val mapReverseU: 'a t -> ('a -> 'b [@bs]) -> 'b t + val mapReverse: 'a t -> ('a -> 'b) -> 'b t (** [mapReverse a f] - Equivalent to [reverse (map a f)] + Equivalent to [reverse (map a f)] *) -val forEachU: 'a t -> ('a -> 'b [@bs]) -> unit val forEach: 'a t -> ('a -> 'b) -> unit (** [forEach xs f ] @example {[ @@ -290,8 +284,7 @@ val forEach: 'a t -> ('a -> 'b) -> unit !us = 1 + 2 + 3 + 4;; ]} *) - -val forEachWithIndexU: 'a t -> (int -> 'a -> 'b [@bs]) -> unit + val forEachWithIndex: 'a t -> (int -> 'a -> 'b) -> unit (** [forEachWithIndex xs f] @@ -302,7 +295,6 @@ val forEachWithIndex: 'a t -> (int -> 'a -> 'b) -> unit ]} *) -val reduceU: 'a t -> 'b -> ('b -> 'a -> 'b [@bs]) -> 'b val reduce: 'a t -> 'b -> ('b -> 'a -> 'b) -> 'b (** [reduce xs f] @@ -312,8 +304,7 @@ val reduce: 'a t -> 'b -> ('b -> 'a -> 'b) -> 'b reduce [1;2;3;4] [] add = [4;3;2;1]; ]} *) - -val reduceReverseU: 'a t -> 'b -> ('b -> 'a -> 'b [@bs]) -> 'b + val reduceReverse: 'a t -> 'b -> ('b -> 'a -> 'b) -> 'b (** [reduceReverse xs f] @@ -323,35 +314,29 @@ val reduceReverse: 'a t -> 'b -> ('b -> 'a -> 'b) -> 'b reduceReverse [1;2;3;4] [] add = [1;2;3;4];; ]} *) - -val mapReverse2U: 'a t -> 'b t -> ('a -> 'b -> 'c [@bs]) -> 'c t + val mapReverse2: 'a t -> 'b t -> ('a -> 'b -> 'c) -> 'c t (** [mapReverse2 xs ys f] - equivalent to [reverse (zipBy xs ys f)] + equivalent to [reverse (zipBy xs ys f)] @example {[ mapReverse2 [1;2;3] [1;2] (+) = [4;2] ]} *) -val forEach2U: 'a t -> 'b t -> ('a -> 'b -> 'c [@bs]) -> unit val forEach2: 'a t -> 'b t -> ('a -> 'b -> 'c) -> unit (** [forEach2 xs ys f] stop with the shorter list -*) +*) -val reduce2U: - 'b t -> 'c t -> 'a -> ('a -> 'b -> 'c -> 'a [@bs]) -> 'a val reduce2: 'b t -> 'c t -> 'a -> ('a -> 'b -> 'c -> 'a) -> 'a (** [reduce2 xs ys init f ] - stops with the shorter list. + stops with the shorter list. *) -val reduceReverse2U: - 'a t -> 'b t -> 'c -> ('c -> 'a -> 'b -> 'c [@bs]) -> 'c val reduceReverse2: 'a t -> 'b t -> 'c -> ('c -> 'a -> 'b -> 'c) -> 'c (** @@ -364,7 +349,6 @@ val reduceReverse2: ]} *) -val everyU: 'a t -> ('a -> bool [@bs]) -> bool val every: 'a t -> ('a -> bool ) -> bool (** [every ls p] @@ -373,7 +357,6 @@ val every: 'a t -> ('a -> bool ) -> bool every [2;4] (fun x -> x mod 2 = 0 ) true;; ]} *) -val someU: 'a t -> ('a -> bool [@bs]) -> bool val some: 'a t -> ('a -> bool ) -> bool (** [some ls p] @@ -383,16 +366,14 @@ val some: 'a t -> ('a -> bool ) -> bool ]} *) -val every2U: 'a t -> 'b t -> ('a -> 'b -> bool [@bs]) -> bool val every2: 'a t -> 'b t -> ('a -> 'b -> bool ) -> bool (** [every2 xs ys p] stop with the shorter list @example {[ (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 t -> 'b t -> ('a -> 'b -> bool [@bs]) -> bool val some2: 'a t -> 'b t -> ('a -> 'b -> bool) -> bool (** [some2 xs ys p] @example {[ @@ -406,8 +387,7 @@ val cmpByLength: 'a t -> 'a t -> int Compare two lists solely by length *) - -val cmpU: 'a t -> 'a t -> ('a -> 'a -> int [@bs]) -> int + val cmp: 'a t -> 'a t -> ('a -> 'a -> int) -> int (** [cmp xs ys cmpElem] @@ -419,11 +399,10 @@ val cmp: 'a t -> 'a t -> ('a -> 'a -> int) -> int {b Attention}: The total ordering of List is different from Array, for Array, we compare the length first and one by one later, while - for lists, we just compare one by one + for lists, we just compare one by one *) -val eqU: 'a t -> 'a t -> ('a -> 'a -> bool [@bs]) -> bool val eq: 'a t -> 'a t -> ('a -> 'a -> bool) -> bool (** [eq xs ys eqElem] @@ -433,10 +412,9 @@ val eq: 'a t -> 'a t -> ('a -> 'a -> bool) -> bool eq [1;2;3] [1;2] (=) = false ;; eq [1;2] [1;2] (=) = true ]} -*) +*) -val hasU: 'a t -> 'b -> ('a -> 'b -> bool [@bs]) -> bool val has: 'a t -> 'b -> ('a -> 'b -> bool) -> bool (** @example {[ has [1;2;3] 2 (=) = true;; @@ -444,14 +422,12 @@ val has: 'a t -> 'b -> ('a -> 'b -> bool) -> bool ]} *) -val getByU: 'a t -> ('a -> bool [@bs]) -> 'a option val getBy: 'a t -> ('a -> bool) -> 'a option (** @example {[ getBy [1;4;3;2] (fun x -> x mod 2 = 0) = Some 4 ]} *) - -val keepU: 'a t -> ('a -> bool [@bs]) -> 'a t + val keep: 'a t -> ('a -> bool) -> 'a t (** [keep xs p] @@ -460,7 +436,6 @@ val keep: 'a t -> ('a -> bool) -> 'a t [2;4] ]} *) -val keepMapU: 'a t -> ('a -> 'b option [@bs]) -> 'b t val keepMap: 'a t -> ('a -> 'b option) -> 'b t (** [keepMap xs f] @@ -470,7 +445,6 @@ val keepMap: 'a t -> ('a -> 'b option) -> 'b t [-2;-4] ]} *) -val partitionU: 'a t -> ('a -> bool [@bs]) -> 'a t * 'a t val partition: 'a t -> ('a -> bool) -> 'a t * 'a t (** [partition xs p] @@ -486,10 +460,9 @@ val unzip: ('a * 'b) t -> 'a t * 'b t unzip [(1,2) ; (3,4)] = ([1;3], [2;4]) ]} *) -val getAssocU: ('a * 'c) t -> 'b -> ('a -> 'b -> bool [@bs]) -> 'c option val getAssoc: ('a * 'c) t -> 'b -> ('a -> 'b -> bool) -> 'c option (** [getAssoc xs k eq] - + return the second element of a pair in [xs] where the first element equals [x], or [None] if not found @example {[ @@ -497,7 +470,6 @@ val getAssoc: ('a * 'c) t -> 'b -> ('a -> 'b -> bool) -> 'c option ]} *) -val hasAssocU: ('a * 'c) t -> 'b -> ('a -> 'b -> bool [@bs]) -> bool val hasAssoc: ('a * 'c) t -> 'b -> ('a -> 'b -> bool ) -> bool (** [hasAssoc xs x eq] return true if there is a pair in [xs] where the first element equals [x] @@ -506,7 +478,6 @@ val hasAssoc: ('a * 'c) t -> 'b -> ('a -> 'b -> bool ) -> bool ]} *) -val removeAssocU:('a * 'c) t -> 'b -> ('a -> 'b -> bool [@bs]) -> ('a * 'c) t val removeAssoc: ('a * 'c) t -> 'b -> ('a -> 'b -> bool) -> ('a * 'c) t (** [removeAssoc xs x eq] Try to remove the first pair, if not found, leave it untouched. @@ -516,20 +487,77 @@ val removeAssoc: ('a * 'c) t -> 'b -> ('a -> 'b -> bool) -> ('a * 'c) t ]} *) -val setAssocU: ('a * 'c) t -> 'a -> 'c -> ('a -> 'a -> bool [@bs]) -> ('a * 'c) t -val setAssoc: ('a * 'c) t -> 'a -> 'c -> ('a -> 'a -> bool) -> ('a * 'c) t +val setAssoc: ('a * 'c) t -> 'a -> 'c -> ('a -> 'a -> bool) -> ('a * 'c) t (** [setAssoc xs k v eq] if [k] exists in [xs], replace it with the new [v], otherwise, add it to the head @example {[ setAssoc [1,"a"; 2, "b"; 3, "c"] 2 "x" (=) = - [1,"a"; 2, "x"; 3,"c"] ;; + [1,"a"; 2, "x"; 3,"c"] ;; - setAssoc [1,"a"; 3, "c"] 2 "2" (=) = - [2,"2"; 1,"a"; 3, "c"] + setAssoc [1,"a"; 3, "c"] 2 "2" (=) = + [2,"2"; 1,"a"; 3, "c"] ]} -*) +*) + +(** {1 Uncurried version} *) +val makeByU: int -> (int -> 'a [@bs]) -> 'a t +val mapU: 'a t -> ('a -> 'b [@bs]) -> 'b t + +val zipByU: 'a t -> 'b t -> ('a -> 'b -> 'c [@bs]) -> 'c t + +val mapWithIndexU: 'a t -> (int -> 'a -> 'b [@bs]) -> 'b t + +val mapReverseU: 'a t -> ('a -> 'b [@bs]) -> 'b t + +val forEachU: 'a t -> ('a -> 'b [@bs]) -> unit + +val forEachWithIndexU: 'a t -> (int -> 'a -> 'b [@bs]) -> unit + +val reduceU: 'a t -> 'b -> ('b -> 'a -> 'b [@bs]) -> 'b + +val reduceReverseU: 'a t -> 'b -> ('b -> 'a -> 'b [@bs]) -> 'b + +val mapReverse2U: 'a t -> 'b t -> ('a -> 'b -> 'c [@bs]) -> 'c t + +val forEach2U: 'a t -> 'b t -> ('a -> 'b -> 'c [@bs]) -> unit + +val reduce2U: + 'b t -> 'c t -> 'a -> ('a -> 'b -> 'c -> 'a [@bs]) -> 'a + +val reduceReverse2U: + 'a t -> 'b t -> 'c -> ('c -> 'a -> 'b -> 'c [@bs]) -> 'c + +val everyU: 'a t -> ('a -> bool [@bs]) -> bool + +val someU: 'a t -> ('a -> bool [@bs]) -> bool + +val every2U: 'a t -> 'b t -> ('a -> 'b -> bool [@bs]) -> bool + +val some2U: 'a t -> 'b t -> ('a -> 'b -> bool [@bs]) -> bool + +val cmpU: 'a t -> 'a t -> ('a -> 'a -> int [@bs]) -> int + +val eqU: 'a t -> 'a t -> ('a -> 'a -> bool [@bs]) -> bool + +val hasU: 'a t -> 'b -> ('a -> 'b -> bool [@bs]) -> bool + +val getByU: 'a t -> ('a -> bool [@bs]) -> 'a option + +val keepU: 'a t -> ('a -> bool [@bs]) -> 'a t + +val keepMapU: 'a t -> ('a -> 'b option [@bs]) -> 'b t + +val partitionU: 'a t -> ('a -> bool [@bs]) -> 'a t * 'a t + +val getAssocU: ('a * 'c) t -> 'b -> ('a -> 'b -> bool [@bs]) -> 'c option + +val hasAssocU: ('a * 'c) t -> 'b -> ('a -> 'b -> bool [@bs]) -> bool + +val removeAssocU:('a * 'c) t -> 'b -> ('a -> 'b -> bool [@bs]) -> ('a * 'c) t + +val setAssocU: ('a * 'c) t -> 'a -> 'c -> ('a -> 'a -> bool [@bs]) -> ('a * 'c) t diff --git a/jscomp/others/belt_Map.mli b/jscomp/others/belt_Map.mli index d8facef491..146f205e75 100644 --- a/jscomp/others/belt_Map.mli +++ b/jscomp/others/belt_Map.mli @@ -117,11 +117,6 @@ val has: ('k, 'v, 'id) t -> 'k -> bool ]} *) -val cmpU: - ('k, 'v, 'id) t -> - ('k, 'v, 'id) t -> - ('v -> 'v -> int [@bs]) -> - int val cmp: ('k, 'v, 'id) t -> ('k, 'v, 'id) t -> @@ -134,11 +129,6 @@ val cmp: It will compare size first and each element following the order one by one. *) -val eqU: - ('k, 'v, 'id) t -> - ('k, 'v, 'id) t -> - ('v -> 'v -> bool [@bs]) -> - bool val eq: ('k, 'v, 'id) t -> ('k, 'v, 'id) t -> @@ -149,7 +139,6 @@ val eq: equal data. [veq] is the equality predicate used to compare the data associated with the keys. *) -val forEachU: ('k, 'v, 'id) t -> ('k -> 'v -> unit [@bs]) -> unit val forEach: ('k, 'v, 'id) t -> ('k -> 'v -> unit) -> unit (** [forEach m f] applies [f] to all bindings in map [m]. [f] receives the 'k as first argument, and the associated value @@ -165,7 +154,6 @@ val forEach: ('k, 'v, 'id) t -> ('k -> 'v -> unit) -> unit ]} *) -val reduceU: ('k, 'v, 'id) t -> 'acc -> ('acc -> 'k -> 'v -> 'acc [@bs]) -> 'acc val reduce: ('k, 'v, 'id) t -> 'acc -> ('acc -> 'k -> 'v -> 'acc) -> 'acc (** [reduce m a f] computes [(f kN dN ... (f k1 d1 a)...)], where [k1 ... kN] are the keys of all bindings in [m] @@ -177,12 +165,10 @@ val reduce: ('k, 'v, 'id) t -> 'acc -> ('acc -> 'k -> 'v -> 'acc) -> 'acc ]} *) -val everyU: ('k, 'v, 'id) t -> ('k -> 'v -> bool [@bs]) -> bool val every: ('k, 'v, 'id) t -> ('k -> 'v -> bool) -> bool (** [every m p] checks if all the bindings of the map satisfy the predicate [p]. Order unspecified *) -val someU: ('k, 'v, 'id) t -> ('k -> 'v -> bool [@bs]) -> bool val some: ('k, 'v, 'id) t -> ('k -> 'v -> bool) -> bool (** [some m p] checks if at least one binding of the map satisfy the predicate [p]. Order unspecified *) @@ -338,7 +324,6 @@ val set: ]} *) -val updateU: ('k, 'v, 'id) t -> 'k -> ('v option -> 'v option [@bs]) -> ('k, 'v, 'id) t val update: ('k, 'v, 'id) t -> 'k -> ('v option -> 'v option) -> ('k, 'v, 'id) t (** [update m x f] returns a map containing the same bindings as [m], except for the binding of [x]. @@ -358,11 +343,6 @@ val mergeMany: exist [s] *) -val mergeU: - ('k, 'v, 'id ) t -> - ('k, 'v2, 'id) t -> - ('k -> 'v option -> 'v2 option -> 'v3 option [@bs]) -> - ('k, 'v3, 'id) t val merge: ('k, 'v, 'id ) t -> ('k, 'v2, 'id) t -> @@ -374,10 +354,6 @@ val merge: *) -val keepU: - ('k, 'v, 'id) t -> - ('k -> 'v -> bool [@bs]) -> - ('k, 'v, 'id) t val keep: ('k, 'v, 'id) t -> ('k -> 'v -> bool) -> @@ -385,10 +361,6 @@ val keep: (** [keep m p] returns the map with all the bindings in [m] that satisfy predicate [p]. *) -val partitionU: - ('k, 'v, 'id) t -> - ('k -> 'v -> bool [@bs]) -> - ('k, 'v, 'id) t * ('k, 'v, 'id) t val partition: ('k, 'v, 'id) t -> ('k -> 'v -> bool) -> @@ -411,7 +383,6 @@ val split: or [Some v] if [m] binds [v] to [x]. *) -val mapU: ('k, 'v, 'id) t -> ('v -> 'v2 [@bs]) -> ('k, 'v2, 'id) t val map: ('k, 'v, 'id) t -> ('v -> 'v2) -> ('k, 'v2, 'id) t (** [map m f] returns a map with same domain as [m], where the associated value [a] of all bindings of [m] has been @@ -419,7 +390,6 @@ val map: ('k, 'v, 'id) t -> ('v -> 'v2) -> ('k, 'v2, 'id) t The bindings are passed to [f] in increasing order with respect to the ordering over the type of the keys. *) -val mapWithKeyU: ('k, 'v, 'id) t -> ('k -> 'v -> 'v2 [@bs]) -> ('k, 'v2, 'id) t val mapWithKey: ('k, 'v, 'id) t -> ('k -> 'v -> 'v2) -> ('k, 'v2, 'id) t (** [mapWithKey m f] @@ -427,6 +397,52 @@ val mapWithKey: ('k, 'v, 'id) t -> ('k -> 'v -> 'v2) -> ('k, 'v2, 'id) t *) +(** {1 Uncurried version} *) + + +val cmpU: + ('k, 'v, 'id) t -> + ('k, 'v, 'id) t -> + ('v -> 'v -> int [@bs]) -> + int + +val eqU: + ('k, 'v, 'id) t -> + ('k, 'v, 'id) t -> + ('v -> 'v -> bool [@bs]) -> + bool + +val forEachU: ('k, 'v, 'id) t -> ('k -> 'v -> unit [@bs]) -> unit + +val reduceU: ('k, 'v, 'id) t -> 'acc -> ('acc -> 'k -> 'v -> 'acc [@bs]) -> 'acc + +val everyU: ('k, 'v, 'id) t -> ('k -> 'v -> bool [@bs]) -> bool + +val someU: ('k, 'v, 'id) t -> ('k -> 'v -> bool [@bs]) -> bool + +val updateU: ('k, 'v, 'id) t -> 'k -> ('v option -> 'v option [@bs]) -> ('k, 'v, 'id) t + +val mergeU: + ('k, 'v, 'id ) t -> + ('k, 'v2, 'id) t -> + ('k -> 'v option -> 'v2 option -> 'v3 option [@bs]) -> + ('k, 'v3, 'id) t + +val keepU: + ('k, 'v, 'id) t -> + ('k -> 'v -> bool [@bs]) -> + ('k, 'v, 'id) t + +val partitionU: + ('k, 'v, 'id) t -> + ('k -> 'v -> bool [@bs]) -> + ('k, 'v, 'id) t * ('k, 'v, 'id) t + +val mapU: ('k, 'v, 'id) t -> ('v -> 'v2 [@bs]) -> ('k, 'v2, 'id) t + +val mapWithKeyU: ('k, 'v, 'id) t -> ('k -> 'v -> 'v2 [@bs]) -> ('k, 'v2, 'id) t + +(** {1 Advanced} *) val getData: ('k, 'v, 'id) t -> ('k, 'v, 'id) Belt_MapDict.t (** [getData s0] diff --git a/jscomp/others/belt_MapDict.mli b/jscomp/others/belt_MapDict.mli index de9d7dfc67..e094ff37b5 100644 --- a/jscomp/others/belt_MapDict.mli +++ b/jscomp/others/belt_MapDict.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. *) @@ -32,59 +32,43 @@ val isEmpty: ('k, 'v, 'id) t -> bool val has: ('k, 'a, 'id) t -> 'k -> - cmp:('k, 'id) cmp -> - bool + cmp:('k, 'id) cmp -> + bool -val cmpU: - ('k, 'v, 'id) t -> +val cmp: ('k, 'v, 'id) t -> - kcmp:('k, 'id) cmp -> - vcmp:('v -> 'v -> int [@bs]) -> - int -val cmp: - ('k, 'v, 'id) t -> ('k, 'v, 'id) t -> kcmp:('k, 'id) cmp -> - vcmp:('v -> 'v -> int) -> + vcmp:('v -> 'v -> int) -> int -val eqU: - ('k, 'a, 'id) t -> +val eq: ('k, 'a, 'id) t -> - kcmp:('k, 'id) cmp -> - veq:('a -> 'a -> bool [@bs]) -> - bool -val eq: - ('k, 'a, 'id) t -> ('k, 'a, 'id) t -> kcmp:('k, 'id) cmp -> - veq:('a -> 'a -> bool) -> + veq:('a -> 'a -> bool) -> bool (** [eq m1 m2 cmp] tests whether the maps [m1] and [m2] are equal, that is, contain equal keys and associate them with equal data. [cmp] is the equality predicate used to compare the data associated with the keys. *) - -val forEachU: ('k, 'a, 'id) t -> ('k -> 'a -> unit [@bs]) -> unit -val forEach: ('k, 'a, 'id) t -> ('k -> 'a -> unit) -> unit + +val forEach: ('k, 'a, 'id) t -> ('k -> 'a -> unit) -> unit (** [forEach m f] applies [f] to all bindings in map [m]. [f] receives the 'k as first argument, and the associated value as second argument. The bindings are passed to [f] in increasing order with respect to the ordering over the type of the keys. *) - -val reduceU: ('k, 'a, 'id) t -> 'b -> ('b -> 'k -> 'a -> 'b [@bs]) -> 'b -val reduce: ('k, 'a, 'id) t -> 'b -> ('b -> 'k -> 'a -> 'b) -> 'b + +val reduce: ('k, 'a, 'id) t -> 'b -> ('b -> 'k -> '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: ('k, 'a, 'id) t -> ('k -> 'a -> bool [@bs]) -> bool -val every: ('k, 'a, 'id) t -> ('k -> 'a -> bool) -> bool +val every: ('k, 'a, 'id) t -> ('k -> 'a -> bool) -> bool (** [every m p] checks if all the bindings of the map satisfy the predicate [p]. Order unspecified *) - -val someU: ('k, 'a, 'id) t -> ('k -> 'a -> bool [@bs]) -> bool -val some: ('k, 'a, 'id) t -> ('k -> 'a -> bool) -> bool + +val some: ('k, 'a, 'id) t -> ('k -> 'a -> bool) -> bool (** [some m p] checks if at least one binding of the map satisfy the predicate [p]. Order unspecified *) @@ -107,26 +91,26 @@ val maximum: ('k, 'a, _) t -> ('k * 'a) option val maxUndefined:('k, 'a, _) t -> ('k * 'a) Js.undefined val get: ('k, 'a, 'id) t -> 'k -> - cmp:('k, 'id) cmp -> + cmp:('k, 'id) cmp -> 'a option val getUndefined: ('k, 'a, 'id) t -> 'k -> cmp:('k, 'id) cmp -> 'a Js.undefined - + val getWithDefault: ('k, 'a, 'id) t -> 'k -> 'a -> cmp:('k, 'id) cmp -> - 'a + 'a val getExn: ('k, 'a, 'id) t -> 'k -> cmp:('k, 'id) cmp -> 'a - + val checkInvariantInternal: _ t -> unit (** {b raise} when invariant is not held -*) +*) val remove: ('a, 'b, 'id) t -> 'a -> @@ -139,18 +123,12 @@ val removeMany: 'a array -> cmp:('a, 'id) cmp -> ('a, 'b, 'id) t - + val set: ('a, 'b, 'id) t -> 'a -> 'b -> cmp:('a, 'id) cmp -> ('a, 'b, 'id) t -val updateU: - ('a, 'b, 'id) t -> - 'a -> - ('b option -> 'b option [@bs]) -> - cmp:('a, 'id) cmp -> - ('a, 'b, 'id) t val update: ('a, 'b, 'id) t -> 'a -> @@ -158,14 +136,9 @@ val update: cmp:('a, 'id) cmp -> ('a, 'b, 'id) t -val mergeU: - ('a, 'b, 'id) t -> - ('a, 'c, 'id) t -> - ('a -> 'b option -> 'c option -> 'd option [@bs]) -> - cmp:('a, 'id) cmp -> ('a, 'd, 'id) t val merge: ('a, 'b, 'id) t -> - ('a, 'c, 'id) t -> + ('a, 'c, 'id) t -> ('a -> 'b option -> 'c option -> 'd option) -> cmp:('a, 'id) cmp -> ('a, 'd, 'id) t @@ -175,24 +148,16 @@ val mergeMany: cmp:('a, 'id) cmp -> ('a, 'b, 'id) t -val keepU: - ('k, 'a, 'id) t -> - ('k -> 'a -> bool [@bs]) -> - ('k, 'a, 'id) t -val keep: - ('k, 'a, 'id) t -> - ('k -> 'a -> bool) -> +val keep: + ('k, 'a, 'id) t -> + ('k -> 'a -> bool) -> ('k, 'a, 'id) t (** [keep m p] returns the map with all the bindings in [m] that satisfy predicate [p]. *) - -val partitionU: - ('k, 'a, 'id) t -> - ('k -> 'a -> bool [@bs]) -> - ('k, 'a, 'id) t * ('k, 'a, 'id) t -val partition: + +val partition: ('k, 'a, 'id) t -> - ('k -> 'a -> bool) -> + ('k -> 'a -> bool) -> ('k, 'a, 'id) t * ('k, 'a, 'id) t (** [partition m p] returns a pair of maps [(m1, m2)], where [m1] contains all the bindings of [s] that satisfy the @@ -207,13 +172,64 @@ val split: (('a,'b,'id) t * ('a, 'b, 'id) t) * 'b option -val mapU: ('k, 'a, 'id) t -> ('a -> 'b [@bs]) -> ('k ,'b,'id ) t -val map: ('k, 'a, 'id) t -> ('a -> 'b) -> ('k ,'b,'id ) t +val map: ('k, 'a, 'id) t -> ('a -> 'b) -> ('k ,'b,'id ) t (** [map m f] returns a map with same domain as [m], where the associated value [a] of all bindings of [m] has been replaced by the result of the application of [f] to [a]. The bindings are passed to [f] in increasing order with respect to the ordering over the type of the keys. *) -val mapWithKeyU: ('k, 'a, 'id) t -> ('k -> 'a -> 'b [@bs]) -> ('k, 'b, 'id) t val mapWithKey: ('k, 'a, 'id) t -> ('k -> 'a -> 'b) -> ('k, 'b, 'id) t + + +(** {1 Uncurried version} *) + + +val cmpU: + ('k, 'v, 'id) t -> + ('k, 'v, 'id) t -> + kcmp:('k, 'id) cmp -> + vcmp:('v -> 'v -> int [@bs]) -> + int + +val eqU: + ('k, 'a, 'id) t -> + ('k, 'a, 'id) t -> + kcmp:('k, 'id) cmp -> + veq:('a -> 'a -> bool [@bs]) -> + bool + +val forEachU: ('k, 'a, 'id) t -> ('k -> 'a -> unit [@bs]) -> unit + +val reduceU: ('k, 'a, 'id) t -> 'b -> ('b -> 'k -> 'a -> 'b [@bs]) -> 'b + +val everyU: ('k, 'a, 'id) t -> ('k -> 'a -> bool [@bs]) -> bool + +val someU: ('k, 'a, 'id) t -> ('k -> 'a -> bool [@bs]) -> bool + +val updateU: + ('a, 'b, 'id) t -> + 'a -> + ('b option -> 'b option [@bs]) -> + cmp:('a, 'id) cmp -> + ('a, 'b, 'id) t + +val mergeU: + ('a, 'b, 'id) t -> + ('a, 'c, 'id) t -> + ('a -> 'b option -> 'c option -> 'd option [@bs]) -> + cmp:('a, 'id) cmp -> ('a, 'd, 'id) t + +val keepU: + ('k, 'a, 'id) t -> + ('k -> 'a -> bool [@bs]) -> + ('k, 'a, 'id) t + +val partitionU: + ('k, 'a, 'id) t -> + ('k -> 'a -> bool [@bs]) -> + ('k, 'a, 'id) t * ('k, 'a, 'id) t + +val mapU: ('k, 'a, 'id) t -> ('a -> 'b [@bs]) -> ('k ,'b,'id ) t + +val mapWithKeyU: ('k, 'a, 'id) t -> ('k -> 'a -> 'b [@bs]) -> ('k, 'b, 'id) t diff --git a/jscomp/others/belt_MapInt.mli b/jscomp/others/belt_MapInt.mli index 7bbef32486..4df79e32e9 100644 --- a/jscomp/others/belt_MapInt.mli +++ b/jscomp/others/belt_MapInt.mli @@ -6,38 +6,32 @@ type 'value t val empty: 'v t val isEmpty: 'v t -> bool -val has: 'v t -> key -> bool +val has: 'v t -> key -> bool -val cmpU: 'v t -> 'v t -> ('v -> 'v -> int [@bs]) -> int val cmp: 'v t -> 'v t -> ('v -> 'v -> int) -> int -val eqU: 'v t -> 'v t -> ('v -> 'v -> bool [@bs]) -> bool val eq: 'v t -> 'v t -> ('v -> 'v -> bool) -> bool (** [equal m1 m2 cmp] tests whether the maps [m1] and [m2] are equal, that is, contain equal keys and associate them with equal data. [cmp] is the equality predicate used to compare the data associated with the keys. *) -val forEachU: 'v t -> (key -> 'v -> unit [@bs]) -> unit val forEach: 'v t -> (key -> 'v -> 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 bindings are passed to [f] in increasing order with respect to the ordering over the type of the keys. *) -val reduceU: 'v t -> 'v2 -> ('v2 -> key -> 'v -> 'v2 [@bs]) -> 'v2 val reduce: 'v t -> 'v2 -> ('v2 -> key -> 'v -> 'v2) -> 'v2 (** [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: 'v t -> (key -> 'v -> bool [@bs]) -> bool val every: 'v t -> (key -> 'v -> bool) -> bool (** [every m p] checks if all the bindings of the map satisfy the predicate [p]. *) -val someU: 'v t -> (key -> 'v -> bool [@bs]) -> bool val some: 'v t -> (key -> 'v -> bool) -> bool (** [some m p] checks if at least one binding of the map satisfy the predicate [p]. @@ -46,12 +40,12 @@ val size: 'v t -> int val toList: 'v t -> (key * 'v) list (** In increasing order with respect *) val toArray: 'v t -> (key * 'v) array -val ofArray: (key * 'v) array -> 'v t +val ofArray: (key * 'v) array -> 'v t [@@ocaml.deprecated "Use fromArray instead"] -val fromArray: (key * 'v) array -> 'v t -val keysToArray: 'v t -> key array +val fromArray: (key * 'v) array -> 'v t +val keysToArray: 'v t -> key array val valuesToArray: 'v t -> 'v array -val minKey: _ t -> key option +val minKey: _ t -> key option val minKeyUndefined: _ t -> key Js.undefined val maxKey: _ t -> key option val maxKeyUndefined: _ t -> key Js.undefined @@ -62,12 +56,12 @@ val maxUndefined: 'v t -> (key * 'v) Js.undefined val get: 'v t -> key -> 'v option val getUndefined: 'v t -> key -> 'v Js.undefined val getWithDefault: 'v t -> key -> 'v -> 'v -val getExn: 'v t -> key -> 'v +val getExn: 'v t -> key -> 'v val checkInvariantInternal: _ t -> unit (** {b raise} when invariant is not held -*) +*) (****************************************************************************) @@ -81,43 +75,30 @@ val set: 'v t -> key -> 'v -> 'v t [m], plus a binding of [x] to [y]. If [x] was already bound in [m], its previous binding disappears. *) -val updateU: 'v t -> key -> ('v option -> 'v option [@bs]) -> 'v t -val update: 'v t -> key -> ('v option -> 'v option) -> 'v t +val update: 'v t -> key -> ('v option -> 'v option) -> 'v t val mergeArray: 'v t -> (key * 'v) array -> 'v t - -val mergeU: - 'v t -> 'v2 t -> - (key -> 'v option -> 'v2 option -> 'c option [@bs]) -> - 'c t + val merge: 'v t -> 'v2 t -> (key -> 'v option -> 'v2 option -> 'c option) -> - 'c t + 'c t (** [merge m1 m2 f] computes a map whose keys is a subset of keys of [m1] and of [m2]. The presence of each such binding, and the corresponding value, is determined with the function [f]. *) -val keepU: - 'v t -> - (key -> 'v -> bool [@bs]) -> +val keep: + 'v t -> + (key -> 'v -> bool) -> 'v t -val keep: - 'v t -> - (key -> 'v -> bool) -> - 'v t (** [keep m p] returns the map with all the bindings in [m] that satisfy predicate [p]. *) -val partitionU: - 'v t -> - (key -> 'v -> bool [@bs]) -> +val partition: + 'v t -> + (key -> 'v -> bool) -> 'v t * 'v t -val partition: - 'v t -> - (key -> 'v -> bool) -> - 'v t * 'v t (** [partition m p] returns a pair of maps [(m1, m2)], where [m1] contains all the bindings of [s] that satisfy the predicate [p], and [m2] is the map with all the bindings of @@ -139,21 +120,45 @@ val split: key -> 'v t -> 'v t * 'v option * 'v t *) -val mapU: 'v t -> ('v -> 'v2 [@bs]) -> 'v2 t -val map: 'v t -> ('v -> 'v2) -> 'v2 t +val map: 'v t -> ('v -> 'v2) -> 'v2 t (** [map m f] returns a map with same domain as [m], where the associated value [a] of all bindings of [m] has been replaced by the result of the application of [f] to [a]. The bindings are passed to [f] in increasing order with respect to the ordering over the type of the keys. *) +val mapWithKey: 'v t -> (key -> 'v -> 'v2) -> 'v2 t + + +(** {1 Uncurried version} *) + + +val cmpU: 'v t -> 'v t -> ('v -> 'v -> int [@bs]) -> int +val eqU: 'v t -> 'v t -> ('v -> 'v -> bool [@bs]) -> bool +val forEachU: 'v t -> (key -> 'v -> unit [@bs]) -> unit +val reduceU: 'v t -> 'v2 -> ('v2 -> key -> 'v -> 'v2 [@bs]) -> 'v2 +val everyU: 'v t -> (key -> 'v -> bool [@bs]) -> bool +val someU: 'v t -> (key -> 'v -> bool [@bs]) -> bool +val updateU: 'v t -> key -> ('v option -> 'v option [@bs]) -> 'v t +val mergeU: + 'v t -> 'v2 t -> + (key -> 'v option -> 'v2 option -> 'c option [@bs]) -> + 'c t +val keepU: + 'v t -> + (key -> 'v -> bool [@bs]) -> + 'v t +val partitionU: + 'v t -> + (key -> 'v -> bool [@bs]) -> + 'v t * 'v t +val mapU: 'v t -> ('v -> 'v2 [@bs]) -> 'v2 t val mapWithKeyU: 'v t -> (key -> 'v -> 'v2 [@bs]) -> 'v2 t -val mapWithKey: 'v t -> (key -> 'v -> 'v2) -> 'v2 t (**/**) val checkInvariantInternal: _ t -> unit (** {b raise} when invariant is not held -*) +*) (**/**) diff --git a/jscomp/others/belt_MapString.mli b/jscomp/others/belt_MapString.mli index c947704c56..0023d447be 100644 --- a/jscomp/others/belt_MapString.mli +++ b/jscomp/others/belt_MapString.mli @@ -6,38 +6,32 @@ type 'value t val empty: 'v t val isEmpty: 'v t -> bool -val has: 'v t -> key -> bool +val has: 'v t -> key -> bool -val cmpU: 'v t -> 'v t -> ('v -> 'v -> int [@bs]) -> int val cmp: 'v t -> 'v t -> ('v -> 'v -> int) -> int -val eqU: 'v t -> 'v t -> ('v -> 'v -> bool [@bs]) -> bool val eq: 'v t -> 'v t -> ('v -> 'v -> bool) -> bool (** [equal m1 m2 cmp] tests whether the maps [m1] and [m2] are equal, that is, contain equal keys and associate them with equal data. [cmp] is the equality predicate used to compare the data associated with the keys. *) -val forEachU: 'v t -> (key -> 'v -> unit [@bs]) -> unit val forEach: 'v t -> (key -> 'v -> 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 bindings are passed to [f] in increasing order with respect to the ordering over the type of the keys. *) -val reduceU: 'v t -> 'v2 -> ('v2 -> key -> 'v -> 'v2 [@bs]) -> 'v2 val reduce: 'v t -> 'v2 -> ('v2 -> key -> 'v -> 'v2) -> 'v2 (** [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: 'v t -> (key -> 'v -> bool [@bs]) -> bool val every: 'v t -> (key -> 'v -> bool) -> bool (** [every m p] checks if all the bindings of the map satisfy the predicate [p]. *) -val someU: 'v t -> (key -> 'v -> bool [@bs]) -> bool val some: 'v t -> (key -> 'v -> bool) -> bool (** [some m p] checks if at least one binding of the map satisfy the predicate [p]. @@ -46,12 +40,12 @@ val size: 'v t -> int val toList: 'v t -> (key * 'v) list (** In increasing order with respect *) val toArray: 'v t -> (key * 'v) array -val ofArray: (key * 'v) array -> 'v t +val ofArray: (key * 'v) array -> 'v t [@@ocaml.deprecated "Use fromArray instead"] -val fromArray: (key * 'v) array -> 'v t -val keysToArray: 'v t -> key array +val fromArray: (key * 'v) array -> 'v t +val keysToArray: 'v t -> key array val valuesToArray: 'v t -> 'v array -val minKey: _ t -> key option +val minKey: _ t -> key option val minKeyUndefined: _ t -> key Js.undefined val maxKey: _ t -> key option val maxKeyUndefined: _ t -> key Js.undefined @@ -62,12 +56,12 @@ val maxUndefined: 'v t -> (key * 'v) Js.undefined val get: 'v t -> key -> 'v option val getUndefined: 'v t -> key -> 'v Js.undefined val getWithDefault: 'v t -> key -> 'v -> 'v -val getExn: 'v t -> key -> 'v +val getExn: 'v t -> key -> 'v val checkInvariantInternal: _ t -> unit (** {b raise} when invariant is not held -*) +*) (****************************************************************************) @@ -81,43 +75,30 @@ val set: 'v t -> key -> 'v -> 'v t [m], plus a binding of [x] to [y]. If [x] was already bound in [m], its previous binding disappears. *) -val updateU: 'v t -> key -> ('v option -> 'v option [@bs]) -> 'v t -val update: 'v t -> key -> ('v option -> 'v option) -> 'v t +val update: 'v t -> key -> ('v option -> 'v option) -> 'v t val mergeArray: 'v t -> (key * 'v) array -> 'v t - -val mergeU: - 'v t -> 'v2 t -> - (key -> 'v option -> 'v2 option -> 'c option [@bs]) -> - 'c t + val merge: 'v t -> 'v2 t -> (key -> 'v option -> 'v2 option -> 'c option) -> - 'c t + 'c t (** [merge m1 m2 f] computes a map whose keys is a subset of keys of [m1] and of [m2]. The presence of each such binding, and the corresponding value, is determined with the function [f]. *) -val keepU: - 'v t -> - (key -> 'v -> bool [@bs]) -> +val keep: + 'v t -> + (key -> 'v -> bool) -> 'v t -val keep: - 'v t -> - (key -> 'v -> bool) -> - 'v t (** [keep m p] returns the map with all the bindings in [m] that satisfy predicate [p]. *) -val partitionU: - 'v t -> - (key -> 'v -> bool [@bs]) -> +val partition: + 'v t -> + (key -> 'v -> bool) -> 'v t * 'v t -val partition: - 'v t -> - (key -> 'v -> bool) -> - 'v t * 'v t (** [partition m p] returns a pair of maps [(m1, m2)], where [m1] contains all the bindings of [s] that satisfy the predicate [p], and [m2] is the map with all the bindings of @@ -139,21 +120,45 @@ val split: key -> 'v t -> 'v t * 'v option * 'v t *) -val mapU: 'v t -> ('v -> 'v2 [@bs]) -> 'v2 t -val map: 'v t -> ('v -> 'v2) -> 'v2 t +val map: 'v t -> ('v -> 'v2) -> 'v2 t (** [map m f] returns a map with same domain as [m], where the associated value [a] of all bindings of [m] has been replaced by the result of the application of [f] to [a]. The bindings are passed to [f] in increasing order with respect to the ordering over the type of the keys. *) +val mapWithKey: 'v t -> (key -> 'v -> 'v2) -> 'v2 t + + +(** {1 Uncurried version} *) + + +val cmpU: 'v t -> 'v t -> ('v -> 'v -> int [@bs]) -> int +val eqU: 'v t -> 'v t -> ('v -> 'v -> bool [@bs]) -> bool +val forEachU: 'v t -> (key -> 'v -> unit [@bs]) -> unit +val reduceU: 'v t -> 'v2 -> ('v2 -> key -> 'v -> 'v2 [@bs]) -> 'v2 +val everyU: 'v t -> (key -> 'v -> bool [@bs]) -> bool +val someU: 'v t -> (key -> 'v -> bool [@bs]) -> bool +val updateU: 'v t -> key -> ('v option -> 'v option [@bs]) -> 'v t +val mergeU: + 'v t -> 'v2 t -> + (key -> 'v option -> 'v2 option -> 'c option [@bs]) -> + 'c t +val keepU: + 'v t -> + (key -> 'v -> bool [@bs]) -> + 'v t +val partitionU: + 'v t -> + (key -> 'v -> bool [@bs]) -> + 'v t * 'v t +val mapU: 'v t -> ('v -> 'v2 [@bs]) -> 'v2 t val mapWithKeyU: 'v t -> (key -> 'v -> 'v2 [@bs]) -> 'v2 t -val mapWithKey: 'v t -> (key -> 'v -> 'v2) -> 'v2 t (**/**) val checkInvariantInternal: _ t -> unit (** {b raise} when invariant is not held -*) +*) (**/**) diff --git a/jscomp/others/belt_MutableMap.mli b/jscomp/others/belt_MutableMap.mli index 25ebb28c45..7237616393 100644 --- a/jscomp/others/belt_MutableMap.mli +++ b/jscomp/others/belt_MutableMap.mli @@ -40,11 +40,6 @@ val clear: _ t -> unit val isEmpty: _ t -> bool val has: ('k, _, _) t -> 'k -> bool -val cmpU: - ('k, 'a, 'id) t -> - ('k, 'a, 'id) t -> - ('a -> 'a -> int [@bs]) -> - int val cmp: ('k, 'a, 'id) t -> ('k, 'a, 'id) t -> @@ -54,34 +49,29 @@ val cmp: First compare by size, if size is the same, compare by key, value pair *) -val eqU: ('k, 'a, 'id) t -> ('k, 'a, 'id) t -> ('a -> 'a -> bool [@bs]) -> bool val eq: ('k, 'a, 'id) t -> ('k, 'a, 'id) t -> ('a -> 'a -> bool) -> bool (** [eq m1 m2 eqf] tests whether the maps [m1] and [m2] are equal, that is, contain equal keys and associate them with equal data. [eqf] is the equality predicate used to compare the data associated with the keys. *) -val forEachU: ('k, 'a, 'id) t -> ('k -> 'a -> unit [@bs]) -> unit val forEach: ('k, 'a, 'id) t -> ('k -> 'a -> unit) -> unit (** [forEach m f] applies [f] to all bindings in map [m]. [f] receives the 'k as first argument, and the associated value as second argument. The bindings are passed to [f] in increasing order with respect to the ordering over the type of the keys. *) -val reduceU: ('k, 'a, 'id) t -> 'b -> ('b -> 'k -> 'a -> 'b [@bs]) -> 'b val reduce: ('k, 'a, 'id) t -> 'b -> ('b -> 'k -> '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: ('k, 'a, 'id) t -> ('k -> 'a -> bool [@bs]) -> bool val every: ('k, 'a, 'id) t -> ('k -> 'a -> bool) -> bool (** [every m p] checks if all the bindings of the map satisfy the predicate [p]. *) -val someU: ('k, 'a, 'id) t -> ('k -> 'a -> bool [@bs]) -> bool val some: ('k, 'a, 'id) t -> ('k -> 'a -> bool) -> bool (** [some m p] checks if at least one binding of the map satisfy the predicate [p]. @@ -128,12 +118,10 @@ val removeMany: ('k, 'a, 'id) t -> 'k array -> unit val set: ('k, 'a, 'id) t -> 'k -> 'a -> unit (** [set m x y ] do the in-place modification *) -val updateU: ('k, 'a, 'id) t -> 'k -> ('a option -> 'a option [@bs]) -> unit val update: ('k, 'a, 'id) t -> 'k -> ('a option -> 'a option) -> unit val mergeMany: ('k, 'a, 'id) t -> ('k * 'a) array -> unit -val mapU: ('k, 'a, 'id) t -> ('a -> 'b [@bs]) -> ('k ,'b,'id ) t val map: ('k, 'a, 'id) t -> ('a -> 'b) -> ('k ,'b,'id ) t (** [map m f] returns a map with same domain as [m], where the associated value [a] of all bindings of [m] has been @@ -141,8 +129,30 @@ val map: ('k, 'a, 'id) t -> ('a -> 'b) -> ('k ,'b,'id ) t The bindings are passed to [f] in increasing order with respect to the ordering over the type of the keys. *) -val mapWithKeyU: ('k, 'a, 'id) t -> ('k -> 'a -> 'b [@bs]) -> ('k, 'b, 'id) t val mapWithKey: ('k, 'a, 'id) t -> ('k -> 'a -> 'b) -> ('k, 'b, 'id) t +(** {1 Uncurried version} *) + +val cmpU: + ('k, 'a, 'id) t -> + ('k, 'a, 'id) t -> + ('a -> 'a -> int [@bs]) -> + int + +val eqU: ('k, 'a, 'id) t -> ('k, 'a, 'id) t -> ('a -> 'a -> bool [@bs]) -> bool + +val forEachU: ('k, 'a, 'id) t -> ('k -> 'a -> unit [@bs]) -> unit + +val reduceU: ('k, 'a, 'id) t -> 'b -> ('b -> 'k -> 'a -> 'b [@bs]) -> 'b + +val everyU: ('k, 'a, 'id) t -> ('k -> 'a -> bool [@bs]) -> bool + +val someU: ('k, 'a, 'id) t -> ('k -> 'a -> bool [@bs]) -> bool + +val updateU: ('k, 'a, 'id) t -> 'k -> ('a option -> 'a option [@bs]) -> unit + +val mapU: ('k, 'a, 'id) t -> ('a -> 'b [@bs]) -> ('k ,'b,'id ) t + +val mapWithKeyU: ('k, 'a, 'id) t -> ('k -> 'a -> 'b [@bs]) -> ('k, 'b, 'id) t diff --git a/jscomp/others/belt_MutableQueue.mli b/jscomp/others/belt_MutableQueue.mli index 4c718967ac..8b3f10cdfa 100644 --- a/jscomp/others/belt_MutableQueue.mli +++ b/jscomp/others/belt_MutableQueue.mli @@ -34,23 +34,23 @@ val ofArray: 'a array -> 'a t [@@ocaml.deprecated "Use fromArray instead"] val fromArray: 'a array -> 'a t -(** [fromArray a] is equivalent to [Array.forEach a (add q a)] *) +(** [fromArray a] is equivalent to [Array.forEach a (add q a)] *) val add: 'a t -> 'a -> unit (** [add q x] adds the element [x] at the end of the queue [q]. *) - + val peek: 'a t -> 'a option (** [peekOpt q] returns the first element in queue [q], without removing it from the queue. *) val peekUndefined: 'a t -> 'a Js.undefined (** [peekUndefined q] returns [undefined] if not found *) -val peekExn: 'a t -> 'a +val peekExn: 'a t -> 'a (** [peekExn q] {b raise} an exception if [q] is empty *) -val pop: 'a t -> 'a option +val pop: 'a t -> 'a option (** [pop q] removes and returns the first element in queue [q].*) val popUndefined: 'a t -> 'a Js.undefined @@ -58,12 +58,12 @@ val popUndefined: 'a t -> 'a Js.undefined it will return undefined if it is already empty *) -val popExn: 'a t -> 'a +val popExn: 'a t -> 'a (** [popExn q] {b raise} an exception if [q] is empty *) - + val copy: 'a t -> 'a t (** [copy q] @@ -73,16 +73,13 @@ val copy: 'a t -> 'a t val size: 'a t -> int (** @return the number of elements in a queue. *) -val mapU: 'a t -> ('a -> 'b [@bs]) -> 'b t val map: 'a t -> ('a -> 'b ) -> 'b t -val forEachU: 'a t -> ('a -> unit [@bs]) -> unit val forEach: 'a t -> ('a -> unit ) -> unit (** [forEach q f] applies [f] in turn to all elements of [q], from the least recently entered to the most recently entered. The queue itself is unchanged. *) -val reduceU: 'a t -> 'b -> ('b -> 'a -> 'b [@bs]) -> 'b val reduce: 'a t -> 'b -> ('b -> 'a -> 'b ) -> 'b (** [reduce q accu f] is equivalent to [List.reduce l accu f], where [l] is the list of [q]'s elements. The queue remains @@ -94,5 +91,15 @@ val transfer: 'a t -> 'a t -> unit sequence [forEach (fun x -> add x q2) q1; clear q1], but runs in constant time. *) -val toArray: 'a t -> 'a array +val toArray: 'a t -> 'a array (** First added will be in the beginning of the array *) + + +(** {1 Uncurried version} *) + + +val mapU: 'a t -> ('a -> 'b [@bs]) -> 'b t + +val forEachU: 'a t -> ('a -> unit [@bs]) -> unit + +val reduceU: 'a t -> 'b -> ('b -> 'a -> 'b [@bs]) -> 'b diff --git a/jscomp/others/belt_MutableSet.mli b/jscomp/others/belt_MutableSet.mli index 867180136f..f1adf87186 100644 --- a/jscomp/others/belt_MutableSet.mli +++ b/jscomp/others/belt_MutableSet.mli @@ -76,31 +76,25 @@ val cmp: val eq: ('value, 'id) t -> ('value, 'id) t -> bool -val forEachU: ('value, 'id) t -> ('value -> unit [@bs]) -> unit val forEach: ('value, 'id) t -> ('value -> unit) -> unit (** [forEach m f] applies [f] in turn to all elements of [m]. In increasing order *) -val reduceU: ('value, 'id) t -> 'a -> ('a -> 'value -> 'a [@bs]) -> '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 (** [every s p] 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 (** [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 s p] returns the set of all elements in [s] 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 (** [partition p s] returns a pair of sets [(s1, s2)], where [s1] is the set of all the elements of [s] that satisfy the @@ -153,3 +147,19 @@ val ofArray: 'k array -> id:('k, 'id) id -> ('k, 'id) t val ofSortedArrayUnsafe: 'value array -> id:('value, 'id) id -> ('value,'id) t [@@ocaml.deprecated "Use fromSortedArrayUnsafe instead"] + + +(** {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/belt_MutableStack.mli b/jscomp/others/belt_MutableStack.mli index cf89ce36d8..d10b890527 100644 --- a/jscomp/others/belt_MutableStack.mli +++ b/jscomp/others/belt_MutableStack.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. *) @@ -42,25 +42,28 @@ val push : 'a t -> 'a -> unit val popUndefined : 'a t -> 'a Js.undefined -val pop : 'a t -> 'a option +val pop : 'a t -> 'a option val topUndefined : 'a t -> 'a Js.undefined -val top : 'a t -> 'a option +val top : 'a t -> 'a option val isEmpty : 'a t -> bool val size : 'a t -> int -val forEachU : 'a t -> ('a -> unit [@bs] ) -> unit val forEach : 'a t -> ('a -> unit ) -> unit - -val dynamicPopIterU : 'a t -> ('a -> unit [@bs]) -> unit -val dynamicPopIter : 'a t -> ('a -> unit ) -> unit +val dynamicPopIter : 'a t -> ('a -> unit ) -> unit (** [dynamicPopIter s f ] - apply [f] to each element of [s]. The item is poped + apply [f] to each element of [s]. The item is poped before applying [f], [s] will be empty after this opeartion. This function is useful for worklist algorithm *) + +(** {1 Uncurried version} *) + +val forEachU : 'a t -> ('a -> unit [@bs] ) -> unit + +val dynamicPopIterU : 'a t -> ('a -> unit [@bs]) -> unit diff --git a/jscomp/others/belt_Range.mli b/jscomp/others/belt_Range.mli index 1a4b49ffc3..cd8c50991c 100644 --- a/jscomp/others/belt_Range.mli +++ b/jscomp/others/belt_Range.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. *) @@ -27,41 +27,49 @@ it use a for-loop internally instead of creating an array *) -val forEachU: int -> int -> (int -> unit [@bs]) -> unit val forEach: int -> int -> (int -> unit ) -> unit (** [forEach start finish action] equivalent to [Belt.Array.(forEach (range start finish) action)] *) - -val everyU: int -> int -> (int -> bool [@bs]) -> bool + val every: int -> int -> (int -> bool ) -> bool (** [every start finish p] equivalent to [Belt.Array.(every (range start finish) p )] *) - -val everyByU: int -> int -> step:int -> (int -> bool [@bs]) -> bool + val everyBy: int -> int -> step:int -> (int -> bool ) -> bool (** [everyBy start finish ~step p] {b See} {!Belt_Array.rangeBy} - + equivalent to [Belt.Array.(every (rangeBy start finish ~step) p)] *) - -val someU: int -> int -> (int -> bool [@bs]) -> bool + val some: int -> int -> (int -> bool ) -> bool (** [some start finish p] equivalent to [Belt.Array.(some (range start finish) p)] *) -val someByU: int -> int -> step:int -> (int -> bool [@bs]) -> bool -val someBy: int -> int -> step:int -> (int -> bool ) -> bool +val someBy: int -> int -> step:int -> (int -> bool ) -> bool (** [someBy start finish ~step p] {b See} {!Belt_Array.rangeBy} - + equivalent to [Belt.Array.(some (rangeBy start finish ~step) p)] *) + + +(** {1 Uncurried version} *) + +val forEachU: int -> int -> (int -> unit [@bs]) -> unit + +val everyU: int -> int -> (int -> bool [@bs]) -> bool + +val everyByU: int -> int -> step:int -> (int -> bool [@bs]) -> bool + +val someU: int -> int -> (int -> bool [@bs]) -> bool + +val someByU: int -> int -> step:int -> (int -> bool [@bs]) -> bool diff --git a/jscomp/others/belt_Set.mli b/jscomp/others/belt_Set.mli index f524e20c6a..fb8f7b63cc 100644 --- a/jscomp/others/belt_Set.mli +++ b/jscomp/others/belt_Set.mli @@ -233,7 +233,6 @@ val eq: ('value, 'id) t -> ('value, 'id) t -> bool @return true if [toArray s0 = toArray s1] *) -val forEachU: ('value, 'id) t -> ('value -> unit [@bs]) -> unit val forEach: ('value, 'id) t -> ('value -> unit ) -> unit (** [forEach s f] applies [f] in turn to all elements of [s]. In increasing order @@ -246,7 +245,6 @@ val forEach: ('value, 'id) t -> ('value -> unit ) -> unit ]} *) -val reduceU: ('value, 'id) t -> 'a -> ('a -> 'value -> 'a [@bs]) -> 'a val reduce: ('value, 'id) t -> 'a -> ('a -> 'value -> 'a ) -> 'a (** In increasing order. @@ -256,23 +254,19 @@ val reduce: ('value, 'id) t -> 'a -> ('a -> 'value -> 'a ) -> 'a ]} *) -val everyU: ('value, 'id) t -> ('value -> bool [@bs]) -> 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 (** [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]. *) -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 (** [partition m p] returns a pair of sets [(s1, s2)], where [s1] is the set of all the elements of [s] that satisfy the @@ -388,3 +382,18 @@ val packIdData: id:('value, 'id) id -> data:('value, 'id) Belt_SetDict.t -> ('va @return the packed collection *) + +(** {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/belt_SetInt.mli b/jscomp/others/belt_SetInt.mli index 1956fd148f..29ed77ec44 100644 --- a/jscomp/others/belt_SetInt.mli +++ b/jscomp/others/belt_SetInt.mli @@ -1,6 +1,6 @@ # 1 "set.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. *) @@ -44,28 +44,28 @@ val empty: t val ofArray: value array -> t [@@ocaml.deprecated "Use fromArray instead"] -val ofSortedArrayUnsafe: value array -> t +val ofSortedArrayUnsafe: value array -> t [@@ocaml.deprecated "Use fromSortedArrayUnsafe instead"] val fromArray: value array -> t -val fromSortedArrayUnsafe: value array -> t +val fromSortedArrayUnsafe: value array -> t val isEmpty: t -> bool val has: t -> value -> bool - + val add: t -> value -> t (** If [x] was already in [s], [s] is returned unchanged. *) -val mergeMany: t -> value array -> t +val mergeMany: t -> value array -> t val remove: t -> value -> t (** If [x] was not in [s], [s] is returned unchanged. *) val removeMany: t -> value array -> t - + val union: t -> t -> t val intersect: t -> t -> t val diff: t -> t -> t val subset: t -> t -> bool (** [subset s1 s2] tests whether the set [s1] is a subset of the set [s2]. *) - + val cmp: t -> t -> int (** Total ordering between sets. Can be used as the ordering function for doing sets of sets. *) @@ -75,30 +75,24 @@ val eq: t -> t -> bool equal, that is, contain equal elements. *) -val forEachU: t -> (value -> unit [@bs]) -> unit -val forEach: t -> (value -> unit ) -> 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 p s] returns 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 (** [partition p s] returns a pair of sets [(s1, s2)], where [s1] is the set of all the elements of [s] that satisfy the @@ -120,8 +114,8 @@ 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 getExn: t -> value -> value +val split: t -> value -> (t * t) * bool (** [split x s] returns a triple [(l, present, r)], where [l] is the set of elements of [s] that are strictly less than [x]; @@ -135,6 +129,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_SetString.mli b/jscomp/others/belt_SetString.mli index 396f0cfd3a..d654998038 100644 --- a/jscomp/others/belt_SetString.mli +++ b/jscomp/others/belt_SetString.mli @@ -1,6 +1,6 @@ # 1 "set.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. *) @@ -44,28 +44,28 @@ val empty: t val ofArray: value array -> t [@@ocaml.deprecated "Use fromArray instead"] -val ofSortedArrayUnsafe: value array -> t +val ofSortedArrayUnsafe: value array -> t [@@ocaml.deprecated "Use fromSortedArrayUnsafe instead"] val fromArray: value array -> t -val fromSortedArrayUnsafe: value array -> t +val fromSortedArrayUnsafe: value array -> t val isEmpty: t -> bool val has: t -> value -> bool - + val add: t -> value -> t (** If [x] was already in [s], [s] is returned unchanged. *) -val mergeMany: t -> value array -> t +val mergeMany: t -> value array -> t val remove: t -> value -> t (** If [x] was not in [s], [s] is returned unchanged. *) val removeMany: t -> value array -> t - + val union: t -> t -> t val intersect: t -> t -> t val diff: t -> t -> t val subset: t -> t -> bool (** [subset s1 s2] tests whether the set [s1] is a subset of the set [s2]. *) - + val cmp: t -> t -> int (** Total ordering between sets. Can be used as the ordering function for doing sets of sets. *) @@ -75,30 +75,24 @@ val eq: t -> t -> bool equal, that is, contain equal elements. *) -val forEachU: t -> (value -> unit [@bs]) -> unit -val forEach: t -> (value -> unit ) -> 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 p s] returns 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 (** [partition p s] returns a pair of sets [(s1, s2)], where [s1] is the set of all the elements of [s] that satisfy the @@ -120,8 +114,8 @@ 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 getExn: t -> value -> value +val split: t -> value -> (t * t) * bool (** [split x s] returns a triple [(l, present, r)], where [l] is the set of elements of [s] that are strictly less than [x]; @@ -135,6 +129,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_SortArray.mli b/jscomp/others/belt_SortArray.mli index 41e0f212e0..76d324d14e 100644 --- a/jscomp/others/belt_SortArray.mli +++ b/jscomp/others/belt_SortArray.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. *) @@ -29,19 +29,15 @@ module Int = Belt_SortArrayInt (** Specalized when key type is [int], more efficient than the gerneic type *) -module String = Belt_SortArrayString +module String = Belt_SortArrayString (** Specalized when key type is [string], more efficient - than the gerneic type *) + than the gerneic type *) -val strictlySortedLengthU: - 'a array -> - ('a -> 'a -> bool [@bs]) -> +val strictlySortedLength: + 'a array -> + ('a -> 'a -> bool) -> int -val strictlySortedLength: - 'a array -> - ('a -> 'a -> bool) -> - int (** [strictlySortedLenght xs cmp] return [+n] means increasing order @@ -52,28 +48,25 @@ val strictlySortedLength: strictlySortedLength [||] (fun x y -> x < y) = 0;; strictlySortedLength [|1|] (fun x y -> x < y) = 1;; strictlySortedLength [|4;3;2;1|] (fun x y -> x < y) = -4;; - ]} -*) + ]} +*) -val isSortedU: 'a array -> ('a -> 'a -> int [@bs]) -> bool -val isSorted: 'a array -> ('a -> 'a -> int) -> bool -(** [isSorted arr cmp] +val isSorted: 'a array -> ('a -> 'a -> int) -> bool +(** [isSorted arr cmp] @return true if array is increasingly sorted (equal is okay ) @example {[ isSorted [|1;1;2;3;4|] (fun x y -> compare x y)) = true ]} *) -val stableSortInPlaceByU: 'a array -> ('a -> 'a -> int [@bs]) -> unit val stableSortInPlaceBy: 'a array -> ('a -> 'a -> int ) -> unit (** [stableSortBy xs cmp] Sort xs in place using comparator [cmp], the stable means if the elements are equal, their order will be preserved -*) +*) -val stableSortByU: 'a array -> ('a -> 'a -> int [@bs]) -> 'a array -val stableSortBy: 'a array -> ('a -> 'a -> int) -> 'a array +val stableSortBy: 'a array -> ('a -> 'a -> int) -> 'a array (** [stableSort xs cmp] @return a fresh array @@ -82,18 +75,16 @@ val stableSortBy: 'a array -> ('a -> 'a -> int) -> 'a array -val binarySearchByU: - 'a array -> 'a -> ('a -> 'a -> int [@bs]) -> int val binarySearchBy: - 'a array -> 'a -> ('a -> 'a -> int ) -> int + 'a array -> 'a -> ('a -> 'a -> int ) -> int (** - If value is not found and value is less than one or more elements in array, - the negative number returned is the bitwise complement of the index of the first element - that is larger than value. - + If value is not found and value is less than one or more elements in array, + the negative number returned is the bitwise complement of the index of the first element + that is larger than value. + If value is not found and value is greater than all elements in array, - the negative number returned is the bitwise complement of + the negative number returned is the bitwise complement of (the index of the last element plus 1) for example, if [key] is smaller than all elements return [-1] since [lnot (-1) = 0] @@ -105,15 +96,16 @@ val binarySearchBy: ]} *) + (**/**) -val unionU: - 'a array -> int -> int -> - 'a array -> int -> int -> +val unionU: + 'a array -> int -> int -> + 'a array -> int -> int -> 'a array -> int -> ('a -> 'a -> int [@bs]) -> int -val union: - 'a array -> int -> int -> - 'a array -> int -> int -> +val union: + 'a array -> int -> int -> + 'a array -> int -> int -> 'a array -> int -> ('a -> 'a -> int ) -> int (** @@ -121,30 +113,48 @@ val union: assume [src] and [src2] is strictly sorted. for equivalent elements, it is picked from [src] also assume that [dst] is large enough to store all elements -*) +*) -val intersectU: - 'a array -> int -> int -> - 'a array -> int -> int -> +val intersectU: + 'a array -> int -> int -> + 'a array -> int -> int -> 'a array -> int -> ('a -> 'a -> int [@bs]) -> int -val intersect: - 'a array -> int -> int -> - 'a array -> int -> int -> +val intersect: + 'a array -> int -> int -> + 'a array -> int -> int -> 'a array -> int -> ('a -> 'a -> int ) - -> int -(** [union src src1ofs src1len src2 src2ofs src2len dst dstofs cmp] + -> int +(** [union src src1ofs src1len src2 src2ofs src2len dst dstofs cmp] return the [offset] in the output array *) -val diffU: - 'a array -> int -> int -> - 'a array -> int -> int -> +val diffU: + 'a array -> int -> int -> + 'a array -> int -> int -> 'a array -> int -> ('a -> 'a -> int [@bs]) -> int -val diff: - 'a array -> int -> int -> - 'a array -> int -> int -> +val diff: + 'a array -> int -> int -> + 'a array -> int -> int -> 'a array -> int -> ('a -> 'a -> int) - -> int + -> int (**/**) + + +(** {1 Uncurried version} *) + + +val strictlySortedLengthU: + 'a array -> + ('a -> 'a -> bool [@bs]) -> + int + +val isSortedU: 'a array -> ('a -> 'a -> int [@bs]) -> bool + +val stableSortInPlaceByU: 'a array -> ('a -> 'a -> int [@bs]) -> unit + +val stableSortByU: 'a array -> ('a -> 'a -> int [@bs]) -> 'a array + +val binarySearchByU: + 'a array -> 'a -> ('a -> 'a -> int [@bs]) -> int diff --git a/jscomp/others/map.cppo.mli b/jscomp/others/map.cppo.mli index 2efdd39590..b201f31cd5 100644 --- a/jscomp/others/map.cppo.mli +++ b/jscomp/others/map.cppo.mli @@ -4,44 +4,38 @@ type key = string type key = int #else [%error "unknown type"] -#endif +#endif type 'value t (** The type of maps from type [key] to type ['value]. *) val empty: 'v t val isEmpty: 'v t -> bool -val has: 'v t -> key -> bool +val has: 'v t -> key -> bool -val cmpU: 'v t -> 'v t -> ('v -> 'v -> int [@bs]) -> int val cmp: 'v t -> 'v t -> ('v -> 'v -> int) -> int -val eqU: 'v t -> 'v t -> ('v -> 'v -> bool [@bs]) -> bool val eq: 'v t -> 'v t -> ('v -> 'v -> bool) -> bool (** [equal m1 m2 cmp] tests whether the maps [m1] and [m2] are equal, that is, contain equal keys and associate them with equal data. [cmp] is the equality predicate used to compare the data associated with the keys. *) -val forEachU: 'v t -> (key -> 'v -> unit [@bs]) -> unit val forEach: 'v t -> (key -> 'v -> 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 bindings are passed to [f] in increasing order with respect to the ordering over the type of the keys. *) -val reduceU: 'v t -> 'v2 -> ('v2 -> key -> 'v -> 'v2 [@bs]) -> 'v2 val reduce: 'v t -> 'v2 -> ('v2 -> key -> 'v -> 'v2) -> 'v2 (** [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: 'v t -> (key -> 'v -> bool [@bs]) -> bool val every: 'v t -> (key -> 'v -> bool) -> bool (** [every m p] checks if all the bindings of the map satisfy the predicate [p]. *) -val someU: 'v t -> (key -> 'v -> bool [@bs]) -> bool val some: 'v t -> (key -> 'v -> bool) -> bool (** [some m p] checks if at least one binding of the map satisfy the predicate [p]. @@ -50,12 +44,12 @@ val size: 'v t -> int val toList: 'v t -> (key * 'v) list (** In increasing order with respect *) val toArray: 'v t -> (key * 'v) array -val ofArray: (key * 'v) array -> 'v t +val ofArray: (key * 'v) array -> 'v t [@@ocaml.deprecated "Use fromArray instead"] -val fromArray: (key * 'v) array -> 'v t -val keysToArray: 'v t -> key array +val fromArray: (key * 'v) array -> 'v t +val keysToArray: 'v t -> key array val valuesToArray: 'v t -> 'v array -val minKey: _ t -> key option +val minKey: _ t -> key option val minKeyUndefined: _ t -> key Js.undefined val maxKey: _ t -> key option val maxKeyUndefined: _ t -> key Js.undefined @@ -66,12 +60,12 @@ val maxUndefined: 'v t -> (key * 'v) Js.undefined val get: 'v t -> key -> 'v option val getUndefined: 'v t -> key -> 'v Js.undefined val getWithDefault: 'v t -> key -> 'v -> 'v -val getExn: 'v t -> key -> 'v +val getExn: 'v t -> key -> 'v val checkInvariantInternal: _ t -> unit (** {b raise} when invariant is not held -*) +*) (****************************************************************************) @@ -85,43 +79,30 @@ val set: 'v t -> key -> 'v -> 'v t [m], plus a binding of [x] to [y]. If [x] was already bound in [m], its previous binding disappears. *) -val updateU: 'v t -> key -> ('v option -> 'v option [@bs]) -> 'v t -val update: 'v t -> key -> ('v option -> 'v option) -> 'v t +val update: 'v t -> key -> ('v option -> 'v option) -> 'v t val mergeArray: 'v t -> (key * 'v) array -> 'v t - -val mergeU: - 'v t -> 'v2 t -> - (key -> 'v option -> 'v2 option -> 'c option [@bs]) -> - 'c t + val merge: 'v t -> 'v2 t -> (key -> 'v option -> 'v2 option -> 'c option) -> - 'c t + 'c t (** [merge m1 m2 f] computes a map whose keys is a subset of keys of [m1] and of [m2]. The presence of each such binding, and the corresponding value, is determined with the function [f]. *) -val keepU: - 'v t -> - (key -> 'v -> bool [@bs]) -> +val keep: + 'v t -> + (key -> 'v -> bool) -> 'v t -val keep: - 'v t -> - (key -> 'v -> bool) -> - 'v t (** [keep m p] returns the map with all the bindings in [m] that satisfy predicate [p]. *) -val partitionU: - 'v t -> - (key -> 'v -> bool [@bs]) -> +val partition: + 'v t -> + (key -> 'v -> bool) -> 'v t * 'v t -val partition: - 'v t -> - (key -> 'v -> bool) -> - 'v t * 'v t (** [partition m p] returns a pair of maps [(m1, m2)], where [m1] contains all the bindings of [s] that satisfy the predicate [p], and [m2] is the map with all the bindings of @@ -143,21 +124,45 @@ val split: key -> 'v t -> 'v t * 'v option * 'v t *) -val mapU: 'v t -> ('v -> 'v2 [@bs]) -> 'v2 t -val map: 'v t -> ('v -> 'v2) -> 'v2 t +val map: 'v t -> ('v -> 'v2) -> 'v2 t (** [map m f] returns a map with same domain as [m], where the associated value [a] of all bindings of [m] has been replaced by the result of the application of [f] to [a]. The bindings are passed to [f] in increasing order with respect to the ordering over the type of the keys. *) +val mapWithKey: 'v t -> (key -> 'v -> 'v2) -> 'v2 t + + +(** {1 Uncurried version} *) + + +val cmpU: 'v t -> 'v t -> ('v -> 'v -> int [@bs]) -> int +val eqU: 'v t -> 'v t -> ('v -> 'v -> bool [@bs]) -> bool +val forEachU: 'v t -> (key -> 'v -> unit [@bs]) -> unit +val reduceU: 'v t -> 'v2 -> ('v2 -> key -> 'v -> 'v2 [@bs]) -> 'v2 +val everyU: 'v t -> (key -> 'v -> bool [@bs]) -> bool +val someU: 'v t -> (key -> 'v -> bool [@bs]) -> bool +val updateU: 'v t -> key -> ('v option -> 'v option [@bs]) -> 'v t +val mergeU: + 'v t -> 'v2 t -> + (key -> 'v option -> 'v2 option -> 'c option [@bs]) -> + 'c t +val keepU: + 'v t -> + (key -> 'v -> bool [@bs]) -> + 'v t +val partitionU: + 'v t -> + (key -> 'v -> bool [@bs]) -> + 'v t * 'v t +val mapU: 'v t -> ('v -> 'v2 [@bs]) -> 'v2 t val mapWithKeyU: 'v t -> (key -> 'v -> 'v2 [@bs]) -> 'v2 t -val mapWithKey: 'v t -> (key -> 'v -> 'v2) -> 'v2 t (**/**) val checkInvariantInternal: _ t -> unit (** {b raise} when invariant is not held -*) +*) (**/**) diff --git a/jscomp/others/set.cppo.mli b/jscomp/others/set.cppo.mli index d61e5a5cad..0dbc4d9cb7 100644 --- a/jscomp/others/set.cppo.mli +++ b/jscomp/others/set.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. *) @@ -33,9 +33,9 @@ type value = string #elif defined TYPE_INT type value = int -#else +#else [%error "unknown type"] -#endif +#endif (** The type of the set elements. *) @@ -47,28 +47,28 @@ val empty: t val ofArray: value array -> t [@@ocaml.deprecated "Use fromArray instead"] -val ofSortedArrayUnsafe: value array -> t +val ofSortedArrayUnsafe: value array -> t [@@ocaml.deprecated "Use fromSortedArrayUnsafe instead"] val fromArray: value array -> t -val fromSortedArrayUnsafe: value array -> t +val fromSortedArrayUnsafe: value array -> t val isEmpty: t -> bool val has: t -> value -> bool - + val add: t -> value -> t (** If [x] was already in [s], [s] is returned unchanged. *) -val mergeMany: t -> value array -> t +val mergeMany: t -> value array -> t val remove: t -> value -> t (** If [x] was not in [s], [s] is returned unchanged. *) val removeMany: t -> value array -> t - + val union: t -> t -> t val intersect: t -> t -> t val diff: t -> t -> t val subset: t -> t -> bool (** [subset s1 s2] tests whether the set [s1] is a subset of the set [s2]. *) - + val cmp: t -> t -> int (** Total ordering between sets. Can be used as the ordering function for doing sets of sets. *) @@ -78,30 +78,24 @@ val eq: t -> t -> bool equal, that is, contain equal elements. *) -val forEachU: t -> (value -> unit [@bs]) -> unit -val forEach: t -> (value -> unit ) -> 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 p s] returns 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 (** [partition p s] returns a pair of sets [(s1, s2)], where [s1] is the set of all the elements of [s] that satisfy the @@ -123,8 +117,8 @@ 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 getExn: t -> value -> value +val split: t -> value -> (t * t) * bool (** [split x s] returns a triple [(l, present, r)], where [l] is the set of elements of [s] that are strictly less than [x]; @@ -138,6 +132,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_HashMap.js b/lib/js/belt_HashMap.js index a654d5d72f..a95d2f5b08 100644 --- a/lib/js/belt_HashMap.js +++ b/lib/js/belt_HashMap.js @@ -259,16 +259,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; @@ -283,6 +277,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.Int = Int; exports.$$String = $$String; exports.make = make; @@ -293,11 +293,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; @@ -308,4 +305,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_HashSet.js b/lib/js/belt_HashSet.js index 4cf9439567..55581677f0 100644 --- a/lib/js/belt_HashSet.js +++ b/lib/js/belt_HashSet.js @@ -204,12 +204,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; @@ -220,6 +216,10 @@ var ofArray = fromArray; var getBucketHistogram = Belt_internalSetBuckets.getBucketHistogram; +var forEachU = Belt_internalSetBuckets.forEachU; + +var reduceU = Belt_internalSetBuckets.reduceU; + exports.Int = Int; exports.$$String = $$String; exports.make = make; @@ -229,9 +229,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; @@ -240,4 +238,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_Id.js b/lib/js/belt_Id.js index 63e21818d1..4f507d2432 100644 --- a/lib/js/belt_Id.js +++ b/lib/js/belt_Id.js @@ -58,12 +58,12 @@ function hashable(hash, eq) { ]; } -exports.MakeComparableU = MakeComparableU; exports.MakeComparable = MakeComparable; exports.comparableU = comparableU; exports.comparable = comparable; -exports.MakeHashableU = MakeHashableU; exports.MakeHashable = MakeHashable; exports.hashableU = hashableU; exports.hashable = hashable; +exports.MakeComparableU = MakeComparableU; +exports.MakeHashableU = MakeHashableU; /* No side effect */ diff --git a/lib/js/belt_List.js b/lib/js/belt_List.js index 47ab952fb9..eba3c8dc79 100644 --- a/lib/js/belt_List.js +++ b/lib/js/belt_List.js @@ -1419,7 +1419,6 @@ exports.add = add; exports.get = get; exports.getExn = getExn; exports.make = make; -exports.makeByU = makeByU; exports.makeBy = makeBy; exports.shuffle = shuffle; exports.drop = drop; @@ -1429,65 +1428,66 @@ exports.concat = concat; exports.concatMany = concatMany; exports.reverseConcat = reverseConcat; exports.flatten = flatten; -exports.mapU = mapU; exports.map = map; exports.zip = zip; -exports.zipByU = zipByU; exports.zipBy = zipBy; -exports.mapWithIndexU = mapWithIndexU; exports.mapWithIndex = mapWithIndex; exports.ofArray = ofArray; exports.fromArray = fromArray; exports.toArray = toArray; exports.reverse = reverse; -exports.mapReverseU = mapReverseU; exports.mapReverse = mapReverse; -exports.forEachU = forEachU; exports.forEach = forEach; -exports.forEachWithIndexU = forEachWithIndexU; exports.forEachWithIndex = forEachWithIndex; -exports.reduceU = reduceU; exports.reduce = reduce; -exports.reduceReverseU = reduceReverseU; exports.reduceReverse = reduceReverse; -exports.mapReverse2U = mapReverse2U; exports.mapReverse2 = mapReverse2; -exports.forEach2U = forEach2U; exports.forEach2 = forEach2; -exports.reduce2U = reduce2U; exports.reduce2 = reduce2; -exports.reduceReverse2U = reduceReverse2U; exports.reduceReverse2 = reduceReverse2; -exports.everyU = everyU; exports.every = every; -exports.someU = someU; exports.some = some; -exports.every2U = every2U; exports.every2 = every2; -exports.some2U = some2U; exports.some2 = some2; exports.cmpByLength = cmpByLength; -exports.cmpU = cmpU; exports.cmp = cmp; -exports.eqU = eqU; exports.eq = eq; -exports.hasU = hasU; exports.has = has; -exports.getByU = getByU; exports.getBy = getBy; -exports.keepU = keepU; exports.keep = keep; -exports.keepMapU = keepMapU; exports.keepMap = keepMap; -exports.partitionU = partitionU; exports.partition = partition; exports.unzip = unzip; -exports.getAssocU = getAssocU; exports.getAssoc = getAssoc; -exports.hasAssocU = hasAssocU; exports.hasAssoc = hasAssoc; -exports.removeAssocU = removeAssocU; exports.removeAssoc = removeAssoc; -exports.setAssocU = setAssocU; exports.setAssoc = setAssoc; +exports.makeByU = makeByU; +exports.mapU = mapU; +exports.zipByU = zipByU; +exports.mapWithIndexU = mapWithIndexU; +exports.mapReverseU = mapReverseU; +exports.forEachU = forEachU; +exports.forEachWithIndexU = forEachWithIndexU; +exports.reduceU = reduceU; +exports.reduceReverseU = reduceReverseU; +exports.mapReverse2U = mapReverse2U; +exports.forEach2U = forEach2U; +exports.reduce2U = reduce2U; +exports.reduceReverse2U = reduceReverse2U; +exports.everyU = everyU; +exports.someU = someU; +exports.every2U = every2U; +exports.some2U = some2U; +exports.cmpU = cmpU; +exports.eqU = eqU; +exports.hasU = hasU; +exports.getByU = getByU; +exports.keepU = keepU; +exports.keepMapU = keepMapU; +exports.partitionU = partitionU; +exports.getAssocU = getAssocU; +exports.hasAssocU = hasAssocU; +exports.removeAssocU = removeAssocU; +exports.setAssocU = setAssocU; /* No side effect */ diff --git a/lib/js/belt_Map.js b/lib/js/belt_Map.js index 5e80a50e73..f62fb52f55 100644 --- a/lib/js/belt_Map.js +++ b/lib/js/belt_Map.js @@ -311,17 +311,11 @@ exports.Dict = Dict; exports.make = make; 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.toArray = toArray; @@ -345,20 +339,26 @@ exports.getExn = getExn; exports.remove = remove; exports.removeMany = removeMany; exports.set = set; -exports.updateU = updateU; exports.update = update; exports.mergeMany = mergeMany; -exports.mergeU = mergeU; exports.merge = merge; -exports.keepU = keepU; exports.keep = keep; -exports.partitionU = partitionU; exports.partition = partition; exports.split = split; -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.mergeU = mergeU; +exports.keepU = keepU; +exports.partitionU = partitionU; +exports.mapU = mapU; +exports.mapWithKeyU = mapWithKeyU; exports.getData = getData; exports.getId = getId; exports.packIdData = packIdData; diff --git a/lib/js/belt_MapDict.js b/lib/js/belt_MapDict.js index 4b244b0f50..5cd080f7f6 100644 --- a/lib/js/belt_MapDict.js +++ b/lib/js/belt_MapDict.js @@ -282,28 +282,16 @@ var isEmpty = Belt_internalAVLtree.isEmpty; var has = Belt_internalAVLtree.has; -var cmpU = Belt_internalAVLtree.cmpU; - var cmp = Belt_internalAVLtree.cmp; -var eqU = Belt_internalAVLtree.eqU; - var eq = Belt_internalAVLtree.eq; -var forEachU = Belt_internalAVLtree.forEachU; - var forEach = Belt_internalAVLtree.forEach; -var reduceU = Belt_internalAVLtree.reduceU; - var reduce = Belt_internalAVLtree.reduce; -var everyU = Belt_internalAVLtree.everyU; - var every = Belt_internalAVLtree.every; -var someU = Belt_internalAVLtree.someU; - var some = Belt_internalAVLtree.some; var size = Belt_internalAVLtree.size; @@ -346,36 +334,42 @@ var getExn = Belt_internalAVLtree.getExn; var checkInvariantInternal = Belt_internalAVLtree.checkInvariantInternal; -var keepU = Belt_internalAVLtree.keepSharedU; - var keep = Belt_internalAVLtree.keepShared; -var partitionU = Belt_internalAVLtree.partitionSharedU; - var partition = Belt_internalAVLtree.partitionShared; -var mapU = Belt_internalAVLtree.mapU; - var map = Belt_internalAVLtree.map; -var mapWithKeyU = Belt_internalAVLtree.mapWithKeyU; - var mapWithKey = Belt_internalAVLtree.mapWithKey; +var cmpU = Belt_internalAVLtree.cmpU; + +var eqU = Belt_internalAVLtree.eqU; + +var forEachU = Belt_internalAVLtree.forEachU; + +var reduceU = Belt_internalAVLtree.reduceU; + +var everyU = Belt_internalAVLtree.everyU; + +var someU = Belt_internalAVLtree.someU; + +var keepU = Belt_internalAVLtree.keepSharedU; + +var partitionU = Belt_internalAVLtree.partitionSharedU; + +var mapU = Belt_internalAVLtree.mapU; + +var mapWithKeyU = Belt_internalAVLtree.mapWithKeyU; + exports.empty = empty; 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; @@ -400,18 +394,24 @@ exports.checkInvariantInternal = checkInvariantInternal; exports.remove = remove; exports.removeMany = removeMany; exports.set = set; -exports.updateU = updateU; exports.update = update; -exports.mergeU = mergeU; exports.merge = merge; exports.mergeMany = mergeMany; -exports.keepU = keepU; exports.keep = keep; -exports.partitionU = partitionU; exports.partition = partition; exports.split = split; -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.mergeU = mergeU; +exports.keepU = keepU; +exports.partitionU = partitionU; +exports.mapU = mapU; +exports.mapWithKeyU = mapWithKeyU; /* No side effect */ diff --git a/lib/js/belt_MapInt.js b/lib/js/belt_MapInt.js index e62c6d40d6..acadb7911c 100644 --- a/lib/js/belt_MapInt.js +++ b/lib/js/belt_MapInt.js @@ -169,28 +169,16 @@ var isEmpty = Belt_internalAVLtree.isEmpty; var has = Belt_internalMapInt.has; -var cmpU = Belt_internalMapInt.cmpU; - var cmp = Belt_internalMapInt.cmp; -var eqU = Belt_internalMapInt.eqU; - var eq = Belt_internalMapInt.eq; -var forEachU = Belt_internalAVLtree.forEachU; - var forEach = Belt_internalAVLtree.forEach; -var reduceU = Belt_internalAVLtree.reduceU; - var reduce = Belt_internalAVLtree.reduce; -var everyU = Belt_internalAVLtree.everyU; - var every = Belt_internalAVLtree.every; -var someU = Belt_internalAVLtree.someU; - var some = Belt_internalAVLtree.some; var size = Belt_internalAVLtree.size; @@ -231,44 +219,50 @@ var getWithDefault = Belt_internalMapInt.getWithDefault; var getExn = Belt_internalMapInt.getExn; -var mergeU = Belt_internalMapInt.mergeU; - var merge = Belt_internalMapInt.merge; -var keepU = Belt_internalAVLtree.keepSharedU; - var keep = Belt_internalAVLtree.keepShared; -var partitionU = Belt_internalAVLtree.partitionSharedU; - var partition = Belt_internalAVLtree.partitionShared; var split = Belt_internalMapInt.split; -var mapU = Belt_internalAVLtree.mapU; - var map = Belt_internalAVLtree.map; -var mapWithKeyU = Belt_internalAVLtree.mapWithKeyU; - var mapWithKey = Belt_internalAVLtree.mapWithKey; +var cmpU = Belt_internalMapInt.cmpU; + +var eqU = Belt_internalMapInt.eqU; + +var forEachU = Belt_internalAVLtree.forEachU; + +var reduceU = Belt_internalAVLtree.reduceU; + +var everyU = Belt_internalAVLtree.everyU; + +var someU = Belt_internalAVLtree.someU; + +var mergeU = Belt_internalMapInt.mergeU; + +var keepU = Belt_internalAVLtree.keepSharedU; + +var partitionU = Belt_internalAVLtree.partitionSharedU; + +var mapU = Belt_internalAVLtree.mapU; + +var mapWithKeyU = Belt_internalAVLtree.mapWithKeyU; + var checkInvariantInternal = Belt_internalAVLtree.checkInvariantInternal; exports.empty = empty; 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; @@ -292,19 +286,25 @@ exports.getExn = getExn; exports.remove = remove; exports.removeMany = removeMany; exports.set = set; -exports.updateU = updateU; exports.update = update; exports.mergeArray = mergeArray; -exports.mergeU = mergeU; exports.merge = merge; -exports.keepU = keepU; exports.keep = keep; -exports.partitionU = partitionU; exports.partition = partition; exports.split = split; -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.mergeU = mergeU; +exports.keepU = keepU; +exports.partitionU = partitionU; +exports.mapU = mapU; +exports.mapWithKeyU = mapWithKeyU; exports.checkInvariantInternal = checkInvariantInternal; /* No side effect */ diff --git a/lib/js/belt_MapString.js b/lib/js/belt_MapString.js index e19cc244fa..e1da54c7cd 100644 --- a/lib/js/belt_MapString.js +++ b/lib/js/belt_MapString.js @@ -169,28 +169,16 @@ var isEmpty = Belt_internalAVLtree.isEmpty; var has = Belt_internalMapString.has; -var cmpU = Belt_internalMapString.cmpU; - var cmp = Belt_internalMapString.cmp; -var eqU = Belt_internalMapString.eqU; - var eq = Belt_internalMapString.eq; -var forEachU = Belt_internalAVLtree.forEachU; - var forEach = Belt_internalAVLtree.forEach; -var reduceU = Belt_internalAVLtree.reduceU; - var reduce = Belt_internalAVLtree.reduce; -var everyU = Belt_internalAVLtree.everyU; - var every = Belt_internalAVLtree.every; -var someU = Belt_internalAVLtree.someU; - var some = Belt_internalAVLtree.some; var size = Belt_internalAVLtree.size; @@ -231,44 +219,50 @@ var getWithDefault = Belt_internalMapString.getWithDefault; var getExn = Belt_internalMapString.getExn; -var mergeU = Belt_internalMapString.mergeU; - var merge = Belt_internalMapString.merge; -var keepU = Belt_internalAVLtree.keepSharedU; - var keep = Belt_internalAVLtree.keepShared; -var partitionU = Belt_internalAVLtree.partitionSharedU; - var partition = Belt_internalAVLtree.partitionShared; var split = Belt_internalMapString.split; -var mapU = Belt_internalAVLtree.mapU; - var map = Belt_internalAVLtree.map; -var mapWithKeyU = Belt_internalAVLtree.mapWithKeyU; - var mapWithKey = Belt_internalAVLtree.mapWithKey; +var cmpU = Belt_internalMapString.cmpU; + +var eqU = Belt_internalMapString.eqU; + +var forEachU = Belt_internalAVLtree.forEachU; + +var reduceU = Belt_internalAVLtree.reduceU; + +var everyU = Belt_internalAVLtree.everyU; + +var someU = Belt_internalAVLtree.someU; + +var mergeU = Belt_internalMapString.mergeU; + +var keepU = Belt_internalAVLtree.keepSharedU; + +var partitionU = Belt_internalAVLtree.partitionSharedU; + +var mapU = Belt_internalAVLtree.mapU; + +var mapWithKeyU = Belt_internalAVLtree.mapWithKeyU; + var checkInvariantInternal = Belt_internalAVLtree.checkInvariantInternal; exports.empty = empty; 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; @@ -292,19 +286,25 @@ exports.getExn = getExn; exports.remove = remove; exports.removeMany = removeMany; exports.set = set; -exports.updateU = updateU; exports.update = update; exports.mergeArray = mergeArray; -exports.mergeU = mergeU; exports.merge = merge; -exports.keepU = keepU; exports.keep = keep; -exports.partitionU = partitionU; exports.partition = partition; exports.split = split; -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.mergeU = mergeU; +exports.keepU = keepU; +exports.partitionU = partitionU; +exports.mapU = mapU; +exports.mapWithKeyU = mapWithKeyU; exports.checkInvariantInternal = checkInvariantInternal; /* No side effect */ diff --git a/lib/js/belt_MutableMap.js b/lib/js/belt_MutableMap.js index 1d253b654b..3ab8321135 100644 --- a/lib/js/belt_MutableMap.js +++ b/lib/js/belt_MutableMap.js @@ -366,17 +366,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; @@ -401,11 +395,17 @@ exports.ofArray = ofArray; exports.remove = remove; exports.removeMany = removeMany; exports.set = set; -exports.updateU = updateU; exports.update = update; exports.mergeMany = mergeMany; -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_MutableQueue.js b/lib/js/belt_MutableQueue.js index 8d0bb90b09..d32340fe77 100644 --- a/lib/js/belt_MutableQueue.js +++ b/lib/js/belt_MutableQueue.js @@ -303,12 +303,12 @@ exports.popUndefined = popUndefined; exports.popExn = popExn; exports.copy = copy; exports.size = size; -exports.mapU = mapU; exports.map = map; -exports.forEachU = forEachU; exports.forEach = forEach; -exports.reduceU = reduceU; exports.reduce = reduce; exports.transfer = transfer; exports.toArray = toArray; +exports.mapU = mapU; +exports.forEachU = forEachU; +exports.reduceU = reduceU; /* No side effect */ diff --git a/lib/js/belt_MutableSet.js b/lib/js/belt_MutableSet.js index 8148a8eb50..38948345e7 100644 --- a/lib/js/belt_MutableSet.js +++ b/lib/js/belt_MutableSet.js @@ -530,17 +530,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; @@ -556,4 +550,10 @@ exports.split = split; exports.checkInvariantInternal = checkInvariantInternal; exports.ofArray = ofArray; exports.ofSortedArrayUnsafe = ofSortedArrayUnsafe; +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_MutableStack.js b/lib/js/belt_MutableStack.js index fcbaf27473..a752bdbd70 100644 --- a/lib/js/belt_MutableStack.js +++ b/lib/js/belt_MutableStack.js @@ -137,8 +137,8 @@ exports.topUndefined = topUndefined; exports.top = top; exports.isEmpty = isEmpty; exports.size = size; -exports.forEachU = forEachU; exports.forEach = forEach; -exports.dynamicPopIterU = dynamicPopIterU; exports.dynamicPopIter = dynamicPopIter; +exports.forEachU = forEachU; +exports.dynamicPopIterU = dynamicPopIterU; /* No side effect */ diff --git a/lib/js/belt_Range.js b/lib/js/belt_Range.js index 6fb5ea2e02..1a3bc3b3a2 100644 --- a/lib/js/belt_Range.js +++ b/lib/js/belt_Range.js @@ -105,14 +105,14 @@ function someBy(s, f, step, p) { return someByU(s, f, step, Curry.__1(p)); } -exports.forEachU = forEachU; exports.forEach = forEach; -exports.everyU = everyU; exports.every = every; -exports.everyByU = everyByU; exports.everyBy = everyBy; -exports.someU = someU; exports.some = some; -exports.someByU = someByU; exports.someBy = someBy; +exports.forEachU = forEachU; +exports.everyU = everyU; +exports.everyByU = everyByU; +exports.someU = someU; +exports.someByU = someByU; /* No side effect */ diff --git a/lib/js/belt_Set.js b/lib/js/belt_Set.js index 15b40d666b..2cb294f060 100644 --- a/lib/js/belt_Set.js +++ b/lib/js/belt_Set.js @@ -286,17 +286,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.toArray = toArray; @@ -313,4 +307,10 @@ exports.checkInvariantInternal = checkInvariantInternal; exports.getData = getData; exports.getId = getId; exports.packIdData = packIdData; +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_SetInt.js b/lib/js/belt_SetInt.js index 6d6eeaaef5..a8a5d69c55 100644 --- a/lib/js/belt_SetInt.js +++ b/lib/js/belt_SetInt.js @@ -271,28 +271,16 @@ var cmp = Belt_internalSetInt.cmp; var eq = Belt_internalSetInt.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; @@ -317,6 +305,18 @@ var getExn = Belt_internalSetInt.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; @@ -334,17 +334,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; @@ -358,4 +352,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_SetString.js b/lib/js/belt_SetString.js index 2357be12c3..282c395fbe 100644 --- a/lib/js/belt_SetString.js +++ b/lib/js/belt_SetString.js @@ -271,28 +271,16 @@ var cmp = Belt_internalSetString.cmp; var eq = Belt_internalSetString.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; @@ -317,6 +305,18 @@ var getExn = Belt_internalSetString.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; @@ -334,17 +334,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; @@ -358,4 +352,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_SortArray.js b/lib/js/belt_SortArray.js index 5669141afa..23ef4b907d 100644 --- a/lib/js/belt_SortArray.js +++ b/lib/js/belt_SortArray.js @@ -448,15 +448,10 @@ var $$String = 0; exports.Int = Int; exports.$$String = $$String; -exports.strictlySortedLengthU = strictlySortedLengthU; exports.strictlySortedLength = strictlySortedLength; -exports.isSortedU = isSortedU; exports.isSorted = isSorted; -exports.stableSortInPlaceByU = stableSortInPlaceByU; exports.stableSortInPlaceBy = stableSortInPlaceBy; -exports.stableSortByU = stableSortByU; exports.stableSortBy = stableSortBy; -exports.binarySearchByU = binarySearchByU; exports.binarySearchBy = binarySearchBy; exports.unionU = unionU; exports.union = union; @@ -464,4 +459,9 @@ exports.intersectU = intersectU; exports.intersect = intersect; exports.diffU = diffU; exports.diff = diff; +exports.strictlySortedLengthU = strictlySortedLengthU; +exports.isSortedU = isSortedU; +exports.stableSortInPlaceByU = stableSortInPlaceByU; +exports.stableSortByU = stableSortByU; +exports.binarySearchByU = binarySearchByU; /* No side effect */