diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c69237a..b8f3066 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,30 +6,18 @@ 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 test + - 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 73022e2..82c4955 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-either/compare/v6.1.1...HEAD) Breaking changes: @@ -12,14 +12,28 @@ Bugfixes: Other improvements: +## [v6.1.1](https://github.com/purescript/purescript-either/releases/tag/v6.1.1) - 2026-10-17 + +Breaking changes: + +New features: + +Bugfixes: + +Other improvements: + +- Migrate from Bower/Pulp to Spago and update CI and formatting tools (#72 by @thomashoneyman) + ## [v6.1.0](https://github.com/purescript/purescript-either/releases/tag/v6.1.0) - 2022-05-16 New features: + - Add `blush` which is a left-biased `hush`, thus turns `Right`s into `Nothing`s but `Left`s into `Just`s (#69 by @i-am-the-slime). ## [v6.0.0](https://github.com/purescript/purescript-either/releases/tag/v6.0.0) - 2022-04-27 Breaking changes: + - Update project and deps to PureScript v0.15.0 (#66 by @JordanMartinez) New features: @@ -31,10 +45,12 @@ Other improvements: ## [v5.0.0](https://github.com/purescript/purescript-either/releases/tag/v5.0.0) - 2021-02-26 Breaking changes: + - Added support for PureScript 0.14 and dropped support for all previous versions (#55) - Added default parameter to `fromLeft` and `fromRight` and removed `Partial` constraint (#48) New features: + - Added `\/` alias for `either` (#51) - Added lazy versions of `fromRight` and `fromLeft` (#59) - This package no longer depends on the `purescript-bifunctors` and `purescript-foldable-traversable` packages. Relevant instances have been moved to those packages. (#64) @@ -42,6 +58,7 @@ New features: Bugfixes: Other improvements: + - Migrated CI to GitHub Actions and updated installation instructions to use Spago (#58) - Added a CHANGELOG.md file and pull request template (#62, #63) - Corrected docs for `Apply` instance (#49) @@ -138,8 +155,6 @@ Update docs ## [v0.1.4](https://github.com/purescript/purescript-either/releases/tag/v0.1.4) - 2014-11-05 - - ## [v0.1.3](https://github.com/purescript/purescript-either/releases/tag/v0.1.3) - 2014-08-26 Add `Alt` instance @@ -150,6 +165,4 @@ Add `Alt` instance ## [v0.1.1](https://github.com/purescript/purescript-either/releases/tag/v0.1.1) - 2014-04-25 - - ## [v0.1.0](https://github.com/purescript/purescript-either/releases/tag/v0.1.0) - 2014-04-21 diff --git a/bower.json b/bower.json deleted file mode 100644 index 6e9638d..0000000 --- a/bower.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "purescript-either", - "homepage": "https://github.com/purescript/purescript-either", - "license": "BSD-3-Clause", - "repository": { - "type": "git", - "url": "https://github.com/purescript/purescript-either.git" - }, - "ignore": [ - "**/.*", - "bower_components", - "node_modules", - "output", - "test", - "bower.json", - "package.json" - ], - "dependencies": { - "purescript-control": "^6.0.0", - "purescript-invariant": "^6.0.0", - "purescript-maybe": "^6.0.0", - "purescript-prelude": "^6.0.0" - }, - "devDependencies": { - "purescript-assert": "^6.0.0", - "purescript-console": "^6.0.0", - "purescript-effect": "^4.0.0" - } -} diff --git a/package.json b/package.json index c8e10e0..eab7815 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,20 @@ { "private": true, + "license": "BSD-3-Clause", + "repository": { + "type": "git", + "url": "https://github.com/purescript/purescript-either.git" + }, "scripts": { - "clean": "rimraf output && rimraf .pulp-cache", - "build": "pulp build -- --censor-lib --strict", - "test": "pulp test" + "build": "spago build", + "test": "spago 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": "^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..439b973 --- /dev/null +++ b/spago.yaml @@ -0,0 +1,26 @@ +package: + name: either + description: Values with two alternatives, commonly used for errors and successes + build: + strict: true + pedanticPackages: true + publish: + version: 6.1.1 + license: BSD-3-Clause + location: + githubOwner: purescript + githubRepo: purescript-either + dependencies: + - control: ">=6.0.0 <7.0.0" + - invariant: ">=6.0.0 <7.0.0" + - maybe: ">=6.0.0 <7.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" + - console: ">=6.0.0 <7.0.0" + - effect: ">=4.0.0 <5.0.0" +workspace: {} diff --git a/src/Data/Either.purs b/src/Data/Either.purs index 3940d93..0ccfefd 100644 --- a/src/Data/Either.purs +++ b/src/Data/Either.purs @@ -104,7 +104,7 @@ instance applicativeEither :: Applicative (Either e) where -- | ``` instance altEither :: Alt (Either e) where alt (Left _) r = r - alt l _ = l + alt l _ = l -- | The `Bind` instance allows sequencing of `Either` values and functions that -- | return an `Either` by using the `>>=` operator: @@ -164,8 +164,8 @@ instance monadEither :: Monad (Either e) -- | f <<= Right x = Right (f (Right x)) -- | ``` instance extendEither :: Extend (Either e) where - extend _ (Left y) = Left y - extend f x = Right (f x) + extend _ (Left y) = Left y + extend f x = Right (f x) -- | The `Show` instance allows `Either` values to be rendered as a string with -- | `show` whenever there is an `Show` instance for both type the `Either` can diff --git a/src/Data/Either/Nested.purs b/src/Data/Either/Nested.purs index f4ee931..a6d9281 100644 --- a/src/Data/Either/Nested.purs +++ b/src/Data/Either/Nested.purs @@ -17,11 +17,48 @@ -- | toEither3 (Blue v) = in3 v -- | ``` module Data.Either.Nested - ( type (\/), (\/) - , in1, in2, in3, in4, in5, in6, in7, in8, in9, in10 - , at1, at2, at3, at4, at5, at6, at7, at8, at9, at10 - , Either1, Either2, Either3, Either4, Either5, Either6, Either7, Either8, Either9, Either10 - , either1, either2, either3, either4, either5, either6, either7, either8, either9, either10 + ( type (\/) + , (\/) + , in1 + , in2 + , in3 + , in4 + , in5 + , in6 + , in7 + , in8 + , in9 + , in10 + , at1 + , at2 + , at3 + , at4 + , at5 + , at6 + , at7 + , at8 + , at9 + , at10 + , Either1 + , Either2 + , Either3 + , Either4 + , Either5 + , Either6 + , Either7 + , Either8 + , Either9 + , Either10 + , either1 + , either2 + , either3 + , either4 + , either5 + , either6 + , either7 + , either8 + , either9 + , either10 ) where import Data.Either (Either(..), either) diff --git a/test/Main.purs b/test/Main.purs index c878a67..d9517b7 100644 --- a/test/Main.purs +++ b/test/Main.purs @@ -27,13 +27,11 @@ main = do , expected: in3 100 } log "Test injection with the injectReflexive instance" + let x = inj 100 :: MySum assertEqual - let - x = inj 100 :: MySum - in - { actual: inj x :: MySum - , expected: x - } + { actual: inj x :: MySum + , expected: x + } log "Test that injection picks the left-most option" assertEqual { actual: inj 100 :: Either3 Int Int Int