# takeWhile

Takes elements from an Fx while a predicate returns true.
Stops at the first element for which the predicate returns false; that element is not included.

## Signatures

```ts
export declare const takeWhile: {
    <A>(predicate: (a: A) => boolean): <E, R>(fx: Fx<A, E, R>) => Fx<A, E, R>;
    <A, E, R>(fx: Fx<A, E, R>, predicate: (a: A) => boolean): Fx<A, E, R>;
};
```

## Why

`takeWhile` emits the longest matching prefix, in order, and completes before the first false
value. It is the predicate complement of `takeUntil`.

## Ownership and lifetime

A false result stops upstream immediately. The pure predicate acquires no resources and adds no
failures or services.

## Examples

```ts
import { Fx } from "@typed/fx"
const small = Fx.fromIterable([1, 2, 3]).pipe(Fx.takeWhile((n) => n < 3))
```
