{
  "id": "@typed/fx/Fx#filterMapLoop",
  "canonicalId": "@typed/fx/Fx#filterMapLoop",
  "symbol": {
    "id": "@typed/fx/Fx#filterMapLoop",
    "packageName": "@typed/fx",
    "moduleName": "Fx",
    "exportName": "filterMapLoop",
    "kind": "constant",
    "signatures": [
      "export declare const filterMapLoop: {\n    <B, A, C>(seed: B, f: (acc: B, a: A) => readonly [\n        Option.Option<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        Option.Option<C>,\n        B\n    ]): Fx<C, E, R>;\n};"
    ],
    "summary": "Loops over an Fx with an accumulator, producing an optional new value for each element.\nIf the function returns `None`, the element is filtered out.",
    "sections": {
      "Why": "`filterMapLoop` combines per-run state, mapping, and filtering in one ordered step. Every input\nupdates the accumulator and may emit one `Some`; `None` still commits the returned next state.",
      "Ownership and lifetime": "The seed is copied into each run and retained only until that run ends. The callback is pure, and\nsource failure, services, completion, and interruption are preserved."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Option } from \"effect\"\nimport { Fx } from \"@typed/fx\"\n\nconst everyOther = Fx.fromIterable([1, 2, 3]).pipe(\n  Fx.filterMapLoop(0, (index, value) => [index % 2 === 0 ? Option.some(value) : Option.none(), index + 1]),\n)"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/Fx/combinators/filterMapLoop.ts",
      "line": 36
    },
    "since": "1.0.0",
    "category": "Stateful transforms"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx/Fx#filterMapLoop",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.7",
    "moduleName": "Fx",
    "consumerSpecifier": "@typed/fx/Fx",
    "exportName": "filterMapLoop",
    "qualifiedName": "filterMapLoop",
    "declarationKey": "declaration:2b5245870649451fd0e4e405",
    "family": "variable",
    "signatures": [
      "export declare const filterMapLoop: {\n    <B, A, C>(seed: B, f: (acc: B, a: A) => readonly [\n        Option.Option<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        Option.Option<C>,\n        B\n    ]): Fx<C, E, R>;\n};"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/filterMapLoop.ts",
        "start": {
          "line": 36,
          "column": 14
        },
        "end": {
          "line": 54,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/filterMapLoop.ts",
        "start": {
          "line": 37,
          "column": 3
        },
        "end": {
          "line": 40,
          "column": 47
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/filterMapLoop.ts",
        "start": {
          "line": 42,
          "column": 3
        },
        "end": {
          "line": 46,
          "column": 18
        }
      }
    ],
    "aliases": [
      "@typed/fx#Fx.filterMapLoop"
    ],
    "isAlias": false,
    "static": false
  },
  "declaration": {
    "declarationKey": "declaration:2b5245870649451fd0e4e405",
    "name": "filterMapLoop",
    "family": "variable",
    "facets": [
      {
        "family": "variable",
        "syntaxKind": "VariableDeclaration",
        "signatures": [
          "export declare const filterMapLoop: {\n    <B, A, C>(seed: B, f: (acc: B, a: A) => readonly [\n        Option.Option<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        Option.Option<C>,\n        B\n    ]): Fx<C, E, R>;\n};"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/filterMapLoop.ts",
            "start": {
              "line": 36,
              "column": 14
            },
            "end": {
              "line": 54,
              "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    Option.Option<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    Option.Option<C>,\n    B\n]): Fx<C, E, R>;"
        ],
        "typeParameters": [
          "B",
          "A",
          "C",
          "E",
          "R"
        ],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/filterMapLoop.ts",
            "start": {
              "line": 37,
              "column": 3
            },
            "end": {
              "line": 40,
              "column": 47
            }
          },
          {
            "file": "packages/fx/src/Fx/combinators/filterMapLoop.ts",
            "start": {
              "line": 42,
              "column": 3
            },
            "end": {
              "line": 46,
              "column": 18
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare const filterMapLoop: {\n    <B, A, C>(seed: B, f: (acc: B, a: A) => readonly [\n        Option.Option<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        Option.Option<C>,\n        B\n    ]): Fx<C, E, R>;\n};"
    ],
    "typeParameters": [
      "B",
      "A",
      "C",
      "E",
      "R"
    ],
    "summary": "Loops over an Fx with an accumulator, producing an optional new value for each element.\nIf the function returns `None`, the element is filtered out.",
    "sections": {
      "Why": "`filterMapLoop` combines per-run state, mapping, and filtering in one ordered step. Every input\nupdates the accumulator and may emit one `Some`; `None` still commits the returned next state.",
      "Ownership and lifetime": "The seed is copied into each run and retained only until that run ends. The callback is pure, and\nsource failure, services, completion, and interruption are preserved."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Option } from \"effect\"\nimport { Fx } from \"@typed/fx\"\n\nconst everyOther = Fx.fromIterable([1, 2, 3]).pipe(\n  Fx.filterMapLoop(0, (index, value) => [index % 2 === 0 ? Option.some(value) : Option.none(), index + 1]),\n)"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/filterMapLoop.ts",
        "start": {
          "line": 36,
          "column": 14
        },
        "end": {
          "line": 54,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/filterMapLoop.ts",
        "start": {
          "line": 37,
          "column": 3
        },
        "end": {
          "line": 40,
          "column": 47
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/filterMapLoop.ts",
        "start": {
          "line": 42,
          "column": 3
        },
        "end": {
          "line": 46,
          "column": 18
        }
      }
    ],
    "since": "1.0.0",
    "category": "Stateful transforms"
  }
}
