Pull

object Pull extends PullLowPriority
Companion
class
trait PullLowPriority
class Object
trait Matchable
class Any

Type members

Classlikes

final class PartiallyAppliedFromEither[F <: ([_$14] =>> Any)]
trait Timed[F <: ([_$16] =>> Any), O]
An abstraction for writing Pull computations that can timeout
while reading from a Stream.
A Pull.Timed is not created or intepreted directly, but by
calling Stream.ToPull.timed.
{{{
yourStream.pull.timed(tp => ...).stream
}}}
The argument to timed is a Pull.Timed[F, O] => Pull[F, O2, R]
function, which describes the pulling logic and is often recursive,
with shape:
{{{
def go(timedPull: Pull.Timed[F, A] ): Pull[F, B, Unit] =
timedPull.uncons.flatMap {
case Some((Right(chunk), next)) => doSomething >> go(next)
case Some((Left(_), next)) => doSomethingElse >> go(next)
case None => Pull.done
}
}}}
Where doSomething and doSomethingElse are Pull computations
such as Pull.output, in addition to Pull.Timed.timeout.
See below for detailed descriptions of timeout and uncons, and
look at the Stream.ToPull.timed scaladoc for an example of usage.
final class IdOps[O](self: Pull[Id, O, Unit]) extends AnyVal
Provides syntax for pure pulls based on cats.Id.

Value members

Methods

def attemptEval[F <: ([_$5] =>> Any), R](fr: F[R]): Pull[F, INothing, Either[Throwable, R]]
Like eval but if the effectful value fails, the exception is returned in a Left
instead of failing the pull.
def bracketCase[F <: ([_$6] =>> Any), O, A, B](acquire: Pull[F, O, A], use: A => Pull[F, O, B], release: (A, ExitCase) => Pull[F, O, Unit]): Pull[F, O, B]
def eval[F <: ([_$7] =>> Any), R](fr: F[R]): Pull[F, INothing, R]
Evaluates the supplied effectful value and returns the result as the resource of the returned pull.
def extendScopeTo[F <: ([_$8] =>> Any), O](s: Stream[F, O])(F: MonadError[F, Throwable]): Pull[F, INothing, Stream[F, O]]
Extends the scope of the currently open resources to the specified stream, preventing them
from being finalized until after s completes execution, even if the returned pull is converted
to a stream, compiled, and evaluated before s is compiled and evaluated.
def loop[F <: ([_$11] =>> Any), O, R](f: R => Pull[F, O, Option[R]]): R => Pull[F, O, Unit]
Repeatedly uses the output of the pull as input for the next step of the pull.
Halts when a step terminates with None or Pull.raiseError.
def output1[F >: ([x] =>> Pure[x]) <: ([x] =>> Any), O](o: O): Pull[F, O, Unit]
Outputs a single value.
def output[F >: ([x] =>> Pure[x]) <: ([x] =>> Any), O](os: Chunk[O]): Pull[F, O, Unit]
Outputs a chunk of values.
def pure[F >: ([x] =>> Pure[x]) <: ([x] =>> Any), R](r: R): Pull[F, INothing, R]
Pull that outputs nothing and has result of r.
def raiseError[F <: ([_$12] =>> Any)](err: Throwable)(evidence$1: RaiseThrowable[F]): Pull[F, INothing, INothing]
Reads and outputs nothing, and fails with the given error.
The F type must be explicitly provided (e.g., via raiseError[IO] or raiseError[Fallible]).
def fromEither[F <: ([x] =>> Any)]: PartiallyAppliedFromEither[F]
Lifts an Either[Throwable, A] to an effectful Pull[F, A, Unit] .
Example
{{{
scala> import cats.effect.SyncIO, scala.util.Try
scala> Pull.fromEitherSyncIO.stream.compile.toList.unsafeRunSync()
res0: List[Int] = List(42)
scala> Try(Pull.fromEither[SyncIO] (Left(new RuntimeException)).stream.compile.toList.unsafeRunSync())
res1: Try[List[INothing] ] = Failure(java.lang.RuntimeException)
}}}
def suspend[F >: ([x] =>> Pure[x]) <: ([x] =>> Any), O, R](p: => Pull[F, O, R]): Pull[F, O, R]
Returns a pull that evaluates the supplied by-name each time the pull is used,
allowing use of a mutable value in pull computations.

Fields

val done: Pull[Pure, INothing, Unit]
The completed Pull. Reads and outputs nothing.

Implicits

Implicits

implicit def syncInstance[F <: ([_$17] =>> Any), O](evidence$2: Sync[F]): Sync[[_$18] =>> Pull[F, O, _$18]]
Sync instance for Pull.
implicit def functionKInstance[F <: ([_$19] =>> Any)]: FunctionK[F, [_$20] =>> Pull[F, INothing, _$20]]
FunctionK instance for F ~> Pull[F, INothing, *]
Example
{{{
scala> import cats.Id
scala> Pull.functionKInstanceId.flatMap(Pull.output1).stream.compile.toList
res0: cats.Id[List[Int] ] = List(42)
}}}

Inherited implicits

implicit def monadErrorInstance[F <: ([_$68] =>> Any), O]: MonadError[[_$69] =>> Pull[F, O, _$69], Throwable]
Inhertied from
PullLowPriority