{
  "id": "@typed/fx/Push#mapAccum",
  "canonicalId": "@typed/fx/Push#mapAccum",
  "symbol": {
    "id": "@typed/fx/Push#mapAccum",
    "packageName": "@typed/fx",
    "moduleName": "Push",
    "exportName": "mapAccum",
    "kind": "constant",
    "signatures": [
      "export declare const mapAccum: {\n    <S, B, C>(initial: S, f: (s: S, b: B) => readonly [\n        S,\n        C\n    ]): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, C, E2, R2>;\n    <A, E, R, B, E2, R2, S, C>(push: Push<A, E, R, B, E2, R2>, initial: S, f: (s: S, b: B) => readonly [\n        S,\n        C\n    ]): Push<A, E, R, C, E2, R2>;\n};"
    ],
    "summary": "Maps over the output (Fx) side of a `Push` with an accumulator: for each emitted value `b`,\napplies `f(state, b)` to get `[nextState, emitted]` and emits the second element.\nThe first element is the initial state; subsequent states are updated by each step.\nIt emits exactly one `C` per upstream value, in order. Accumulator state is\nprivate to each output subscription; the input Sink is unchanged.",
    "sections": {
      "Why": "Stateful output projection can derive running totals or protocol state without\nmoving that state into the bidirectional input boundary.",
      "Ownership and lifetime": "Each run owns its own synchronous accumulator. It is discarded when that run\ncompletes or is interrupted and acquires no Scope or external resource."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport * as Fx from \"@typed/fx/Fx\"\nimport * as Push from \"@typed/fx/Push\"\nimport * as Sink from \"@typed/fx/Sink\"\n\nconst push = Push.make(Sink.make(() => Effect.void, (_: string) => Effect.void), Fx.fromIterable([1, 2, 3]))\nconst totals = Push.mapAccum(push, 0, (total, value) => [total + value, total + value] as const)"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/Push/Push.ts",
      "line": 1950
    },
    "since": "1.0.0",
    "category": "Stateful outputs"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx/Push#mapAccum",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.13",
    "moduleName": "Push",
    "consumerSpecifier": "@typed/fx/Push",
    "exportName": "mapAccum",
    "qualifiedName": "mapAccum",
    "declarationKey": "declaration:d42475d4ae6b85f29f3f9017",
    "family": "variable",
    "signatures": [
      "export declare const mapAccum: {\n    <S, B, C>(initial: S, f: (s: S, b: B) => readonly [\n        S,\n        C\n    ]): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, C, E2, R2>;\n    <A, E, R, B, E2, R2, S, C>(push: Push<A, E, R, B, E2, R2>, initial: S, f: (s: S, b: B) => readonly [\n        S,\n        C\n    ]): Push<A, E, R, C, E2, R2>;\n};"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Push/Push.ts",
        "start": {
          "line": 1950,
          "column": 14
        },
        "end": {
          "line": 1988,
          "column": 3
        }
      },
      {
        "file": "packages/fx/src/Push/Push.ts",
        "start": {
          "line": 1951,
          "column": 3
        },
        "end": {
          "line": 1954,
          "column": 84
        }
      },
      {
        "file": "packages/fx/src/Push/Push.ts",
        "start": {
          "line": 1955,
          "column": 3
        },
        "end": {
          "line": 1959,
          "column": 31
        }
      }
    ],
    "aliases": [
      "@typed/fx#Push.mapAccum"
    ],
    "isAlias": false,
    "static": false
  },
  "declaration": {
    "declarationKey": "declaration:d42475d4ae6b85f29f3f9017",
    "name": "mapAccum",
    "family": "variable",
    "facets": [
      {
        "family": "variable",
        "syntaxKind": "VariableDeclaration",
        "signatures": [
          "export declare const mapAccum: {\n    <S, B, C>(initial: S, f: (s: S, b: B) => readonly [\n        S,\n        C\n    ]): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, C, E2, R2>;\n    <A, E, R, B, E2, R2, S, C>(push: Push<A, E, R, B, E2, R2>, initial: S, f: (s: S, b: B) => readonly [\n        S,\n        C\n    ]): Push<A, E, R, C, E2, R2>;\n};"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Push/Push.ts",
            "start": {
              "line": 1950,
              "column": 14
            },
            "end": {
              "line": 1988,
              "column": 3
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "call-signature",
        "syntaxKind": "CallSignature",
        "signatures": [
          "<S, B, C>(initial: S, f: (s: S, b: B) => readonly [\n    S,\n    C\n]): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, C, E2, R2>;",
          "<A, E, R, B, E2, R2, S, C>(push: Push<A, E, R, B, E2, R2>, initial: S, f: (s: S, b: B) => readonly [\n    S,\n    C\n]): Push<A, E, R, C, E2, R2>;"
        ],
        "typeParameters": [
          "S",
          "B",
          "C",
          "A",
          "E",
          "R",
          "E2",
          "R2"
        ],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Push/Push.ts",
            "start": {
              "line": 1951,
              "column": 3
            },
            "end": {
              "line": 1954,
              "column": 84
            }
          },
          {
            "file": "packages/fx/src/Push/Push.ts",
            "start": {
              "line": 1955,
              "column": 3
            },
            "end": {
              "line": 1959,
              "column": 31
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare const mapAccum: {\n    <S, B, C>(initial: S, f: (s: S, b: B) => readonly [\n        S,\n        C\n    ]): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, C, E2, R2>;\n    <A, E, R, B, E2, R2, S, C>(push: Push<A, E, R, B, E2, R2>, initial: S, f: (s: S, b: B) => readonly [\n        S,\n        C\n    ]): Push<A, E, R, C, E2, R2>;\n};"
    ],
    "typeParameters": [
      "S",
      "B",
      "C",
      "A",
      "E",
      "R",
      "E2",
      "R2"
    ],
    "summary": "Maps over the output (Fx) side of a `Push` with an accumulator: for each emitted value `b`,\napplies `f(state, b)` to get `[nextState, emitted]` and emits the second element.\nThe first element is the initial state; subsequent states are updated by each step.\nIt emits exactly one `C` per upstream value, in order. Accumulator state is\nprivate to each output subscription; the input Sink is unchanged.",
    "sections": {
      "Why": "Stateful output projection can derive running totals or protocol state without\nmoving that state into the bidirectional input boundary.",
      "Ownership and lifetime": "Each run owns its own synchronous accumulator. It is discarded when that run\ncompletes or is interrupted and acquires no Scope or external resource."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport * as Fx from \"@typed/fx/Fx\"\nimport * as Push from \"@typed/fx/Push\"\nimport * as Sink from \"@typed/fx/Sink\"\n\nconst push = Push.make(Sink.make(() => Effect.void, (_: string) => Effect.void), Fx.fromIterable([1, 2, 3]))\nconst totals = Push.mapAccum(push, 0, (total, value) => [total + value, total + value] as const)"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Push/Push.ts",
        "start": {
          "line": 1950,
          "column": 14
        },
        "end": {
          "line": 1988,
          "column": 3
        }
      },
      {
        "file": "packages/fx/src/Push/Push.ts",
        "start": {
          "line": 1951,
          "column": 3
        },
        "end": {
          "line": 1954,
          "column": 84
        }
      },
      {
        "file": "packages/fx/src/Push/Push.ts",
        "start": {
          "line": 1955,
          "column": 3
        },
        "end": {
          "line": 1959,
          "column": 31
        }
      }
    ],
    "since": "1.0.0",
    "category": "Stateful outputs"
  }
}
