{
  "id": "@typed/fx/Fx#loopEffect",
  "canonicalId": "@typed/fx/Fx#loopEffect",
  "symbol": {
    "id": "@typed/fx/Fx#loopEffect",
    "packageName": "@typed/fx",
    "moduleName": "Fx",
    "exportName": "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>(self: Fx<A, E | E2, R>) => Fx<C, E | E2, R | R2>;\n    <A, E, R, B, C>(self: Fx<A, E, R>, seed: B, f: (acc: B, a: A) => Effect.Effect<readonly [\n        C,\n        B\n    ], E, R>): Fx<C, E, R>;\n};"
    ],
    "summary": "Effectfully loops over an Fx with an accumulator, producing a new value for each element.",
    "sections": {
      "Why": "`loopEffect` models an Effectful state transition without nested Fx values. It does not serialize\nproducer callbacks: overlapping deliveries can read the same seed, complete out of order, and\noverwrite one another's next state. Use a serialized producer when atomic accumulation matters.",
      "Ownership and lifetime": "One mutable seed is retained per run. Each callback Effect follows its invoking delivery; failure\nis sent to the Sink, services remain required, and interruption does not provide a global lock."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport { Fx } from \"@typed/fx\"\n\nconst concurrent = Fx.make<number>((sink) =>\n  Effect.all([sink.onSuccess(1), sink.onSuccess(2)], { concurrency: \"unbounded\", discard: true })\n)\nconst program = Fx.collectAll(\n  concurrent.pipe(Fx.loopEffect(0, (sum, n) => Effect.succeed([sum + n, sum + n])))\n) // both overlapping transitions may observe sum === 0"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/Fx/combinators/loopEffect.ts",
      "line": 39
    },
    "since": "1.0.0",
    "category": "Stateful transforms"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx/Fx#loopEffect",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.13",
    "moduleName": "Fx",
    "consumerSpecifier": "@typed/fx/Fx",
    "exportName": "loopEffect",
    "qualifiedName": "loopEffect",
    "declarationKey": "declaration:1bfb357af1850b152fec997b",
    "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>(self: Fx<A, E | E2, R>) => Fx<C, E | E2, R | R2>;\n    <A, E, R, B, C>(self: Fx<A, E, R>, seed: B, f: (acc: B, a: A) => Effect.Effect<readonly [\n        C,\n        B\n    ], E, R>): Fx<C, E, R>;\n};"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/loopEffect.ts",
        "start": {
          "line": 39,
          "column": 14
        },
        "end": {
          "line": 57,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/loopEffect.ts",
        "start": {
          "line": 40,
          "column": 3
        },
        "end": {
          "line": 43,
          "column": 62
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/loopEffect.ts",
        "start": {
          "line": 45,
          "column": 3
        },
        "end": {
          "line": 49,
          "column": 18
        }
      }
    ],
    "aliases": [
      "@typed/fx#Fx.loopEffect"
    ],
    "isAlias": false,
    "static": false
  },
  "declaration": {
    "declarationKey": "declaration:1bfb357af1850b152fec997b",
    "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>(self: Fx<A, E | E2, R>) => Fx<C, E | E2, R | R2>;\n    <A, E, R, B, C>(self: Fx<A, E, R>, seed: B, f: (acc: B, a: A) => Effect.Effect<readonly [\n        C,\n        B\n    ], E, R>): Fx<C, E, R>;\n};"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/loopEffect.ts",
            "start": {
              "line": 39,
              "column": 14
            },
            "end": {
              "line": 57,
              "column": 2
            }
          }
        ],
        "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>(self: Fx<A, E | E2, R>) => Fx<C, E | E2, R | R2>;",
          "<A, E, R, B, C>(self: Fx<A, E, R>, seed: B, f: (acc: B, a: A) => Effect.Effect<readonly [\n    C,\n    B\n], E, R>): Fx<C, E, R>;"
        ],
        "typeParameters": [
          "B",
          "A",
          "E2",
          "R2",
          "C",
          "E",
          "R"
        ],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/loopEffect.ts",
            "start": {
              "line": 40,
              "column": 3
            },
            "end": {
              "line": 43,
              "column": 62
            }
          },
          {
            "file": "packages/fx/src/Fx/combinators/loopEffect.ts",
            "start": {
              "line": 45,
              "column": 3
            },
            "end": {
              "line": 49,
              "column": 18
            }
          }
        ],
        "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>(self: Fx<A, E | E2, R>) => Fx<C, E | E2, R | R2>;\n    <A, E, R, B, C>(self: Fx<A, E, R>, seed: B, f: (acc: B, a: A) => Effect.Effect<readonly [\n        C,\n        B\n    ], E, R>): Fx<C, E, R>;\n};"
    ],
    "typeParameters": [
      "B",
      "A",
      "E2",
      "R2",
      "C",
      "E",
      "R"
    ],
    "summary": "Effectfully loops over an Fx with an accumulator, producing a new value for each element.",
    "sections": {
      "Why": "`loopEffect` models an Effectful state transition without nested Fx values. It does not serialize\nproducer callbacks: overlapping deliveries can read the same seed, complete out of order, and\noverwrite one another's next state. Use a serialized producer when atomic accumulation matters.",
      "Ownership and lifetime": "One mutable seed is retained per run. Each callback Effect follows its invoking delivery; failure\nis sent to the Sink, services remain required, and interruption does not provide a global lock."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport { Fx } from \"@typed/fx\"\n\nconst concurrent = Fx.make<number>((sink) =>\n  Effect.all([sink.onSuccess(1), sink.onSuccess(2)], { concurrency: \"unbounded\", discard: true })\n)\nconst program = Fx.collectAll(\n  concurrent.pipe(Fx.loopEffect(0, (sum, n) => Effect.succeed([sum + n, sum + n])))\n) // both overlapping transitions may observe sum === 0"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/loopEffect.ts",
        "start": {
          "line": 39,
          "column": 14
        },
        "end": {
          "line": 57,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/loopEffect.ts",
        "start": {
          "line": 40,
          "column": 3
        },
        "end": {
          "line": 43,
          "column": 62
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/loopEffect.ts",
        "start": {
          "line": 45,
          "column": 3
        },
        "end": {
          "line": 49,
          "column": 18
        }
      }
    ],
    "since": "1.0.0",
    "category": "Stateful transforms"
  }
}
