Alias for flatMap(_ => p2)
.
Alias for _.map(_ => o2)
.
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.
Lifts this pull to the specified effect type, output type, and resource type.
Lifts this pull to the specified output type.
Lifts this pull to the specified resource type.
Applies the resource of this pull to f
and returns the result.
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 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
.
Tracks any resources acquired during this pull and releases them when the pull completes.
Interpret this Pull
to produce a Stream
.
Interpret this Pull
to produce a Stream
. The result type R
is discarded.
Like stream but no scope is inserted around the pull, resulting in any resources being promoted to the current 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 current 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.
Caution: this can result in resources with greatly extended lifecycles if the pull
discards parts of the stream from which it was created. This could lead to memory leaks
so be very careful when using this function. For example, a pull that emits the first element
and discards the tail could discard the release of one or more resources that were acquired
in order to produce the first element. Normally, these resources would be registered in the
scope generated by the pull-to-stream conversion and hence released as part of that scope
closing but when using streamNoScope
, they get promoted to the current stream scope,
which may be infinite in the worst case.
A
p: Pull[F,O,R]
reads values from one or more streams, returns a result of typeR
, and produces aStream[F,O]
when callingp.stream
.Any resources acquired by
p
are freed following the call tostream
.Laws:
Pull
forms a monad inR
withpure
andflatMap
: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 byhandleErrorWith
:handleErrorWith(raiseError(e))(f) == f(e)