{
  "id": "@typed/fx/Fx#continueWith",
  "canonicalId": "@typed/fx/Fx#continueWith",
  "symbol": {
    "id": "@typed/fx/Fx#continueWith",
    "packageName": "@typed/fx",
    "moduleName": "Fx",
    "exportName": "continueWith",
    "kind": "constant",
    "signatures": [
      "export declare const continueWith: {\n    <B, E2, R2>(f: () => Fx<B, E2, R2>): <A, E, R>(fx: Fx<A, E, R>) => Fx<A | B, E | E2, R | R2>;\n    <A, E, R, B, E2, R2>(fx: Fx<A, E, R>, f: () => Fx<B, E2, R2>): Fx<A | B, E | E2, R | R2>;\n};"
    ],
    "summary": "Continues an Fx with a lazily created Fx after the first run returns.",
    "sections": {
      "Why": "This sequences two producer runs without converting either to a pull\ncollection. The thunk is lazy, so the continuation is not constructed until\nthe first `Fx.run` Effect returns.",
      "Ordering and cardinality": "All successes from `fx` are delivered before successes from `f()`. A source\nfailure is also delivered to the shared Sink, but delivery does not fail\n`Fx.run`: `Sink.onFailure` returns an Effect whose error channel is `never`.\nAfter that handler returns, the continuation still runs. The two producers\nnever run concurrently.",
      "Ownership and lifetime": "Failures and service requirements from both producers remain on the public\ntype and both failures are delivered to the same Sink. The returned Fx owns\nneither input. Interruption or a defect that prevents the first run Effect\nfrom returning also prevents the continuation from starting."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Fx, Sink } from \"@typed/fx\"\nimport { Effect } from \"effect\"\n\nconst events: Array<string> = []\nconst phases = Fx.continueWith(Fx.fail(\"offline\"), () => Fx.succeed(\"fallback\"))\nconst program = phases.run(Sink.make(\n  () => Effect.sync(() => events.push(\"failure delivered\")),\n  (value) => Effect.sync(() => events.push(value))\n))\n\nEffect.runPromise(program).then(() => console.log(events))\n// [\"failure delivered\", \"fallback\"]"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/Fx/combinators/continueWith.ts",
      "line": 53
    },
    "since": "1.0.0",
    "category": "Combining sources"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx/Fx#continueWith",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.7",
    "moduleName": "Fx",
    "consumerSpecifier": "@typed/fx/Fx",
    "exportName": "continueWith",
    "qualifiedName": "continueWith",
    "declarationKey": "declaration:f2b1a647eb5b2ffcfd5a80f3",
    "family": "variable",
    "signatures": [
      "export declare const continueWith: {\n    <B, E2, R2>(f: () => Fx<B, E2, R2>): <A, E, R>(fx: Fx<A, E, R>) => Fx<A | B, E | E2, R | R2>;\n    <A, E, R, B, E2, R2>(fx: Fx<A, E, R>, f: () => Fx<B, E2, R2>): Fx<A | B, E | E2, R | R2>;\n};"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/continueWith.ts",
        "start": {
          "line": 53,
          "column": 14
        },
        "end": {
          "line": 61,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/continueWith.ts",
        "start": {
          "line": 54,
          "column": 3
        },
        "end": {
          "line": 54,
          "column": 96
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/continueWith.ts",
        "start": {
          "line": 56,
          "column": 3
        },
        "end": {
          "line": 56,
          "column": 92
        }
      }
    ],
    "aliases": [
      "@typed/fx#Fx.continueWith"
    ],
    "isAlias": false,
    "static": false
  },
  "declaration": {
    "declarationKey": "declaration:f2b1a647eb5b2ffcfd5a80f3",
    "name": "continueWith",
    "family": "variable",
    "facets": [
      {
        "family": "variable",
        "syntaxKind": "VariableDeclaration",
        "signatures": [
          "export declare const continueWith: {\n    <B, E2, R2>(f: () => Fx<B, E2, R2>): <A, E, R>(fx: Fx<A, E, R>) => Fx<A | B, E | E2, R | R2>;\n    <A, E, R, B, E2, R2>(fx: Fx<A, E, R>, f: () => Fx<B, E2, R2>): Fx<A | B, E | E2, R | R2>;\n};"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/continueWith.ts",
            "start": {
              "line": 53,
              "column": 14
            },
            "end": {
              "line": 61,
              "column": 2
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "call-signature",
        "syntaxKind": "CallSignature",
        "signatures": [
          "<B, E2, R2>(f: () => Fx<B, E2, R2>): <A, E, R>(fx: Fx<A, E, R>) => Fx<A | B, E | E2, R | R2>;",
          "<A, E, R, B, E2, R2>(fx: Fx<A, E, R>, f: () => Fx<B, E2, R2>): Fx<A | B, E | E2, R | R2>;"
        ],
        "typeParameters": [
          "B",
          "E2",
          "R2",
          "A",
          "E",
          "R"
        ],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/continueWith.ts",
            "start": {
              "line": 54,
              "column": 3
            },
            "end": {
              "line": 54,
              "column": 96
            }
          },
          {
            "file": "packages/fx/src/Fx/combinators/continueWith.ts",
            "start": {
              "line": 56,
              "column": 3
            },
            "end": {
              "line": 56,
              "column": 92
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare const continueWith: {\n    <B, E2, R2>(f: () => Fx<B, E2, R2>): <A, E, R>(fx: Fx<A, E, R>) => Fx<A | B, E | E2, R | R2>;\n    <A, E, R, B, E2, R2>(fx: Fx<A, E, R>, f: () => Fx<B, E2, R2>): Fx<A | B, E | E2, R | R2>;\n};"
    ],
    "typeParameters": [
      "B",
      "E2",
      "R2",
      "A",
      "E",
      "R"
    ],
    "summary": "Continues an Fx with a lazily created Fx after the first run returns.",
    "sections": {
      "Why": "This sequences two producer runs without converting either to a pull\ncollection. The thunk is lazy, so the continuation is not constructed until\nthe first `Fx.run` Effect returns.",
      "Ordering and cardinality": "All successes from `fx` are delivered before successes from `f()`. A source\nfailure is also delivered to the shared Sink, but delivery does not fail\n`Fx.run`: `Sink.onFailure` returns an Effect whose error channel is `never`.\nAfter that handler returns, the continuation still runs. The two producers\nnever run concurrently.",
      "Ownership and lifetime": "Failures and service requirements from both producers remain on the public\ntype and both failures are delivered to the same Sink. The returned Fx owns\nneither input. Interruption or a defect that prevents the first run Effect\nfrom returning also prevents the continuation from starting."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Fx, Sink } from \"@typed/fx\"\nimport { Effect } from \"effect\"\n\nconst events: Array<string> = []\nconst phases = Fx.continueWith(Fx.fail(\"offline\"), () => Fx.succeed(\"fallback\"))\nconst program = phases.run(Sink.make(\n  () => Effect.sync(() => events.push(\"failure delivered\")),\n  (value) => Effect.sync(() => events.push(value))\n))\n\nEffect.runPromise(program).then(() => console.log(events))\n// [\"failure delivered\", \"fallback\"]"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/continueWith.ts",
        "start": {
          "line": 53,
          "column": 14
        },
        "end": {
          "line": 61,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/continueWith.ts",
        "start": {
          "line": 54,
          "column": 3
        },
        "end": {
          "line": 54,
          "column": 96
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/continueWith.ts",
        "start": {
          "line": 56,
          "column": 3
        },
        "end": {
          "line": 56,
          "column": 92
        }
      }
    ],
    "since": "1.0.0",
    "category": "Combining sources"
  }
}
