final class Pull[+F[_], +O, +R] extends AnyVal
A p: Pull[F,O,R]
reads values from one or more streams, returns a
result of type R
, and produces a Stream[F,O]
when calling p.stream
.
Any resources acquired by p
are freed following the call to stream
.
Laws:
Pull
forms a monad in R
with pure
and flatMap
:
pure >=> f == f
f >=> pure == f
(f >=> g) >=> h == f >=> (g >=> h)
wheref >=> g
is defined asa => a flatMap f flatMap g
raiseError
is caught by handleErrorWith
:
handleErrorWith(raiseError(e))(f) == f(e)
- Source
- Pull.scala
- Alphabetic
- By Inheritance
- Pull
- AnyVal
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
##(): Int
- Definition Classes
- Any
- def +(other: String): String
- def ->[B](y: B): (Pull[F, O, R], B)
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- Any
-
def
>>[F2[x] >: F[x], O2 >: O, R2](p2: ⇒ Pull[F2, O2, R2]): Pull[F2, O2, R2]
Alias for
flatMap(_ => p2)
. -
def
as[R2](r2: R2): Pull[F, O, R2]
Alias for
_.map(_ => o2)
. -
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
attempt: Pull[F, O, Either[Throwable, R]]
Returns a pull with the result wrapped in
Right
, or an error wrapped inLeft
if the pull has failed. -
def
covary[F2[x] >: F[x]]: Pull[F2, O, R]
Lifts this pull to the specified effect type.
-
def
covaryAll[F2[x] >: F[x], O2 >: O, R2 >: R]: Pull[F2, O2, R2]
Lifts this pull to the specified effect type, output type, and resource type.
-
def
covaryOutput[O2 >: O]: Pull[F, O2, R]
Lifts this pull to the specified output type.
-
def
covaryResource[R2 >: R]: Pull[F, O, R2]
Lifts this pull to the specified resource type.
- def ensuring(cond: (Pull[F, O, R]) ⇒ Boolean, msg: ⇒ Any): Pull[F, O, R]
- def ensuring(cond: (Pull[F, O, R]) ⇒ Boolean): Pull[F, O, R]
- def ensuring(cond: Boolean, msg: ⇒ Any): Pull[F, O, R]
- def ensuring(cond: Boolean): Pull[F, O, R]
-
def
flatMap[F2[x] >: F[x], O2 >: O, R2](f: (R) ⇒ Pull[F2, O2, R2]): Pull[F2, O2, R2]
Applies the resource of this pull to
f
and returns the result. - def formatted(fmtstr: String): String
-
def
getClass(): Class[_ <: AnyVal]
- Definition Classes
- AnyVal → Any
-
def
handleErrorWith[F2[x] >: F[x], O2 >: O, R2 >: R](h: (Throwable) ⇒ Pull[F2, O2, R2]): Pull[F2, O2, R2]
If
this
terminates withPull.raiseError(e)
, invokeh(e)
. -
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
map[R2](f: (R) ⇒ R2): Pull[F, O, R2]
Applies the resource of this pull to
f
and returns the result in a newPull
. -
def
onComplete[F2[x] >: F[x], O2 >: O, R2 >: R](p2: ⇒ Pull[F2, O2, R2]): Pull[F2, O2, R2]
Run
p2
afterthis
, regardless of errors duringthis
, then reraise any errors encountered duringthis
. -
def
scope: Pull[F, O, R]
Tracks any resources acquired during this pull and releases them when the pull completes.
-
def
stream: Stream[F, O]
Interpret this
Pull
to produce aStream
.Interpret this
Pull
to produce aStream
. The result typeR
is discarded. -
def
streamNoScope: Stream[F, O]
Like stream but no scope is inserted around the pull, resulting in any resources being promoted to the parent scope of the stream, extending the resource lifetime.
Like stream but no scope is inserted around the pull, resulting in any resources being promoted to the parent scope of the stream, extending the resource lifetime. Typically used as a performance optimization, where resource lifetime can be extended in exchange for faster execution.
-
def
toString(): String
- Definition Classes
- Any
- def →[B](y: B): (Pull[F, O, R], B)