A finalizer used in a ReleaseMap.
A finalizer used in a ReleaseMap. The Exit value passed to it is the result of executing ZManaged#use or an arbitrary value passed into ReleaseMap#release.
A scope in which resources can be safely preallocated.
A scope in which resources can be safely preallocated. Passing a
ZManaged to the apply
method will create (inside an effect) a managed
resource which is already acquired and cannot fail.
A ReleaseMap
represents the finalizers associated with a scope.
A ReleaseMap
represents the finalizers associated with a scope.
The design of ReleaseMap
is inspired by ResourceT, written by Michael
Snoyman @snoyberg.
(https://github.com/snoyberg/conduit/blob/master/resourcet/Control/Monad/Trans/Resource/Internal.hs)
A scope in which ZManaged values can be safely allocated.
A scope in which ZManaged values can be safely allocated. Passing a
managed resource to the apply
method will return an effect that allocates
the resource and returns it with an early-release handle.
A ZManagedConstructor[Input]
knows how to construct a ZManaged
value
from an input of type Input
.
A ZManagedConstructor[Input]
knows how to construct a ZManaged
value
from an input of type Input
. This allows the type of the ZManaged
value
constructed to depend on Input
.
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
.
Lifts a ZIO[R, E, A]
into ZManaged[R, E, A]
with a release action that
does not need access to the resource.
Lifts a ZIO[R, E, A]
into ZManaged[R, E, A]
with a release action that
does not need access to the resource. The acquire and release actions will
be performed uninterruptibly.
Lifts a synchronous effect into ZManaged[R, Throwable, A]
with a release
action that does not need access to the resource.
Lifts a synchronous effect into ZManaged[R, Throwable, A]
with a release
action that does not need access to the resource. The acquire and release
actions will be performed uninterruptibly.
Lifts a synchronous effect into ZManaged[R, Throwable, A]
with a release
action.
Lifts a synchronous effect into ZManaged[R, Throwable, A]
with a release
action. The acquire and release actions will be performed uninterruptibly.
Lifts a ZIO[R, E, A]
into ZManaged[R, E, A]
with a release action that
does not need access to the resource but handles Exit
.
Lifts a ZIO[R, E, A]
into ZManaged[R, E, A]
with a release action that
does not need access to the resource but handles Exit
. The acquire and
release actions will be performed uninterruptibly.
Lifts a ZIO[R, E, A]
into ZManaged[R, E, A]
with a release action that
handles Exit
.
Lifts a ZIO[R, E, A]
into ZManaged[R, E, A]
with a release action that
handles Exit
. The acquire and release actions will be performed
uninterruptibly.
Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with a release action that does not require access to the resource.
Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with a release action that does not require access to the resource. The acquire action will be performed interruptibly, while release will be performed uninterruptibly.
Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with a release action.
Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with a release action. The acquire action will be performed interruptibly, while release will be performed uninterruptibly.
Lifts a synchronous effect that does not throw exceptions into a
ZManaged[Any, Nothing, A]
with a release action that does not need access
to the resource.
Lifts a synchronous effect that does not throw exceptions into a
ZManaged[Any, Nothing, A]
with a release action that does not need access
to the resource. The acquire and release actions will be performed
uninterruptibly.
Lifts a synchronous effect that does not throw exceptions into a
ZManaged[Any, Nothing, A]
with a release action.
Lifts a synchronous effect that does not throw exceptions into a
ZManaged[Any, Nothing, A]
with a release action. The acquire and release
actions will be performed uninterruptibly.
Lifts a ZIO[R, E, A]
into ZManaged[R, E, A]
with a release action.
Lifts a ZIO[R, E, A]
into ZManaged[R, E, A]
with a release action. The
acquire and release actions will be performed uninterruptibly.
Creates new ZManaged from a ZIO value that uses a ReleaseMap and returns a resource and a finalizer.
Creates new ZManaged from a ZIO value that uses a ReleaseMap and returns a resource and a finalizer.
The correct usage of this constructor consists of:
Lifts a synchronous side-effect into a ZManaged[R, Throwable, A]
,
translating any thrown exceptions into typed failed effects.
Evaluate each effect in the structure from left to right, collecting the the successful values and discarding the empty cases.
Evaluate each effect in the structure from left to right, collecting the
the successful values and discarding the empty cases. For a parallel
version, see collectPar
.
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 from left to right, and discard the results.
Evaluate each effect in the structure from left to right, and discard the
results. For a parallel version, see collectAllParDiscard
.
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 discard the results.
Evaluate each effect in the structure in parallel, and discard the results.
For a sequential version, see collectAllDiscard
.
Collects the first element of the Iterable[A]
for which the effectual
function f
returns Some
.
Evaluate each effect in the structure in parallel, collecting the the successful values and discarding the empty cases.
Similar to Either.cond, evaluate the predicate, return the given A as success if predicate returns true, and the given E as error otherwise
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 lazily evaluated zio.Exit value.
Accesses the whole environment of the effect.
Create a managed that accesses the environment.
Create a managed that accesses the environment.
Create a managed that accesses the environment.
Determines whether any element of the Iterable[A]
satisfies the effectual
predicate f
.
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.
Returns an effect that models failure with the specified Cause
.
Returns an effect that succeeds with the FiberId
of the caller.
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 a managed resource that attempts to acquire the first managed resource and in case of failure, attempts to acquire each of the specified managed resources in order until one of them is successfully acquired, ensuring that the acquired resource is properly released after being used.
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.
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.
Folds an Iterable[A] using an effectual function f, working sequentially from left to right.
Determines whether all elements of the Iterable[A]
satisfy the effectual
predicate f
.
Applies the function f
if the argument is non-empty and returns the
results in a new Option[A2]
.
Applies the function f
to each element of the Collection[A]
and returns
the results in a new Collection[B]
.
Applies the function f
to each element of the Collection[A]
and returns
the results in a new Collection[B]
.
For a parallel version of this method, see foreachPar
. If you do not need
the results, see foreachDiscard
for a more efficient implementation.
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).unit
, but without the cost of building the
list of results.
Applies the function f
to each element of the Collection[A]
and returns
the result in a new Collection[B]
using the specified execution strategy.
Applies the function f
to each element of the Collection[A]
in
parallel, and returns the results in a new Collection[B]
.
Applies the function f
to each element of the Collection[A]
in
parallel, and returns the results in a new Collection[B]
.
For a sequential version of this method, see foreach
.
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 foreachDiscard
.
Constructs a ZManaged
value of the appropriate type for the specified
input.
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 an Either
into a ZManaged
value.
Lifts an Option
into a ZManaged
but preserves the error as an option in
the error channel, making it easier to compose in some scenarios.
Lifts a pure Reservation[R, E, A]
into ZManaged[R, E, A]
.
Lifts a pure Reservation[R, E, A]
into ZManaged[R, E, A]
. The
acquisition step is performed interruptibly.
Creates a ZManaged from a Reservation produced by an effect.
Creates a ZManaged from a Reservation produced by an effect. Evaluating the effect that produces the reservation will be performed *uninterruptibly*, while the acquisition step of the reservation will be performed *interruptibly*. The release step will be performed uninterruptibly as usual.
This two-phase acquisition allows for resource acquisition flows that can be safely interrupted and released.
Lifts a Try
into a ZManaged
.
Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with no release action.
Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with no release action. The effect will be performed interruptibly.
Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with no release action.
Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with no release action. The effect will be performed uninterruptibly. You usually want the ZManaged.fromZIO variant.
Runs onTrue
if the result of b
is true
and onFalse
otherwise.
Returns an effect that is interrupted as if by the fiber calling this method.
Returns an effect that is interrupted as if by the specified fiber.
Iterates with the specified effectual function.
Iterates with the specified effectual function. The moral equivalent of:
var s = initial while (cont(s)) { s = body(s) } s
Returns a managed effect that describes shifting to the specified executor
as the acquire
action and shifting back to the original executor as the
release
action.
Loops with the specified effectual function, collecting the results into a list.
Loops with the specified effectual function, collecting the results into a list. The moral equivalent of:
var s = initial var as = List.empty[A] while (cont(s)) { as = body(s) :: as s = inc(s) } as.reverse
Loops with the specified effectual function purely for its effects.
Loops with the specified effectual function purely for its effects. The moral equivalent of:
var s = initial while (cont(s)) { body(s) s = inc(s) }
Returns a memoized version of the specified resourceful function in the context of a managed scope.
Returns a memoized version of the specified resourceful function in the context of a managed scope. Each time the memoized function is evaluated a new resource will be acquired, if the function has not already been evaluated with that input, or else the previously acquired resource will be returned. All resources acquired by evaluating the function will be released at the end of the scope.
Merges an Iterable[ZManaged]
to a single ZManaged
, working
sequentially.
Merges an Iterable[ZManaged]
to a single ZManaged
, working in parallel.
Merges an Iterable[ZManaged]
to a single ZManaged
, working in parallel.
Due to the parallel nature of this combinator, f
must be both:
f(a, b) == f(b, a)
f(a, f(b, c)) == f(f(a, b), c)
Returns a ZManaged
that never acquires a resource.
Returns a ZManaged
with the empty value.
Returns a managed effect that describes shifting to the specified executor
as the acquire
action and shifting back to the original executor as the
release
action.
Retrieves the maximum number of fibers for parallel operators or None
if
it is unbounded.
Creates a scope in which resources can be safely preallocated.
Reduces an Iterable[IO]
to a single IO
, working sequentially.
Reduces an Iterable[IO]
to a single IO
, working in parallel.
Provides access to the entire map of resources allocated by this ZManaged.
Returns an ZManaged that accesses the runtime, which can be used to (unsafely) execute tasks.
Returns an ZManaged that accesses the runtime, which can be used to (unsafely) execute tasks. This is useful for integration with legacy code that must call back into ZIO code.
Creates a scope in which resources can be safely allocated into together with a release action.
Accesses the specified service in the environment of the effect.
Accesses the service corresponding to the specified key in the environment.
Accesses the specified service in the environment of the effect.
Accesses the specified service in the environment of the effect.
def foo(int: Int) = ZManaged.serviceWith[Foo](_.foo(int))
Effectfully accesses the specified managed service in the environment of the effect .
Effectfully accesses the specified managed service in the environment of the effect .
Especially useful for creating "accessor" methods on Services' companion objects accessing managed resources.
trait Foo { def start(): ZManaged[Any, Nothing, Unit] } def start: ZManaged[Foo, Nothing, Unit] = ZManaged.serviceWithManaged[Foo](_.start())
Effectfully accesses the specified service in the environment of the effect.
Effectfully accesses the specified service in the environment of the effect.
def foo(int: Int) = ZManaged.serviceWith[Foo](_.foo(int))
Returns a managed effect that describes shifting to the specified executor
as the acquire
action with no release action.
Returns an effect with the optional value.
Lifts a lazy, pure value into a Managed.
Returns a lazily constructed Managed.
Returns a ZManaged value that represents a managed resource that can be safely swapped within the scope of the ZManaged.
Returns a ZManaged value that represents a managed resource that can be safely swapped within the scope of the ZManaged. The function provided inside the ZManaged can be used to switch the resource currently in use.
When the resource is switched, the finalizer for the previous finalizer will be executed uninterruptibly. If the effect executing inside the ZManaged#use is interrupted, the finalizer for the resource currently in use is guaranteed to execute.
This constructor can be used to create an expressive control flow that uses several instances of a managed resource. For example:
def makeWriter: Task[FileWriter] trait FileWriter { def write(data: Int): Task[Unit] def close: UIO[Unit] } val elements = List(1, 2, 3, 4) val writingProgram = ZManaged.switchable[Any, Throwable, FileWriter].use { switchWriter => ZIO.foreachDiscard(elements) { element => for { writer <- switchWriter(makeWriter.toManaged(_.close)) _ <- writer.write(element) } yield () } }
Returns the effect resulting from mapping the success of this effect to unit.
The moral equivalent of if (!p) exp
The moral equivalent of if (!p) exp
when p
has side-effects
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
Locally installs a supervisor and an effect that succeeds with all the children that have been forked in the returned effect.
Returns a managed effect that describes setting the specified maximum
number of fibers for parallel operators as the acquire
action and setting
it back to the original value as the release
action.
Returns a managed effect that describes setting an unbounded maximum number
of fibers for parallel operators as the acquire
action and setting it
back to the original value as the release
action.
Returns a managed effect that describes setting the runtime configuration
to the specified value as the acquire
action and setting it back to the
original runtime configuration as the release
action.
Create a managed that accesses the environment.
Create a managed that accesses the environment.
(Since version 2.0.0) use environmentWith
Create a managed that accesses the environment.
Create a managed that accesses the environment.
(Since version 2.0.0) use environmentWithZIO
Create a managed that accesses the environment.
Create a managed that accesses the environment.
(Since version 2.0.0) use environmentWithManaged
Create a managed that accesses the environment.
Create a managed that accesses the environment.
(Since version 2.0.0) use environmentWithZIO
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.
(Since version 2.0.0) use collectAllPar
Evaluate each effect in the structure in parallel, and discard the results.
Evaluate each effect in the structure in parallel, and discard the results.
For a sequential version, see collectAllDiscard
.
Unlike collectAllParDiscard
, this method will use at most n
fibers.
(Since version 2.0.0) use collectAllParDiscard
Evaluate each effect in the structure in parallel, and discard the results.
Evaluate each effect in the structure in parallel, and discard the results.
For a sequential version, see collectAll_
.
Unlike CollectAllPar_
, this method will use at most n
fibers.
(Since version 2.0.0) use collectAllParDiscard
Evaluate each effect in the structure in parallel, and discard the results.
Evaluate each effect in the structure in parallel, and discard the results.
For a sequential version, see collectAll_
.
(Since version 2.0.0) use collectAllParDiscard
Evaluate each effect in the structure from left to right, and discard the results.
Evaluate each effect in the structure from left to right, and discard the
results. For a parallel version, see collectAllPar_
.
(Since version 2.0.0) use collectAllDiscard
Evaluate each effect in the structure in parallel, collecting the the successful values and discarding the empty cases.
Evaluate each effect in the structure in parallel, collecting the the successful values and discarding the empty cases.
Unlike collectPar
, this method will use at most up to n
fibers.
(Since version 2.0.0) use collectAllPar
Lifts a synchronous side-effect into a ZManaged[R, Throwable, A]
,
translating any thrown exceptions into typed failed effects.
Lifts a synchronous side-effect into a ZManaged[R, Throwable, A]
,
translating any thrown exceptions into typed failed effects.
(Since version 2.0.0) use attempt
Lifts a by-name, pure value into a Managed.
Lifts a by-name, pure value into a Managed.
(Since version 2.0.0) use succeed
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.
(Since version 2,0.0) use flattenZIO
Applies the function f
to each element of the Collection[A]
in
parallel, and returns the results in a new Collection[B]
.
Applies the function f
to each element of the Collection[A]
in
parallel, and returns the results in a new Collection[B]
.
Unlike foreachPar
, this method will use at most up to n
fibers.
(Since version 2.0.0) use foreachPar
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 foreachParDiscard
, this method will use at most up to n
fibers.
(Since version 2.0.0) use foreachParDiscard
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.
(Since version 2.0.0) use foreachParDiscard
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_
.
(Since version 2.0.0) use foreachParDiscard
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).unit
, but without the cost of building the
list of results.
(Since version 2.0.0) use foreachDiscard
Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with no release action.
Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with no release action. The effect will be performed interruptibly.
(Since version 2.0.0) use fromZIO
Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with no release action.
Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with no release action. The effect will be performed uninterruptibly. You usually want the ZManaged.fromZIO variant.
(Since version 2.0.0) use fromZIOUninterruptible
Lifts a function R => A
into a ZManaged[R, Nothing, A]
.
Lifts a function R => A
into a ZManaged[R, Nothing, A]
.
(Since version 2.0.0) use access
Lifts an effectful function whose effect requires no environment into an effect that requires the input to the function.
Lifts an effectful function whose effect requires no environment into an effect that requires the input to the function.
(Since version 2.0.0) use environmentWithZIOManaged
Returns an effect that models failure with the specified Cause
.
Returns an effect that models failure with the specified Cause
.
(Since version 2.0.0) use failCause
Runs onTrue
if the result of b
is true
and onFalse
otherwise.
Runs onTrue
if the result of b
is true
and onFalse
otherwise.
(Since version 2.0.0) use ifManaged
Loops with the specified effectual function purely for its effects.
Loops with the specified effectual function purely for its effects. The moral equivalent of:
var s = initial while (cont(s)) { body(s) s = inc(s) }
(Since version 2.0.0) use loopDiscard
Lifts a ZIO[R, E, A]
into ZManaged[R, E, A]
with a release action.
Lifts a ZIO[R, E, A]
into ZManaged[R, E, A]
with a release action. The
acquire and release actions will be performed uninterruptibly.
(Since version 2.0.0) use acquireReleaseWith
Lifts a synchronous effect into ZManaged[R, Throwable, A]
with a release
action.
Lifts a synchronous effect into ZManaged[R, Throwable, A]
with a release
action. The acquire and release actions will be performed uninterruptibly.
(Since version 2.0.0) use acquireReleaseAttemptWith
Lifts a synchronous effect that does not throw exceptions into a
ZManaged[Any, Nothing, A]
with a release action.
Lifts a synchronous effect that does not throw exceptions into a
ZManaged[Any, Nothing, A]
with a release action. The acquire and release
actions will be performed uninterruptibly.
(Since version 2.0.0) use acquireReleaseSucceedWith
Lifts a synchronous effect that does not throw exceptions into a
ZManaged[Any, Nothing, A]
with a release action that does not need access
to the resource.
Lifts a synchronous effect that does not throw exceptions into a
ZManaged[Any, Nothing, A]
with a release action that does not need access
to the resource. The acquire and release actions will be performed
uninterruptibly.
(Since version 2.0.0) use acquireReleaseSucceed
Lifts a synchronous effect into ZManaged[R, Throwable, A]
with a release
action that does not need access to the resource.
Lifts a synchronous effect into ZManaged[R, Throwable, A]
with a release
action that does not need access to the resource. The acquire and release
actions will be performed uninterruptibly.
(Since version 2.0.0) use acquireReleaseAttempt
Lifts a ZIO[R, E, A]
into ZManaged[R, E, A]
with a release action that
handles Exit
.
Lifts a ZIO[R, E, A]
into ZManaged[R, E, A]
with a release action that
handles Exit
. The acquire and release actions will be performed
uninterruptibly.
(Since version 2.0.0) use acquireReleaseExitWith
Lifts a ZIO[R, E, A]
into ZManaged[R, E, A]
with a release action that
does not need access to the resource but handles Exit
.
Lifts a ZIO[R, E, A]
into ZManaged[R, E, A]
with a release action that
does not need access to the resource but handles Exit
. The acquire and
release actions will be performed uninterruptibly.
(Since version 2.0.0) use acquireReleaseExit
Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with a release action.
Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with a release action. The acquire action will be performed interruptibly, while release will be performed uninterruptibly.
(Since version 2.0.0) use acquireReleaseInterruptibleWith
Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with a release action that does not require access to the resource.
Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with a release action that does not require access to the resource. The acquire action will be performed interruptibly, while release will be performed uninterruptibly.
(Since version 2.0.0) use acquireReleaseInterruptible
Creates a ZManaged from a Reservation produced by an effect.
Creates a ZManaged from a Reservation produced by an effect. Evaluating the effect that produces the reservation will be performed *uninterruptibly*, while the acquisition step of the reservation will be performed *interruptibly*. The release step will be performed uninterruptibly as usual.
This two-phase acquisition allows for resource acquisition flows that can be safely interrupted and released.
(Since version 2.0.0) use fromReservationZIO
Lifts a ZIO[R, E, A]
into ZManaged[R, E, A]
with a release action that
does not need access to the resource.
Lifts a ZIO[R, E, A]
into ZManaged[R, E, A]
with a release action that
does not need access to the resource. The acquire and release actions will
be performed uninterruptibly.
(Since version 2.0.0) use acquireRelease
Sequentially zips the specified effects using the specified combiner function.
Sequentially zips the specified effects using the specified combiner function.
(Since version 2.0.0) use zip
Sequentially zips the specified effects using the specified combiner function.
Sequentially zips the specified effects using the specified combiner function.
(Since version 2.0.0) use zip
Sequentially zips the specified effects using the specified combiner function.
Sequentially zips the specified effects using the specified combiner function.
(Since version 2.0.0) use zip
Returns an effect that executes the specified effects in parallel,
combining their results with the specified f
function.
Returns an effect that executes the specified effects in parallel,
combining their results with the specified f
function. If any effect
fails, then the other effects will be interrupted.
(Since version 2.0.0) use zipPar
Returns an effect that executes the specified effects in parallel,
combining their results with the specified f
function.
Returns an effect that executes the specified effects in parallel,
combining their results with the specified f
function. If any effect
fails, then the other effects will be interrupted.
(Since version 2.0.0) use zipPar
Returns an effect that executes the specified effects in parallel,
combining their results with the specified f
function.
Returns an effect that executes the specified effects in parallel,
combining their results with the specified f
function. If any effect
fails, then the other effects will be interrupted.
(Since version 2.0.0) use zipPar
Merges an Iterable[ZManaged]
to a single ZManaged
, working in parallel.
Merges an Iterable[ZManaged]
to a single ZManaged
, working in parallel.
Due to the parallel nature of this combinator, f
must be both:
f(a, b) == f(b, a)
f(a, f(b, c)) == f(f(a, b), c)
Unlike mergeAllPar
, this method will use at most up to n
fibers.
(Since version 2.0.0) use mergeAllPar
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
(Since version 2.0.0) use reduceAllPar
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.
(Since version 2.0.0) use someOrFail
Lifts a pure Reservation[R, E, A]
into ZManaged[R, E, A]
.
Lifts a pure Reservation[R, E, A]
into ZManaged[R, E, A]
. The
acquisition step is performed interruptibly.
(Since version 2.0.0) use fromReservation
Accesses the specified services in the environment of the effect.
Accesses the specified services in the environment of the effect.
(Since version 2.0.0) use service
Accesses the specified services in the environment of the effect.
Accesses the specified services in the environment of the effect.
(Since version 2.0.0) use service
Accesses the specified services in the environment of the effect.
Accesses the specified services in the environment of the effect.
(Since version 2.0.0) use service
The moral equivalent of if (!p) exp
when p
has side-effects
The moral equivalent of if (!p) exp
when p
has side-effects
(Since version 2.0.0) use unlessManaged
Runs an effect when the supplied PartialFunction
matches for the given
effectful value, otherwise does nothing.
Runs an effect when the supplied PartialFunction
matches for the given
effectful value, otherwise does nothing.
(Since version 2.0.0) use whenCaseManaged
The moral equivalent of if (p) exp
when p
has side-effects
The moral equivalent of if (p) exp
when p
has side-effects
(Since version 2.0.0) use whenManaged