{
  "id": "@typed/fx#Sink.Sink.WithState",
  "canonicalId": "@typed/fx/Sink#Sink.WithState",
  "symbol": {
    "id": "@typed/fx#Sink.Sink.WithState",
    "packageName": "@typed/fx",
    "moduleName": ".",
    "exportName": "Sink.Sink.WithState",
    "kind": "interface",
    "signatures": [
      "interface WithState<A, E, R, B> extends WithEarlyExit<A, E, R> {\n    readonly state: Ref<B>;\n}"
    ],
    "summary": "An early-exit sink with a mutable Effect `Ref` for consumer-local state.",
    "sections": {
      "Why": "Stateful consumers can accumulate values without moving that state into the producer.",
      "Ownership and lifetime": "The surrounding `withState` invocation creates and owns the Ref. It remains reachable only for\nthat invocation; callback ordering determines the order of state updates.",
      "Property: state": "Mutable state created for the current consumer invocation.",
      "Property: state: Why": "Stateful callback logic can use Effect's atomic Ref operations directly.",
      "Property: state: Ownership and lifetime": "`withState` creates this Ref for one execution; it is not shared with later executions."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Ref } from \"effect\"\nimport type * as Sink from \"@typed/fx/Sink\"\nconst increment = (sink: Sink.Sink.WithState<number, never, never, number>) =>\n  Ref.update(sink.state, (n) => n + 1)"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/Sink/Sink.ts",
      "line": 379
    },
    "since": "1.0.0",
    "category": "Stateful delivery"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx#Sink.Sink.WithState",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.13",
    "moduleName": ".",
    "consumerSpecifier": "@typed/fx",
    "exportName": "Sink",
    "qualifiedName": "Sink.Sink.WithState",
    "declarationKey": "declaration:cc97fb68e6a51022024921fe",
    "family": "interface",
    "signatures": [
      "interface WithState<A, E, R, B> extends WithEarlyExit<A, E, R> {\n    readonly state: Ref<B>;\n}"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Sink/Sink.ts",
        "start": {
          "line": 379,
          "column": 3
        },
        "end": {
          "line": 394,
          "column": 4
        }
      },
      {
        "file": "packages/fx/src/Sink/Sink.ts",
        "start": {
          "line": 393,
          "column": 5
        },
        "end": {
          "line": 393,
          "column": 28
        }
      }
    ],
    "aliases": [
      "@typed/fx/Sink#Sink.WithState"
    ],
    "isAlias": true,
    "parentId": "@typed/fx#Sink.Sink",
    "static": false,
    "importedFrom": "declaration:cc97fb68e6a51022024921fe"
  },
  "declaration": {
    "declarationKey": "declaration:cc97fb68e6a51022024921fe",
    "name": "WithState",
    "family": "interface",
    "facets": [
      {
        "family": "interface",
        "syntaxKind": "InterfaceDeclaration",
        "signatures": [
          "interface WithState<A, E, R, B> extends WithEarlyExit<A, E, R> {\n    readonly state: Ref<B>;\n}"
        ],
        "typeParameters": [
          "A",
          "E",
          "R",
          "B"
        ],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Sink/Sink.ts",
            "start": {
              "line": 379,
              "column": 3
            },
            "end": {
              "line": 394,
              "column": 4
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "property",
        "syntaxKind": "PropertySignature",
        "signatures": [
          "readonly state: Ref<B>;"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Sink/Sink.ts",
            "start": {
              "line": 393,
              "column": 5
            },
            "end": {
              "line": 393,
              "column": 28
            }
          }
        ],
        "static": false,
        "readonly": true,
        "optional": false
      }
    ],
    "signatures": [
      "interface WithState<A, E, R, B> extends WithEarlyExit<A, E, R> {\n    readonly state: Ref<B>;\n}"
    ],
    "typeParameters": [
      "A",
      "E",
      "R",
      "B"
    ],
    "summary": "An early-exit sink with a mutable Effect `Ref` for consumer-local state.",
    "sections": {
      "Why": "Stateful consumers can accumulate values without moving that state into the producer.",
      "Ownership and lifetime": "The surrounding `withState` invocation creates and owns the Ref. It remains reachable only for\nthat invocation; callback ordering determines the order of state updates.",
      "Property: state": "Mutable state created for the current consumer invocation.",
      "Property: state: Why": "Stateful callback logic can use Effect's atomic Ref operations directly.",
      "Property: state: Ownership and lifetime": "`withState` creates this Ref for one execution; it is not shared with later executions."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Ref } from \"effect\"\nimport type * as Sink from \"@typed/fx/Sink\"\nconst increment = (sink: Sink.Sink.WithState<number, never, never, number>) =>\n  Ref.update(sink.state, (n) => n + 1)"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Sink/Sink.ts",
        "start": {
          "line": 379,
          "column": 3
        },
        "end": {
          "line": 394,
          "column": 4
        }
      },
      {
        "file": "packages/fx/src/Sink/Sink.ts",
        "start": {
          "line": 393,
          "column": 5
        },
        "end": {
          "line": 393,
          "column": 28
        }
      }
    ],
    "since": "1.0.0",
    "category": "Stateful delivery"
  }
}
