Skip to content

Commit

Permalink
Get rid of U functions (#191)
Browse files Browse the repository at this point in the history
* Get rid of U functions

* Add changelog entry
  • Loading branch information
cknitt authored Feb 15, 2024
1 parent dd05215 commit 154f9f2
Show file tree
Hide file tree
Showing 5 changed files with 171 additions and 334 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Next version

- Add `Dict.forEach`, `Dict.forEachWithKey` and `Dict.mapValues` https://github.com/rescript-association/rescript-core/pull/181
- Remove internal xxxU helper functions that are not needed anymore in uncurried mode. https://github.com/rescript-association/rescript-core/pull/191

## 1.0.0

Expand Down
5 changes: 1 addition & 4 deletions src/Core__Array.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,12 @@ function toShuffled(xs) {
}

function filterMap(a, f) {
var f$1 = function (a) {
return f(a);
};
var l = a.length;
var r = new Array(l);
var j = 0;
for(var i = 0; i < l; ++i){
var v = a[i];
var v$1 = f$1(v);
var v$1 = f(v);
if (v$1 !== undefined) {
r[j] = Caml_option.valFromOption(v$1);
j = j + 1 | 0;
Expand Down
4 changes: 1 addition & 3 deletions src/Core__Array.res
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ let toShuffled = xs => {
result
}

let filterMapU = (a, f) => {
let filterMap = (a, f) => {
let l = length(a)
let r = makeUninitializedUnsafe(l)
let j = ref(0)
Expand All @@ -227,8 +227,6 @@ let filterMapU = (a, f) => {
r
}

let filterMap = (a, f) => filterMapU(a, a => f(a))

let keepSome = filterMap(_, x => x)

@send external flatMap: (array<'a>, 'a => array<'b>) => array<'b> = "flatMap"
Expand Down
Loading

0 comments on commit 154f9f2

Please sign in to comment.