Skip to content

Commit

Permalink
Add missing Either.void constructor (#4413)
Browse files Browse the repository at this point in the history
  • Loading branch information
gcanti authored and effect-bot committed Feb 6, 2025
1 parent 138e585 commit 27b74ca
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/thick-laws-yell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"effect": minor
---

Add missing `Either.void` constructor.
9 changes: 9 additions & 0 deletions packages/effect/src/Either.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,15 @@ export declare namespace Either {
*/
export const right: <R>(right: R) => Either<R> = either.right

const void_: Either<void> = right(void 0)
export {
/**
* @category constructors
* @since 3.13.0
*/
void_ as void
}

/**
* Constructs a new `Either` holding a `Left` value. This usually represents a failure, due to the right-bias of this
* structure.
Expand Down
4 changes: 4 additions & 0 deletions packages/effect/test/Either.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import {
} from "effect/test/util"

describe("Either", () => {
it("void", () => {
deepStrictEqual(Either.void, Either.right(undefined))
})

it("gen", () => {
const a = Either.gen(function*() {
const x = yield* Either.right(1)
Expand Down

0 comments on commit 27b74ca

Please sign in to comment.