Symbolic alias for zip.
Symbolic alias for zipParRight
Symbolic alias for zipRight
Symbolic alias for zipParLeft
Symbolic alias for zipPar
Symbolic alias for zipLeft.
Symbolic alias for zip.
Symbolic alias for compose
Operator alias for orElse
.
Symbolic alias for flatMap
Symbolic alias for andThen
Submerges the error case of an Either
into the ZManaged
.
Submerges the error case of an Either
into the ZManaged
. The inverse
operation of ZManaged.either
.
Executes the this effect and then provides its output as an environment to the second effect
Maps this effect to the specified constant while preserving the effects of this effect.
Returns an effect whose failure and success channels have been mapped by
the specified pair of functions, f
and g
.
Recovers from all errors.
Recovers from some or all of the error cases.
Executes the second effect and then provides its output as an environment to this effect
Returns an effect whose failure and success have been lifted into an
Either
.The resulting effect cannot fail
Ensures that f
is executed when this ZManaged is finalized, after
the existing finalizer.
Ensures that f
is executed when this ZManaged is finalized, after
the existing finalizer.
For usecases that need access to the ZManaged's result, see ZManaged#onExit.
Ensures that f
is executed when this ZManaged is finalized, before
the existing finalizer.
Ensures that f
is executed when this ZManaged is finalized, before
the existing finalizer.
For usecases that need access to the ZManaged's result, see ZManaged#onExitFirst.
Zips this effect with its environment
Returns an effect that models the execution of this effect, followed by
the passing of its value to the specified continuation function k
,
followed by the effect that it returns.
Effectfully map the error channel
Returns an effect that performs the outer effect first, followed by the inner effect, yielding the value of the inner effect.
Returns an effect that performs the outer effect first, followed by the inner effect, yielding the value of the inner effect.
This method can be used to "flatten" nested effects.
Flip the error and result
Flip the error and result, then apply an effectful function to the effect
Folds over the failure value or the success value to yield an effect that
does not fail, but succeeds with the value returned by the left or right
function passed to fold
.
A more powerful version of foldM
that allows recovering from any kind of failure except interruptions.
Recovers from errors by accepting one effect to execute for the case of an error, and one effect to execute for the case of success.
Creates a ZManaged
value that acquires the original resource in a fiber,
and provides that fiber.
Creates a ZManaged
value that acquires the original resource in a fiber,
and provides that fiber. The finalizer for this value will interrupt the fiber
and run the original finalizer.
Unwraps the optional success of this effect, but can fail with unit value.
Depending on the environment execute this or the other effect
Returns an effect whose success is mapped by the specified f
function.
Returns an effect whose failure is mapped by the specified f
function.
Returns an effect whose full failure is mapped by the specified f
function.
Effectfully maps the resource acquired by this value.
Ensures that a cleanup function runs when this ZManaged is finalized, after the existing finalizers.
Ensures that a cleanup function runs when this ZManaged is finalized, before the existing finalizers.
Executes this effect, skipping the error but returning optionally the success.
Translates effect failure into death of the fiber, making all failures unchecked and not a part of the type of the effect.
Keeps none of the errors, and terminates the fiber with them, using
the specified function to convert the E
into a Throwable
.
Executes this effect and returns its value, if it succeeds, but otherwise executes the specified effect.
Returns an effect that will produce the value of this effect, unless it fails, in which case, it will produce the value of the specified effect.
Provides the ZManaged
effect with its required environment, which eliminates
its dependency on R
.
Provides some of the environment required to run this effect,
leaving the remainder R0
.
Keeps some of the errors, and terminates the fiber with the rest.
Keeps some of the errors, and terminates the fiber with the rest, using
the specified function to convert the E
into a Throwable
.
Keeps some of the errors, and terminates the fiber with the rest.
Retries with the specified retry policy.
Retries with the specified retry policy.
Retries are done following the failure of the original io
(up to a fixed maximum with
once
or recurs
for example), so that that io.retry(Schedule.once)
means
"execute io
and in case of failure, try again once".
Exposes the full cause of failure of this effect.
Zips this effect with its environment
Returns an effect that effectfully peeks at the acquired resource.
Like ZManaged#tap, but uses a function that returns a ZIO value rather than a ZManaged value.
Returns a new effect that executes this one and times the acquisition of the resource.
Returns an effect that will timeout this resource, returning None
if the
timeout elapses before the resource was reserved and acquired.
Returns an effect that will timeout this resource, returning None
if the
timeout elapses before the resource was reserved and acquired.
If the reservation completes successfully (even after the timeout) the release action will be run on a new fiber.
Some
will be returned if acquisition and reservation complete in time
Return unit while running the effect
The inverse operation ZManaged.sandboxed
Run an effect while acquiring the resource before and releasing it after
Use the resource until interruption.
Use the resource until interruption. Useful for resources that you want to acquire and use as long as the application is running, like a HTTP server.
Run an effect while acquiring the resource before and releasing it after.
Run an effect while acquiring the resource before and releasing it after. This does not provide the resource to the function
The moral equivalent of if (p) exp
The moral equivalent of if (p) exp
when p
has side-effects
Modifies this ZManaged
to provide a canceler that can be used to eagerly
execute the finalizer of this ZManaged
.
Modifies this ZManaged
to provide a canceler that can be used to eagerly
execute the finalizer of this ZManaged
. The canceler will run
uninterruptibly with an exit value indicating that the effect was
interrupted, and if completed will cause the regular finalizer to not run.
A more powerful version of withEarlyRelease
that allows specifying an
exit value in the event of early release.
Named alias for <*>
.
Named alias for <*
.
Named alias for <&>
.
Named alias for <&
.
Named alias for &>
.
Named alias for *>
.
Returns an effect that executes both this effect and the specified effect,
in sequence, combining their results with the specified f
function.
Returns an effect that executes both this effect and the specified effect,
in parallel, combining their results with the specified f
function.
Returns an effect that executes both this effect and the specified effect,
in parallel, combining their results with the specified f
function. If
either side fails, then the other side will be interrupted.
Symbolic alias for join
(Since version 1.0.0) use as
A
ZManaged[R, E, A]
is a managed resource of typeA
, which may be used by invoking theuse
method of the resource. The resource will be automatically acquired before the resource is used, and automatically released after the resource is used.Resources do not survive the scope of
use
, meaning that if you attempt to capture the resource, leak it fromuse
, and then use it after the resource has been consumed, the resource will not be valid anymore and may fail with some checked error, as per the type of the functions provided by the resource.