Submerges the error case of an Either
into the STM
.
Submerges the error case of an Either
into the STM
. The inverse
operation of STM.either
.
Atomically performs a batch of operations in a single transaction.
Creates an STM
value from a partial (but pure) function.
Checks the condition, and if it's true, returns unit, otherwise, retries.
Evaluate each effect in the structure from left to right, collecting the the successful values and discarding the empty cases.
Collects all the transactional effects in a set, returning a single transactional effect that produces a set of values.
Collects all the transactional effects in a collection, returning a single transactional effect that produces a collection of values.
Collects all the transactional effects, returning a single transactional
effect that produces Unit
.
Collects all the transactional effects, returning a single transactional
effect that produces Unit
.
Equivalent to collectAll(i).unit
, but without the cost of building the
list of results.
Collects the first element of the Iterable[A]
for which the effectual
function f
returns Some
.
Similar to Either.cond, evaluate the predicate, return the given A as success if predicate returns true, and the given E as error otherwise
Kills the fiber running the effect.
Kills the fiber running the effect with a RuntimeException
that contains
the specified message.
Returns a value modelled on provided exit status.
Retrieves the environment inside an stm.
Accesses the environment of the transaction to perform a transaction.
Accesses the environment of the transaction to perform a transaction.
Determines whether any element of the Iterable[A]
satisfies the effectual
predicate f
.
Returns a value that models failure in the transaction.
Returns the fiber id of the fiber committing the transaction.
Filters the set using the specified effectual predicate.
Filters the collection using the specified effectual predicate.
Filters the set using the specified effectual predicate, removing all elements that satisfy the predicate.
Filters the collection using the specified effectual predicate, removing all elements that satisfy the predicate.
Returns an effect that first executes the outer effect, and then executes the inner effect, returning the value from the inner effect, and effectively flattening a nested effect.
Folds an Iterable[A] using an effectual function f, working sequentially from left to right.
Folds an Iterable[A] using an effectual function f, working sequentially from right to left.
Determines whether all elements of the Iterable[A]
satisfy the effectual
predicate f
.
Applies the function f
to each element of the Set[A]
and returns a
transactional effect that produces a new Set[B]
.
Applies the function f
to each element of the Collection[A]
and returns
a transactional effect that produces a new Collection[B]
.
Applies the function f
to each element of the Iterable[A]
and returns a
transactional effect that produces Unit
.
Applies the function f
to each element of the Iterable[A]
and returns a
transactional effect that produces Unit
.
Equivalent to foreach(as)(f).unit
, but without the cost of building the
list of results.
Lifts an Either
into a STM
.
Lifts an Option
into a STM
.
Lifts a Try
into a STM
.
Runs onTrue
if the result of b
is true
and onFalse
otherwise.
Interrupts the fiber running the effect.
Interrupts the fiber running the effect with the specified fiber id.
Iterates with the specified transactional function.
Iterates with the specified transactional function. The moral equivalent of:
var s = initial while (cont(s)) { s = body(s) } s
Returns an effect with the value on the left part.
Loops with the specified transactional function, collecting the results into a list.
Loops with the specified transactional 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 transactional function purely for its transactional effects.
Loops with the specified transactional function purely for its transactional effects. The moral equivalent of:
var s = initial while (cont(s)) { body(s) s = inc(s) }
Merges an Iterable[ZSTM]
to a single ZSTM, working sequentially.
Returns an effect with the empty value.
Feeds elements of type A
to a function f
that returns an effect.
Feeds elements of type A
to a function f
that returns an effect.
Collects all successes and failures in a tupled fashion.
Reduces an Iterable[ZSTM]
to a single ZSTM
, working sequentially.
Replicates the given effect n times.
Replicates the given effect n times. If 0 or negative numbers are given, an
empty Iterable
will return.
Performs this transaction the specified number of times and collects the results.
Performs this transaction the specified number of times, discarding the results.
Abort and retry the whole transaction when any of the underlying transactional variables have changed.
Returns an effect with the value on the right part.
Accesses the specified service in the environment of the effect.
Accesses the service corresponding to the specified key in the environment.
Effectfully accesses the specified service in the environment of the effect.
Effectfully accesses the specified service in the environment of the effect.
Returns an effect with the optional value.
Returns an STM
effect that succeeds with the specified value.
Suspends creation of the specified transaction lazily.
Returns an STM
effect that succeeds with Unit
.
The moral equivalent of if (!p) exp
The moral equivalent of if (!p) exp
when p
has side-effects
Feeds elements of type A
to f
and accumulates all errors in error
channel or successes in success channel.
Feeds elements of type A
to f
and accumulates all errors in error
channel or successes in success channel.
This combinator is lossy meaning that if there are errors all successes will be lost. To retain all information please use partition.
Feeds elements of type A
to f
and accumulates all errors in error
channel or successes in success channel.
Feeds elements of type A
to f
and accumulates all errors in error
channel or successes in success channel.
This combinator is lossy meaning that if there are errors all successes will be lost. To retain all information please use partition.
Feeds elements of type A
to f
until it succeeds.
Feeds elements of type A
to f
until it succeeds. Returns first success
or the accumulation of all errors.
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
Accesses the environment of the transaction.
Accesses the environment of the transaction.
(Since version 2.0.0) use environmentWith
Accesses the environment of the transaction to perform a transaction.
Accesses the environment of the transaction to perform a transaction.
(Since version 2.0.0) use environmentWithSTM
Accesses the environment of the transaction to perform a transaction.
Accesses the environment of the transaction to perform a transaction.
(Since version 2.0.0) use environmentWithSTM
Collects all the transactional effects, returning a single transactional
effect that produces Unit
.
Collects all the transactional effects, returning a single transactional
effect that produces Unit
.
Equivalent to collectAll(i).unit
, but without the cost of building the
list of results.
(Since version 2.0.0) use collectAllDiscard
Applies the function f
to each element of the Iterable[A]
and returns a
transactional effect that produces Unit
.
Applies the function f
to each element of the Iterable[A]
and returns a
transactional effect that produces Unit
.
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 function R => A
into a URSTM[R, A]
.
Lifts a function R => A
into a URSTM[R, 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 environmentWithZIO
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 ifSTM
Loops with the specified transactional function purely for its transactional effects.
Loops with the specified transactional function purely for its transactional effects. The moral equivalent of:
var s = initial while (cont(s)) { body(s) s = inc(s) }
(Since version 2.0.0) use loopDiscard
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
Creates an STM
value from a partial (but pure) function.
Creates an STM
value from a partial (but pure) function.
(Since version 2.0.0) use attempt
Performs this transaction the specified number of times and collects the results.
Performs this transaction the specified number of times and collects the results.
(Since version 2.0.0) use replicateSTM
Performs this transaction the specified number of times, discarding the results.
Performs this transaction the specified number of times, discarding the results.
(Since version 2.0.0) use replicateSTMDiscard
Requires that the given ZSTM[R, E, Option[A]]
contain a value.
Requires that the given ZSTM[R, 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
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 unlessSTM
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 whenCaseSTM
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 whenSTM