# Fx.concat

Concatenates two Fx streams: runs the first to completion, then runs the
second. Emits all values from the first stream in order, then all values
from the second stream in order.

**Completion:** The concatenated stream completes when the **second** stream
completes (the first must complete before the second starts).

**Failures:** A source Cause is delivered to the Sink. Because `Fx.run` is infallible, delivery
alone does not suppress the continuation: the right source is run after the left run returns.

## Signatures

```ts
export declare const concat: {
    <A2, E2, R2>(that: Fx<A2, E2, R2>): <A, E, R>(self: Fx<A, E, R>) => Fx<A | A2, E | E2, R | R2>;
    <A, E, R, A2, E2, R2>(self: Fx<A, E, R>, that: Fx<A2, E2, R2>): Fx<A | A2, E | E2, R | R2>;
};
```

## Why

`concat` makes subscription order explicit: the right source is not acquired until the left run
returns. It preserves every value and each source's internal order. A failure callback can be
followed by continuation values when the Sink handles the Cause without interrupting the run.

## Ownership and lifetime

Only one source is active at a time. Interruption stops the active source and prevents later
acquisition. Failure is Sink delivery rather than a failing `Fx.run` Effect, so it does not by
itself prevent the right source from being acquired.

## Examples

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

const program = Effect.gen(function* () {
  const deliveries = yield* Ref.make<Array<string>>([])
  const sink = Sink.make(
    () => Ref.update(deliveries, (xs) => [...xs, "failure"]),
    (value: string) => Ref.update(deliveries, (xs) => [...xs, value])
  )
  yield* Fx.concat(Fx.fail("left failed"), Fx.succeed("right still runs")).run(sink)
  return yield* Ref.get(deliveries) // ["failure", "right still runs"]
})
```
