Skip to content

Commit 1132190

Browse files
committed
Revert "Result.forEach with tests and docs (rescript-lang#116)"
This reverts commit 9a9105f.
1 parent 24920d0 commit 1132190

8 files changed

+3
-119
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
### API changes
66

77
- Add `Result.forEach` https://github.com/rescript-association/rescript-core/pull/116
8-
- Add `Array.fromOption` https://github.com/rescript-association/rescript-core/pull/111
98

109
## 0.2.0
1110

src/Core__Result.mjs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,6 @@ function cmp(a, b, f) {
102102
}
103103
}
104104

105-
function forEach(r, f) {
106-
if (r.TAG === /* Ok */0) {
107-
return Curry._1(f, r._0);
108-
}
109-
110-
}
111-
112105
export {
113106
getExn ,
114107
mapWithDefault ,
@@ -119,6 +112,5 @@ export {
119112
isError ,
120113
eq ,
121114
cmp ,
122-
forEach ,
123115
}
124116
/* No side effect */

src/Core__Result.res

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,3 @@ let cmpU = (a, b, f) =>
9191
}
9292

9393
let cmp = (a, b, f) => cmpU(a, b, (. x, y) => f(x, y))
94-
95-
let forEach = (r, f) =>
96-
switch r {
97-
| Ok(ok) => f(ok)
98-
| Error(_) => ()
99-
}

src/Core__Result.resi

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -197,15 +197,3 @@ let eq: (t<'a, 'c>, t<'b, 'd>, ('a, 'b) => bool) => bool
197197
```
198198
*/
199199
let cmp: (t<'a, 'c>, t<'b, 'd>, ('a, 'b) => int) => int
200-
201-
/**
202-
`forEach(res, f)` runs the provided function `f` on the `Ok` value. If `res` is `Error`, nothing happens.
203-
204-
## Examples
205-
206-
```rescript
207-
Result.forEach(Ok(3), Console.log) // Logs "3", returns ()
208-
Result.forEach(Error("x"), Console.log) // Does nothing, returns ()
209-
```
210-
*/
211-
let forEach: (t<'a, 'b>, 'a => unit) => unit

test/ResultTests.mjs

Lines changed: 0 additions & 60 deletions
This file was deleted.

test/ResultTests.res

Lines changed: 0 additions & 21 deletions
This file was deleted.

test/TestSuite.mjs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import * as TestTests from "./TestTests.mjs";
55
import * as ArrayTests from "./ArrayTests.mjs";
66
import * as ErrorTests from "./ErrorTests.mjs";
77
import * as PromiseTest from "./PromiseTest.mjs";
8-
import * as ResultTests from "./ResultTests.mjs";
98

109
var bign = TestTests.bign;
1110

@@ -29,13 +28,9 @@ var panicTest = ErrorTests.panicTest;
2928

3029
var fromOptionTest = ArrayTests.fromOptionTest;
3130

32-
var $$catch = IntTests.$$catch;
33-
34-
var eq = ResultTests.eq;
35-
36-
var forEachIfOkCallFunction = ResultTests.forEachIfOkCallFunction;
31+
var eq = IntTests.eq;
3732

38-
var forEachIfErrorDoNotCallFunction = ResultTests.forEachIfErrorDoNotCallFunction;
33+
var $$catch = IntTests.$$catch;
3934

4035
export {
4136
bign ,
@@ -49,9 +44,7 @@ export {
4944
Concurrently ,
5045
panicTest ,
5146
fromOptionTest ,
52-
$$catch ,
5347
eq ,
54-
forEachIfOkCallFunction ,
55-
forEachIfErrorDoNotCallFunction ,
48+
$$catch ,
5649
}
5750
/* IntTests Not a pure module */

test/TestSuite.res

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ include PromiseTest
33
include ErrorTests
44
include ArrayTests
55
include IntTests
6-
include ResultTests

0 commit comments

Comments
 (0)