effect 4.0.0-beta.25 → 4.0.0-beta.27

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 (155) hide show
  1. package/dist/Cause.d.ts +1 -1
  2. package/dist/Config.js +4 -4
  3. package/dist/Config.js.map +1 -1
  4. package/dist/Data.d.ts +2 -2
  5. package/dist/Data.js +2 -2
  6. package/dist/Effect.d.ts +51 -35
  7. package/dist/Effect.d.ts.map +1 -1
  8. package/dist/Effect.js +16 -12
  9. package/dist/Effect.js.map +1 -1
  10. package/dist/ErrorReporter.d.ts +2 -4
  11. package/dist/ErrorReporter.d.ts.map +1 -1
  12. package/dist/ErrorReporter.js +1 -3
  13. package/dist/ErrorReporter.js.map +1 -1
  14. package/dist/Layer.d.ts +112 -117
  15. package/dist/Layer.d.ts.map +1 -1
  16. package/dist/Layer.js +43 -44
  17. package/dist/Layer.js.map +1 -1
  18. package/dist/LayerMap.d.ts +4 -4
  19. package/dist/LayerMap.js +3 -3
  20. package/dist/ManagedRuntime.d.ts +1 -1
  21. package/dist/ManagedRuntime.js +1 -1
  22. package/dist/Metric.d.ts +2 -4
  23. package/dist/Metric.d.ts.map +1 -1
  24. package/dist/Metric.js +2 -4
  25. package/dist/Metric.js.map +1 -1
  26. package/dist/Runtime.d.ts +66 -0
  27. package/dist/Runtime.d.ts.map +1 -1
  28. package/dist/Runtime.js +72 -5
  29. package/dist/Runtime.js.map +1 -1
  30. package/dist/Schedule.d.ts +36 -36
  31. package/dist/Schedule.js +14 -14
  32. package/dist/Schema.d.ts +15 -32
  33. package/dist/Schema.d.ts.map +1 -1
  34. package/dist/Schema.js +9 -17
  35. package/dist/Schema.js.map +1 -1
  36. package/dist/SchemaAST.js +91 -2
  37. package/dist/SchemaAST.js.map +1 -1
  38. package/dist/SchemaGetter.d.ts +3 -3
  39. package/dist/SchemaRepresentation.d.ts.map +1 -1
  40. package/dist/SchemaRepresentation.js +12 -8
  41. package/dist/SchemaRepresentation.js.map +1 -1
  42. package/dist/Stdio.d.ts +10 -2
  43. package/dist/Stdio.d.ts.map +1 -1
  44. package/dist/Stdio.js +18 -0
  45. package/dist/Stdio.js.map +1 -1
  46. package/dist/index.d.ts +1 -1
  47. package/dist/index.js +1 -1
  48. package/dist/internal/schema/representation.js +7 -3
  49. package/dist/internal/schema/representation.js.map +1 -1
  50. package/dist/internal/schema/to-codec.js +7 -10
  51. package/dist/internal/schema/to-codec.js.map +1 -1
  52. package/dist/unstable/ai/AiError.d.ts +6 -3
  53. package/dist/unstable/ai/AiError.d.ts.map +1 -1
  54. package/dist/unstable/ai/AiError.js +8 -4
  55. package/dist/unstable/ai/AiError.js.map +1 -1
  56. package/dist/unstable/ai/LanguageModel.js +7 -5
  57. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  58. package/dist/unstable/cli/CliError.d.ts +23 -56
  59. package/dist/unstable/cli/CliError.d.ts.map +1 -1
  60. package/dist/unstable/cli/CliError.js +25 -57
  61. package/dist/unstable/cli/CliError.js.map +1 -1
  62. package/dist/unstable/cli/Command.d.ts +117 -62
  63. package/dist/unstable/cli/Command.d.ts.map +1 -1
  64. package/dist/unstable/cli/Command.js +95 -32
  65. package/dist/unstable/cli/Command.js.map +1 -1
  66. package/dist/unstable/cli/GlobalFlag.d.ts +1 -1
  67. package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
  68. package/dist/unstable/cli/Primitive.d.ts +1 -1
  69. package/dist/unstable/cli/Primitive.js +1 -1
  70. package/dist/unstable/cli/internal/command.d.ts +27 -10
  71. package/dist/unstable/cli/internal/command.d.ts.map +1 -1
  72. package/dist/unstable/cli/internal/command.js +40 -23
  73. package/dist/unstable/cli/internal/command.js.map +1 -1
  74. package/dist/unstable/cli/internal/config.js +42 -0
  75. package/dist/unstable/cli/internal/config.js.map +1 -1
  76. package/dist/unstable/cli/internal/help.d.ts +4 -4
  77. package/dist/unstable/cli/internal/help.d.ts.map +1 -1
  78. package/dist/unstable/cli/internal/help.js +25 -7
  79. package/dist/unstable/cli/internal/help.js.map +1 -1
  80. package/dist/unstable/cli/internal/parser.js +26 -6
  81. package/dist/unstable/cli/internal/parser.js.map +1 -1
  82. package/dist/unstable/http/Headers.d.ts +16 -0
  83. package/dist/unstable/http/Headers.d.ts.map +1 -1
  84. package/dist/unstable/http/Headers.js +11 -0
  85. package/dist/unstable/http/Headers.js.map +1 -1
  86. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  87. package/dist/unstable/httpapi/HttpApiBuilder.js +6 -7
  88. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  89. package/dist/unstable/httpapi/HttpApiClient.d.ts +6 -6
  90. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  91. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  92. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +10 -10
  93. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
  94. package/dist/unstable/httpapi/HttpApiEndpoint.js +2 -2
  95. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  96. package/dist/unstable/httpapi/HttpApiError.d.ts +6 -15
  97. package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
  98. package/dist/unstable/httpapi/HttpApiError.js +16 -21
  99. package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
  100. package/dist/unstable/reactivity/Atom.d.ts +56 -0
  101. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  102. package/dist/unstable/reactivity/Atom.js +66 -0
  103. package/dist/unstable/reactivity/Atom.js.map +1 -1
  104. package/dist/unstable/reactivity/AtomHttpApi.d.ts +2 -2
  105. package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
  106. package/dist/unstable/rpc/RpcServer.d.ts +3 -0
  107. package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
  108. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  109. package/dist/unstable/schema/Model.d.ts +21 -0
  110. package/dist/unstable/schema/Model.d.ts.map +1 -1
  111. package/dist/unstable/schema/Model.js +15 -0
  112. package/dist/unstable/schema/Model.js.map +1 -1
  113. package/dist/unstable/sql/SqlSchema.d.ts +2 -2
  114. package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
  115. package/dist/unstable/sql/SqlSchema.js.map +1 -1
  116. package/package.json +1 -1
  117. package/src/Cause.ts +1 -1
  118. package/src/Config.ts +4 -4
  119. package/src/Data.ts +2 -2
  120. package/src/Effect.ts +60 -31
  121. package/src/ErrorReporter.ts +2 -4
  122. package/src/Layer.ts +112 -117
  123. package/src/LayerMap.ts +4 -4
  124. package/src/ManagedRuntime.ts +1 -1
  125. package/src/Metric.ts +2 -4
  126. package/src/Runtime.ts +95 -5
  127. package/src/Schedule.ts +36 -36
  128. package/src/Schema.ts +20 -52
  129. package/src/SchemaAST.ts +127 -2
  130. package/src/SchemaGetter.ts +3 -3
  131. package/src/SchemaRepresentation.ts +12 -8
  132. package/src/Stdio.ts +21 -2
  133. package/src/index.ts +1 -1
  134. package/src/internal/schema/representation.ts +8 -4
  135. package/src/internal/schema/to-codec.ts +7 -17
  136. package/src/unstable/ai/AiError.ts +8 -4
  137. package/src/unstable/ai/LanguageModel.ts +8 -5
  138. package/src/unstable/cli/CliError.ts +47 -59
  139. package/src/unstable/cli/Command.ts +348 -180
  140. package/src/unstable/cli/GlobalFlag.ts +1 -1
  141. package/src/unstable/cli/Primitive.ts +1 -1
  142. package/src/unstable/cli/internal/command.ts +62 -32
  143. package/src/unstable/cli/internal/config.ts +49 -0
  144. package/src/unstable/cli/internal/help.ts +41 -16
  145. package/src/unstable/cli/internal/parser.ts +36 -10
  146. package/src/unstable/http/Headers.ts +34 -0
  147. package/src/unstable/httpapi/HttpApiBuilder.ts +4 -7
  148. package/src/unstable/httpapi/HttpApiClient.ts +6 -6
  149. package/src/unstable/httpapi/HttpApiEndpoint.ts +4 -4
  150. package/src/unstable/httpapi/HttpApiError.ts +23 -21
  151. package/src/unstable/reactivity/Atom.ts +132 -0
  152. package/src/unstable/reactivity/AtomHttpApi.ts +2 -2
  153. package/src/unstable/rpc/RpcServer.ts +5 -0
  154. package/src/unstable/schema/Model.ts +31 -0
  155. package/src/unstable/sql/SqlSchema.ts +2 -2
package/src/Effect.ts CHANGED
@@ -2436,17 +2436,17 @@ export const fromOption: <A>(
2436
2436
  * ```ts
2437
2437
  * import { Console, Effect } from "effect"
2438
2438
  *
2439
- * const input: string | null = null
2440
- *
2441
- * const program = Effect.gen(function*() {
2439
+ * const program = Effect.fn(function*(input: string | null) {
2442
2440
  * const value = yield* Effect.fromNullishOr(input)
2443
2441
  * yield* Console.log(value)
2444
- * }).pipe(
2442
+ * },
2445
2443
  * Effect.catch(() => Console.log("missing"))
2446
2444
  * )
2447
2445
  *
2448
- * Effect.runPromise(program)
2446
+ * Effect.runPromise(program(null))
2449
2447
  * // Output: missing
2448
+ * Effect.runPromise(program("hello"))
2449
+ * // Output: hello
2450
2450
  * ```
2451
2451
  *
2452
2452
  * @since 4.0.0
@@ -4394,7 +4394,8 @@ export const catchTag: {
4394
4394
  * once. Instead of using {@link catchTag} multiple times, you can pass an
4395
4395
  * object where each key is an error type's `_tag`, and the value is the handler
4396
4396
  * for that specific error. This allows you to catch and recover from multiple
4397
- * error types in a single call.
4397
+ * error types in a single call. You can also provide a fallback handler for
4398
+ * unhandled errors.
4398
4399
  *
4399
4400
  * The error type must have a readonly `_tag` field to use `catchTag`. This
4400
4401
  * field is used to identify and match errors.
@@ -4436,7 +4437,8 @@ export const catchTags: {
4436
4437
  * once. Instead of using {@link catchTag} multiple times, you can pass an
4437
4438
  * object where each key is an error type's `_tag`, and the value is the handler
4438
4439
  * for that specific error. This allows you to catch and recover from multiple
4439
- * error types in a single call.
4440
+ * error types in a single call. You can also provide a fallback handler for
4441
+ * unhandled errors.
4440
4442
  *
4441
4443
  * The error type must have a readonly `_tag` field to use `catchTag`. This
4442
4444
  * field is used to identify and match errors.
@@ -4472,19 +4474,27 @@ export const catchTags: {
4472
4474
  E,
4473
4475
  Cases extends
4474
4476
  & { [K in Extract<E, { _tag: string }>["_tag"]]+?: ((error: Extract<E, { _tag: K }>) => Effect<any, any, any>) }
4475
- & (unknown extends E ? {} : { [K in Exclude<keyof Cases, Extract<E, { _tag: string }>["_tag"]>]: never })
4476
- >(cases: Cases): <A, R>(
4477
+ & (unknown extends E ? {} : { [K in Exclude<keyof Cases, Extract<E, { _tag: string }>["_tag"]>]: never }),
4478
+ A2 = never,
4479
+ E2 = Exclude<E, { _tag: keyof Cases }>,
4480
+ R2 = never
4481
+ >(
4482
+ cases: Cases,
4483
+ orElse?: ((e: Exclude<E, { _tag: keyof Cases }>) => Effect<A2, E2, R2>) | undefined
4484
+ ): <A, R>(
4477
4485
  self: Effect<A, E, R>
4478
4486
  ) => Effect<
4479
4487
  | A
4488
+ | A2
4480
4489
  | {
4481
4490
  [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect<infer A, any, any> ? A : never
4482
4491
  }[keyof Cases],
4483
- | Exclude<E, { _tag: keyof Cases }>
4492
+ | E2
4484
4493
  | {
4485
4494
  [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect<any, infer E, any> ? E : never
4486
4495
  }[keyof Cases],
4487
4496
  | R
4497
+ | R2
4488
4498
  | {
4489
4499
  [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect<any, any, infer R> ? R : never
4490
4500
  }[keyof Cases]
@@ -4498,7 +4508,8 @@ export const catchTags: {
4498
4508
  * once. Instead of using {@link catchTag} multiple times, you can pass an
4499
4509
  * object where each key is an error type's `_tag`, and the value is the handler
4500
4510
  * for that specific error. This allows you to catch and recover from multiple
4501
- * error types in a single call.
4511
+ * error types in a single call. You can also provide a fallback handler for
4512
+ * unhandled errors.
4502
4513
  *
4503
4514
  * The error type must have a readonly `_tag` field to use `catchTag`. This
4504
4515
  * field is used to identify and match errors.
@@ -4536,17 +4547,26 @@ export const catchTags: {
4536
4547
  A,
4537
4548
  Cases extends
4538
4549
  & { [K in Extract<E, { _tag: string }>["_tag"]]+?: ((error: Extract<E, { _tag: K }>) => Effect<any, any, any>) }
4539
- & (unknown extends E ? {} : { [K in Exclude<keyof Cases, Extract<E, { _tag: string }>["_tag"]>]: never })
4540
- >(self: Effect<A, E, R>, cases: Cases): Effect<
4550
+ & (unknown extends E ? {} : { [K in Exclude<keyof Cases, Extract<E, { _tag: string }>["_tag"]>]: never }),
4551
+ A2 = never,
4552
+ E2 = Exclude<E, { _tag: keyof Cases }>,
4553
+ R2 = never
4554
+ >(
4555
+ self: Effect<A, E, R>,
4556
+ cases: Cases,
4557
+ orElse?: ((e: Exclude<E, { _tag: keyof Cases }>) => Effect<A2, E2, R2>) | undefined
4558
+ ): Effect<
4541
4559
  | A
4560
+ | A2
4542
4561
  | {
4543
4562
  [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect<infer A, any, any> ? A : never
4544
4563
  }[keyof Cases],
4545
- | Exclude<E, { _tag: keyof Cases }>
4564
+ | E2
4546
4565
  | {
4547
4566
  [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect<any, infer E, any> ? E : never
4548
4567
  }[keyof Cases],
4549
4568
  | R
4569
+ | R2
4550
4570
  | {
4551
4571
  [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect<any, any, infer R> ? R : never
4552
4572
  }[keyof Cases]
@@ -6636,7 +6656,7 @@ export const tapDefect: {
6636
6656
  * attempts++
6637
6657
  * yield* Console.log(`Attempt ${attempts}`)
6638
6658
  * if (attempts < 3) {
6639
- * yield* Effect.fail("Not ready")
6659
+ * return yield* Effect.fail("Not ready")
6640
6660
  * }
6641
6661
  * return "Ready"
6642
6662
  * })
@@ -7413,7 +7433,10 @@ export const ignoreCause: <
7413
7433
  *
7414
7434
  * const fetchUrl = Effect.gen(function*() {
7415
7435
  * const endpoint = yield* Effect.service(Endpoint)
7416
- * return endpoint.url === "bad" ? yield* Effect.fail("Unavailable") : endpoint.url
7436
+ * if (endpoint.url === "bad") {
7437
+ * return yield* Effect.fail("Unavailable")
7438
+ * }
7439
+ * return endpoint.url
7417
7440
  * })
7418
7441
  *
7419
7442
  * const plan = ExecutionPlan.make(
@@ -7444,7 +7467,10 @@ export const withExecutionPlan: {
7444
7467
  *
7445
7468
  * const fetchUrl = Effect.gen(function*() {
7446
7469
  * const endpoint = yield* Effect.service(Endpoint)
7447
- * return endpoint.url === "bad" ? yield* Effect.fail("Unavailable") : endpoint.url
7470
+ * if (endpoint.url === "bad") {
7471
+ * return yield* Effect.fail("Unavailable")
7472
+ * }
7473
+ * return endpoint.url
7448
7474
  * })
7449
7475
  *
7450
7476
  * const plan = ExecutionPlan.make(
@@ -7479,7 +7505,10 @@ export const withExecutionPlan: {
7479
7505
  *
7480
7506
  * const fetchUrl = Effect.gen(function*() {
7481
7507
  * const endpoint = yield* Effect.service(Endpoint)
7482
- * return endpoint.url === "bad" ? yield* Effect.fail("Unavailable") : endpoint.url
7508
+ * if (endpoint.url === "bad") {
7509
+ * return yield* Effect.fail("Unavailable")
7510
+ * }
7511
+ * return endpoint.url
7483
7512
  * })
7484
7513
  *
7485
7514
  * const plan = ExecutionPlan.make(
@@ -10420,7 +10449,7 @@ export const isSuccess: <A, E, R>(self: Effect<A, E, R>) => Effect<boolean, neve
10420
10449
  * @since 2.0.0
10421
10450
  * @category Environment
10422
10451
  */
10423
- export const services: <R>() => Effect<ServiceMap.ServiceMap<R>, never, R> = internal.services
10452
+ export const services: <R = never>() => Effect<ServiceMap.ServiceMap<R>, never, R> = internal.services
10424
10453
 
10425
10454
  /**
10426
10455
  * Transforms the current service map using the provided function.
@@ -10486,7 +10515,7 @@ export const servicesWith: <R, A, E, R2>(
10486
10515
  * const Database = ServiceMap.Service<Database>("Database")
10487
10516
  *
10488
10517
  * const DatabaseLive = Layer.succeed(Database)({
10489
- * query: (sql: string) => Effect.succeed(`Result for: ${sql}`)
10518
+ * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result for: ${sql}`))
10490
10519
  * })
10491
10520
  *
10492
10521
  * const program = Effect.gen(function*() {
@@ -10520,7 +10549,7 @@ export const provide: {
10520
10549
  * const Database = ServiceMap.Service<Database>("Database")
10521
10550
  *
10522
10551
  * const DatabaseLive = Layer.succeed(Database)({
10523
- * query: (sql: string) => Effect.succeed(`Result for: ${sql}`)
10552
+ * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result for: ${sql}`))
10524
10553
  * })
10525
10554
  *
10526
10555
  * const program = Effect.gen(function*() {
@@ -10565,7 +10594,7 @@ export const provide: {
10565
10594
  * const Database = ServiceMap.Service<Database>("Database")
10566
10595
  *
10567
10596
  * const DatabaseLive = Layer.succeed(Database)({
10568
- * query: (sql: string) => Effect.succeed(`Result for: ${sql}`)
10597
+ * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result for: ${sql}`))
10569
10598
  * })
10570
10599
  *
10571
10600
  * const program = Effect.gen(function*() {
@@ -10606,7 +10635,7 @@ export const provide: {
10606
10635
  * const Database = ServiceMap.Service<Database>("Database")
10607
10636
  *
10608
10637
  * const DatabaseLive = Layer.succeed(Database)({
10609
- * query: (sql: string) => Effect.succeed(`Result for: ${sql}`)
10638
+ * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result for: ${sql}`))
10610
10639
  * })
10611
10640
  *
10612
10641
  * const program = Effect.gen(function*() {
@@ -10640,7 +10669,7 @@ export const provide: {
10640
10669
  * const Database = ServiceMap.Service<Database>("Database")
10641
10670
  *
10642
10671
  * const DatabaseLive = Layer.succeed(Database)({
10643
- * query: (sql: string) => Effect.succeed(`Result for: ${sql}`)
10672
+ * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result for: ${sql}`))
10644
10673
  * })
10645
10674
  *
10646
10675
  * const program = Effect.gen(function*() {
@@ -10684,7 +10713,7 @@ export const provide: {
10684
10713
  * const Database = ServiceMap.Service<Database>("Database")
10685
10714
  *
10686
10715
  * const DatabaseLive = Layer.succeed(Database)({
10687
- * query: (sql: string) => Effect.succeed(`Result for: ${sql}`)
10716
+ * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result for: ${sql}`))
10688
10717
  * })
10689
10718
  *
10690
10719
  * const program = Effect.gen(function*() {
@@ -10724,7 +10753,7 @@ export const provide: {
10724
10753
  * const Database = ServiceMap.Service<Database>("Database")
10725
10754
  *
10726
10755
  * const DatabaseLive = Layer.succeed(Database)({
10727
- * query: (sql: string) => Effect.succeed(`Result for: ${sql}`)
10756
+ * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result for: ${sql}`))
10728
10757
  * })
10729
10758
  *
10730
10759
  * const program = Effect.gen(function*() {
@@ -13004,8 +13033,8 @@ export const cachedInvalidateWithTTL: {
13004
13033
  * import { Effect } from "effect"
13005
13034
  *
13006
13035
  * const program = Effect.gen(function*() {
13007
- * yield* Effect.interrupt
13008
- * yield* Effect.succeed("This won't execute")
13036
+ * return yield* Effect.interrupt
13037
+ * yield* Effect.succeed("This won't execute and is unreachable")
13009
13038
  * })
13010
13039
  *
13011
13040
  * Effect.runPromise(program).catch(console.error)
@@ -13832,7 +13861,7 @@ export const repeat: {
13832
13861
  * attempt++
13833
13862
  * if (attempt <= 2) {
13834
13863
  * yield* Console.log(`Attempt ${attempt} failed`)
13835
- * yield* Effect.fail(`Error ${attempt}`)
13864
+ * return yield* Effect.fail(`Error ${attempt}`)
13836
13865
  * }
13837
13866
  * yield* Console.log(`Attempt ${attempt} succeeded`)
13838
13867
  * return "success"
@@ -13882,7 +13911,7 @@ export const repeatOrElse: {
13882
13911
  * attempt++
13883
13912
  * if (attempt <= 2) {
13884
13913
  * yield* Console.log(`Attempt ${attempt} failed`)
13885
- * yield* Effect.fail(`Error ${attempt}`)
13914
+ * return yield* Effect.fail(`Error ${attempt}`)
13886
13915
  * }
13887
13916
  * yield* Console.log(`Attempt ${attempt} succeeded`)
13888
13917
  * return "success"
@@ -13935,7 +13964,7 @@ export const repeatOrElse: {
13935
13964
  * attempt++
13936
13965
  * if (attempt <= 2) {
13937
13966
  * yield* Console.log(`Attempt ${attempt} failed`)
13938
- * yield* Effect.fail(`Error ${attempt}`)
13967
+ * return yield* Effect.fail(`Error ${attempt}`)
13939
13968
  * }
13940
13969
  * yield* Console.log(`Attempt ${attempt} succeeded`)
13941
13970
  * return "success"
@@ -39,7 +39,7 @@
39
39
  *
40
40
  * // Opt in to error reporting with Effect.withErrorReporting
41
41
  * const program = Effect.gen(function*() {
42
- * yield* new RateLimitError({ retryAfter: 60 })
42
+ * return yield* new RateLimitError({ retryAfter: 60 })
43
43
  * }).pipe(
44
44
  * Effect.withErrorReporting,
45
45
  * Effect.provide(ErrorReporter.layer([consoleReporter]))
@@ -200,9 +200,7 @@ export const CurrentErrorReporters: ServiceMap.Reference<ReadonlySet<ErrorReport
200
200
  * { mergeWithExisting: true }
201
201
  * )
202
202
  *
203
- * const program = Effect.gen(function*() {
204
- * yield* Effect.fail("boom")
205
- * }).pipe(
203
+ * const program = Effect.fail("boom").pipe(
206
204
  * Effect.withErrorReporting,
207
205
  * Effect.provide(ReporterLive)
208
206
  * )