Pull
- Companion
- class
trait PullLowPriority
class Object
trait Matchable
class Any
Type members
Classlikes
An abstraction for writing
while reading from a
Pull
computations that can timeoutwhile reading from a
Stream
.{{{
yourStream.pull.timed(tp => ...).stream
}}}
yourStream.pull.timed(tp => ...).stream
}}}
The argument to
function, which describes the pulling logic and is often recursive,
with shape:
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
}
}}}
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
such as
doSomething
and doSomethingElse
are Pull
computationssuch as
Pull.output
, in addition to Pull.Timed.timeout
.See below for detailed descriptions of
look at the Stream.ToPull.timed scaladoc for an example of usage.
timeout
and uncons
, andlook at the Stream.ToPull.timed scaladoc for an example of usage.
Value members
Methods
Creates an pull that performs no effects, emits no outputs,
and terminates successfully with the supplied value as its result.
and terminates successfully with the supplied value as its result.
def raiseError[F <: ([_$5] =>> Any)](err: Throwable)(evidence$1: RaiseThrowable[F]): Pull[F, INothing, INothing]
Lifts a throwable error into an atomic pull that emits no outputs and
fails with the given error, without any result.
fails with the given error, without any result.
The
or
F
type must be explicitly provided (e.g., via raiseError[IO]
or
raiseError[Fallible]
).Creates a pull that evaluates the supplied effect
outputs, and terminates with the result of the effect.
If the
fr
, emits nooutputs, and terminates with the result of the effect.
If the
fr
effect fails with an error, the new pull fails with that error.Lifts the given output value
effects, emits that single output in a singleton chunk, and always
terminates successfully with a unit result.
O
into a pull that performs noeffects, 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
use the chunk-based
output
method instead.Creates a pull that emits the elements of the given chunk.
The new pull performs no effects and terminates successfully with a unit result.
The new pull performs no effects and terminates successfully with a unit result.
Like eval but if the effectful value fails, the exception is returned
in a
in a
Left
instead of failing the pull. def bracketCase[F <: ([_$10] =>> 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 extendScopeTo[F <: ([_$11] =>> 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
even if the returned pull is converted to a stream, compiled, and
evaluated before
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.Repeatedly uses the output of the pull as input for the next step of the
pull. Halts when a step terminates with
pull. Halts when a step terminates with
None
or Pull.raiseError
.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)
}}}
Implicits
Implicits
implicit def syncInstance[F <: ([_$19] =>> Any), O](evidence$2: Sync[F]): Sync[[_$20] =>> Pull[F, O, _$20]]
Sync
instance for Pull
.Inherited implicits
implicit def monadErrorInstance[F <: ([_$79] =>> Any), O]: MonadError[[_$80] =>> Pull[F, O, _$80], Throwable]
- Inhertied from
- PullLowPriority