Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

Commit ede3ae1

Browse files
committed
Format sources
1 parent 4968d95 commit ede3ae1

22 files changed

+471
-484
lines changed

js/src/js_array.res

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ let code = s => Js.String.charCodeAt(0, s)
9999
Js.Array.fromMap(strArr, code) == [97.0, 98.0, 99.0, 100.0]
100100
```
101101
*/
102-
external fromMap: (array_like<'a>, ('a => 'b)) => array<'b> = "Array.from"
102+
external fromMap: (array_like<'a>, 'a => 'b) => array<'b> = "Array.from"
103103

104104
/* ES2015 */
105105

@@ -689,7 +689,7 @@ Js.Array.every(isEven, [6, 22, 8, 4]) == true
689689
Js.Array.every(isEven, [6, 22, 7, 4]) == false
690690
```
691691
*/
692-
external every: (('a => bool)) => bool = "every"
692+
external every: ('a => bool) => bool = "every"
693693

694694
@send.pipe(: t<'a> as 'this)
695695
/**
@@ -718,7 +718,7 @@ let nonEmpty = s => s != ""
718718
Js.Array.filter(nonEmpty, ["abc", "", "", "def", "ghi"]) == ["abc", "def", "ghi"]
719719
```
720720
*/
721-
external filter: (('a => bool)) => 'this = "filter"
721+
external filter: ('a => bool) => 'this = "filter"
722722

723723
@send.pipe(: t<'a> as 'this)
724724
/**
@@ -756,7 +756,7 @@ Js.Array.find(x => x < 0, [33, 22, -55, 77, -44]) == Some(-55)
756756
Js.Array.find(x => x < 0, [33, 22, 55, 77, 44]) == None
757757
```
758758
*/
759-
external find: (('a => bool)) => option<'a> = "find"
759+
external find: ('a => bool) => option<'a> = "find"
760760

761761
@send.pipe(: t<'a> as 'this)
762762
@return(nullable)
@@ -786,7 +786,7 @@ Js.Array.findIndex(x => x < 0, [33, 22, -55, 77, -44]) == 2
786786
Js.Array.findIndex(x => x < 0, [33, 22, 55, 77, 44]) == -1
787787
```
788788
*/
789-
external findIndex: (('a => bool)) => int = "findIndex"
789+
external findIndex: ('a => bool) => int = "findIndex"
790790

791791
@send.pipe(: t<'a> as 'this)
792792
/**
@@ -815,7 +815,7 @@ The `forEach()` function applies the function given as the first argument to eac
815815
Js.Array.forEach(x => Js.log(x), ["a", "b", "c"]) == ()
816816
```
817817
*/
818-
external forEach: (('a => unit)) => unit = "forEach"
818+
external forEach: ('a => unit) => unit = "forEach"
819819

820820
@send.pipe(: t<'a> as 'this)
821821
/**
@@ -849,7 +849,7 @@ Js.Array.map(x => x * x, [12, 4, 8]) == [144, 16, 64]
849849
Js.Array.map(Js.String.length, ["animal", "vegetable", "mineral"]) == [6, 9, 7]
850850
```
851851
*/
852-
external map: (('a => 'b)) => t<'b> = "map"
852+
external map: ('a => 'b) => t<'b> = "map"
853853

854854
@send.pipe(: t<'a> as 'this)
855855
/**
@@ -1020,7 +1020,7 @@ Js.Array.some(isEven, [3, 7, 5, 2, 9]) == true
10201020
Js.Array.some(isEven, [3, 7, 5, 1, 9]) == false
10211021
```
10221022
*/
1023-
external some: (('a => bool)) => bool = "some"
1023+
external some: ('a => bool) => bool = "some"
10241024

10251025
@send.pipe(: t<'a> as 'this)
10261026
/**

js/src/js_array2.res

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ let code = s => Js.String.charCodeAt(0, s)
9797
Js.Array2.fromMap(strArr, code) == [97.0, 98.0, 99.0, 100.0]
9898
```
9999
*/
100-
external fromMap: (array_like<'a>, @uncurry ('a => 'b)) => array<'b> = "Array.from"
100+
external fromMap: (array_like<'a>, @uncurry 'a => 'b) => array<'b> = "Array.from"
101101

102102
/* ES2015 */
103103

@@ -740,7 +740,7 @@ Js.Array2.every([6, 22, 8, 4], isEven) == true
740740
Js.Array2.every([6, 22, 7, 4], isEven) == false
741741
```
742742
*/
743-
external every: (t<'a>, @uncurry ('a => bool)) => bool = "every"
743+
external every: (t<'a>, @uncurry 'a => bool) => bool = "every"
744744

745745
@send
746746
/**
@@ -779,7 +779,7 @@ let nonEmpty = s => s != ""
779779
Js.Array2.filter(["abc", "", "", "def", "ghi"], nonEmpty) == ["abc", "def", "ghi"]
780780
```
781781
*/
782-
external filter: (t<'a>, @uncurry ('a => bool)) => t<'a> = "filter"
782+
external filter: (t<'a>, @uncurry 'a => bool) => t<'a> = "filter"
783783

784784
@send
785785
/**
@@ -818,7 +818,7 @@ Js.Array2.find([33, 22, -55, 77, -44], x => x < 0) == Some(-55)
818818
Js.Array2.find([33, 22, 55, 77, 44], x => x < 0) == None
819819
```
820820
*/
821-
external find: (t<'a>, @uncurry ('a => bool)) => option<'a> = "find"
821+
external find: (t<'a>, @uncurry 'a => bool) => option<'a> = "find"
822822

823823
/* ES2015 */
824824

@@ -859,7 +859,7 @@ Js.Array2.findIndex([33, 22, -55, 77, -44], x => x < 0) == 2
859859
Js.Array2.findIndex([33, 22, 55, 77, 44], x => x < 0) == -1
860860
```
861861
*/
862-
external findIndex: (t<'a>, @uncurry ('a => bool)) => int = "findIndex"
862+
external findIndex: (t<'a>, @uncurry 'a => bool) => int = "findIndex"
863863

864864
/* ES2015 */
865865

@@ -902,7 +902,7 @@ on MDN.
902902
Js.Array2.forEach(["a", "b", "c"], x => Js.log(x)) == ()
903903
```
904904
*/
905-
external forEach: (t<'a>, @uncurry ('a => unit)) => unit = "forEach"
905+
external forEach: (t<'a>, @uncurry 'a => unit) => unit = "forEach"
906906

907907
@send
908908
/**
@@ -943,7 +943,7 @@ Js.Array2.map([12, 4, 8], x => x * x) == [144, 16, 64]
943943
Js.Array2.map(["animal", "vegetable", "mineral"], Js.String.length) == [6, 9, 7]
944944
```
945945
*/
946-
external map: (t<'a>, @uncurry ('a => 'b)) => t<'b> = "map"
946+
external map: (t<'a>, @uncurry 'a => 'b) => t<'b> = "map"
947947

948948
@send
949949
/**
@@ -1116,7 +1116,7 @@ Js.Array2.some([3, 7, 5, 2, 9], isEven) == true
11161116
Js.Array2.some([3, 7, 5, 1, 9], isEven) == false
11171117
```
11181118
*/
1119-
external some: (t<'a>, @uncurry ('a => bool)) => bool = "some"
1119+
external some: (t<'a>, @uncurry 'a => bool) => bool = "some"
11201120

11211121
@send
11221122
/**

js/src/js_dict.res

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ external keys: t<'a> => array<key> = "Object.keys"
6060
@obj
6161
external empty: unit => t<'a> = ""
6262

63-
let unsafeDeleteKey: (. t<string>, string) => unit = %raw(` function (dict,key){
63+
let unsafeDeleteKey: (t<string>, string) => unit = %raw(` function (dict,key){
6464
delete dict[key];
6565
}
6666
`)
@@ -118,7 +118,7 @@ let map = (f, source) => {
118118
let l = Js_array2.length(keys)
119119
for i in 0 to l - 1 {
120120
let key = Js_array2.unsafe_get(keys, i)
121-
set(target, key, f(. unsafeGet(source, key)))
121+
set(target, key, f(unsafeGet(source, key)))
122122
}
123123
target
124124
}

js/src/js_dict.resi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ external keys: t<'a> => array<string> = "Object.keys"
107107
external empty: unit => t<'a> = ""
108108

109109
/** Experimental internal function */
110-
let unsafeDeleteKey: (. t<string>, string) => unit
110+
let unsafeDeleteKey: (t<string>, string) => unit
111111

112112
/**
113113
Returns an array of key/value pairs in the given dictionary (ES2017).
@@ -170,4 +170,4 @@ let salePrices = Js.Dict.map(discount, prices)
170170
salePrices == Js.Dict.fromList(list{("pen", 0.90), ("book", 4.50), ("stapler", 6.30)})
171171
```
172172
*/
173-
let map: ((. 'a) => 'b, t<'a>) => t<'b>
173+
let map: ('a => 'b, t<'a>) => t<'b>

js/src/js_list.res

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ let rev = l => revAppend(l, list{})
7878
let rec mapRevAux = (f, acc, ls) =>
7979
switch ls {
8080
| list{} => acc
81-
| list{a, ...l} => mapRevAux(f, list{f(. a), ...acc}, l)
81+
| list{a, ...l} => mapRevAux(f, list{f(a), ...acc}, l)
8282
}
8383

8484
let mapRev = (f, ls) => mapRevAux(f, list{}, ls)
@@ -89,15 +89,15 @@ let rec iter = (f, x) =>
8989
switch x {
9090
| list{} => ()
9191
| list{a, ...l} =>
92-
f(. a)
92+
f(a)
9393
iter(f, l)
9494
}
9595

9696
let rec iteri = (i, f, x) =>
9797
switch x {
9898
| list{} => ()
9999
| list{a, ...l} =>
100-
f(. i, a)
100+
f(i, a)
101101
iteri(i + 1, f, l)
102102
}
103103

@@ -106,15 +106,15 @@ let iteri = (f, l) => iteri(0, f, l)
106106
let rec foldLeft = (f, accu, l) =>
107107
switch l {
108108
| list{} => accu
109-
| list{a, ...l} => foldLeft(f, f(. accu, a), l)
109+
| list{a, ...l} => foldLeft(f, f(accu, a), l)
110110
}
111111

112112
let foldRightMaxStack = 1000
113113

114114
let rec tailLoop = (f, acc, x) =>
115115
switch x {
116116
| list{} => acc
117-
| list{h, ...t} => tailLoop(f, f(. h, acc), t)
117+
| list{h, ...t} => tailLoop(f, f(h, acc), t)
118118
}
119119

120120
let foldRight = (f, l, init) => {
@@ -123,9 +123,9 @@ let foldRight = (f, l, init) => {
123123
| list{} => init
124124
| list{h, ...t} =>
125125
if n < foldRightMaxStack {
126-
f(. h, loop(n + 1, t))
126+
f(h, loop(n + 1, t))
127127
} else {
128-
f(. h, tailLoop(f, init, rev(t)))
128+
f(h, tailLoop(f, init, rev(t)))
129129
}
130130
}
131131

@@ -144,19 +144,19 @@ let rec filterRevAux = (f, acc, xs) =>
144144
switch xs {
145145
| list{} => acc
146146
| list{y, ...ys} =>
147-
switch f(. y) {
147+
switch f(y) {
148148
| false => filterRevAux(f, acc, ys)
149149
| true => filterRevAux(f, list{y, ...acc}, ys)
150150
}
151151
}
152152

153153
let filter = (f, xs) => rev(filterRevAux(f, list{}, xs))
154154

155-
let rec filterMapRevAux = (f: (. 'a) => option<'b>, acc, xs) =>
155+
let rec filterMapRevAux = (f: 'a => option<'b>, acc, xs) =>
156156
switch xs {
157157
| list{} => acc
158158
| list{y, ...ys} =>
159-
switch f(. y) {
159+
switch f(y) {
160160
| None => filterMapRevAux(f, acc, ys)
161161
| Some(z) => filterMapRevAux(f, list{z, ...acc}, ys)
162162
}
@@ -170,7 +170,7 @@ let rec countByAux = (f, acc, xs) =>
170170
| list{y, ...ys} =>
171171
countByAux(
172172
f,
173-
if f(. y) {
173+
if f(y) {
174174
acc + 1
175175
} else {
176176
acc
@@ -204,7 +204,7 @@ let rec equal = (cmp, xs, ys) =>
204204
switch (xs, ys) {
205205
| (list{}, list{}) => true
206206
| (list{x, ...xs}, list{y, ...ys}) =>
207-
if cmp(. x, y) {
207+
if cmp(x, y) {
208208
equal(cmp, xs, ys)
209209
} else {
210210
false

js/src/js_list.resi

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,30 +42,30 @@ let revAppend: (t<'a>, t<'a>) => t<'a>
4242

4343
let rev: t<'a> => t<'a>
4444

45-
let mapRev: ((. 'a) => 'b, t<'a>) => t<'b>
45+
let mapRev: ('a => 'b, t<'a>) => t<'b>
4646

47-
let map: ((. 'a) => 'b, t<'a>) => t<'b>
47+
let map: ('a => 'b, t<'a>) => t<'b>
4848

49-
let iter: ((. 'a) => unit, t<'a>) => unit
49+
let iter: ('a => unit, t<'a>) => unit
5050

51-
let iteri: ((. int, 'a) => unit, t<'a>) => unit
51+
let iteri: ((int, 'a) => unit, t<'a>) => unit
5252

5353
/** Application order is left to right, tail recurisve */
54-
let foldLeft: ((. 'a, 'b) => 'a, 'a, list<'b>) => 'a
54+
let foldLeft: (('a, 'b) => 'a, 'a, list<'b>) => 'a
5555

5656
/** Application order is right to left tail-recursive. */
57-
let foldRight: ((. 'a, 'b) => 'b, list<'a>, 'b) => 'b
57+
let foldRight: (('a, 'b) => 'b, list<'a>, 'b) => 'b
5858

5959
let flatten: t<t<'a>> => t<'a>
6060

61-
let filter: ((. 'a) => bool, t<'a>) => t<'a>
61+
let filter: ('a => bool, t<'a>) => t<'a>
6262

63-
let filterMap: ((. 'a) => option<'b>, t<'a>) => t<'b>
63+
let filterMap: ('a => option<'b>, t<'a>) => t<'b>
6464

65-
let countBy: ((. 'a) => bool, list<'a>) => int
65+
let countBy: ('a => bool, list<'a>) => int
6666

67-
let init: (int, (. int) => 'a) => t<'a>
67+
let init: (int, int => 'a) => t<'a>
6868

6969
let toVector: t<'a> => array<'a>
7070

71-
let equal: ((. 'a, 'a) => bool, list<'a>, list<'a>) => bool
71+
let equal: (('a, 'a) => bool, list<'a>, list<'a>) => bool

js/src/js_log.res

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/** Equivalent to console.log any value */
2-
@val @scope("console")
2+
@val
3+
@scope("console")
34
external log: 'a => unit = "log"
45

56
@val @scope("console")
@@ -12,5 +13,7 @@ external log3: 'a => 'b => 'c => unit = "log"
1213
external log4: 'a => 'b => 'c => 'd => unit = "log"
1314

1415
/** A convenience function to console.log more than 4 arguments */
15-
@val @scope("console") @variadic
16+
@val
17+
@scope("console")
18+
@variadic
1619
external logMany: array<'a> => unit = "log"

js/src/js_null_undefined.res

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ external undefined: t<'a> = "#undefined"
4040
let bind = (x, f) =>
4141
switch to_opt(x) {
4242
| None => (Obj.magic((x: t<'a>)): t<'b>)
43-
| Some(x) => return(f(. x))
43+
| Some(x) => return(f(x))
4444
}
4545

4646
let iter = (x, f) =>
4747
switch to_opt(x) {
4848
| None => ()
49-
| Some(x) => f(. x)
49+
| Some(x) => f(x)
5050
}
5151

5252
let fromOption = x =>

js/src/js_null_undefined.resi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ let maybeGreetWorld = (maybeGreeting: Js.null_undefined<string>) =>
5959
Js.Null_undefined.bind(maybeGreeting, (. greeting) => greeting ++ " world!")
6060
```
6161
*/
62-
let bind: (t<'a>, (. 'a) => 'b) => t<'b>
62+
let bind: (t<'a>, 'a => 'b) => t<'b>
6363

6464
/**
6565
Iterates over the contained value with the given function.
@@ -72,7 +72,7 @@ let maybeSay = (maybeMessage: Js.null_undefined<string>) =>
7272
Js.Null_undefined.iter(maybeMessage, (. message) => Js.log(message))
7373
```
7474
*/
75-
let iter: (t<'a>, (. 'a) => unit) => unit
75+
let iter: (t<'a>, 'a => unit) => unit
7676

7777
/**
7878
Maps `option<'a>` to `Js.null_undefined<'a>`.

0 commit comments

Comments
 (0)