# Combine


Stream combination: concat, interleave, zip, zipWith.

## `concat`

_concat: yield all elements of `s1`, then all elements of `s2`; if `s1` ends immediately we forward `s2` directly without rewrapping._

```
concat : Computation (Step r a) -> Computation (Step s a) -> Computation (Step s a)
```

Concatenate two streams: all elements of the first, then all of
the second. Sequential, not interleaved.

## `interleave`

_interleave: alternate elements between two streams; when the leading stream ends, the trailing stream takes over uninterrupted._

```
interleave : Computation (Step r a) -> Computation (Step s a) -> Computation (Step null a)
```

Interleave two streams: alternate elements from each. When one
stream ends the other continues to completion.

## `zip`

_zip: pair elements positionally into `{ fst, snd }` records; stops when either input stream ends._

```
zip : Computation (Step r a) -> Computation (Step s b) -> Computation (Step null { fst : a, snd : b })
```

Zip two streams into a stream of pairs. Stops when either stream ends.

## `zipWith`

_zipWith: pair elements positionally and combine each pair with `f`; stops when either input stream ends._

```
zipWith : (a -> b -> c) -> Computation (Step r a) -> Computation (Step s b) -> Computation (Step null c)
```

Zip two streams with a combining function. Stops when either stream ends.

