diff --git a/.changeset/rude-rules-brush.md b/.changeset/rude-rules-brush.md new file mode 100644 index 00000000000..5a5794b2032 --- /dev/null +++ b/.changeset/rude-rules-brush.md @@ -0,0 +1,5 @@ +--- +"effect": minor +--- + +`Differ` implements `Pipeable` diff --git a/packages/effect/src/Differ.ts b/packages/effect/src/Differ.ts index a46d2487510..8471ce00ef1 100644 --- a/packages/effect/src/Differ.ts +++ b/packages/effect/src/Differ.ts @@ -15,6 +15,7 @@ import * as HashMapPatch from "./internal/differ/hashMapPatch.js" import * as HashSetPatch from "./internal/differ/hashSetPatch.js" import * as OrPatch from "./internal/differ/orPatch.js" import * as ReadonlyArrayPatch from "./internal/differ/readonlyArrayPatch.js" +import type { Pipeable } from "./Pipeable.js" import type * as Types from "./Types.js" /** @@ -48,7 +49,7 @@ export type TypeId = typeof TypeId * @since 2.0.0 * @category models */ -export interface Differ { +export interface Differ extends Pipeable { readonly [TypeId]: { readonly _V: Types.Invariant readonly _P: Types.Invariant diff --git a/packages/effect/src/internal/differ.ts b/packages/effect/src/internal/differ.ts index d4071d14831..0c07cccd77c 100644 --- a/packages/effect/src/internal/differ.ts +++ b/packages/effect/src/internal/differ.ts @@ -7,6 +7,7 @@ import * as Dual from "../Function.js" import { constant, identity } from "../Function.js" import type { HashMap } from "../HashMap.js" import type { HashSet } from "../HashSet.js" +import { pipeArguments } from "../Pipeable.js" import * as ChunkPatch from "./differ/chunkPatch.js" import * as ContextPatch from "./differ/contextPatch.js" import * as HashMapPatch from "./differ/hashMapPatch.js" @@ -22,6 +23,9 @@ export const DifferProto = { [DifferTypeId]: { _P: identity, _V: identity + }, + pipe() { + return pipeArguments(this, arguments) } } diff --git a/packages/effect/test/Differ.test.ts b/packages/effect/test/Differ.test.ts index 82e7db78712..77186b83af0 100644 --- a/packages/effect/test/Differ.test.ts +++ b/packages/effect/test/Differ.test.ts @@ -128,7 +128,10 @@ describe("Differ", () => { describe("tuple", () => { diffLaws( - pipe(Differ.update(), Differ.zip(Differ.update())), + Differ.update() + .pipe( + Differ.zip(Differ.update()) + ), randomPair, (a, b) => Equal.equals(a[0], b[0]) && Equal.equals(a[1], b[1]) )