Navigation

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.