Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: purescript/purescript-prelude
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.0.0
Choose a base ref
...
head repository: purescript/purescript-prelude
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 3,016 additions and 373 deletions.
  1. +26 −0 .eslintrc.json
  2. +12 −0 .github/PULL_REQUEST_TEMPLATE.md
  3. +34 −0 .github/workflows/ci.yml
  4. +3 −3 .gitignore
  5. +0 −17 .jscsrc
  6. +0 −20 .jshintrc
  7. +0 −23 .travis.yml
  8. +232 −0 CHANGELOG.md
  9. +22 −16 LICENSE
  10. +4 −4 README.md
  11. +2 −2 bower.json
  12. +6 −6 package.json
  13. +14 −8 src/Control/Applicative.purs
  14. +8 −7 src/Control/Apply.js
  15. +32 −6 src/Control/Apply.purs
  16. +20 −10 src/Control/Bind.js
  17. +54 −7 src/Control/Bind.purs
  18. +6 −4 src/Control/Category.purs
  19. +28 −5 src/Control/Monad.purs
  20. +2 −1 src/Control/Semigroupoid.purs
  21. +24 −1 src/Data/BooleanAlgebra.purs
  22. +6 −5 src/Data/Bounded.js
  23. +60 −1 src/Data/Bounded.purs
  24. +56 −0 src/Data/Bounded/Generic.purs
  25. +23 −1 src/Data/CommutativeRing.purs
  26. +55 −0 src/Data/DivisionRing.purs
  27. +7 −9 src/Data/Eq.js
  28. +67 −8 src/Data/Eq.purs
  29. +35 −0 src/Data/Eq/Generic.purs
  30. +12 −10 src/Data/EuclideanRing.js
  31. +64 −11 src/Data/EuclideanRing.purs
  32. +26 −9 src/Data/Field.purs
  33. +37 −6 src/Data/Function.purs
  34. +1 −3 src/Data/Functor.js
  35. +21 −11 src/Data/Functor.purs
  36. +62 −0 src/Data/Generic/Rep.purs
  37. +3 −5 src/Data/HeytingAlgebra.js
  38. +104 −3 src/Data/HeytingAlgebra.purs
  39. +70 −0 src/Data/HeytingAlgebra/Generic.purs
  40. +120 −0 src/Data/Monoid.purs
  41. +44 −0 src/Data/Monoid/Additive.purs
  42. +51 −0 src/Data/Monoid/Conj.purs
  43. +51 −0 src/Data/Monoid/Disj.purs
  44. +44 −0 src/Data/Monoid/Dual.purs
  45. +30 −0 src/Data/Monoid/Endo.purs
  46. +27 −0 src/Data/Monoid/Generic.purs
  47. +44 −0 src/Data/Monoid/Multiplicative.purs
  48. +4 −3 src/Data/NaturalTransformation.purs
  49. +18 −2 src/Data/Ord.js
  50. +124 −23 src/Data/Ord.purs
  51. +39 −0 src/Data/Ord/Generic.purs
  52. +0 −13 src/Data/Ord/Unsafe.js
  53. +0 −15 src/Data/Ord/Unsafe.purs
  54. +1 −1 src/Data/Ordering.purs
  55. +5 −0 src/Data/Reflectable.js
  56. +57 −0 src/Data/Reflectable.purs
  57. +2 −4 src/Data/Ring.js
  58. +47 −4 src/Data/Ring.purs
  59. +24 −0 src/Data/Ring/Generic.purs
  60. +2 −4 src/Data/Semigroup.js
  61. +51 −2 src/Data/Semigroup.purs
  62. +40 −0 src/Data/Semigroup/First.purs
  63. +31 −0 src/Data/Semigroup/Generic.purs
  64. +40 −0 src/Data/Semigroup/Last.purs
  65. +4 −6 src/Data/Semiring.js
  66. +88 −4 src/Data/Semiring.purs
  67. +51 −0 src/Data/Semiring/Generic.purs
  68. +7 −9 src/Data/Show.js
  69. +63 −1 src/Data/Show.purs
  70. +5 −0 src/Data/Show/Generic.js
  71. +57 −0 src/Data/Show/Generic.purs
  72. +6 −0 src/Data/Symbol.js
  73. +24 −0 src/Data/Symbol.purs
  74. +1 −3 src/Data/Unit.js
  75. +5 −8 src/Data/Unit.purs
  76. +26 −5 src/Data/Void.purs
  77. +20 −4 src/Prelude.purs
  78. +38 −0 src/Record/Unsafe.js
  79. +27 −0 src/Record/Unsafe.purs
  80. +53 −0 src/Type/Proxy.purs
  81. +222 −0 test/Data/Generic/Rep.purs
  82. +27 −27 test/Test/Main.js
  83. +143 −13 test/Test/Main.purs
  84. +5 −0 test/Test/Utils.js
  85. +10 −0 test/Test/Utils.purs
26 changes: 26 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"extends": "eslint:recommended",
"rules": {
"strict": [2, "global"],
"block-scoped-var": 2,
"consistent-return": 2,
"eqeqeq": [2, "smart"],
"guard-for-in": 2,
"no-caller": 2,
"no-extend-native": 2,
"no-loop-func": 2,
"no-new": 2,
"no-param-reassign": 2,
"no-return-assign": 2,
"no-unused-expressions": 2,
"no-use-before-define": 2,
"radix": [2, "always"],
"indent": [2, 2, { "SwitchCase": 1 }],
"quotes": [2, "double"],
"semi": [2, "always"]
}
}
12 changes: 12 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
**Description of the change**

Clearly and concisely describe the purpose of the pull request. If this PR relates to an existing issue or change proposal, please link to it. Include any other background context that would help reviewers understand the motivation for this PR.

---

**Checklist:**

- [ ] Added the change to the changelog's "Unreleased" section with a reference to this PR (e.g. "- Made a change (#0000)")
- [ ] Linked any existing issues or proposals that this pull request should close
- [ ] Updated or added relevant documentation
- [ ] Added a test for the contribution (if applicable)
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on:
push:
branches: [master]
pull_request:

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
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
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/.*
!/.gitignore
!/.jscsrc
!/.jshintrc
!/.travis.yml
!/.eslintrc.json
!/.github/
/bower_components/
/node_modules/
/output/
package-lock.json
17 changes: 0 additions & 17 deletions .jscsrc

This file was deleted.

20 changes: 0 additions & 20 deletions .jshintrc

This file was deleted.

23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

232 changes: 232 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
# Changelog

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:
- Avoid `RangeError` in `arrayBind` foreign implementation (#314 by @pete-murphy)

Other improvements:

## [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)
- Add comment that `Number` is not a fully law abiding instance of `Ord` (#277 by @JamieBallingall)
- The internal FFI function `join` in `Data.Show` has been renamed to `intercalate` to
match the same function in `Data.Show.Generic` (#274 by @cdepillabout)

## [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)
- 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)
- Clarify `Array`'s do notation and the purposes of `Monoid` and `Semigroup` newtypes (#217)
- Clarify `Unit` representation in FFI code (#223)
- Fix typo: 'ommitted' -> 'omitted' (#220)

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

## [v4.1.1](https://github.com/purescript/purescript-prelude/releases/tag/v4.1.1) - 2019-04-20

- Added documentation fixes/improvements to `Data.Monoid.Conj` and other `Data.Monoid` newtypes (#191, #192)
- Made `Eq` and `Ord` instances for primitive types less JavaScript-specific (#183)

## [v4.1.0](https://github.com/purescript/purescript-prelude/releases/tag/v4.1.0) - 2018-07-17

- Added `Ord` instance for records

## [v4.0.1](https://github.com/purescript/purescript-prelude/releases/tag/v4.0.1) - 2018-06-07

- Performance improvement for `Array` equality, now performs a reference check before comparing contents (@jazmit)

## [v4.0.0](https://github.com/purescript/purescript-prelude/releases/tag/v4.0.0) - 2018-05-22

This version is for PureScript v0.12.x.

**Breaking changes**

- `id` has been renamed to `identity`
- The modulo and division behaviour for integers is now based on Euclidean division. Functions implementing the old `div`/`mod` behaviour are available as `quot`/`rem` in [`purescript-integers`](https://github.com/purescript/purescript-integers). (#161, #168)
- The definition of `Field` has been altered. It is no longer necessary to provide an instance for this, there is a single instance now for every type that implements `EuclideanRing` and `DivisionRing` .

**Other changes**

- `Monoid` has been moved into the prelude
- `Data.Symbol` has been moved into the prelude
- `RProxy` and `RLProxy` have been moved into the prelude
- There are now various instances available for records: `Eq`, `Show`, `Semigroup`, `Monoid`, `Semiring`... etc. (@i-am-tom)

## [v3.3.0](https://github.com/purescript/purescript-prelude/releases/tag/v3.3.0) - 2018-04-13

- Added `Data.Function.applyN` for repeatedly applying a function to an initial value (@matthewleon)

## [v3.2.0](https://github.com/purescript/purescript-prelude/releases/tag/v3.2.0) - 2018-04-07

- Added `Bounded` instance for `Number` (@erisco)

## [v3.1.1](https://github.com/purescript/purescript-prelude/releases/tag/v3.1.1) - 2017-11-01

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

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

- Updated for PureScript 0.11
- Removed incorrect `EuclideanRing Unit` and `Field Unit` instances

## [v2.5.0](https://github.com/purescript/purescript-prelude/releases/tag/v2.5.0) - 2017-03-02

- Added `Eq1` and `Ord1` classes

## [v2.4.0](https://github.com/purescript/purescript-prelude/releases/tag/v2.4.0) - 2017-02-13

- Add the new `Discard` class to support https://github.com/purescript/purescript/pull/2653
- Fixes a corner case in the `degree` function for `Int`.
- Documentation fixes

## [v2.3.0](https://github.com/purescript/purescript-prelude/releases/tag/v2.3.0) - 2017-01-29

- Added `gcd` and `lcm` for any `EuclideanRing`.
- Fixed some issues with the `EuclideanRing` laws. The `Unit` instance is no longer valid, but is being kept around temporarily for the sake of backwards compatibility.

## [v2.2.0](https://github.com/purescript/purescript-prelude/releases/tag/v2.2.0) - 2017-01-26

- Added instances of the form `C b => C (a -> b)` for `Semiring`, `Ring`, `CommutativeRing`, `BooleanAlgebra`
- Added some documentation for the `Void` type (@chexxor)
- Fixed documentation typos (@mlang, @thoradam)

## [v2.1.0](https://github.com/purescript/purescript-prelude/releases/tag/v2.1.0) - 2016-09-30

- Added `whenM` and `unlessM` variants of `when` and `unless` for situations where the conditional is also in `m`

## [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)

## [v1.1.0](https://github.com/purescript/purescript-prelude/releases/tag/v1.1.0) - 2016-09-26

- Added `flap` and corresponding `<@>` operator (@joneshf)

## [v1.0.1](https://github.com/purescript/purescript-prelude/releases/tag/v1.0.1) - 2016-06-07

- A redundant `CommutativeRing` constraint was removed from `Field`, the `EuclideanRing` constraint already implies `CommutativeRing`.

## [v1.0.0](https://github.com/purescript/purescript-prelude/releases/tag/v1.0.0) - 2016-06-01

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.

## [v1.0.0-rc.6](https://github.com/purescript/purescript-prelude/releases/tag/v1.0.0-rc.6) - 2016-05-23

- Added `Data.NaturalTransformation` with a synonym and type operator alias for natural transformations

## [v1.0.0-rc.5](https://github.com/purescript/purescript-prelude/releases/tag/v1.0.0-rc.5) - 2016-05-22

- Added general `abs` and `signum` for types that with `Ord` and `Ring` instances (@hdgarrood)

## [v1.0.0-rc.4](https://github.com/purescript/purescript-prelude/releases/tag/v1.0.0-rc.4) - 2016-05-19

- Various fixes

## [v0.1.5](https://github.com/purescript/purescript-prelude/releases/tag/v0.1.5) - 2016-03-30

- Fixes invalid escape sequence in `Show` (@michaelficarra, #65)

## [v1.0.0-rc.3](https://github.com/purescript/purescript-prelude/releases/tag/v1.0.0-rc.3) - 2016-03-30

- Fixed escaping in `Show` #65

## [v1.0.0-rc.2](https://github.com/purescript/purescript-prelude/releases/tag/v1.0.0-rc.2) - 2016-03-20

- Reworked the hierarchy for number classes to resolve some issues with the laws and admit new instances #61
- Introduced `HeytingAlgebra` as a superclass of `BooleanAlgebra` #62

## [v1.0.0-rc.1](https://github.com/purescript/purescript-prelude/releases/tag/v1.0.0-rc.1) - 2016-02-29

- Release candidate for the psc 0.8+ prelude

## [v0.1.4](https://github.com/purescript/purescript-prelude/releases/tag/v0.1.4) - 2016-01-27

- Fixed the escaping used in `Show` for `Char` and `String` (@michaelficarra)

## [v0.1.3](https://github.com/purescript/purescript-prelude/releases/tag/v0.1.3) - 2015-10-13

Move `Int` bounds to foreign module (@andyarvanitis)

## [v0.1.2](https://github.com/purescript/purescript-prelude/releases/tag/v0.1.2) - 2015-08-13

Add `Bounded Char` instance (@garyb)

## [v0.1.1](https://github.com/purescript/purescript-prelude/releases/tag/v0.1.1) - 2015-07-26

Export `unsafeCompare`

## [v0.1.0](https://github.com/purescript/purescript-prelude/releases/tag/v0.1.0) - 2015-06-30

This release works with versions 0.7.\* of the PureScript compiler. It will not work with older versions. If you are using an older version, you should require an older, compatible version of this library.

## [v0.1.0-rc.1](https://github.com/purescript/purescript-prelude/releases/tag/v0.1.0-rc.1) - 2015-06-06

Initial release candidate.
Loading