From 89723f5e52247540728d99722efd4279ab87157f Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 09:22:53 -0500 Subject: [PATCH 01/11] Migrated FFI to ES modules via 'lebab' --- src/Data/UInt.js | 88 ++++++++++++++++++++++++------------------------ 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/src/Data/UInt.js b/src/Data/UInt.js index ea027a6..bd45312 100644 --- a/src/Data/UInt.js +++ b/src/Data/UInt.js @@ -1,10 +1,10 @@ "use strict"; -exports.from = function (val) { +export function from(val) { return val >>> 0; -}; +} -exports.exact = function (just) { +export function exact(just) { return function (nothing) { return function (conv) { return function (val) { @@ -16,57 +16,57 @@ exports.exact = function (just) { }; }; }; -}; +} -exports.toInt = function (uval) { +export function toInt(uval) { return uval | 0; -}; +} -exports.toNumber = function (uval) { +export function toNumber(uval) { return uval; -}; +} -exports.uintAdd = function (x) { +export function uintAdd(x) { return function (y) { return (x + y) >>> 0; }; -}; +} -exports.uintMul = function (x) { +export function uintMul(x) { return function (y) { return Math.imul(x, y) >>> 0; }; -}; +} -exports.uintSub = function (x) { +export function uintSub(x) { return function (y) { return (x - y) >>> 0; }; -}; +} -exports.uintDiv = function (x) { +export function uintDiv(x) { return function (y) { return (x / y) >>> 0; }; -}; +} -exports.uintMod = function (x) { +export function uintMod(x) { return function (y) { return (x % y) >>> 0; }; -}; +} -exports.uintDegree = function (x) { +export function uintDegree(x) { return Math.abs(x | 0); -}; +} -exports.uintEq = function (x) { +export function uintEq(x) { return function (y) { return x == y; }; -}; +} -exports.uintCmp = function (lt) { +export function uintCmp(lt) { return function (eq) { return function (gt) { return function (x) { @@ -78,62 +78,62 @@ exports.uintCmp = function (lt) { }; }; }; -}; +} -exports.fromStringImpl = function (s) { +export function fromStringImpl(s) { var n = Number(s); if (n === parseInt(s)) { return n; } return NaN; -}; +} -exports.toString = function (x) { +export function toString(x) { return x.toString(); -}; +} -exports.pow = function (u) { +export function pow(u) { return function (p) { return Math.pow(u, p) >>> 0; }; -}; +} -exports.and = function (n1) { +export function and(n1) { return function (n2) { return (n1 & n2) >>> 0; }; -}; +} -exports.or = function (n1) { +export function or(n1) { return function (n2) { return (n1 | n2) >>> 0; }; -}; +} -exports.xor = function (n1) { +export function xor(n1) { return function (n2) { return (n1 ^ n2) >>> 0; }; -}; +} -exports.shl = function (n1) { +export function shl(n1) { return function (n2) { return (n1 << n2) >>> 0; }; -}; +} -exports.shr = function (n1) { +export function shr(n1) { return function (n2) { return (n1 >> n2) >>> 0; }; -}; +} -exports.zshr = function (n1) { +export function zshr(n1) { return function (n2) { return (n1 >>> n2) >>> 0; }; -}; +} -exports.complement = function (n) { +export function complement(n) { return (~n >>> 0); -}; +} From 5207c29d427b373a3aa540df7c3deede459c8460 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 09:22:54 -0500 Subject: [PATCH 02/11] Removed '"use strict";' in FFI files --- src/Data/UInt.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Data/UInt.js b/src/Data/UInt.js index bd45312..db1269e 100644 --- a/src/Data/UInt.js +++ b/src/Data/UInt.js @@ -1,5 +1,3 @@ -"use strict"; - export function from(val) { return val >>> 0; } From 66b39ab95e1803526ac16bebe2045c57d8cefdc4 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 09:22:54 -0500 Subject: [PATCH 03/11] Update to CI to use 'unstable' purescript --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d28510..16fa120 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,7 @@ jobs: - name: Set up a PureScript toolchain uses: purescript-contrib/setup-purescript@main with: + purescript: "unstable" purs-tidy: "latest" - name: Cache PureScript dependencies From 8893702213036e4ac8280d6cb6175d0ee2e1596c Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 09:22:54 -0500 Subject: [PATCH 04/11] Add CI test: verify 'bower.json' file works via pulp --- .github/workflows/ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 16fa120..c5a1684 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,3 +44,12 @@ jobs: - name: Check formatting run: purs-tidy check src test + + - name: Verify Bower & Pulp + run: | + npm install bower pulp@16.0.0-0 + npx bower install + npx pulp build -- --censor-lib --strict + if [ -d "test" ]; then + npx pulp test + fi From c79d72b0c7c5de347fcd4748187dd4eec4c46e10 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 09:22:54 -0500 Subject: [PATCH 05/11] Ignore spago-based tests (temporarily) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5a1684..cfaf9d3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,7 +39,7 @@ jobs: - name: Build tests run: spago -x test.dhall build --no-install --purs-args '--censor-lib --strict' - - name: Run tests +# - name: Run tests run: spago -x test.dhall test --no-install - name: Check formatting From cf25b73cfbca937975faa3bbbbb9832c3b80b387 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 09:22:54 -0500 Subject: [PATCH 06/11] Update Bower dependencies to master or main --- bower.json | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/bower.json b/bower.json index f4c8a7b..89bff95 100644 --- a/bower.json +++ b/bower.json @@ -1,29 +1,29 @@ { - "name": "purescript-uint", - "license": [ - "MIT" - ], - "repository": { - "type": "git", - "url": "https://github.com/purescript-contrib/purescript-uint.git" - }, - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "output" - ], - "dependencies": { - "purescript-enums": "^v5.0.0", - "purescript-gen": "^v3.0.0", - "purescript-math": "^v3.0.0", - "purescript-maybe": "^v5.0.0", - "purescript-prelude": "^v5.0.0", - "purescript-psci-support": "^v5.0.0" - }, - "devDependencies": { - "purescript-effect": "^v3.0.0", - "purescript-quickcheck": "^v7.1.0", - "purescript-quickcheck-laws": "^v6.0.1" - } + "name": "purescript-uint", + "license": [ + "MIT" + ], + "repository": { + "type": "git", + "url": "https://github.com/purescript-contrib/purescript-uint.git" + }, + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "output" + ], + "dependencies": { + "purescript-enums": "master", + "purescript-gen": "master", + "purescript-math": "master", + "purescript-maybe": "master", + "purescript-prelude": "master", + "purescript-psci-support": "master" + }, + "devDependencies": { + "purescript-effect": "master", + "purescript-quickcheck": "master", + "purescript-quickcheck-laws": "main" + } } From a95596faa989a8e9e62cc75417e179237e529e16 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 09:22:54 -0500 Subject: [PATCH 07/11] Update packages.dhall to 'prepare-0.15' package set --- packages.dhall | 126 +------------------------------------------------ 1 file changed, 2 insertions(+), 124 deletions(-) diff --git a/packages.dhall b/packages.dhall index 2a73f20..582d6d3 100644 --- a/packages.dhall +++ b/packages.dhall @@ -1,126 +1,4 @@ -{- -Welcome to your new Dhall package-set! - -Below are instructions for how to edit this file for most use -cases, so that you don't need to know Dhall to use it. - -## Warning: Don't Move This Top-Level Comment! - -Due to how `dhall format` currently works, this comment's -instructions cannot appear near corresponding sections below -because `dhall format` will delete the comment. However, -it will not delete a top-level comment like this one. - -## Use Cases - -Most will want to do one or both of these options: -1. Override/Patch a package's dependency -2. Add a package not already in the default package set - -This file will continue to work whether you use one or both options. -Instructions for each option are explained below. - -### Overriding/Patching a package - -Purpose: -- Change a package's dependency to a newer/older release than the - default package set's release -- Use your own modified version of some dependency that may - include new API, changed API, removed API by - using your custom git repo of the library rather than - the package set's repo - -Syntax: -Replace the overrides' "{=}" (an empty record) with the following idea -The "//" or "⫽" means "merge these two records and - when they have the same value, use the one on the right:" -------------------------------- -let overrides = - { packageName = - upstream.packageName // { updateEntity1 = "new value", updateEntity2 = "new value" } - , packageName = - upstream.packageName // { version = "v4.0.0" } - , packageName = - upstream.packageName // { repo = "https://www.example.com/path/to/new/repo.git" } - } -------------------------------- - -Example: -------------------------------- -let overrides = - { halogen = - upstream.halogen // { version = "master" } - , halogen-vdom = - upstream.halogen-vdom // { version = "v4.0.0" } - } -------------------------------- - -### Additions - -Purpose: -- Add packages that aren't already included in the default package set - -Syntax: -Replace the additions' "{=}" (an empty record) with the following idea: -------------------------------- -let additions = - { package-name = - { dependencies = - [ "dependency1" - , "dependency2" - ] - , repo = - "https://example.com/path/to/git/repo.git" - , version = - "tag ('v4.0.0') or branch ('master')" - } - , package-name = - { dependencies = - [ "dependency1" - , "dependency2" - ] - , repo = - "https://example.com/path/to/git/repo.git" - , version = - "tag ('v4.0.0') or branch ('master')" - } - , etc. - } -------------------------------- - -Example: -------------------------------- -let additions = - { benchotron = - { dependencies = - [ "arrays" - , "exists" - , "profunctor" - , "strings" - , "quickcheck" - , "lcg" - , "transformers" - , "foldable-traversable" - , "exceptions" - , "node-fs" - , "node-buffer" - , "node-readline" - , "datetime" - , "now" - ] - , repo = - "https://github.com/hdgarrood/purescript-benchotron.git" - , version = - "v7.0.0" - } - } -------------------------------- --} let upstream = - https://github.com/purescript/package-sets/releases/download/psc-0.14.3-20210722/packages.dhall sha256:1ceb43aa59436bf5601bac45f6f3781c4e1f0e4c2b8458105b018e5ed8c30f8c - -let overrides = {=} - -let additions = {=} + https://raw.githubusercontent.com/purescript/package-sets/prepare-0.15/src/packages.dhall -in upstream // overrides // additions +in upstream From ec66a888bd09d66108f83115780cde546bc8ea8c Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 09:22:54 -0500 Subject: [PATCH 08/11] Removed unneeded 'psci-support' package --- spago.dhall | 1 - 1 file changed, 1 deletion(-) diff --git a/spago.dhall b/spago.dhall index 519f653..d9faab3 100644 --- a/spago.dhall +++ b/spago.dhall @@ -3,7 +3,6 @@ [ "prelude" , "math" , "maybe" - , "psci-support" , "enums" , "gen" ] From e610b23f27a79d0dfbb72d89c0e2b399e2068d1e Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 12:31:57 -0500 Subject: [PATCH 09/11] Added changelog entry --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2b46cd..4068438 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ Notable changes to this project are documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +Breaking Changes: +- Migrate FFI to ES modules (#20 by @JordanMartinez) + ## v6.0.2 2021-07-11 Move quickcheck test dependencies to `test.dhall`. From b9ec0115b438c40afa22efca021d9f56de55cf16 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 12:44:35 -0500 Subject: [PATCH 10/11] Comment out other test --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cfaf9d3..50d9084 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: run: spago -x test.dhall build --no-install --purs-args '--censor-lib --strict' # - name: Run tests - run: spago -x test.dhall test --no-install +# run: spago -x test.dhall test --no-install - name: Check formatting run: purs-tidy check src test From f7b0b9817e4f6c73a87b1416ea6045dab72a222d Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 12:44:59 -0500 Subject: [PATCH 11/11] Make psci-support dev dep --- bower.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bower.json b/bower.json index 89bff95..47b5645 100644 --- a/bower.json +++ b/bower.json @@ -18,11 +18,11 @@ "purescript-gen": "master", "purescript-math": "master", "purescript-maybe": "master", - "purescript-prelude": "master", - "purescript-psci-support": "master" + "purescript-prelude": "master" }, "devDependencies": { "purescript-effect": "master", + "purescript-psci-support": "master", "purescript-quickcheck": "master", "purescript-quickcheck-laws": "main" }