Skip to content

The to/tov methods should not drain the resulting stream #754

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

Merged
merged 1 commit into from
Oct 29, 2016
Merged
Changes from all commits
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
4 changes: 2 additions & 2 deletions core/shared/src/main/scala/fs2/Stream.scala
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ final class Stream[+F[_],+O] private (private val coreRef: Stream.CoreRef[F,O])

/** Like `to`, but the specified `Sink`'s effect may be a supertype of `F`. */
def tov[F2[_]](f: Sink[F2,O])(implicit S: Sub1[F,F2]): Stream[F2,Unit] =
f(Sub1.substStream(self)).drain
f(Sub1.substStream(self))

def translate[G[_]](u: F ~> G): Stream[G,O] =
Stream.mk { get.translate(StreamCore.NT.T(u)) }
Expand Down Expand Up @@ -528,7 +528,7 @@ object Stream {
f(self,s2)

/** Applies the given sink to this stream and drains the output. */
def to(f: Sink[F,O]): Stream[F,Unit] = f(self).drain
def to(f: Sink[F,O]): Stream[F,Unit] = f(self)
}

implicit class StreamPureOps[+O](private val self: Stream[Pure,O]) extends AnyVal {
Expand Down