effect 2.4.18 → 2.4.19

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 (129) hide show
  1. package/Readable/package.json +6 -0
  2. package/RegExp/package.json +6 -0
  3. package/Subscribable/package.json +6 -0
  4. package/dist/cjs/Duration.js +39 -2
  5. package/dist/cjs/Duration.js.map +1 -1
  6. package/dist/cjs/List.js +5 -4
  7. package/dist/cjs/List.js.map +1 -1
  8. package/dist/cjs/Readable.js +79 -0
  9. package/dist/cjs/Readable.js.map +1 -0
  10. package/dist/cjs/RegExp.js +24 -0
  11. package/dist/cjs/RegExp.js.map +1 -0
  12. package/dist/cjs/Subscribable.js +91 -0
  13. package/dist/cjs/Subscribable.js.map +1 -0
  14. package/dist/cjs/SubscriptionRef.js.map +1 -1
  15. package/dist/cjs/TestAnnotation.js +2 -1
  16. package/dist/cjs/TestAnnotation.js.map +1 -1
  17. package/dist/cjs/index.js +8 -2
  18. package/dist/cjs/index.js.map +1 -1
  19. package/dist/cjs/internal/cause.js +3 -2
  20. package/dist/cjs/internal/cause.js.map +1 -1
  21. package/dist/cjs/internal/configProvider.js +2 -2
  22. package/dist/cjs/internal/configProvider.js.map +1 -1
  23. package/dist/cjs/internal/core-effect.js +28 -14
  24. package/dist/cjs/internal/core-effect.js.map +1 -1
  25. package/dist/cjs/internal/core.js +16 -85
  26. package/dist/cjs/internal/core.js.map +1 -1
  27. package/dist/cjs/internal/effect/circular.js +5 -0
  28. package/dist/cjs/internal/effect/circular.js.map +1 -1
  29. package/dist/cjs/internal/errors.js +13 -0
  30. package/dist/cjs/internal/errors.js.map +1 -0
  31. package/dist/cjs/internal/fiberRuntime.js +79 -39
  32. package/dist/cjs/internal/fiberRuntime.js.map +1 -1
  33. package/dist/cjs/internal/hashMap.js +1 -1
  34. package/dist/cjs/internal/hashMap.js.map +1 -1
  35. package/dist/cjs/internal/matcher.js +5 -4
  36. package/dist/cjs/internal/matcher.js.map +1 -1
  37. package/dist/cjs/internal/ref.js +6 -1
  38. package/dist/cjs/internal/ref.js.map +1 -1
  39. package/dist/cjs/internal/schedule/intervals.js +2 -1
  40. package/dist/cjs/internal/schedule/intervals.js.map +1 -1
  41. package/dist/cjs/internal/subscriptionRef.js +8 -0
  42. package/dist/cjs/internal/subscriptionRef.js.map +1 -1
  43. package/dist/cjs/internal/trie.js +1 -1
  44. package/dist/cjs/internal/trie.js.map +1 -1
  45. package/dist/cjs/internal/version.js +1 -1
  46. package/dist/dts/Duration.d.ts +16 -0
  47. package/dist/dts/Duration.d.ts.map +1 -1
  48. package/dist/dts/List.d.ts.map +1 -1
  49. package/dist/dts/Readable.d.ts +55 -0
  50. package/dist/dts/Readable.d.ts.map +1 -0
  51. package/dist/dts/Ref.d.ts +2 -2
  52. package/dist/dts/Ref.d.ts.map +1 -1
  53. package/dist/dts/RegExp.d.ts +17 -0
  54. package/dist/dts/RegExp.d.ts.map +1 -0
  55. package/dist/dts/Subscribable.d.ts +59 -0
  56. package/dist/dts/Subscribable.d.ts.map +1 -0
  57. package/dist/dts/SubscriptionRef.d.ts +2 -2
  58. package/dist/dts/SubscriptionRef.d.ts.map +1 -1
  59. package/dist/dts/TestAnnotation.d.ts.map +1 -1
  60. package/dist/dts/index.d.ts +14 -0
  61. package/dist/dts/index.d.ts.map +1 -1
  62. package/dist/dts/internal/errors.d.ts +5 -0
  63. package/dist/dts/internal/errors.d.ts.map +1 -0
  64. package/dist/esm/Duration.js +38 -1
  65. package/dist/esm/Duration.js.map +1 -1
  66. package/dist/esm/List.js +4 -3
  67. package/dist/esm/List.js.map +1 -1
  68. package/dist/esm/Readable.js +45 -0
  69. package/dist/esm/Readable.js.map +1 -0
  70. package/dist/esm/RegExp.js +17 -0
  71. package/dist/esm/RegExp.js.map +1 -0
  72. package/dist/esm/Subscribable.js +56 -0
  73. package/dist/esm/Subscribable.js.map +1 -0
  74. package/dist/esm/SubscriptionRef.js.map +1 -1
  75. package/dist/esm/TestAnnotation.js +2 -1
  76. package/dist/esm/TestAnnotation.js.map +1 -1
  77. package/dist/esm/index.js +14 -0
  78. package/dist/esm/index.js.map +1 -1
  79. package/dist/esm/internal/cause.js +3 -2
  80. package/dist/esm/internal/cause.js.map +1 -1
  81. package/dist/esm/internal/configProvider.js +2 -2
  82. package/dist/esm/internal/configProvider.js.map +1 -1
  83. package/dist/esm/internal/core-effect.js +25 -12
  84. package/dist/esm/internal/core-effect.js.map +1 -1
  85. package/dist/esm/internal/core.js +13 -82
  86. package/dist/esm/internal/core.js.map +1 -1
  87. package/dist/esm/internal/effect/circular.js +5 -0
  88. package/dist/esm/internal/effect/circular.js.map +1 -1
  89. package/dist/esm/internal/errors.js +6 -0
  90. package/dist/esm/internal/errors.js.map +1 -0
  91. package/dist/esm/internal/fiberRuntime.js +77 -36
  92. package/dist/esm/internal/fiberRuntime.js.map +1 -1
  93. package/dist/esm/internal/hashMap.js +1 -1
  94. package/dist/esm/internal/hashMap.js.map +1 -1
  95. package/dist/esm/internal/matcher.js +4 -3
  96. package/dist/esm/internal/matcher.js.map +1 -1
  97. package/dist/esm/internal/ref.js +6 -1
  98. package/dist/esm/internal/ref.js.map +1 -1
  99. package/dist/esm/internal/schedule/intervals.js +2 -1
  100. package/dist/esm/internal/schedule/intervals.js.map +1 -1
  101. package/dist/esm/internal/subscriptionRef.js +8 -0
  102. package/dist/esm/internal/subscriptionRef.js.map +1 -1
  103. package/dist/esm/internal/trie.js +1 -1
  104. package/dist/esm/internal/trie.js.map +1 -1
  105. package/dist/esm/internal/version.js +1 -1
  106. package/package.json +25 -1
  107. package/src/Duration.ts +54 -1
  108. package/src/List.ts +5 -3
  109. package/src/Readable.ts +92 -0
  110. package/src/Ref.ts +2 -2
  111. package/src/RegExp.ts +17 -0
  112. package/src/Subscribable.ts +99 -0
  113. package/src/SubscriptionRef.ts +2 -2
  114. package/src/TestAnnotation.ts +2 -1
  115. package/src/index.ts +17 -0
  116. package/src/internal/cause.ts +3 -2
  117. package/src/internal/configProvider.ts +2 -3
  118. package/src/internal/core-effect.ts +78 -66
  119. package/src/internal/core.ts +13 -150
  120. package/src/internal/effect/circular.ts +7 -1
  121. package/src/internal/errors.ts +7 -0
  122. package/src/internal/fiberRuntime.ts +120 -86
  123. package/src/internal/hashMap.ts +1 -1
  124. package/src/internal/matcher.ts +5 -3
  125. package/src/internal/ref.ts +8 -2
  126. package/src/internal/schedule/intervals.ts +2 -1
  127. package/src/internal/subscriptionRef.ts +8 -0
  128. package/src/internal/trie.ts +1 -1
  129. package/src/internal/version.ts +1 -1
@@ -15,6 +15,7 @@ import * as MutableHashMap from "../../MutableHashMap.js"
15
15
  import * as Option from "../../Option.js"
16
16
  import { pipeArguments } from "../../Pipeable.js"
17
17
  import * as Predicate from "../../Predicate.js"
18
+ import * as Readable from "../../Readable.js"
18
19
  import type * as Ref from "../../Ref.js"
19
20
  import type * as Schedule from "../../Schedule.js"
20
21
  import { currentScheduler } from "../../Scheduler.js"
@@ -556,10 +557,15 @@ export const synchronizedVariance = {
556
557
  class SynchronizedImpl<in out A> implements Synchronized.SynchronizedRef<A> {
557
558
  readonly [SynchronizedTypeId] = synchronizedVariance
558
559
  readonly [internalRef.RefTypeId] = internalRef.refVariance
560
+ readonly [Readable.TypeId]: Readable.TypeId
559
561
  constructor(
560
562
  readonly ref: Ref.Ref<A>,
561
563
  readonly withLock: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
562
- ) {}
564
+ ) {
565
+ this[Readable.TypeId] = Readable.TypeId
566
+ this.get = internalRef.get(this.ref)
567
+ }
568
+ readonly get: Effect.Effect<A>
563
569
  modify<B>(f: (a: A) => readonly [B, A]): Effect.Effect<B> {
564
570
  return this.modifyEffect((a) => core.succeed(f(a)))
565
571
  }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @since 2.0.0
3
+ */
4
+
5
+ /** @internal */
6
+ export const getBugErrorMessage = (message: string) =>
7
+ `BUG: ${message} - please report an issue at https://github.com/Effect-TS/effect/issues`
@@ -2668,7 +2668,7 @@ export const scopeWith = <A, E, R>(
2668
2668
 
2669
2669
  /* @internal */
2670
2670
  export const scopedEffect = <A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, Exclude<R, Scope.Scope>> =>
2671
- core.flatMap(scopeMake(), (scope) => scopeUse(scope)(effect))
2671
+ core.flatMap(scopeMake(), (scope) => scopeUse(effect, scope))
2672
2672
 
2673
2673
  /* @internal */
2674
2674
  export const sequentialFinalizers = <A, E, R>(self: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> =>
@@ -2988,96 +2988,122 @@ export const withRuntimeFlagsScoped = (
2988
2988
  )
2989
2989
  }
2990
2990
 
2991
- // circular with ReleaseMap
2991
+ // circular with Scope
2992
+
2993
+ /** @internal */
2994
+ export const scopeTag = Context.GenericTag<Scope.Scope>("effect/Scope")
2992
2995
 
2993
2996
  /* @internal */
2994
- export const releaseMapReleaseAll = (
2995
- strategy: ExecutionStrategy.ExecutionStrategy,
2996
- exit: Exit.Exit<unknown, unknown>
2997
- ) =>
2998
- (self: core.ReleaseMap): Effect.Effect<void> =>
2999
- core.suspend(() => {
3000
- switch (self.state._tag) {
3001
- case "Exited": {
2997
+ export const scope: Effect.Effect<Scope.Scope, never, Scope.Scope> = scopeTag
2998
+
2999
+ interface ScopeImpl extends Scope.CloseableScope {
3000
+ state: {
3001
+ readonly _tag: "Open"
3002
+ readonly finalizers: Set<Scope.Scope.Finalizer>
3003
+ } | {
3004
+ readonly _tag: "Closed"
3005
+ readonly exit: Exit.Exit<unknown, unknown>
3006
+ }
3007
+ }
3008
+
3009
+ const scopeUnsafeAddFinalizer = (scope: ScopeImpl, fin: Scope.Scope.Finalizer): void => {
3010
+ if (scope.state._tag === "Open") {
3011
+ scope.state.finalizers.add(fin)
3012
+ }
3013
+ }
3014
+
3015
+ const ScopeImplProto: Omit<ScopeImpl, "strategy" | "state"> = {
3016
+ [core.ScopeTypeId]: core.ScopeTypeId,
3017
+ [core.CloseableScopeTypeId]: core.CloseableScopeTypeId,
3018
+ pipe() {
3019
+ return pipeArguments(this, arguments)
3020
+ },
3021
+ fork(this: ScopeImpl, strategy) {
3022
+ return core.sync(() => {
3023
+ const newScope = scopeUnsafeMake(strategy)
3024
+ if (this.state._tag === "Closed") {
3025
+ newScope.state = this.state
3026
+ return newScope
3027
+ }
3028
+ const fin = (exit: Exit.Exit<unknown, unknown>) => newScope.close(exit)
3029
+ this.state.finalizers.add(fin)
3030
+ scopeUnsafeAddFinalizer(newScope, (_) =>
3031
+ core.sync(() => {
3032
+ if (this.state._tag === "Open") {
3033
+ this.state.finalizers.delete(fin)
3034
+ }
3035
+ }))
3036
+ return newScope
3037
+ })
3038
+ },
3039
+ close(this: ScopeImpl, exit) {
3040
+ return core.suspend(() => {
3041
+ if (this.state._tag === "Closed") {
3002
3042
  return core.unit
3003
3043
  }
3004
- case "Running": {
3005
- const finalizersMap = self.state.finalizers
3006
- const update = self.state.update
3007
- const finalizers = Array.from(finalizersMap.keys()).sort((a, b) => b - a).map((key) => finalizersMap.get(key)!)
3008
- self.state = { _tag: "Exited", nextKey: self.state.nextKey, exit, update }
3009
- return executionStrategy.isSequential(strategy) ?
3010
- pipe(
3011
- finalizers,
3012
- core.forEachSequential((fin) => core.exit(update(fin)(exit))),
3013
- core.flatMap((results) =>
3014
- pipe(
3015
- core.exitCollectAll(results),
3016
- Option.map(core.exitAsUnit),
3017
- Option.getOrElse(() => core.exitUnit)
3018
- )
3044
+ const finalizers = Array.from(this.state.finalizers.values()).reverse()
3045
+ this.state = { _tag: "Closed", exit }
3046
+ if (finalizers.length === 0) {
3047
+ return core.unit
3048
+ }
3049
+ return executionStrategy.isSequential(this.strategy) ?
3050
+ pipe(
3051
+ core.forEachSequential(finalizers, (fin) => core.exit(fin(exit))),
3052
+ core.flatMap((results) =>
3053
+ pipe(
3054
+ core.exitCollectAll(results),
3055
+ Option.map(core.exitAsUnit),
3056
+ Option.getOrElse(() => core.exitUnit)
3019
3057
  )
3020
- ) :
3021
- executionStrategy.isParallel(strategy) ?
3022
- pipe(
3023
- forEachParUnbounded(finalizers, (fin) => core.exit(update(fin)(exit)), false),
3024
- core.flatMap((results) =>
3025
- pipe(
3026
- core.exitCollectAll(results, { parallel: true }),
3027
- Option.map(core.exitAsUnit),
3028
- Option.getOrElse(() => core.exitUnit)
3029
- )
3058
+ )
3059
+ ) :
3060
+ executionStrategy.isParallel(this.strategy) ?
3061
+ pipe(
3062
+ forEachParUnbounded(finalizers, (fin) => core.exit(fin(exit)), false),
3063
+ core.flatMap((results) =>
3064
+ pipe(
3065
+ core.exitCollectAll(results, { parallel: true }),
3066
+ Option.map(core.exitAsUnit),
3067
+ Option.getOrElse(() => core.exitUnit)
3030
3068
  )
3031
- ) :
3032
- pipe(
3033
- forEachParN(finalizers, strategy.parallelism, (fin) => core.exit(update(fin)(exit)), false),
3034
- core.flatMap((results) =>
3035
- pipe(
3036
- core.exitCollectAll(results, { parallel: true }),
3037
- Option.map(core.exitAsUnit),
3038
- Option.getOrElse(() => core.exitUnit)
3039
- )
3069
+ )
3070
+ ) :
3071
+ pipe(
3072
+ forEachParN(finalizers, this.strategy.parallelism, (fin) => core.exit(fin(exit)), false),
3073
+ core.flatMap((results) =>
3074
+ pipe(
3075
+ core.exitCollectAll(results, { parallel: true }),
3076
+ Option.map(core.exitAsUnit),
3077
+ Option.getOrElse(() => core.exitUnit)
3040
3078
  )
3041
3079
  )
3080
+ )
3081
+ })
3082
+ },
3083
+ addFinalizer(this: ScopeImpl, fin) {
3084
+ return core.suspend(() => {
3085
+ if (this.state._tag === "Closed") {
3086
+ return fin(this.state.exit)
3042
3087
  }
3043
- }
3044
- })
3045
-
3046
- // circular with Scope
3047
-
3048
- /** @internal */
3049
- export const scopeTag = Context.GenericTag<Scope.Scope>("effect/Scope")
3088
+ this.state.finalizers.add(fin)
3089
+ return core.unit
3090
+ })
3091
+ }
3092
+ }
3050
3093
 
3051
- /* @internal */
3052
- export const scope: Effect.Effect<Scope.Scope, never, Scope.Scope> = scopeTag
3094
+ const scopeUnsafeMake = (
3095
+ strategy: ExecutionStrategy.ExecutionStrategy = executionStrategy.sequential
3096
+ ): ScopeImpl => {
3097
+ const scope = Object.create(ScopeImplProto)
3098
+ scope.strategy = strategy
3099
+ scope.state = { _tag: "Open", finalizers: new Set() }
3100
+ return scope
3101
+ }
3053
3102
 
3054
3103
  /* @internal */
3055
3104
  export const scopeMake = (
3056
3105
  strategy: ExecutionStrategy.ExecutionStrategy = executionStrategy.sequential
3057
- ): Effect.Effect<Scope.Scope.Closeable> =>
3058
- core.map(core.releaseMapMake, (rm): Scope.Scope.Closeable => ({
3059
- [core.ScopeTypeId]: core.ScopeTypeId,
3060
- [core.CloseableScopeTypeId]: core.CloseableScopeTypeId,
3061
- strategy,
3062
- pipe() {
3063
- return pipeArguments(this, arguments)
3064
- },
3065
- fork: (strategy) =>
3066
- core.uninterruptible(
3067
- pipe(
3068
- scopeMake(strategy),
3069
- core.flatMap((scope) =>
3070
- pipe(
3071
- core.releaseMapAdd(rm, (exit) => core.scopeClose(scope, exit)),
3072
- core.tap((fin) => core.scopeAddFinalizerExit(scope, fin)),
3073
- core.as(scope)
3074
- )
3075
- )
3076
- )
3077
- ),
3078
- close: (exit) => core.asUnit(releaseMapReleaseAll(strategy, exit)(rm)),
3079
- addFinalizer: (fin) => core.asUnit(core.releaseMapAdd(fin)(rm))
3080
- }))
3106
+ ): Effect.Effect<Scope.Scope.Closeable> => core.sync(() => scopeUnsafeMake(strategy))
3081
3107
 
3082
3108
  /* @internal */
3083
3109
  export const scopeExtend = dual<
@@ -3552,15 +3578,23 @@ export const makeSpanScoped = (
3552
3578
  readonly context?: Context.Context<never> | undefined
3553
3579
  }
3554
3580
  ): Effect.Effect<Tracer.Span, never, Scope.Scope> =>
3555
- acquireRelease(
3556
- internalEffect.makeSpan(name, options),
3557
- (span, exit) =>
3558
- span.status._tag === "Ended" ?
3559
- core.unit :
3560
- core.flatMap(
3561
- internalEffect.currentTimeNanosTracing,
3562
- (endTime) => core.sync(() => span.end(endTime, exit))
3563
- )
3581
+ core.uninterruptible(
3582
+ core.withFiberRuntime((fiber) => {
3583
+ const scope = Context.unsafeGet(fiber.getFiberRef(core.currentContext), scopeTag)
3584
+ const span = internalEffect.unsafeMakeSpan(fiber, name, options)
3585
+ const timingEnabled = fiber.getFiberRef(core.currentTracerTimingEnabled)
3586
+ const clock_ = Context.get(fiber.getFiberRef(defaultServices.currentServices), clock.clockTag)
3587
+ return core.as(
3588
+ core.scopeAddFinalizerExit(scope, (exit) =>
3589
+ core.sync(() => {
3590
+ if (span.status._tag === "Ended") {
3591
+ return
3592
+ }
3593
+ span.end(timingEnabled ? clock_.unsafeCurrentTimeNanos() : BigInt(0), exit)
3594
+ })),
3595
+ span
3596
+ )
3597
+ })
3564
3598
  )
3565
3599
 
3566
3600
  /* @internal */
@@ -270,7 +270,7 @@ export const unsafeGet = Dual.dual<
270
270
  >(2, (self, key) => {
271
271
  const element = getHash(self, key, Hash.hash(key))
272
272
  if (Option.isNone(element)) {
273
- throw new Error("Error: Expected map to contain key")
273
+ throw new Error("Expected map to contain key")
274
274
  }
275
275
  return element.value
276
276
  })
@@ -508,7 +508,7 @@ export const orElseAbsurd = <I, R, RA, A, Pr>(
508
508
  self: Matcher<I, R, RA, A, Pr>
509
509
  ): [Pr] extends [never] ? (input: I) => Unify<A> : Unify<A> =>
510
510
  orElse(() => {
511
- throw new Error("absurd")
511
+ throw new Error("effect/Match/orElseAbsurd: absurd")
512
512
  })(self)
513
513
 
514
514
  /** @internal */
@@ -565,6 +565,8 @@ export const option: <I, F, R, A, Pr>(
565
565
  })
566
566
  }) as any
567
567
 
568
+ const getExhaustiveAbsurdErrorMessage = "effect/Match/exhaustive: absurd"
569
+
568
570
  /** @internal */
569
571
  export const exhaustive: <I, F, A, Pr>(
570
572
  self: Matcher<I, F, never, A, Pr>
@@ -578,7 +580,7 @@ export const exhaustive: <I, F, A, Pr>(
578
580
  return toEither.right
579
581
  }
580
582
 
581
- throw new Error("@effect/match: exhaustive absurd")
583
+ throw new Error(getExhaustiveAbsurdErrorMessage)
582
584
  }
583
585
 
584
586
  return (u: I): A => {
@@ -589,6 +591,6 @@ export const exhaustive: <I, F, A, Pr>(
589
591
  return result.right as any
590
592
  }
591
593
 
592
- throw new Error("@effect/match: exhaustive absurd")
594
+ throw new Error(getExhaustiveAbsurdErrorMessage)
593
595
  }
594
596
  }) as any
@@ -3,6 +3,7 @@ import { dual } from "../Function.js"
3
3
  import * as MutableRef from "../MutableRef.js"
4
4
  import * as Option from "../Option.js"
5
5
  import { pipeArguments } from "../Pipeable.js"
6
+ import * as Readable from "../Readable.js"
6
7
  import type * as Ref from "../Ref.js"
7
8
  import * as core from "./core.js"
8
9
 
@@ -17,7 +18,12 @@ export const refVariance = {
17
18
 
18
19
  class RefImpl<in out A> implements Ref.Ref<A> {
19
20
  readonly [RefTypeId] = refVariance
20
- constructor(readonly ref: MutableRef.MutableRef<A>) {}
21
+ readonly [Readable.TypeId]: Readable.TypeId
22
+ constructor(readonly ref: MutableRef.MutableRef<A>) {
23
+ this[Readable.TypeId] = Readable.TypeId
24
+ this.get = core.sync(() => MutableRef.get(this.ref))
25
+ }
26
+ readonly get: Effect.Effect<A>
21
27
  modify<B>(f: (a: A) => readonly [B, A]): Effect.Effect<B> {
22
28
  return core.sync(() => {
23
29
  const current = MutableRef.get(this.ref)
@@ -40,7 +46,7 @@ export const unsafeMake = <A>(value: A): Ref.Ref<A> => new RefImpl(MutableRef.ma
40
46
  export const make = <A>(value: A): Effect.Effect<Ref.Ref<A>> => core.sync(() => unsafeMake(value))
41
47
 
42
48
  /** @internal */
43
- export const get = <A>(self: Ref.Ref<A>) => self.modify((a) => [a, a])
49
+ export const get = <A>(self: Ref.Ref<A>) => self.get
44
50
 
45
51
  /** @internal */
46
52
  export const set = dual<
@@ -3,6 +3,7 @@ import { dual, pipe } from "../../Function.js"
3
3
  import * as Option from "../../Option.js"
4
4
  import * as Interval from "../../ScheduleInterval.js"
5
5
  import type * as Intervals from "../../ScheduleIntervals.js"
6
+ import { getBugErrorMessage } from "../errors.js"
6
7
 
7
8
  /** @internal */
8
9
  const IntervalsSymbolKey = "effect/ScheduleIntervals"
@@ -109,7 +110,7 @@ const unionLoop = (
109
110
  that = Chunk.tailNonEmpty(that)
110
111
  }
111
112
  } else {
112
- throw new Error("BUG: Intervals.unionLoop - please report an issue at https://github.com/Effect-TS/effect/issues")
113
+ throw new Error(getBugErrorMessage("Intervals.unionLoop"))
113
114
  }
114
115
  }
115
116
  return make(pipe(acc, Chunk.prepend(interval), Chunk.reverse))
@@ -2,8 +2,10 @@ import * as Effect from "../Effect.js"
2
2
  import { dual, pipe } from "../Function.js"
3
3
  import { pipeArguments } from "../Pipeable.js"
4
4
  import * as PubSub from "../PubSub.js"
5
+ import * as Readable from "../Readable.js"
5
6
  import * as Ref from "../Ref.js"
6
7
  import type { Stream } from "../Stream.js"
8
+ import * as Subscribable from "../Subscribable.js"
7
9
  import type * as SubscriptionRef from "../SubscriptionRef.js"
8
10
  import * as Synchronized from "../SynchronizedRef.js"
9
11
  import * as _circular from "./effect/circular.js"
@@ -25,6 +27,8 @@ const subscriptionRefVariance = {
25
27
 
26
28
  /** @internal */
27
29
  class SubscriptionRefImpl<in out A> implements SubscriptionRef.SubscriptionRef<A> {
30
+ readonly [Readable.TypeId]: Readable.TypeId
31
+ readonly [Subscribable.TypeId]: Subscribable.TypeId
28
32
  readonly [Ref.RefTypeId] = _ref.refVariance
29
33
  readonly [Synchronized.SynchronizedRefTypeId] = _circular.synchronizedVariance
30
34
  readonly [SubscriptionRefTypeId] = subscriptionRefVariance
@@ -33,10 +37,14 @@ class SubscriptionRefImpl<in out A> implements SubscriptionRef.SubscriptionRef<A
33
37
  readonly pubsub: PubSub.PubSub<A>,
34
38
  readonly semaphore: Effect.Semaphore
35
39
  ) {
40
+ this[Readable.TypeId] = Readable.TypeId
41
+ this[Subscribable.TypeId] = Subscribable.TypeId
42
+ this.get = Ref.get(this.ref)
36
43
  }
37
44
  pipe() {
38
45
  return pipeArguments(this, arguments)
39
46
  }
47
+ readonly get: Effect.Effect<A>
40
48
  get changes(): Stream<A> {
41
49
  return pipe(
42
50
  Ref.get(this.ref),
@@ -420,7 +420,7 @@ export const unsafeGet = dual<
420
420
  >(2, (self, key) => {
421
421
  const element = get(self, key)
422
422
  if (Option.isNone(element)) {
423
- throw new Error("Error: Expected trie to contain key")
423
+ throw new Error("Expected trie to contain key")
424
424
  }
425
425
  return element.value
426
426
  })
@@ -1,4 +1,4 @@
1
- let moduleVersion = "2.4.18"
1
+ let moduleVersion = "2.4.19"
2
2
 
3
3
  export const getCurrentVersion = () => moduleVersion
4
4