{
  "id": "@typed/fx#Fx.loop",
  "canonicalId": "@typed/fx/Fx#loop",
  "symbol": {
    "id": "@typed/fx#Fx.loop",
    "packageName": "@typed/fx",
    "moduleName": ".",
    "exportName": "Fx.loop",
    "kind": "constant",
    "signatures": [
      "export declare const loop: {\n    <B, A, C>(seed: B, f: (acc: B, a: A) => readonly [\n        C,\n        B\n    ]): <E, R>(self: Fx<A, E, R>) => Fx<C, E, R>;\n    <A, E, R, B, C>(self: Fx<A, E, R>, seed: B, f: (acc: B, a: A) => readonly [\n        C,\n        B\n    ]): Fx<C, E, R>;\n};"
    ],
    "summary": "Loops over an Fx with an accumulator, producing a new value for each element\nand updating the accumulator.",
    "sections": {
      "Why": "`loop` is the primitive for a synchronous state machine over pushed values. Every input emits\nexactly one output and installs exactly one next state, preserving source order.",
      "Ownership and lifetime": "A fresh accumulator starts from `seed` for each run and is discarded when that run ends. The\npure callback adds no failures, services, fibers, or resources."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Fx } from \"@typed/fx\"\n\nconst indexed = Fx.fromIterable([\"a\", \"b\"]).pipe(Fx.loop(0, (index, value) => [[index, value] as const, index + 1]))"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/Fx/combinators/loop.ts",
      "line": 32
    },
    "since": "1.0.0",
    "category": "Stateful transforms"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx#Fx.loop",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.7",
    "moduleName": ".",
    "consumerSpecifier": "@typed/fx",
    "exportName": "Fx",
    "qualifiedName": "Fx.loop",
    "declarationKey": "declaration:291202f08f6b3e0c2bfe450f",
    "family": "variable",
    "signatures": [
      "export declare const loop: {\n    <B, A, C>(seed: B, f: (acc: B, a: A) => readonly [\n        C,\n        B\n    ]): <E, R>(self: Fx<A, E, R>) => Fx<C, E, R>;\n    <A, E, R, B, C>(self: Fx<A, E, R>, seed: B, f: (acc: B, a: A) => readonly [\n        C,\n        B\n    ]): Fx<C, E, R>;\n};"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/loop.ts",
        "start": {
          "line": 32,
          "column": 14
        },
        "end": {
          "line": 43,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/loop.ts",
        "start": {
          "line": 33,
          "column": 3
        },
        "end": {
          "line": 36,
          "column": 47
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/loop.ts",
        "start": {
          "line": 38,
          "column": 3
        },
        "end": {
          "line": 38,
          "column": 98
        }
      }
    ],
    "aliases": [
      "@typed/fx/Fx#loop"
    ],
    "isAlias": true,
    "parentId": "@typed/fx#Fx",
    "static": false,
    "importedFrom": "declaration:291202f08f6b3e0c2bfe450f"
  },
  "declaration": {
    "declarationKey": "declaration:291202f08f6b3e0c2bfe450f",
    "name": "loop",
    "family": "variable",
    "facets": [
      {
        "family": "variable",
        "syntaxKind": "VariableDeclaration",
        "signatures": [
          "export declare const loop: {\n    <B, A, C>(seed: B, f: (acc: B, a: A) => readonly [\n        C,\n        B\n    ]): <E, R>(self: Fx<A, E, R>) => Fx<C, E, R>;\n    <A, E, R, B, C>(self: Fx<A, E, R>, seed: B, f: (acc: B, a: A) => readonly [\n        C,\n        B\n    ]): Fx<C, E, R>;\n};"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/loop.ts",
            "start": {
              "line": 32,
              "column": 14
            },
            "end": {
              "line": 43,
              "column": 2
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "call-signature",
        "syntaxKind": "CallSignature",
        "signatures": [
          "<B, A, C>(seed: B, f: (acc: B, a: A) => readonly [\n    C,\n    B\n]): <E, R>(self: Fx<A, E, R>) => Fx<C, E, R>;",
          "<A, E, R, B, C>(self: Fx<A, E, R>, seed: B, f: (acc: B, a: A) => readonly [\n    C,\n    B\n]): Fx<C, E, R>;"
        ],
        "typeParameters": [
          "B",
          "A",
          "C",
          "E",
          "R"
        ],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/loop.ts",
            "start": {
              "line": 33,
              "column": 3
            },
            "end": {
              "line": 36,
              "column": 47
            }
          },
          {
            "file": "packages/fx/src/Fx/combinators/loop.ts",
            "start": {
              "line": 38,
              "column": 3
            },
            "end": {
              "line": 38,
              "column": 98
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare const loop: {\n    <B, A, C>(seed: B, f: (acc: B, a: A) => readonly [\n        C,\n        B\n    ]): <E, R>(self: Fx<A, E, R>) => Fx<C, E, R>;\n    <A, E, R, B, C>(self: Fx<A, E, R>, seed: B, f: (acc: B, a: A) => readonly [\n        C,\n        B\n    ]): Fx<C, E, R>;\n};"
    ],
    "typeParameters": [
      "B",
      "A",
      "C",
      "E",
      "R"
    ],
    "summary": "Loops over an Fx with an accumulator, producing a new value for each element\nand updating the accumulator.",
    "sections": {
      "Why": "`loop` is the primitive for a synchronous state machine over pushed values. Every input emits\nexactly one output and installs exactly one next state, preserving source order.",
      "Ownership and lifetime": "A fresh accumulator starts from `seed` for each run and is discarded when that run ends. The\npure callback adds no failures, services, fibers, or resources."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Fx } from \"@typed/fx\"\n\nconst indexed = Fx.fromIterable([\"a\", \"b\"]).pipe(Fx.loop(0, (index, value) => [[index, value] as const, index + 1]))"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/loop.ts",
        "start": {
          "line": 32,
          "column": 14
        },
        "end": {
          "line": 43,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/loop.ts",
        "start": {
          "line": 33,
          "column": 3
        },
        "end": {
          "line": 36,
          "column": 47
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/loop.ts",
        "start": {
          "line": 38,
          "column": 3
        },
        "end": {
          "line": 38,
          "column": 98
        }
      }
    ],
    "since": "1.0.0",
    "category": "Stateful transforms"
  }
}
