{
  "id": "@typed/fx/Sink#withEarlyExit",
  "canonicalId": "@typed/fx/Sink#withEarlyExit",
  "symbol": {
    "id": "@typed/fx/Sink#withEarlyExit",
    "packageName": "@typed/fx",
    "moduleName": "Sink",
    "exportName": "withEarlyExit",
    "kind": "function",
    "signatures": [
      "export declare function withEarlyExit<A, E, R, R2>(sink: Sink<A, E, R>, f: (sink: Sink.WithEarlyExit<A, E, R>, params: {\n    signal: AbortSignal;\n    scheduler: Scheduler;\n}) => Effect.Effect<unknown, never, R2>): Effect.Effect<void, never, R | R2>;"
    ],
    "summary": "Runs a producer-style callback with a sink that can complete the surrounding Effect early.",
    "sections": {
      "Why": "Consumer combinators can stop upstream work after a bound or predicate without representing\nnormal completion as failure.",
      "Ownership and lifetime": "The returned Effect owns the callback fiber. Completion, `earlyExit`, or interruption aborts that\nfiber through the supplied signal; deliveries after exit are ignored. The callback's services are\ncombined with the wrapped sink's services."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport * as Sink from \"@typed/fx/Sink\"\nconst base = Sink.make(Effect.logError, Effect.log)\nconst program = Sink.withEarlyExit(base, (sink) => sink.onSuccess(\"done\").pipe(Effect.andThen(sink.earlyExit)))"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/Sink/combinators.ts",
      "line": 324
    },
    "since": "1.0.0",
    "category": "Stopping delivery"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx/Sink#withEarlyExit",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.13",
    "moduleName": "Sink",
    "consumerSpecifier": "@typed/fx/Sink",
    "exportName": "withEarlyExit",
    "qualifiedName": "withEarlyExit",
    "declarationKey": "declaration:ba4e1abc8384ad0bbbbed4ad",
    "family": "function",
    "signatures": [
      "export declare function withEarlyExit<A, E, R, R2>(sink: Sink<A, E, R>, f: (sink: Sink.WithEarlyExit<A, E, R>, params: {\n    signal: AbortSignal;\n    scheduler: Scheduler;\n}) => Effect.Effect<unknown, never, R2>): Effect.Effect<void, never, R | R2>;"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Sink/combinators.ts",
        "start": {
          "line": 324,
          "column": 1
        },
        "end": {
          "line": 369,
          "column": 2
        }
      }
    ],
    "aliases": [
      "@typed/fx#Sink.withEarlyExit"
    ],
    "isAlias": false,
    "static": false
  },
  "declaration": {
    "declarationKey": "declaration:ba4e1abc8384ad0bbbbed4ad",
    "name": "withEarlyExit",
    "family": "function",
    "facets": [
      {
        "family": "function",
        "syntaxKind": "FunctionDeclaration",
        "signatures": [
          "export declare function withEarlyExit<A, E, R, R2>(sink: Sink<A, E, R>, f: (sink: Sink.WithEarlyExit<A, E, R>, params: {\n    signal: AbortSignal;\n    scheduler: Scheduler;\n}) => Effect.Effect<unknown, never, R2>): Effect.Effect<void, never, R | R2>;"
        ],
        "typeParameters": [
          "A",
          "E",
          "R",
          "R2"
        ],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Sink/combinators.ts",
            "start": {
              "line": 324,
              "column": 1
            },
            "end": {
              "line": 369,
              "column": 2
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare function withEarlyExit<A, E, R, R2>(sink: Sink<A, E, R>, f: (sink: Sink.WithEarlyExit<A, E, R>, params: {\n    signal: AbortSignal;\n    scheduler: Scheduler;\n}) => Effect.Effect<unknown, never, R2>): Effect.Effect<void, never, R | R2>;"
    ],
    "typeParameters": [
      "A",
      "E",
      "R",
      "R2"
    ],
    "summary": "Runs a producer-style callback with a sink that can complete the surrounding Effect early.",
    "sections": {
      "Why": "Consumer combinators can stop upstream work after a bound or predicate without representing\nnormal completion as failure.",
      "Ownership and lifetime": "The returned Effect owns the callback fiber. Completion, `earlyExit`, or interruption aborts that\nfiber through the supplied signal; deliveries after exit are ignored. The callback's services are\ncombined with the wrapped sink's services."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport * as Sink from \"@typed/fx/Sink\"\nconst base = Sink.make(Effect.logError, Effect.log)\nconst program = Sink.withEarlyExit(base, (sink) => sink.onSuccess(\"done\").pipe(Effect.andThen(sink.earlyExit)))"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Sink/combinators.ts",
        "start": {
          "line": 324,
          "column": 1
        },
        "end": {
          "line": 369,
          "column": 2
        }
      }
    ],
    "since": "1.0.0",
    "category": "Stopping delivery"
  }
}
