diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c69237a..6d95f29 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,30 +6,19 @@ 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 lint + - 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 484cd08..2910724 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-control/compare/v6.0.1...HEAD) Breaking changes: @@ -12,9 +12,22 @@ Bugfixes: Other improvements: +## [v6.0.1](https://github.com/purescript/purescript-control/releases/tag/v6.0.1) - 2026-10-17 + +Breaking changes: + +New features: + +Bugfixes: + +Other improvements: + +- Migrate from Bower/Pulp to Spago and update CI, linting, and formatting (#84 by @thomashoneyman) + ## [v6.0.0](https://github.com/purescript/purescript-control/releases/tag/v6.0.0) - 2022-04-27 Breaking changes: + - Migrate FFI to ES modules (#78 by @kl0tl and @JordanMartinez) - Drop deprecated `MonadZero` instance (#76 by @JordanMartinez) - Make `<|>` right associative (#80 by @JordanMartinez) @@ -28,17 +41,19 @@ Other improvements: ## [v5.0.0](https://github.com/purescript/purescript-control/releases/tag/v5.0.0) - 2021-02-26 Breaking changes: - - Added support for PureScript 0.14 and dropped support for all previous versions (#61) - - Deprecated `MonadZero` (#64, #66, #68, #70) + +- Added support for PureScript 0.14 and dropped support for all previous versions (#61) +- Deprecated `MonadZero` (#64, #66, #68, #70) New features: Bugfixes: Other improvements: - - Migrated CI to GitHub Actions and updated installation instructions to use Spago (#65) - - Added a CHANGELOG.md file and pull request template (#72, #73) - - Added examples for `Alt` (#58) + +- Migrated CI to GitHub Actions and updated installation instructions to use Spago (#65) +- Added a CHANGELOG.md file and pull request template (#72, #73) +- Added examples for `Alt` (#58) ## [v4.2.0](https://github.com/purescript/purescript-control/releases/tag/v4.2.0) - 2019-09-05 @@ -50,7 +65,7 @@ Added `Newtype` instance for `Alternate` (@masaeedu) ## [v4.0.0](https://github.com/purescript/purescript-control/releases/tag/v4.0.0) - 2018-05-22 -- Updated for PureScript 0.12 +- Updated for PureScript 0.12 - The definition of `fix` was fixed to allow sharing ## [v3.3.1](https://github.com/purescript/purescript-control/releases/tag/v3.3.1) - 2017-09-21 @@ -146,6 +161,3 @@ Update docs (@hdgarrood) - Now uses "proper" `Unit` type instead of `{}` (garyb) ## [v0.1.0](https://github.com/purescript/purescript-control/releases/tag/v0.1.0) - 2014-04-25 - - - diff --git a/bower.json b/bower.json deleted file mode 100644 index 12505c1..0000000 --- a/bower.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "purescript-control", - "homepage": "https://github.com/purescript/purescript-control", - "license": "BSD-3-Clause", - "repository": { - "type": "git", - "url": "https://github.com/purescript/purescript-control.git" - }, - "ignore": [ - "**/.*", - "bower_components", - "node_modules", - "output", - "test", - "bower.json", - "package.json" - ], - "dependencies": { - "purescript-newtype": "^5.0.0", - "purescript-prelude": "^6.0.0" - }, - "devDependencies": { - "purescript-effect": "^4.0.0" - } -} diff --git a/package.json b/package.json index c8e10e0..7e708ee 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,20 @@ { "private": true, + "homepage": "https://github.com/purescript/purescript-control", + "license": "BSD-3-Clause", + "repository": "github:purescript/purescript-control", "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": "^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..c13556d --- /dev/null +++ b/spago.yaml @@ -0,0 +1,22 @@ +package: + name: control + description: Utility functions and classes for Functor, Applicative, and Monad hierarchies + build: + strict: true + pedanticPackages: true + publish: + version: 6.0.1 + license: BSD-3-Clause + location: + githubOwner: purescript + githubRepo: purescript-control + dependencies: + - newtype: ">=5.0.0 <6.0.0" + - prelude: ">=6.0.0 <7.0.0" + test: + main: Test.Main + strict: true + pedanticPackages: true + dependencies: + - effect: ">=4.0.0 <5.0.0" +workspace: {} diff --git a/src/Control/Alt.purs b/src/Control/Alt.purs index a813270..6a852eb 100644 --- a/src/Control/Alt.purs +++ b/src/Control/Alt.purs @@ -1,5 +1,7 @@ module Control.Alt - ( class Alt, alt, (<|>) + ( class Alt + , alt + , (<|>) , module Data.Functor ) where @@ -26,7 +28,7 @@ import Data.Semigroup (append) -- | -- | ```purescript -- | import Control.Alt ((<|>)) --- | import Data.Maybe (Maybe(..) +-- | import Data.Maybe (Maybe(..)) -- | import Data.Either (Either(..)) -- | -- | Nothing <|> Just 1 <|> Just 2 == Just 1 diff --git a/src/Control/Alternative.purs b/src/Control/Alternative.purs index 5bec9c7..e263ad1 100644 --- a/src/Control/Alternative.purs +++ b/src/Control/Alternative.purs @@ -9,12 +9,11 @@ module Control.Alternative ) where import Control.Alt (class Alt, alt, (<|>)) -import Control.Applicative (class Applicative, pure, liftA1, unless, when) +import Control.Applicative (class Applicative, liftA1, pure, unless, when) import Control.Apply (class Apply, apply, (*>), (<*), (<*>)) import Control.Plus (class Plus, empty) - -import Data.Unit (Unit, unit) import Data.Functor (class Functor, map, void, ($>), (<#>), (<$), (<$>)) +import Data.Unit (Unit, unit) -- | The `Alternative` type class has no members of its own; it just specifies -- | that the type constructor has both `Applicative` and `Plus` instances. diff --git a/src/Control/Comonad.purs b/src/Control/Comonad.purs index d471e2d..c65299b 100644 --- a/src/Control/Comonad.purs +++ b/src/Control/Comonad.purs @@ -1,11 +1,11 @@ module Control.Comonad - ( class Comonad, extract + ( class Comonad + , extract , module Control.Extend , module Data.Functor ) where import Control.Extend (class Extend, duplicate, extend, (<<=), (=<=), (=>=), (=>>)) - import Data.Functor (class Functor, map, void, ($>), (<#>), (<$), (<$>)) -- | `Comonad` extends the `Extend` class with the `extract` function diff --git a/src/Control/Extend.js b/src/Control/Extend.js index 3c8ac86..2b8241b 100644 --- a/src/Control/Extend.js +++ b/src/Control/Extend.js @@ -1,5 +1,5 @@ -export const arrayExtend = function(f) { - return function(xs) { +export const arrayExtend = function (f) { + return function (xs) { return xs.map(function (_, i, xs) { return f(xs.slice(i)); }); diff --git a/src/Control/Extend.purs b/src/Control/Extend.purs index 367ccd5..3f15a74 100644 --- a/src/Control/Extend.purs +++ b/src/Control/Extend.purs @@ -1,13 +1,18 @@ module Control.Extend - ( class Extend, extend, (<<=), extendFlipped, (=>>) - , composeCoKleisli, (=>=) - , composeCoKleisliFlipped, (=<=) + ( class Extend + , extend + , (<<=) + , extendFlipped + , (=>>) + , composeCoKleisli + , (=>=) + , composeCoKleisliFlipped + , (=<=) , duplicate , module Data.Functor ) where import Control.Category (identity) - import Data.Functor (class Functor, map, void, ($>), (<#>), (<$), (<$>)) import Data.Semigroup (class Semigroup, (<>)) diff --git a/src/Control/Lazy.purs b/src/Control/Lazy.purs index 3434d09..de3eb2a 100644 --- a/src/Control/Lazy.purs +++ b/src/Control/Lazy.purs @@ -22,4 +22,4 @@ instance lazyUnit :: Lazy Unit where fix :: forall l. Lazy l => (l -> l) -> l fix f = go where - go = defer \_ -> f go + go = defer \_ -> f go diff --git a/src/Control/MonadPlus.purs b/src/Control/MonadPlus.purs index 83f71ab..50960c3 100644 --- a/src/Control/MonadPlus.purs +++ b/src/Control/MonadPlus.purs @@ -12,12 +12,11 @@ module Control.MonadPlus import Control.Alt (class Alt, alt, (<|>)) import Control.Alternative (class Alternative, guard) -import Control.Applicative (class Applicative, pure, liftA1, unless, when) +import Control.Applicative (class Applicative, liftA1, pure, unless, when) import Control.Apply (class Apply, apply, (*>), (<*), (<*>)) import Control.Bind (class Bind, bind, ifM, join, (<=<), (=<<), (>=>), (>>=)) import Control.Monad (class Monad, ap, liftM1) import Control.Plus (class Plus, empty) - import Data.Functor (class Functor, map, void, ($>), (<#>), (<$), (<$>)) -- | The `MonadPlus` type class has no members of its own; it just specifies diff --git a/src/Control/Plus.purs b/src/Control/Plus.purs index f8724ea..ce8dfe5 100644 --- a/src/Control/Plus.purs +++ b/src/Control/Plus.purs @@ -1,11 +1,11 @@ module Control.Plus - ( class Plus, empty + ( class Plus + , empty , module Control.Alt , module Data.Functor ) where import Control.Alt (class Alt, alt, (<|>)) - import Data.Functor (class Functor, map, void, ($>), (<#>), (<$), (<$>)) -- | The `Plus` type class extends the `Alt` type class with a value that diff --git a/src/Data/Monoid/Alternate.purs b/src/Data/Monoid/Alternate.purs index 9a16f1e..de86cc8 100644 --- a/src/Data/Monoid/Alternate.purs +++ b/src/Data/Monoid/Alternate.purs @@ -2,7 +2,7 @@ module Data.Monoid.Alternate where import Prelude -import Control.Alternative (class Alt, class Plus, class Alternative, empty, (<|>)) +import Control.Alternative (class Alt, class Alternative, class Plus, empty, (<|>)) import Control.Comonad (class Comonad, class Extend) import Data.Eq (class Eq1) import Data.Newtype (class Newtype) diff --git a/test/Test/Main.purs b/test/Test/Main.purs index 32756eb..c3e9da2 100644 --- a/test/Test/Main.purs +++ b/test/Test/Main.purs @@ -1,8 +1,7 @@ module Test.Main (main) where -import Effect (Effect) import Data.Unit (Unit) - +import Effect (Effect) import Test.Control.Lazy (testLazy) main :: Effect Unit