@typed/fx 1.27.3 → 1.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/dist/cjs/AsyncData.js +1 -1
  2. package/dist/cjs/AsyncData.js.map +1 -1
  3. package/dist/cjs/Emitter.js +3 -3
  4. package/dist/cjs/Emitter.js.map +1 -1
  5. package/dist/cjs/Form.js +15 -15
  6. package/dist/cjs/Form.js.map +1 -1
  7. package/dist/cjs/FormEntry.js +3 -3
  8. package/dist/cjs/FormEntry.js.map +1 -1
  9. package/dist/cjs/Fx.js +11 -9
  10. package/dist/cjs/Fx.js.map +1 -1
  11. package/dist/cjs/Idle.js +8 -8
  12. package/dist/cjs/Idle.js.map +1 -1
  13. package/dist/cjs/Match.js +17 -17
  14. package/dist/cjs/Match.js.map +1 -1
  15. package/dist/cjs/Pull.js +3 -3
  16. package/dist/cjs/Pull.js.map +1 -1
  17. package/dist/cjs/Push.js +1 -1
  18. package/dist/cjs/Push.js.map +1 -1
  19. package/dist/cjs/RefArray.js +2 -2
  20. package/dist/cjs/RefArray.js.map +1 -1
  21. package/dist/cjs/RefChunk.js +1 -1
  22. package/dist/cjs/RefChunk.js.map +1 -1
  23. package/dist/cjs/RefHashMap.js +1 -1
  24. package/dist/cjs/RefHashMap.js.map +1 -1
  25. package/dist/cjs/RefHashSet.js +1 -1
  26. package/dist/cjs/RefHashSet.js.map +1 -1
  27. package/dist/cjs/RefSubject.js +150 -75
  28. package/dist/cjs/RefSubject.js.map +1 -1
  29. package/dist/cjs/Sink.js +14 -14
  30. package/dist/cjs/Sink.js.map +1 -1
  31. package/dist/cjs/Stream.js +1 -1
  32. package/dist/cjs/Stream.js.map +1 -1
  33. package/dist/cjs/Subject.js +27 -22
  34. package/dist/cjs/Subject.js.map +1 -1
  35. package/dist/cjs/Typeclass.js +1 -1
  36. package/dist/cjs/Typeclass.js.map +1 -1
  37. package/dist/cjs/Versioned.js +4 -4
  38. package/dist/cjs/Versioned.js.map +1 -1
  39. package/dist/cjs/index.js +1 -1
  40. package/dist/cjs/index.js.map +1 -1
  41. package/dist/cjs/internal/DeferredRef.js +14 -11
  42. package/dist/cjs/internal/DeferredRef.js.map +1 -1
  43. package/dist/cjs/internal/core.js +71 -42
  44. package/dist/cjs/internal/core.js.map +1 -1
  45. package/dist/cjs/internal/diff.js +1 -1
  46. package/dist/cjs/internal/diff.js.map +1 -1
  47. package/dist/cjs/internal/effect-loop-operator.js +1 -1
  48. package/dist/cjs/internal/effect-loop-operator.js.map +1 -1
  49. package/dist/cjs/internal/effect-operator.js +3 -3
  50. package/dist/cjs/internal/effect-operator.js.map +1 -1
  51. package/dist/cjs/internal/effect-producer.js +3 -3
  52. package/dist/cjs/internal/effect-producer.js.map +1 -1
  53. package/dist/cjs/internal/helpers.js +63 -42
  54. package/dist/cjs/internal/helpers.js.map +1 -1
  55. package/dist/cjs/internal/keyed.js +34 -26
  56. package/dist/cjs/internal/keyed.js.map +1 -1
  57. package/dist/cjs/internal/loop-operator.js +1 -1
  58. package/dist/cjs/internal/loop-operator.js.map +1 -1
  59. package/dist/cjs/internal/operator.js +1 -1
  60. package/dist/cjs/internal/operator.js.map +1 -1
  61. package/dist/cjs/internal/protos.js +1 -1
  62. package/dist/cjs/internal/protos.js.map +1 -1
  63. package/dist/cjs/internal/provide.js +1 -1
  64. package/dist/cjs/internal/provide.js.map +1 -1
  65. package/dist/cjs/internal/share.js +8 -13
  66. package/dist/cjs/internal/share.js.map +1 -1
  67. package/dist/cjs/internal/sync-operator.js +4 -4
  68. package/dist/cjs/internal/sync-operator.js.map +1 -1
  69. package/dist/cjs/internal/sync-producer.js +27 -23
  70. package/dist/cjs/internal/sync-producer.js.map +1 -1
  71. package/dist/cjs/internal/withKey.js +7 -7
  72. package/dist/cjs/internal/withKey.js.map +1 -1
  73. package/dist/dts/AsyncData.d.ts +2 -2
  74. package/dist/dts/AsyncData.d.ts.map +1 -1
  75. package/dist/dts/Emitter.d.ts +1 -1
  76. package/dist/dts/Emitter.d.ts.map +1 -1
  77. package/dist/dts/Fx.d.ts +39 -13
  78. package/dist/dts/Fx.d.ts.map +1 -1
  79. package/dist/dts/Idle.d.ts.map +1 -1
  80. package/dist/dts/Match.d.ts +1 -1
  81. package/dist/dts/Match.d.ts.map +1 -1
  82. package/dist/dts/Push.d.ts +4 -1
  83. package/dist/dts/Push.d.ts.map +1 -1
  84. package/dist/dts/RefArray.d.ts +1 -2
  85. package/dist/dts/RefArray.d.ts.map +1 -1
  86. package/dist/dts/RefChunk.d.ts.map +1 -1
  87. package/dist/dts/RefHashMap.d.ts +1 -1
  88. package/dist/dts/RefHashMap.d.ts.map +1 -1
  89. package/dist/dts/RefHashSet.d.ts.map +1 -1
  90. package/dist/dts/RefSubject.d.ts +64 -3
  91. package/dist/dts/RefSubject.d.ts.map +1 -1
  92. package/dist/dts/Sink.d.ts +2 -1
  93. package/dist/dts/Sink.d.ts.map +1 -1
  94. package/dist/dts/Subject.d.ts +2 -1
  95. package/dist/dts/Subject.d.ts.map +1 -1
  96. package/dist/dts/Versioned.d.ts +3 -1
  97. package/dist/dts/Versioned.d.ts.map +1 -1
  98. package/dist/dts/internal/DeferredRef.d.ts +6 -4
  99. package/dist/dts/internal/DeferredRef.d.ts.map +1 -1
  100. package/dist/dts/internal/core.d.ts +25 -12
  101. package/dist/dts/internal/core.d.ts.map +1 -1
  102. package/dist/dts/internal/diff.d.ts +1 -1
  103. package/dist/dts/internal/diff.d.ts.map +1 -1
  104. package/dist/dts/internal/effect-operator.d.ts.map +1 -1
  105. package/dist/dts/internal/helpers.d.ts +8 -6
  106. package/dist/dts/internal/helpers.d.ts.map +1 -1
  107. package/dist/dts/internal/keyed.d.ts +2 -2
  108. package/dist/dts/internal/keyed.d.ts.map +1 -1
  109. package/dist/dts/internal/loop-operator.d.ts +1 -1
  110. package/dist/dts/internal/loop-operator.d.ts.map +1 -1
  111. package/dist/dts/internal/protos.d.ts +1 -1
  112. package/dist/dts/internal/protos.d.ts.map +1 -1
  113. package/dist/dts/internal/provide.d.ts.map +1 -1
  114. package/dist/dts/internal/share.d.ts +1 -1
  115. package/dist/dts/internal/share.d.ts.map +1 -1
  116. package/dist/dts/internal/strategies.d.ts.map +1 -1
  117. package/dist/dts/internal/sync-operator.d.ts.map +1 -1
  118. package/dist/dts/internal/sync-producer.d.ts +4 -4
  119. package/dist/dts/internal/sync-producer.d.ts.map +1 -1
  120. package/dist/esm/Emitter.js +1 -1
  121. package/dist/esm/Emitter.js.map +1 -1
  122. package/dist/esm/Form.js +14 -14
  123. package/dist/esm/Form.js.map +1 -1
  124. package/dist/esm/FormEntry.js +2 -2
  125. package/dist/esm/FormEntry.js.map +1 -1
  126. package/dist/esm/Fx.js +16 -5
  127. package/dist/esm/Fx.js.map +1 -1
  128. package/dist/esm/Idle.js +7 -7
  129. package/dist/esm/Idle.js.map +1 -1
  130. package/dist/esm/Match.js +17 -17
  131. package/dist/esm/Match.js.map +1 -1
  132. package/dist/esm/Pull.js +2 -2
  133. package/dist/esm/Push.js.map +1 -1
  134. package/dist/esm/RefArray.js +1 -1
  135. package/dist/esm/RefArray.js.map +1 -1
  136. package/dist/esm/RefHashMap.js.map +1 -1
  137. package/dist/esm/RefSubject.js +140 -59
  138. package/dist/esm/RefSubject.js.map +1 -1
  139. package/dist/esm/Sink.js +13 -13
  140. package/dist/esm/Sink.js.map +1 -1
  141. package/dist/esm/Subject.js +29 -20
  142. package/dist/esm/Subject.js.map +1 -1
  143. package/dist/esm/Versioned.js +1 -1
  144. package/dist/esm/Versioned.js.map +1 -1
  145. package/dist/esm/internal/DeferredRef.js +13 -10
  146. package/dist/esm/internal/DeferredRef.js.map +1 -1
  147. package/dist/esm/internal/core.js +70 -37
  148. package/dist/esm/internal/core.js.map +1 -1
  149. package/dist/esm/internal/diff.js.map +1 -1
  150. package/dist/esm/internal/effect-operator.js +2 -2
  151. package/dist/esm/internal/effect-producer.js +1 -1
  152. package/dist/esm/internal/helpers.js +62 -39
  153. package/dist/esm/internal/helpers.js.map +1 -1
  154. package/dist/esm/internal/keyed.js +26 -17
  155. package/dist/esm/internal/keyed.js.map +1 -1
  156. package/dist/esm/internal/share.js +7 -12
  157. package/dist/esm/internal/share.js.map +1 -1
  158. package/dist/esm/internal/sync-operator.js +3 -3
  159. package/dist/esm/internal/sync-operator.js.map +1 -1
  160. package/dist/esm/internal/sync-producer.js +7 -5
  161. package/dist/esm/internal/sync-producer.js.map +1 -1
  162. package/dist/esm/internal/withKey.js +6 -6
  163. package/dist/esm/internal/withKey.js.map +1 -1
  164. package/package.json +8 -7
  165. package/src/Emitter.ts +2 -1
  166. package/src/Form.ts +22 -30
  167. package/src/FormEntry.ts +2 -2
  168. package/src/Fx.ts +54 -36
  169. package/src/Idle.ts +7 -7
  170. package/src/Match.ts +24 -26
  171. package/src/Pull.ts +2 -2
  172. package/src/Push.ts +4 -1
  173. package/src/RefArray.ts +1 -1
  174. package/src/RefHashMap.ts +1 -1
  175. package/src/RefSubject.ts +262 -98
  176. package/src/Sink.ts +15 -14
  177. package/src/Subject.ts +55 -39
  178. package/src/Versioned.ts +4 -2
  179. package/src/internal/DeferredRef.ts +21 -11
  180. package/src/internal/core.ts +92 -61
  181. package/src/internal/diff.ts +1 -1
  182. package/src/internal/effect-operator.ts +2 -2
  183. package/src/internal/effect-producer.ts +3 -3
  184. package/src/internal/helpers.ts +89 -42
  185. package/src/internal/keyed.ts +47 -42
  186. package/src/internal/loop-operator.ts +1 -1
  187. package/src/internal/protos.ts +1 -1
  188. package/src/internal/share.ts +11 -26
  189. package/src/internal/sync-operator.ts +3 -3
  190. package/src/internal/sync-producer.ts +7 -5
  191. package/src/internal/withKey.ts +6 -6
@@ -1,6 +1,11 @@
1
- import type { FiberId } from "effect"
2
- import { Context, Effect, ExecutionStrategy, Exit, Option, Scope } from "effect"
3
- import type { Fx, KeyedOptions } from "../Fx.js"
1
+ import * as Context from "effect/Context"
2
+ import * as Effect from "effect/Effect"
3
+ import * as ExecutionStrategy from "effect/ExecutionStrategy"
4
+ import * as Exit from "effect/Exit"
5
+ import type * as FiberId from "effect/FiberId"
6
+ import * as Option from "effect/Option"
7
+ import * as Scope from "effect/Scope"
8
+ import { type Fx, type KeyedOptions } from "../Fx.js"
4
9
  import * as RefSubject from "../RefSubject.js"
5
10
  import * as Sink from "../Sink.js"
6
11
  import type { Add, Moved, Remove, Update } from "./diff.js"
@@ -64,46 +69,47 @@ function runKeyed<A, E, R, B extends PropertyKey, C, E2, R2, R3>(
64
69
  const scheduleNextEmit = forkDebounce(Effect.suspend(() => sink.onSuccess(getReadyIndices(state))))
65
70
 
66
71
  function diffAndPatch(values: ReadonlyArray<A>) {
67
- return Effect.gen(function*(_) {
72
+ return Effect.gen(function*() {
68
73
  const previous = state.previousValues
69
74
  state.previousValues = values
70
75
 
71
76
  let added = false
72
- let done = false
73
77
  let scheduled = false
78
+ let done = false
74
79
 
75
80
  for (const patch of diffIterator(previous, values, options)) {
76
81
  if (patch._tag === "Remove") {
77
- yield* _(removeValue(state, patch))
82
+ yield* removeValue(state, patch)
78
83
  } else if (patch._tag === "Add") {
79
84
  added = true
80
- yield* _(
81
- addValue(
82
- state,
83
- values,
84
- patch,
85
- id,
86
- parentScope,
87
- options,
88
- sink,
89
- Effect.suspend(() => {
90
- if (done === false) {
91
- scheduled = true
92
- return Effect.unit
93
- }
94
- return scheduleNextEmit
95
- })
96
- )
85
+ yield* addValue(
86
+ state,
87
+ values,
88
+ patch,
89
+ id,
90
+ parentScope,
91
+ options,
92
+ sink,
93
+ Effect.suspend(() => {
94
+ if (done === false) {
95
+ scheduled = true
96
+ return Effect.void
97
+ }
98
+ return scheduleNextEmit
99
+ })
97
100
  )
98
101
  } else {
99
- yield* _(updateValue(state, values, patch))
102
+ yield* updateValue(state, values, patch)
100
103
  }
101
104
  }
102
105
 
103
106
  done = true
104
107
 
105
108
  if (scheduled || added === false) {
106
- yield* _(scheduleNextEmit)
109
+ yield* scheduleNextEmit
110
+ } else {
111
+ // Allow fibers to begin running if we're adding Fibers
112
+ yield* Effect.sleep(1)
107
113
  }
108
114
  })
109
115
  }
@@ -117,7 +123,7 @@ function runKeyed<A, E, R, B extends PropertyKey, C, E2, R2, R3>(
117
123
  )
118
124
  )
119
125
  },
120
- options.debounce || 0
126
+ options.debounce || 1
121
127
  )
122
128
  }
123
129
 
@@ -162,16 +168,17 @@ function addValue<A, B extends PropertyKey, C, R2, E2, E, R3, D>(
162
168
  sink: Sink.Sink<ReadonlyArray<C>, E | E2, R2 | R3>,
163
169
  scheduleNextEmit: Effect.Effect<D, never, R3>
164
170
  ) {
165
- return Effect.gen(function*(_) {
171
+ return Effect.gen(function*() {
166
172
  const value = values[patch.index]
167
- const childScope = yield* _(Scope.fork(parentScope, ExecutionStrategy.sequential))
168
- const ref: RefSubject.RefSubject<A> = yield* _(RefSubject.unsafeMake<never, A>({
173
+ const childScope = yield* Scope.fork(parentScope, ExecutionStrategy.sequential)
174
+ const ref: RefSubject.RefSubject<A> = yield* RefSubject.unsafeMake<never, A>({
169
175
  initial: Effect.sync(() => entry.value),
170
176
  initialValue: value,
171
177
  scope: childScope,
172
178
  id
173
- }))
174
- yield* _(Scope.addFinalizer(childScope, ref.interrupt))
179
+ })
180
+
181
+ yield* Scope.addFinalizer(childScope, ref.interrupt)
175
182
 
176
183
  const entry = new KeyedEntry<A, C>(
177
184
  value,
@@ -184,18 +191,16 @@ function addValue<A, B extends PropertyKey, C, R2, E2, E, R3, D>(
184
191
  entries.set(patch.key, entry)
185
192
  indices.set(patch.index, patch.key)
186
193
 
187
- yield* _(
188
- Effect.forkIn(
189
- options.onValue(ref, patch.key).run(Sink.make(
190
- (cause) => sink.onFailure(cause),
191
- (output) => {
192
- entry.output = Option.some(output)
194
+ yield* Effect.forkIn(
195
+ options.onValue(ref, patch.key).run(Sink.make(
196
+ (cause) => sink.onFailure(cause),
197
+ (output) => {
198
+ entry.output = Option.some(output)
193
199
 
194
- return scheduleNextEmit
195
- }
196
- )),
197
- parentScope
198
- )
200
+ return scheduleNextEmit
201
+ }
202
+ )),
203
+ parentScope
199
204
  )
200
205
  })
201
206
  }
@@ -1,4 +1,4 @@
1
- import type { Either } from "effect"
1
+ import type * as Either from "effect/Either"
2
2
  import * as Option from "effect/Option"
3
3
  import * as Sink from "../Sink.js"
4
4
  import type { Bounds } from "./bounds.js"
@@ -1,4 +1,4 @@
1
- import type { Effect } from "effect"
1
+ import type * as Effect from "effect/Effect"
2
2
  import * as Effectable from "effect/Effectable"
3
3
  import { identity } from "effect/Function"
4
4
  import { pipeArguments } from "effect/Pipeable"
@@ -1,13 +1,12 @@
1
- import { ExecutionStrategy, type Scope } from "effect"
2
1
  import * as Effect from "effect/Effect"
3
2
  import * as Fiber from "effect/Fiber"
4
3
  import { dual } from "effect/Function"
5
4
  import * as MutableRef from "effect/MutableRef"
6
5
  import * as Option from "effect/Option"
6
+ import type * as Scope from "effect/Scope"
7
7
  import type { Fx } from "../Fx.js"
8
8
  import type { Sink } from "../Sink.js"
9
9
  import * as Subject from "../Subject.js"
10
- import { withScopedFork } from "./helpers.js"
11
10
  import { FxBase } from "./protos.js"
12
11
 
13
12
  export function share<A, E, R, R2>(
@@ -41,23 +40,17 @@ export class Share<A, E, R, R2> extends FxBase<A, E, R | R2 | Scope.Scope> {
41
40
  }
42
41
 
43
42
  run<R3>(sink: Sink<A, E, R3>): Effect.Effect<unknown, never, R | R2 | R3 | Scope.Scope> {
44
- return withScopedFork(
45
- (fork) =>
46
- Effect.flatMap(
47
- fork(
48
- Effect.onExit(this.i1.run(sink), () => this._RefCount.decrement() === 0 ? this.interrupt() : Effect.unit)
49
- ),
50
- () => this.initialize()
51
- ),
52
- ExecutionStrategy.sequential
43
+ return Effect.zipRight(
44
+ this.initialize(),
45
+ Effect.onExit(this.i1.run(sink), () => this._RefCount.decrement() === 0 ? this.interrupt() : Effect.void)
53
46
  )
54
47
  }
55
48
 
56
49
  private initialize(): Effect.Effect<unknown, never, R | R2> {
57
- return Effect.suspend(() => {
50
+ return Effect.suspend((): Effect.Effect<unknown, never, R | R2> => {
58
51
  if (this._RefCount.increment() === 1) {
59
52
  return this.i0.run(this.i1).pipe(
60
- Effect.onExit(() =>
53
+ Effect.ensuring(
61
54
  Effect.suspend(() => {
62
55
  MutableRef.set(this._FxFiber, Option.none())
63
56
  return this.i1.interrupt
@@ -65,26 +58,18 @@ export class Share<A, E, R, R2> extends FxBase<A, E, R | R2 | Scope.Scope> {
65
58
  ),
66
59
  Effect.interruptible,
67
60
  Effect.forkDaemon,
68
- Effect.tap((fiber) => Effect.sync(() => MutableRef.set(this._FxFiber, Option.some(fiber)))),
69
- Effect.flatMap(Fiber.join)
61
+ Effect.tap((fiber) => Effect.sync(() => MutableRef.set(this._FxFiber, Option.some(fiber))))
70
62
  )
71
63
  } else {
72
- return Option.match(
73
- MutableRef.get(this._FxFiber),
74
- {
75
- onNone: () => Effect.unit,
76
- onSome: Fiber.join
77
- }
78
- )
64
+ return Effect.void
79
65
  }
80
66
  })
81
67
  }
82
68
 
83
69
  private interrupt(): Effect.Effect<void, never, R | R2> {
84
- return Effect.suspend(() => {
85
- const fiber = Option.getOrNull(MutableRef.getAndSet(this._FxFiber, Option.none()))
86
-
87
- return fiber ? Effect.zip(Fiber.interrupt(fiber), this.i1.interrupt) : this.i1.interrupt
70
+ return Option.match(MutableRef.getAndSet(this._FxFiber, Option.none()), {
71
+ onNone: () => Effect.void,
72
+ onSome: Fiber.interrupt
88
73
  })
89
74
  }
90
75
  }
@@ -1,4 +1,4 @@
1
- import * as ReadonlyArray from "effect/ReadonlyArray"
1
+ import * as ReadonlyArray from "effect/Array"
2
2
 
3
3
  import * as Effect from "effect/Effect"
4
4
  import { flow } from "effect/Function"
@@ -95,11 +95,11 @@ export function compileCauseSyncOperatorSink<R>(
95
95
  ): Sink.Sink<any, any, R> {
96
96
  return matchSyncOperator(operator, {
97
97
  Map: (op) => Sink.make((a) => sink.onFailure(op.f(a)), sink.onSuccess),
98
- Filter: (op) => Sink.make((a) => op.f(a) ? sink.onFailure(a) : Effect.unit, sink.onSuccess),
98
+ Filter: (op) => Sink.make((a) => op.f(a) ? sink.onFailure(a) : Effect.void, sink.onSuccess),
99
99
  FilterMap: (op) =>
100
100
  Sink.make((a) =>
101
101
  Option.match(op.f(a), {
102
- onNone: () => Effect.unit,
102
+ onNone: () => Effect.void,
103
103
  onSome: sink.onFailure
104
104
  }), sink.onSuccess)
105
105
  })
@@ -1,4 +1,6 @@
1
- import { Effect, Option, ReadonlyArray } from "effect"
1
+ import * as Array from "effect/Array"
2
+ import * as Effect from "effect/Effect"
3
+ import * as Option from "effect/Option"
2
4
  import type { Sink } from "../Sink.js"
3
5
 
4
6
  const DISCARD = { discard: true } as const
@@ -65,8 +67,8 @@ export function runReduce<A, B>(
65
67
  return matchSyncProducer(producer, {
66
68
  Success: (a) => syncOnce(() => f(initial, a)),
67
69
  FromSync: (a) => syncOnce(() => f(initial, a())),
68
- FromArray: (a) => syncOnce(() => ReadonlyArray.reduce(a, initial, f)),
69
- FromIterable: (a) => syncOnce(() => ReadonlyArray.reduce(a, initial, f))
70
+ FromArray: (a) => syncOnce(() => Array.reduce(a, initial, f)),
71
+ FromIterable: (a) => syncOnce(() => Array.reduce(a, initial, f))
70
72
  })
71
73
  }
72
74
 
@@ -84,7 +86,7 @@ export function runReduceEffect<A, B, E2, R2>(
84
86
  }
85
87
 
86
88
  function arrayToSink<A, R2>(array: ReadonlyArray<A>, sink: Sink<A, never, R2>): Effect.Effect<unknown, never, R2> {
87
- if (array.length === 0) return Effect.unit
89
+ if (array.length === 0) return Effect.void
88
90
  else if (array.length === 1) return sink.onSuccess(array[0])
89
91
  else {
90
92
  const [first, ...rest] = array
@@ -97,7 +99,7 @@ function arrayToSink<A, R2>(array: ReadonlyArray<A>, sink: Sink<A, never, R2>):
97
99
  }
98
100
 
99
101
  function iterableToSink<A, R2>(array: Iterable<A>, sink: Sink<A, never, R2>): Effect.Effect<unknown, never, R2> {
100
- let effect: Effect.Effect<any, never, R2> = Effect.unit
102
+ let effect: Effect.Effect<any, never, R2> = Effect.void
101
103
 
102
104
  for (const item of array) {
103
105
  effect = Effect.zipRight(effect, sink.onSuccess(item))
@@ -37,7 +37,7 @@ function runWithKey<A, E, R, B extends PropertyKey, C, E2, R2, R3>(
37
37
  const run = fx.run(Sink.make(
38
38
  (cause) => sink.onFailure(cause),
39
39
  (value) =>
40
- Effect.gen(function*(_) {
40
+ Effect.gen(function*() {
41
41
  const key = options.getKey(value)
42
42
 
43
43
  // We don't need to do anything if the key is the same as the previous one
@@ -47,15 +47,15 @@ function runWithKey<A, E, R, B extends PropertyKey, C, E2, R2, R3>(
47
47
  // If the key is the same, we just need to update the value
48
48
  if (prev.key === key) {
49
49
  prev.value = value
50
- yield* _(RefSubject.set(prev.ref, value))
50
+ yield* RefSubject.set(prev.ref, value)
51
51
  return
52
52
  } else {
53
53
  // Otherwise, we need to remove the previous value
54
- yield* _(prev.ref.interrupt)
54
+ yield* prev.ref.interrupt
55
55
  }
56
56
  }
57
57
 
58
- const ref = yield* _(RefSubject.fromEffect(Effect.sync(() => state.value)))
58
+ const ref = yield* RefSubject.fromEffect(Effect.sync(() => state.value))
59
59
 
60
60
  // Create a new state
61
61
  const state: WithKeyState<A, B> = {
@@ -67,11 +67,11 @@ function runWithKey<A, E, R, B extends PropertyKey, C, E2, R2, R3>(
67
67
  previous = Option.some(state)
68
68
 
69
69
  // Create a new listener
70
- yield* _(fork(options.onValue(state.ref, state.key).run(sink)))
70
+ yield* fork(options.onValue(state.ref, state.key).run(sink))
71
71
  })
72
72
  ))
73
73
 
74
- return Effect.flatMap(run, () => Option.isSome(previous) ? previous.value.ref.interrupt : Effect.unit)
74
+ return Effect.flatMap(run, () => Option.isSome(previous) ? previous.value.ref.interrupt : Effect.void)
75
75
  }, ExecutionStrategy.sequential)
76
76
  }
77
77