Pull

fs2.Pull$
See thePull companion class
object Pull

Attributes

Companion:
class
Source:
Pull.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Pull.type

Members list

Concise view

Type members

Classlikes

final implicit class IdOps[O](self: Pull[Id, O, Unit]) extends AnyVal

Provides syntax for pure pulls based on cats.Id.

Provides syntax for pure pulls based on cats.Id.

Attributes

Source:
Pull.scala
Graph
Supertypes
class AnyVal
trait Matchable
class Any
final class PartiallyAppliedFromEither[F[_]]

Attributes

Source:
Pull.scala
Graph
Supertypes
class Object
trait Matchable
class Any
final implicit class StreamPullOps[F[_], O](self: Pull[F, O, Unit]) extends AnyVal

Attributes

Source:
Pull.scala
Graph
Supertypes
class AnyVal
trait Matchable
class Any
trait Timed[F[_], O]

An abstraction for writing Pull computations that can timeout while reading from a Stream.

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.

Attributes

Source:
Pull.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Value members

Concrete methods

def attemptEval[F[_], R](fr: F[R]): Pull[F, Nothing, Either[Throwable, R]]

Like eval but if the effectful value fails, the exception is returned in a Left instead of failing the pull.

Like eval but if the effectful value fails, the exception is returned in a Left instead of failing the pull.

Attributes

Source:
Pull.scala
def bracketCase[F[_], 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]

Attributes

Source:
Pull.scala
def eval[F[_], R](fr: F[R]): Pull[F, Nothing, R]

Creates a pull that evaluates the supplied effect fr, emits no outputs, and terminates with the result of the effect. If the fr effect fails with an error, the new pull fails with that error.

Creates a pull that evaluates the supplied effect fr, emits no outputs, and terminates with the result of the effect. If the fr effect fails with an error, the new pull fails with that error.

Attributes

Source:
Pull.scala
def extendScopeTo[F[_], O](s: Stream[F, O])(implicit F: MonadError[F, Throwable]): Pull[F, Nothing, 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.

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.

Attributes

Source:
Pull.scala

Lifts an Either[Throwable, A] to an effectful Pull[F, A, Unit].

Lifts an Either[Throwable, A] to an effectful Pull[F, A, Unit].

Attributes

Example:
scala> import cats.effect.SyncIO, scala.util.Try
scala> Pull.fromEither[SyncIO](Right(42)).stream.compile.toList.unsafeRunSync()
res0: List[Int] = List(42)
scala> Try(Pull.fromEither[SyncIO](Left(new RuntimeException)).stream.compile.toList.unsafeRunSync())
res1: Try[List[Nothing]] = Failure(java.lang.RuntimeException)
Source:
Pull.scala
def loop[F[_], 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.

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.

Attributes

Source:
Pull.scala
def loopEither[F[_], O, S, R](f: S => Pull[F, O, Either[S, R]]): S => Pull[F, O, R]

Intantiates with a state. Repeatedly uses the left value of the result of the pull as input for the next step. The Pull terminates when a step terminates with Right or Pull.raiseError.

Intantiates with a state. Repeatedly uses the left value of the result of the pull as input for the next step. The Pull terminates when a step terminates with Right or Pull.raiseError.

Attributes

Source:
Pull.scala
def output[F[_], O](os: Chunk[O]): Pull[F, O, Unit]

Creates a pull that emits the elements of the given chunk. The new pull performs no effects and terminates successfully with a unit result.

Creates a pull that emits the elements of the given chunk. The new pull performs no effects and terminates successfully with a unit result.

Attributes

Source:
Pull.scala
def output1[F[_], O](o: O): Pull[F, O, Unit]

Lifts the given output value O into a pull that performs no effects, emits that single output in a singleton chunk, and always terminates successfully with a unit result.

Lifts the given output value O into a pull that performs no effects, emits that single output in a singleton chunk, and always terminates successfully with a unit result.

Note: using singleton chunks is not efficient. If possible, use the chunk-based output method instead.

Attributes

Source:
Pull.scala
def outputOption1[F[_], O](opt: Option[O]): Pull[F, O, Unit]

Lifts the given optional value O into a pull that performs no effects, emits the content of that option, and always terminates successfully with a unit result.

Lifts the given optional value O into a pull that performs no effects, emits the content of that option, and always terminates successfully with a unit result.

Attributes

Source:
Pull.scala
def pure[F[_], R](r: R): Pull[F, Nothing, R]

Creates an pull that performs no effects, emits no outputs, and terminates successfully with the supplied value as its result.

Creates an pull that performs no effects, emits no outputs, and terminates successfully with the supplied value as its result.

Attributes

Source:
Pull.scala
def raiseError[F[_] : RaiseThrowable](err: Throwable): Pull[F, Nothing, Nothing]

Lifts a throwable error into an atomic pull that emits no outputs and fails with the given error, without any result.

Lifts a throwable error into an atomic pull that emits no outputs and fails with the given error, without any result.

The F type must be explicitly provided (e.g., via raiseError[IO] or raiseError[Fallible]).

Attributes

Source:
Pull.scala
def sleep[F[_]](d: FiniteDuration)(implicit t: Temporal[F]): Pull[F, Nothing, Unit]

Creates a pull that waits for the duration d

Creates a pull that waits for the duration d

Attributes

Source:
Pull.scala
def suspend[F[_], 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.

Returns a pull that evaluates the supplied by-name each time the pull is used, allowing use of a mutable value in pull computations.

Attributes

Source:
Pull.scala

Concrete fields

val done: Pull[Nothing, Nothing, Unit]

A pull that performs no effects, emits no outputs, and always terminates successfully with a unit result.

A pull that performs no effects, emits no outputs, and always terminates successfully with a unit result.

Attributes

Source:
Pull.scala

Implicits

Implicits

final implicit def IdOps[O](self: Pull[Id, O, Unit]): IdOps[O]

Provides syntax for pure pulls based on cats.Id.

Provides syntax for pure pulls based on cats.Id.

Attributes

Source:
Pull.scala
final implicit def StreamPullOps[F[_], O](self: Pull[F, O, Unit]): StreamPullOps[F, O]

Attributes

Source:
Pull.scala
implicit def functionKInstance[F[_]]: FunctionK[F, [_] =>> Pull[F, Nothing, _$31]]

FunctionK instance for F ~> Pull[F, Nothing, *]

FunctionK instance for F ~> Pull[F, Nothing, *]

Attributes

Example:
scala> import cats.Id
scala> Pull.functionKInstance[Id](42).flatMap(Pull.output1).stream.compile.toList
res0: cats.Id[List[Int]] = List(42)
Source:
Pull.scala
implicit def syncInstance[F[_] : Sync, O]: Sync[[_] =>> Pull[F, O, _$29]]

Sync instance for Pull.

Sync instance for Pull.

Attributes

Source:
Pull.scala

Inherited implicits

implicit def monadErrorInstance[F[_], O]: MonadError[[_] =>> Pull[F, O, _$90], Throwable]

Attributes

Inherited from:
PullLowPriority (hidden)
Source:
Pull.scala