{
  "id": "@typed/fx/RefSubject#modifyEffect",
  "canonicalId": "@typed/fx/RefSubject#modifyEffect",
  "symbol": {
    "id": "@typed/fx/RefSubject#modifyEffect",
    "packageName": "@typed/fx",
    "moduleName": "RefSubject",
    "exportName": "modifyEffect",
    "kind": "constant",
    "signatures": [
      "export declare const modifyEffect: {\n    <A, B, E2, R2>(f: (value: A) => Effect.Effect<readonly [\n        B,\n        A\n    ], E2, R2>): <E, R>(ref: RefSubject<A, E, R>) => Effect.Effect<B, E | E2, R | R2>;\n    <A, E, R, B, E2, R2>(ref: RefSubject<A, E, R>, f: (value: A) => Effect.Effect<readonly [\n        B,\n        A\n    ], E2, R2>): Effect.Effect<B, E | E2, R | R2>;\n};"
    ],
    "summary": "Modifies a `RefSubject` using an `Effect`ful function that returns both a result and a new value.",
    "sections": {
      "Why": "Modifies a `RefSubject` using an `Effect`ful function that returns both a result and a new\nvalue. The transition is serialized at the RefSubject rather than coordinated by callers or UI\ncomponents.",
      "Ownership and lifetime": "Running modify effect performs one serialized subject transition and resolves with its committed\nvalue. It acquires no resource; failures and services remain those of the source ref."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport * as RefSubject from \"@typed/fx/RefSubject\"\n\nconst program = Effect.gen(function* () {\n  const count = yield* RefSubject.make(5)\n\n  // Get the old value and set a new one, returning the old value\n  const oldValue = yield* RefSubject.modifyEffect(count, (value) =>\n    Effect.succeed([value, value + 10] as const)\n  )\n\n  console.log(oldValue) // 5\n  const newValue = yield* count\n  console.log(newValue) // 15\n})"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/RefSubject/RefSubject.ts",
      "line": 2378
    },
    "since": "1.0.0",
    "category": "Transactions"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx/RefSubject#modifyEffect",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.13",
    "moduleName": "RefSubject",
    "consumerSpecifier": "@typed/fx/RefSubject",
    "exportName": "modifyEffect",
    "qualifiedName": "modifyEffect",
    "declarationKey": "declaration:5e00555bd3914262e9976a04",
    "family": "variable",
    "signatures": [
      "export declare const modifyEffect: {\n    <A, B, E2, R2>(f: (value: A) => Effect.Effect<readonly [\n        B,\n        A\n    ], E2, R2>): <E, R>(ref: RefSubject<A, E, R>) => Effect.Effect<B, E | E2, R | R2>;\n    <A, E, R, B, E2, R2>(ref: RefSubject<A, E, R>, f: (value: A) => Effect.Effect<readonly [\n        B,\n        A\n    ], E2, R2>): Effect.Effect<B, E | E2, R | R2>;\n};"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/RefSubject/RefSubject.ts",
        "start": {
          "line": 2378,
          "column": 14
        },
        "end": {
          "line": 2399,
          "column": 3
        }
      },
      {
        "file": "packages/fx/src/RefSubject/RefSubject.ts",
        "start": {
          "line": 2379,
          "column": 3
        },
        "end": {
          "line": 2381,
          "column": 75
        }
      },
      {
        "file": "packages/fx/src/RefSubject/RefSubject.ts",
        "start": {
          "line": 2382,
          "column": 3
        },
        "end": {
          "line": 2385,
          "column": 39
        }
      }
    ],
    "aliases": [
      "@typed/fx#RefSubject.modifyEffect"
    ],
    "isAlias": false,
    "static": false
  },
  "declaration": {
    "declarationKey": "declaration:5e00555bd3914262e9976a04",
    "name": "modifyEffect",
    "family": "variable",
    "facets": [
      {
        "family": "variable",
        "syntaxKind": "VariableDeclaration",
        "signatures": [
          "export declare const modifyEffect: {\n    <A, B, E2, R2>(f: (value: A) => Effect.Effect<readonly [\n        B,\n        A\n    ], E2, R2>): <E, R>(ref: RefSubject<A, E, R>) => Effect.Effect<B, E | E2, R | R2>;\n    <A, E, R, B, E2, R2>(ref: RefSubject<A, E, R>, f: (value: A) => Effect.Effect<readonly [\n        B,\n        A\n    ], E2, R2>): Effect.Effect<B, E | E2, R | R2>;\n};"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/fx/src/RefSubject/RefSubject.ts",
            "start": {
              "line": 2378,
              "column": 14
            },
            "end": {
              "line": 2399,
              "column": 3
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "call-signature",
        "syntaxKind": "CallSignature",
        "signatures": [
          "<A, B, E2, R2>(f: (value: A) => Effect.Effect<readonly [\n    B,\n    A\n], E2, R2>): <E, R>(ref: RefSubject<A, E, R>) => Effect.Effect<B, E | E2, R | R2>;",
          "<A, E, R, B, E2, R2>(ref: RefSubject<A, E, R>, f: (value: A) => Effect.Effect<readonly [\n    B,\n    A\n], E2, R2>): Effect.Effect<B, E | E2, R | R2>;"
        ],
        "typeParameters": [
          "A",
          "B",
          "E2",
          "R2",
          "E",
          "R"
        ],
        "sourceSpans": [
          {
            "file": "packages/fx/src/RefSubject/RefSubject.ts",
            "start": {
              "line": 2379,
              "column": 3
            },
            "end": {
              "line": 2381,
              "column": 75
            }
          },
          {
            "file": "packages/fx/src/RefSubject/RefSubject.ts",
            "start": {
              "line": 2382,
              "column": 3
            },
            "end": {
              "line": 2385,
              "column": 39
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare const modifyEffect: {\n    <A, B, E2, R2>(f: (value: A) => Effect.Effect<readonly [\n        B,\n        A\n    ], E2, R2>): <E, R>(ref: RefSubject<A, E, R>) => Effect.Effect<B, E | E2, R | R2>;\n    <A, E, R, B, E2, R2>(ref: RefSubject<A, E, R>, f: (value: A) => Effect.Effect<readonly [\n        B,\n        A\n    ], E2, R2>): Effect.Effect<B, E | E2, R | R2>;\n};"
    ],
    "typeParameters": [
      "A",
      "B",
      "E2",
      "R2",
      "E",
      "R"
    ],
    "summary": "Modifies a `RefSubject` using an `Effect`ful function that returns both a result and a new value.",
    "sections": {
      "Why": "Modifies a `RefSubject` using an `Effect`ful function that returns both a result and a new\nvalue. The transition is serialized at the RefSubject rather than coordinated by callers or UI\ncomponents.",
      "Ownership and lifetime": "Running modify effect performs one serialized subject transition and resolves with its committed\nvalue. It acquires no resource; failures and services remain those of the source ref."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport * as RefSubject from \"@typed/fx/RefSubject\"\n\nconst program = Effect.gen(function* () {\n  const count = yield* RefSubject.make(5)\n\n  // Get the old value and set a new one, returning the old value\n  const oldValue = yield* RefSubject.modifyEffect(count, (value) =>\n    Effect.succeed([value, value + 10] as const)\n  )\n\n  console.log(oldValue) // 5\n  const newValue = yield* count\n  console.log(newValue) // 15\n})"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/RefSubject/RefSubject.ts",
        "start": {
          "line": 2378,
          "column": 14
        },
        "end": {
          "line": 2399,
          "column": 3
        }
      },
      {
        "file": "packages/fx/src/RefSubject/RefSubject.ts",
        "start": {
          "line": 2379,
          "column": 3
        },
        "end": {
          "line": 2381,
          "column": 75
        }
      },
      {
        "file": "packages/fx/src/RefSubject/RefSubject.ts",
        "start": {
          "line": 2382,
          "column": 3
        },
        "end": {
          "line": 2385,
          "column": 39
        }
      }
    ],
    "since": "1.0.0",
    "category": "Transactions"
  }
}
