Txn

io.github.timwspence.cats.stm.STMLike.Txn
See theTxn companion object
sealed abstract class Txn[+A]

Attributes

Companion:
object
Source:
STMLike.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Concise view

Value members

Concrete methods

final def *>[B](that: Txn[B]): Txn[B]

Attributes

Source:
STMLike.scala
final def <*[B](that: Txn[B]): Txn[A]

Attributes

Source:
STMLike.scala
final def >>[B](that: => Txn[B]): Txn[B]

Attributes

Source:
STMLike.scala

Transform certain errors using pf and rethrow them. Non matching errors and successful values are not affected by this function.

Transform certain errors using pf and rethrow them. Non matching errors and successful values are not affected by this function.

Attributes

Source:
STMLike.scala
final def as[B](b: B): Txn[B]

Attributes

Source:
STMLike.scala
final def attempt: Txn[Either[Throwable, A]]

Handle errors by turning them into Either values.

Handle errors by turning them into Either values.

If there is no error, then an scala.util.Right value will be returned instead.

Attributes

Source:
STMLike.scala
def attemptNarrow[EE <: Throwable](implicit tag: ClassTag[EE]): Txn[Either[EE, A]]

Similar to attempt, but it only handles errors of type EE.

Similar to attempt, but it only handles errors of type EE.

Attributes

Source:
STMLike.scala
final def attemptT[B >: A]: EitherT[Txn, Throwable, B]

Similar to attempt, but wraps the result in a EitherT for convenience.

Similar to attempt, but wraps the result in a EitherT for convenience.

Attributes

Source:
STMLike.scala
final def attemptTap[B](f: Either[Throwable, A] => Txn[B]): Txn[A]

Reifies the value or error of the source and performs an effect on the result, then recovers the original value or error back into F.

Reifies the value or error of the source and performs an effect on the result, then recovers the original value or error back into F.

Note that if the effect returned by f fails, the resulting effect will fail too.

Attributes

Source:
STMLike.scala
final def ensure(error: => Throwable)(predicate: A => Boolean): Txn[A]

Turns a successful value into an error if it does not satisfy a given predicate.

Turns a successful value into an error if it does not satisfy a given predicate.

Attributes

Source:
STMLike.scala
final def ensureOr(error: A => Throwable)(predicate: A => Boolean): Txn[A]

Turns a successful value into an error specified by the error function if it does not satisfy a given predicate.

Turns a successful value into an error specified by the error function if it does not satisfy a given predicate.

Attributes

Source:
STMLike.scala
final def flatMap[B](f: A => Txn[B]): Txn[B]

Monadic bind on STM.

Monadic bind on STM.

Attributes

Source:
STMLike.scala
final def flatTap[B](f: A => Txn[B]): Txn[A]

Attributes

Source:
STMLike.scala
final def flatten[B](implicit ev: A <:< Txn[B]): Txn[B]

"flatten" a nested F of F structure into a single-layer F structure.

"flatten" a nested F of F structure into a single-layer F structure.

This is also commonly called join.

Attributes

Source:
STMLike.scala
final def fmap[B](f: A => B): Txn[B]

Alias for map

Alias for map

Attributes

Source:
STMLike.scala
final def fproduct[B](f: A => B): Txn[(A, B)]

Tuple the values in fa with the result of applying a function with the value

Tuple the values in fa with the result of applying a function with the value

Attributes

Source:
STMLike.scala
final def fproductLeft[B](f: A => B): Txn[(B, A)]

Pair the result of function application with A.

Pair the result of function application with A.

Attributes

Source:
STMLike.scala
final def handleError[B >: A](f: Throwable => B): Txn[B]

Handle any error, by mapping it to an A value.

Handle any error, by mapping it to an A value.

Attributes

See also:

handleErrorWith to map to an F[A] value instead of simply an A value.

recover to only recover from certain errors.

Source:
STMLike.scala
final def handleErrorWith[B >: A](f: Throwable => Txn[B]): Txn[B]

Handle any error, potentially recovering from it, by mapping it to an F[A] value.

Handle any error, potentially recovering from it, by mapping it to an F[A] value.

Attributes

See also:

handleError to handle any error by simply mapping it to an A value instead of an F[A].

recoverWith to recover from only certain errors.

Source:
STMLike.scala
final def map[B](f: A => B): Txn[B]

Functor map on STM.

Functor map on STM.

Attributes

Source:
STMLike.scala
final def map2[B, Z](fb: Txn[B])(f: (A, B) => Z): Txn[Z]

Attributes

Source:
STMLike.scala

Execute a callback on certain errors, then rethrow them. Any non matching error is rethrown as well.

Execute a callback on certain errors, then rethrow them. Any non matching error is rethrown as well.

Attributes

Source:
STMLike.scala
final def orElse[B >: A](other: Txn[B]): Txn[B]

Try an alternative STM action if this one retries.

Try an alternative STM action if this one retries.

Attributes

Source:
STMLike.scala
final def product[B](that: Txn[B]): Txn[(A, B)]

Attributes

Source:
STMLike.scala
final def productL[B](that: Txn[B]): Txn[A]

Attributes

Source:
STMLike.scala
final def productR[B](that: Txn[B]): Txn[B]

Attributes

Source:
STMLike.scala
final def recover[B >: A](pf: PartialFunction[Throwable, B]): Txn[B]

Recover from certain errors by mapping them to an A value.

Recover from certain errors by mapping them to an A value.

Attributes

See also:

handleError to handle any/all errors.

recoverWith to recover from certain errors by mapping them to F[A] values.

Source:
STMLike.scala
final def recoverWith[B >: A](pf: PartialFunction[Throwable, Txn[B]]): Txn[B]

Recover from certain errors by mapping them to an F[A] value.

Recover from certain errors by mapping them to an F[A] value.

Attributes

See also:

handleErrorWith to handle any/all errors.

recover to recover from certain errors by mapping them to A values.

Source:
STMLike.scala
final def redeem[B](recover: Throwable => B, map: A => B): Txn[B]

Returns a new value that transforms the result of the source, given the recover or map functions, which get executed depending on whether the result is successful or if it ends in error.

Returns a new value that transforms the result of the source, given the recover or map functions, which get executed depending on whether the result is successful or if it ends in error.

Attributes

Source:
STMLike.scala
final def redeemWith[B](recover: Throwable => Txn[B], bind: A => Txn[B]): Txn[B]

Returns a new value that transforms the result of the source, given the recover or bind functions, which get executed depending on whether the result is successful or if it ends in error.

Returns a new value that transforms the result of the source, given the recover or bind functions, which get executed depending on whether the result is successful or if it ends in error.

Attributes

Source:
STMLike.scala
final def rethrow[B](implicit ev: A <:< Either[Throwable, B]): Txn[B]

Inverse of attempt

Inverse of attempt

Attributes

Source:
STMLike.scala
final def tupleLeft[B](b: B): Txn[(B, A)]

Tuples the A value in Txn[A] with the supplied B value, with the B value on the left.

Tuples the A value in Txn[A] with the supplied B value, with the B value on the left.

Attributes

Source:
STMLike.scala
final def tupleRight[B](b: B): Txn[(A, B)]

Tuples the A value in Txn[A] with the supplied B value, with the B value on the right.

Tuples the A value in Txn[A] with the supplied B value, with the B value on the right.

Attributes

Source:
STMLike.scala
final def void: Txn[Unit]

Attributes

Source:
STMLike.scala
final def widen[B >: A]: Txn[B]

Lifts natural subtyping covariance of covariant Functors.

Lifts natural subtyping covariance of covariant Functors.

Attributes

Source:
STMLike.scala