# Transform


Stream transformations: map, filter, scanl, flatMap.

## `filter`

_sfilter (exported as `filter`): keep only elements that satisfy the predicate; failing elements are dropped silently with no blame._

```
sfilter : (a -> Bool) -> Computation (Step r a) -> Computation (Step r a)
```

Keep only elements satisfying a predicate. Exposed as `filter` at
the module's top-level.

## `flatMap`

_flatMap: apply `f` returning a stream to each element and flatten via `concat`; expands one input element into zero or more outputs._

```
flatMap : (a -> Computation (Step r b)) -> Computation (Step r a) -> Computation (Step r b)
```

Apply a function that returns a stream to each element, then
flatten the resulting streams with `concat`.

## `map`

_smap (exported as `map`): map a function over each element of a stream; the structure of `More`/`Done` steps is preserved._

```
smap : (a -> b) -> Computation (Step r a) -> Computation (Step r b)
```

Map a function over each element of a stream. Exposed as `map` at
the module's top-level.

## `scanl`

_scanl: emit a running left-fold; for each input element, emit the accumulator before combining with the element to advance._

```
scanl : (b -> a -> b) -> b -> Computation (Step r a) -> Computation (Step r b)
```

Accumulate a running fold over the stream, yielding each
intermediate accumulator value.

