Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions core/shared/src/main/scala/fs2/Stream.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1040,17 +1040,18 @@ final class Stream[+F[_], +O] private[fs2] (private[fs2] val underlying: Pull[F,
underlying.flatMapOutput(evalOut).streamNoScope
}

/** Like `evalMap`, but operates on chunks for performance. This means this operator
* is not lazy on every single element, rather on the chunks.
/** Like `evalMap`, but operates on chunks for performance. Evaluates `f` for all elements
* within a chunk using the Applicative instance, which allows parallel evaluation if supported by `F`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommend removing "using the Applicative instance, which allows ...". Feels out of place here.

Copy link
Copy Markdown
Author

@ankitkumarrain ankitkumarrain Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @mpilquist, thank you for your suggestions. I’ve updated the changes accordingly. Could you please take another look?

*
* For instance, `evalMap` would only print twice in the follow example (note the `take(2)`):
* This operator is not lazy on individual elements, only on chunks. For instance, `evalMap` would
* only print twice in the following example (note the `take(2)`):
* @example {{{
* scala> import cats.effect.SyncIO
* scala> Stream(1,2,3,4).evalMap(i => SyncIO(println(i))).take(2).compile.drain.unsafeRunSync()
* res0: Unit = ()
* }}}
*
* But with `evalMapChunk`, it will print 4 times:
* But with `evalMapChunk`, it will print 4 times (entire first chunk is processed):
* @example {{{
* scala> Stream(1,2,3,4).evalMapChunk(i => SyncIO(println(i))).take(2).compile.drain.unsafeRunSync()
* res0: Unit = ()
Expand Down Expand Up @@ -1233,6 +1234,8 @@ final class Stream[+F[_], +O] private[fs2] (private[fs2] val underlying: Pull[F,
/** Like `filter`, but the predicate `f` depends on the previously emitted and
* current elements.
*
* The first element is always emitted (no previous element to compare).
*
* @example {{{
* scala> Stream(1, 9, 5, 6, 7, 8, 9, 10).filterWithPrevious((previous, current) => previous < current).toList
* res0: List[Int] = List(1, 9, 10)
Expand Down