@typed/fx 1.2.0 → 1.3.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 (153) hide show
  1. package/dist/Subject/HoldSubject.d.ts +3 -4
  2. package/dist/Subject/HoldSubject.d.ts.map +1 -1
  3. package/dist/Subject/HoldSubject.js +3 -3
  4. package/dist/Subject/HoldSubject.js.map +1 -1
  5. package/dist/Subject/RefSubject.d.ts +18 -2
  6. package/dist/Subject/RefSubject.d.ts.map +1 -1
  7. package/dist/Subject/RefSubject.js +98 -19
  8. package/dist/Subject/RefSubject.js.map +1 -1
  9. package/dist/Subject/Subject.js +1 -1
  10. package/dist/Subject/Subject.js.map +1 -1
  11. package/dist/Subject/SynchronizedSubject.d.ts.map +1 -1
  12. package/dist/Subject/SynchronizedSubject.js +7 -5
  13. package/dist/Subject/SynchronizedSubject.js.map +1 -1
  14. package/dist/_internal/RefCounter.js +1 -1
  15. package/dist/_internal/RefCounter.js.map +1 -1
  16. package/dist/cjs/Subject/HoldSubject.d.ts +3 -4
  17. package/dist/cjs/Subject/HoldSubject.d.ts.map +1 -1
  18. package/dist/cjs/Subject/HoldSubject.js +3 -3
  19. package/dist/cjs/Subject/HoldSubject.js.map +1 -1
  20. package/dist/cjs/Subject/RefSubject.d.ts +18 -2
  21. package/dist/cjs/Subject/RefSubject.d.ts.map +1 -1
  22. package/dist/cjs/Subject/RefSubject.js +98 -19
  23. package/dist/cjs/Subject/RefSubject.js.map +1 -1
  24. package/dist/cjs/Subject/SynchronizedSubject.d.ts.map +1 -1
  25. package/dist/cjs/Subject/SynchronizedSubject.js +6 -4
  26. package/dist/cjs/Subject/SynchronizedSubject.js.map +1 -1
  27. package/dist/cjs/_internal/RefCounter.js +1 -1
  28. package/dist/cjs/_internal/RefCounter.js.map +1 -1
  29. package/dist/cjs/constructor/index.d.ts +0 -4
  30. package/dist/cjs/constructor/index.d.ts.map +1 -1
  31. package/dist/cjs/constructor/index.js +0 -4
  32. package/dist/cjs/constructor/index.js.map +1 -1
  33. package/dist/cjs/constructor/promiseFx.d.ts +0 -2
  34. package/dist/cjs/constructor/promiseFx.d.ts.map +1 -1
  35. package/dist/cjs/constructor/promiseFx.js +1 -5
  36. package/dist/cjs/constructor/promiseFx.js.map +1 -1
  37. package/dist/cjs/operator/catchAllDefect.d.ts.map +1 -1
  38. package/dist/cjs/operator/catchAllDefect.js +2 -1
  39. package/dist/cjs/operator/catchAllDefect.js.map +1 -1
  40. package/dist/cjs/operator/continueWith.js +1 -1
  41. package/dist/cjs/operator/continueWith.js.map +1 -1
  42. package/dist/cjs/operator/debounce.js +1 -1
  43. package/dist/cjs/operator/debounce.js.map +1 -1
  44. package/dist/cjs/operator/during.js +1 -1
  45. package/dist/cjs/operator/during.js.map +1 -1
  46. package/dist/cjs/operator/hold.d.ts.map +1 -1
  47. package/dist/cjs/operator/hold.js +8 -8
  48. package/dist/cjs/operator/hold.js.map +1 -1
  49. package/dist/cjs/operator/loop.js +1 -1
  50. package/dist/cjs/operator/loop.js.map +1 -1
  51. package/dist/cjs/operator/multicast.js +3 -3
  52. package/dist/cjs/operator/multicast.js.map +1 -1
  53. package/dist/cjs/operator/skipRepeats.js +2 -2
  54. package/dist/cjs/operator/skipRepeats.js.map +1 -1
  55. package/dist/cjs/operator/switchMatch.js +1 -1
  56. package/dist/cjs/operator/switchMatch.js.map +1 -1
  57. package/dist/cjs/operator/tapDefect.d.ts.map +1 -1
  58. package/dist/cjs/operator/tapDefect.js +2 -1
  59. package/dist/cjs/operator/tapDefect.js.map +1 -1
  60. package/dist/cjs/run/collectAll.js +1 -1
  61. package/dist/cjs/run/collectAll.js.map +1 -1
  62. package/dist/cjs/run/collectN.js +1 -1
  63. package/dist/cjs/run/collectN.js.map +1 -1
  64. package/dist/cjs/run/reduce.js +1 -1
  65. package/dist/cjs/run/reduce.js.map +1 -1
  66. package/dist/constructor/done.js +1 -1
  67. package/dist/constructor/done.js.map +1 -1
  68. package/dist/constructor/empty.js +1 -1
  69. package/dist/constructor/empty.js.map +1 -1
  70. package/dist/constructor/fromArray.js +1 -1
  71. package/dist/constructor/fromArray.js.map +1 -1
  72. package/dist/constructor/fromEffect.js +1 -1
  73. package/dist/constructor/fromEffect.js.map +1 -1
  74. package/dist/constructor/fromIterable.js +1 -1
  75. package/dist/constructor/fromIterable.js.map +1 -1
  76. package/dist/constructor/index.d.ts +0 -4
  77. package/dist/constructor/index.d.ts.map +1 -1
  78. package/dist/constructor/index.js +0 -4
  79. package/dist/constructor/index.js.map +1 -1
  80. package/dist/constructor/never.js +1 -1
  81. package/dist/constructor/never.js.map +1 -1
  82. package/dist/constructor/promiseFx.d.ts +0 -2
  83. package/dist/constructor/promiseFx.d.ts.map +1 -1
  84. package/dist/constructor/promiseFx.js +0 -2
  85. package/dist/constructor/promiseFx.js.map +1 -1
  86. package/dist/operator/catchAllDefect.d.ts.map +1 -1
  87. package/dist/operator/catchAllDefect.js +2 -1
  88. package/dist/operator/catchAllDefect.js.map +1 -1
  89. package/dist/operator/continueWith.js +2 -2
  90. package/dist/operator/continueWith.js.map +1 -1
  91. package/dist/operator/debounce.js +1 -1
  92. package/dist/operator/debounce.js.map +1 -1
  93. package/dist/operator/during.js +1 -1
  94. package/dist/operator/during.js.map +1 -1
  95. package/dist/operator/hold.d.ts.map +1 -1
  96. package/dist/operator/hold.js +8 -8
  97. package/dist/operator/hold.js.map +1 -1
  98. package/dist/operator/loop.js +1 -1
  99. package/dist/operator/loop.js.map +1 -1
  100. package/dist/operator/multicast.js +3 -3
  101. package/dist/operator/multicast.js.map +1 -1
  102. package/dist/operator/scanEffect.js +1 -1
  103. package/dist/operator/scanEffect.js.map +1 -1
  104. package/dist/operator/skipRepeats.js +2 -2
  105. package/dist/operator/skipRepeats.js.map +1 -1
  106. package/dist/operator/switchMatch.js +1 -1
  107. package/dist/operator/switchMatch.js.map +1 -1
  108. package/dist/operator/tapDefect.d.ts.map +1 -1
  109. package/dist/operator/tapDefect.js +2 -1
  110. package/dist/operator/tapDefect.js.map +1 -1
  111. package/dist/run/collectAll.js +1 -1
  112. package/dist/run/collectAll.js.map +1 -1
  113. package/dist/run/collectN.js +1 -1
  114. package/dist/run/collectN.js.map +1 -1
  115. package/dist/run/reduce.js +1 -1
  116. package/dist/run/reduce.js.map +1 -1
  117. package/dist/run/run.js +1 -1
  118. package/dist/run/run.js.map +1 -1
  119. package/dist/tsconfig.cjs.build.tsbuildinfo +1 -1
  120. package/package.json +4 -4
  121. package/src/Subject/HoldSubject.ts +4 -4
  122. package/src/Subject/RefSubject.ts +9 -11
  123. package/src/Subject/SynchronizedSubject.ts +4 -4
  124. package/src/_internal/RefCounter.ts +1 -1
  125. package/src/constructor/index.ts +0 -4
  126. package/src/constructor/promiseFx.ts +0 -22
  127. package/src/operator/catchAllDefect.ts +2 -1
  128. package/src/operator/continueWith.ts +2 -2
  129. package/src/operator/debounce.ts +1 -1
  130. package/src/operator/during.ts +1 -1
  131. package/src/operator/hold.ts +9 -8
  132. package/src/operator/loop.ts +1 -1
  133. package/src/operator/multicast.ts +3 -3
  134. package/src/operator/skipRepeats.ts +2 -2
  135. package/src/operator/switchMatch.ts +1 -1
  136. package/src/operator/tapDefect.ts +2 -1
  137. package/src/run/collectAll.ts +1 -1
  138. package/src/run/collectN.ts +1 -1
  139. package/src/run/reduce.ts +1 -1
  140. package/tsconfig.build.tsbuildinfo +1 -1
  141. package/tsconfig.cjs.build.json +2 -2
  142. package/dist/Subject/Computed.d.ts +0 -12
  143. package/dist/Subject/Computed.d.ts.map +0 -1
  144. package/dist/Subject/Computed.js +0 -54
  145. package/dist/Subject/Computed.js.map +0 -1
  146. package/dist/cjs/Subject/Computed.d.ts +0 -12
  147. package/dist/cjs/Subject/Computed.d.ts.map +0 -1
  148. package/dist/cjs/Subject/Computed.js +0 -80
  149. package/dist/cjs/Subject/Computed.js.map +0 -1
  150. package/src/constructor/tryCatchPromise.ts +0 -11
  151. package/src/constructor/tryCatchPromiseAbort.ts +0 -11
  152. package/src/constructor/tryPromise.ts +0 -11
  153. package/src/constructor/tryPromiseAbort.ts +0 -10
@@ -1,5 +1,5 @@
1
1
  import { identity } from '@effect/data/Function'
2
- import { type MutableRef, make } from '@effect/data/MutableRef'
2
+ import * as MutableRef from '@effect/data/MutableRef'
3
3
  import { type Option, none } from '@effect/data/Option'
4
4
  import * as Effect from '@effect/io/Effect'
5
5
 
@@ -32,7 +32,7 @@ export namespace HoldSubject {
32
32
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
33
33
  export type OutputsOf<T> = [T] extends [Variance<infer _E, infer A>] ? A : never
34
34
 
35
- export function unsafeMake<E, A>(value: MutableRef<Option<A>> = make(none())): HoldSubject<E, A> {
35
+ export function unsafeMake<E, A>(value: MutableRef.MutableRef<Option<A>> = MutableRef.make(none())): HoldSubject<E, A> {
36
36
  return new HoldSubjectImpl(value)
37
37
  }
38
38
 
@@ -43,11 +43,11 @@ export namespace HoldSubject {
43
43
  };
44
44
  readonly [TypeId]: HoldSubject.Variance<E, A>[TypeId] = this[Subject.TypeId]
45
45
 
46
- constructor(value: MutableRef<Option<A>>) {
46
+ constructor(value: MutableRef.MutableRef<Option<A>>) {
47
47
  super(never, value)
48
48
  }
49
49
 
50
- readonly value = Effect.sync(() => this.current.get())
50
+ readonly value = Effect.sync(() => MutableRef.get(this.current))
51
51
  }
52
52
  }
53
53
 
@@ -25,11 +25,9 @@ export interface RefSubject<A> extends HoldSubject<never, A>, Ref.Ref<A> {
25
25
  readonly set: (a: A) => Effect.Effect<never, never, A>
26
26
  readonly update: (f: (a: A) => A) => Effect.Effect<never, never, A>
27
27
  readonly delete: Effect.Effect<never, never, A>
28
-
29
28
  readonly compute: <R, E, B>(
30
29
  f: (a: A) => Effect.Effect<R, E, B>,
31
30
  ) => Effect.Effect<R | Scope.Scope, never, Computed<E, B>>
32
-
33
31
  readonly computeSync: <B>(f: (a: A) => B) => Effect.Effect<Scope.Scope, never, Computed<never, B>>
34
32
  }
35
33
 
@@ -50,14 +48,14 @@ export namespace RefSubject {
50
48
  const current = MutableRef.make(Option.some(initial()))
51
49
  const subject = HoldSubject.unsafeMake<never, A>(current)
52
50
 
53
- const getValue = () => pipe(current.get(), Option.getOrElse(initial))
51
+ const getValue = () => pipe(current, MutableRef.get, Option.getOrElse(initial))
54
52
 
55
53
  const modify = <B>(f: (a: A) => readonly [B, A]): Effect.Effect<never, never, B> =>
56
- Effect.suspendSucceed(() => {
54
+ Effect.suspend(() => {
57
55
  const currentValue = getValue()
58
56
  const [b, a] = f(currentValue)
59
57
 
60
- current.set(Option.some(a))
58
+ MutableRef.set(current, (Option.some(a)))
61
59
 
62
60
  if (eq(currentValue, a)) {
63
61
  return Effect.succeed(b)
@@ -82,9 +80,9 @@ export namespace RefSubject {
82
80
  modify,
83
81
  ...makeDerivations(modify, Effect.sync(getValue)),
84
82
  delete: Effect.sync(() => {
85
- const option = current.get()
83
+ const option = MutableRef.get(current)
86
84
  const reset = initial()
87
- current.set(Option.some(reset))
85
+ MutableRef.set(current, (Option.some(reset)))
88
86
 
89
87
  return Option.getOrElse(option, () => reset)
90
88
  }),
@@ -105,7 +103,7 @@ export namespace RefSubject {
105
103
  type Val = { readonly [K in keyof Subjects]: ValueOf<Subjects[K]> }
106
104
  const length = subjects.length
107
105
 
108
- const getUnderlyingValues = Effect.tuple(
106
+ const getUnderlyingValues = Effect.all(
109
107
  ...ReadonlyArray.mapNonEmpty(subjects, (s) => s.get),
110
108
  ) as Effect.Effect<never, never, Val>
111
109
 
@@ -130,7 +128,7 @@ export namespace RefSubject {
130
128
 
131
129
  // Override event to replicate events into underlying subjects
132
130
  const event = (val: Val) =>
133
- Effect.tuple(...ReadonlyArray.mapNonEmpty(subjects, (s, i) => s.event(val[i])))
131
+ Effect.all(...ReadonlyArray.mapNonEmpty(subjects, (s, i) => s.event(val[i])))
134
132
 
135
133
  // Override modify to replicate events into underlying subjects
136
134
  const modify = <B>(f: (a: Val) => readonly [B, Val]): Effect.Effect<never, never, B> =>
@@ -175,7 +173,7 @@ export namespace RefSubject {
175
173
  > {
176
174
  type Val = { readonly [K in keyof Subjects]: ValueOf<Subjects[K]> }
177
175
 
178
- const getUnderlyingValues = Effect.struct(
176
+ const getUnderlyingValues = Effect.all(
179
177
  ReadonlyRecord.map(subjects, (s) => s.get),
180
178
  ) as Effect.Effect<never, never, Val>
181
179
 
@@ -199,7 +197,7 @@ export namespace RefSubject {
199
197
 
200
198
  // Override event to replicate events into underlying subjects
201
199
  const event = (val: Val) =>
202
- Effect.struct(ReadonlyRecord.map(subjects, (s, i) => s.event(val[i])))
200
+ Effect.all(ReadonlyRecord.map(subjects, (s, i) => s.event(val[i])))
203
201
 
204
202
  // Override modify to replicate events into underlying subjects
205
203
  const modify = <B>(f: (a: Val) => readonly [B, Val]): Effect.Effect<never, never, B> =>
@@ -34,11 +34,11 @@ export namespace SynchronizedSubject {
34
34
 
35
35
  const getValue = () =>
36
36
  pipe(
37
- mutableRef.get(),
37
+ MutableRef.get(mutableRef),
38
38
  Option.getOrElse(() => {
39
39
  const a = initial()
40
40
 
41
- mutableRef.set(Option.some(a))
41
+ MutableRef.set(mutableRef, Option.some(a))
42
42
 
43
43
  return a
44
44
  }),
@@ -56,7 +56,7 @@ export namespace SynchronizedSubject {
56
56
  return b
57
57
  }
58
58
 
59
- mutableRef.set(Option.some(a))
59
+ MutableRef.set(mutableRef, Option.some(a))
60
60
 
61
61
  yield* $(subject.event(a))
62
62
 
@@ -100,7 +100,7 @@ export namespace SynchronizedSubject {
100
100
  delete: Effect.sync(() => {
101
101
  const value = getValue()
102
102
 
103
- mutableRef.set(Option.some(value))
103
+ MutableRef.set(mutableRef, Option.some(value))
104
104
 
105
105
  return value
106
106
  }),
@@ -33,7 +33,7 @@ export class RefCounter {
33
33
 
34
34
  readonly wait = Deferred.await(this.deferred)
35
35
 
36
- private checkShouldClose = Effect.suspendSucceed(() => {
36
+ private checkShouldClose = Effect.suspend(() => {
37
37
  const interrupt = this.fiber ? Fiber.interrupt(this.fiber) : Effect.unit()
38
38
 
39
39
  this.fiber = undefined
@@ -38,8 +38,4 @@ export * from './serviceWithFx.js'
38
38
  export * from './succeed.js'
39
39
  export * from './suspend.js'
40
40
  export * from './sync.js'
41
- export * from './tryCatchPromise.js'
42
- export * from './tryCatchPromiseAbort.js'
43
- export * from './tryPromise.js'
44
- export * from './tryPromiseAbort.js'
45
41
  export * from './unit.js'
@@ -20,25 +20,3 @@ export const promiseInterruptFx = <R, E, A>(
20
20
  Effect.matchCauseEffect(sink.error, (fx) => fx.run(sink)),
21
21
  ),
22
22
  )
23
-
24
- export const tryCatchPromiseFx = <R, E, A, E2>(
25
- f: () => Promise<Fx<R, E, A>>,
26
- onError: (u: unknown) => E2,
27
- ): Fx<R, E | E2, A> =>
28
- Fx((sink) =>
29
- pipe(
30
- Effect.tryCatchPromise(f, onError),
31
- Effect.matchCauseEffect(sink.error, (fx) => fx.run(sink)),
32
- ),
33
- )
34
-
35
- export const tryCatchPromiseInterruptFx = <R, E, A, E2>(
36
- f: (signal: AbortSignal) => Promise<Fx<R, E, A>>,
37
- onError: (u: unknown) => E2,
38
- ): Fx<R, E | E2, A> =>
39
- Fx((sink) =>
40
- pipe(
41
- Effect.tryCatchPromiseInterrupt(f, onError),
42
- Effect.matchCauseEffect(sink.error, (fx) => fx.run(sink)),
43
- ),
44
- )
@@ -1,5 +1,6 @@
1
1
  import { pipe } from '@effect/data/Function'
2
2
  import { match } from '@effect/data/Option'
3
+ import * as Chunk from '@effect/data/Chunk'
3
4
  import * as Cause from '@effect/io/Cause'
4
5
 
5
6
  import type { Fx } from '../Fx.js'
@@ -14,7 +15,7 @@ export function catchAllDefect<R2, E2, B>(f: (defect: unknown) => Fx<R2, E2, B>)
14
15
  catchAllCause(
15
16
  (cause): Fx<R2, E | E2, B> =>
16
17
  pipe(
17
- Cause.defects(cause).get(0),
18
+ Chunk.get(Cause.defects(cause), 0),
18
19
  match(() => failCause(cause), f),
19
20
  ),
20
21
  ),
@@ -1,4 +1,4 @@
1
- import { suspendSucceed } from '@effect/io/Effect'
1
+ import { suspend } from '@effect/io/Effect'
2
2
 
3
3
  import { Fx } from '../Fx.js'
4
4
 
@@ -24,5 +24,5 @@ class ContinueWithSink<R, E, A, R2, E2, B> {
24
24
 
25
25
  event = this.sink.event
26
26
  error = this.sink.error
27
- end = suspendSucceed(() => this.f().run(this.sink))
27
+ end = suspend(() => this.f().run(this.sink))
28
28
  }
@@ -27,7 +27,7 @@ class DebounceFx<R, E, A> extends Fx.Variance<R, E, A> implements Fx<R, E, A> {
27
27
  return fx.run(
28
28
  Fx.Sink(
29
29
  (a: A) =>
30
- Effect.suspendSucceed(() =>
30
+ Effect.suspend(() =>
31
31
  pipe(
32
32
  scheduledFiber ? Fiber.interrupt(scheduledFiber) : counter.increment,
33
33
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -42,7 +42,7 @@ class DuringFx<R, E, A, R2, E2, R3, E3, B>
42
42
  signal.run(
43
43
  Fx.Sink(
44
44
  (endSignal) =>
45
- Effect.suspendSucceed(() => {
45
+ Effect.suspend(() => {
46
46
  shouldRun = true
47
47
 
48
48
  return endSignal.run(Fx.Sink(() => earlyExit, sink.error, earlyExit))
@@ -34,8 +34,8 @@ export class HoldFx<R, E, A> extends MulticastFx<R, E, A> implements Fx<R, E, A>
34
34
  }
35
35
 
36
36
  run<R2>(sink: Fx.Sink<R2, E, A>): Effect.Effect<Scope | R | R2, never, void> {
37
- return Effect.suspendSucceed(() => {
38
- if (Option.isSome(this.current.get())) {
37
+ return Effect.suspend(() => {
38
+ if (Option.isSome(MutableRef.get(this.current))) {
39
39
  return pipe(
40
40
  this.scheduleFlush(sink),
41
41
  Effect.flatMap(() => super.run(sink)),
@@ -47,7 +47,7 @@ export class HoldFx<R, E, A> extends MulticastFx<R, E, A> implements Fx<R, E, A>
47
47
  }
48
48
 
49
49
  event(a: A) {
50
- return Effect.suspendSucceed(() => {
50
+ return Effect.suspend(() => {
51
51
  this.addValue(a)
52
52
 
53
53
  return pipe(
@@ -58,7 +58,7 @@ export class HoldFx<R, E, A> extends MulticastFx<R, E, A> implements Fx<R, E, A>
58
58
  }
59
59
 
60
60
  error(cause: Cause.Cause<E>) {
61
- return Effect.suspendSucceed(() =>
61
+ return Effect.suspend(() =>
62
62
  pipe(
63
63
  this.flushPending(),
64
64
  Effect.flatMap(() => super.error(cause)),
@@ -67,7 +67,7 @@ export class HoldFx<R, E, A> extends MulticastFx<R, E, A> implements Fx<R, E, A>
67
67
  }
68
68
 
69
69
  get end() {
70
- return Effect.suspendSucceed(() =>
70
+ return Effect.suspend(() =>
71
71
  pipe(
72
72
  this.flushPending(),
73
73
  Effect.flatMap(() => super.end),
@@ -76,11 +76,12 @@ export class HoldFx<R, E, A> extends MulticastFx<R, E, A> implements Fx<R, E, A>
76
76
  }
77
77
 
78
78
  protected scheduleFlush(sink: Fx.Sink<any, E, A>) {
79
- return Effect.suspendSucceed(() => {
79
+ return Effect.suspend(() => {
80
80
  this.pendingSinks.push([
81
81
  sink,
82
82
  pipe(
83
- this.current.get(),
83
+ this.current,
84
+ MutableRef.get,
84
85
  Option.match(
85
86
  () => [],
86
87
  (a) => [a],
@@ -137,7 +138,7 @@ export class HoldFx<R, E, A> extends MulticastFx<R, E, A> implements Fx<R, E, A>
137
138
  }
138
139
 
139
140
  protected addValue(a: A) {
140
- this.current.set(Option.some(a))
141
+ MutableRef.set(this.current, Option.some(a))
141
142
  this.pendingSinks.forEach(([, events]) => events.push(a))
142
143
  }
143
144
  }
@@ -30,7 +30,7 @@ class LoopSink<R, E, A, B, C> implements Fx.Sink<R, E, A> {
30
30
  ) {}
31
31
 
32
32
  readonly event = (a: A) =>
33
- Effect.suspendSucceed(() => {
33
+ Effect.suspend(() => {
34
34
  const [c, b] = this.f(this.acc, a)
35
35
 
36
36
  this.acc = b
@@ -55,13 +55,13 @@ export class MulticastFx<R, E, A>
55
55
  }
56
56
 
57
57
  event(a: A) {
58
- return Effect.suspendSucceed(() =>
58
+ return Effect.suspend(() =>
59
59
  Effect.forEachDiscard(this.observers.slice(), (observer) => this.runEvent(a, observer)),
60
60
  )
61
61
  }
62
62
 
63
63
  error(cause: Cause<E>) {
64
- return Effect.suspendSucceed(() =>
64
+ return Effect.suspend(() =>
65
65
  pipe(
66
66
  Effect.forEachDiscard(this.observers.slice(), (observer) => this.runError(cause, observer)),
67
67
  Effect.tap(() => this.cleanup()),
@@ -70,7 +70,7 @@ export class MulticastFx<R, E, A>
70
70
  }
71
71
 
72
72
  get end(): Effect.Effect<never, never, void> {
73
- return Effect.suspendSucceed(() =>
73
+ return Effect.suspend(() =>
74
74
  pipe(
75
75
  this.observers.slice(),
76
76
  Effect.forEachDiscard((observer) => this.runEnd(observer)),
@@ -22,13 +22,13 @@ class SkipRepeatsWithFx<R, E, A> extends Fx.Variance<R, E, A> implements Fx<R, E
22
22
  }
23
23
 
24
24
  run<R2>(sink: Fx.Sink<R2, E, A>) {
25
- return Effect.suspendSucceed(() => {
25
+ return Effect.suspend(() => {
26
26
  let previous: Option.Option<A> = Option.none()
27
27
 
28
28
  return this.self.run({
29
29
  ...sink,
30
30
  event: (a) =>
31
- Effect.suspendSucceed(() => {
31
+ Effect.suspend(() => {
32
32
  if (Option.isNone(previous) || !this.equals(previous.value, a)) {
33
33
  previous = Option.some(a)
34
34
 
@@ -49,7 +49,7 @@ class SwitchMatchFx<R, E, A, R2, E2, B, R3, E3, C>
49
49
 
50
50
  let firstError = true
51
51
 
52
- const handleError = Effect.suspendSucceed(() =>
52
+ const handleError = Effect.suspend(() =>
53
53
  firstError ? ((firstError = false), Effect.asUnit(counter.decrement)) : Effect.unit(),
54
54
  )
55
55
 
@@ -1,5 +1,6 @@
1
1
  import { pipe } from '@effect/data/Function'
2
2
  import { match } from '@effect/data/Option'
3
+ import * as Chunk from '@effect/data/Chunk'
3
4
  import * as Cause from '@effect/io/Cause'
4
5
  import * as Effect from '@effect/io/Effect'
5
6
 
@@ -14,7 +15,7 @@ export function tapDefect<R2, E2, B>(f: (defect: unknown) => Effect.Effect<R2, E
14
15
  tapCause(
15
16
  (cause): Effect.Effect<R2, E | E2, B> =>
16
17
  pipe(
17
- Cause.defects(cause).get(0),
18
+ Chunk.get(Cause.defects(cause), 0),
18
19
  match(() => Effect.failCause(cause), f),
19
20
  ),
20
21
  ),
@@ -6,7 +6,7 @@ import type { Fx } from '../Fx.js'
6
6
  import { reduce } from './reduce.js'
7
7
 
8
8
  export const collectAll = <R, E, A>(fx: Fx<R, E, A>): Effect.Effect<R, E, readonly A[]> =>
9
- Effect.suspendSucceed(() =>
9
+ Effect.suspend(() =>
10
10
  pipe(
11
11
  fx,
12
12
  reduce([] as A[], (acc, a) => {
@@ -9,7 +9,7 @@ import { reduce } from './reduce.js'
9
9
  export const collectN =
10
10
  (amount: number) =>
11
11
  <R, E, A>(fx: Fx<R, E, A>): Effect.Effect<R, E, readonly A[]> =>
12
- Effect.suspendSucceed(() =>
12
+ Effect.suspend(() =>
13
13
  pipe(
14
14
  fx,
15
15
  take(amount),
package/src/run/reduce.ts CHANGED
@@ -9,7 +9,7 @@ export const reduce: <B, A>(
9
9
  seed: B,
10
10
  f: (acc: B, a: A) => B,
11
11
  ) => <R, E>(fx: Fx<R, E, A>) => Effect.Effect<R, E, B> = (seed, f) => (fx) =>
12
- Effect.suspendSucceed(() => {
12
+ Effect.suspend(() => {
13
13
  let acc = seed
14
14
 
15
15
  return pipe(