# fromEffect

Creates a `RefSubject` from an `Effect`.

## Signatures

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

## Why

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

## Ownership and lifetime

The creation Effect requires Scope and the source's services, which it captures for the private
initializer Scope. The source Effect itself stays deferred until the first current read or
observation and runs at most once. Source failures remain visible on reads and observations;
closing the creation Scope interrupts an initializer that is still running.

## Examples

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

const program = Effect.gen(function* () {
  const ref = yield* RefSubject.fromEffect(
    Effect.succeed("Initial value")
  )

  const value = yield* ref
  console.log(value) // "Initial value"
})
```
