# takeEffect

Takes the first `n` elements where `n` is produced by an Effect.

## Signatures

```ts
export declare const takeEffect: {
    <E2, R2>(count: Effect.Effect<number, E2, R2>): <A, E, R>(fx: Fx<A, E, R>) => Fx<A, E | E2, R | R2>;
    <A, E, R, E2, R2>(fx: Fx<A, E, R>, count: Effect.Effect<number, E2, R2>): Fx<A, E | E2, R | R2>;
};
```

## Why

`takeEffect` obtains a dynamic bound once before subscribing, then applies ordinary `take`.

## Ownership and lifetime

The count Effect can fail, require services, or be interrupted; in those cases upstream never
starts. After success, reaching the limit stops upstream work.

## Examples

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

const first = Fx.fromIterable([1, 2]).pipe(Fx.takeEffect(Effect.succeed(1)))
```
