{
  "id": "@typed/fx/Push#flatMapEffect",
  "canonicalId": "@typed/fx/Push#flatMapEffect",
  "symbol": {
    "id": "@typed/fx/Push#flatMapEffect",
    "packageName": "@typed/fx",
    "moduleName": "Push",
    "exportName": "flatMapEffect",
    "kind": "constant",
    "signatures": [
      "export declare const flatMapEffect: {\n    <B, C, E3, R3>(f: (b: B) => Effect.Effect<C, E3, R3>): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;\n    <A, E, R, B, E2, R2, C, E3, R3>(push: Push<A, E, R, B, E2, R2>, f: (b: B) => Effect.Effect<C, E3, R3>): Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;\n};"
    ],
    "summary": "Transforms every output value into an Effect and merges their results concurrently.\n\nOne Effect starts per outer value and can emit one result. All successful\nresults are emitted, but concurrent completion order may differ from input\norder. The input side is unchanged.",
    "sections": {
      "Why": "This runs independent Effect work concurrently without manually lifting each\nEffect into Fx.",
      "Ownership and lifetime": "Active Effects are fibers owned by the output Scope. Completion waits for all\nof them; interruption stops them and runs their finalizers. `E3` and `R3` join\nthe output failure and service channels."
    },
    "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 finalized: Array<number> = []\nconst push = Push.make(\n  Sink.make(() => Effect.void, (_: string) => Effect.void),\n  Fx.fromIterable([1, 2])\n)\nconst loaded = Push.flatMapEffect(push, (id) =>\n  Effect.sleep(id === 1 ? \"20 millis\" : \"1 millis\").pipe(\n    Effect.as(id),\n    Effect.ensuring(Effect.sync(() => finalized.push(id)))\n  )\n)\nconst program = Fx.collectAll(loaded).pipe(\n  Effect.map((values) => ({ values, finalized })),\n  Effect.scoped\n)\n// Effect.runPromise(program) => { values: [2, 1], finalized: [2, 1] }"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/Push/Push.ts",
      "line": 1548
    },
    "since": "1.0.0",
    "category": "Concurrent output work"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx/Push#flatMapEffect",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.7",
    "moduleName": "Push",
    "consumerSpecifier": "@typed/fx/Push",
    "exportName": "flatMapEffect",
    "qualifiedName": "flatMapEffect",
    "declarationKey": "declaration:472bc1a9fa8827f167385244",
    "family": "variable",
    "signatures": [
      "export declare const flatMapEffect: {\n    <B, C, E3, R3>(f: (b: B) => Effect.Effect<C, E3, R3>): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;\n    <A, E, R, B, E2, R2, C, E3, R3>(push: Push<A, E, R, B, E2, R2>, f: (b: B) => Effect.Effect<C, E3, R3>): Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;\n};"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Push/Push.ts",
        "start": {
          "line": 1548,
          "column": 14
        },
        "end": {
          "line": 1577,
          "column": 3
        }
      },
      {
        "file": "packages/fx/src/Push/Push.ts",
        "start": {
          "line": 1549,
          "column": 3
        },
        "end": {
          "line": 1553,
          "column": 57
        }
      },
      {
        "file": "packages/fx/src/Push/Push.ts",
        "start": {
          "line": 1554,
          "column": 3
        },
        "end": {
          "line": 1557,
          "column": 55
        }
      }
    ],
    "aliases": [
      "@typed/fx#Push.flatMapEffect"
    ],
    "isAlias": false,
    "static": false
  },
  "declaration": {
    "declarationKey": "declaration:472bc1a9fa8827f167385244",
    "name": "flatMapEffect",
    "family": "variable",
    "facets": [
      {
        "family": "variable",
        "syntaxKind": "VariableDeclaration",
        "signatures": [
          "export declare const flatMapEffect: {\n    <B, C, E3, R3>(f: (b: B) => Effect.Effect<C, E3, R3>): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;\n    <A, E, R, B, E2, R2, C, E3, R3>(push: Push<A, E, R, B, E2, R2>, f: (b: B) => Effect.Effect<C, E3, R3>): Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;\n};"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Push/Push.ts",
            "start": {
              "line": 1548,
              "column": 14
            },
            "end": {
              "line": 1577,
              "column": 3
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "call-signature",
        "syntaxKind": "CallSignature",
        "signatures": [
          "<B, C, E3, R3>(f: (b: B) => Effect.Effect<C, E3, R3>): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;",
          "<A, E, R, B, E2, R2, C, E3, R3>(push: Push<A, E, R, B, E2, R2>, f: (b: B) => Effect.Effect<C, E3, R3>): Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;"
        ],
        "typeParameters": [
          "B",
          "C",
          "E3",
          "R3",
          "A",
          "E",
          "R",
          "E2",
          "R2"
        ],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Push/Push.ts",
            "start": {
              "line": 1549,
              "column": 3
            },
            "end": {
              "line": 1553,
              "column": 57
            }
          },
          {
            "file": "packages/fx/src/Push/Push.ts",
            "start": {
              "line": 1554,
              "column": 3
            },
            "end": {
              "line": 1557,
              "column": 55
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare const flatMapEffect: {\n    <B, C, E3, R3>(f: (b: B) => Effect.Effect<C, E3, R3>): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;\n    <A, E, R, B, E2, R2, C, E3, R3>(push: Push<A, E, R, B, E2, R2>, f: (b: B) => Effect.Effect<C, E3, R3>): Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;\n};"
    ],
    "typeParameters": [
      "B",
      "C",
      "E3",
      "R3",
      "A",
      "E",
      "R",
      "E2",
      "R2"
    ],
    "summary": "Transforms every output value into an Effect and merges their results concurrently.\n\nOne Effect starts per outer value and can emit one result. All successful\nresults are emitted, but concurrent completion order may differ from input\norder. The input side is unchanged.",
    "sections": {
      "Why": "This runs independent Effect work concurrently without manually lifting each\nEffect into Fx.",
      "Ownership and lifetime": "Active Effects are fibers owned by the output Scope. Completion waits for all\nof them; interruption stops them and runs their finalizers. `E3` and `R3` join\nthe output failure and service channels."
    },
    "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 finalized: Array<number> = []\nconst push = Push.make(\n  Sink.make(() => Effect.void, (_: string) => Effect.void),\n  Fx.fromIterable([1, 2])\n)\nconst loaded = Push.flatMapEffect(push, (id) =>\n  Effect.sleep(id === 1 ? \"20 millis\" : \"1 millis\").pipe(\n    Effect.as(id),\n    Effect.ensuring(Effect.sync(() => finalized.push(id)))\n  )\n)\nconst program = Fx.collectAll(loaded).pipe(\n  Effect.map((values) => ({ values, finalized })),\n  Effect.scoped\n)\n// Effect.runPromise(program) => { values: [2, 1], finalized: [2, 1] }"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Push/Push.ts",
        "start": {
          "line": 1548,
          "column": 14
        },
        "end": {
          "line": 1577,
          "column": 3
        }
      },
      {
        "file": "packages/fx/src/Push/Push.ts",
        "start": {
          "line": 1549,
          "column": 3
        },
        "end": {
          "line": 1553,
          "column": 57
        }
      },
      {
        "file": "packages/fx/src/Push/Push.ts",
        "start": {
          "line": 1554,
          "column": 3
        },
        "end": {
          "line": 1557,
          "column": 55
        }
      }
    ],
    "since": "1.0.0",
    "category": "Concurrent output work"
  }
}
