diff --git a/.eslintrc.json b/.eslintrc.json index 84cef4f..1c6afb9 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -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, diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43d2897..b6ebf3a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,8 @@ jobs: - uses: actions/checkout@v2 - uses: purescript-contrib/setup-purescript@main + with: + purescript: "unstable" - uses: actions/setup-node@v1 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 19ca264..7e39446 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 (#47 by @kl0tl and @JordanMartinez) New features: diff --git a/bower.json b/bower.json index 24fea18..5dcc7a0 100644 --- a/bower.json +++ b/bower.json @@ -17,12 +17,12 @@ "package.json" ], "dependencies": { - "purescript-partial": "^3.0.0", - "purescript-prelude": "^5.0.0", - "purescript-tailrec": "^5.0.0", - "purescript-unsafe-coerce": "^5.0.0" + "purescript-partial": "master", + "purescript-prelude": "master", + "purescript-tailrec": "master", + "purescript-unsafe-coerce": "master" }, "devDependencies": { - "purescript-console": "^5.0.0" + "purescript-console": "master" } } diff --git a/package.json b/package.json index fd4391e..a1d6811 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,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" } } diff --git a/src/Control/Monad/ST/Internal.js b/src/Control/Monad/ST/Internal.js index 7745a05..24d2ed8 100644 --- a/src/Control/Monad/ST/Internal.js +++ b/src/Control/Monad/ST/Internal.js @@ -1,6 +1,4 @@ -"use strict"; - -exports.map_ = function (f) { +export const map_ = function (f) { return function (a) { return function () { return f(a()); @@ -8,13 +6,13 @@ exports.map_ = function (f) { }; }; -exports.pure_ = function (a) { +export const pure_ = function (a) { return function () { return a; }; }; -exports.bind_ = function (a) { +export const bind_ = function (a) { return function (f) { return function () { return f(a())(); @@ -22,11 +20,11 @@ exports.bind_ = function (a) { }; }; -exports.run = function (f) { +export const run = function (f) { return f(); }; -exports["while"] = function (f) { +function whileST(f) { return function (a) { return function () { while (f()) { @@ -34,9 +32,10 @@ exports["while"] = function (f) { } }; }; -}; +} +export { whileST as while }; -exports["for"] = function (lo) { +function forST(lo) { return function (hi) { return function (f) { return function () { @@ -46,9 +45,10 @@ exports["for"] = function (lo) { }; }; }; -}; +} +export { forST as for }; -exports.foreach = function (as) { +export const foreach = function (as) { return function (f) { return function () { for (var i = 0, l = as.length; i < l; i++) { @@ -58,19 +58,20 @@ exports.foreach = function (as) { }; }; -exports.new = function (val) { +function newSTRef(val) { return function () { return { value: val }; }; -}; +} +export { newSTRef as new }; -exports.read = function (ref) { +export const read = function (ref) { return function () { return ref.value; }; }; -exports.modifyImpl = function (f) { +export const modifyImpl = function (f) { return function (ref) { return function () { var t = f(ref.value); @@ -80,7 +81,7 @@ exports.modifyImpl = function (f) { }; }; -exports.write = function (a) { +export const write = function (a) { return function (ref) { return function () { return ref.value = a; // eslint-disable-line no-return-assign