Skip to content

Commit

Permalink
Merge pull request #754 from mpilquist/topic/undrain-the-sink
Browse files Browse the repository at this point in the history
The to/tov methods should not drain the resulting stream
  • Loading branch information
mpilquist committed Oct 29, 2016
2 parents 7810f49 + 2300335 commit 1edf3fd
Showing 1 changed file with 2 additions and 2 deletions.
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

0 comments on commit 1edf3fd

Please sign in to comment.