{
  "id": "@typed/fx#Sink.loopEffect",
  "canonicalId": "@typed/fx/Sink#loopEffect",
  "symbol": {
    "id": "@typed/fx#Sink.loopEffect",
    "packageName": "@typed/fx",
    "moduleName": ".",
    "exportName": "Sink.loopEffect",
    "kind": "constant",
    "signatures": [
      "export declare const loopEffect: {\n    <B, A, E2, R2, C>(seed: B, f: (acc: B, a: A) => Effect.Effect<readonly [\n        C,\n        B\n    ], E2, R2>): <E, R>(sink: Sink<C, E | E2, R>) => Sink<A, E | E2, R | R2>;\n    <A, E, R, B, C>(sink: Sink<C, E, R>, seed: B, f: (acc: B, a: A) => Effect.Effect<readonly [\n        C,\n        B\n    ], E, R>): Sink<A, E, R>;\n};"
    ],
    "summary": "Threads state through an effectful success transformation and forwards one value on success.",
    "sections": {
      "Why": "Stateful consumer transitions can consult Effect services or fail without moving the state\nmachine into the producer.",
      "Ownership and lifetime": "Callback invocation constructs a transition Effect from the seed visible at that moment. The\nadapter does not serialize those Effects: overlapping callbacks can read the same seed, and\nsuccessful transitions commit in completion order. A failure is sent to the wrapped sink and does\nnot commit. The sink instance retains its last committed seed when reused by another producer run;\nconstruct a new adapted sink to reset it. Transition services and interruption remain typed."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport * as Sink from \"@typed/fx/Sink\"\nconst target = Sink.make(Effect.logError, Effect.log)\nconst totals = Sink.loopEffect(target, 0, (sum, n: number) => Effect.succeed([sum + n, sum + n] as const))"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/Sink/combinators.ts",
      "line": 778
    },
    "since": "1.0.0",
    "category": "Stateful delivery"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx#Sink.loopEffect",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.7",
    "moduleName": ".",
    "consumerSpecifier": "@typed/fx",
    "exportName": "Sink",
    "qualifiedName": "Sink.loopEffect",
    "declarationKey": "declaration:feaa9cb79ba79b1cf36ae593",
    "family": "variable",
    "signatures": [
      "export declare const loopEffect: {\n    <B, A, E2, R2, C>(seed: B, f: (acc: B, a: A) => Effect.Effect<readonly [\n        C,\n        B\n    ], E2, R2>): <E, R>(sink: Sink<C, E | E2, R>) => Sink<A, E | E2, R | R2>;\n    <A, E, R, B, C>(sink: Sink<C, E, R>, seed: B, f: (acc: B, a: A) => Effect.Effect<readonly [\n        C,\n        B\n    ], E, R>): Sink<A, E, R>;\n};"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Sink/combinators.ts",
        "start": {
          "line": 778,
          "column": 14
        },
        "end": {
          "line": 800,
          "column": 3
        }
      },
      {
        "file": "packages/fx/src/Sink/combinators.ts",
        "start": {
          "line": 779,
          "column": 3
        },
        "end": {
          "line": 782,
          "column": 66
        }
      },
      {
        "file": "packages/fx/src/Sink/combinators.ts",
        "start": {
          "line": 783,
          "column": 3
        },
        "end": {
          "line": 787,
          "column": 20
        }
      }
    ],
    "aliases": [
      "@typed/fx/Sink#loopEffect"
    ],
    "isAlias": true,
    "parentId": "@typed/fx#Sink",
    "static": false,
    "importedFrom": "declaration:feaa9cb79ba79b1cf36ae593"
  },
  "declaration": {
    "declarationKey": "declaration:feaa9cb79ba79b1cf36ae593",
    "name": "loopEffect",
    "family": "variable",
    "facets": [
      {
        "family": "variable",
        "syntaxKind": "VariableDeclaration",
        "signatures": [
          "export declare const loopEffect: {\n    <B, A, E2, R2, C>(seed: B, f: (acc: B, a: A) => Effect.Effect<readonly [\n        C,\n        B\n    ], E2, R2>): <E, R>(sink: Sink<C, E | E2, R>) => Sink<A, E | E2, R | R2>;\n    <A, E, R, B, C>(sink: Sink<C, E, R>, seed: B, f: (acc: B, a: A) => Effect.Effect<readonly [\n        C,\n        B\n    ], E, R>): Sink<A, E, R>;\n};"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Sink/combinators.ts",
            "start": {
              "line": 778,
              "column": 14
            },
            "end": {
              "line": 800,
              "column": 3
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "call-signature",
        "syntaxKind": "CallSignature",
        "signatures": [
          "<B, A, E2, R2, C>(seed: B, f: (acc: B, a: A) => Effect.Effect<readonly [\n    C,\n    B\n], E2, R2>): <E, R>(sink: Sink<C, E | E2, R>) => Sink<A, E | E2, R | R2>;",
          "<A, E, R, B, C>(sink: Sink<C, E, R>, seed: B, f: (acc: B, a: A) => Effect.Effect<readonly [\n    C,\n    B\n], E, R>): Sink<A, E, R>;"
        ],
        "typeParameters": [
          "B",
          "A",
          "E2",
          "R2",
          "C",
          "E",
          "R"
        ],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Sink/combinators.ts",
            "start": {
              "line": 779,
              "column": 3
            },
            "end": {
              "line": 782,
              "column": 66
            }
          },
          {
            "file": "packages/fx/src/Sink/combinators.ts",
            "start": {
              "line": 783,
              "column": 3
            },
            "end": {
              "line": 787,
              "column": 20
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare const loopEffect: {\n    <B, A, E2, R2, C>(seed: B, f: (acc: B, a: A) => Effect.Effect<readonly [\n        C,\n        B\n    ], E2, R2>): <E, R>(sink: Sink<C, E | E2, R>) => Sink<A, E | E2, R | R2>;\n    <A, E, R, B, C>(sink: Sink<C, E, R>, seed: B, f: (acc: B, a: A) => Effect.Effect<readonly [\n        C,\n        B\n    ], E, R>): Sink<A, E, R>;\n};"
    ],
    "typeParameters": [
      "B",
      "A",
      "E2",
      "R2",
      "C",
      "E",
      "R"
    ],
    "summary": "Threads state through an effectful success transformation and forwards one value on success.",
    "sections": {
      "Why": "Stateful consumer transitions can consult Effect services or fail without moving the state\nmachine into the producer.",
      "Ownership and lifetime": "Callback invocation constructs a transition Effect from the seed visible at that moment. The\nadapter does not serialize those Effects: overlapping callbacks can read the same seed, and\nsuccessful transitions commit in completion order. A failure is sent to the wrapped sink and does\nnot commit. The sink instance retains its last committed seed when reused by another producer run;\nconstruct a new adapted sink to reset it. Transition services and interruption remain typed."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport * as Sink from \"@typed/fx/Sink\"\nconst target = Sink.make(Effect.logError, Effect.log)\nconst totals = Sink.loopEffect(target, 0, (sum, n: number) => Effect.succeed([sum + n, sum + n] as const))"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Sink/combinators.ts",
        "start": {
          "line": 778,
          "column": 14
        },
        "end": {
          "line": 800,
          "column": 3
        }
      },
      {
        "file": "packages/fx/src/Sink/combinators.ts",
        "start": {
          "line": 779,
          "column": 3
        },
        "end": {
          "line": 782,
          "column": 66
        }
      },
      {
        "file": "packages/fx/src/Sink/combinators.ts",
        "start": {
          "line": 783,
          "column": 3
        },
        "end": {
          "line": 787,
          "column": 20
        }
      }
    ],
    "since": "1.0.0",
    "category": "Stateful delivery"
  }
}
