{
  "id": "@typed/fx#Fx.flatMap",
  "canonicalId": "@typed/fx/Fx#flatMap",
  "symbol": {
    "id": "@typed/fx#Fx.flatMap",
    "packageName": "@typed/fx",
    "moduleName": ".",
    "exportName": "Fx.flatMap",
    "kind": "constant",
    "signatures": [
      "export declare const flatMap: FlatMapLike;"
    ],
    "summary": "Maps each source value to an inner Fx and merges every inner concurrently.",
    "sections": {
      "Why": "`flatMap` is the unconstrained merge policy for independent pushed work. It\npreserves push-based production instead of collecting an inner Fx before the\nnext source value can be handled.",
      "Concurrency, ordering, and cardinality": "Every source value creates exactly one inner Fx with no concurrency limit.\nEach inner retains its own emission order, but values from different inners\ninterleave according to arrival time. There is no output buffer or global\nordering guarantee.",
      "Ownership and lifetime": "Source and inner failures are forwarded; their required services are unioned.\nA `FiberSet` in the required `Scope` owns all inner fibers. Source completion\nwaits for the set to empty. Interrupting observation closes the Scope and\ninterrupts every active inner, running each inner Scope's finalizers."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Fx } from \"@typed/fx\"\nimport { Effect } from \"effect\"\n\nconst rows = Fx.flatMap(Fx.fromIterable([\n  { id: \"slow\", wait: \"20 millis\" as const },\n  { id: \"fast\", wait: \"1 millis\" as const }\n]), ({ id, wait }) => Fx.at(id, wait))\n\nEffect.runPromise(Effect.scoped(Fx.collectAll(rows))).then(console.log)\n// [\"fast\", \"slow\"]: inners overlap and results arrive by production time"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/Fx/combinators/flatMap.ts",
      "line": 83
    },
    "since": "1.0.0",
    "category": "Concurrent work"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx#Fx.flatMap",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.13",
    "moduleName": ".",
    "consumerSpecifier": "@typed/fx",
    "exportName": "Fx",
    "qualifiedName": "Fx.flatMap",
    "declarationKey": "declaration:0a1a27c6448a1784181fe558",
    "family": "variable",
    "signatures": [
      "export declare const flatMap: FlatMapLike;"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/flatMap.ts",
        "start": {
          "line": 83,
          "column": 14
        },
        "end": {
          "line": 96,
          "column": 2
        }
      }
    ],
    "aliases": [
      "@typed/fx/Fx#flatMap"
    ],
    "isAlias": true,
    "parentId": "@typed/fx#Fx",
    "static": false,
    "importedFrom": "declaration:0a1a27c6448a1784181fe558"
  },
  "declaration": {
    "declarationKey": "declaration:0a1a27c6448a1784181fe558",
    "name": "flatMap",
    "family": "variable",
    "facets": [
      {
        "family": "variable",
        "syntaxKind": "VariableDeclaration",
        "signatures": [
          "export declare const flatMap: FlatMapLike;"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/flatMap.ts",
            "start": {
              "line": 83,
              "column": 14
            },
            "end": {
              "line": 96,
              "column": 2
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare const flatMap: FlatMapLike;"
    ],
    "typeParameters": [],
    "summary": "Maps each source value to an inner Fx and merges every inner concurrently.",
    "sections": {
      "Why": "`flatMap` is the unconstrained merge policy for independent pushed work. It\npreserves push-based production instead of collecting an inner Fx before the\nnext source value can be handled.",
      "Concurrency, ordering, and cardinality": "Every source value creates exactly one inner Fx with no concurrency limit.\nEach inner retains its own emission order, but values from different inners\ninterleave according to arrival time. There is no output buffer or global\nordering guarantee.",
      "Ownership and lifetime": "Source and inner failures are forwarded; their required services are unioned.\nA `FiberSet` in the required `Scope` owns all inner fibers. Source completion\nwaits for the set to empty. Interrupting observation closes the Scope and\ninterrupts every active inner, running each inner Scope's finalizers."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Fx } from \"@typed/fx\"\nimport { Effect } from \"effect\"\n\nconst rows = Fx.flatMap(Fx.fromIterable([\n  { id: \"slow\", wait: \"20 millis\" as const },\n  { id: \"fast\", wait: \"1 millis\" as const }\n]), ({ id, wait }) => Fx.at(id, wait))\n\nEffect.runPromise(Effect.scoped(Fx.collectAll(rows))).then(console.log)\n// [\"fast\", \"slow\"]: inners overlap and results arrive by production time"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/flatMap.ts",
        "start": {
          "line": 83,
          "column": 14
        },
        "end": {
          "line": 96,
          "column": 2
        }
      }
    ],
    "since": "1.0.0",
    "category": "Concurrent work"
  }
}
