object Pull extends PullLowPriority
- Source
- Pull.scala
- Alphabetic
- By Inheritance
- Pull
- PullLowPriority
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- implicit final class IdOps[O] extends AnyVal
Provides syntax for pure pulls based on
cats.Id
. - final class PartiallyAppliedFromEither[F[_]] extends AnyRef
- trait Timed[F[_], O] extends AnyRef
An abstraction for writing
Pull
computations that can timeout while reading from aStream
.An abstraction for writing
Pull
computations that can timeout while reading from aStream
.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 aPull.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
anddoSomethingElse
arePull
computations such asPull.output
, in addition toPull.Timed.timeout
.See below for detailed descriptions of
timeout
anduncons
, and look at the Stream.ToPull.timed scaladoc for an example of usage.
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def attemptEval[F[_], 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[_], 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 clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- val done: Pull[Pure, INothing, Unit]
The completed
Pull
.The completed
Pull
. Reads and outputs nothing. - final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def eval[F[_], 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[_], O](s: Stream[F, O])(implicit 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 befores
is compiled and evaluated. - def fromEither[F[x]]: PartiallyAppliedFromEither[F]
Lifts an Either[Throwable, A] to an effectful Pull[F, A, Unit].
Lifts an Either[Throwable, A] to an effectful Pull[F, A, Unit].
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[INothing]] = Failure(java.lang.RuntimeException)
Example: - implicit def functionKInstance[F[_]]: ~>[F, [γ$1$]Pull[F, INothing, γ$1$]]
FunctionK
instance forF ~> Pull[F, INothing, *]
FunctionK
instance forF ~> Pull[F, INothing, *]
scala> import cats.Id scala> Pull.functionKInstance[Id](42).flatMap(Pull.output1).stream.compile.toList res0: cats.Id[List[Int]] = List(42)
Example: - final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- 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.
Repeatedly uses the output of the pull as input for the next step of the pull. Halts when a step terminates with
None
orPull.raiseError
. - implicit def monadErrorInstance[F[_], O]: MonadError[[γ$3$]Pull[F, O, γ$3$], Throwable]
- Definition Classes
- PullLowPriority
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def output[F[x] >: Pure[x], O](os: Chunk[O]): Pull[F, O, Unit]
Outputs a chunk of values.
- def output1[F[x] >: Pure[x], O](o: O): Pull[F, O, Unit]
Outputs a single value.
- def pure[F[x] >: Pure[x], R](r: R): Pull[F, INothing, R]
Pull that outputs nothing and has result of
r
. - def raiseError[F[_]](err: Throwable)(implicit arg0: RaiseThrowable[F]): Pull[F, INothing, INothing]
Reads and outputs nothing, and fails with the given error.
Reads and outputs nothing, and fails with the given error.
The
F
type must be explicitly provided (e.g., viaraiseError[IO]
orraiseError[Fallible]
). - def suspend[F[x] >: Pure[x], 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.
- implicit def syncInstance[F[_], O](implicit arg0: Sync[F]): Sync[[γ$0$]Pull[F, O, γ$0$]]
Sync
instance forPull
. - final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated