Skip to content

Commit 0e3c041

Browse files
committed
First uncurryfication.
1 parent 77b53d8 commit 0e3c041

39 files changed

+125
-57
lines changed

src/ReScriptStdLib.res

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@@uncurried
12
module Array = Stdlib__Array
23
module Console = Stdlib__Console
34
module DataView = Stdlib__DataView

src/Stdlib__Array.bs.js

Lines changed: 16 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Stdlib__Array.res

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@@uncurried
12
external getUnsafe: (array<'a>, int) => 'a = "%array_unsafe_get"
23
external setUnsafe: (array<'a>, int, 'a) => unit = "%array_unsafe_set"
34

@@ -99,7 +100,7 @@ let lastIndexOfOpt = (arr, item) =>
99100
@send external mapWithIndex: (array<'a>, ('a, int) => 'b) => array<'b> = "map"
100101

101102
let reduceU = (a, x, f) => {
102-
let r = ref(x)
103+
let r = ref(. x)
103104
for i in 0 to length(a) - 1 {
104105
r.contents = f(. r.contents, getUnsafe(a, i))
105106
}
@@ -109,7 +110,7 @@ let reduceU = (a, x, f) => {
109110
let reduce = (a, x, f) => reduceU(a, x, (. a, b) => f(a, b))
110111

111112
let reduceWithIndexU = (a, x, f) => {
112-
let r = ref(x)
113+
let r = ref(. x)
113114
for i in 0 to length(a) - 1 {
114115
r.contents = f(. r.contents, getUnsafe(a, i), i)
115116
}
@@ -119,7 +120,7 @@ let reduceWithIndexU = (a, x, f) => {
119120
let reduceWithIndex = (a, x, f) => reduceWithIndexU(a, x, (. a, b, c) => f(a, b, c))
120121

121122
let reduceReverseU = (a, x, f) => {
122-
let r = ref(x)
123+
let r = ref(. x)
123124
for i in length(a) - 1 downto 0 {
124125
r.contents = f(. r.contents, getUnsafe(a, i))
125126
}
@@ -164,7 +165,7 @@ let reverse = xs => {
164165
let shuffleInPlace = xs => {
165166
let len = length(xs)
166167
for i in 0 to len - 1 {
167-
swapUnsafe(xs, i, Js.Math.random_int(i, len)) /* [i,len) */
168+
swapUnsafe(xs, i, Js.Math.random_int(. i, len)) /* [i,len) */
168169
}
169170
}
170171

@@ -177,7 +178,7 @@ let shuffle = xs => {
177178
let filterMapU = (a, f) => {
178179
let l = length(a)
179180
let r = makeUninitializedUnsafe(l)
180-
let j = ref(0)
181+
let j = ref(. 0)
181182
for i in 0 to l - 1 {
182183
let v = getUnsafe(a, i)
183184
switch f(. v) {

src/Stdlib__Array.resi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@@uncurried
12
@val external from: 'a => array<'b> = "Array.from"
23
@val external fromWithMap: ('a, 'b => 'c) => array<'c> = "Array.from"
34
@val external fromArrayLike: Js.Array2.array_like<'a> => array<'a> = "Array.from"

src/Stdlib__BigInt.res

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@@uncurried
12
type t = Js.Types.bigint_val
23

34
@val external asIntN: (~width: int, t) => t = "BigInt.asIntN"

src/Stdlib__Console.res

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@@uncurried
12
@val external log: 'a => unit = "console.log"
23
@val external log2: ('a, 'b) => unit = "console.log"
34
@val external log3: ('a, 'b, 'c) => unit = "console.log"

src/Stdlib__Date.res

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@@uncurried
12
type t = Js.Date.t
23

34
module Time = {

src/Stdlib__Dict.res

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@@uncurried
12
type t<'a> = Js.Dict.t<'a>
23

34
@get_index external get: (t<'a>, string) => option<'a> = ""

src/Stdlib__Error.res

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@@uncurried
12
type t = Js.Exn.t
23

34
external fromException: exn => option<t> = "?as_js_exn"

src/Stdlib__Float.res

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@@uncurried
12
module Constants = {
23
@val external nan: float = "NaN"
34
@val external epsilon: float = "Number.EPSILON"

src/Stdlib__Float.resi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@@uncurried
12
module Constants: {
23
@val external nan: float = "NaN"
34
@val external epsilon: float = "Number.EPSILON"

src/Stdlib__Global.res

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@@uncurried
12
type timeoutId = Js.Global.timeoutId
23

34
@val external setTimeout: (unit => unit, int) => timeoutId = "setTimeout"

src/Stdlib__Int.bs.js

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Stdlib__Int.res

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@@uncurried
12
module Constants = {
23
@inline let minValue = -2147483648
34
@inline let maxValue = 2147483647

src/Stdlib__JSON.bs.js

Lines changed: 15 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Stdlib__JSON.res

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@@uncurried
12
type t = Js.Json.t
23

34
type jsonReviver

src/Stdlib__Map.res

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@@uncurried
12
type t<'k, 'v>
23

34
@new external make: unit => t<'k, 'v> = "Map"

src/Stdlib__Math.res

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@@uncurried
12
module Constants = {
23
@val external e: float = "Math.E"
34
@val external ln2: float = "Math.LN2"

src/Stdlib__Nullable.bs.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Stdlib__Nullable.res

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@@uncurried
12
type t<'a> = Js.Nullable.t<'a>
23

34
external null: t<'a> = "#null"

src/Stdlib__Object.res

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@@uncurried
12
@obj external empty: unit => {..} = ""
23

34
@val external is: ('a, 'b) => bool = "Object.is"

src/Stdlib__Option.bs.js

Lines changed: 28 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Stdlib__Option.res

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@@uncurried
12
/* Copyright (C) 2017 Hongbo Zhang, Authors of ReScript
23
*
34
* This program is free software: you can redistribute it and/or modify
@@ -41,7 +42,7 @@ let forEach = (opt, f) => forEachU(opt, (. x) => f(x))
4142
let getExn = x =>
4243
switch x {
4344
| Some(x) => x
44-
| None => raise(Not_found)
45+
| None => raise(. Not_found)
4546
}
4647

4748
external getUnsafe: option<'a> => 'a = "%identity"

src/Stdlib__Option.resi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@@uncurried
12
/* Copyright (C) 2017 Authors of ReScript
23
*
34
* This program is free software: you can redistribute it and/or modify

src/Stdlib__Promise.bs.js

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)