Skip to content
Merged
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 @@ -13,6 +13,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:
- Migrate FFI to ES modules (#218 by @kl0tl and @JordanMartinez)

New features:

Expand Down
32 changes: 16 additions & 16 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@
"package.json"
],
"dependencies": {
"purescript-bifunctors": "^5.0.0",
"purescript-control": "^5.0.0",
"purescript-foldable-traversable": "^5.0.0",
"purescript-maybe": "^5.0.0",
"purescript-nonempty": "^6.0.0",
"purescript-partial": "^3.0.0",
"purescript-prelude": "^5.0.0",
"purescript-st": "^5.0.0",
"purescript-tailrec": "^5.0.0",
"purescript-tuples": "^6.0.0",
"purescript-unfoldable": "^5.0.0",
"purescript-unsafe-coerce": "^5.0.0"
"purescript-bifunctors": "master",
"purescript-control": "master",
"purescript-foldable-traversable": "master",
"purescript-maybe": "master",
"purescript-nonempty": "master",
"purescript-partial": "master",
"purescript-prelude": "master",
"purescript-st": "master",
"purescript-tailrec": "master",
"purescript-tuples": "master",
"purescript-unfoldable": "master",
"purescript-unsafe-coerce": "master"
},
"devDependencies": {
"purescript-assert": "^5.0.0",
"purescript-console": "^5.0.0",
"purescript-const": "^5.0.0",
"purescript-minibench": "^3.0.0"
"purescript-assert": "master",
"purescript-console": "master",
"purescript-const": "master",
"purescript-minibench": "master"
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
},
"devDependencies": {
"eslint": "^7.15.0",
"pulp": "^15.0.0",
"purescript-psa": "^0.8.0",
"pulp": "16.0.0-0",
"purescript-psa": "^0.8.2",
"rimraf": "^3.0.2"
}
}
50 changes: 24 additions & 26 deletions src/Data/Array.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
"use strict";

//------------------------------------------------------------------------------
// Array creation --------------------------------------------------------------
//------------------------------------------------------------------------------

exports.range = function (start) {
export const range = function (start) {
return function (end) {
var step = start > end ? -1 : 1;
var result = new Array(step * (end - start) + 1);
Expand Down Expand Up @@ -40,9 +38,9 @@ var replicatePolyfill = function (count) {
};

// In browsers that have Array.prototype.fill we use it, as it's faster.
exports.replicate = typeof Array.prototype.fill === "function" ? replicateFill : replicatePolyfill;
export const replicate = typeof Array.prototype.fill === "function" ? replicateFill : replicatePolyfill;

exports.fromFoldableImpl = (function () {
export const fromFoldableImpl = (function () {
function Cons(head, tail) {
this.head = head;
this.tail = tail;
Expand Down Expand Up @@ -77,15 +75,15 @@ exports.fromFoldableImpl = (function () {
// Array size ------------------------------------------------------------------
//------------------------------------------------------------------------------

exports.length = function (xs) {
export const length = function (xs) {
return xs.length;
};

//------------------------------------------------------------------------------
// Non-indexed reads -----------------------------------------------------------
//------------------------------------------------------------------------------

exports.unconsImpl = function (empty) {
export const unconsImpl = function (empty) {
return function (next) {
return function (xs) {
return xs.length === 0 ? empty({}) : next(xs[0])(xs.slice(1));
Expand All @@ -97,7 +95,7 @@ exports.unconsImpl = function (empty) {
// Indexed operations ----------------------------------------------------------
//------------------------------------------------------------------------------

exports.indexImpl = function (just) {
export const indexImpl = function (just) {
return function (nothing) {
return function (xs) {
return function (i) {
Expand All @@ -107,7 +105,7 @@ exports.indexImpl = function (just) {
};
};

exports.findMapImpl = function (nothing) {
export const findMapImpl = function (nothing) {
return function (isJust) {
return function (f) {
return function (xs) {
Expand All @@ -121,7 +119,7 @@ exports.findMapImpl = function (nothing) {
};
};

exports.findIndexImpl = function (just) {
export const findIndexImpl = function (just) {
return function (nothing) {
return function (f) {
return function (xs) {
Expand All @@ -134,7 +132,7 @@ exports.findIndexImpl = function (just) {
};
};

exports.findLastIndexImpl = function (just) {
export const findLastIndexImpl = function (just) {
return function (nothing) {
return function (f) {
return function (xs) {
Expand All @@ -147,7 +145,7 @@ exports.findLastIndexImpl = function (just) {
};
};

exports._insertAt = function (just) {
export const _insertAt = function (just) {
return function (nothing) {
return function (i) {
return function (a) {
Expand All @@ -162,7 +160,7 @@ exports._insertAt = function (just) {
};
};

exports._deleteAt = function (just) {
export const _deleteAt = function (just) {
return function (nothing) {
return function (i) {
return function (l) {
Expand All @@ -175,7 +173,7 @@ exports._deleteAt = function (just) {
};
};

exports._updateAt = function (just) {
export const _updateAt = function (just) {
return function (nothing) {
return function (i) {
return function (a) {
Expand All @@ -194,11 +192,11 @@ exports._updateAt = function (just) {
// Transformations -------------------------------------------------------------
//------------------------------------------------------------------------------

exports.reverse = function (l) {
export const reverse = function (l) {
return l.slice().reverse();
};

exports.concat = function (xss) {
export const concat = function (xss) {
if (xss.length <= 10000) {
// This method is faster, but it crashes on big arrays.
// So we use it when can and fallback to simple variant otherwise.
Expand All @@ -215,13 +213,13 @@ exports.concat = function (xss) {
return result;
};

exports.filter = function (f) {
export const filter = function (f) {
return function (xs) {
return xs.filter(f);
};
};

exports.partition = function (f) {
export const partition = function (f) {
return function (xs) {
var yes = [];
var no = [];
Expand All @@ -236,7 +234,7 @@ exports.partition = function (f) {
};
};

exports.scanl = function (f) {
export const scanl = function (f) {
return function (b) {
return function (xs) {
var len = xs.length;
Expand All @@ -251,7 +249,7 @@ exports.scanl = function (f) {
};
};

exports.scanr = function (f) {
export const scanr = function (f) {
return function (b) {
return function (xs) {
var len = xs.length;
Expand All @@ -270,7 +268,7 @@ exports.scanr = function (f) {
// Sorting ---------------------------------------------------------------------
//------------------------------------------------------------------------------

exports.sortByImpl = (function () {
export const sortByImpl = (function () {
function mergeFromTo(compare, fromOrdering, xs1, xs2, from, to) {
var mid;
var i;
Expand Down Expand Up @@ -328,7 +326,7 @@ exports.sortByImpl = (function () {
// Subarrays -------------------------------------------------------------------
//------------------------------------------------------------------------------

exports.slice = function (s) {
export const slice = function (s) {
return function (e) {
return function (l) {
return l.slice(s, e);
Expand All @@ -340,7 +338,7 @@ exports.slice = function (s) {
// Zipping ---------------------------------------------------------------------
//------------------------------------------------------------------------------

exports.zipWith = function (f) {
export const zipWith = function (f) {
return function (xs) {
return function (ys) {
var l = xs.length < ys.length ? xs.length : ys.length;
Expand All @@ -357,7 +355,7 @@ exports.zipWith = function (f) {
// Folding ---------------------------------------------------------------------
//------------------------------------------------------------------------------

exports.any = function (p) {
export const any = function (p) {
return function (xs) {
var len = xs.length;
for (var i = 0; i < len; i++) {
Expand All @@ -367,7 +365,7 @@ exports.any = function (p) {
};
};

exports.all = function (p) {
export const all = function (p) {
return function (xs) {
var len = xs.length;
for (var i = 0; i < len; i++) {
Expand All @@ -381,7 +379,7 @@ exports.all = function (p) {
// Partial ---------------------------------------------------------------------
//------------------------------------------------------------------------------

exports.unsafeIndexImpl = function (xs) {
export const unsafeIndexImpl = function (xs) {
return function (n) {
return xs[n];
};
Expand Down
8 changes: 3 additions & 5 deletions src/Data/Array/NonEmpty/Internal.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"use strict";

exports.foldr1Impl = function (f) {
export const foldr1Impl = function (f) {
return function (xs) {
var acc = xs[xs.length - 1];
for (var i = xs.length - 2; i >= 0; i--) {
Expand All @@ -10,7 +8,7 @@ exports.foldr1Impl = function (f) {
};
};

exports.foldl1Impl = function (f) {
export const foldl1Impl = function (f) {
return function (xs) {
var acc = xs[0];
var len = xs.length;
Expand All @@ -21,7 +19,7 @@ exports.foldl1Impl = function (f) {
};
};

exports.traverse1Impl = function () {
export const traverse1Impl = function () {
function Cont(fn) {
this.fn = fn;
}
Expand Down
Loading