{
  "id": "@typed/fx#Fx.retry",
  "canonicalId": "@typed/fx/Fx#retry",
  "symbol": {
    "id": "@typed/fx#Fx.retry",
    "packageName": "@typed/fx",
    "moduleName": ".",
    "exportName": "Fx.retry",
    "kind": "constant",
    "signatures": [
      "export declare const retry: {\n    <E, X, E2, R2>(schedule: Schedule.Schedule<X, E, E2, R2>): <A, R>(self: Fx<A, E, R>) => Fx<A, E | E2, R | R2>;\n    <A, E, R, X, E2, R2>(self: Fx<A, E, R>, schedule: Schedule.Schedule<X, E, E2, R2>): Fx<A, E | E2, R | R2>;\n};"
    ],
    "summary": "Retries the entire stream when its Cause contains a typed `Fail` accepted by\n`schedule`.\n\nThe schedule is reset as soon as the first element of an attempt is emitted,\nmatching Effect `Stream.retry`.",
    "sections": {
      "Why": "Retrying the whole producer, rather than a single value callback, gives a\nSchedule the typed failure that ended an attempt and lets it control backoff.",
      "Ownership and lifetime": "Attempts are sequential and reuse the same downstream sink. The first Fail\nfound anywhere in the Cause is offered to the Schedule, so a composite Cause\ncontaining that Fail can be retried even when it also contains defects or\ninterrupts; starting a new attempt discards the whole prior Cause. A Cause\nwithout a Fail terminates immediately. Schedule completion re-emits the last\nsource Cause, while Schedule failure terminates with its own cause. Emitting\nany value resets the Schedule. External interruption cancels the active\nattempt or backoff sleep."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Schedule } from \"effect\"\nimport { retry } from \"@typed/fx/Fx\"\nimport { fail } from \"@typed/fx/Fx\"\n\nconst retried = retry(fail(\"offline\"), Schedule.recurs(2))"
      },
      {
        "language": "text",
        "code": "A composite Cause is retryable when it contains a Fail\n```ts\nimport { Cause, Schedule } from \"effect\"\nimport { retry } from \"@typed/fx/Fx\"\nimport { failCause } from \"@typed/fx/Fx\"\n\nconst composite = Cause.combine(Cause.fail(\"offline\"), Cause.die(\"decoder defect\"))\nconst retried = retry(failCause(composite), Schedule.recurs(2))\n```"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/Fx/combinators/retry.ts",
      "line": 58
    },
    "since": "1.0.0",
    "category": "Errors and recovery"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx#Fx.retry",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.13",
    "moduleName": ".",
    "consumerSpecifier": "@typed/fx",
    "exportName": "Fx",
    "qualifiedName": "Fx.retry",
    "declarationKey": "declaration:53b0702c2d6e6ec31a803454",
    "family": "variable",
    "signatures": [
      "export declare const retry: {\n    <E, X, E2, R2>(schedule: Schedule.Schedule<X, E, E2, R2>): <A, R>(self: Fx<A, E, R>) => Fx<A, E | E2, R | R2>;\n    <A, E, R, X, E2, R2>(self: Fx<A, E, R>, schedule: Schedule.Schedule<X, E, E2, R2>): Fx<A, E | E2, R | R2>;\n};"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/retry.ts",
        "start": {
          "line": 58,
          "column": 14
        },
        "end": {
          "line": 105,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/retry.ts",
        "start": {
          "line": 59,
          "column": 3
        },
        "end": {
          "line": 61,
          "column": 57
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/retry.ts",
        "start": {
          "line": 62,
          "column": 3
        },
        "end": {
          "line": 65,
          "column": 28
        }
      }
    ],
    "aliases": [
      "@typed/fx/Fx#retry"
    ],
    "isAlias": true,
    "parentId": "@typed/fx#Fx",
    "static": false,
    "importedFrom": "declaration:53b0702c2d6e6ec31a803454"
  },
  "declaration": {
    "declarationKey": "declaration:53b0702c2d6e6ec31a803454",
    "name": "retry",
    "family": "variable",
    "facets": [
      {
        "family": "variable",
        "syntaxKind": "VariableDeclaration",
        "signatures": [
          "export declare const retry: {\n    <E, X, E2, R2>(schedule: Schedule.Schedule<X, E, E2, R2>): <A, R>(self: Fx<A, E, R>) => Fx<A, E | E2, R | R2>;\n    <A, E, R, X, E2, R2>(self: Fx<A, E, R>, schedule: Schedule.Schedule<X, E, E2, R2>): Fx<A, E | E2, R | R2>;\n};"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/retry.ts",
            "start": {
              "line": 58,
              "column": 14
            },
            "end": {
              "line": 105,
              "column": 2
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "call-signature",
        "syntaxKind": "CallSignature",
        "signatures": [
          "<E, X, E2, R2>(schedule: Schedule.Schedule<X, E, E2, R2>): <A, R>(self: Fx<A, E, R>) => Fx<A, E | E2, R | R2>;",
          "<A, E, R, X, E2, R2>(self: Fx<A, E, R>, schedule: Schedule.Schedule<X, E, E2, R2>): Fx<A, E | E2, R | R2>;"
        ],
        "typeParameters": [
          "E",
          "X",
          "E2",
          "R2",
          "A",
          "R"
        ],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/retry.ts",
            "start": {
              "line": 59,
              "column": 3
            },
            "end": {
              "line": 61,
              "column": 57
            }
          },
          {
            "file": "packages/fx/src/Fx/combinators/retry.ts",
            "start": {
              "line": 62,
              "column": 3
            },
            "end": {
              "line": 65,
              "column": 28
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare const retry: {\n    <E, X, E2, R2>(schedule: Schedule.Schedule<X, E, E2, R2>): <A, R>(self: Fx<A, E, R>) => Fx<A, E | E2, R | R2>;\n    <A, E, R, X, E2, R2>(self: Fx<A, E, R>, schedule: Schedule.Schedule<X, E, E2, R2>): Fx<A, E | E2, R | R2>;\n};"
    ],
    "typeParameters": [
      "E",
      "X",
      "E2",
      "R2",
      "A",
      "R"
    ],
    "summary": "Retries the entire stream when its Cause contains a typed `Fail` accepted by\n`schedule`.\n\nThe schedule is reset as soon as the first element of an attempt is emitted,\nmatching Effect `Stream.retry`.",
    "sections": {
      "Why": "Retrying the whole producer, rather than a single value callback, gives a\nSchedule the typed failure that ended an attempt and lets it control backoff.",
      "Ownership and lifetime": "Attempts are sequential and reuse the same downstream sink. The first Fail\nfound anywhere in the Cause is offered to the Schedule, so a composite Cause\ncontaining that Fail can be retried even when it also contains defects or\ninterrupts; starting a new attempt discards the whole prior Cause. A Cause\nwithout a Fail terminates immediately. Schedule completion re-emits the last\nsource Cause, while Schedule failure terminates with its own cause. Emitting\nany value resets the Schedule. External interruption cancels the active\nattempt or backoff sleep."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Schedule } from \"effect\"\nimport { retry } from \"@typed/fx/Fx\"\nimport { fail } from \"@typed/fx/Fx\"\n\nconst retried = retry(fail(\"offline\"), Schedule.recurs(2))"
      },
      {
        "language": "text",
        "code": "A composite Cause is retryable when it contains a Fail\n```ts\nimport { Cause, Schedule } from \"effect\"\nimport { retry } from \"@typed/fx/Fx\"\nimport { failCause } from \"@typed/fx/Fx\"\n\nconst composite = Cause.combine(Cause.fail(\"offline\"), Cause.die(\"decoder defect\"))\nconst retried = retry(failCause(composite), Schedule.recurs(2))\n```"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/retry.ts",
        "start": {
          "line": 58,
          "column": 14
        },
        "end": {
          "line": 105,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/retry.ts",
        "start": {
          "line": 59,
          "column": 3
        },
        "end": {
          "line": 61,
          "column": 57
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/retry.ts",
        "start": {
          "line": 62,
          "column": 3
        },
        "end": {
          "line": 65,
          "column": 28
        }
      }
    ],
    "since": "1.0.0",
    "category": "Errors and recovery"
  }
}
