Txn

sealed abstract class Txn[+A]
Companion
object
class Object
trait Matchable
class Any

Value members

Concrete methods

final def *>[B](that: Txn[B]): Txn[B]
final def <*[B](that: Txn[B]): Txn[A]
final def >>[B](that: => Txn[B]): Txn[B]
final def adaptError(pf: PartialFunction[Throwable, Throwable]): Txn[A]

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.

final def as[B](b: B): Txn[B]
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.

def attemptNarrow[EE <: Throwable](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.

final def attemptT[B >: A]: EitherT[[A] =>> Txn[A], 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.

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.

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.

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.

final def flatMap[B](f: A => Txn[B]): Txn[B]

Monadic bind on STM.

Monadic bind on STM.

final def flatTap[B](f: A => Txn[B]): Txn[A]
final def flatten[B](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.

final def fmap[B](f: A => B): Txn[B]

Alias for map

Alias for map

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

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.

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.

See also

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

recover to only recover from certain errors.

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.

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.

final def map[B](f: A => B): Txn[B]

Functor map on STM.

Functor map on STM.

final def map2[B, Z](fb: Txn[B])(f: (A, B) => Z): Txn[Z]
final def onError(pf: PartialFunction[Throwable, Txn[Unit]]): Txn[A]

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.

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.

final def product[B](that: Txn[B]): Txn[(A, B)]
final def productL[B](that: Txn[B]): Txn[A]
final def productR[B](that: Txn[B]): Txn[B]
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.

See also

handleError to handle any/all errors.

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

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.

See also

handleErrorWith to handle any/all errors.

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

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.

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.

final def rethrow[B](ev: A <:< Either[Throwable, B]): Txn[B]

Inverse of attempt

Inverse of attempt

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.

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.

final def void: Txn[Unit]
final def widen[B >: A]: Txn[B]

Lifts natural subtyping covariance of covariant Functors.

Lifts natural subtyping covariance of covariant Functors.