# RefSubject.fromFx

Creates a `RefSubject` from an `Fx`, tracking the latest emitted value.

## Signatures

```ts
export declare function fromFx<A, E, R>(fx: Fx<A, E, R>, options?: RefSubjectOptions<A>): Effect.Effect<RefSubject<A, E>, never, R | Scope.Scope>;
```

## Why

Makes fx acquisition explicit while normalizing it into current RefSubject state and subsequent
pushed versions.

## Ownership and lifetime

The creation Effect requires Scope. It owns initializer acquisition, live source subscriptions,
and cleanup; source failures and services stay on reads and pushes.

## Examples

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

const program = Effect.gen(function* () {
  // Create an Fx that emits multiple values
  const numbers = Fx.fromIterable([1, 2, 3, 4, 5])

  // Create a RefSubject that tracks the latest value
  const ref = yield* RefSubject.fromFx(numbers)

  // Get the latest value
  const latest = yield* ref
  console.log(latest) // 5
})
```
