Skip to content

Commit 0241957

Browse files
KhraksMamtsoveffect-bot
authored andcommitted
Differ implements Pipeable (#4239)
1 parent 6d1cb01 commit 0241957

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

.changeset/rude-rules-brush.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"effect": minor
3+
---
4+
5+
`Differ` implements `Pipeable`

packages/effect/src/Differ.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import * as HashMapPatch from "./internal/differ/hashMapPatch.js"
1515
import * as HashSetPatch from "./internal/differ/hashSetPatch.js"
1616
import * as OrPatch from "./internal/differ/orPatch.js"
1717
import * as ReadonlyArrayPatch from "./internal/differ/readonlyArrayPatch.js"
18+
import type { Pipeable } from "./Pipeable.js"
1819
import type * as Types from "./Types.js"
1920

2021
/**
@@ -48,7 +49,7 @@ export type TypeId = typeof TypeId
4849
* @since 2.0.0
4950
* @category models
5051
*/
51-
export interface Differ<in out Value, in out Patch> {
52+
export interface Differ<in out Value, in out Patch> extends Pipeable {
5253
readonly [TypeId]: {
5354
readonly _V: Types.Invariant<Value>
5455
readonly _P: Types.Invariant<Patch>

packages/effect/src/internal/differ.ts

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import * as Dual from "../Function.js"
77
import { constant, identity } from "../Function.js"
88
import type { HashMap } from "../HashMap.js"
99
import type { HashSet } from "../HashSet.js"
10+
import { pipeArguments } from "../Pipeable.js"
1011
import * as ChunkPatch from "./differ/chunkPatch.js"
1112
import * as ContextPatch from "./differ/contextPatch.js"
1213
import * as HashMapPatch from "./differ/hashMapPatch.js"
@@ -22,6 +23,9 @@ export const DifferProto = {
2223
[DifferTypeId]: {
2324
_P: identity,
2425
_V: identity
26+
},
27+
pipe() {
28+
return pipeArguments(this, arguments)
2529
}
2630
}
2731

packages/effect/test/Differ.test.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ describe("Differ", () => {
123123

124124
describe("tuple", () => {
125125
diffLaws(
126-
pipe(Differ.update<number>(), Differ.zip(Differ.update<number>())),
126+
Differ.update<number>()
127+
.pipe(
128+
Differ.zip(Differ.update<number>())
129+
),
127130
randomPair,
128131
(a, b) => Equal.equals(a[0], b[0]) && Equal.equals(a[1], b[1])
129132
)

0 commit comments

Comments
 (0)