Skip to content

Commit 3cb3b5d

Browse files
authored
Merge pull request #32 from baransu/set-docs
Add Set, Set.Int, Set.String, Set.Dict docs
2 parents 50d3937 + 2fbaf2f commit 3cb3b5d

File tree

7 files changed

+1424
-170
lines changed

7 files changed

+1424
-170
lines changed

common/Util.bs.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11

22

3+
import * as Belt_Id from "bs-platform/lib/es6/belt_Id.js";
4+
import * as Caml_obj from "bs-platform/lib/es6/caml_obj.js";
5+
import * as Belt_SetDict from "bs-platform/lib/es6/belt_SetDict.js";
36

47
function s(prim) {
58
return prim;
@@ -17,8 +20,25 @@ var ReactStuff = {
1720
Unsafe: Unsafe
1821
};
1922

23+
var cmp = Caml_obj.caml_compare;
24+
25+
var IntCmp = Belt_Id.MakeComparable({
26+
cmp: cmp
27+
});
28+
29+
var b = Belt_SetDict.fromArray(/* array */[
30+
1,
31+
2,
32+
3
33+
], IntCmp.cmp);
34+
35+
var a = Belt_SetDict.empty;
36+
2037
export {
2138
ReactStuff ,
39+
IntCmp ,
40+
a ,
41+
b ,
2242

2343
}
24-
/* No side effect */
44+
/* IntCmp Not a pure module */

common/Util.re

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,12 @@ module ReactStuff = {
66
external elementAsString: React.element => string = "%identity";
77
};
88
};
9+
10+
module IntCmp =
11+
Belt.Id.MakeComparable({
12+
type t = int;
13+
let cmp = Pervasives.compare;
14+
});
15+
16+
let a = Belt.Set.Dict.empty;
17+
let b = Belt.Set.Dict.fromArray([|1, 2, 3|], ~cmp=IntCmp.cmp);

components/CodeExample.bs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ export {
2323
make ,
2424

2525
}
26-
/* react Not a pure module */
26+
/* Util Not a pure module */

0 commit comments

Comments
 (0)