Skip to content
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: 2 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
{
"parserOptions": {
"ecmaVersion": 5
"ecmaVersion": 6,
"sourceType": "module"
},
"extends": "eslint:recommended",
"env": {
"commonjs": true
},
"rules": {
"strict": [2, "global"],
"block-scoped-var": 2,
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
- uses: actions/checkout@v2

- uses: purescript-contrib/setup-purescript@main
with:
purescript: "unstable"

- uses: actions/setup-node@v1
with:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Notable changes to this project are documented in this file. The format is based
## [Unreleased]

Breaking changes:
- Migrated FFI to ES Modules (#287 by @kl0tl and @JordanMartinez)

New features:

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
},
"devDependencies": {
"eslint": "^7.15.0",
"purescript-psa": "^0.8.0",
"pulp": "^15.0.0",
"purescript-psa": "^0.8.2",
"pulp": "16.0.0-0",
Copy link
Member

Choose a reason for hiding this comment

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

What's the reason for the prerelease version of Pulp? Should this be 16.0.0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made a pre-release of 16.0.0 in case we wanted to add support for esbuild later or come across other bugs.

"rimraf": "^3.0.2"
}
}
4 changes: 1 addition & 3 deletions src/Control/Apply.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"use strict";

exports.arrayApply = function (fs) {
export const arrayApply = function (fs) {
return function (xs) {
var l = fs.length;
var k = xs.length;
Expand Down
4 changes: 1 addition & 3 deletions src/Control/Bind.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"use strict";

exports.arrayBind = function (arr) {
export const arrayBind = function (arr) {
return function (f) {
var result = [];
for (var i = 0, l = arr.length; i < l; i++) {
Expand Down
14 changes: 6 additions & 8 deletions src/Data/Bounded.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
"use strict";
export const topInt = 2147483647;
export const bottomInt = -2147483648;

exports.topInt = 2147483647;
exports.bottomInt = -2147483648;
export const topChar = String.fromCharCode(65535);
export const bottomChar = String.fromCharCode(0);

exports.topChar = String.fromCharCode(65535);
exports.bottomChar = String.fromCharCode(0);

exports.topNumber = Number.POSITIVE_INFINITY;
exports.bottomNumber = Number.NEGATIVE_INFINITY;
export const topNumber = Number.POSITIVE_INFINITY;
export const bottomNumber = Number.NEGATIVE_INFINITY;
14 changes: 6 additions & 8 deletions src/Data/Eq.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
"use strict";

var refEq = function (r1) {
return function (r2) {
return r1 === r2;
};
};

exports.eqBooleanImpl = refEq;
exports.eqIntImpl = refEq;
exports.eqNumberImpl = refEq;
exports.eqCharImpl = refEq;
exports.eqStringImpl = refEq;
export const eqBooleanImpl = refEq;
export const eqIntImpl = refEq;
export const eqNumberImpl = refEq;
export const eqCharImpl = refEq;
export const eqStringImpl = refEq;

exports.eqArrayImpl = function (f) {
export const eqArrayImpl = function (f) {
return function (xs) {
return function (ys) {
if (xs.length !== ys.length) return false;
Expand Down
10 changes: 4 additions & 6 deletions src/Data/EuclideanRing.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
"use strict";

exports.intDegree = function (x) {
export const intDegree = function (x) {
return Math.min(Math.abs(x), 2147483647);
};

// See the Euclidean definition in
// https://en.m.wikipedia.org/wiki/Modulo_operation.
exports.intDiv = function (x) {
export const intDiv = function (x) {
return function (y) {
if (y === 0) return 0;
return y > 0 ? Math.floor(x / y) : -Math.floor(x / -y);
};
};

exports.intMod = function (x) {
export const intMod = function (x) {
return function (y) {
if (y === 0) return 0;
var yy = Math.abs(y);
return ((x % yy) + yy) % yy;
};
};

exports.numDiv = function (n1) {
export const numDiv = function (n1) {
return function (n2) {
return n1 / n2;
};
Expand Down
4 changes: 1 addition & 3 deletions src/Data/Functor.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"use strict";

exports.arrayMap = function (f) {
export const arrayMap = function (f) {
return function (arr) {
var l = arr.length;
var result = new Array(l);
Expand Down
8 changes: 3 additions & 5 deletions src/Data/HeytingAlgebra.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
"use strict";

exports.boolConj = function (b1) {
export const boolConj = function (b1) {
return function (b2) {
return b1 && b2;
};
};

exports.boolDisj = function (b1) {
export const boolDisj = function (b1) {
return function (b2) {
return b1 || b2;
};
};

exports.boolNot = function (b) {
export const boolNot = function (b) {
return !b;
};
14 changes: 6 additions & 8 deletions src/Data/Ord.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use strict";

var unsafeCompareImpl = function (lt) {
return function (eq) {
return function (gt) {
Expand All @@ -12,13 +10,13 @@ var unsafeCompareImpl = function (lt) {
};
};

exports.ordBooleanImpl = unsafeCompareImpl;
exports.ordIntImpl = unsafeCompareImpl;
exports.ordNumberImpl = unsafeCompareImpl;
exports.ordStringImpl = unsafeCompareImpl;
exports.ordCharImpl = unsafeCompareImpl;
export const ordBooleanImpl = unsafeCompareImpl;
export const ordIntImpl = unsafeCompareImpl;
export const ordNumberImpl = unsafeCompareImpl;
export const ordStringImpl = unsafeCompareImpl;
export const ordCharImpl = unsafeCompareImpl;

exports.ordArrayImpl = function (f) {
export const ordArrayImpl = function (f) {
return function (xs) {
return function (ys) {
var i = 0;
Expand Down
6 changes: 2 additions & 4 deletions src/Data/Ring.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
"use strict";

exports.intSub = function (x) {
export const intSub = function (x) {
return function (y) {
/* jshint bitwise: false */
return x - y | 0;
};
};

exports.numSub = function (n1) {
export const numSub = function (n1) {
return function (n2) {
return n1 - n2;
};
Expand Down
6 changes: 2 additions & 4 deletions src/Data/Semigroup.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
"use strict";

exports.concatString = function (s1) {
export const concatString = function (s1) {
return function (s2) {
return s1 + s2;
};
};

exports.concatArray = function (xs) {
export const concatArray = function (xs) {
return function (ys) {
if (xs.length === 0) return ys;
if (ys.length === 0) return xs;
Expand Down
10 changes: 4 additions & 6 deletions src/Data/Semiring.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
"use strict";

exports.intAdd = function (x) {
export const intAdd = function (x) {
return function (y) {
/* jshint bitwise: false */
return x + y | 0;
};
};

exports.intMul = function (x) {
export const intMul = function (x) {
return function (y) {
/* jshint bitwise: false */
return x * y | 0;
};
};

exports.numAdd = function (n1) {
export const numAdd = function (n1) {
return function (n2) {
return n1 + n2;
};
};

exports.numMul = function (n1) {
export const numMul = function (n1) {
return function (n2) {
return n1 * n2;
};
Expand Down
16 changes: 7 additions & 9 deletions src/Data/Show.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
"use strict";

exports.showIntImpl = function (n) {
export const showIntImpl = function (n) {
return n.toString();
};

exports.showNumberImpl = function (n) {
export const showNumberImpl = function (n) {
var str = n.toString();
return isNaN(str + ".0") ? str : str + ".0";
};

exports.showCharImpl = function (c) {
export const showCharImpl = function (c) {
var code = c.charCodeAt(0);
if (code < 0x20 || code === 0x7F) {
switch (c) {
Expand All @@ -26,7 +24,7 @@ exports.showCharImpl = function (c) {
return c === "'" || c === "\\" ? "'\\" + c + "'" : "'" + c + "'";
};

exports.showStringImpl = function (s) {
export const showStringImpl = function (s) {
var l = s.length;
return "\"" + s.replace(
/[\0-\x1F\x7F"\\]/g, // eslint-disable-line no-control-regex
Expand All @@ -50,7 +48,7 @@ exports.showStringImpl = function (s) {
) + "\"";
};

exports.showArrayImpl = function (f) {
export const showArrayImpl = function (f) {
return function (xs) {
var ss = [];
for (var i = 0, l = xs.length; i < l; i++) {
Expand All @@ -60,13 +58,13 @@ exports.showArrayImpl = function (f) {
};
};

exports.cons = function (head) {
export const cons = function (head) {
return function (tail) {
return [head].concat(tail);
};
};

exports.join = function (separator) {
export const join = function (separator) {
return function (xs) {
return xs.join(separator);
};
Expand Down
4 changes: 1 addition & 3 deletions src/Data/Show/Generic.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"use strict";

exports.intercalate = function (separator) {
export const intercalate = function (separator) {
return function (xs) {
var len = xs.length;
if (len === 0) return "";
Expand Down
4 changes: 1 addition & 3 deletions src/Data/Symbol.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"use strict";

// module Data.Symbol

exports.unsafeCoerce = function (arg) {
export const unsafeCoerce = function (arg) {
return arg;
};

4 changes: 1 addition & 3 deletions src/Data/Unit.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
"use strict";

exports.unit = undefined;
export const unit = undefined;
10 changes: 4 additions & 6 deletions src/Record/Unsafe.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
"use strict";

exports.unsafeHas = function (label) {
export const unsafeHas = function (label) {
return function (rec) {
return {}.hasOwnProperty.call(rec, label);
};
};

exports.unsafeGet = function (label) {
export const unsafeGet = function (label) {
return function (rec) {
return rec[label];
};
};

exports.unsafeSet = function (label) {
export const unsafeSet = function (label) {
return function (value) {
return function (rec) {
var copy = {};
Expand All @@ -27,7 +25,7 @@ exports.unsafeSet = function (label) {
};
};

exports.unsafeDelete = function (label) {
export const unsafeDelete = function (label) {
return function (rec) {
var copy = {};
for (var key in rec) {
Expand Down
Loading