{
  "id": "@typed/fx#RefSubject.Computed",
  "canonicalId": "@typed/fx/RefSubject#Computed",
  "symbol": {
    "id": "@typed/fx#RefSubject.Computed",
    "packageName": "@typed/fx",
    "moduleName": ".",
    "exportName": "RefSubject.Computed",
    "kind": "interface",
    "signatures": [
      "export interface Computed<out A, out E = never, out R = never> extends Versioned.Versioned<R, E, A, E, R | Scope.Scope, A, E, R> {\n    readonly [ComputedTypeId]: ComputedTypeId;\n}",
      "export declare namespace Computed {\n    type Any = Computed<any, any, any> | Computed<never, any, any> | Computed<any, never, any> | Computed<never, never, any>;\n}"
    ],
    "summary": "A `Computed` is a read-only view of a value that can change over time.\nIt is an `Fx` that emits the current value and subsequent updates.\nIt is also an `Effect` that samples the current value.",
    "sections": {
      "Why": "Represents derived state as both an Effectful current read and an Fx of subsequent versions,\nwithout granting write access.",
      "Ownership and lifetime": "Computed is a contract and performs no acquisition. Implementations retain the errors, services,\ninterruption, and Scope requirements expressed by its members.",
      "Property: [[computed:[ComputedTypeId]]]": "Carries the runtime marker recognized by `isComputed`.",
      "Property: [[computed:[ComputedTypeId]]]: Why": "Marks the value as Computed for runtime guards and composition without granting writable\nRefSubject operations.",
      "Property: [[computed:[ComputedTypeId]]]: Ownership and lifetime": "This declaration performs no acquisition and retains no resources. Implementations preserve\nsource errors, services, and lifetime."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport { RefSubject } from \"@typed/fx\"\nimport { Fx } from \"@typed/fx\"\n\n// Create a RefSubject and derive a Computed from it\nconst program = Effect.gen(function* () {\n  const count = yield* RefSubject.make(0)\n\n  // Create a computed that doubles the count\n  const doubled = RefSubject.map(count, (n) => n * 2)\n\n  // Sample the computed value\n  const value = yield* doubled\n  console.log(value) // 0\n\n  // Update the source\n  yield* RefSubject.set(count, 5)\n\n  // The computed automatically reflects the change\n  const newValue = yield* doubled\n  console.log(newValue) // 10\n})"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/RefSubject/RefSubject.ts",
      "line": 194
    },
    "since": "1.0.0",
    "category": "Read-only state"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx#RefSubject.Computed",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.7",
    "moduleName": ".",
    "consumerSpecifier": "@typed/fx",
    "exportName": "RefSubject",
    "qualifiedName": "RefSubject.Computed",
    "declarationKey": "declaration:8d44a4d2178a87e5412653fa",
    "family": "interface",
    "signatures": [
      "export interface Computed<out A, out E = never, out R = never> extends Versioned.Versioned<R, E, A, E, R | Scope.Scope, A, E, R> {\n    readonly [ComputedTypeId]: ComputedTypeId;\n}",
      "export declare namespace Computed {\n    type Any = Computed<any, any, any> | Computed<never, any, any> | Computed<any, never, any> | Computed<never, never, any>;\n}"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/RefSubject/RefSubject.ts",
        "start": {
          "line": 194,
          "column": 1
        },
        "end": {
          "line": 222,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/RefSubject/RefSubject.ts",
        "start": {
          "line": 241,
          "column": 1
        },
        "end": {
          "line": 263,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/RefSubject/RefSubject.ts",
        "start": {
          "line": 221,
          "column": 3
        },
        "end": {
          "line": 221,
          "column": 45
        }
      }
    ],
    "aliases": [
      "@typed/fx/RefSubject#Computed"
    ],
    "isAlias": true,
    "parentId": "@typed/fx#RefSubject",
    "static": false,
    "importedFrom": "declaration:8d44a4d2178a87e5412653fa"
  },
  "declaration": {
    "declarationKey": "declaration:8d44a4d2178a87e5412653fa",
    "name": "Computed",
    "family": "interface",
    "facets": [
      {
        "family": "interface",
        "syntaxKind": "InterfaceDeclaration",
        "signatures": [
          "export interface Computed<out A, out E = never, out R = never> extends Versioned.Versioned<R, E, A, E, R | Scope.Scope, A, E, R> {\n    readonly [ComputedTypeId]: ComputedTypeId;\n}"
        ],
        "typeParameters": [
          "out A",
          "out E = never",
          "out R = never"
        ],
        "sourceSpans": [
          {
            "file": "packages/fx/src/RefSubject/RefSubject.ts",
            "start": {
              "line": 194,
              "column": 1
            },
            "end": {
              "line": 222,
              "column": 2
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "namespace",
        "syntaxKind": "ModuleDeclaration",
        "signatures": [
          "export declare namespace Computed {\n    type Any = Computed<any, any, any> | Computed<never, any, any> | Computed<any, never, any> | Computed<never, never, any>;\n}"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/fx/src/RefSubject/RefSubject.ts",
            "start": {
              "line": 241,
              "column": 1
            },
            "end": {
              "line": 263,
              "column": 2
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "property",
        "syntaxKind": "PropertySignature",
        "signatures": [
          "readonly [ComputedTypeId]: ComputedTypeId;"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/fx/src/RefSubject/RefSubject.ts",
            "start": {
              "line": 221,
              "column": 3
            },
            "end": {
              "line": 221,
              "column": 45
            }
          }
        ],
        "static": false,
        "readonly": true,
        "optional": false
      }
    ],
    "signatures": [
      "export interface Computed<out A, out E = never, out R = never> extends Versioned.Versioned<R, E, A, E, R | Scope.Scope, A, E, R> {\n    readonly [ComputedTypeId]: ComputedTypeId;\n}",
      "export declare namespace Computed {\n    type Any = Computed<any, any, any> | Computed<never, any, any> | Computed<any, never, any> | Computed<never, never, any>;\n}"
    ],
    "typeParameters": [
      "out A",
      "out E = never",
      "out R = never"
    ],
    "summary": "A `Computed` is a read-only view of a value that can change over time.\nIt is an `Fx` that emits the current value and subsequent updates.\nIt is also an `Effect` that samples the current value.",
    "sections": {
      "Why": "Represents derived state as both an Effectful current read and an Fx of subsequent versions,\nwithout granting write access.",
      "Ownership and lifetime": "Computed is a contract and performs no acquisition. Implementations retain the errors, services,\ninterruption, and Scope requirements expressed by its members.",
      "Property: [[computed:[ComputedTypeId]]]": "Carries the runtime marker recognized by `isComputed`.",
      "Property: [[computed:[ComputedTypeId]]]: Why": "Marks the value as Computed for runtime guards and composition without granting writable\nRefSubject operations.",
      "Property: [[computed:[ComputedTypeId]]]: Ownership and lifetime": "This declaration performs no acquisition and retains no resources. Implementations preserve\nsource errors, services, and lifetime."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport { RefSubject } from \"@typed/fx\"\nimport { Fx } from \"@typed/fx\"\n\n// Create a RefSubject and derive a Computed from it\nconst program = Effect.gen(function* () {\n  const count = yield* RefSubject.make(0)\n\n  // Create a computed that doubles the count\n  const doubled = RefSubject.map(count, (n) => n * 2)\n\n  // Sample the computed value\n  const value = yield* doubled\n  console.log(value) // 0\n\n  // Update the source\n  yield* RefSubject.set(count, 5)\n\n  // The computed automatically reflects the change\n  const newValue = yield* doubled\n  console.log(newValue) // 10\n})"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/RefSubject/RefSubject.ts",
        "start": {
          "line": 194,
          "column": 1
        },
        "end": {
          "line": 222,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/RefSubject/RefSubject.ts",
        "start": {
          "line": 241,
          "column": 1
        },
        "end": {
          "line": 263,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/RefSubject/RefSubject.ts",
        "start": {
          "line": 221,
          "column": 3
        },
        "end": {
          "line": 221,
          "column": 45
        }
      }
    ],
    "since": "1.0.0",
    "category": "Read-only state"
  }
}
