{
  "id": "@typed/fx#Fx.scan",
  "canonicalId": "@typed/fx/Fx#scan",
  "symbol": {
    "id": "@typed/fx#Fx.scan",
    "packageName": "@typed/fx",
    "moduleName": ".",
    "exportName": "Fx.scan",
    "kind": "constant",
    "signatures": [
      "export declare const scan: {\n    <S, A>(initial: S, f: (s: S, a: A) => S): <E, R>(fx: Fx<A, E, R>) => Fx<S, E, R>;\n    <A, E, R, S>(fx: Fx<A, E, R>, initial: S, f: (s: S, a: A) => S): Fx<S, E, R>;\n};"
    ],
    "summary": "Scans the stream with a pure function, emitting the accumulated state after each element.\nEmits the initial value first, then for each input `a` emits `f(state, a)` and updates state.\n\nSemantics align with Effect Stream's `scan`: output is `initial`, `f(initial, a1)`, `f(..., a2)`, ...",
    "sections": {
      "Why": "`scan` exposes every accumulated state, including `initial` before the source is run. For `n`\ninputs it emits `n + 1` states in order, making incremental reduction observable.",
      "Ownership and lifetime": "Each run owns an independent accumulator and releases it when the run ends. The pure reducer\nacquires no resources and preserves source failures, services, and interruption."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Fx } from \"@typed/fx\"\n\nconst totals = Fx.fromIterable([1, 2, 3]).pipe(Fx.scan(0, (sum, n) => sum + n))"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/Fx/combinators/scan.ts",
      "line": 36
    },
    "since": "1.0.0",
    "category": "Stateful transforms"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx#Fx.scan",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.7",
    "moduleName": ".",
    "consumerSpecifier": "@typed/fx",
    "exportName": "Fx",
    "qualifiedName": "Fx.scan",
    "declarationKey": "declaration:ab02d3feae338ace4542a41b",
    "family": "variable",
    "signatures": [
      "export declare const scan: {\n    <S, A>(initial: S, f: (s: S, a: A) => S): <E, R>(fx: Fx<A, E, R>) => Fx<S, E, R>;\n    <A, E, R, S>(fx: Fx<A, E, R>, initial: S, f: (s: S, a: A) => S): Fx<S, E, R>;\n};"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/scan.ts",
        "start": {
          "line": 36,
          "column": 14
        },
        "end": {
          "line": 51,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/scan.ts",
        "start": {
          "line": 37,
          "column": 3
        },
        "end": {
          "line": 37,
          "column": 84
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/scan.ts",
        "start": {
          "line": 38,
          "column": 3
        },
        "end": {
          "line": 38,
          "column": 80
        }
      }
    ],
    "aliases": [
      "@typed/fx/Fx#scan"
    ],
    "isAlias": true,
    "parentId": "@typed/fx#Fx",
    "static": false,
    "importedFrom": "declaration:ab02d3feae338ace4542a41b"
  },
  "declaration": {
    "declarationKey": "declaration:ab02d3feae338ace4542a41b",
    "name": "scan",
    "family": "variable",
    "facets": [
      {
        "family": "variable",
        "syntaxKind": "VariableDeclaration",
        "signatures": [
          "export declare const scan: {\n    <S, A>(initial: S, f: (s: S, a: A) => S): <E, R>(fx: Fx<A, E, R>) => Fx<S, E, R>;\n    <A, E, R, S>(fx: Fx<A, E, R>, initial: S, f: (s: S, a: A) => S): Fx<S, E, R>;\n};"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/scan.ts",
            "start": {
              "line": 36,
              "column": 14
            },
            "end": {
              "line": 51,
              "column": 2
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "call-signature",
        "syntaxKind": "CallSignature",
        "signatures": [
          "<S, A>(initial: S, f: (s: S, a: A) => S): <E, R>(fx: Fx<A, E, R>) => Fx<S, E, R>;",
          "<A, E, R, S>(fx: Fx<A, E, R>, initial: S, f: (s: S, a: A) => S): Fx<S, E, R>;"
        ],
        "typeParameters": [
          "S",
          "A",
          "E",
          "R"
        ],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/scan.ts",
            "start": {
              "line": 37,
              "column": 3
            },
            "end": {
              "line": 37,
              "column": 84
            }
          },
          {
            "file": "packages/fx/src/Fx/combinators/scan.ts",
            "start": {
              "line": 38,
              "column": 3
            },
            "end": {
              "line": 38,
              "column": 80
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare const scan: {\n    <S, A>(initial: S, f: (s: S, a: A) => S): <E, R>(fx: Fx<A, E, R>) => Fx<S, E, R>;\n    <A, E, R, S>(fx: Fx<A, E, R>, initial: S, f: (s: S, a: A) => S): Fx<S, E, R>;\n};"
    ],
    "typeParameters": [
      "S",
      "A",
      "E",
      "R"
    ],
    "summary": "Scans the stream with a pure function, emitting the accumulated state after each element.\nEmits the initial value first, then for each input `a` emits `f(state, a)` and updates state.\n\nSemantics align with Effect Stream's `scan`: output is `initial`, `f(initial, a1)`, `f(..., a2)`, ...",
    "sections": {
      "Why": "`scan` exposes every accumulated state, including `initial` before the source is run. For `n`\ninputs it emits `n + 1` states in order, making incremental reduction observable.",
      "Ownership and lifetime": "Each run owns an independent accumulator and releases it when the run ends. The pure reducer\nacquires no resources and preserves source failures, services, and interruption."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Fx } from \"@typed/fx\"\n\nconst totals = Fx.fromIterable([1, 2, 3]).pipe(Fx.scan(0, (sum, n) => sum + n))"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/scan.ts",
        "start": {
          "line": 36,
          "column": 14
        },
        "end": {
          "line": 51,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/scan.ts",
        "start": {
          "line": 37,
          "column": 3
        },
        "end": {
          "line": 37,
          "column": 84
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/scan.ts",
        "start": {
          "line": 38,
          "column": 3
        },
        "end": {
          "line": 38,
          "column": 80
        }
      }
    ],
    "since": "1.0.0",
    "category": "Stateful transforms"
  }
}
