From 2f12ae835aafd8f5c0cc70d5abdd4dfb0eeebb7b Mon Sep 17 00:00:00 2001 From: JordanMartinez Date: Sat, 5 Dec 2020 07:21:56 -0800 Subject: [PATCH 01/11] Add lazy versions of fromRight and fromLeft (#59) --- src/Data/Either.purs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Data/Either.purs b/src/Data/Either.purs index 65cc805..3d3d0a2 100644 --- a/src/Data/Either.purs +++ b/src/Data/Either.purs @@ -280,6 +280,15 @@ fromLeft :: forall a b. a -> Either a b -> a fromLeft _ (Left a) = a fromLeft default _ = default +-- | Similar to `fromLeft` but for use in cases where the default value may be +-- | expensive to compute. As PureScript is not lazy, the standard `fromLeft` +-- | has to evaluate the default value before returning the result, +-- | whereas here the value is only computed when the `Either` is known +-- | to be `Right`. +fromLeft' :: forall a b. (Unit -> a) -> Either a b -> a +fromLeft' _ (Left a) = a +fromLeft' default _ = default unit + -- | A function that extracts the value from the `Right` data constructor. -- | The first argument is a default value, which will be returned in the -- | case where a `Left` is passed to `fromRight`. @@ -287,6 +296,15 @@ fromRight :: forall a b. b -> Either a b -> b fromRight _ (Right b) = b fromRight default _ = default +-- | Similar to `fromRight` but for use in cases where the default value may be +-- | expensive to compute. As PureScript is not lazy, the standard `fromRight` +-- | has to evaluate the default value before returning the result, +-- | whereas here the value is only computed when the `Either` is known +-- | to be `Left`. +fromRight' :: forall a b. (Unit -> b) -> Either a b -> b +fromRight' _ (Right b) = b +fromRight' default _ = default unit + -- | Takes a default and a `Maybe` value, if the value is a `Just`, turn it into -- | a `Right`, if the value is a `Nothing` use the provided default as a `Left` -- | From 9f6d4915995d018f0eb4a0001c0706017cf4c9e7 Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Mon, 7 Dec 2020 19:20:32 -0800 Subject: [PATCH 02/11] Run CI on push / pull_request to master --- .github/workflows/ci.yml | 6 +++++- README.md | 1 + package.json | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e2972ba..55efa3d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,10 @@ name: CI -on: push +on: + push: + branches: [master] + pull_request: + branches: [master] jobs: build: diff --git a/README.md b/README.md index 84f8cbd..b361259 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Latest release](http://img.shields.io/github/release/purescript/purescript-either.svg)](https://github.com/purescript/purescript-either/releases) [![Build status](https://github.com/purescript/purescript-either/workflows/CI/badge.svg?branch=master)](https://github.com/purescript/purescript-either/actions?query=workflow%3ACI+branch%3Amaster) +[![Pursuit](https://pursuit.purescript.org/packages/purescript-either/badge)](https://pursuit.purescript.org/packages/purescript-either) The `Either` type provides is used to represent values that can be one of two possibilities. For example, `Either Int Number` can be used in a place where either integers or floating point numbers are acceptable. diff --git a/package.json b/package.json index 1fac874..d3602c1 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,6 @@ "devDependencies": { "pulp": "^15.0.0", "purescript-psa": "^0.8.0", - "rimraf": "^2.6.2" + "rimraf": "^3.0.2" } } From b54e375dda9d5ec5fa3908ad0ccb560c7c56b949 Mon Sep 17 00:00:00 2001 From: JordanMartinez Date: Thu, 24 Dec 2020 10:13:27 -0800 Subject: [PATCH 03/11] Complete PR adding Generic instance for Either (#61) * Derive Generic instance for Either * Remove dependency on generics-rep Co-authored-by: Paul Young <84700+paulyoung@users.noreply.github.com> --- src/Data/Either.purs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Data/Either.purs b/src/Data/Either.purs index 3d3d0a2..5b5d78e 100644 --- a/src/Data/Either.purs +++ b/src/Data/Either.purs @@ -12,6 +12,7 @@ import Data.Foldable (class Foldable) import Data.FoldableWithIndex (class FoldableWithIndex) import Data.Functor.Invariant (class Invariant, imapF) import Data.FunctorWithIndex (class FunctorWithIndex) +import Data.Generic.Rep (class Generic) import Data.Maybe (Maybe(..), maybe, maybe') import Data.Ord (class Ord1) import Data.Traversable (class Traversable) @@ -40,6 +41,8 @@ derive instance functorEither :: Functor (Either a) instance functorWithIndexEither :: FunctorWithIndex Unit (Either a) where mapWithIndex f = map $ f unit +derive instance genericEither :: Generic (Either a b) _ + instance invariantEither :: Invariant (Either a) where imap = imapF From daa0575eaade6a99cf8c27c975ac8c22a4f75218 Mon Sep 17 00:00:00 2001 From: JordanMartinez Date: Sun, 10 Jan 2021 14:56:04 -0800 Subject: [PATCH 04/11] Generate changelog and add PR template (#62) * Generate CHANGELOG.md file using notes from previous GH releases * Add pull request template * Update CI in PS to v0.14.0-rc5 --- .github/PULL_REQUEST_TEMPLATE.md | 12 +++ .github/workflows/ci.yml | 2 +- CHANGELOG.md | 123 +++++++++++++++++++++++++++++++ 3 files changed, 136 insertions(+), 1 deletion(-) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 CHANGELOG.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..4435abb --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -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) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 55efa3d..f4f44e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: - uses: purescript-contrib/setup-purescript@main with: - purescript: "0.14.0-rc3" + purescript: "0.14.0-rc5" - uses: actions/setup-node@v1 with: diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c3ba1b5 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,123 @@ +# 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: + +Other improvements: + +## [v4.1.1](https://github.com/purescript/purescript-either/releases/tag/v4.1.1) - 2018-11-30 + +Reordered instance chain for `Inject` so that `inj :: a -> a` succeeds (@hdgarrood) + +## [v4.1.0](https://github.com/purescript/purescript-either/releases/tag/v4.1.0) - 2018-10-28 + +Added `FunctorWithIndex`, `FoldableWithIndex`, `TraversableWithIndex` instances (@MonoidMusician) + +## [v4.0.0](https://github.com/purescript/purescript-either/releases/tag/v4.0.0) - 2018-05-23 + +- Updated for PureScript 0.12 +- Added `\/` type synonym to `Data.Either.Nested` +- Added `Inject` class for injecting values into/projecting values out of nested `Eithers` + +## [v3.2.0](https://github.com/purescript/purescript-either/releases/tag/v3.2.0) - 2018-04-15 + +- Added `note'` (lazy `note`) (@matthewleon) + +## [v3.1.0](https://github.com/purescript/purescript-either/releases/tag/v3.1.0) - 2017-06-23 + +- Added `note` and `hush` functions (@kRITZCREEK) + +## [v3.0.0](https://github.com/purescript/purescript-either/releases/tag/v3.0.0) - 2017-03-26 + +- Updated for PureScript 0.11 + +## [v2.2.1](https://github.com/purescript/purescript-either/releases/tag/v2.2.1) - 2017-03-05 + +- Fix lower bound of prelude dependency (@passy) + +## [v2.2.0](https://github.com/purescript/purescript-either/releases/tag/v2.2.0) - 2017-03-02 + +- Added `Eq1` and `Ord1` instances + +## [v2.1.0](https://github.com/purescript/purescript-either/releases/tag/v2.1.0) - 2016-12-24 + +Add `choose` function (@tmcgilchrist) + +## [v2.0.0](https://github.com/purescript/purescript-either/releases/tag/v2.0.0) - 2016-10-03 + +- Updated dependencies +- The `Nested` module has been reworked for "open" nesting #20 (@natefaubion) + +## [v1.0.0](https://github.com/purescript/purescript-either/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.1](https://github.com/purescript/purescript-either/releases/tag/v1.0.0-rc.1) - 2016-03-13 + +- Release candidate for the psc 0.8+ core libraries + +## [v0.2.3](https://github.com/purescript/purescript-either/releases/tag/v0.2.3) - 2015-09-26 + +Fixed error message (@zudov) + +## [v0.2.2](https://github.com/purescript/purescript-either/releases/tag/v0.2.2) - 2015-08-14 + +- Added `Semiring` and `Semigroup` instances (@anttih) + +## [v0.2.1](https://github.com/purescript/purescript-either/releases/tag/v0.2.1) - 2015-08-13 + +- Fixed warnings about partial functions + +## [v0.2.0](https://github.com/purescript/purescript-either/releases/tag/v0.2.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.2.0-rc.1](https://github.com/purescript/purescript-either/releases/tag/v0.2.0-rc.1) - 2015-06-06 + +Initial release candidate of the library intended for the 0.7 compiler. + +## [v0.1.8](https://github.com/purescript/purescript-either/releases/tag/v0.1.8) - 2015-03-25 + +More helper functions for nested sums (@jdegoes) + +## [v0.1.7](https://github.com/purescript/purescript-either/releases/tag/v0.1.7) - 2015-03-24 + +Reworked nested sums (@jdegoes) + +## [v0.1.6](https://github.com/purescript/purescript-either/releases/tag/v0.1.6) - 2015-03-18 + +Add `fromLeft` and `fromRight` (@pseudonom) + +## [v0.1.5](https://github.com/purescript/purescript-either/releases/tag/v0.1.5) - 2015-03-17 + +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 + +## [v0.1.2](https://github.com/purescript/purescript-either/releases/tag/v0.1.2) - 2014-05-22 + +- Fixed `show` output (paf31) + +## [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 + + + From 4a03126ae75936016bc72965e1cb4cd96c14617b Mon Sep 17 00:00:00 2001 From: milesfrain Date: Mon, 18 Jan 2021 21:55:55 -0800 Subject: [PATCH 05/11] Changelog updates since v4.1.1 (#63) --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c3ba1b5..0b9143b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,12 +5,20 @@ Notable changes to this project are documented in this file. The format is based ## [Unreleased] 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) 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) +- Improved documentation of `Either`s "do notation" (#52) ## [v4.1.1](https://github.com/purescript/purescript-either/releases/tag/v4.1.1) - 2018-11-30 From 170f24b5e86f534fb058a0093600e5578c603abc Mon Sep 17 00:00:00 2001 From: Ryan Hendrickson Date: Wed, 3 Feb 2021 10:59:21 -0500 Subject: [PATCH 06/11] Refactor functors and related packages (#64) This is part of a set of commits that rearrange the dependencies between multiple packages. The immediate motivation is to allow certain newtypes to be reused between `profunctor` and `bifunctors`, but this particular approach goes a little beyond that in two ways: first, it attempts to move data types (`either`, `tuple`) toward the bottom of the dependency stack; and second, it tries to ensure no package comes between `functors` and the packages most closely related to it, in order to open the possibility of merging those packages together (which may be desirable if at some point in the future additional newtypes are added which reveal new and exciting constraints on the module dependency graph). --- CHANGELOG.md | 1 + bower.json | 2 -- src/Data/Either.purs | 55 -------------------------------------------- 3 files changed, 1 insertion(+), 57 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b9143b..503ebee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ Breaking changes: 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) Bugfixes: diff --git a/bower.json b/bower.json index 1702a87..140356b 100644 --- a/bower.json +++ b/bower.json @@ -16,9 +16,7 @@ "package.json" ], "dependencies": { - "purescript-bifunctors": "master", "purescript-control": "master", - "purescript-foldable-traversable": "master", "purescript-invariant": "master", "purescript-maybe": "master", "purescript-prelude": "master" diff --git a/src/Data/Either.purs b/src/Data/Either.purs index 5b5d78e..70c2bc5 100644 --- a/src/Data/Either.purs +++ b/src/Data/Either.purs @@ -4,19 +4,11 @@ import Prelude import Control.Alt (class Alt, (<|>)) import Control.Extend (class Extend) -import Data.Bifoldable (class Bifoldable) -import Data.Bifunctor (class Bifunctor) -import Data.Bitraversable (class Bitraversable) import Data.Eq (class Eq1) -import Data.Foldable (class Foldable) -import Data.FoldableWithIndex (class FoldableWithIndex) import Data.Functor.Invariant (class Invariant, imapF) -import Data.FunctorWithIndex (class FunctorWithIndex) import Data.Generic.Rep (class Generic) import Data.Maybe (Maybe(..), maybe, maybe') import Data.Ord (class Ord1) -import Data.Traversable (class Traversable) -import Data.TraversableWithIndex (class TraversableWithIndex) -- | The `Either` type is used to represent a choice between two types of value. -- | @@ -38,18 +30,11 @@ data Either a b = Left a | Right b -- | ``` derive instance functorEither :: Functor (Either a) -instance functorWithIndexEither :: FunctorWithIndex Unit (Either a) where - mapWithIndex f = map $ f unit - derive instance genericEither :: Generic (Either a b) _ instance invariantEither :: Invariant (Either a) where imap = imapF -instance bifunctorEither :: Bifunctor Either where - bimap f _ (Left l) = Left (f l) - bimap _ g (Right r) = Right (g r) - -- | The `Apply` instance allows functions contained within a `Right` to -- | transform a value contained within a `Right` using the `(<*>)` operator: -- | @@ -209,46 +194,6 @@ instance boundedEither :: (Bounded a, Bounded b) => Bounded (Either a b) where top = Right top bottom = Left bottom -instance foldableEither :: Foldable (Either a) where - foldr _ z (Left _) = z - foldr f z (Right x) = f x z - foldl _ z (Left _) = z - foldl f z (Right x) = f z x - foldMap f (Left _) = mempty - foldMap f (Right x) = f x - -instance foldableWithIndexEither :: FoldableWithIndex Unit (Either a) where - foldrWithIndex _ z (Left _) = z - foldrWithIndex f z (Right x) = f unit x z - foldlWithIndex _ z (Left _) = z - foldlWithIndex f z (Right x) = f unit z x - foldMapWithIndex f (Left _) = mempty - foldMapWithIndex f (Right x) = f unit x - -instance bifoldableEither :: Bifoldable Either where - bifoldr f _ z (Left a) = f a z - bifoldr _ g z (Right b) = g b z - bifoldl f _ z (Left a) = f z a - bifoldl _ g z (Right b) = g z b - bifoldMap f _ (Left a) = f a - bifoldMap _ g (Right b) = g b - -instance traversableEither :: Traversable (Either a) where - traverse _ (Left x) = pure (Left x) - traverse f (Right x) = Right <$> f x - sequence (Left x) = pure (Left x) - sequence (Right x) = Right <$> x - -instance traversableWithIndexEither :: TraversableWithIndex Unit (Either a) where - traverseWithIndex _ (Left x) = pure (Left x) - traverseWithIndex f (Right x) = Right <$> f unit x - -instance bitraversableEither :: Bitraversable Either where - bitraverse f _ (Left a) = Left <$> f a - bitraverse _ g (Right b) = Right <$> g b - bisequence (Left a) = Left <$> a - bisequence (Right b) = Right <$> b - instance semigroupEither :: (Semigroup b) => Semigroup (Either a b) where append x y = append <$> x <*> y From c1a1af35684f10eecaf6ac7d38dbf6bd48af2ced Mon Sep 17 00:00:00 2001 From: Cyril Date: Fri, 26 Feb 2021 18:34:22 +0100 Subject: [PATCH 07/11] Prepare v5.0.0 release (#65) * Update CI to build with the latest version of the compiler * Update the bower repository URL to match the URL in the registry * Upgrade bower dependencies * Update the changelog --- .github/workflows/ci.yml | 2 -- CHANGELOG.md | 10 ++++++++++ bower.json | 16 ++++++++-------- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f4f44e5..43d2897 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,8 +13,6 @@ jobs: - uses: actions/checkout@v2 - uses: purescript-contrib/setup-purescript@main - with: - purescript: "0.14.0-rc5" - uses: actions/setup-node@v1 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 503ebee..aab5e90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ Notable changes to this project are documented in this file. The format is based ## [Unreleased] +Breaking changes: + +New features: + +Bugfixes: + +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) diff --git a/bower.json b/bower.json index 140356b..e92d057 100644 --- a/bower.json +++ b/bower.json @@ -4,7 +4,7 @@ "license": "BSD-3-Clause", "repository": { "type": "git", - "url": "git://github.com/purescript/purescript-either.git" + "url": "https://github.com/purescript/purescript-either.git" }, "ignore": [ "**/.*", @@ -16,14 +16,14 @@ "package.json" ], "dependencies": { - "purescript-control": "master", - "purescript-invariant": "master", - "purescript-maybe": "master", - "purescript-prelude": "master" + "purescript-control": "^5.0.0", + "purescript-invariant": "^5.0.0", + "purescript-maybe": "^5.0.0", + "purescript-prelude": "^5.0.0" }, "devDependencies": { - "purescript-assert": "master", - "purescript-console": "master", - "purescript-effect": "master" + "purescript-assert": "^5.0.0", + "purescript-console": "^5.0.0", + "purescript-effect": "^3.0.0" } } From 313d5ef314a6ca9ac5f8f40b47c874d9f8feba2e Mon Sep 17 00:00:00 2001 From: JordanMartinez Date: Mon, 14 Mar 2022 12:05:28 -0700 Subject: [PATCH 08/11] Update to v0.15.0 (#66) * Update to CI to use 'unstable' purescript * Update pulp to 16.0.0-0 and psa to 0.8.2 * Update Bower dependencies to master * Added changelog entry --- .github/workflows/ci.yml | 2 ++ CHANGELOG.md | 1 + bower.json | 14 +++++++------- package.json | 4 ++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43d2897..b6ebf3a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,8 @@ jobs: - uses: actions/checkout@v2 - uses: purescript-contrib/setup-purescript@main + with: + purescript: "unstable" - uses: actions/setup-node@v1 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index aab5e90..2496610 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Notable changes to this project are documented in this file. The format is based ## [Unreleased] Breaking changes: +- Update project and deps to PureScript v0.15.0 (#66 by @JordanMartinez) New features: diff --git a/bower.json b/bower.json index e92d057..cb214a4 100644 --- a/bower.json +++ b/bower.json @@ -16,14 +16,14 @@ "package.json" ], "dependencies": { - "purescript-control": "^5.0.0", - "purescript-invariant": "^5.0.0", - "purescript-maybe": "^5.0.0", - "purescript-prelude": "^5.0.0" + "purescript-control": "master", + "purescript-invariant": "master", + "purescript-maybe": "master", + "purescript-prelude": "master" }, "devDependencies": { - "purescript-assert": "^5.0.0", - "purescript-console": "^5.0.0", - "purescript-effect": "^3.0.0" + "purescript-assert": "master", + "purescript-console": "master", + "purescript-effect": "master" } } diff --git a/package.json b/package.json index d3602c1..c8e10e0 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,8 @@ "test": "pulp test" }, "devDependencies": { - "pulp": "^15.0.0", - "purescript-psa": "^0.8.0", + "pulp": "16.0.0-0", + "purescript-psa": "^0.8.2", "rimraf": "^3.0.2" } } From 5fbe43cb88e3784c8625c938cadcf61506edb3f4 Mon Sep 17 00:00:00 2001 From: JordanMartinez Date: Wed, 27 Apr 2022 14:09:57 -0500 Subject: [PATCH 09/11] Prepare v6.0.0 release (1st PS 0.15.0-compatible release) (#68) * Update the bower dependencies * Update Node to 14 in CI * Update the changelog --- .github/workflows/ci.yml | 4 ++-- CHANGELOG.md | 10 ++++++++++ bower.json | 14 +++++++------- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6ebf3a..c69237a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,9 +16,9 @@ jobs: with: purescript: "unstable" - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v2 with: - node-version: "12" + node-version: "14.x" - name: Install dependencies run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 2496610..31709c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ Notable changes to this project are documented in this file. The format is based ## [Unreleased] +Breaking changes: + +New features: + +Bugfixes: + +Other improvements: + +## [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) diff --git a/bower.json b/bower.json index cb214a4..6e9638d 100644 --- a/bower.json +++ b/bower.json @@ -16,14 +16,14 @@ "package.json" ], "dependencies": { - "purescript-control": "master", - "purescript-invariant": "master", - "purescript-maybe": "master", - "purescript-prelude": "master" + "purescript-control": "^6.0.0", + "purescript-invariant": "^6.0.0", + "purescript-maybe": "^6.0.0", + "purescript-prelude": "^6.0.0" }, "devDependencies": { - "purescript-assert": "master", - "purescript-console": "master", - "purescript-effect": "master" + "purescript-assert": "^6.0.0", + "purescript-console": "^6.0.0", + "purescript-effect": "^4.0.0" } } From b515c20806e85797adb1e28e81a81d4d46cd3c54 Mon Sep 17 00:00:00 2001 From: Mark Eibes Date: Fri, 13 May 2022 18:27:55 +0200 Subject: [PATCH 10/11] Add `blush` as an analogue to `hush` (#69) Also update docstring wording --- CHANGELOG.md | 4 +--- src/Data/Either.purs | 12 +++++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31709c2..f0b6254 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Notable changes to this project are documented in this file. The format is based Breaking changes: New features: +- Add `blush` which is a left-biased `hush`, thus turns `Right`s into `Nothing`s but `Left`s into `Just`s (#69). Bugfixes: @@ -148,6 +149,3 @@ Add `Alt` instance ## [v0.1.0](https://github.com/purescript/purescript-either/releases/tag/v0.1.0) - 2014-04-21 - - - diff --git a/src/Data/Either.purs b/src/Data/Either.purs index 70c2bc5..3940d93 100644 --- a/src/Data/Either.purs +++ b/src/Data/Either.purs @@ -273,7 +273,7 @@ note a = maybe (Left a) Right note' :: forall a b. (Unit -> a) -> Maybe b -> Either a b note' f = maybe' (Left <<< f) Right --- | Turns an `Either` into a `Maybe`, by throwing eventual `Left` values away and converting +-- | Turns an `Either` into a `Maybe`, by throwing potential `Left` values away and converting -- | them into `Nothing`. `Right` values get turned into `Just`s. -- | -- | ```purescript @@ -282,3 +282,13 @@ note' f = maybe' (Left <<< f) Right -- | ``` hush :: forall a b. Either a b -> Maybe b hush = either (const Nothing) Just + +-- | Turns an `Either` into a `Maybe`, by throwing potential `Right` values away and converting +-- | them into `Nothing`. `Left` values get turned into `Just`s. +-- | +-- | ```purescript +-- | blush (Left "ParseError") = Just "Parse Error" +-- | blush (Right 42) = Nothing +-- | ``` +blush :: forall a b. Either a b -> Maybe a +blush = either Just (const Nothing) From af655a04ed2fd694b6688af39ee20d7907ad0763 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Mon, 16 May 2022 21:16:21 -0500 Subject: [PATCH 11/11] Update changelog --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0b6254..73022e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,12 +7,16 @@ Notable changes to this project are documented in this file. The format is based Breaking changes: New features: -- Add `blush` which is a left-biased `hush`, thus turns `Right`s into `Nothing`s but `Left`s into `Just`s (#69). Bugfixes: Other improvements: +## [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: