From 74529717b9a39ad95ea0619d8f8a63810cc86917 Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Thu, 15 Oct 2026 00:49:00 +0000 Subject: [PATCH 1/5] Migrate to Spago and update repository tooling --- .github/workflows/ci.yml | 30 +++++++++++++++--------------- .gitignore | 5 ++++- .oxfmtrc.json | 3 +++ .tidyrc.json | 10 ++++++++++ CHANGELOG.md | 10 +++------- bower.json | 34 ---------------------------------- package.json | 16 ++++++++++------ spago.yaml | 31 +++++++++++++++++++++++++++++++ 8 files changed, 76 insertions(+), 63 deletions(-) create mode 100644 .oxfmtrc.json create mode 100644 .tidyrc.json delete mode 100644 bower.json create mode 100644 spago.yaml 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 7ebd961..6f7e45c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,10 @@ /.* !/.gitignore !/.github/ +!/.tidyrc.json +!/.oxfmtrc.json /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 c9c5e23..1c35c5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,16 +2,12 @@ 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: - -New features: - -Bugfixes: +## [v7.0.1](https://github.com/purescript/purescript-parallel/releases/tag/v7.0.1) Other improvements: +- Migrate from Bower/Pulp to Spago and update CI, linting, and formatting. + ## [v7.0.0](https://github.com/purescript/purescript-parallel/releases/tag/v7.0.0) - 2023-08-24 Breaking changes: diff --git a/bower.json b/bower.json deleted file mode 100644 index c808fef..0000000 --- a/bower.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "purescript-parallel", - "license": "BSD-3-Clause", - "repository": { - "type": "git", - "url": "https://github.com/purescript/purescript-parallel.git" - }, - "ignore": [ - "**/.*", - "bower_components", - "node_modules", - "output", - "test", - "bower.json", - "package.json" - ], - "dependencies": { - "purescript-control": "^6.0.0", - "purescript-effect": "^4.0.0", - "purescript-either": "^6.0.0", - "purescript-foldable-traversable": "^6.0.0", - "purescript-functors": "^5.0.0", - "purescript-maybe": "^6.0.0", - "purescript-newtype": "^5.0.0", - "purescript-prelude": "^6.0.0", - "purescript-profunctor": "^6.0.0", - "purescript-refs": "^6.0.0", - "purescript-transformers": "^6.0.0" - }, - "devDependencies": { - "purescript-console": "^6.0.0", - "purescript-functions": "^6.0.0" - } -} diff --git a/package.json b/package.json index 4d84152..c0a8ad2 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,17 @@ { "private": true, "scripts": { - "clean": "rimraf output && rimraf .pulp-cache", - "build": "pulp build -- --censor-lib --strict", - "test": "pulp test" + "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": { - "pulp": "16.0.0-0", - "purescript-psa": "^0.8.2", - "rimraf": "^2.6.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..ec25127 --- /dev/null +++ b/spago.yaml @@ -0,0 +1,31 @@ +package: + name: parallel + description: Classes for parallel composition and racing of asynchronous computations. + build: + strict: true + pedanticPackages: true + publish: + version: 7.0.1 + license: BSD-3-Clause + location: + githubOwner: purescript + githubRepo: purescript-parallel + dependencies: + - control: ">=6.0.0 <7.0.0" + - effect: ">=4.0.0 <5.0.0" + - either: ">=6.0.0 <7.0.0" + - foldable-traversable: ">=6.0.0 <7.0.0" + - functors: ">=5.0.0 <6.0.0" + - maybe: ">=6.0.0 <7.0.0" + - newtype: ">=5.0.0 <6.0.0" + - prelude: ">=6.0.0 <7.0.0" + - profunctor: ">=6.0.0 <7.0.0" + - refs: ">=6.0.0 <7.0.0" + - transformers: ">=6.0.0 <7.0.0" + test: + main: Test.Main + strict: true + pedanticPackages: true + dependencies: + - console: ">=6.0.0 <7.0.0" +workspace: {} From 669e9930d42e58a6867817c8e190ae242c87fc5f Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Thu, 15 Oct 2026 00:50:10 +0000 Subject: [PATCH 2/5] Format sources and documentation --- CHANGELOG.md | 9 +++++++-- src/Control/Parallel.purs | 13 ++++++------- src/Control/Parallel/Class.purs | 22 ++++++++++------------ test/Main.js | 28 +++++++++++++++------------- test/Main.purs | 12 ++++++------ 5 files changed, 44 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c35c5c..f21345e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,27 +11,32 @@ Other improvements: ## [v7.0.0](https://github.com/purescript/purescript-parallel/releases/tag/v7.0.0) - 2023-08-24 Breaking changes: -- Remove `Monad` and `Applicative` constraints on the `Parallel` class. Both -types now only require `Apply`. (#43 by @artemisSystem) +- Remove `Monad` and `Applicative` constraints on the `Parallel` class. Both + types now only require `Apply`. (#43 by @artemisSystem) ## [v6.0.0](https://github.com/purescript/purescript-parallel/releases/tag/v6.0.0) - 2022-04-27 Breaking changes: + - Update project and deps to PureScript v0.15.0 (#41 by @JordanMartinez) ## [v5.0.0](https://github.com/purescript/purescript-parallel/releases/tag/v5.0.0) - 2021-02-26 Breaking changes: + - Added support for PureScript 0.14 and dropped support for all previous versions (#37) New features: + - Added instances for `Star` and `Costar` (#28) Bugfixes: + - Fixed documentation typo: arguement -> argument (#33) Other improvements: + - Migrated CI to GitHub Actions and updated installation instructions to use Spago (#36) - Replaced dead URI in tests (#32) - Added a changelog and pull request template (#37) diff --git a/src/Control/Parallel.purs b/src/Control/Parallel.purs index 0a15b2b..8f56086 100644 --- a/src/Control/Parallel.purs +++ b/src/Control/Parallel.purs @@ -12,19 +12,18 @@ module Control.Parallel import Prelude import Control.Alternative (class Alternative) -import Control.Parallel.Class (class Parallel, parallel, sequential, ParCont(..)) - -import Data.Foldable (class Foldable, traverse_, oneOfMap) +import Control.Parallel.Class (class Parallel, ParCont(..), parallel, sequential) +import Data.Foldable (class Foldable, oneOfMap, traverse_) import Data.Traversable (class Traversable, traverse) -- | Apply a function to an argument under a type constructor in parallel. parApply :: forall f m a b . Parallel f m - => m (a -> b) - -> m a - -> m b -parApply mf ma = sequential(apply (parallel mf) (parallel ma)) + => m (a -> b) + -> m a + -> m b +parApply mf ma = sequential (apply (parallel mf) (parallel ma)) -- | Traverse a collection in parallel. parTraverse diff --git a/src/Control/Parallel/Class.purs b/src/Control/Parallel/Class.purs index 0ad36d5..1dad280 100644 --- a/src/Control/Parallel/Class.purs +++ b/src/Control/Parallel/Class.purs @@ -7,8 +7,8 @@ import Control.Alternative (class Alternative) import Control.Monad.Cont.Trans (ContT(..), runContT) import Control.Monad.Except.Trans (ExceptT(..)) import Control.Monad.Maybe.Trans (MaybeT(..)) -import Control.Monad.Reader.Trans (mapReaderT, ReaderT) -import Control.Monad.Writer.Trans (mapWriterT, WriterT) +import Control.Monad.Reader.Trans (ReaderT, mapReaderT) +import Control.Monad.Writer.Trans (WriterT, mapWriterT) import Control.Plus (class Plus) import Data.Either (Either) import Data.Functor.Compose (Compose(..)) @@ -99,19 +99,17 @@ instance altParCont :: MonadEffect m => Alt (ParCont m) where runContT c1 \a -> do b <- liftEffect (Ref.read done) - if b - then pure unit - else do - liftEffect (Ref.write true done) - k a + if b then pure unit + else do + liftEffect (Ref.write true done) + k a runContT c2 \a -> do b <- liftEffect (Ref.read done) - if b - then pure unit - else do - liftEffect (Ref.write true done) - k a + if b then pure unit + else do + liftEffect (Ref.write true done) + k a instance plusParCont :: MonadEffect m => Plus (ParCont m) where empty = ParCont $ ContT \_ -> pure unit diff --git a/test/Main.js b/test/Main.js index 5e69ad2..bb58237 100644 --- a/test/Main.js +++ b/test/Main.js @@ -1,18 +1,20 @@ import http from "http"; export function getImpl(opts) { - return function(done) { - return function() { - http.request(opts, function(res) { - var body = ''; - res.setEncoding('utf8'); - res.on('data', function (s) { - body += s; - }); - res.on('end', function () { - done(body)(); - }); - }).end(); - }; + return function (done) { + return function () { + http + .request(opts, function (res) { + var body = ""; + res.setEncoding("utf8"); + res.on("data", function (s) { + body += s; + }); + res.on("end", function () { + done(body)(); + }); + }) + .end(); }; + }; } diff --git a/test/Main.purs b/test/Main.purs index 325eb43..64bf9c8 100644 --- a/test/Main.purs +++ b/test/Main.purs @@ -23,9 +23,9 @@ request host = Request { host: host, path: "/" } main :: Effect Unit main = runContT (parTraverse (get <<< request) resources) logShow where - resources :: Array String - resources = - [ "www.purescript.org" - , "try.purescript.org" - , "discourse.purescript.org" - ] + resources :: Array String + resources = + [ "www.purescript.org" + , "try.purescript.org" + , "discourse.purescript.org" + ] From 4284e7536eaa29cdf86a558cf5961fe945c77a47 Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Thu, 15 Oct 2026 00:52:14 +0000 Subject: [PATCH 3/5] Credit the migration pull request --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f21345e..6c357d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ Notable changes to this project are documented in this file. The format is based 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 (#44 by @thomashoneyman). ## [v7.0.0](https://github.com/purescript/purescript-parallel/releases/tag/v7.0.0) - 2023-08-24 From 96cbc206e748b1e0ea918d36976c249feedf2c52 Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Thu, 15 Oct 2026 01:02:37 +0000 Subject: [PATCH 4/5] Keep parallel race branches on separate lines --- src/Control/Parallel/Class.purs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Control/Parallel/Class.purs b/src/Control/Parallel/Class.purs index 1dad280..2114c91 100644 --- a/src/Control/Parallel/Class.purs +++ b/src/Control/Parallel/Class.purs @@ -99,14 +99,16 @@ instance altParCont :: MonadEffect m => Alt (ParCont m) where runContT c1 \a -> do b <- liftEffect (Ref.read done) - if b then pure unit + if b then + pure unit else do liftEffect (Ref.write true done) k a runContT c2 \a -> do b <- liftEffect (Ref.read done) - if b then pure unit + if b then + pure unit else do liftEffect (Ref.write true done) k a From fe56a9f4542331aa3cddfcd004fd7d212c229b9d Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Thu, 15 Oct 2026 21:26:16 +0000 Subject: [PATCH 5/5] Restore Unreleased changelog template and date proposed release --- CHANGELOG.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c357d2..59b7002 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). -## [v7.0.1](https://github.com/purescript/purescript-parallel/releases/tag/v7.0.1) +## [Unreleased] + +Breaking changes: + +New features: + +Bugfixes: + +Other improvements: + +## [v7.0.1](https://github.com/purescript/purescript-parallel/releases/tag/v7.0.1) - 2026-10-17 Other improvements: