Bracket2

izumi.functional.bio.Bracket2
trait Bracket2[F[_, _]] extends Error2[F]

Attributes

Graph
Supertypes
trait Error2[F]
trait Monad2[F]
trait Bifunctor2[F]
trait Guarantee2[F]
trait Applicative2[F]
trait Functor2[F]
trait RootBifunctor[F]
trait Root
class Object
trait Matchable
class Any
Show all
Known subtypes
trait Panic2[F]
class Panic2Instance[S]
trait IO2[F]
trait WeakAsync2[F]
trait Async2[F]
class AsyncZio[R]
object AsyncZio
class TemporalZio[R]
object TemporalZio
Show all

Members list

Type members

Inherited types

Attributes

Inherited from:
DivergenceHelper

Attributes

Inherited from:
PredefinedHelper

Value members

Abstract methods

def bracketCase[E, A, B](acquire: F[E, A])(release: (A, Exit[E, B]) => F[Nothing, Unit])(use: A => F[E, B]): F[E, B]

Concrete methods

def bracket[E, A, B](acquire: F[E, A])(release: A => F[Nothing, Unit])(use: A => F[E, B]): F[E, B]
final def bracketOnFailure[E, A, B](acquire: F[E, A])(cleanupOnFailure: (A, Failure[E]) => F[Nothing, Unit])(use: A => F[E, B]): F[E, B]

Run release action only on a failure – any failure, INCLUDING interruption. Do not run release action if use finished successfully.

Run release action only on a failure – any failure, INCLUDING interruption. Do not run release action if use finished successfully.

Attributes

override def guarantee[E, A](f: F[E, A], cleanup: F[Nothing, Unit]): F[E, A]

Attributes

Definition Classes
def guaranteeCase[E, A](f: F[E, A], cleanup: Exit[E, A] => F[Nothing, Unit]): F[E, A]
final def guaranteeExceptOnInterrupt[E, A](f: F[E, A], cleanupOnNonInterruption: Uninterrupted[E, A] => F[Nothing, Unit]): F[E, A]

Run cleanup on both success and failure, if the failure IS NOT an interruption.

Run cleanup on both success and failure, if the failure IS NOT an interruption.

Attributes

final def guaranteeOnFailure[E, A](f: F[E, A], cleanupOnFailure: Failure[E] => F[Nothing, Unit]): F[E, A]

Run cleanup only on a failure – any failure, INCLUDING interruption. Do not run cleanup if use finished successfully.

Run cleanup only on a failure – any failure, INCLUDING interruption. Do not run cleanup if use finished successfully.

Attributes

final def guaranteeOnInterrupt[E, A](f: F[E, A], cleanupOnInterruption: Interruption => F[Nothing, Unit]): F[E, A]

Run cleanup only on interruption. Do not run cleanup if use finished successfully.

Run cleanup only on interruption. Do not run cleanup if use finished successfully.

Attributes

Inherited methods

override def *>[E, A, B](f: F[E, A], next: => F[E, B]): F[E, B]

execute two operations in order, return result of second operation

execute two operations in order, return result of second operation

Attributes

Definition Classes
Inherited from:
Monad2
override def <*[E, A, B](f: F[E, A], next: => F[E, B]): F[E, A]

execute two operations in order, same as *>, but return result of first operation

execute two operations in order, same as *>, but return result of first operation

Attributes

Definition Classes
Inherited from:
Monad2
override def InnerF: Functor2[F]

Attributes

Definition Classes
Inherited from:
ApplicativeError2
protected def accumulateErrorsImpl[ColL[_], ColR <: (IterableOnce), E, E1, A, B, B1, AC](col: ColR[A])(effect: A => F[E, B], onLeft: E => IterableOnce[E1], init: AC, onRight: (AC, B) => AC, end: AC => B1)(implicit buildL: Factory[E1, ColL[E1]]): F[ColL[E1], B1]

Attributes

Inherited from:
ErrorAccumulatingOps2
def as[E, A, B](r: F[E, A])(v: => B): F[E, B]

Attributes

Inherited from:
Functor2
def attempt[E, A](r: F[E, A]): F[Nothing, Either[E, A]]

Attributes

Inherited from:
Error2
override def bimap[E, A, E2, B](r: F[E, A])(f: E => E2, g: A => B): F[E2, B]

Attributes

Definition Classes
Inherited from:
Error2
def catchSome[E, A, E1 >: E](r: F[E, A])(f: PartialFunction[E, F[E1, A]]): F[E1, A]

Attributes

Inherited from:
Error2
def collect[E, A, B](l: Iterable[A])(f: A => F[E, Option[B]]): F[E, List[B]]

Attributes

Inherited from:
Applicative2
def collectFirst[E, A, B](l: Iterable[A])(f: A => F[E, Option[B]]): F[E, Option[B]]

Attributes

Inherited from:
Monad2
def filter[E, A](l: Iterable[A])(f: A => F[E, Boolean]): F[E, List[A]]

Attributes

Inherited from:
Applicative2
def find[E, A](l: Iterable[A])(f: A => F[E, Boolean]): F[E, Option[A]]

Attributes

Inherited from:
Monad2
def flatSequence[E, A](l: Iterable[F[E, Iterable[A]]]): F[E, List[A]]

Attributes

Inherited from:
Applicative2
def flatSequenceAccumErrors[ColR <: (IterableOnce), ColIn <: (IterableOnce), ColL[_], E, A](col: ColR[F[ColL[E], ColIn[A]]])(implicit buildR: Factory[A, ColR[A]], buildL: Factory[E, ColL[E]], iterL: ColL[E] => IterableOnce[E]): F[ColL[E], ColR[A]]

flatSequence with error accumulation

flatSequence with error accumulation

Attributes

Inherited from:
ErrorAccumulatingOps2
def flatTraverse[E, A, B](l: Iterable[A])(f: A => F[E, Iterable[B]]): F[E, List[B]]

Attributes

Inherited from:
Applicative2
def flatTraverseAccumErrors[ColR <: (IterableOnce), ColIn <: (IterableOnce), ColL[_], E, A, B](col: ColR[A])(f: A => F[ColL[E], ColIn[B]])(implicit buildR: Factory[B, ColR[B]], buildL: Factory[E, ColL[E]], iterL: ColL[E] => IterableOnce[E]): F[ColL[E], ColR[B]]

flatTraverse with error accumulation

flatTraverse with error accumulation

Attributes

Inherited from:
ErrorAccumulatingOps2
def flatten[E, A](r: F[E, F[E, A]]): F[E, A]

Attributes

Inherited from:
Monad2
def flip[E, A](r: F[E, A]): F[A, E]

Attributes

Inherited from:
Error2
def foldLeft[E, A, AC](l: Iterable[A])(z: AC)(f: (AC, A) => F[E, AC]): F[E, AC]

Attributes

Inherited from:
Monad2
final def forever[E, A](r: F[E, A]): F[E, Nothing]

Attributes

Inherited from:
Applicative2
def fromOption[E, A](errorOnNone: => E, r: F[E, Option[A]]): F[E, A]

Extracts the optional value or fails with the errorOnNone error

Extracts the optional value or fails with the errorOnNone error

Attributes

Inherited from:
Error2
def fromOptionF[E, A](fallbackOnNone: => F[E, A], r: F[E, Option[A]]): F[E, A]

Extracts the optional value, or executes the fallbackOnNone effect

Extracts the optional value, or executes the fallbackOnNone effect

Attributes

Inherited from:
Monad2
def fromOptionOr[E, A](valueOnNone: => A, r: F[E, Option[A]]): F[E, A]

Extracts the optional value, or returns the given valueOnNone value

Extracts the optional value, or returns the given valueOnNone value

Attributes

Inherited from:
Functor2
final def ifThenElse[E, E1, A](cond: F[E, Boolean])(ifTrue: => F[E1, A], ifFalse: => F[E1, A])(implicit ev: E <:< E1): F[E1, A]

Attributes

Inherited from:
Monad2
final def ifThenElse[E, A](cond: Boolean)(ifTrue: => F[E, A], ifFalse: => F[E, A]): F[E, A]

Attributes

Inherited from:
Applicative2
final def ifThenFail[E](cond: Boolean)(errorIfTrue: => E): F[E, Unit]

Attributes

Inherited from:
ApplicativeError2
def iterateUntil[E, A](r: F[E, A])(p: A => Boolean): F[E, A]

Execute an action repeatedly until its result satisfies the given predicate and return that result, discarding all others.

Execute an action repeatedly until its result satisfies the given predicate and return that result, discarding all others.

Attributes

Inherited from:
Monad2
def iterateUntilF[E, A](init: A)(f: A => F[E, A])(p: A => Boolean): F[E, A]

Apply an effectful function iteratively until its result satisfies the given predicate and return that result.

Apply an effectful function iteratively until its result satisfies the given predicate and return that result.

Attributes

Inherited from:
Monad2
def iterateWhile[E, A](r: F[E, A])(p: A => Boolean): F[E, A]

Execute an action repeatedly until its result fails to satisfy the given predicate and return that result, discarding all others.

Execute an action repeatedly until its result fails to satisfy the given predicate and return that result, discarding all others.

Attributes

Inherited from:
Monad2
def iterateWhileF[E, A](init: A)(f: A => F[E, A])(p: A => Boolean): F[E, A]

Apply an effectful function iteratively until its result fails to satisfy the given predicate and return that result.

Apply an effectful function iteratively until its result fails to satisfy the given predicate and return that result.

Attributes

Inherited from:
Monad2
def leftFlatMap[E, A, E2](r: F[E, A])(f: E => F[Nothing, E2]): F[E2, A]

Attributes

Inherited from:
Error2
def leftMap[E, A, E2](r: F[E, A])(f: E => E2): F[E2, A]

Attributes

Inherited from:
Bifunctor2
override def leftMap2[E, A, E2, E3](firstOp: F[E, A], secondOp: => F[E2, A])(f: (E, E2) => E3): F[E3, A]

map errors from two operations into a new error if both fail

map errors from two operations into a new error if both fail

Attributes

Definition Classes
Inherited from:
Error2
override def map[E, A, B](r: F[E, A])(f: A => B): F[E, B]

Attributes

Definition Classes
Inherited from:
Monad2
override def map2[E, A, B, C](r1: F[E, A], r2: => F[E, B])(f: (A, B) => C): F[E, C]

execute two operations in order, map their results

execute two operations in order, map their results

Attributes

Definition Classes
Inherited from:
Monad2
override def orElse[E, A, E2](r: F[E, A], f: => F[E2, A]): F[E2, A]

execute second operation only if the first one fails

execute second operation only if the first one fails

Attributes

Definition Classes
Inherited from:
Error2
def partition[E, A](l: Iterable[F[E, A]]): F[Nothing, (List[E], List[A])]

Attributes

Inherited from:
Error2
def redeem[E, A, E2, B](r: F[E, A])(err: E => F[E2, B], succ: A => F[E2, B]): F[E2, B]

Attributes

Inherited from:
Error2
def redeemPure[E, A, B](r: F[E, A])(err: E => B, succ: A => B): F[Nothing, B]

Attributes

Inherited from:
Error2
def retryUntil[E, A](r: F[E, A])(f: E => Boolean): F[E, A]

Retries this effect until its error satisfies the specified predicate.

Retries this effect until its error satisfies the specified predicate.

Attributes

Inherited from:
Error2
def retryUntilF[E, A](r: F[E, A])(f: E => F[Nothing, Boolean]): F[E, A]

Retries this effect until its error satisfies the specified effectful predicate.

Retries this effect until its error satisfies the specified effectful predicate.

Attributes

Inherited from:
Error2
def retryWhile[E, A](r: F[E, A])(f: E => Boolean): F[E, A]

Retries this effect while its error satisfies the specified predicate.

Retries this effect while its error satisfies the specified predicate.

Attributes

Inherited from:
Error2
def retryWhileF[E, A](r: F[E, A])(f: E => F[Nothing, Boolean]): F[E, A]

Retries this effect while its error satisfies the specified effectful predicate.

Retries this effect while its error satisfies the specified effectful predicate.

Attributes

Inherited from:
Error2
def sequence[E, A](l: Iterable[F[E, A]]): F[E, List[A]]

Attributes

Inherited from:
Applicative2
def sequenceAccumErrors[ColR <: (IterableOnce), ColL[_], E, A](col: ColR[F[ColL[E], A]])(implicit buildR: Factory[A, ColR[A]], buildL: Factory[E, ColL[E]], iterL: ColL[E] => IterableOnce[E]): F[ColL[E], ColR[A]]

sequence with error accumulation

sequence with error accumulation

Attributes

Inherited from:
ErrorAccumulatingOps2
def sequenceAccumErrorsNEList[ColR <: (IterableOnce), E, A](col: ColR[F[E, A]])(implicit buildR: Factory[A, ColR[A]]): F[NEList[E], ColR[A]]

sequence with error accumulation

sequence with error accumulation

Attributes

Inherited from:
ErrorAccumulatingOps2
def sequenceAccumErrors_[ColR <: (IterableOnce), ColL[_], E, A](col: ColR[F[ColL[E], A]])(implicit buildL: Factory[E, ColL[E]], iterL: ColL[E] => IterableOnce[E]): F[ColL[E], Unit]

sequence_ with error accumulation

sequence_ with error accumulation

Attributes

Inherited from:
ErrorAccumulatingOps2
def sequence_[E](l: Iterable[F[E, Unit]]): F[E, Unit]

Attributes

Inherited from:
Applicative2
def tailRecM[E, A, B](a: A)(f: A => F[E, Either[A, B]]): F[E, B]

Attributes

Inherited from:
Monad2
def tap[E, A](r: F[E, A], f: A => F[E, Unit]): F[E, A]

Attributes

Inherited from:
Monad2
def tapBoth[E, A, E1 >: E](r: F[E, A])(err: E => F[E1, Unit], succ: A => F[E1, Unit]): F[E1, A]

Attributes

Inherited from:
Error2
def tapError[E, A, E1 >: E](r: F[E, A])(f: E => F[E1, Unit]): F[E1, A]

Attributes

Inherited from:
Error2
final def traverse[E, A, B](o: Option[A])(f: A => F[E, B]): F[E, Option[B]]

Attributes

Inherited from:
Applicative2
def traverse[E, A, B](l: Iterable[A])(f: A => F[E, B]): F[E, List[B]]

Attributes

Inherited from:
Applicative2
def traverseAccumErrors[ColR <: (IterableOnce), ColL[_], E, A, B](col: ColR[A])(f: A => F[ColL[E], B])(implicit buildR: Factory[B, ColR[B]], buildL: Factory[E, ColL[E]], iterL: ColL[E] => IterableOnce[E]): F[ColL[E], ColR[B]]

traverse with error accumulation

traverse with error accumulation

Attributes

Inherited from:
ErrorAccumulatingOps2
def traverseAccumErrorsNEList[ColR <: (IterableOnce), E, A, B](col: ColR[A])(f: A => F[E, B])(implicit buildR: Factory[B, ColR[B]]): F[NEList[E], ColR[B]]

traverse with error accumulation

traverse with error accumulation

Attributes

Inherited from:
ErrorAccumulatingOps2
def traverseAccumErrors_[ColR <: (IterableOnce), ColL[_], E, A](col: ColR[A])(f: A => F[ColL[E], Unit])(implicit buildL: Factory[E, ColL[E]], iterL: ColL[E] => IterableOnce[E]): F[ColL[E], Unit]

traverse_ with error accumulation

traverse_ with error accumulation

Attributes

Inherited from:
ErrorAccumulatingOps2
def traverse_[E, A](l: Iterable[A])(f: A => F[E, Unit]): F[E, Unit]

Attributes

Inherited from:
Applicative2
def unit: F[Nothing, Unit]

Attributes

Inherited from:
Applicative2
final def unless[E, E1](cond: F[E, Boolean])(ifFalse: => F[E1, Unit])(implicit ev: E <:< E1): F[E1, Unit]

Attributes

Inherited from:
Monad2
final def unless[E](cond: Boolean)(ifFalse: => F[E, Unit]): F[E, Unit]

Attributes

Inherited from:
Applicative2
def void[E, A](r: F[E, A]): F[E, Unit]

Attributes

Inherited from:
Functor2
final def when[E, E1](cond: F[E, Boolean])(ifTrue: => F[E1, Unit])(implicit ev: E <:< E1): F[E1, Unit]

Attributes

Inherited from:
Monad2
final def when[E](cond: Boolean)(ifTrue: => F[E, Unit]): F[E, Unit]

Attributes

Inherited from:
Applicative2
final def widen[E, A, A1](r: F[E, A])(implicit ev: A <:< A1): F[E, A1]

Attributes

Inherited from:
Functor2
final def widenBoth[E, A, E1, A1](r: F[E, A])(implicit ev: E <:< E1, ev2: A <:< A1): F[E1, A1]

Attributes

Inherited from:
Bifunctor2
final def widenError[E, A, E1](r: F[E, A])(implicit ev: E <:< E1): F[E1, A]

Attributes

Inherited from:
Bifunctor2
final def withFilter[E, A](r: F[E, A])(predicate: A => Boolean)(implicit filter: WithFilter[E], pos: SourceFilePositionMaterializer): F[E, A]

for-comprehensions sugar:

for-comprehensions sugar:

 for {
   (1, 2) &lt;- F.pure((2, 1))
 } yield ()

Use widenError to for pattern matching with non-Throwable errors:

 val f = for {
   (1, 2) &lt;- F.pure((2, 1)).widenError[Option[Unit]]
 } yield ()
 // f: F[Option[Unit], Unit] = F.fail(Some(())

Attributes

Inherited from:
Error2
def zip[E, A, B](firstOp: F[E, A], secondOp: => F[E, B]): F[E, (A, B)]

Attributes

Inherited from:
Applicative2

Inherited and Abstract methods

def catchAll[E, A, E2](r: F[E, A])(f: E => F[E2, A]): F[E2, A]

Attributes

Inherited from:
Error2
def fail[E](v: => E): F[E, Nothing]

Attributes

Inherited from:
ApplicativeError2
def flatMap[E, A, B](r: F[E, A])(f: A => F[E, B]): F[E, B]

Attributes

Inherited from:
Monad2
def fromAttempt[A](effect: => A): F[Throwable, A]

For lazy monads: alias for IO2#syncThrowable. For strict monads, shorthand for F.fromTry(Try(effect))

For lazy monads: alias for IO2#syncThrowable. For strict monads, shorthand for F.fromTry(Try(effect))

Attributes

Inherited from:
ApplicativeError2
def fromEither[E, V](effect: => Either[E, V]): F[E, V]

Attributes

Inherited from:
ApplicativeError2
def fromOption[E, A](errorOnNone: => E)(effect: => Option[A]): F[E, A]

Attributes

Inherited from:
ApplicativeError2
def fromTry[A](effect: => Try[A]): F[Throwable, A]

Attributes

Inherited from:
ApplicativeError2
def pure[A](a: A): F[Nothing, A]

Attributes

Inherited from:
Applicative2