Lifts this stream to the specified effect type.
Lifts this stream to the specified effect type.
scala> import cats.effect.IO scala> Stream(1, 2, 3).covary[IO] res0: Stream[IO,Int] = Stream(..)
Synchronously sends values through sink
.
Synchronously sends values through sink
.
If sink
fails, then resulting stream will fail. If sink halts
the evaluation will halt too.
Note that observe will only output full chunks of O
that are known to be successfully processed
by sink
. So if Sink terminates/fail in middle of chunk processing, the chunk will not be available
in resulting stream.
Note that if your sink can be represented by an O => F[Unit]
, evalTap
will provide much greater performance.
scala> import cats.effect.{ContextShift, IO}, cats.implicits._ scala> implicit val cs: ContextShift[IO] = IO.contextShift(scala.concurrent.ExecutionContext.Implicits.global) scala> Stream(1, 2, 3).covary[IO].observe(Sink.showLinesStdOut).map(_ + 1).compile.toVector.unsafeRunSync res0: Vector[Int] = Vector(2, 3, 4)
Send chunks through sink
, allowing up to maxQueued
pending _chunks_ before blocking s
.
Gets a projection of this stream that allows converting it to a Pull
in a number of ways.
Repeatedly invokes using
, running the resultant Pull
each time, halting when a pull
returns None
instead of Some(nextStream)
.
Provides syntax for streams that are invariant in
F
andO
.