Trait/Object

zio.stm

ZSTM

Related Docs: object ZSTM | package stm

Permalink

sealed trait ZSTM[-R, +E, +A] extends Serializable

STM[E, A] represents an effect that can be performed transactionally, resulting in a failure E or a value A.

def transfer(receiver: TRef[Int],
              sender: TRef[Int], much: Int): UIO[Int] =
  STM.atomically {
    for {
      balance <- sender.get
      _       <- STM.check(balance >= much)
      _       <- receiver.update(_ + much)
      _       <- sender.update(_ - much)
      newAmnt <- receiver.get
    } yield newAmnt
  }

  val action: UIO[Int] =
    for {
      t <- STM.atomically(TRef.make(0).zip(TRef.make(20000)))
      (receiver, sender) = t
      balance <- transfer(receiver, sender, 1000)
    } yield balance

Software Transactional Memory is a technique which allows composition of arbitrary atomic operations. It is the software analog of transactions in database systems.

The API is lifted directly from the Haskell package Control.Concurrent.STM although the implementation does not resemble the Haskell one at all. http://hackage.haskell.org/package/stm-2.5.0.0/docs/Control-Concurrent-STM.html

STM in Haskell was introduced in: Composable memory transactions, by Tim Harris, Simon Marlow, Simon Peyton Jones, and Maurice Herlihy, in ACM Conference on Principles and Practice of Parallel Programming 2005. https://www.microsoft.com/en-us/research/publication/composable-memory-transactions/

See also: Lock Free Data Structures using STMs in Haskell, by Anthony Discolo, Tim Harris, Simon Marlow, Simon Peyton Jones, Satnam Singh) FLOPS 2006: Eighth International Symposium on Functional and Logic Programming, Fuji Susono, JAPAN, April 2006 https://www.microsoft.com/en-us/research/publication/lock-free-data-structures-using-stms-in-haskell/

Self Type
ZSTM[R, E, A]
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ZSTM
  2. Serializable
  3. Serializable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def tag: Int

    Permalink

Concrete Value Members

  1. final def !(implicit ev: <:<[E, Throwable], ev2: CanFail[E]): ZSTM[R, Nothing, A]

    Permalink

    A symbolic alias for orDie.

  2. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  4. def *>[R1 <: R, E1 >: E, B](that: ⇒ ZSTM[R1, E1, B]): ZSTM[R1, E1, B]

    Permalink

    Sequentially zips this value with the specified one, discarding the first element of the tuple.

  5. def <*[R1 <: R, E1 >: E, B](that: ⇒ ZSTM[R1, E1, B]): ZSTM[R1, E1, A]

    Permalink

    Sequentially zips this value with the specified one, discarding the second element of the tuple.

  6. def <*>[R1 <: R, E1 >: E, B](that: ⇒ ZSTM[R1, E1, B])(implicit zippable: Zippable[A, B]): ZSTM[R1, E1, Out]

    Permalink

    Sequentially zips this value with the specified one.

  7. def <+>[R1 <: R, E1, B](that: ⇒ ZSTM[R1, E1, B]): ZSTM[R1, E1, Either[A, B]]

    Permalink

    A symbolic alias for orElseEither.

  8. def <>[R1 <: R, E1, A1 >: A](that: ⇒ ZSTM[R1, E1, A1]): ZSTM[R1, E1, A1]

    Permalink

    Tries this effect first, and if it fails or retries, tries the other effect.

  9. def <|>[R1 <: R, E1 >: E, A1 >: A](that: ⇒ ZSTM[R1, E1, A1]): ZSTM[R1, E1, A1]

    Permalink

    Tries this effect first, and if it enters retry, then it tries the other effect.

    Tries this effect first, and if it enters retry, then it tries the other effect. This is an equivalent of haskell's orElse.

  10. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  11. def absolve[E1 >: E, B](implicit ev: <:<[A, Either[E1, B]]): ZSTM[R, E1, B]

    Permalink

    Returns an effect that submerges the error case of an Either into the STM.

    Returns an effect that submerges the error case of an Either into the STM. The inverse operation of STM.either.

  12. def as[B](b: ⇒ B): ZSTM[R, E, B]

    Permalink

    Maps the success value of this effect to the specified constant value.

  13. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  14. def asSome: ZSTM[R, E, Option[A]]

    Permalink

    Maps the success value of this effect to an optional value.

  15. def asSomeError: ZSTM[R, Option[E], A]

    Permalink

    Maps the error value of this effect to an optional value.

  16. def catchAll[R1 <: R, E2, A1 >: A](h: (E) ⇒ ZSTM[R1, E2, A1])(implicit ev: CanFail[E]): ZSTM[R1, E2, A1]

    Permalink

    Recovers from all errors.

  17. def catchSome[R1 <: R, E1 >: E, A1 >: A](pf: PartialFunction[E, ZSTM[R1, E1, A1]])(implicit ev: CanFail[E]): ZSTM[R1, E1, A1]

    Permalink

    Recovers from some or all of the error cases.

  18. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. def collect[B](pf: PartialFunction[A, B]): ZSTM[R, E, B]

    Permalink

    Simultaneously filters and maps the value produced by this effect.

  20. def collectSTM[R1 <: R, E1 >: E, B](pf: PartialFunction[A, ZSTM[R1, E1, B]]): ZSTM[R1, E1, B]

    Permalink

    Simultaneously filters and flatMaps the value produced by this effect.

    Simultaneously filters and flatMaps the value produced by this effect. Continues on the effect returned from pf.

  21. def commit(implicit trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Commits this transaction atomically.

  22. def commitEither(implicit trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Commits this transaction atomically, regardless of whether the transaction is a success or a failure.

  23. def either(implicit ev: CanFail[E]): URSTM[R, Either[E, A]]

    Permalink

    Converts the failure channel into an Either.

  24. def ensuring[R1 <: R](finalizer: ZSTM[R1, Nothing, Any]): ZSTM[R1, E, A]

    Permalink

    Executes the specified finalization transaction whether or not this effect succeeds.

    Executes the specified finalization transaction whether or not this effect succeeds. Note that as with all STM transactions, if the full transaction fails, everything will be rolled back.

  25. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  26. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  27. def eventually(implicit ev: CanFail[E]): URSTM[R, A]

    Permalink

    Returns an effect that ignores errors and runs repeatedly until it eventually succeeds.

  28. def filterOrDie(p: (A) ⇒ Boolean)(t: ⇒ Throwable): ZSTM[R, E, A]

    Permalink

    Dies with specified Throwable if the predicate fails.

  29. def filterOrDieMessage(p: (A) ⇒ Boolean)(msg: ⇒ String): ZSTM[R, E, A]

    Permalink

    Dies with a java.lang.RuntimeException having the specified text message if the predicate fails.

  30. def filterOrElse[R1 <: R, E1 >: E, A1 >: A](p: (A) ⇒ Boolean)(zstm: ⇒ ZSTM[R1, E1, A1]): ZSTM[R1, E1, A1]

    Permalink

    Supplies zstm if the predicate fails.

  31. def filterOrElseWith[R1 <: R, E1 >: E, A1 >: A](p: (A) ⇒ Boolean)(f: (A) ⇒ ZSTM[R1, E1, A1]): ZSTM[R1, E1, A1]

    Permalink

    Applies f if the predicate fails.

  32. def filterOrFail[E1 >: E](p: (A) ⇒ Boolean)(e: ⇒ E1): ZSTM[R, E1, A]

    Permalink

    Fails with e if the predicate fails.

  33. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  34. def flatMap[R1 <: R, E1 >: E, B](f: (A) ⇒ ZSTM[R1, E1, B]): ZSTM[R1, E1, B]

    Permalink

    Feeds the value produced by this effect to the specified function, and then runs the returned effect as well to produce its results.

  35. def flatMapError[R1 <: R, E2](f: (E) ⇒ ZSTM[R1, Nothing, E2])(implicit ev: CanFail[E]): ZSTM[R1, E2, A]

    Permalink

    Creates a composite effect that represents this effect followed by another one that may depend on the error produced by this one.

  36. def flatten[R1 <: R, E1 >: E, B](implicit ev: <:<[A, ZSTM[R1, E1, B]]): ZSTM[R1, E1, B]

    Permalink

    Flattens out a nested STM effect.

  37. def flattenErrorOption[E1, E2 <: E1](default: ⇒ E2)(implicit ev: <:<[E, Option[E1]]): ZSTM[R, E1, A]

    Permalink

    Unwraps the optional error, defaulting to the provided value.

  38. def flip: ZSTM[R, A, E]

    Permalink

    Flips the success and failure channels of this transactional effect.

    Flips the success and failure channels of this transactional effect. This allows you to use all methods on the error channel, possibly before flipping back.

  39. def flipWith[R1, A1, E1](f: (ZSTM[R, A, E]) ⇒ ZSTM[R1, A1, E1]): ZSTM[R1, E1, A1]

    Permalink

    Swaps the error/value parameters, applies the function f and flips the parameters back

  40. def fold[B](f: (E) ⇒ B, g: (A) ⇒ B)(implicit ev: CanFail[E]): URSTM[R, B]

    Permalink

    Folds over the STM effect, handling both failure and success, but not retry.

  41. def foldSTM[R1 <: R, E1, B](f: (E) ⇒ ZSTM[R1, E1, B], g: (A) ⇒ ZSTM[R1, E1, B])(implicit ev: CanFail[E]): ZSTM[R1, E1, B]

    Permalink

    Effectfully folds over the STM effect, handling both failure and success.

  42. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  43. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  44. def head[B](implicit ev: <:<[A, List[B]]): ZSTM[R, Option[E], B]

    Permalink

    Returns a successful effect with the head of the list if the list is non-empty or fails with the error None if the list is empty.

  45. def ignore: URSTM[R, Unit]

    Permalink

    Returns a new effect that ignores the success or failure of this effect.

  46. def isFailure: ZSTM[R, Nothing, Boolean]

    Permalink

    Returns whether this transactional effect is a failure.

  47. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  48. def isSuccess: ZSTM[R, Nothing, Boolean]

    Permalink

    Returns whether this transactional effect is a success.

  49. def left[B, C](implicit ev: IsSubtypeOfOutput[A, Either[B, C]]): ZSTM[R, Either[E, C], B]

    Permalink

    "Zooms in" on the value in the Left side of an Either, moving the possibility that the value is a Right to the error channel.

  50. def map[B](f: (A) ⇒ B): ZSTM[R, E, B]

    Permalink

    Maps the value produced by the effect.

  51. def mapAttempt[B](f: (A) ⇒ B)(implicit ev: IsSubtypeOfError[E, Throwable]): ZSTM[R, Throwable, B]

    Permalink

    Maps the value produced by the effect with the specified function that may throw exceptions but is otherwise pure, translating any thrown exceptions into typed failed effects.

  52. def mapBoth[E2, B](f: (E) ⇒ E2, g: (A) ⇒ B)(implicit ev: CanFail[E]): ZSTM[R, E2, B]

    Permalink

    Returns an STM effect whose failure and success channels have been mapped by the specified pair of functions, f and g.

  53. def mapError[E1](f: (E) ⇒ E1)(implicit ev: CanFail[E]): ZSTM[R, E1, A]

    Permalink

    Maps from one error type to another.

  54. def merge[A1 >: A](implicit ev1: <:<[E, A1], ev2: CanFail[E]): URSTM[R, A1]

    Permalink

    Returns a new effect where the error channel has been merged into the success channel to their common combined type.

  55. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  56. def none[B](implicit ev: <:<[A, Option[B]]): ZSTM[R, Option[E], Unit]

    Permalink

    Requires the option produced by this value to be None.

  57. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  58. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  59. def option(implicit ev: CanFail[E]): URSTM[R, Option[A]]

    Permalink

    Converts the failure channel into an Option.

  60. def orDie(implicit ev1: IsSubtypeOfError[E, Throwable], ev2: CanFail[E]): URSTM[R, A]

    Permalink

    Translates STM effect failure into death of the fiber, making all failures unchecked and not a part of the type of the effect.

  61. def orDieWith(f: (E) ⇒ Throwable)(implicit ev: CanFail[E]): URSTM[R, A]

    Permalink

    Keeps none of the errors, and terminates the fiber running the STM effect with them, using the specified function to convert the E into a Throwable.

  62. def orElse[R1 <: R, E1, A1 >: A](that: ⇒ ZSTM[R1, E1, A1]): ZSTM[R1, E1, A1]

    Permalink

    Named alias for <>.

  63. def orElseEither[R1 <: R, E1, B](that: ⇒ ZSTM[R1, E1, B]): ZSTM[R1, E1, Either[A, B]]

    Permalink

    Returns a transactional effect that will produce the value of this effect in left side, unless it fails or retries, in which case, it will produce the value of the specified effect in right side.

  64. def orElseFail[E1](e1: ⇒ E1): ZSTM[R, E1, A]

    Permalink

    Tries this effect first, and if it fails or retries, fails with the specified error.

  65. def orElseOptional[R1 <: R, E1, A1 >: A](that: ⇒ ZSTM[R1, Option[E1], A1])(implicit ev: <:<[E, Option[E1]]): ZSTM[R1, Option[E1], A1]

    Permalink

    Returns an effect that will produce the value of this effect, unless it fails with the None value, in which case it will produce the value of the specified effect.

  66. def orElseSucceed[A1 >: A](a1: ⇒ A1): URSTM[R, A1]

    Permalink

    Tries this effect first, and if it fails or retries, succeeds with the specified value.

  67. def orTry[R1 <: R, E1 >: E, A1 >: A](that: ⇒ ZSTM[R1, E1, A1]): ZSTM[R1, E1, A1]

    Permalink

    Named alias for <|>.

  68. def provideEnvironment(r: ZEnvironment[R]): STM[E, A]

    Permalink

    Provides the transaction its required environment, which eliminates its dependency on R.

  69. def provideSomeEnvironment[R0](f: (ZEnvironment[R0]) ⇒ ZEnvironment[R]): ZSTM[R0, E, A]

    Permalink

    Transforms the environment being provided to this effect with the specified function.

  70. def refineOrDie[E1](pf: PartialFunction[E, E1])(implicit ev1: IsSubtypeOfError[E, Throwable], ev2: CanFail[E]): ZSTM[R, E1, A]

    Permalink

    Keeps some of the errors, and terminates the fiber with the rest.

  71. def refineOrDieWith[E1](pf: PartialFunction[E, E1])(f: (E) ⇒ Throwable)(implicit ev: CanFail[E]): ZSTM[R, E1, A]

    Permalink

    Keeps some of the errors, and terminates the fiber with the rest, using the specified function to convert the E into a Throwable.

  72. def reject[E1 >: E](pf: PartialFunction[A, E1]): ZSTM[R, E1, A]

    Permalink

    Fail with the returned value if the PartialFunction matches, otherwise continue with our held value.

  73. def rejectSTM[R1 <: R, E1 >: E](pf: PartialFunction[A, ZSTM[R1, E1, E1]]): ZSTM[R1, E1, A]

    Permalink

    Continue with the returned computation if the PartialFunction matches, translating the successful match into a failure, otherwise continue with our held value.

  74. def repeatUntil(f: (A) ⇒ Boolean): ZSTM[R, E, A]

    Permalink

    Repeats this STM effect until its result satisfies the specified predicate.

    Repeats this STM effect until its result satisfies the specified predicate. WARNING: repeatUntil uses a busy loop to repeat the effect and will consume a thread until it completes (it cannot yield). This is because STM describes a single atomic transaction which must either complete, retry or fail a transaction before yielding back to the ZIO Runtime.

    • Use retryUntil instead if you don't need to maintain transaction state for repeats.
    • Ensure repeating the STM effect will eventually satisfy the predicate.
    • Consider using the Blocking thread pool for execution of the transaction.
  75. def repeatWhile(f: (A) ⇒ Boolean): ZSTM[R, E, A]

    Permalink

    Repeats this STM effect while its result satisfies the specified predicate.

    Repeats this STM effect while its result satisfies the specified predicate. WARNING: repeatWhile uses a busy loop to repeat the effect and will consume a thread until it completes (it cannot yield). This is because STM describes a single atomic transaction which must either complete, retry or fail a transaction before yielding back to the ZIO Runtime.

    • Use retryWhile instead if you don't need to maintain transaction state for repeats.
    • Ensure repeating the STM effect will eventually not satisfy the predicate.
    • Consider using the Blocking thread pool for execution of the transaction.
  76. def retryUntil(f: (A) ⇒ Boolean): ZSTM[R, E, A]

    Permalink

    Filters the value produced by this effect, retrying the transaction until the predicate returns true for the value.

  77. def retryWhile(f: (A) ⇒ Boolean): ZSTM[R, E, A]

    Permalink

    Filters the value produced by this effect, retrying the transaction while the predicate returns true for the value.

  78. final def right[B, C](implicit ev: IsSubtypeOfOutput[A, Either[B, C]]): ZSTM[R, Either[B, E], C]

    Permalink

    "Zooms in" on the value in the Right side of an Either, moving the possibility that the value is a Left to the error channel.

  79. def some[B](implicit ev: <:<[A, Option[B]]): ZSTM[R, Option[E], B]

    Permalink

    Converts an option on values into an option on errors.

  80. def someOrElse[B](default: ⇒ B)(implicit ev: <:<[A, Option[B]]): ZSTM[R, E, B]

    Permalink

    Extracts the optional value, or returns the given 'default'.

  81. def someOrElseSTM[B, R1 <: R, E1 >: E](default: ZSTM[R1, E1, B])(implicit ev: <:<[A, Option[B]]): ZSTM[R1, E1, B]

    Permalink

    Extracts the optional value, or executes the effect 'default'.

  82. def someOrFail[B, E1 >: E](e: ⇒ E1)(implicit ev: <:<[A, Option[B]]): ZSTM[R, E1, B]

    Permalink

    Extracts the optional value, or fails with the given error 'e'.

  83. def someOrFailException[B, E1 >: E](implicit ev: <:<[A, Option[B]], ev2: <:<[NoSuchElementException, E1]): ZSTM[R, E1, B]

    Permalink

    Extracts the optional value, or fails with a java.util.NoSuchElementException

  84. def summarized[R1 <: R, E1 >: E, B, C](summary: ZSTM[R1, E1, B])(f: (B, B) ⇒ C): ZSTM[R1, E1, (C, A)]

    Permalink

    Summarizes a STM effect by computing a provided value before and after execution, and then combining the values to produce a summary, together with the result of execution.

  85. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  86. def tap[R1 <: R, E1 >: E](f: (A) ⇒ ZSTM[R1, E1, Any]): ZSTM[R1, E1, A]

    Permalink

    "Peeks" at the success of transactional effect.

  87. def tapBoth[R1 <: R, E1 >: E](f: (E) ⇒ ZSTM[R1, E1, Any], g: (A) ⇒ ZSTM[R1, E1, Any])(implicit ev: CanFail[E]): ZSTM[R1, E1, A]

    Permalink

    "Peeks" at both sides of an transactional effect.

  88. def tapError[R1 <: R, E1 >: E](f: (E) ⇒ ZSTM[R1, E1, Any])(implicit ev: CanFail[E]): ZSTM[R1, E1, A]

    Permalink

    "Peeks" at the error of the transactional effect.

  89. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  90. def unit: ZSTM[R, E, Unit]

    Permalink

    Maps the success value of this effect to unit.

  91. final def unleft[E1, B](implicit ev: IsSubtypeOfError[E, Either[E1, B]]): ZSTM[R, E1, Either[A, B]]

    Permalink

    Converts a ZSTM[R, Either[E, B], A] into a ZSTM[R, E, Either[A, B]].

    Converts a ZSTM[R, Either[E, B], A] into a ZSTM[R, E, Either[A, B]]. The inverse of left.

  92. def unless(b: ⇒ Boolean): ZSTM[R, E, Option[A]]

    Permalink

    The moral equivalent of if (!p) exp

  93. def unlessSTM[R1 <: R, E1 >: E](b: ZSTM[R1, E1, Boolean]): ZSTM[R1, E1, Option[A]]

    Permalink

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

  94. final def unright[E1, B](implicit ev: IsSubtypeOfError[E, Either[B, E1]]): ZSTM[R, E1, Either[B, A]]

    Permalink

    Converts a ZSTM[R, Either[B, E], A] into a ZSTM[R, E, Either[B, A]].

    Converts a ZSTM[R, Either[B, E], A] into a ZSTM[R, E, Either[B, A]]. The inverse of right.

  95. def unsome[E1](implicit ev: <:<[E, Option[E1]]): ZSTM[R, E1, Option[A]]

    Permalink

    Converts an option on errors into an option on values.

  96. def updateService[M]: UpdateService[R, E, A, M]

    Permalink

    Updates a service in the environment of this effect.

  97. final def updateServiceAt[Service]: UpdateServiceAt[R, E, A, Service]

    Permalink

    Updates a service at the specified key in the environment of this effect.

  98. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  99. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  100. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  101. def when(b: ⇒ Boolean): ZSTM[R, E, Option[A]]

    Permalink

    The moral equivalent of if (p) exp

  102. def whenSTM[R1 <: R, E1 >: E](b: ZSTM[R1, E1, Boolean]): ZSTM[R1, E1, Option[A]]

    Permalink

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

  103. def withFilter(f: (A) ⇒ Boolean): ZSTM[R, E, A]

    Permalink

    Same as retryUntil.

  104. def zip[R1 <: R, E1 >: E, B](that: ⇒ ZSTM[R1, E1, B])(implicit zippable: Zippable[A, B]): ZSTM[R1, E1, Out]

    Permalink

    Named alias for <*>.

  105. def zipLeft[R1 <: R, E1 >: E, B](that: ⇒ ZSTM[R1, E1, B]): ZSTM[R1, E1, A]

    Permalink

    Named alias for <*.

  106. def zipRight[R1 <: R, E1 >: E, B](that: ⇒ ZSTM[R1, E1, B]): ZSTM[R1, E1, B]

    Permalink

    Named alias for *>.

  107. def zipWith[R1 <: R, E1 >: E, B, C](that: ⇒ ZSTM[R1, E1, B])(f: (A, B) ⇒ C): ZSTM[R1, E1, C]

    Permalink

    Sequentially zips this value with the specified one, combining the values using the specified combiner function.

Deprecated Value Members

  1. def &&&[R1 <: R, E1 >: E, B](that: ZSTM[R1, E1, B])(implicit zippable: Zippable[A, B]): ZSTM[R1, E1, Out]

    Permalink

    Alias for <*> and zip.

    Alias for <*> and zip.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use zip

  2. def >>=[R1 <: R, E1 >: E, B](f: (A) ⇒ ZSTM[R1, E1, B]): ZSTM[R1, E1, B]

    Permalink

    Feeds the value produced by this effect to the specified function, and then runs the returned effect as well to produce its results.

    Feeds the value produced by this effect to the specified function, and then runs the returned effect as well to produce its results.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use flatMap

  3. def bimap[E2, B](f: (E) ⇒ E2, g: (A) ⇒ B)(implicit ev: CanFail[E]): ZSTM[R, E2, B]

    Permalink

    Returns an STM effect whose failure and success channels have been mapped by the specified pair of functions, f and g.

    Returns an STM effect whose failure and success channels have been mapped by the specified pair of functions, f and g.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use mapBoth

  4. def collectM[R1 <: R, E1 >: E, B](pf: PartialFunction[A, ZSTM[R1, E1, B]]): ZSTM[R1, E1, B]

    Permalink

    Simultaneously filters and flatMaps the value produced by this effect.

    Simultaneously filters and flatMaps the value produced by this effect. Continues on the effect returned from pf.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use collectSTM

  5. def filterOrElse_[R1 <: R, E1 >: E, A1 >: A](p: (A) ⇒ Boolean)(zstm: ⇒ ZSTM[R1, E1, A1]): ZSTM[R1, E1, A1]

    Permalink

    Supplies zstm if the predicate fails.

    Supplies zstm if the predicate fails.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use filterOrElse

  6. def foldM[R1 <: R, E1, B](f: (E) ⇒ ZSTM[R1, E1, B], g: (A) ⇒ ZSTM[R1, E1, B])(implicit ev: CanFail[E]): ZSTM[R1, E1, B]

    Permalink

    Effectfully folds over the STM effect, handling both failure and success.

    Effectfully folds over the STM effect, handling both failure and success.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use foldSTM

  7. def get[B](implicit ev1: <:<[E, Nothing], ev2: <:<[A, Option[B]]): ZSTM[R, Option[Nothing], B]

    Permalink

    Unwraps the optional success of this effect, but can fail with None value.

    Unwraps the optional success of this effect, but can fail with None value.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use some

  8. def mapPartial[B](f: (A) ⇒ B)(implicit ev: IsSubtypeOfError[E, Throwable]): ZSTM[R, Throwable, B]

    Permalink

    Maps the value produced by the effect with the specified function that may throw exceptions but is otherwise pure, translating any thrown exceptions into typed failed effects.

    Maps the value produced by the effect with the specified function that may throw exceptions but is otherwise pure, translating any thrown exceptions into typed failed effects.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use mapAttempt

  9. def optional[E1](implicit ev: <:<[E, Option[E1]]): ZSTM[R, E1, Option[A]]

    Permalink

    Converts an option on errors into an option on values.

    Converts an option on errors into an option on values.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use unsome

  10. def rejectM[R1 <: R, E1 >: E](pf: PartialFunction[A, ZSTM[R1, E1, E1]]): ZSTM[R1, E1, A]

    Permalink

    Continue with the returned computation if the PartialFunction matches, translating the successful match into a failure, otherwise continue with our held value.

    Continue with the returned computation if the PartialFunction matches, translating the successful match into a failure, otherwise continue with our held value.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use rejectSTM

  11. def someOrElseM[B, R1 <: R, E1 >: E](default: ZSTM[R1, E1, B])(implicit ev: <:<[A, Option[B]]): ZSTM[R1, E1, B]

    Permalink

    Extracts the optional value, or executes the effect 'default'.

    Extracts the optional value, or executes the effect 'default'.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use someOrElseSTM

  12. def unlessM[R1 <: R, E1 >: E](b: ZSTM[R1, E1, Boolean]): ZSTM[R1, E1, Option[A]]

    Permalink

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

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

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use unlessSTM

  13. def unoption[E1](implicit ev: <:<[E, Option[E1]]): ZSTM[R, E1, Option[A]]

    Permalink

    Converts an option on errors into an option on values.

    Converts an option on errors into an option on values.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use unsome

  14. def whenM[R1 <: R, E1 >: E](b: ZSTM[R1, E1, Boolean]): ZSTM[R1, E1, Option[A]]

    Permalink

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

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

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use whenSTM

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped