Returns an effectful function that extracts out the first element of a tuple.
Returns an effectful function that extracts out the second element of a tuple.
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
.
Evaluate each effect in the structure from left to right, and collect the results.
Evaluate each effect in the structure from left to right, and collect
the results. For a parallel version, see collectAllPar
.
Evaluate each effect in the structure in parallel, and collect the results.
Evaluate each effect in the structure in parallel, and collect
the results. For a sequential version, see collectAll
.
Evaluate each effect in the structure in parallel, and collect the results.
Evaluate each effect in the structure in parallel, and collect
the results. For a sequential version, see collectAll
.
Unlike CollectAllPar
, this method will use at most n
fibers.
Returns an effect that dies with the specified Throwable
.
Returns an effect that dies with the specified Throwable
.
This method can be used for terminating a fiber because a defect has been
detected in the code.
Returns an effect that dies with a java.lang.RuntimeException having the specified text message.
Returns an effect that dies with a java.lang.RuntimeException having the specified text message. This method can be used for terminating a fiber because a defect has been detected in the code.
Returns an effect from a zio.Exit value.
Lifts a by-name, pure value into a Managed.
Accesses the whole environment of the effect.
Returns an effect that models failure with the specified error.
Returns an effect that models failure with the specified error.
The moral equivalent of throw
for pure code.
Creates an effect that only executes the provided finalizer as its release action.
Creates an effect that only executes the provided function as its release action.
Creates an effect that executes a finalizer stored in a Ref.
Creates an effect that executes a finalizer stored in a Ref. The Ref
is yielded as the result of the effect, allowing for control flows that require
mutating finalizers.
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.
Applies the function f
to each element of the Iterable[A]
and
returns the results in a new List[B]
.
Applies the function f
to each element of the Iterable[A]
and
returns the results in a new List[B]
.
For a parallel version of this method, see foreachPar
.
Applies the function f
to each element of the Iterable[A]
in parallel,
and returns the results in a new List[B]
.
Applies the function f
to each element of the Iterable[A]
in parallel,
and returns the results in a new List[B]
.
For a sequential version of this method, see foreach
.
Applies the function f
to each element of the Iterable[A]
in parallel,
and returns the results in a new List[B]
.
Applies the function f
to each element of the Iterable[A]
in parallel,
and returns the results in a new List[B]
.
Unlike foreachPar
, this method will use at most up to n
fibers.
Applies the function f
to each element of the Iterable[A]
and runs
produced effects in parallel, discarding the results.
Applies the function f
to each element of the Iterable[A]
and runs
produced effects in parallel, discarding the results.
Unlike foreachPar_
, this method will use at most up to n
fibers.
Applies the function f
to each element of the Iterable[A]
and runs
produced effects in parallel, discarding the results.
Applies the function f
to each element of the Iterable[A]
and runs
produced effects in parallel, discarding the results.
For a sequential version of this method, see foreach_
.
Applies the function f
to each element of the Iterable[A]
and runs
produced effects sequentially.
Applies the function f
to each element of the Iterable[A]
and runs
produced effects sequentially.
Equivalent to foreach(as)(f).void
, but without the cost of building
the list of results.
Creates a ZManaged from an AutoCloseable
resource.
Creates a ZManaged from an AutoCloseable
resource. The resource's close
method will be used as the release action.
Lifts a ZIO[R, E, R] into ZManaged[R, E, R] with no release action.
Lifts a ZIO[R, E, R] into ZManaged[R, E, R] with no release action. Use with care.
Lifts an Either
into a ZManaged
value.
Lifts a function R => A
into a ZManaged[R, Nothing, A]
.
Lifts an effectful function whose effect requires no environment into an effect that requires the input to the function.
Returns an effect that models failure with the specified Cause
.
Returns the identity effectful function, which performs no effects
Returns an effect that is interrupted.
Lifts a ZIO[R, E, R]
into ZManaged[R, E, R]
with a release action.
Lifts a ZIO[R, E, R]
into ZManaged[R, E, R]
with a release action that handles Exit
.
Merges an Iterable[IO]
to a single IO, working sequentially.
Merges an Iterable[IO]
to a single IO, working in parallel.
Merges an Iterable[IO]
to a single IO, working in parallel.
Merges an Iterable[IO]
to a single IO, working in parallel.
Unlike mergeAllPar
, this method will use at most up to n
fibers.
This is not implemented in terms of ZIO.foreach / ZManaged.zipWithPar as otherwise all reservation phases would always run, causing unnecessary work
Returns a ZManaged
that never acquires a resource.
Reduces an Iterable[IO]
to a single IO
, working sequentially.
Reduces an Iterable[IO]
to a single IO
, working in parallel.
Reduces an Iterable[IO]
to a single IO
, working in parallel.
Reduces an Iterable[IO]
to a single IO
, working in parallel.
Unlike mergeAllPar
, this method will use at most up to n
fibers.
This is not implemented in terms of ZIO.foreach / ZManaged.zipWithPar as otherwise all reservation phases would always run, causing unnecessary work
Requires that the given ZManaged[E, Option[A]]
contain a value.
Requires that the given ZManaged[E, Option[A]]
contain a value. If there is no
value, then the specified error will be raised.
Lifts a pure Reservation[R, E, A]
into ZManaged[R, E, A]
Alias for ZManaged.collectAll
Alias for ZManaged.collectAllPar
Alias for ZManaged.collectAllParN
Lifts a strict, pure value into a Managed.
Returns a lazily constructed Managed.
Returns an effectful function that merely swaps the elements in a Tuple2
.
Alias for ZManaged.foreach
Alias for ZManaged.foreachPar
Alias for ZManaged.foreachParN
Alias for ZManaged.foreachParN_
Alias for ZManaged.foreachPar_
Alias for ZManaged.foreach_
Returns the effect resulting from mapping the success of this effect to unit.
The inverse operation to sandbox
.
The inverse operation to sandbox
. Submerges the full cause of failure.
Unwraps a ZManaged
that is inside a ZIO
.
The moral equivalent of if (p) exp
Runs an effect when the supplied PartialFunction
matches for the given value, otherwise does nothing.
Runs an effect when the supplied PartialFunction
matches for the given effectful value, otherwise does nothing.
The moral equivalent of if (p) exp
when p
has side-effects