From 7441014b65478f971ecfc07f9980d9a63f0e2c5e Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Wed, 14 Oct 2026 23:26:23 +0000 Subject: [PATCH 1/8] Migrate Bower to Spago and modernize repository tooling --- .github/workflows/ci.yml | 31 +++++++++---------------------- .gitignore | 4 +++- .tidyrc.json | 10 ++++++++++ CHANGELOG.md | 2 ++ bower.json | 24 ------------------------ package.json | 15 ++++++++++----- spago.yaml | 12 ++++++++++++ 7 files changed, 46 insertions(+), 52 deletions(-) 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..811ea7f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,30 +6,17 @@ 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/setup-node@v2 + - uses: actions/checkout@v6 + - uses: actions/setup-node@v6 with: - node-version: "14.x" - - - name: Install dependencies - run: | - npm install -g bower - npm install - bower install --production - - - name: Build source - run: npm run-script build - - - name: Run tests - run: | - bower install - npm run-script test --if-present + node-version: "24" + - run: npm install + - run: npm run build + - run: npm run format:check diff --git a/.gitignore b/.gitignore index 7ebd961..c9c5856 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,9 @@ /.* !/.gitignore !/.github/ +!/.tidyrc.json /bower_components/ /node_modules/ /output/ -package-lock.json +/package-lock.json +/spago.lock 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 fb717fc..5da6b74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ Bugfixes: Other improvements: +- Migrate from Bower/Pulp to Spago and update CI and formatting. + ## [v6.0.0](https://github.com/purescript/purescript-maybe/releases/tag/v6.0.0) - 2022-04-27 Breaking changes: diff --git a/bower.json b/bower.json deleted file mode 100644 index a2ab363..0000000 --- a/bower.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "purescript-maybe", - "homepage": "https://github.com/purescript/purescript-maybe", - "license": "BSD-3-Clause", - "repository": { - "type": "git", - "url": "https://github.com/purescript/purescript-maybe.git" - }, - "ignore": [ - "**/.*", - "bower_components", - "node_modules", - "output", - "test", - "bower.json", - "package.json" - ], - "dependencies": { - "purescript-control": "^6.0.0", - "purescript-invariant": "^6.0.0", - "purescript-newtype": "^5.0.0", - "purescript-prelude": "^6.0.0" - } -} diff --git a/package.json b/package.json index 3e28704..5cb68a9 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,17 @@ { "private": true, + "license": "BSD-3-Clause", + "homepage": "https://github.com/purescript/purescript-maybe", + "repository": "github:purescript/purescript-maybe", "scripts": { - "clean": "rimraf output && rimraf .pulp-cache", - "build": "pulp build -- --censor-lib --strict" + "build": "spago build", + "format": "purs-tidy format-in-place src && oxfmt --write .", + "format:check": "purs-tidy check src && oxfmt --check ." }, "devDependencies": { - "pulp": "16.0.0-0", - "purescript-psa": "^0.8.2", - "rimraf": "^3.0.2" + "oxfmt": "^0.73.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..4207e86 --- /dev/null +++ b/spago.yaml @@ -0,0 +1,12 @@ +package: + name: maybe + description: Optional values + build: + strict: true + pedanticPackages: true + dependencies: + - control: ">=6.0.0 <7.0.0" + - invariant: ">=6.0.0 <7.0.0" + - newtype: ">=5.0.0 <6.0.0" + - prelude: ">=6.0.0 <7.0.0" +workspace: {} From b30eb9efb51f5fdca28672512a3a451e90c8189d Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Wed, 14 Oct 2026 23:27:13 +0000 Subject: [PATCH 2/8] Format repository with purs-tidy and Oxfmt --- CHANGELOG.md | 8 +++++++- package.json | 2 +- src/Data/Maybe.purs | 21 +++++++++++---------- src/Data/Maybe/First.purs | 1 - 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5da6b74..3f43660 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,10 +17,12 @@ Other improvements: ## [v6.0.0](https://github.com/purescript/purescript-maybe/releases/tag/v6.0.0) - 2022-04-27 Breaking changes: + - Update project and deps to PureScript v0.15.0 (#60 by @JordanMartinez) - Drop deprecated `MonadZero` instance (#61 by @JordanMartinez) New features: + - Added `Semiring` instance (#59) Bugfixes: @@ -30,15 +32,18 @@ Other improvements: ## [v5.0.0](https://github.com/purescript/purescript-maybe/releases/tag/v5.0.0) - 2021-02-26 Breaking changes: + - Added support for PureScript 0.14 and dropped support for all previous versions (#50) - Ported the `generics-rep` package's `Maybe` instance to this package (#55) New features: Bugfixes: + - Relaxed constraints on `optional`, which doesn't need the `Plus` part of `Alternative` (#47) Other improvements: + - Fixed documentation comment for the `Last` newtype, which omitted the constructor (#42) - Documented the relationship of `optional` to the left catch law (#52) - Demonstrated how `do` notation for `Maybe` is similar to nested if-then-else statements (#48) @@ -82,8 +87,9 @@ Other improvements: ## [v1.0.0](https://github.com/purescript/purescript-maybe/releases/tag/v1.0.0) - 2016-06-01 - Updated for PureScript 0.9.1 - + This release is intended for the PureScript 0.9.1 compiler and newer. **Note**: The v1.0.0 tag is not meant to indicate the library is “finished”, the core libraries are all being bumped to this for the 0.9 compiler release so as to use semver more correctly. + - Updated for new `Prelude` class hierarchies ## [v0.3.5](https://github.com/purescript/purescript-maybe/releases/tag/v0.3.5) - 2015-11-15 diff --git a/package.json b/package.json index 5cb68a9..8a28612 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": true, - "license": "BSD-3-Clause", "homepage": "https://github.com/purescript/purescript-maybe", + "license": "BSD-3-Clause", "repository": "github:purescript/purescript-maybe", "scripts": { "build": "spago build", diff --git a/src/Data/Maybe.purs b/src/Data/Maybe.purs index 743279b..d833e50 100644 --- a/src/Data/Maybe.purs +++ b/src/Data/Maybe.purs @@ -6,7 +6,6 @@ import Control.Alt (class Alt, (<|>)) import Control.Alternative (class Alternative) import Control.Extend (class Extend) import Control.Plus (class Plus) - import Data.Eq (class Eq1) import Data.Functor.Invariant (class Invariant, imapF) import Data.Generic.Rep (class Generic) @@ -31,7 +30,7 @@ data Maybe a = Nothing | Just a -- | ``` instance functorMaybe :: Functor Maybe where map fn (Just x) = Just (fn x) - map _ _ = Nothing + map _ _ = Nothing -- | The `Apply` instance allows functions contained within a `Just` to -- | transform a value contained within a `Just` using the `apply` operator: @@ -66,7 +65,7 @@ instance functorMaybe :: Functor Maybe where -- | ``` instance applyMaybe :: Apply Maybe where apply (Just fn) x = fn <$> x - apply Nothing _ = Nothing + apply Nothing _ = Nothing -- | The `Applicative` instance enables lifting of values into `Maybe` with the -- | `pure` function: @@ -101,7 +100,7 @@ instance applicativeMaybe :: Applicative Maybe where -- | ``` instance altMaybe :: Alt Maybe where alt Nothing r = r - alt l _ = l + alt l _ = l -- | The `Plus` instance provides a default `Maybe` value: -- | @@ -124,7 +123,7 @@ instance alternativeMaybe :: Alternative Maybe -- | ``` instance bindMaybe :: Bind Maybe where bind (Just x) k = k x - bind Nothing _ = Nothing + bind Nothing _ = Nothing -- | The `Monad` instance guarantees that there are both `Applicative` and -- | `Bind` instances for `Maybe`. This also enables the `do` syntactic sugar: @@ -162,8 +161,8 @@ instance monadMaybe :: Monad Maybe -- | f <<= x = Just (f x) -- | ``` instance extendMaybe :: Extend Maybe where - extend _ Nothing = Nothing - extend f x = Just (f x) + extend _ Nothing = Nothing + extend f x = Just (f x) instance invariantMaybe :: Invariant Maybe where imap = imapF @@ -202,7 +201,8 @@ instance semiringMaybe :: Semiring a => Semiring (Maybe a) where -- | type the `Maybe` contains. derive instance eqMaybe :: Eq a => Eq (Maybe a) -instance eq1Maybe :: Eq1 Maybe where eq1 = eq +instance eq1Maybe :: Eq1 Maybe where + eq1 = eq -- | The `Ord` instance allows `Maybe` values to be compared with -- | `compare`, `>`, `>=`, `<` and `<=` whenever there is an `Ord` instance for @@ -211,7 +211,8 @@ instance eq1Maybe :: Eq1 Maybe where eq1 = eq -- | `Nothing` is considered to be less than any `Just` value. derive instance ordMaybe :: Ord a => Ord (Maybe a) -instance ord1Maybe :: Ord1 Maybe where compare1 = compare +instance ord1Maybe :: Ord1 Maybe where + compare1 = compare instance boundedMaybe :: Bounded a => Bounded (Maybe a) where top = Just top @@ -222,7 +223,7 @@ instance boundedMaybe :: Bounded a => Bounded (Maybe a) where -- | contains. instance showMaybe :: Show a => Show (Maybe a) where show (Just x) = "(Just " <> show x <> ")" - show Nothing = "Nothing" + show Nothing = "Nothing" derive instance genericMaybe :: Generic (Maybe a) _ diff --git a/src/Data/Maybe/First.purs b/src/Data/Maybe/First.purs index 2641c5c..b4e59af 100644 --- a/src/Data/Maybe/First.purs +++ b/src/Data/Maybe/First.purs @@ -6,7 +6,6 @@ import Control.Alt (class Alt) import Control.Alternative (class Alternative) import Control.Extend (class Extend) import Control.Plus (class Plus) - import Data.Eq (class Eq1) import Data.Functor.Invariant (class Invariant) import Data.Maybe (Maybe(..)) From 162d5ffe4241e0ab400298623e0a9100caaf6292 Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Thu, 15 Oct 2026 00:01:41 +0000 Subject: [PATCH 3/8] Configure registry publication metadata --- spago.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spago.yaml b/spago.yaml index 4207e86..5e42b8f 100644 --- a/spago.yaml +++ b/spago.yaml @@ -4,6 +4,12 @@ package: build: strict: true pedanticPackages: true + publish: + version: 6.0.1 + license: BSD-3-Clause + location: + githubOwner: purescript + githubRepo: purescript-maybe dependencies: - control: ">=6.0.0 <7.0.0" - invariant: ">=6.0.0 <7.0.0" From db4bf4b6d56e8f71573ce1dc1ecf78a3d7c1a47e Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Thu, 15 Oct 2026 00:32:45 +0000 Subject: [PATCH 4/8] 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 3f43660..168645f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ Bugfixes: Other improvements: -- Migrate from Bower/Pulp to Spago and update CI and formatting. +- Migrate from Bower/Pulp to Spago and update CI and formatting (#65 by @thomashoneyman) ## [v6.0.0](https://github.com/purescript/purescript-maybe/releases/tag/v6.0.0) - 2022-04-27 From 53f7a6e7e8ce171a4ad502fe1ce60b67a3f13b1a Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Thu, 15 Oct 2026 00:44:41 +0000 Subject: [PATCH 5/8] Prepare versioned changelog for release --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 168645f..04bce7c 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-maybe/releases/tag/v6.0.1) Breaking changes: From f657c9835281fe522784357258e6adfc42057357 Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Thu, 15 Oct 2026 21:26:13 +0000 Subject: [PATCH 6/8] 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 04bce7c..924d178 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-maybe/releases/tag/v6.0.1) +## [Unreleased] + +Breaking changes: + +New features: + +Bugfixes: + +Other improvements: + +## [v6.0.1](https://github.com/purescript/purescript-maybe/releases/tag/v6.0.1) - 2026-10-17 Breaking changes: From 893f811955336dee35b2023894b0ea5b717667e8 Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Fri, 16 Oct 2026 18:20:23 +0000 Subject: [PATCH 7/8] Parenthesize typed values in Maybe documentation comparisons --- src/Data/Maybe.purs | 2 +- src/Data/Maybe/First.purs | 2 +- src/Data/Maybe/Last.purs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Data/Maybe.purs b/src/Data/Maybe.purs index d833e50..60fcccd 100644 --- a/src/Data/Maybe.purs +++ b/src/Data/Maybe.purs @@ -71,7 +71,7 @@ instance applyMaybe :: Apply Maybe where -- | `pure` function: -- | -- | ``` purescript --- | pure x :: Maybe _ == Just x +-- | (pure x :: Maybe _) == Just x -- | ``` -- | -- | Combining `Functor`'s `<$>` with `Apply`'s `<*>` and `Applicative`'s diff --git a/src/Data/Maybe/First.purs b/src/Data/Maybe/First.purs index b4e59af..d0ff551 100644 --- a/src/Data/Maybe/First.purs +++ b/src/Data/Maybe/First.purs @@ -18,7 +18,7 @@ import Data.Ord (class Ord1) -- | First (Just x) <> First (Just y) == First (Just x) -- | First Nothing <> First (Just y) == First (Just y) -- | First Nothing <> First Nothing == First Nothing --- | mempty :: First _ == First Nothing +-- | (mempty :: First _) == First Nothing -- | ``` newtype First a = First (Maybe a) diff --git a/src/Data/Maybe/Last.purs b/src/Data/Maybe/Last.purs index b70502c..2215256 100644 --- a/src/Data/Maybe/Last.purs +++ b/src/Data/Maybe/Last.purs @@ -18,7 +18,7 @@ import Data.Ord (class Ord1) -- | Last (Just x) <> Last (Just y) == Last (Just y) -- | Last (Just x) <> Last Nothing == Last (Just x) -- | Last Nothing <> Last Nothing == Last Nothing --- | mempty :: Last _ == Last Nothing +-- | (mempty :: Last _) == Last Nothing -- | ``` newtype Last a = Last (Maybe a) From 828250e721653a4e895eb1cd16eb0b9e2f6f8eea Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Sat, 17 Oct 2026 15:46:07 +0000 Subject: [PATCH 8/8] Link Unreleased changelog comparison --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 924d178..d517502 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -155,3 +155,5 @@ Other improvements: ## [v0.1.0](https://github.com/purescript/purescript-maybe/releases/tag/v0.1.0) - 2014-04-10 - Initial versioned release + +[Unreleased]: https://github.com/purescript/purescript-maybe/compare/v6.0.1...HEAD