{
  "id": "@typed/fx/Sink#loopCauseEffect",
  "canonicalId": "@typed/fx/Sink#loopCauseEffect",
  "symbol": {
    "id": "@typed/fx/Sink#loopCauseEffect",
    "packageName": "@typed/fx",
    "moduleName": "Sink",
    "exportName": "loopCauseEffect",
    "kind": "constant",
    "signatures": [
      "export declare const loopCauseEffect: {\n    <A, E, R2, B, C>(seed: B, f: (acc: B, a: Cause.Cause<E>) => Effect.Effect<readonly [\n        Cause.Cause<C>,\n        B\n    ], E, R2>): <R>(sink: Sink<A, E | C, R>) => Sink<A, E, R | R2>;\n    <A, E, R, B, C, R2>(sink: Sink<A, E | C, R>, seed: B, f: (acc: B, a: Cause.Cause<E>) => Effect.Effect<readonly [\n        Cause.Cause<C>,\n        B\n    ], E, R2>): Sink<A, E, R | R2>;\n};"
    ],
    "summary": "Threads state through an effectful failure transformation.",
    "sections": {
      "Why": "Failure handling can consult services and retain state while preserving the original Cause when\nthe handler itself fails.",
      "Ownership and lifetime": "Callback invocation constructs a transition Effect from the seed visible at that moment. The\nadapter does not serialize those Effects: overlapping failures can read the same seed, and\nsuccessful transitions commit in completion order. A transition failure is combined with the\noriginal cause and does not commit. Success values bypass the state machine. The sink instance\nretains its seed across producer runs; construct a new one to reset it."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport * as Sink from \"@typed/fx/Sink\"\nconst target = Sink.make(Effect.logError, Effect.log)\nconst sink = Sink.loopCauseEffect(target, 0, (count, cause) => Effect.succeed([cause, count + 1] as const))"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/Sink/combinators.ts",
      "line": 944
    },
    "since": "1.0.0",
    "category": "Stateful failure handling"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx/Sink#loopCauseEffect",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.13",
    "moduleName": "Sink",
    "consumerSpecifier": "@typed/fx/Sink",
    "exportName": "loopCauseEffect",
    "qualifiedName": "loopCauseEffect",
    "declarationKey": "declaration:32cb9667da7b1ac4ca767c6a",
    "family": "variable",
    "signatures": [
      "export declare const loopCauseEffect: {\n    <A, E, R2, B, C>(seed: B, f: (acc: B, a: Cause.Cause<E>) => Effect.Effect<readonly [\n        Cause.Cause<C>,\n        B\n    ], E, R2>): <R>(sink: Sink<A, E | C, R>) => Sink<A, E, R | R2>;\n    <A, E, R, B, C, R2>(sink: Sink<A, E | C, R>, seed: B, f: (acc: B, a: Cause.Cause<E>) => Effect.Effect<readonly [\n        Cause.Cause<C>,\n        B\n    ], E, R2>): Sink<A, E, R | R2>;\n};"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Sink/combinators.ts",
        "start": {
          "line": 944,
          "column": 14
        },
        "end": {
          "line": 968,
          "column": 3
        }
      },
      {
        "file": "packages/fx/src/Sink/combinators.ts",
        "start": {
          "line": 945,
          "column": 3
        },
        "end": {
          "line": 948,
          "column": 57
        }
      },
      {
        "file": "packages/fx/src/Sink/combinators.ts",
        "start": {
          "line": 950,
          "column": 3
        },
        "end": {
          "line": 954,
          "column": 25
        }
      }
    ],
    "aliases": [
      "@typed/fx#Sink.loopCauseEffect"
    ],
    "isAlias": false,
    "static": false
  },
  "declaration": {
    "declarationKey": "declaration:32cb9667da7b1ac4ca767c6a",
    "name": "loopCauseEffect",
    "family": "variable",
    "facets": [
      {
        "family": "variable",
        "syntaxKind": "VariableDeclaration",
        "signatures": [
          "export declare const loopCauseEffect: {\n    <A, E, R2, B, C>(seed: B, f: (acc: B, a: Cause.Cause<E>) => Effect.Effect<readonly [\n        Cause.Cause<C>,\n        B\n    ], E, R2>): <R>(sink: Sink<A, E | C, R>) => Sink<A, E, R | R2>;\n    <A, E, R, B, C, R2>(sink: Sink<A, E | C, R>, seed: B, f: (acc: B, a: Cause.Cause<E>) => Effect.Effect<readonly [\n        Cause.Cause<C>,\n        B\n    ], E, R2>): Sink<A, E, R | R2>;\n};"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Sink/combinators.ts",
            "start": {
              "line": 944,
              "column": 14
            },
            "end": {
              "line": 968,
              "column": 3
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "call-signature",
        "syntaxKind": "CallSignature",
        "signatures": [
          "<A, E, R2, B, C>(seed: B, f: (acc: B, a: Cause.Cause<E>) => Effect.Effect<readonly [\n    Cause.Cause<C>,\n    B\n], E, R2>): <R>(sink: Sink<A, E | C, R>) => Sink<A, E, R | R2>;",
          "<A, E, R, B, C, R2>(sink: Sink<A, E | C, R>, seed: B, f: (acc: B, a: Cause.Cause<E>) => Effect.Effect<readonly [\n    Cause.Cause<C>,\n    B\n], E, R2>): Sink<A, E, R | R2>;"
        ],
        "typeParameters": [
          "A",
          "E",
          "R2",
          "B",
          "C",
          "R"
        ],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Sink/combinators.ts",
            "start": {
              "line": 945,
              "column": 3
            },
            "end": {
              "line": 948,
              "column": 57
            }
          },
          {
            "file": "packages/fx/src/Sink/combinators.ts",
            "start": {
              "line": 950,
              "column": 3
            },
            "end": {
              "line": 954,
              "column": 25
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare const loopCauseEffect: {\n    <A, E, R2, B, C>(seed: B, f: (acc: B, a: Cause.Cause<E>) => Effect.Effect<readonly [\n        Cause.Cause<C>,\n        B\n    ], E, R2>): <R>(sink: Sink<A, E | C, R>) => Sink<A, E, R | R2>;\n    <A, E, R, B, C, R2>(sink: Sink<A, E | C, R>, seed: B, f: (acc: B, a: Cause.Cause<E>) => Effect.Effect<readonly [\n        Cause.Cause<C>,\n        B\n    ], E, R2>): Sink<A, E, R | R2>;\n};"
    ],
    "typeParameters": [
      "A",
      "E",
      "R2",
      "B",
      "C",
      "R"
    ],
    "summary": "Threads state through an effectful failure transformation.",
    "sections": {
      "Why": "Failure handling can consult services and retain state while preserving the original Cause when\nthe handler itself fails.",
      "Ownership and lifetime": "Callback invocation constructs a transition Effect from the seed visible at that moment. The\nadapter does not serialize those Effects: overlapping failures can read the same seed, and\nsuccessful transitions commit in completion order. A transition failure is combined with the\noriginal cause and does not commit. Success values bypass the state machine. The sink instance\nretains its seed across producer runs; construct a new one to reset it."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport * as Sink from \"@typed/fx/Sink\"\nconst target = Sink.make(Effect.logError, Effect.log)\nconst sink = Sink.loopCauseEffect(target, 0, (count, cause) => Effect.succeed([cause, count + 1] as const))"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Sink/combinators.ts",
        "start": {
          "line": 944,
          "column": 14
        },
        "end": {
          "line": 968,
          "column": 3
        }
      },
      {
        "file": "packages/fx/src/Sink/combinators.ts",
        "start": {
          "line": 945,
          "column": 3
        },
        "end": {
          "line": 948,
          "column": 57
        }
      },
      {
        "file": "packages/fx/src/Sink/combinators.ts",
        "start": {
          "line": 950,
          "column": 3
        },
        "end": {
          "line": 954,
          "column": 25
        }
      }
    ],
    "since": "1.0.0",
    "category": "Stateful failure handling"
  }
}
