# changesWithEffect

Drops consecutive elements that are considered equal by an effectful predicate.
When the effect returns `true`, the element is skipped; when `false`, it is emitted.

This is the effectful variant of `skipRepeatsWith`: instead of a pure
`Equivalence<A>`, you supply `(prev, next) => Effect<boolean>` where `true`
means "equal" (skip) and `false` means "changed" (emit).

## Signatures

```ts
export declare const changesWithEffect: {
    <A, E2, R2>(f: (prev: A, next: A) => Effect.Effect<boolean, E2, R2>): <E, R>(fx: Fx<A, E | E2, R>) => Fx<A, E | E2, R | R2>;
    <A, E, R, E2, R2>(fx: Fx<A, E | E2, R>, f: (prev: A, next: A) => Effect.Effect<boolean, E2, R2>): Fx<A, E | E2, R | R2>;
};
```

## Why

`changesWithEffect` supports service-backed or failing equivalence checks. The first value always
emits; every later value is compared with the last emitted value and emits only when the effect
returns `false`, preserving source order.

## Ownership and lifetime

One previous value and a semaphore are scoped to each run. Comparison effects are serialized,
interrupted with the run, and add their failures and services to the resulting Fx.

## Examples

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

const changes = Fx.fromIterable([1, 1, 2]).pipe(
  Fx.changesWithEffect((previous, next) => Effect.succeed(previous === next)),
)
```
