{
  "id": "@typed/fx/Fx#provide",
  "canonicalId": "@typed/fx/Fx#provide",
  "symbol": {
    "id": "@typed/fx/Fx#provide",
    "packageName": "@typed/fx",
    "moduleName": "Fx",
    "exportName": "provide",
    "kind": "constant",
    "signatures": [
      "export declare const provide: {\n    <R2, E2 = never, R3 = never>(layer: Layer.Layer<R2, E2, R3>): <A, E, R>(fx: Fx<A, E, R>) => Fx<A, E | E2, Exclude<R, R2> | R3>;\n    <A, E, R, R2, E2 = never, R3 = never>(fx: Fx<A, E, R>, layer: Layer.Layer<R2, E2, R3>): Fx<A, E | E2, Exclude<R, R2> | R3>;\n};"
    ],
    "summary": "Builds a Layer for each subscription and provides it to the entire Fx run.",
    "sections": {
      "Why": "Fx preserves Effect service requirements in `R`; providing a Layer closes\nthose requirements while retaining acquisition failures and dependencies in\nthe resulting type.",
      "Ownership and lifetime": "Each subscription creates a private Scope and builds the Layer inside it\nbefore the source starts. A build failure is sent to the sink and the source\nnever runs. Otherwise the built Context is available to every source Effect,\nand the Scope closes with the source's success, failure, defect, or\ninterruption. Provided services are removed from `R`; Layer dependencies and\nerrors are added."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Context, Effect, Layer } from \"effect\"\nimport { provide } from \"@typed/fx/Fx\"\nimport { fromEffect } from \"@typed/fx/Fx\"\n\nclass Config extends Context.Service<Config, { readonly url: string }>()(\"Config\") {}\nconst request = fromEffect(Effect.map(Config, ({ url }) => url))\nconst runnable = provide(request, Layer.succeed(Config, { url: \"/api\" }))"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/Fx/combinators/provide.ts",
      "line": 45
    },
    "since": "1.0.0",
    "category": "Providing services"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx/Fx#provide",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.13",
    "moduleName": "Fx",
    "consumerSpecifier": "@typed/fx/Fx",
    "exportName": "provide",
    "qualifiedName": "provide",
    "declarationKey": "declaration:d3985f1937972de352cd654d",
    "family": "variable",
    "signatures": [
      "export declare const provide: {\n    <R2, E2 = never, R3 = never>(layer: Layer.Layer<R2, E2, R3>): <A, E, R>(fx: Fx<A, E, R>) => Fx<A, E | E2, Exclude<R, R2> | R3>;\n    <A, E, R, R2, E2 = never, R3 = never>(fx: Fx<A, E, R>, layer: Layer.Layer<R2, E2, R3>): Fx<A, E | E2, Exclude<R, R2> | R3>;\n};"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/provide.ts",
        "start": {
          "line": 45,
          "column": 14
        },
        "end": {
          "line": 76,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/provide.ts",
        "start": {
          "line": 46,
          "column": 3
        },
        "end": {
          "line": 48,
          "column": 71
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/provide.ts",
        "start": {
          "line": 50,
          "column": 3
        },
        "end": {
          "line": 53,
          "column": 41
        }
      }
    ],
    "aliases": [
      "@typed/fx#Fx.provide"
    ],
    "isAlias": false,
    "static": false
  },
  "declaration": {
    "declarationKey": "declaration:d3985f1937972de352cd654d",
    "name": "provide",
    "family": "variable",
    "facets": [
      {
        "family": "variable",
        "syntaxKind": "VariableDeclaration",
        "signatures": [
          "export declare const provide: {\n    <R2, E2 = never, R3 = never>(layer: Layer.Layer<R2, E2, R3>): <A, E, R>(fx: Fx<A, E, R>) => Fx<A, E | E2, Exclude<R, R2> | R3>;\n    <A, E, R, R2, E2 = never, R3 = never>(fx: Fx<A, E, R>, layer: Layer.Layer<R2, E2, R3>): Fx<A, E | E2, Exclude<R, R2> | R3>;\n};"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/provide.ts",
            "start": {
              "line": 45,
              "column": 14
            },
            "end": {
              "line": 76,
              "column": 2
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "call-signature",
        "syntaxKind": "CallSignature",
        "signatures": [
          "<R2, E2 = never, R3 = never>(layer: Layer.Layer<R2, E2, R3>): <A, E, R>(fx: Fx<A, E, R>) => Fx<A, E | E2, Exclude<R, R2> | R3>;",
          "<A, E, R, R2, E2 = never, R3 = never>(fx: Fx<A, E, R>, layer: Layer.Layer<R2, E2, R3>): Fx<A, E | E2, Exclude<R, R2> | R3>;"
        ],
        "typeParameters": [
          "R2",
          "E2 = never",
          "R3 = never",
          "A",
          "E",
          "R"
        ],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/provide.ts",
            "start": {
              "line": 46,
              "column": 3
            },
            "end": {
              "line": 48,
              "column": 71
            }
          },
          {
            "file": "packages/fx/src/Fx/combinators/provide.ts",
            "start": {
              "line": 50,
              "column": 3
            },
            "end": {
              "line": 53,
              "column": 41
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare const provide: {\n    <R2, E2 = never, R3 = never>(layer: Layer.Layer<R2, E2, R3>): <A, E, R>(fx: Fx<A, E, R>) => Fx<A, E | E2, Exclude<R, R2> | R3>;\n    <A, E, R, R2, E2 = never, R3 = never>(fx: Fx<A, E, R>, layer: Layer.Layer<R2, E2, R3>): Fx<A, E | E2, Exclude<R, R2> | R3>;\n};"
    ],
    "typeParameters": [
      "R2",
      "E2 = never",
      "R3 = never",
      "A",
      "E",
      "R"
    ],
    "summary": "Builds a Layer for each subscription and provides it to the entire Fx run.",
    "sections": {
      "Why": "Fx preserves Effect service requirements in `R`; providing a Layer closes\nthose requirements while retaining acquisition failures and dependencies in\nthe resulting type.",
      "Ownership and lifetime": "Each subscription creates a private Scope and builds the Layer inside it\nbefore the source starts. A build failure is sent to the sink and the source\nnever runs. Otherwise the built Context is available to every source Effect,\nand the Scope closes with the source's success, failure, defect, or\ninterruption. Provided services are removed from `R`; Layer dependencies and\nerrors are added."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Context, Effect, Layer } from \"effect\"\nimport { provide } from \"@typed/fx/Fx\"\nimport { fromEffect } from \"@typed/fx/Fx\"\n\nclass Config extends Context.Service<Config, { readonly url: string }>()(\"Config\") {}\nconst request = fromEffect(Effect.map(Config, ({ url }) => url))\nconst runnable = provide(request, Layer.succeed(Config, { url: \"/api\" }))"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/provide.ts",
        "start": {
          "line": 45,
          "column": 14
        },
        "end": {
          "line": 76,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/provide.ts",
        "start": {
          "line": 46,
          "column": 3
        },
        "end": {
          "line": 48,
          "column": 71
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/provide.ts",
        "start": {
          "line": 50,
          "column": 3
        },
        "end": {
          "line": 53,
          "column": 41
        }
      }
    ],
    "since": "1.0.0",
    "category": "Providing services"
  }
}
