ZSTM

zio.stm.ZSTM
See theZSTM companion trait
object ZSTM

Attributes

Companion
trait
Source
ZSTM.scala
Graph
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
ZSTM.type

Members list

Type members

Classlikes

final class Acquire[-R, +E, +A](acquire: () => ZSTM[R, E, A]) extends AnyVal

Attributes

Source
ZSTM.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class EnvironmentWithPartiallyApplied[R](dummy: Boolean = ...) extends AnyVal

Attributes

Source
ZSTM.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class EnvironmentWithSTMPartiallyApplied[R](dummy: Boolean = ...) extends AnyVal

Attributes

Source
ZSTM.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class IfSTM[R, E](b: ZSTM[R, E, Boolean])

Attributes

Source
ZSTM.scala
Supertypes
class Object
trait Matchable
class Any
final class Release[-R, +E, +A](acquire: () => ZSTM[R, E, A], release: A => URIO[R, Any])

Attributes

Source
ZSTM.scala
Supertypes
class Object
trait Matchable
class Any
final class ServiceAtPartiallyApplied[Service](dummy: Boolean = ...) extends AnyVal

Attributes

Source
ZSTM.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class ServiceWithPartiallyApplied[Service](dummy: Boolean = ...) extends AnyVal

Attributes

Source
ZSTM.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class ServiceWithSTMPartiallyApplied[Service](dummy: Boolean = ...) extends AnyVal

Attributes

Source
ZSTM.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class UnlessSTM[R, E](b: ZSTM[R, E, Boolean])

Attributes

Source
ZSTM.scala
Supertypes
class Object
trait Matchable
class Any
final class UpdateService[-R, +E, +A, M](self: ZSTM[R, E, A])

Attributes

Source
ZSTM.scala
Supertypes
class Object
trait Matchable
class Any
final class UpdateServiceAt[-R, +E, +A, Service](self: ZSTM[R, E, A]) extends AnyVal

Attributes

Source
ZSTM.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class WhenSTM[R, E](b: ZSTM[R, E, Boolean])

Attributes

Source
ZSTM.scala
Supertypes
class Object
trait Matchable
class Any

Inherited and Abstract types

The names of the product elements

The names of the product elements

Attributes

Inherited from:
Mirror
Source
Mirror.scala

The name of the type

The name of the type

Attributes

Inherited from:
Mirror
Source
Mirror.scala

Value members

Concrete methods

def absolve[R, E, A](z: ZSTM[R, E, Either[E, A]]): ZSTM[R, E, A]

Submerges the error case of an Either into the STM. The inverse operation of STM.either.

Submerges the error case of an Either into the STM. The inverse operation of STM.either.

Attributes

Source
ZSTM.scala
def acquireReleaseWith[R, E, A](acquire: ZSTM[R, E, A]): Acquire[R, E, A]

Treats the specified acquire transaction as the acquisition of a resource. The acquire transaction will be executed interruptibly. If it is a success and is committed the specified release workflow will be executed uninterruptibly as soon as the use workflow completes execution.

Treats the specified acquire transaction as the acquisition of a resource. The acquire transaction will be executed interruptibly. If it is a success and is committed the specified release workflow will be executed uninterruptibly as soon as the use workflow completes execution.

Attributes

Source
ZSTM.scala
def atomically[R, E, A](stm: ZSTM[R, E, A])(implicit trace: Trace): ZIO[R, E, A]

Atomically performs a batch of operations in a single transaction.

Atomically performs a batch of operations in a single transaction.

Attributes

Source
ZSTM.scala
def attempt[A](a: => A): STM[Throwable, A]

Creates an STM value from a partial (but pure) function.

Creates an STM value from a partial (but pure) function.

Attributes

Source
ZSTM.scala
def check[R](p: => Boolean): URSTM[R, Unit]

Checks the condition, and if it's true, returns unit, otherwise, retries.

Checks the condition, and if it's true, returns unit, otherwise, retries.

Attributes

Source
ZSTM.scala
def collect[R, E, A, B, Collection <: (Iterable)](in: Collection[A])(f: A => ZSTM[R, Option[E], B])(implicit bf: BuildFrom[Collection[A], B, Collection[B]]): ZSTM[R, E, Collection[B]]

Evaluate each effect in the structure from left to right, collecting the successful values and discarding the empty cases.

Evaluate each effect in the structure from left to right, collecting the successful values and discarding the empty cases.

Attributes

Source
ZSTM.scala
def collectAll[R, E, A, Collection <: (Iterable)](in: Collection[ZSTM[R, E, A]])(implicit bf: BuildFrom[Collection[ZSTM[R, E, A]], A, Collection[A]]): ZSTM[R, E, Collection[A]]

Collects all the transactional effects in a collection, returning a single transactional effect that produces a collection of values.

Collects all the transactional effects in a collection, returning a single transactional effect that produces a collection of values.

Attributes

Source
ZSTM.scala
def collectAll[R, E, A](in: Set[ZSTM[R, E, A]]): ZSTM[R, E, Set[A]]

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 set, returning a single transactional effect that produces a set of values.

Attributes

Source
ZSTM.scala
def collectAllDiscard[R, E, A](in: Iterable[ZSTM[R, E, A]]): ZSTM[R, E, Unit]

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.

Attributes

Source
ZSTM.scala
def collectFirst[R, E, A, B](as: Iterable[A])(f: A => ZSTM[R, E, Option[B]]): ZSTM[R, E, Option[B]]

Collects the first element of the Iterable[A] for which the effectual function f returns Some.

Collects the first element of the Iterable[A] for which the effectual function f returns Some.

Attributes

Source
ZSTM.scala
def cond[E, A](predicate: Boolean, result: => A, error: => E): STM[E, A]

Similar to Either.cond, evaluate the predicate, return the given A as success if predicate returns true, and the given E as error otherwise

Similar to Either.cond, evaluate the predicate, return the given A as success if predicate returns true, and the given E as error otherwise

Attributes

Source
ZSTM.scala
def die(t: => Throwable): USTM[Nothing]

Kills the fiber running the effect.

Kills the fiber running the effect.

Attributes

Source
ZSTM.scala
def dieMessage(m: => String): USTM[Nothing]

Kills the fiber running the effect with a RuntimeException that contains the specified message.

Kills the fiber running the effect with a RuntimeException that contains the specified message.

Attributes

Source
ZSTM.scala
def done[R, E, A](exit: => TExit[E, A]): ZSTM[R, E, A]

Returns a value modelled on provided exit status.

Returns a value modelled on provided exit status.

Attributes

Source
ZSTM.scala
def environment[R]: URSTM[R, ZEnvironment[R]]

Retrieves the environment inside an stm.

Retrieves the environment inside an stm.

Attributes

Source
ZSTM.scala

Accesses the environment of the transaction to perform a transaction.

Accesses the environment of the transaction to perform a transaction.

Attributes

Source
ZSTM.scala

Accesses the environment of the transaction to perform a transaction.

Accesses the environment of the transaction to perform a transaction.

Attributes

Source
ZSTM.scala
def exists[R, E, A](as: Iterable[A])(f: A => ZSTM[R, E, Boolean]): ZSTM[R, E, Boolean]

Determines whether any element of the Iterable[A] satisfies the effectual predicate f.

Determines whether any element of the Iterable[A] satisfies the effectual predicate f.

Attributes

Source
ZSTM.scala
def fail[E](e: => E): STM[E, Nothing]

Returns a value that models failure in the transaction.

Returns a value that models failure in the transaction.

Attributes

Source
ZSTM.scala
def filter[R, E, A, Collection <: (Iterable)](as: Collection[A])(f: A => ZSTM[R, E, Boolean])(implicit bf: BuildFrom[Collection[A], A, Collection[A]]): ZSTM[R, E, Collection[A]]

Filters the collection using the specified effectual predicate.

Filters the collection using the specified effectual predicate.

Attributes

Source
ZSTM.scala
def filter[R, E, A](as: Set[A])(f: A => ZSTM[R, E, Boolean]): ZSTM[R, E, Set[A]]

Filters the set using the specified effectual predicate.

Filters the set using the specified effectual predicate.

Attributes

Source
ZSTM.scala
def filterNot[R, E, A, Collection <: (Iterable)](as: Collection[A])(f: A => ZSTM[R, E, Boolean])(implicit bf: BuildFrom[Collection[A], A, Collection[A]]): ZSTM[R, E, Collection[A]]

Filters the collection 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.

Attributes

Source
ZSTM.scala
def filterNot[R, E, A](as: Set[A])(f: A => ZSTM[R, E, Boolean]): ZSTM[R, E, Set[A]]

Filters the set using the specified effectual predicate, removing all elements that satisfy the predicate.

Filters the set using the specified effectual predicate, removing all elements that satisfy the predicate.

Attributes

Source
ZSTM.scala
def flatten[R, E, A](tx: ZSTM[R, E, ZSTM[R, E, A]]): ZSTM[R, E, A]

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.

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.

Attributes

Source
ZSTM.scala
def foldLeft[R, E, S, A](in: Iterable[A])(zero: S)(f: (S, A) => ZSTM[R, E, S]): ZSTM[R, E, S]

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 left to right.

Attributes

Source
ZSTM.scala
def foldRight[R, E, S, A](in: Iterable[A])(zero: S)(f: (A, S) => ZSTM[R, E, S]): ZSTM[R, E, S]

Folds an Iterable[A] using an effectual function f, working sequentially from right to left.

Folds an Iterable[A] using an effectual function f, working sequentially from right to left.

Attributes

Source
ZSTM.scala
def forall[R, E, A](as: Iterable[A])(f: A => ZSTM[R, E, Boolean]): ZSTM[R, E, Boolean]

Determines whether all elements of the Iterable[A] satisfy the effectual predicate f.

Determines whether all elements of the Iterable[A] satisfy the effectual predicate f.

Attributes

Source
ZSTM.scala
def foreach[R, E, A, B, Collection <: (Iterable)](in: Collection[A])(f: A => ZSTM[R, E, B])(implicit bf: BuildFrom[Collection[A], B, Collection[B]]): ZSTM[R, E, Collection[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 Collection[A] and returns a transactional effect that produces a new Collection[B].

Attributes

Source
ZSTM.scala
def foreach[R, E, A, B](in: Set[A])(f: A => ZSTM[R, E, B]): ZSTM[R, E, Set[B]]

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 Set[A] and returns a transactional effect that produces a new Set[B].

Attributes

Source
ZSTM.scala
def foreachDiscard[R, E, A](in: Iterable[A])(f: A => ZSTM[R, E, Any]): ZSTM[R, E, Unit]

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.

Attributes

Source
ZSTM.scala
def fromEither[E, A](e: => Either[E, A]): STM[E, A]

Lifts an Either into a STM.

Lifts an Either into a STM.

Attributes

Source
ZSTM.scala
def fromOption[A](v: => Option[A]): STM[Option[Nothing], A]

Lifts an Option into a STM.

Lifts an Option into a STM.

Attributes

Source
ZSTM.scala
def fromTry[A](a: => Try[A]): TaskSTM[A]

Lifts a Try into a STM.

Lifts a Try into a STM.

Attributes

Source
ZSTM.scala
def ifSTM[R, E](b: ZSTM[R, E, Boolean]): IfSTM[R, E]

Runs onTrue if the result of b is true and onFalse otherwise.

Runs onTrue if the result of b is true and onFalse otherwise.

Attributes

Source
ZSTM.scala
def interruptAs(fiberId: => FiberId): USTM[Nothing]

Interrupts the fiber running the effect with the specified fiber id.

Interrupts the fiber running the effect with the specified fiber id.

Attributes

Source
ZSTM.scala
def iterate[R, E, S](initial: S)(cont: S => Boolean)(body: S => ZSTM[R, E, S]): ZSTM[R, E, S]

Iterates with the specified transactional function. The moral equivalent of:

Iterates with the specified transactional function. The moral equivalent of:

var s = initial

while (cont(s)) {
 s = body(s)
}

s

Attributes

Source
ZSTM.scala
def left[A](a: => A): USTM[Either[A, Nothing]]

Returns an effect with the value on the left part.

Returns an effect with the value on the left part.

Attributes

Source
ZSTM.scala
def loop[R, E, A, S](initial: S)(cont: S => Boolean, inc: S => S)(body: S => ZSTM[R, E, A]): ZSTM[R, E, List[A]]

Loops with the specified transactional function, collecting the results into a list. The moral equivalent of:

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

Attributes

Source
ZSTM.scala
def loopDiscard[R, E, S](initial: S)(cont: S => Boolean, inc: S => S)(body: S => ZSTM[R, E, Any]): ZSTM[R, E, Unit]

Loops with the specified transactional function purely for its transactional effects. The moral equivalent of:

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)
}

Attributes

Source
ZSTM.scala
def mergeAll[R, E, A, B](in: Iterable[ZSTM[R, E, A]])(zero: B)(f: (B, A) => B): ZSTM[R, E, B]

Merges an Iterable[ZSTM] to a single ZSTM, working sequentially.

Merges an Iterable[ZSTM] to a single ZSTM, working sequentially.

Attributes

Source
ZSTM.scala
def onCommit[R](zio: ZIO[R, Nothing, Any])(implicit trace: Trace): ZSTM[R, Nothing, Unit]

Executes the specified workflow when this transaction is committed.

Executes the specified workflow when this transaction is committed.

Attributes

Source
ZSTM.scala
def partition[R, E, A, B](in: Iterable[A])(f: A => ZSTM[R, E, B])(implicit ev: CanFail[E]): ZSTM[R, Nothing, (Iterable[E], Iterable[B])]

Feeds elements of type A to a function f that returns an effect. Collects all successes and failures in a tupled fashion.

Feeds elements of type A to a function f that returns an effect. Collects all successes and failures in a tupled fashion.

Attributes

Source
ZSTM.scala
def reduceAll[R, R1 <: R, E, A](a: ZSTM[R, E, A], as: Iterable[ZSTM[R1, E, A]])(f: (A, A) => A): ZSTM[R1, E, A]

Reduces an Iterable[ZSTM] to a single ZSTM, working sequentially.

Reduces an Iterable[ZSTM] to a single ZSTM, working sequentially.

Attributes

Source
ZSTM.scala
def replicate[R, E, A](n: Int)(tx: ZSTM[R, E, A]): Iterable[ZSTM[R, E, A]]

Replicates the given effect n times. If 0 or negative numbers are given, an empty Iterable will return.

Replicates the given effect n times. If 0 or negative numbers are given, an empty Iterable will return.

Attributes

Source
ZSTM.scala
def replicateSTM[R, E, A](n: Int)(transaction: ZSTM[R, E, A]): ZSTM[R, E, Iterable[A]]

Performs this transaction the specified number of times and collects the results.

Performs this transaction the specified number of times and collects the results.

Attributes

Source
ZSTM.scala
def replicateSTMDiscard[R, E, A](n: Int)(transaction: ZSTM[R, E, A]): ZSTM[R, E, Unit]

Performs this transaction the specified number of times, discarding the results.

Performs this transaction the specified number of times, discarding the results.

Attributes

Source
ZSTM.scala
def right[A](a: => A): USTM[Either[Nothing, A]]

Returns an effect with the value on the right part.

Returns an effect with the value on the right part.

Attributes

Source
ZSTM.scala
def service[A : Tag]: ZSTM[A, Nothing, A]

Accesses the specified service in the environment of the effect.

Accesses the specified service in the environment of the effect.

Attributes

Source
ZSTM.scala
def serviceAt[Service]: ServiceAtPartiallyApplied[Service]

Accesses the service corresponding to the specified key in the environment.

Accesses the service corresponding to the specified key in the environment.

Attributes

Source
ZSTM.scala
def serviceWith[Service]: ServiceWithPartiallyApplied[Service]

Effectfully accesses the specified service in the environment of the effect.

Effectfully accesses the specified service in the environment of the effect.

Attributes

Source
ZSTM.scala

Effectfully accesses the specified service in the environment of the effect.

Effectfully accesses the specified service in the environment of the effect.

Attributes

Source
ZSTM.scala
def some[A](a: => A): USTM[Option[A]]

Returns an effect with the optional value.

Returns an effect with the optional value.

Attributes

Source
ZSTM.scala
def succeed[A](a: => A): USTM[A]

Returns an STM effect that succeeds with the specified value.

Returns an STM effect that succeeds with the specified value.

Attributes

Source
ZSTM.scala
def suspend[R, E, A](stm: => ZSTM[R, E, A]): ZSTM[R, E, A]

Suspends creation of the specified transaction lazily.

Suspends creation of the specified transaction lazily.

Attributes

Source
ZSTM.scala
def unless[R, E, A](b: => Boolean)(stm: => ZSTM[R, E, A]): ZSTM[R, E, Option[A]]

The moral equivalent of if (!p) exp

The moral equivalent of if (!p) exp

Attributes

Source
ZSTM.scala
def unlessSTM[R, E](b: ZSTM[R, E, Boolean]): UnlessSTM[R, E]

The moral equivalent of if (!p) exp when p has side-effects

The moral equivalent of if (!p) exp when p has side-effects

Attributes

Source
ZSTM.scala
def validate[R, E, A, B, Collection <: (Iterable)](in: Collection[A])(f: A => ZSTM[R, E, B])(implicit bf: BuildFrom[Collection[A], B, Collection[B]], ev: CanFail[E]): ZSTM[R, ::[E], Collection[B]]

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.

Attributes

Source
ZSTM.scala
def validate[R, E, A, B](in: NonEmptyChunk[A])(f: A => ZSTM[R, E, B])(implicit ev: CanFail[E]): ZSTM[R, ::[E], NonEmptyChunk[B]]

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.

Attributes

Source
ZSTM.scala
def validateFirst[R, E, A, B, Collection <: (Iterable)](in: Collection[A])(f: A => ZSTM[R, E, B])(implicit bf: BuildFrom[Collection[A], E, Collection[E]], ev: CanFail[E]): ZSTM[R, Collection[E], B]

Feeds elements of type A to f until it succeeds. Returns first success or the accumulation of all errors.

Feeds elements of type A to f until it succeeds. Returns first success or the accumulation of all errors.

Attributes

Source
ZSTM.scala
def when[R, E, A](b: => Boolean)(stm: => ZSTM[R, E, A]): ZSTM[R, E, Option[A]]

The moral equivalent of if (p) exp

The moral equivalent of if (p) exp

Attributes

Source
ZSTM.scala
def whenCase[R, E, A, B](a: => A)(pf: PartialFunction[A, ZSTM[R, E, B]]): ZSTM[R, E, Option[B]]

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 value, otherwise does nothing.

Attributes

Source
ZSTM.scala
def whenCaseSTM[R, E, A, B](a: ZSTM[R, E, A])(pf: PartialFunction[A, ZSTM[R, E, B]]): ZSTM[R, E, Option[B]]

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.

Attributes

Source
ZSTM.scala
def whenSTM[R, E](b: ZSTM[R, E, Boolean]): WhenSTM[R, E]

The moral equivalent of if (p) exp when p has side-effects

The moral equivalent of if (p) exp when p has side-effects

Attributes

Source
ZSTM.scala

Concrete fields

Returns the fiber id of the fiber committing the transaction.

Returns the fiber id of the fiber committing the transaction.

Attributes

Source
ZSTM.scala
val interrupt: USTM[Nothing]

Interrupts the fiber running the effect.

Interrupts the fiber running the effect.

Attributes

Source
ZSTM.scala
val none: USTM[Option[Nothing]]

Returns an effect with the empty value.

Returns an effect with the empty value.

Attributes

Source
ZSTM.scala
val retry: USTM[Nothing]

Abort and retry the whole transaction when any of the underlying transactional variables have changed.

Abort and retry the whole transaction when any of the underlying transactional variables have changed.

Attributes

Source
ZSTM.scala
val unit: USTM[Unit]

Returns an STM effect that succeeds with Unit.

Returns an STM effect that succeeds with Unit.

Attributes

Source
ZSTM.scala