{
  "id": "@typed/fx/Fx#flatMapConcurrentlyEffect",
  "canonicalId": "@typed/fx/Fx#flatMapConcurrentlyEffect",
  "symbol": {
    "id": "@typed/fx/Fx#flatMapConcurrentlyEffect",
    "packageName": "@typed/fx",
    "moduleName": "Fx",
    "exportName": "flatMapConcurrentlyEffect",
    "kind": "constant",
    "signatures": [
      "export declare const flatMapConcurrentlyEffect: {\n    <A, B, E2, R2>(f: (a: A) => Effect.Effect<B, E2, R2>, concurrency: number): <E, R>(self: Fx<A, E, R>) => Fx<B, E | E2 | Cause.IllegalArgumentError, R | R2 | Scope.Scope>;\n    <A, E, R, B, E2, R2>(self: Fx<A, E, R>, f: (a: A) => Effect.Effect<B, E2, R2>, concurrency: number): Fx<B, E | E2 | Cause.IllegalArgumentError, R | R2 | Scope.Scope>;\n};"
    ],
    "summary": "Maps each element of an Fx to an Effect, running them concurrently with a limit.",
    "sections": {
      "Why": "This Effect-producing bounded merge avoids manual `Fx.fromEffect` conversion\nwhile making the callback's concurrency budget part of the operation.",
      "Concurrency, ordering, and cardinality": "Every source value eventually starts one callback Effect, with no more than\n`concurrency` active at once. Each success emits exactly one value. Waiting\nwork is retained, and results arrive by completion rather than source order.",
      "Ownership and lifetime": "Invalid limits fail with `Cause.IllegalArgumentError`; source and callback\nfailures remain typed and callback services are added to requirements. The\nrequired `Scope` owns waiting and active Effects. Completion drains them;\ninterruption cancels them and runs their finalizers."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Fx } from \"@typed/fx\"\nimport { Effect } from \"effect\"\n\nconst loaded = Fx.flatMapConcurrentlyEffect(\n  Fx.fromIterable([\n    { id: \"one\", wait: \"20 millis\" as const },\n    { id: \"two\", wait: \"20 millis\" as const },\n    { id: \"three\", wait: \"1 millis\" as const }\n  ]),\n  ({ id, wait }) => Effect.as(Effect.sleep(wait), id),\n  2\n)\n\nEffect.runPromise(Effect.scoped(Fx.collectAll(loaded))).then(console.log)\n// \"three\" remains queued until a permit is released"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/Fx/combinators/flatMapConcurrentlyEffect.ts",
      "line": 56
    },
    "since": "1.0.0",
    "category": "Concurrent work"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx/Fx#flatMapConcurrentlyEffect",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.13",
    "moduleName": "Fx",
    "consumerSpecifier": "@typed/fx/Fx",
    "exportName": "flatMapConcurrentlyEffect",
    "qualifiedName": "flatMapConcurrentlyEffect",
    "declarationKey": "declaration:c637d115fccf57169ce0c701",
    "family": "variable",
    "signatures": [
      "export declare const flatMapConcurrentlyEffect: {\n    <A, B, E2, R2>(f: (a: A) => Effect.Effect<B, E2, R2>, concurrency: number): <E, R>(self: Fx<A, E, R>) => Fx<B, E | E2 | Cause.IllegalArgumentError, R | R2 | Scope.Scope>;\n    <A, E, R, B, E2, R2>(self: Fx<A, E, R>, f: (a: A) => Effect.Effect<B, E2, R2>, concurrency: number): Fx<B, E | E2 | Cause.IllegalArgumentError, R | R2 | Scope.Scope>;\n};"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/flatMapConcurrentlyEffect.ts",
        "start": {
          "line": 56,
          "column": 14
        },
        "end": {
          "line": 75,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/flatMapConcurrentlyEffect.ts",
        "start": {
          "line": 57,
          "column": 3
        },
        "end": {
          "line": 60,
          "column": 100
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/flatMapConcurrentlyEffect.ts",
        "start": {
          "line": 62,
          "column": 3
        },
        "end": {
          "line": 66,
          "column": 71
        }
      }
    ],
    "aliases": [
      "@typed/fx#Fx.flatMapConcurrentlyEffect"
    ],
    "isAlias": false,
    "static": false
  },
  "declaration": {
    "declarationKey": "declaration:c637d115fccf57169ce0c701",
    "name": "flatMapConcurrentlyEffect",
    "family": "variable",
    "facets": [
      {
        "family": "variable",
        "syntaxKind": "VariableDeclaration",
        "signatures": [
          "export declare const flatMapConcurrentlyEffect: {\n    <A, B, E2, R2>(f: (a: A) => Effect.Effect<B, E2, R2>, concurrency: number): <E, R>(self: Fx<A, E, R>) => Fx<B, E | E2 | Cause.IllegalArgumentError, R | R2 | Scope.Scope>;\n    <A, E, R, B, E2, R2>(self: Fx<A, E, R>, f: (a: A) => Effect.Effect<B, E2, R2>, concurrency: number): Fx<B, E | E2 | Cause.IllegalArgumentError, R | R2 | Scope.Scope>;\n};"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/flatMapConcurrentlyEffect.ts",
            "start": {
              "line": 56,
              "column": 14
            },
            "end": {
              "line": 75,
              "column": 2
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "call-signature",
        "syntaxKind": "CallSignature",
        "signatures": [
          "<A, B, E2, R2>(f: (a: A) => Effect.Effect<B, E2, R2>, concurrency: number): <E, R>(self: Fx<A, E, R>) => Fx<B, E | E2 | Cause.IllegalArgumentError, R | R2 | Scope.Scope>;",
          "<A, E, R, B, E2, R2>(self: Fx<A, E, R>, f: (a: A) => Effect.Effect<B, E2, R2>, concurrency: number): Fx<B, E | E2 | Cause.IllegalArgumentError, R | R2 | Scope.Scope>;"
        ],
        "typeParameters": [
          "A",
          "B",
          "E2",
          "R2",
          "E",
          "R"
        ],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/flatMapConcurrentlyEffect.ts",
            "start": {
              "line": 57,
              "column": 3
            },
            "end": {
              "line": 60,
              "column": 100
            }
          },
          {
            "file": "packages/fx/src/Fx/combinators/flatMapConcurrentlyEffect.ts",
            "start": {
              "line": 62,
              "column": 3
            },
            "end": {
              "line": 66,
              "column": 71
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare const flatMapConcurrentlyEffect: {\n    <A, B, E2, R2>(f: (a: A) => Effect.Effect<B, E2, R2>, concurrency: number): <E, R>(self: Fx<A, E, R>) => Fx<B, E | E2 | Cause.IllegalArgumentError, R | R2 | Scope.Scope>;\n    <A, E, R, B, E2, R2>(self: Fx<A, E, R>, f: (a: A) => Effect.Effect<B, E2, R2>, concurrency: number): Fx<B, E | E2 | Cause.IllegalArgumentError, R | R2 | Scope.Scope>;\n};"
    ],
    "typeParameters": [
      "A",
      "B",
      "E2",
      "R2",
      "E",
      "R"
    ],
    "summary": "Maps each element of an Fx to an Effect, running them concurrently with a limit.",
    "sections": {
      "Why": "This Effect-producing bounded merge avoids manual `Fx.fromEffect` conversion\nwhile making the callback's concurrency budget part of the operation.",
      "Concurrency, ordering, and cardinality": "Every source value eventually starts one callback Effect, with no more than\n`concurrency` active at once. Each success emits exactly one value. Waiting\nwork is retained, and results arrive by completion rather than source order.",
      "Ownership and lifetime": "Invalid limits fail with `Cause.IllegalArgumentError`; source and callback\nfailures remain typed and callback services are added to requirements. The\nrequired `Scope` owns waiting and active Effects. Completion drains them;\ninterruption cancels them and runs their finalizers."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Fx } from \"@typed/fx\"\nimport { Effect } from \"effect\"\n\nconst loaded = Fx.flatMapConcurrentlyEffect(\n  Fx.fromIterable([\n    { id: \"one\", wait: \"20 millis\" as const },\n    { id: \"two\", wait: \"20 millis\" as const },\n    { id: \"three\", wait: \"1 millis\" as const }\n  ]),\n  ({ id, wait }) => Effect.as(Effect.sleep(wait), id),\n  2\n)\n\nEffect.runPromise(Effect.scoped(Fx.collectAll(loaded))).then(console.log)\n// \"three\" remains queued until a permit is released"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/flatMapConcurrentlyEffect.ts",
        "start": {
          "line": 56,
          "column": 14
        },
        "end": {
          "line": 75,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/flatMapConcurrentlyEffect.ts",
        "start": {
          "line": 57,
          "column": 3
        },
        "end": {
          "line": 60,
          "column": 100
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/flatMapConcurrentlyEffect.ts",
        "start": {
          "line": 62,
          "column": 3
        },
        "end": {
          "line": 66,
          "column": 71
        }
      }
    ],
    "since": "1.0.0",
    "category": "Concurrent work"
  }
}
