-
Notifications
You must be signed in to change notification settings - Fork 601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pull: turn flatMapOutput into an extension method. #3016
Conversation
a26e2f1
to
d67bd7c
Compare
@@ -962,6 +962,8 @@ final class Stream[+F[_], +O] private[fs2] (private[fs2] val underlying: Pull[F, | |||
queue: Queue[F2, Option[Chunk[O2]]] | |||
): Stream[F2, Nothing] = enqueueNoneTerminatedChunks(queue: QueueSink[F2, Option[Chunk[O2]]]) | |||
|
|||
import Pull.StreamPullOps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the import necessary, is it not in implicit scope automatically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Failed to compile in Scala 3 without it. It could be that Scala 3 has narrowed that scope.
private[fs2] def flatMapOutput[F[_], F2[x] >: F[x], O, O2]( | ||
p: Pull[F, O, Unit], | ||
f: O => Pull[F2, O2, Unit] | ||
): Pull[F2, O2, Unit] = | ||
p match { | ||
case a: AlgEffect[F, Unit] => a | ||
case r: Terminal[_] => r | ||
case _ => FlatMapOutput(p, f) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding a MiMa filter, can we just make this deprecated and delegate it to the new implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmmm if it is a private[fs2] method, how could a binary incompatibility happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's because of scala/scala3#10842.
It would be safe to add a filter, but every filter we add risks accidentally masking a real issue. So my personal preference is to avoid filters even for private stuff if there's an easy fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not ideal, but so be it. Added back.
d67bd7c
to
45766d0
Compare
We may like method calls, even extension methods, better than functions. Plus, we need fewer type arguments in the calls.
5d5911b
to
d95cd67
Compare
We may like method calls, even extension methods, better than functions. Plus, we need fewer type arguments in the calls.