# RefSubject.set

Sets the value of a `RefSubject`.

## Signatures

```ts
export declare const set: {
    <A>(value: A): <E, R>(ref: RefSubject<A, E, R>) => Effect.Effect<A, E, R>;
    <A, E, R>(ref: RefSubject<A, E, R>, a: A): Effect.Effect<A, E, R>;
};
```

## Why

Sets the value of a `RefSubject`. The transition is serialized at the RefSubject rather than
coordinated by callers or UI components.

## Ownership and lifetime

Running set performs one serialized subject transition and resolves with its committed value. It
acquires no resource; failures and services remain those of the source ref.

## Examples

```ts
import { Effect } from "effect"
import * as RefSubject from "@typed/fx/RefSubject"

const program = Effect.gen(function* () {
  const count = yield* RefSubject.make(0)

  // Set the value
  yield* RefSubject.set(count, 10)
  const value = yield* count
  console.log(value) // 10

  // Can also use pipe syntax
  yield* count.pipe(RefSubject.set(20))
  const newValue = yield* count
  console.log(newValue) // 20
})
```
