Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions jscomp/others/belt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@
{[
type t = int * int
module I0 =
(val Belt.Id.comparableU ~cmp:(fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) ->
(val Belt.Id.comparableU (fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) ->
match compare a0 b0 with
| 0 -> compare a1 b1
| c -> c
))
let s0 = Belt.Set.make ~id:(module I0)
module I1 =
(val Belt.Id.comparableU ~cmp:(fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) ->
(val Belt.Id.comparableU (fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) ->
match compare a1 b1 with
| 0 -> compare a0 b0
| c -> c
Expand Down
30 changes: 15 additions & 15 deletions jscomp/others/belt_Map.mli
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
{[
type t = int * int
module I0 =
(val Belt.Id.comparableU ~cmp:(fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) ->
(val Belt.Id.comparableU (fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) ->
match Pervasives.compare a0 b0 with
| 0 -> Pervasives.compare a1 b1
| c -> c
))
let s0 : (_, string, _) t = make ~id:(module I0) (* value is of type string *)
module I1 =
(val Belt.Id.comparableU ~cmp:(fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) ->
(val Belt.Id.comparableU (fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) ->
match compare a1 b1 with
| 0 -> compare a0 b0
| c -> c
Expand Down Expand Up @@ -122,7 +122,7 @@ val make: id:('k, 'id) id -> ('k, 'a, 'id) t
(** [make ~id]

@example {[
module IntCmp = (val Belt.Id.comparable ~cmp:(fun (x:int) y -> Pervasives.compare x y));;
module IntCmp = (val Belt.Id.comparable (fun (x:int) y -> Pervasives.compare x y));;
let s = make ~id:(module IntCmp)
]}

Expand All @@ -132,7 +132,7 @@ val make: id:('k, 'id) id -> ('k, 'a, 'id) t
val isEmpty: _ t -> bool
(** [isEmpty s0]
@example {[
module IntCmp = (val Belt.Id.comparable ~cmp:(fun (x:int) y -> Pervasives.compare x y));;
module IntCmp = (val Belt.Id.comparable (fun (x:int) y -> Pervasives.compare x y));;
isEmpty (ofArray [|1,"1"|] ~id:(module IntCmp)) = false;;
]}
*)
Expand All @@ -141,7 +141,7 @@ val has: ('k, 'a, 'id) t -> 'k -> bool
(** [has s k]

@example {[
module IntCmp = (val Belt.Id.comparable ~cmp:(fun (x:int) y -> Pervasives.compare x y));;
module IntCmp = (val Belt.Id.comparable (fun (x:int) y -> Pervasives.compare x y));;
has (ofArray [|1,"1"|] ~id:(module IntCmp)) 1 = true;;
]}
*)
Expand Down Expand Up @@ -187,7 +187,7 @@ val forEach: ('k, 'a, 'id) t -> ('k -> 'a -> unit) -> unit

@example {[
module IntCmp =
(val Belt.Id.comparableU ~cmp:(fun[\@bs] (x:int) y -> Pervasives.compare x y));;
(val Belt.Id.comparableU (fun[\@bs] (x:int) y -> Pervasives.compare x y));;

let s0 = ofArray ~id:(module IntCmp) [|4,"4";1,"1";2,"2,"3""|];;
let acc = ref [] ;;
Expand All @@ -205,7 +205,7 @@ val reduce: ('k, 'a, 'id) t -> 'acc -> ('acc -> 'k -> 'a -> 'acc) -> 'acc

@example {[
module IntCmp =
(val Belt.Id.comparableU ~cmp:(fun[\@bs] (x:int) y -> Pervasives.compare x y));;
(val Belt.Id.comparableU (fun[\@bs] (x:int) y -> Pervasives.compare x y));;

let s0 = ofArray ~id:(module IntCmp) [|4,"4";1,"1";2,"2,"3""|];;
reduce s0 [] (fun acc k v -> (k,v) acc ) = [4,"4";3,"3";2,"2";1,"1"];;
Expand All @@ -227,7 +227,7 @@ val size: ('k, 'a, 'id) t -> int

@example {[
module IntCmp =
(val Belt.Id.comparableU ~cmp:(fun[\@bs] (x:int) y -> Pervasives.compare x y));;
(val Belt.Id.comparableU (fun[\@bs] (x:int) y -> Pervasives.compare x y));;
size (ofArray [2,"2"; 2,"1"; 3,"3"] ~id:(module IntCmp)) = 2 ;;
]}
*)
Expand All @@ -236,7 +236,7 @@ val toArray: ('k, 'a, 'id) t -> ('k * 'a) array

@example {[
module IntCmp =
(val Belt.Id.comparableU ~cmp:(fun[\@bs] (x:int) y -> Pervasives.compare x y));;
(val Belt.Id.comparableU (fun[\@bs] (x:int) y -> Pervasives.compare x y));;
toArray (ofArray [2,"2"; 1,"1"; 3,"3"] ~id:(module IntCmp)) = [1,"1";2,"2";3,"3"]
]}

Expand All @@ -251,7 +251,7 @@ val ofArray: ('k * 'a) array -> id:('k,'id) id -> ('k,'a,'id) t
(** [ofArray kvs ~id]
@example {[
module IntCmp =
(val Belt.Id.comparableU ~cmp:(fun[\@bs] (x:int) y -> Pervasives.compare x y));;
(val Belt.Id.comparableU (fun[\@bs] (x:int) y -> Pervasives.compare x y));;
toArray (ofArray [2,"2"; 1,"1"; 3,"3"] ~id:(module IntCmp)) = [1,"1";2,"2";3,"3"]
]}
*)
Expand All @@ -260,7 +260,7 @@ val keysToArray: ('k, 'a, 'id) t -> 'k array

@example {[
module IntCmp =
(val Belt.Id.comparableU ~cmp:(fun[\@bs] (x:int) y -> Pervasives.compare x y));;
(val Belt.Id.comparableU (fun[\@bs] (x:int) y -> Pervasives.compare x y));;
keysToArray (ofArray [2,"2"; 1,"1"; 3,"3"] ~id:(module IntCmp)) =
[|1;2;3|];;
]}
Expand All @@ -270,7 +270,7 @@ val valuesToArray: ('k, 'a, 'id) t -> 'a array

@example {[
module IntCmp =
(val Belt.Id.comparableU ~cmp:(fun[\@bs] (x:int) y -> Pervasives.compare x y));;
(val Belt.Id.comparableU (fun[\@bs] (x:int) y -> Pervasives.compare x y));;
valuesToArray (ofArray [2,"2"; 1,"1"; 3,"3"] ~id:(module IntCmp)) =
[|"1";"2";"3"|];;
]}
Expand Down Expand Up @@ -315,7 +315,7 @@ val get: ('k, 'a, 'id) t -> 'k -> 'a option

@example {[
module IntCmp =
(val Belt.Id.comparableU ~cmp:(fun[\@bs] (x:int) y -> Pervasives.compare x y));;
(val Belt.Id.comparableU (fun[\@bs] (x:int) y -> Pervasives.compare x y));;
get (ofArray [2,"2"; 1,"1"; 3,"3"] ~id:(module IntCmp)) 2 =
Some "2";;
get (ofArray [2,"2"; 1,"1"; 3,"3"] ~id:(module IntCmp)) 2 =
Expand Down Expand Up @@ -352,7 +352,7 @@ val remove: ('k, 'a, 'id) t -> 'k -> ('k, 'a, 'id) t

@example {[
module IntCmp =
(val Belt.Id.comparableU ~cmp:(fun[\@bs] (x:int) y -> Pervasives.compare x y));;
(val Belt.Id.comparableU (fun[\@bs] (x:int) y -> Pervasives.compare x y));;

let s0 = (ofArray [2,"2"; 1,"1"; 3,"3"] ~id:(module IntCmp));;

Expand Down Expand Up @@ -380,7 +380,7 @@ val set:

@example {[
module IntCmp =
(val Belt.Id.comparableU ~cmp:(fun[\@bs] (x:int) y -> Pervasives.compare x y));;
(val Belt.Id.comparableU (fun[\@bs] (x:int) y -> Pervasives.compare x y));;

let s0 = (ofArray [2,"2"; 1,"1"; 3,"3"] ~id:(module IntCmp));;

Expand Down
4 changes: 2 additions & 2 deletions jscomp/others/belt_MutableMap.mli
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@
{[
type t = int * int
module I0 =
(val Belt.Id.comparableU ~cmp:(fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) ->
(val Belt.Id.comparableU (fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) ->
match Pervasives.compare a0 b0 with
| 0 -> Pervasives.compare a1 b1
| c -> c
))
let s0 : (_, string,_) t = make ~id:(module I0)
module I1 =
(val Belt.Id.comparableU ~cmp:(fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) ->
(val Belt.Id.comparableU (fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) ->
match compare a1 b1 with
| 0 -> compare a0 b0
| c -> c
Expand Down
4 changes: 2 additions & 2 deletions jscomp/others/belt_MutableSet.mli
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@
{[
type t = int * int
module I0 =
(val Belt.Id.comparableU ~cmp:(fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) ->
(val Belt.Id.comparableU (fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) ->
match Pervasives.compare a0 b0 with
| 0 -> Pervasives.compare a1 b1
| c -> c
))
let s0 = make ~id:(module I0)
module I1 =
(val Belt.Id.comparableU ~cmp:(fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) ->
(val Belt.Id.comparableU (fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) ->
match compare a1 b1 with
| 0 -> compare a0 b0
| c -> c
Expand Down
32 changes: 16 additions & 16 deletions jscomp/others/belt_Set.mli
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
{[
type t = int * int
module I0 =
(val Belt.Id.comparableU ~cmp:(fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) ->
(val Belt.Id.comparableU (fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) ->
match Pervasives.compare a0 b0 with
| 0 -> Pervasives.compare a1 b1
| c -> c
))
let s0 = make ~id:(module I0)
module I1 =
(val Belt.Id.comparableU ~cmp:(fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) ->
(val Belt.Id.comparableU (fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) ->
match compare a1 b1 with
| 0 -> compare a0 b0
| c -> c
Expand Down Expand Up @@ -108,7 +108,7 @@ val make: id:('value, 'id) id -> ('value, 'id) t
(** [make ~id]

@example {[
module IntCmp = (val Belt.Id.comparable ~cmp:(fun (x:int) y -> Pervasives.compare x y))
module IntCmp = (val Belt.Id.comparable (fun (x:int) y -> Pervasives.compare x y))
let s = make ~id:(module IntCmp)
]}

Expand All @@ -120,7 +120,7 @@ val ofArray: 'k array -> id:('k, 'id) id -> ('k, 'id) t

@example{[
module IntCmp = (val Belt.Id.comparableU
~cmp:(fun[\@bs]
(fun[\@bs]
(x:int) y -> Pervasives.compare x y));;
toArray (ofArray [1;3;2;4] (module IntCmp)) = [1;2;3;4]

Expand All @@ -142,7 +142,7 @@ val isEmpty: _ t -> bool
@example {[
module IntCmp =
(val Belt.Id.comparableU
~cmp:(fun[\@bs]
(fun[\@bs]
(x:int) y -> Pervasives.compare x y));;
isEmpty (ofArray [||] ~id:(module IntCmp)) = true;;
isEmpty (ofArray [|1|] ~id:(module IntCmp)) = true;;
Expand All @@ -153,7 +153,7 @@ val has: ('value, 'id) t -> 'value -> bool
@example {[
module IntCmp =
(val Belt.Id.comparableU
~cmp:(fun[\@bs]
(fun[\@bs]
(x:int) y -> Pervasives.compare x y));;
let v = ofArray [|1;4;2;5|] ~id:(module IntCmp);;
has v 3 = false;;
Expand All @@ -168,7 +168,7 @@ val add:
@example {[
module IntCmp =
(val Belt.Id.comparableU
~cmp:(fun[\@bs]
(fun[\@bs]
(x:int) y -> Pervasives.compare x y));;
let s0 = make ~id:(module IntCmp);;
let s1 = add s0 1 ;;
Expand Down Expand Up @@ -196,7 +196,7 @@ val remove: ('value, 'id) t -> 'value -> ('value, 'id) t
@example {[
module IntCmp =
(val Belt.Id.comparableU
~cmp:(fun[\@bs]
(fun[\@bs]
(x:int) y -> Pervasives.compare x y));;
let s0 = ofArray ~id:(module IntCmp) [|2;3;1;4;5|];;
let s1 = remove s0 1 ;;
Expand Down Expand Up @@ -225,7 +225,7 @@ val union: ('value, 'id) t -> ('value, 'id) t -> ('value, 'id) t
@example {[
module IntCmp =
(val Belt.Id.comparableU
~cmp:(fun[\@bs]
(fun[\@bs]
(x:int) y -> Pervasives.compare x y));;
let s0 = ofArray ~id:(module IntCmp) [|5;2;3;5;6|]];;
let s1 = ofArray ~id:(module IntCmp) [|5;2;3;1;5;4;|];;
Expand All @@ -238,7 +238,7 @@ val intersect: ('value, 'id) t -> ('value, 'id) t -> ('value, 'id) t
@example {[
module IntCmp =
(val Belt.Id.comparableU
~cmp:(fun[\@bs]
(fun[\@bs]
(x:int) y -> Pervasives.compare x y));;
let s0 = ofArray ~id:(module IntCmp) [|5;2;3;5;6|]];;
let s1 = ofArray ~id:(module IntCmp) [|5;2;3;1;5;4;|];;
Expand All @@ -251,7 +251,7 @@ val diff: ('value, 'id) t -> ('value, 'id) t -> ('value, 'id) t
@example {[
module IntCmp =
(val Belt.Id.comparableU
~cmp:(fun[\@bs]
(fun[\@bs]
(x:int) y -> Pervasives.compare x y));;
let s0 = ofArray ~id:(module IntCmp) [|5;2;3;5;6|]];;
let s1 = ofArray ~id:(module IntCmp) [|5;2;3;1;5;4;|];;
Expand All @@ -266,7 +266,7 @@ val subset: ('value, 'id) t -> ('value, 'id) t -> bool
@example {[
module IntCmp =
(val Belt.Id.comparableU
~cmp:(fun[\@bs]
(fun[\@bs]
(x:int) y -> Pervasives.compare x y));;
let s0 = ofArray ~id:(module IntCmp) [|5;2;3;5;6|]];;
let s1 = ofArray ~id:(module IntCmp) [|5;2;3;1;5;4;|];;
Expand Down Expand Up @@ -298,7 +298,7 @@ val forEach: ('value, 'id) t -> ('value -> unit ) -> unit
@example {[
module IntCmp =
(val Belt.Id.comparableU
~cmp:(fun[\@bs]
(fun[\@bs]
(x:int) y -> Pervasives.compare x y));;
let s0 = ofArray ~id:(module IntCmp) [|5;2;3;5;6|]];;
let acc = ref [] ;;
Expand All @@ -314,7 +314,7 @@ val reduce: ('value, 'id) t -> 'a -> ('a -> 'value -> 'a ) -> 'a
@example {[
module IntCmp =
(val Belt.Id.comparableU
~cmp:(fun[\@bs]
(fun[\@bs]
(x:int) y -> Pervasives.compare x y));;
let s0 = ofArray ~id:(module IntCmp) [|5;2;3;5;6|]];;
reduce s0 [] Bs.List.add = [6;5;3;2];;
Expand Down Expand Up @@ -350,7 +350,7 @@ val size: ('value, 'id) t -> int
@example {[
module IntCmp =
(val Belt.Id.comparableU
~cmp:(fun[\@bs]
(fun[\@bs]
(x:int) y -> Pervasives.compare x y));;
let s0 = ofArray ~id:(module IntCmp) [|5;2;3;5;6|]];;
size s0 = 4;;
Expand All @@ -362,7 +362,7 @@ val toArray: ('value, 'id) t -> 'value array
@example {[
module IntCmp =
(val Belt.Id.comparableU
~cmp:(fun[\@bs]
(fun[\@bs]
(x:int) y -> Pervasives.compare x y));;
let s0 = ofArray ~id:(module IntCmp) [|5;2;3;5;6|]];;
toArray s0 = [|2;3;5;6|];;
Expand Down
2 changes: 1 addition & 1 deletion jscomp/test/bs_hashtbl_string_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ let bench3 (type t) (m : (string,t) Belt.Id.comparable) =
done ;
assert (Md0.size !table = 0)

module Sx = (val Belt.Id.comparable ~cmp:(fun (x : string) y -> compare x y ))
module Sx = (val Belt.Id.comparable (fun (x : string) y -> compare x y ))
module H = Belt.HashMap.String
let bench4 () =
let table =
Expand Down
4 changes: 2 additions & 2 deletions jscomp/test/bs_map_set_dict_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module Icmp =
)
)
module Icmp2 =
(val Belt.Id.comparable ~cmp:(fun (x : int) y ->
(val Belt.Id.comparable (fun (x : int) y ->
compare x y ))

module M = Belt.Map
Expand All @@ -23,7 +23,7 @@ let m0 : (_,string,_) M.t = M.make (module Icmp)


module I2 =
(val Belt.Id.comparable ~cmp:(fun (x : int) y -> compare y x ))
(val Belt.Id.comparable (fun (x : int) y -> compare y x ))


let m = M.make (module Icmp2)
Expand Down