diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43d2897..c69237a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,10 +13,12 @@ jobs: - uses: actions/checkout@v2 - uses: purescript-contrib/setup-purescript@main + 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 aab5e90..73022e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,22 @@ 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: +- Update project and deps to PureScript v0.15.0 (#66 by @JordanMartinez) + +New features: + +Bugfixes: + +Other improvements: + ## [v5.0.0](https://github.com/purescript/purescript-either/releases/tag/v5.0.0) - 2021-02-26 Breaking changes: @@ -137,6 +153,3 @@ Add `Alt` instance ## [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 index e92d057..6e9638d 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": "^6.0.0", + "purescript-invariant": "^6.0.0", + "purescript-maybe": "^6.0.0", + "purescript-prelude": "^6.0.0" }, "devDependencies": { - "purescript-assert": "^5.0.0", - "purescript-console": "^5.0.0", - "purescript-effect": "^3.0.0" + "purescript-assert": "^6.0.0", + "purescript-console": "^6.0.0", + "purescript-effect": "^4.0.0" } } 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" } } 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)