Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions .eslintrc.json

This file was deleted.

33 changes: 11 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,19 @@ on:
branches: [master]
pull_request:

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
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/.*
!/.gitignore
!/.eslintrc.json
!/.oxfmtrc.json
!/.tidyrc.json
!/.github/
/bower_components/
/node_modules/
/output/
package-lock.json
/package-lock.json
/spago.lock
3 changes: 3 additions & 0 deletions .oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"trailingComma": "es5"
}
10 changes: 10 additions & 0 deletions .tidyrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"importSort": "ide",
"importWrap": "source",
"indent": 2,
"operatorsFile": null,
"ribbon": 1,
"typeArrowPlacement": "first",
"unicode": "never",
"width": null
}
34 changes: 29 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,54 @@

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-prelude/compare/v6.0.3...HEAD)

Breaking changes:

New features:

Bugfixes:
- Avoid `RangeError` in `arrayBind` foreign implementation (#314 by @pete-murphy)

Other improvements:

## [v6.0.3](https://github.com/purescript/purescript-prelude/releases/tag/v6.0.3) - 2026-10-17

Other improvements:

- Remove NaN tests for `Ord` and `Eq`; library behavior is unchanged (#316)
- Migrate from Bower/Pulp to Spago and modernize CI, linting, and formatting tools (#318 by @thomashoneyman)

## [v6.0.2](https://github.com/purescript/purescript-prelude/releases/tag/v6.0.2) - 2025-02-15

Bugfixes:

- Avoid `RangeError` in `arrayBind` foreign implementation (#314 by @pete-murphy)

## [v6.0.1](https://github.com/purescript/purescript-prelude/releases/tag/v6.0.1) - 2022-08-18

Other improvements:

- Documentation: Clarify relationship between `Ord` and `Eq` (#298 by @JamieBallingall)
- Remove array allocation and local array FFI from the `Show` instance for records. (#299 by @ajnsit)

## [v6.0.0](https://github.com/purescript/purescript-prelude/releases/tag/v6.0.0) - 2022-04-27

Breaking changes:

- Migrated FFI to ES Modules (#287 by @kl0tl and @JordanMartinez)
- Change Generic Rep's `NoConstructors` to newtype `Void` (#282 by @JordanMartinez)
- Replaced polymorphic proxies with monomorphic `Proxy` (#281, #288 by @JordanMartinez)
- Fix `signum zero` to return `zero` (#280 by @JordanMartinez)
- Fix `Show` instance on records with duplicate labels by adding `Nub` constraint (#269 by @JordanMartinez)

New features:

- Added the `Data.Reflectable` module for type reflection (#289 by @PureFunctor)

Bugfixes:

Other improvements:

- Changed `unit`'s FFI representation from `{}` to `undefined` (#267 by @JordanMartinez)
- Added clearer docs for Prelude module (#270 by @JordanMartinez)
- Clarify docs for `flip` (#271 by @JordanMartinez)
Expand All @@ -44,28 +60,33 @@ Other improvements:
## [v5.0.1](https://github.com/purescript/purescript-prelude/releases/tag/v5.0.1) - 2021-05-11

Other improvements:

- Fix warnings revealed by `v0.14.1` PS release (#262 by @JordanMartinez)

## [v5.0.0](https://github.com/purescript/purescript-prelude/releases/tag/v5.0.0) - 2021-02-26

Breaking changes:

- Support compiler version `v0.14.0`, and drop support for previous versions (#206, #226)
- `purescript-proxy` was ported to this repo (#230)
- `purescript-generics-rep` was ported to this repo (#235)
- Move the `Applicative` Superclass law from `Monad` to `Bind` and rename it
to the `Apply` Superclass law (#229)
to the `Apply` Superclass law (#229)
- Removed `unsafeCompare` (#257)

New features:

- Added `Bounded` instance for records (#208)
- Added `Show` instances to `Data.Generics.Rep` types (#250)
- Added `toRep` (#238)

Bugfixes:

- No longer use reference equality check in `Array`'s `Eq` instance because it breaks referential transparency (#187).
- Fix Ring laws (#228)

Documentation improvements:

- Added `lift2` example using `Maybe` (#213)
- Added `const` example (#214)
- Added `power` example (#253)
Expand All @@ -74,6 +95,7 @@ Documentation improvements:
- Fix typo: 'ommitted' -> 'omitted' (#220)

Other improvements:

- Migrated to GitHub Actions (#234)
- Added a `CHANGELOG.md` file and PR template (#254)

Expand Down Expand Up @@ -121,8 +143,8 @@ Remove unused `refIneq` function (@metaleap)

## [v3.1.0](https://github.com/purescript/purescript-prelude/releases/tag/v3.1.0) - 2017-06-27

* Fixes for out-of-date documentation (@joneshf, @matthewleon)
* Add a new `DivisionRing` class
- Fixes for out-of-date documentation (@joneshf, @matthewleon)
- Add a new `DivisionRing` class

## [v3.0.0](https://github.com/purescript/purescript-prelude/releases/tag/v3.0.0) - 2017-03-25

Expand Down Expand Up @@ -157,10 +179,12 @@ Remove unused `refIneq` function (@metaleap)
## [v2.0.0](https://github.com/purescript/purescript-prelude/releases/tag/v2.0.0) - 2016-09-26

**Breaking changes**

- Fixed `=<<` to be right associative, as originally intended
- Changed behaviour of `Eq` and `Ord` for `NaN` numeric value #91 (@berdario)

**Enhancements**

- Updated docs to include notes about the non-law-abiding numeric instances
- Semigroup `append` for `Array` will no longer shallow copy the array if either side is empty #63 (suggested by @natefaubion)

Expand Down
19 changes: 0 additions & 19 deletions bower.json

This file was deleted.

23 changes: 16 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
{
"private": true,
"homepage": "https://github.com/purescript/purescript-prelude",
"license": "BSD-3-Clause",
"repository": {
"type": "git",
"url": "https://github.com/purescript/purescript-prelude.git"
},
"scripts": {
"clean": "rimraf output && rimraf .pulp-cache",
"build": "eslint src && 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": {
"eslint": "^7.15.0",
"purescript-psa": "^0.8.2",
"pulp": "16.0.0-0",
"rimraf": "^3.0.2"
"oxfmt": "^0.73.0",
"oxlint": "^1.88.0",
"purescript": "^0.15.16",
"purs-tidy": "^0.11.1",
Comment thread
thomashoneyman marked this conversation as resolved.
"spago": "^1.0.5"
}
}
19 changes: 19 additions & 0 deletions spago.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package:
name: prelude
description: The PureScript Prelude
build:
strict: true
pedanticPackages: true
publish:
version: 6.0.3
license: BSD-3-Clause
location:
githubOwner: purescript
githubRepo: purescript-prelude
dependencies: []
test:
main: Test.Main
strict: true
pedanticPackages: true
dependencies: []
workspace: {}
1 change: 0 additions & 1 deletion src/Control/Applicative.purs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ module Control.Applicative
) where

import Control.Apply (class Apply, apply, (*>), (<*), (<*>))

import Data.Functor (class Functor, map, void, ($>), (<#>), (<$), (<$>))
import Data.Unit (Unit, unit)
import Type.Proxy (Proxy(..))
Expand Down
5 changes: 4 additions & 1 deletion src/Control/Apply.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ export const arrayApply = function (fs) {
return function (xs) {
var l = fs.length;
var k = xs.length;
var result = new Array(l*k);
// Allocate the result array at its final size; the loop below fills it,
// so initializing every slot first would do the work twice.
// oxlint-disable-next-line unicorn/no-new-array
var result = new Array(l * k);
var n = 0;
for (var i = 0; i < l; i++) {
var f = fs[i];
Expand Down
4 changes: 2 additions & 2 deletions src/Control/Apply.purs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ module Control.Apply
, module Data.Functor
) where

import Data.Functor (class Functor, map, void, ($>), (<#>), (<$), (<$>))
import Data.Function (const)
import Control.Category (identity)
import Data.Function (const)
import Data.Functor (class Functor, map, void, ($>), (<#>), (<$), (<$>))
import Type.Proxy (Proxy(..))

-- | The `Apply` class provides the `(<*>)` which is used to apply a function
Expand Down
30 changes: 15 additions & 15 deletions src/Control/Bind.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
export const arrayBind =
typeof Array.prototype.flatMap === "function"
? function (arr) {
return function (f) {
return arr.flatMap(f);
};
}
return function (f) {
return arr.flatMap(f);
};
}
: function (arr) {
return function (f) {
var result = [];
var l = arr.length;
for (var i = 0; i < l; i++) {
var xs = f(arr[i]);
var k = xs.length;
for (var j = 0; j < k; j++) {
result.push(xs[j]);
return function (f) {
var result = [];
var l = arr.length;
for (var i = 0; i < l; i++) {
var xs = f(arr[i]);
var k = xs.length;
for (var j = 0; j < k; j++) {
result.push(xs[j]);
}
}
}
return result;
return result;
};
};
};
1 change: 0 additions & 1 deletion src/Control/Bind.purs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ module Control.Bind
import Control.Applicative (class Applicative, liftA1, pure, unless, when)
import Control.Apply (class Apply, apply, (*>), (<*), (<*>))
import Control.Category (identity)

import Data.Function (flip)
import Data.Functor (class Functor, map, void, ($>), (<#>), (<$), (<$>))
import Data.Unit (Unit)
Expand Down
1 change: 0 additions & 1 deletion src/Control/Monad.purs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ module Control.Monad
import Control.Applicative (class Applicative, liftA1, pure, unless, when)
import Control.Apply (class Apply, apply, (*>), (<*), (<*>))
import Control.Bind (class Bind, bind, ifM, join, (<=<), (=<<), (>=>), (>>=))

import Data.Functor (class Functor, map, void, ($>), (<#>), (<$), (<$>))
import Data.Unit (Unit)
import Type.Proxy (Proxy)
Expand Down
2 changes: 1 addition & 1 deletion src/Data/BooleanAlgebra.purs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Data.BooleanAlgebra
, class BooleanAlgebraRecord
) where

import Data.HeytingAlgebra (class HeytingAlgebra, class HeytingAlgebraRecord, ff, tt, implies, conj, disj, not, (&&), (||))
import Data.HeytingAlgebra (class HeytingAlgebra, class HeytingAlgebraRecord, conj, disj, ff, implies, not, tt, (&&), (||))
import Data.Symbol (class IsSymbol)
import Data.Unit (Unit)
import Prim.Row as Row
Expand Down
3 changes: 2 additions & 1 deletion src/Data/Eq/Generic.purs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ module Data.Eq.Generic
, genericEq
) where

import Prelude (class Eq, (==), (&&))
import Data.Generic.Rep

import Prelude (class Eq, (&&), (==))

class GenericEq a where
genericEq' :: a -> a -> Boolean

Expand Down
Loading
Loading