Standard map on the elements of a stream.

>>> S.stdoutLn $ S.map reverse $ each (words "alpha beta") ahpla ateb

Map layers of one functor to another with a transformation involving
the base monad.
This function is completely functor-general. It is often useful with
the more concrete type
`IO`-based stream by grouping functions like group,
split or breaks. Summary functions like fold,
foldM, mconcat or toList are often used to define
the transformation argument. For example:

mapped :: (forall x. Stream (Of a) IO x -> IO (Of b x)) -> Stream (Stream (Of a) IO) IO r -> Stream (Of b) IO rto process groups which have been demarcated in an effectful,

>>> S.toList_ $ S.mapped S.toList $ S.split 'c' (S.each "abcde") ["ab","de"]maps and mapped obey these rules:

maps id = id mapped return = id maps f . maps g = maps (f . g) mapped f . mapped g = mapped (f <=< g) maps f . mapped g = mapped (fmap f . g) mapped f . maps g = mapped (f <=< fmap g)maps is more fundamental than mapped, which is best understood as a convenience for effecting this frequent composition:

mapped phi = decompose . maps (Compose . phi)

Map layers of one functor to another with a transformation. Compare
hoist, which has a similar effect on the `monadic` parameter.

maps id = id maps f . maps g = maps (f . g)

Map layers of one functor to another with a transformation involving
the base monad. maps is more fundamental than `mapsM`,
which is best understood as a convenience for effecting this frequent
composition:
`mapped`, which overlaps with the lens libraries.

mapsM phi = decompose . maps (Compose . phi)The streaming prelude exports the same function under the better name

Map layers of one functor to another with a transformation involving
the base monad. `mapsMPost` is essentially the same as
mapsM, but it imposes a Functor constraint on its target
functor rather than its source functor. It should be preferred if
fmap is cheaper for the target functor than for the source
functor.
`mapsPost` is more fundamental than `mapsMPost`, which
is best understood as a convenience for effecting this frequent
composition:
`mappedPost`, which overlaps with the lens libraries.

mapsMPost phi = decompose . mapsPost (Compose . phi)The streaming prelude exports the same function under the better name

Map each layer to an effect, and run them all.

Map layers of one functor to another with a transformation. Compare
hoist, which has a similar effect on the `monadic` parameter.
`mapsPost` is essentially the same as maps, but it
imposes a Functor constraint on its target functor rather than
its source functor. It should be preferred if fmap is cheaper
for the target functor than for the source functor.

mapsPost id = id mapsPost f . mapsPost g = mapsPost (f . g) mapsPost f = maps f

Replace each element of a stream with the result of a monadic action

>>> S.print $ S.mapM readIORef $ S.chain (\ior -> modifyIORef ior (*100)) $ S.mapM newIORef $ each [1..6] 100 200 300 400 500 600See also chain for a variant of this which ignores the return value of the function and just uses the side effects.

Reduce a stream to its return value with a monadic action.

>>> S.mapM_ Prelude.print $ each [1..3] 1 2 3

>>> rest <- S.mapM_ Prelude.print $ S.splitAt 3 $ each [1..10] 1 2 3 >>> S.sum rest 49 :> ()

Map monadically over a stream, producing a new stream only containing
the Just values.

Map a function over the first element of an `Of` pair
`mapOf` is just `first` from the `Bifunctor`
instance
`_first` lens

>>> S.mapOf even (1:>"hi") False :> "hi"

>>> first even (1:>"hi") False :> "hi"and is contained in the

>>> import Lens.Micro >>> over S._first even (1:>"hi") False :> "hi"

Map each element of the stream to a monoid, and take the monoidal sum
of the results.

>>> S.foldMap Sum $ S.take 2 (S.stdinLn) 1<Enter> 2<Enter> 3<Enter> Sum {getSum = 6} :> ()

**Packages**- is:exact