From dd8da31bdd9345804a51aebe2bce3e262fb42313 Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Wed, 14 Oct 2026 23:47:14 +0000 Subject: [PATCH 1/9] Migrate repository tooling and CI to Spago --- .eslintrc.json | 26 -------------------------- .github/workflows/ci.yml | 30 +++++++++++++++--------------- .gitignore | 6 ++++-- .oxfmtrc.json | 3 +++ .tidyrc.json | 10 ++++++++++ CHANGELOG.md | 2 ++ bower.json | 25 ------------------------- package.json | 17 ++++++++++------- spago.yaml | 15 +++++++++++++++ 9 files changed, 59 insertions(+), 75 deletions(-) delete mode 100644 .eslintrc.json create mode 100644 .oxfmtrc.json create mode 100644 .tidyrc.json delete mode 100644 bower.json create mode 100644 spago.yaml diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 1c6afb9..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "parserOptions": { - "ecmaVersion": 6, - "sourceType": "module" - }, - "extends": "eslint:recommended", - "rules": { - "strict": [2, "global"], - "block-scoped-var": 2, - "consistent-return": 2, - "eqeqeq": [2, "smart"], - "guard-for-in": 2, - "no-caller": 2, - "no-extend-native": 2, - "no-loop-func": 2, - "no-new": 2, - "no-param-reassign": 2, - "no-return-assign": 2, - "no-unused-expressions": 2, - "no-use-before-define": 2, - "radix": [2, "always"], - "indent": [2, 2], - "quotes": [2, "double"], - "semi": [2, "always"] - } -} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c69237a..1a2a70b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,30 +6,30 @@ on: pull_request: branches: [master] +permissions: + contents: read + jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - - uses: purescript-contrib/setup-purescript@main - with: - purescript: "unstable" + - uses: actions/checkout@v6 - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v6 with: - node-version: "14.x" + node-version: "24" - name: Install dependencies - run: | - npm install -g bower - npm install - bower install --production + run: npm install - name: Build source - run: npm run-script build + run: npm run build - name: Run tests - run: | - bower install - npm run-script test --if-present + run: npm test + + - name: Lint + run: npm run lint + + - name: Check formatting + run: npm run format:check diff --git a/.gitignore b/.gitignore index b846b63..7ddb3b1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,10 @@ /.* !/.gitignore -!/.eslintrc.json +!/.tidyrc.json +!/.oxfmtrc.json !/.github/ /bower_components/ /node_modules/ /output/ -package-lock.json +/package-lock.json +/spago.lock diff --git a/.oxfmtrc.json b/.oxfmtrc.json new file mode 100644 index 0000000..757fd64 --- /dev/null +++ b/.oxfmtrc.json @@ -0,0 +1,3 @@ +{ + "trailingComma": "es5" +} diff --git a/.tidyrc.json b/.tidyrc.json new file mode 100644 index 0000000..9e39cf1 --- /dev/null +++ b/.tidyrc.json @@ -0,0 +1,10 @@ +{ + "importSort": "ide", + "importWrap": "source", + "indent": 2, + "operatorsFile": null, + "ribbon": 1, + "typeArrowPlacement": "first", + "unicode": "never", + "width": null +} diff --git a/CHANGELOG.md b/CHANGELOG.md index be2766a..510535d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ Bugfixes: Other improvements: +- Migrate from Bower/Pulp to Spago and update CI, linting, and formatting. + ## [v6.0.0](https://github.com/purescript/purescript-refs/releases/tag/v6.0.0) - 2022-04-27 Breaking changes: diff --git a/bower.json b/bower.json deleted file mode 100644 index 29763ef..0000000 --- a/bower.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "purescript-refs", - "homepage": "https://github.com/purescript/purescript-refs", - "license": "BSD-3-Clause", - "repository": { - "type": "git", - "url": "https://github.com/purescript/purescript-refs.git" - }, - "ignore": [ - "**/.*", - "bower_components", - "node_modules", - "output", - "test", - "bower.json", - "package.json" - ], - "dependencies": { - "purescript-effect": "^4.0.0", - "purescript-prelude": "^6.0.0" - }, - "devDependencies": { - "purescript-assert": "^6.0.0" - } -} diff --git a/package.json b/package.json index e6d4187..c0a8ad2 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,17 @@ { "private": true, "scripts": { - "clean": "rimraf output && rimraf .pulp-cache", - "test": "pulp test", - "build": "eslint src && pulp build -- --censor-lib --strict" + "build": "spago build", + "test": "spago test", + "lint": "oxlint --deny-warnings src test", + "format": "purs-tidy format-in-place src test && oxfmt --write .", + "format:check": "purs-tidy check src test && oxfmt --check ." }, "devDependencies": { - "eslint": "^7.15.0", - "pulp": "16.0.0-0", - "purescript-psa": "^0.8.2", - "rimraf": "^3.0.2" + "oxfmt": "^0.73.0", + "oxlint": "^1.88.0", + "purescript": "^0.15.16", + "purs-tidy": "^0.11.1", + "spago": "^1.0.5" } } diff --git a/spago.yaml b/spago.yaml new file mode 100644 index 0000000..e85146f --- /dev/null +++ b/spago.yaml @@ -0,0 +1,15 @@ +package: + name: refs + build: + strict: true + pedanticPackages: true + dependencies: + - effect: ">=4.0.0 <5.0.0" + - prelude: ">=6.0.0 <7.0.0" + test: + main: Test.Main + strict: true + pedanticPackages: true + dependencies: + - assert: ">=6.0.0 <7.0.0" +workspace: {} From 19053e1e5bb74a55fbe08782e816ce2950e506ae Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Wed, 14 Oct 2026 23:47:34 +0000 Subject: [PATCH 2/9] Format repository with purs-tidy and Oxfmt --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 510535d..d54d372 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ Other improvements: ## [v6.0.0](https://github.com/purescript/purescript-refs/releases/tag/v6.0.0) - 2022-04-27 Breaking changes: + - Migrate FFI to ES modules (#39 by @kl0tl and @JordanMartinez) New features: @@ -28,18 +29,21 @@ Other improvements: ## [v5.0.0](https://github.com/purescript/purescript-refs/releases/tag/v5.0.0) - 2021-02-26 Breaking changes: + - Added support for PureScript 0.14 and dropped support for all previous versions (#29) New features: + - Allow the construction of self-referential `Ref`s (#21) - Add roles declarations to allow safe coercions (#29) Bugfixes: Other improvements: + - Add some examples and tests and update documentation (#19, #20, #31) - Remove primes from foreign module exports in preparation for ES modules (#24) -- Remove `return {}` from FFI implementations for a small performance boost (#27) +- Remove `return {}` from FFI implementations for a small performance boost (#27) - Migrated CI to GitHub Actions and updated installation instructions to use Spago (#33) - Added a changelog and pull request template (#34, #35) From a76755c2950700f189204f235c07e9fbbbe4a399 Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Wed, 14 Oct 2026 23:58:49 +0000 Subject: [PATCH 3/9] Add registry publication metadata --- spago.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spago.yaml b/spago.yaml index e85146f..916091b 100644 --- a/spago.yaml +++ b/spago.yaml @@ -3,6 +3,12 @@ package: build: strict: true pedanticPackages: true + publish: + version: 6.0.1 + license: BSD-3-Clause + location: + githubOwner: purescript + githubRepo: purescript-refs dependencies: - effect: ">=4.0.0 <5.0.0" - prelude: ">=6.0.0 <7.0.0" From 58b01a5c222c8ae879cbe7fd3648f256aac3fe14 Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Thu, 15 Oct 2026 00:32:45 +0000 Subject: [PATCH 4/9] Credit migration pull request in changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d54d372..884e727 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ Bugfixes: Other improvements: -- Migrate from Bower/Pulp to Spago and update CI, linting, and formatting. +- Migrate from Bower/Pulp to Spago and update CI, linting, and formatting (#42 by @thomashoneyman) ## [v6.0.0](https://github.com/purescript/purescript-refs/releases/tag/v6.0.0) - 2022-04-27 From de9adbf5c70243adf0ea5dd7b642e659f00e86a8 Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Thu, 15 Oct 2026 00:44:50 +0000 Subject: [PATCH 5/9] Prepare versioned changelog for release --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 884e727..d528ebc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ 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] +## [v6.0.1](https://github.com/purescript/purescript-refs/releases/tag/v6.0.1) Breaking changes: From a206b5e5e6f34808ba436e7b10b8baacd24b9360 Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Thu, 15 Oct 2026 21:26:18 +0000 Subject: [PATCH 6/9] Prepare changelog release date and unreleased section --- CHANGELOG.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d528ebc..8b6868d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,17 @@ 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). -## [v6.0.1](https://github.com/purescript/purescript-refs/releases/tag/v6.0.1) +## [Unreleased] + +Breaking changes: + +New features: + +Bugfixes: + +Other improvements: + +## [v6.0.1](https://github.com/purescript/purescript-refs/releases/tag/v6.0.1) - 2026-10-17 Breaking changes: From 53b240a1221cd7734dfb7374838ae17480a8aa81 Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Thu, 15 Oct 2026 21:33:07 +0000 Subject: [PATCH 7/9] Describe the library in Spago metadata --- spago.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/spago.yaml b/spago.yaml index 916091b..f53db29 100644 --- a/spago.yaml +++ b/spago.yaml @@ -1,5 +1,6 @@ package: name: refs + description: Functions for creating, reading, and updating mutable references build: strict: true pedanticPackages: true From 442a9ae2175c55ca29bd9029e34c5ba5e37976da Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Fri, 16 Oct 2026 19:18:13 +0000 Subject: [PATCH 8/9] Clarify reference modification and test assertions --- src/Effect/Ref.purs | 4 +++- test/Main.purs | 10 ++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Effect/Ref.purs b/src/Effect/Ref.purs index 115238e..465c9df 100644 --- a/src/Effect/Ref.purs +++ b/src/Effect/Ref.purs @@ -63,7 +63,9 @@ foreign import modifyImpl :: forall s b. (s -> { state :: s, value :: b }) -> Re -- | Update the value of a mutable reference by applying a function -- | to the current value. The updated value is returned. modify :: forall s. (s -> s) -> Ref s -> Effect s -modify f = modify' \s -> let s' = f s in { state: s', value: s' } +modify f = modify' \s -> do + let s' = f s + { state: s', value: s' } -- | A version of `modify` which does not return the updated value. modify_ :: forall s. (s -> s) -> Ref s -> Effect Unit diff --git a/test/Main.purs b/test/Main.purs index ded958f..c45635a 100644 --- a/test/Main.purs +++ b/test/Main.purs @@ -43,12 +43,10 @@ selfRef = do -- Modify the `ref` and check that value in `ref'` changes Ref.modify_ (\(RefBox r) -> RefBox (r { value = 1 })) ref - assertEqual - <<< { expected: 1, actual: _ } - =<< (Ref.read ref' <#> \(RefBox { value }) -> value) + value1 <- Ref.read ref' <#> \(RefBox { value }) -> value + assertEqual { expected: 1, actual: value1 } -- Modify the `ref'` and check that value in `ref` changes Ref.modify_ (\(RefBox r) -> RefBox (r { value = 2 })) ref' - assertEqual - <<< { expected: 2, actual: _ } - =<< (Ref.read ref <#> \(RefBox { value }) -> value) + value2 <- Ref.read ref <#> \(RefBox { value }) -> value + assertEqual { expected: 2, actual: value2 } From ae6e189bdb81a9cd5d8d0becf929b1347f76d59c Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Sat, 17 Oct 2026 15:46:05 +0000 Subject: [PATCH 9/9] Link unreleased changelog comparison --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b6868d..3dcedc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ 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] +## [Unreleased](https://github.com/purescript/purescript-refs/compare/v6.0.1...HEAD) Breaking changes: