Skip to content

ReScript v11+: 1.0.0 #189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Next version

## 1.0.0

- Up ReScript dependency to 11+.
- `JSON`, `Null` and `Nullable` untagged variants are now properly exposed.
- BREAKING: Duplicated definition of `result` in `Result` module removed, as `result` is now a built in. Switch out any `Result.t` type annotations to point to the built in `result` instead.

## 0.7.0

- Add `Dict.getUnsafe` https://github.com/rescript-association/rescript-core/pull/167
Expand Down
18 changes: 10 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rescript/core",
"version": "0.7.0",
"version": "1.0.0",
"scripts": {
"clean": "rescript clean",
"build": "rescript",
Expand All @@ -23,10 +23,10 @@
"src/**/*.mjs"
],
"peerDependencies": {
"rescript": "^10.1.0 || ^11.0.0"
"rescript": ">=11.0.0 || ^11.1.0-rc.2"
},
"devDependencies": {
"rescript": "10.1.4",
"rescript": "11.1.0-rc.2",
"@babel/code-frame": "7.18.6"
}
}
13 changes: 7 additions & 6 deletions src/Core__Array.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Generated by ReScript, PLEASE EDIT WITH CARE

import * as Curry from "rescript/lib/es6/curry.js";
import * as Js_math from "rescript/lib/es6/js_math.js";
import * as Caml_option from "rescript/lib/es6/caml_option.js";

Expand All @@ -19,7 +18,7 @@ function fromInitializer(length, f) {
}
var arr = new Array(length);
for(var i = 0; i < length; ++i){
arr[i] = Curry._1(f, i);
arr[i] = f(i);
}
return arr;
}
Expand All @@ -33,7 +32,7 @@ function equal(a, b, eq) {
if (i === len) {
return true;
}
if (!Curry._2(eq, a[i], b[i])) {
if (!eq(a[i], b[i])) {
return false;
}
_i = i + 1 | 0;
Expand All @@ -58,7 +57,7 @@ function compare(a, b, cmp) {
if (i === lenA) {
return 0;
}
var c = Curry._2(cmp, a[i], b[i]);
var c = cmp(a[i], b[i]);
if (c !== 0) {
return c;
}
Expand Down Expand Up @@ -128,7 +127,9 @@ function toShuffled(xs) {
}

function filterMap(a, f) {
var f$1 = Curry.__1(f);
var f$1 = function (a) {
return f(a);
};
var l = a.length;
var r = new Array(l);
var j = 0;
Expand Down Expand Up @@ -158,7 +159,7 @@ function findMap(arr, f) {
if (i === arr.length) {
return ;
}
var r = Curry._1(f, arr[i]);
var r = f(arr[i]);
if (r !== undefined) {
return r;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Core__Array.res
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ let filterMapU = (a, f) => {
let j = ref(0)
for i in 0 to l - 1 {
let v = getUnsafe(a, i)
switch f(. v) {
switch f(v) {
| None => ()
| Some(v) =>
setUnsafe(r, j.contents, v)
Expand All @@ -227,7 +227,7 @@ let filterMapU = (a, f) => {
r
}

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

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

Expand Down
2 changes: 1 addition & 1 deletion src/Core__Error.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var $$TypeError = {};
var $$URIError = {};

function panic(msg) {
throw new Error("Panic! " + msg + "");
throw new Error("Panic! " + msg);
}

export {
Expand Down
4 changes: 2 additions & 2 deletions src/Core__Int.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Generated by ReScript, PLEASE EDIT WITH CARE

import * as Pervasives from "rescript/lib/es6/pervasives.js";
import * as Core__Array from "./Core__Array.mjs";
import * as PervasivesU from "rescript/lib/es6/pervasivesU.js";

function equal(a, b) {
return a === b;
Expand Down Expand Up @@ -50,7 +50,7 @@ function rangeWithOptions(start, end, options) {
} else {
var range = isInverted ? start - end | 0 : end - start | 0;
var range$1 = options.inclusive === true ? range + 1 | 0 : range;
length = Math.ceil(range$1 / Pervasives.abs(step)) | 0;
length = Math.ceil(range$1 / PervasivesU.abs(step)) | 0;
}
return Core__Array.fromInitializer(length, (function (i) {
return start + Math.imul(i, step) | 0;
Expand Down
15 changes: 7 additions & 8 deletions src/Core__JSON.mjs
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
// Generated by ReScript, PLEASE EDIT WITH CARE

import * as Caml_option from "rescript/lib/es6/caml_option.js";

function classify(value) {
var match = Object.prototype.toString.call(value);
switch (match) {
case "[object Array]" :
return {
TAG: /* Array */4,
TAG: "Array",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this js file was just very stale right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this was just the first time Core had v11+ as dep.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right v10 is older than I'd remember.

_0: value
};
case "[object Boolean]" :
return {
TAG: /* Bool */0,
TAG: "Bool",
_0: value
};
case "[object Null]" :
return /* Null */0;
return "Null";
case "[object Number]" :
return {
TAG: /* Number */2,
TAG: "Number",
_0: value
};
case "[object String]" :
return {
TAG: /* String */1,
TAG: "String",
_0: value
};
default:
return {
TAG: /* Object */3,
TAG: "Object",
_0: value
};
}
Expand Down Expand Up @@ -71,7 +70,7 @@ function $$float(json) {

function object(json) {
if (typeof json === "object" && !Array.isArray(json) && json !== null) {
return Caml_option.some(json);
return json;
}

}
Expand Down
9 changes: 8 additions & 1 deletion src/Core__JSON.res
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
type t = Js.Json.t
@unboxed
type rec t = Js.Json.t =
| Boolean(bool)
| @as(null) Null
| String(string)
| Number(float)
| Object(Core__Dict.t<t>)
| Array(array<t>)

@raises @val external parseExn: string => t = "JSON.parse"
@raises @val external parseExnWithReviver: (string, (string, t) => t) => t = "JSON.parse"
Expand Down
9 changes: 8 additions & 1 deletion src/Core__JSON.resi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ Functions for interacting with JSON.
/**
A type representing a JSON object.
*/
type t = Js.Json.t
@unboxed
type rec t = Js.Json.t =
| Boolean(bool)
| @as(null) Null
| String(string)
| Number(float)
| Object(Core__Dict.t<t>)
| Array(array<t>)

/**
`parseExn(string)`
Expand Down
Loading