Pull
A
result of type
p: Pull[F,O,R]
reads values from one or more streams, returns aresult 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)
where
f >=> g
is defined as a => a flatMap f flatMap g
raiseError
is caught by handleErrorWith
:-
handleErrorWith(raiseError(e))(f) == f(e)
- Companion
- object
class Object
trait Matchable
class Any
Value members
Methods
Returns a pull with the result wrapped in
Right
, or an error wrapped in Left
if the pull has failed.Interpret this
Pull
to produce a Stream
, introducing a scope.May only be called on pulls which return a
ignore the result type of the pull.
Unit
result type. Use p.void.stream
to explicitlyignore the result type of the pull.
Interpret this
Pull
to produce a Stream
without introducing a scope.Only use this if you know a scope is not needed. Scope introduction is generally harmless and the risk
of not introducing a scope is a memory leak in streams that otherwise would execute in constant memory.
of not introducing a scope is a memory leak in streams that otherwise would execute in constant memory.
May only be called on pulls which return a
ignore the result type of the pull.
Unit
result type. Use p.void.stream
to explicitlyignore the result type of the pull.
def flatMap[F2 >: ([x] =>> F[x]) <: ([x] =>> Any), 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 >>[F2 >: ([x] =>> F[x]) <: ([x] =>> Any), O2 >: O, R2](p2: => Pull[F2, O2, R2]): Pull[F2, O2, R2]
Alias for
flatMap(_ => p2)
. def onComplete[F2 >: ([x] =>> F[x]) <: ([x] =>> Any), O2 >: O, R2 >: R](p2: => Pull[F2, O2, R2]): Pull[F2, O2, R2]
Run
p2
after this
, regardless of errors during this
, then reraise any errors encountered during this
.