{
  "id": "@typed/fx/Fx#merge",
  "canonicalId": "@typed/fx/Fx#merge",
  "symbol": {
    "id": "@typed/fx/Fx#merge",
    "packageName": "@typed/fx",
    "moduleName": "Fx",
    "exportName": "merge",
    "kind": "constant",
    "signatures": [
      "export declare const merge: {\n    <A2, E2, R2>(that: Fx<A2, E2, R2>): <A, E, R>(self: Fx<A, E, R>) => Fx<A | A2, E | E2, R | R2>;\n    <A, E, R, A2, E2, R2>(self: Fx<A, E, R>, that: Fx<A2, E2, R2>): Fx<A | A2, E | E2, R | R2>;\n};"
    ],
    "summary": "Merges two Fx streams into a single Fx that emits values from both streams\nconcurrently. Order of emission is non-deterministic.\n\n**Completion:** The merged stream completes when **both** input streams have\ncompleted.\n\n**Failures:** Every failure Cause is delivered to the downstream Sink. Delivery does not make\n`Fx.run` fail, so `merge` does not itself cancel the sibling; a terminal observer may choose to.",
    "sections": {
      "Why": "`merge` preserves both producers instead of imposing a pairing relationship. Each input value is\nemitted once as soon as its source pushes it, so inter-source ordering is intentionally undefined.",
      "Ownership and lifetime": "Both runs are children of the consumer and completion waits for both. Downstream interruption\ncancels the remaining runs. A source Cause is only sent to `sink.onFailure`; whether that callback\nends observation is Sink policy, not an intrinsic terminal rule of `merge`."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect, Ref } from \"effect\"\nimport { Fx, Sink } from \"@typed/fx\"\n\nconst program = Effect.gen(function* () {\n  const deliveries = yield* Ref.make<Array<string>>([])\n  const sink = Sink.make(\n    () => Ref.update(deliveries, (xs) => [...xs, \"failure\"]),\n    (value: string) => Ref.update(deliveries, (xs) => [...xs, value])\n  )\n  yield* Fx.merge(Fx.fail(\"left failed\"), Fx.succeed(\"right continued\")).run(sink)\n  return yield* Ref.get(deliveries) // both \"failure\" and \"right continued\"\n})"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/Fx/combinators/additive.ts",
      "line": 50
    },
    "since": "1.0.0",
    "category": "Combining sources"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx/Fx#merge",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.13",
    "moduleName": "Fx",
    "consumerSpecifier": "@typed/fx/Fx",
    "exportName": "merge",
    "qualifiedName": "merge",
    "declarationKey": "declaration:2561562241435ab92f69af5f",
    "family": "variable",
    "signatures": [
      "export declare const merge: {\n    <A2, E2, R2>(that: Fx<A2, E2, R2>): <A, E, R>(self: Fx<A, E, R>) => Fx<A | A2, E | E2, R | R2>;\n    <A, E, R, A2, E2, R2>(self: Fx<A, E, R>, that: Fx<A2, E2, R2>): Fx<A | A2, E | E2, R | R2>;\n};"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/additive.ts",
        "start": {
          "line": 50,
          "column": 14
        },
        "end": {
          "line": 57,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/additive.ts",
        "start": {
          "line": 51,
          "column": 3
        },
        "end": {
          "line": 51,
          "column": 98
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/additive.ts",
        "start": {
          "line": 52,
          "column": 3
        },
        "end": {
          "line": 52,
          "column": 94
        }
      }
    ],
    "aliases": [
      "@typed/fx#Fx.merge"
    ],
    "isAlias": false,
    "static": false
  },
  "declaration": {
    "declarationKey": "declaration:2561562241435ab92f69af5f",
    "name": "merge",
    "family": "variable",
    "facets": [
      {
        "family": "variable",
        "syntaxKind": "VariableDeclaration",
        "signatures": [
          "export declare const merge: {\n    <A2, E2, R2>(that: Fx<A2, E2, R2>): <A, E, R>(self: Fx<A, E, R>) => Fx<A | A2, E | E2, R | R2>;\n    <A, E, R, A2, E2, R2>(self: Fx<A, E, R>, that: Fx<A2, E2, R2>): Fx<A | A2, E | E2, R | R2>;\n};"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/additive.ts",
            "start": {
              "line": 50,
              "column": 14
            },
            "end": {
              "line": 57,
              "column": 2
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "call-signature",
        "syntaxKind": "CallSignature",
        "signatures": [
          "<A2, E2, R2>(that: Fx<A2, E2, R2>): <A, E, R>(self: Fx<A, E, R>) => Fx<A | A2, E | E2, R | R2>;",
          "<A, E, R, A2, E2, R2>(self: Fx<A, E, R>, that: Fx<A2, E2, R2>): Fx<A | A2, E | E2, R | R2>;"
        ],
        "typeParameters": [
          "A2",
          "E2",
          "R2",
          "A",
          "E",
          "R"
        ],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/additive.ts",
            "start": {
              "line": 51,
              "column": 3
            },
            "end": {
              "line": 51,
              "column": 98
            }
          },
          {
            "file": "packages/fx/src/Fx/combinators/additive.ts",
            "start": {
              "line": 52,
              "column": 3
            },
            "end": {
              "line": 52,
              "column": 94
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare const merge: {\n    <A2, E2, R2>(that: Fx<A2, E2, R2>): <A, E, R>(self: Fx<A, E, R>) => Fx<A | A2, E | E2, R | R2>;\n    <A, E, R, A2, E2, R2>(self: Fx<A, E, R>, that: Fx<A2, E2, R2>): Fx<A | A2, E | E2, R | R2>;\n};"
    ],
    "typeParameters": [
      "A2",
      "E2",
      "R2",
      "A",
      "E",
      "R"
    ],
    "summary": "Merges two Fx streams into a single Fx that emits values from both streams\nconcurrently. Order of emission is non-deterministic.\n\n**Completion:** The merged stream completes when **both** input streams have\ncompleted.\n\n**Failures:** Every failure Cause is delivered to the downstream Sink. Delivery does not make\n`Fx.run` fail, so `merge` does not itself cancel the sibling; a terminal observer may choose to.",
    "sections": {
      "Why": "`merge` preserves both producers instead of imposing a pairing relationship. Each input value is\nemitted once as soon as its source pushes it, so inter-source ordering is intentionally undefined.",
      "Ownership and lifetime": "Both runs are children of the consumer and completion waits for both. Downstream interruption\ncancels the remaining runs. A source Cause is only sent to `sink.onFailure`; whether that callback\nends observation is Sink policy, not an intrinsic terminal rule of `merge`."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect, Ref } from \"effect\"\nimport { Fx, Sink } from \"@typed/fx\"\n\nconst program = Effect.gen(function* () {\n  const deliveries = yield* Ref.make<Array<string>>([])\n  const sink = Sink.make(\n    () => Ref.update(deliveries, (xs) => [...xs, \"failure\"]),\n    (value: string) => Ref.update(deliveries, (xs) => [...xs, value])\n  )\n  yield* Fx.merge(Fx.fail(\"left failed\"), Fx.succeed(\"right continued\")).run(sink)\n  return yield* Ref.get(deliveries) // both \"failure\" and \"right continued\"\n})"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/additive.ts",
        "start": {
          "line": 50,
          "column": 14
        },
        "end": {
          "line": 57,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/additive.ts",
        "start": {
          "line": 51,
          "column": 3
        },
        "end": {
          "line": 51,
          "column": 98
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/additive.ts",
        "start": {
          "line": 52,
          "column": 3
        },
        "end": {
          "line": 52,
          "column": 94
        }
      }
    ],
    "since": "1.0.0",
    "category": "Combining sources"
  }
}
