{
  "id": "@typed/fx/Fx#catch",
  "canonicalId": "@typed/fx/Fx#catch_",
  "symbol": {
    "id": "@typed/fx/Fx#catch",
    "packageName": "@typed/fx",
    "moduleName": "Fx",
    "exportName": "catch",
    "kind": "constant",
    "signatures": [
      "export { catch_ as catch };",
      "export declare const catch_: {\n    <E, A2, E2, R2>(f: (e: E) => Fx<A2, E2, R2>): <A, R>(self: Fx<A, E, R>) => Fx<A | A2, E2, R | R2>;\n    <A, E, R, A2, E2, R2>(self: Fx<A, E, R>, f: (e: E) => Fx<A2, E2, R2>): Fx<A | A2, E2, R | R2>;\n};"
    ],
    "summary": "Recovers from the first typed failure of an Fx by running a fallback Fx.",
    "sections": {
      "Why": "Typed failures are part of an Fx's public error channel, so callers often\nneed to replace a failed producer based on its first typed failure. This is\nthe push-stream counterpart of Effect's typed recovery.",
      "Ownership and lifetime": "The source runs until it reports a Cause containing a `Fail`. The first typed\nfailure starts exactly one fallback and the entire original Cause is replaced,\nincluding any defects or interrupts composed beside that Fail. A Cause with\nno Fail passes through unchanged. Source values already delivered remain\ndelivered. The fallback's services become requirements of the returned Fx,\nand external interruption stops whichever run is active."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { catch as recover } from \"@typed/fx/Fx\"\nimport { fail, succeed } from \"@typed/fx/Fx\"\n\nconst resilient = recover(fail(\"offline\"), (error) => succeed(error.length))"
      },
      {
        "language": "text",
        "code": "Recovering a Fail discards its complete composite Cause\n```ts\nimport { Cause } from \"effect\"\nimport { catch as recover } from \"@typed/fx/Fx\"\nimport { failCause, succeed } from \"@typed/fx/Fx\"\n\nconst composite = Cause.combine(Cause.fail(\"offline\"), Cause.die(\"socket defect\"))\nconst recovered = recover(failCause(composite), () => succeed(\"cached\"))\n```"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/Fx/combinators/catch.ts",
      "line": 65
    },
    "since": "1.0.0",
    "category": "Errors and recovery"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx/Fx#catch",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.7",
    "moduleName": "Fx",
    "consumerSpecifier": "@typed/fx/Fx",
    "exportName": "catch",
    "qualifiedName": "catch",
    "declarationKey": "declaration:80136267cd17328dd46da35e",
    "family": "variable",
    "signatures": [
      "export { catch_ as catch };",
      "export declare const catch_: {\n    <E, A2, E2, R2>(f: (e: E) => Fx<A2, E2, R2>): <A, R>(self: Fx<A, E, R>) => Fx<A | A2, E2, R | R2>;\n    <A, E, R, A2, E2, R2>(self: Fx<A, E, R>, f: (e: E) => Fx<A2, E2, R2>): Fx<A | A2, E2, R | R2>;\n};"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/catch.ts",
        "start": {
          "line": 65,
          "column": 14
        },
        "end": {
          "line": 83,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/catch.ts",
        "start": {
          "line": 66,
          "column": 3
        },
        "end": {
          "line": 66,
          "column": 101
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/catch.ts",
        "start": {
          "line": 68,
          "column": 3
        },
        "end": {
          "line": 68,
          "column": 97
        }
      }
    ],
    "aliases": [
      "@typed/fx#Fx.catch",
      "@typed/fx#Fx.catch_",
      "@typed/fx/Fx#catch_"
    ],
    "isAlias": true,
    "static": false,
    "importedFrom": "declaration:80136267cd17328dd46da35e"
  },
  "declaration": {
    "declarationKey": "declaration:80136267cd17328dd46da35e",
    "name": "catch_",
    "family": "variable",
    "facets": [
      {
        "family": "variable",
        "syntaxKind": "VariableDeclaration",
        "signatures": [
          "export declare const catch_: {\n    <E, A2, E2, R2>(f: (e: E) => Fx<A2, E2, R2>): <A, R>(self: Fx<A, E, R>) => Fx<A | A2, E2, R | R2>;\n    <A, E, R, A2, E2, R2>(self: Fx<A, E, R>, f: (e: E) => Fx<A2, E2, R2>): Fx<A | A2, E2, R | R2>;\n};"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/catch.ts",
            "start": {
              "line": 65,
              "column": 14
            },
            "end": {
              "line": 83,
              "column": 2
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "call-signature",
        "syntaxKind": "CallSignature",
        "signatures": [
          "<E, A2, E2, R2>(f: (e: E) => Fx<A2, E2, R2>): <A, R>(self: Fx<A, E, R>) => Fx<A | A2, E2, R | R2>;",
          "<A, E, R, A2, E2, R2>(self: Fx<A, E, R>, f: (e: E) => Fx<A2, E2, R2>): Fx<A | A2, E2, R | R2>;"
        ],
        "typeParameters": [
          "E",
          "A2",
          "E2",
          "R2",
          "A",
          "R"
        ],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/catch.ts",
            "start": {
              "line": 66,
              "column": 3
            },
            "end": {
              "line": 66,
              "column": 101
            }
          },
          {
            "file": "packages/fx/src/Fx/combinators/catch.ts",
            "start": {
              "line": 68,
              "column": 3
            },
            "end": {
              "line": 68,
              "column": 97
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare const catch_: {\n    <E, A2, E2, R2>(f: (e: E) => Fx<A2, E2, R2>): <A, R>(self: Fx<A, E, R>) => Fx<A | A2, E2, R | R2>;\n    <A, E, R, A2, E2, R2>(self: Fx<A, E, R>, f: (e: E) => Fx<A2, E2, R2>): Fx<A | A2, E2, R | R2>;\n};"
    ],
    "typeParameters": [
      "E",
      "A2",
      "E2",
      "R2",
      "A",
      "R"
    ],
    "summary": "Recovers from the first typed failure of an Fx by running a fallback Fx.",
    "sections": {
      "Why": "Typed failures are part of an Fx's public error channel, so callers often\nneed to replace a failed producer based on its first typed failure. This is\nthe push-stream counterpart of Effect's typed recovery.",
      "Ownership and lifetime": "The source runs until it reports a Cause containing a `Fail`. The first typed\nfailure starts exactly one fallback and the entire original Cause is replaced,\nincluding any defects or interrupts composed beside that Fail. A Cause with\nno Fail passes through unchanged. Source values already delivered remain\ndelivered. The fallback's services become requirements of the returned Fx,\nand external interruption stops whichever run is active."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { catch as recover } from \"@typed/fx/Fx\"\nimport { fail, succeed } from \"@typed/fx/Fx\"\n\nconst resilient = recover(fail(\"offline\"), (error) => succeed(error.length))"
      },
      {
        "language": "text",
        "code": "Recovering a Fail discards its complete composite Cause\n```ts\nimport { Cause } from \"effect\"\nimport { catch as recover } from \"@typed/fx/Fx\"\nimport { failCause, succeed } from \"@typed/fx/Fx\"\n\nconst composite = Cause.combine(Cause.fail(\"offline\"), Cause.die(\"socket defect\"))\nconst recovered = recover(failCause(composite), () => succeed(\"cached\"))\n```"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/catch.ts",
        "start": {
          "line": 65,
          "column": 14
        },
        "end": {
          "line": 83,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/catch.ts",
        "start": {
          "line": 66,
          "column": 3
        },
        "end": {
          "line": 66,
          "column": 101
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/catch.ts",
        "start": {
          "line": 68,
          "column": 3
        },
        "end": {
          "line": 68,
          "column": 97
        }
      }
    ],
    "since": "1.0.0",
    "category": "Errors and recovery"
  }
}
