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
32 changes: 10 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,18 @@ 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 format:check
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/.*
!/.gitignore
!/.github/
!/.tidyrc.json
/bower_components/
/node_modules/
/output/
package-lock.json
/package-lock.json
/spago.lock
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
}
23 changes: 18 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-either/compare/v6.1.1...HEAD)

Breaking changes:

Expand All @@ -12,14 +12,28 @@ Bugfixes:

Other improvements:

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

Breaking changes:

New features:

Bugfixes:

Other improvements:

- Migrate from Bower/Pulp to Spago and update CI and formatting tools (#72 by @thomashoneyman)

## [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:
Expand All @@ -31,17 +45,20 @@ 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)

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:

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)
Expand Down Expand Up @@ -138,8 +155,6 @@ 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
Expand All @@ -150,6 +165,4 @@ Add `Alt` instance

## [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
29 changes: 0 additions & 29 deletions bower.json

This file was deleted.

19 changes: 13 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
{
"private": true,
"license": "BSD-3-Clause",
"repository": {
"type": "git",
"url": "https://github.com/purescript/purescript-either.git"
},
"scripts": {
"clean": "rimraf output && rimraf .pulp-cache",
"build": "pulp build -- --censor-lib --strict",
"test": "pulp test"
"build": "spago build",
"test": "spago 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",
"purescript": "^0.15.16",
"purs-tidy": "^0.11.1",
"spago": "^1.0.5"
}
}
26 changes: 26 additions & 0 deletions spago.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package:
name: either
description: Values with two alternatives, commonly used for errors and successes
build:
strict: true
pedanticPackages: true
publish:
version: 6.1.1
license: BSD-3-Clause
location:
githubOwner: purescript
githubRepo: purescript-either
dependencies:
- control: ">=6.0.0 <7.0.0"
- invariant: ">=6.0.0 <7.0.0"
- maybe: ">=6.0.0 <7.0.0"
- prelude: ">=6.0.0 <7.0.0"
test:
main: Test.Main
strict: true
pedanticPackages: true
dependencies:
- assert: ">=6.0.0 <7.0.0"
- console: ">=6.0.0 <7.0.0"
- effect: ">=4.0.0 <5.0.0"
workspace: {}
6 changes: 3 additions & 3 deletions src/Data/Either.purs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ instance applicativeEither :: Applicative (Either e) where
-- | ```
instance altEither :: Alt (Either e) where
alt (Left _) r = r
alt l _ = l
alt l _ = l

-- | The `Bind` instance allows sequencing of `Either` values and functions that
-- | return an `Either` by using the `>>=` operator:
Expand Down Expand Up @@ -164,8 +164,8 @@ instance monadEither :: Monad (Either e)
-- | f <<= Right x = Right (f (Right x))
-- | ```
instance extendEither :: Extend (Either e) where
extend _ (Left y) = Left y
extend f x = Right (f x)
extend _ (Left y) = Left y
extend f x = Right (f x)

-- | The `Show` instance allows `Either` values to be rendered as a string with
-- | `show` whenever there is an `Show` instance for both type the `Either` can
Expand Down
47 changes: 42 additions & 5 deletions src/Data/Either/Nested.purs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,48 @@
-- | toEither3 (Blue v) = in3 v
-- | ```
module Data.Either.Nested
( type (\/), (\/)
, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10
, at1, at2, at3, at4, at5, at6, at7, at8, at9, at10
, Either1, Either2, Either3, Either4, Either5, Either6, Either7, Either8, Either9, Either10
, either1, either2, either3, either4, either5, either6, either7, either8, either9, either10
( type (\/)
, (\/)
, in1
, in2
, in3
, in4
, in5
, in6
, in7
, in8
, in9
, in10
, at1
, at2
, at3
, at4
, at5
, at6
, at7
, at8
, at9
, at10
, Either1
, Either2
, Either3
, Either4
, Either5
, Either6
, Either7
, Either8
, Either9
, Either10
, either1
, either2
, either3
, either4
, either5
, either6
, either7
, either8
, either9
, either10
) where

import Data.Either (Either(..), either)
Expand Down
10 changes: 4 additions & 6 deletions test/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@ main = do
, expected: in3 100
}
log "Test injection with the injectReflexive instance"
let x = inj 100 :: MySum
assertEqual
let
x = inj 100 :: MySum
in
{ actual: inj x :: MySum
, expected: x
}
{ actual: inj x :: MySum
, expected: x
}
log "Test that injection picks the left-most option"
assertEqual
{ actual: inj 100 :: Either3 Int Int Int
Expand Down
Loading