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)
- Companion
- object
Value members
Concrete methods
Returns a pull with the result wrapped in Right
, or an error wrapped in Left
if the pull has failed.
Returns a pull with the result wrapped in Right
, or an error wrapped in Left
if the pull has failed.
Lifts this pull to the specified effect type, output type, and resource type.
Lifts this pull to the specified effect type, output type, and resource type.
Applies the resource of this pull to f
and returns the result.
Applies the resource of this pull to f
and returns the result.
If this
terminates with Pull.raiseError(e)
, invoke h(e)
.
If this
terminates with Pull.raiseError(e)
, invoke h(e)
.
Applies the resource of this pull to f
and returns the result in a new Pull
.
Applies the resource of this pull to f
and returns the result in a new Pull
.
Applies the outputs of this pull to f
and returns the result in a new Pull
.
Applies the outputs of this pull to f
and returns the result in a new Pull
.
Run p2
after this
, regardless of errors during this
, then reraise any errors encountered during this
.
Run p2
after this
, regardless of errors during this
, then reraise any errors encountered during this
.
Interpret this Pull
to produce a Stream
, introducing a scope.
Interpret this Pull
to produce a Stream
, introducing a scope.
May only be called on pulls which return a Unit
result type. Use p.void.stream
to explicitly
ignore the result type of the pull.
Interpret this Pull
to produce a Stream
without introducing a scope.
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.
May only be called on pulls which return a Unit
result type. Use p.void.stream
to explicitly
ignore the result type of the pull.