{
  "id": "@typed/fx#Sink.filter",
  "canonicalId": "@typed/fx/Sink#filter",
  "symbol": {
    "id": "@typed/fx#Sink.filter",
    "packageName": "@typed/fx",
    "moduleName": ".",
    "exportName": "Sink.filter",
    "kind": "function",
    "signatures": [
      "export declare function filter<A, E, R>(sink: Sink<A, E, R>, f: (a: A) => boolean): Sink<A, E, R>;"
    ],
    "summary": "Filters values before they reach the sink using a predicate function.",
    "sections": {
      "Why": "Predicate filtering narrows consumer traffic without changing the producer.",
      "Ownership and lifetime": "The predicate runs synchronously in arrival order. Matching values invoke the wrapped sink once;\nnon-matches invoke it zero times. The adapter acquires no resources."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport * as Sink from \"@typed/fx/Sink\"\nimport { Fx } from \"@typed/fx\"\n\nconst program = Effect.gen(function* () {\n  const sink = Sink.make(\n    (cause) => Effect.void,\n    (value: number) => Effect.sync(() => console.log(\"Positive:\", value))\n  )\n\n  // Only pass through positive numbers\n  const filtered = Sink.filter(sink, (n) => n > 0)\n\n  yield* Fx.fromIterable([-2, -1, 0, 1, 2]).run(filtered)\n  // Output: \"Positive: 1\", \"Positive: 2\"\n})"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/Sink/combinators.ts",
      "line": 296
    },
    "since": "1.0.0",
    "category": "Selecting inputs"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx#Sink.filter",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.13",
    "moduleName": ".",
    "consumerSpecifier": "@typed/fx",
    "exportName": "Sink",
    "qualifiedName": "Sink.filter",
    "declarationKey": "declaration:4552fceaaaf24fac1781e8f2",
    "family": "function",
    "signatures": [
      "export declare function filter<A, E, R>(sink: Sink<A, E, R>, f: (a: A) => boolean): Sink<A, E, R>;"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Sink/combinators.ts",
        "start": {
          "line": 296,
          "column": 1
        },
        "end": {
          "line": 298,
          "column": 2
        }
      }
    ],
    "aliases": [
      "@typed/fx/Sink#filter"
    ],
    "isAlias": true,
    "parentId": "@typed/fx#Sink",
    "static": false,
    "importedFrom": "declaration:4552fceaaaf24fac1781e8f2"
  },
  "declaration": {
    "declarationKey": "declaration:4552fceaaaf24fac1781e8f2",
    "name": "filter",
    "family": "function",
    "facets": [
      {
        "family": "function",
        "syntaxKind": "FunctionDeclaration",
        "signatures": [
          "export declare function filter<A, E, R>(sink: Sink<A, E, R>, f: (a: A) => boolean): Sink<A, E, R>;"
        ],
        "typeParameters": [
          "A",
          "E",
          "R"
        ],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Sink/combinators.ts",
            "start": {
              "line": 296,
              "column": 1
            },
            "end": {
              "line": 298,
              "column": 2
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare function filter<A, E, R>(sink: Sink<A, E, R>, f: (a: A) => boolean): Sink<A, E, R>;"
    ],
    "typeParameters": [
      "A",
      "E",
      "R"
    ],
    "summary": "Filters values before they reach the sink using a predicate function.",
    "sections": {
      "Why": "Predicate filtering narrows consumer traffic without changing the producer.",
      "Ownership and lifetime": "The predicate runs synchronously in arrival order. Matching values invoke the wrapped sink once;\nnon-matches invoke it zero times. The adapter acquires no resources."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport * as Sink from \"@typed/fx/Sink\"\nimport { Fx } from \"@typed/fx\"\n\nconst program = Effect.gen(function* () {\n  const sink = Sink.make(\n    (cause) => Effect.void,\n    (value: number) => Effect.sync(() => console.log(\"Positive:\", value))\n  )\n\n  // Only pass through positive numbers\n  const filtered = Sink.filter(sink, (n) => n > 0)\n\n  yield* Fx.fromIterable([-2, -1, 0, 1, 2]).run(filtered)\n  // Output: \"Positive: 1\", \"Positive: 2\"\n})"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Sink/combinators.ts",
        "start": {
          "line": 296,
          "column": 1
        },
        "end": {
          "line": 298,
          "column": 2
        }
      }
    ],
    "since": "1.0.0",
    "category": "Selecting inputs"
  }
}
