WeakAsyncForMiniBIOAsync
Attributes
- Graph
-
- Supertypes
-
trait WeakTemporal2[MiniBIOAsync]trait BlockingIO2[MiniBIOAsync]trait WeakAsync2[MiniBIOAsync]trait Parallel2[MiniBIOAsync]trait IO2[MiniBIOAsync]trait Panic2[MiniBIOAsync]trait Bracket2[MiniBIOAsync]trait Error2[MiniBIOAsync]trait Monad2[MiniBIOAsync]trait ApplicativeError2[MiniBIOAsync]trait Bifunctor2[MiniBIOAsync]trait Guarantee2[MiniBIOAsync]trait Applicative2[MiniBIOAsync]trait Functor2[MiniBIOAsync]trait RootBifunctor[MiniBIOAsync]trait Roottrait PredefinedHelpertrait DivergenceHelperclass Objecttrait Matchableclass AnyShow all
- Self type
Members list
Type members
Inherited types
Attributes
- Inherited from:
- DivergenceHelper
Attributes
- Inherited from:
- PredefinedHelper
Value members
Concrete methods
Construct an effect from an asynchronous callback-based API.
Construct an effect from an asynchronous callback-based API.
The callback provided to register must be invoked exactly once with either a success value wrapped in Right or an error wrapped in Left.
Example:
def readFile[F[+_, +_]: WeakAsync2](path: String): F[Throwable, String] = {
F.async { cb =>
asyncFileReader.read(path)(
onSuccess = content => cb(Right(content)),
onError = err => cb(Left(err))
)
}
}
Attributes
- Note
-
Effects created with async, Async2.asyncF, Async2.asyncWithOnInterrupt, fromFuture and Async2.fromFutureJava are INTERRUPTIBLE. - In case of async and Async2.asyncF if the current fiber is interrupted, the registered callback will be simply THROWN AWAY. - If a cleanup action is required to wind down the async operation safely, use Async2.asyncWithOnInterrupt to provide a cleanup action. - If an async operation's callback CANNOT be safely discarded OR interrupted, wrap your expression in Panic2.uninterruptible.
to implementors: The effect produced MUST be interruptible.
- Definition Classes
Like bracketCase, but acquire can contain marked interruptible regions as in uninterruptibleExcept
Like bracketCase, but acquire can contain marked interruptible regions as in uninterruptibleExcept
Attributes
- Definition Classes
Attributes
- Definition Classes
Attributes
- Definition Classes
Attributes
- Definition Classes
Attributes
- Note
-
to implementors: The effect produced MUST be interruptible (cats.effect.IO's fromFuture is not!).
- Definition Classes
Attributes
- Definition Classes
Attributes
- Definition Classes
parTraverseN with maxConcurrent set to the number of cores, or 2 when on single-core processor
parTraverseN with maxConcurrent set to the number of cores, or 2 when on single-core processor
Attributes
- Definition Classes
Attributes
- Definition Classes
Attributes
- Definition Classes
Attributes
- Definition Classes
Attributes
- Definition Classes
Attributes
- Definition Classes
Attributes
- Note
-
Will return either Exit.Success, Exit.Error or Exit.Termination. Exit.Interruption cannot be sandboxed – use guaranteeOnInterrupt for cleanups on interruptions.
- Definition Classes
Signal interruption to this fiber.
Signal interruption to this fiber.
This is NOT the same as
F.halt(Exit.Interrupted(Trace.forUnknownError))
The code above exits with Exit.Interrupted failure unconditionally, whereas sendInterruptToSelf will not exit when in an uninterruptible region. Example:
F.uninterruptible {
F.halt(Exit.Interrupted(Trace.forUnknownError)) *>
F.sync(println("Hello!")) // interrupted above. Hello _not_ printed
}
But with sendInterruptToSelf:
F.uninterruptible {
F.sendInterruptToSelf *>
F.sync(println("Hello!")) // Hello IS printed.
} *> F.sync(println("Impossible")) // interrupted immediately after `uninterruptible` block ends. Impossible _not_ printed
Attributes
- See also
-
- https://github.com/zio/interop-cats/issues/503 - History of supporting this method in ZIO
- https://github.com/zio/zio/issues/6911 - related issue
- Definition Classes
Execute a blocking action on a Blocking thread pool; current task will be safely parked until the blocking task finishes *
Execute a blocking action on a Blocking thread pool; current task will be safely parked until the blocking task finishes *
Attributes
- Definition Classes
Attributes
- Definition Classes
Capture an exception-safe side-effect such as memory mutation or randomness
Capture an exception-safe side-effect such as memory mutation or randomness
Attributes
- Note
-
If you're not completely sure that a captured block can't throw, use syncThrowable
syncmeanssynchronous, that is, a blocking CPU effect, as opposed to a non-blocking asynchronous effect or a long blocking I/O effect (izumi.functional.bio.BlockingIO2#syncBlocking) - Example
-
import izumi.functional.bio.F val exceptionSafeArrayAllocation: F[Nothing, Array[Byte]] = { F.sync(new Array(256)) } - Definition Classes
Execute a blocking impure effect on a Blocking thread pool; current task will be safely parked until the blocking task finishes *
Execute a blocking impure effect on a Blocking thread pool; current task will be safely parked until the blocking task finishes *
Attributes
- Definition Classes
Execute a blocking impure effect on a Blocking thread pool; current task will be safely parked until the blocking task finishes
Execute a blocking impure effect on a Blocking thread pool; current task will be safely parked until the blocking task finishes
If canceled, the task MAY be killed via java.lang.Thread#interrupt. There is no guarantee that this method may promptly, or ever, interrupt the enclosed task, and it may be legally implemented as an alias to syncBlocking
THIS IS USUALLY UNSAFE unless calling well-written libraries that specifically handle java.lang.InterruptedException
Attributes
- Definition Classes
Capture a side-effectful block of code that can throw exceptions
Capture a side-effectful block of code that can throw exceptions
Attributes
- Note
-
syncmeanssynchronous, that is, a blocking CPU effect, as opposed to a non-blocking asynchronous effect or a long blocking I/O effect (izumi.functional.bio.BlockingIO2#syncBlocking) - Definition Classes
Attributes
- Definition Classes
Attributes
- Definition Classes
Attributes
- Definition Classes
Designate the effect uninterruptible, with the exception of regions in it that are specifically marked to restore previous interruptibility status using the provided RestoreInterruption function
Designate the effect uninterruptible, with the exception of regions in it that are specifically marked to restore previous interruptibility status using the provided RestoreInterruption function
Attributes
- Note
-
Interruptibility status will be restored to what it was in the outer region, so if the outer region was also uninterruptible, the provided
RestoreInterruptionwill have no effect. e.g. the expressionF.uninterruptible { F.uninterruptibleExcept { restore => restore(F.sleep(1.second)) }is fully uninterruptible throughout - Example
-
F.uninterruptibleExcept { restoreInterruption => val workLoop = { importantWorkThatMustNotBeInterrupted() *> log.info("Taking a break for a second, you can interrupt me while I wait!") *> restoreInterruption.apply { F.sleep(1.second) .guaranteeOnInterrupt(_ => log.info("Got interrupted!")) } *> log.info("No interruptions, going back to work!") *> workLoop } workLoop } - Definition Classes
Returns an effect that executes both effects, in parallel, combining their results with the specified f function. If either side fails, then the other side will be interrupted.
Returns an effect that executes both effects, in parallel, combining their results with the specified f function. If either side fails, then the other side will be interrupted.
Attributes
- Definition Classes
Inherited methods
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
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
Attributes
- Definition Classes
- Inherited from:
- WeakAsync2
Attributes
- Definition Classes
- Inherited from:
- IO2
Attributes
- Inherited from:
- IO2
Attributes
- Inherited from:
- Functor2
Attributes
- Inherited from:
- Error2
Attributes
- Definition Classes
-
Error2 -> Bifunctor2
- Inherited from:
- Error2
Attributes
- Inherited from:
- Bracket2
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
- Inherited from:
- Bracket2
Attributes
- Inherited from:
- Error2
Attributes
- Inherited from:
- Applicative2
Attributes
- Inherited from:
- Monad2
Attributes
- Inherited from:
- Applicative2
Attributes
- Inherited from:
- Monad2
Attributes
- Inherited from:
- Applicative2
flatSequence with error accumulation
Attributes
- Inherited from:
- Applicative2
flatTraverse with error accumulation
Attributes
- Inherited from:
- Monad2
Attributes
- Inherited from:
- Error2
Attributes
- Inherited from:
- Monad2
Attributes
- Inherited from:
- Applicative2
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
- Definition Classes
- Inherited from:
- IO2
Attributes
- Definition Classes
- Inherited from:
- IO2
Attributes
- Inherited from:
- WeakAsync2
Attributes
- Definition Classes
- Inherited from:
- IO2
Extracts the optional value or fails with the errorOnNone error
Extracts the optional value, or executes the fallbackOnNone effect
Extracts the optional value, or executes the fallbackOnNone effect
Attributes
- Inherited from:
- Monad2
Extracts the optional value, or returns the given valueOnNone value
Extracts the optional value, or returns the given valueOnNone value
Attributes
- Inherited from:
- Functor2
Attributes
- Definition Classes
- Inherited from:
- IO2
Attributes
- Definition Classes
- Inherited from:
- Bracket2
Attributes
- Inherited from:
- Bracket2
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
- Inherited from:
- Bracket2
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
- Inherited from:
- Bracket2
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 from:
- Bracket2
Attributes
- Inherited from:
- Monad2
Attributes
- Inherited from:
- Applicative2
Attributes
- Inherited from:
- ApplicativeError2
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
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
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
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
Attributes
- Inherited from:
- Error2
Attributes
- Inherited from:
- Bifunctor2
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
execute two operations in order, map their results
execute two operations in order, map their results
Attributes
- Definition Classes
- Inherited from:
- Monad2
Attributes
- Inherited from:
- WeakAsync2
execute second operation only if the first one fails
execute second operation only if the first one fails
Attributes
- Definition Classes
- Inherited from:
- Error2
Attributes
- Inherited from:
- Panic2
Attributes
- Inherited from:
- Panic2
Attributes
- Inherited from:
- Error2
Attributes
- Inherited from:
- Error2
Attributes
- Inherited from:
- WeakTemporal2
Retries this effect until its error satisfies the specified predicate.
Retries this effect until its error satisfies the specified predicate.
Attributes
- Inherited from:
- Error2
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
Retries this effect while its error satisfies the specified predicate.
Retries this effect while its error satisfies the specified predicate.
Attributes
- Inherited from:
- Error2
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
Attributes
- Inherited from:
- Panic2
Attributes
- Note
-
Will return either Exit.Success, Exit.Error or Exit.Termination. Exit.Interruption cannot be sandboxed. Use guaranteeOnInterrupt for cleanups on interruptions.
- Inherited from:
- Panic2
Attributes
- Inherited from:
- Applicative2
sequence with error accumulation
sequence with error accumulation
sequence_ with error accumulation
Attributes
- Inherited from:
- Applicative2
Capture an exception-safe side-effect that returns another effect
Capture a side-effectful block of code that can throw exceptions and returns another effect
Capture a side-effectful block of code that can throw exceptions and returns another effect
Attributes
- Inherited from:
- IO2
Attributes
- Inherited from:
- Monad2
Attributes
- Inherited from:
- Monad2
Attributes
- Inherited from:
- Error2
Attributes
- Inherited from:
- Error2
Attributes
- Inherited from:
- Applicative2
traverse with error accumulation
traverse with error accumulation
traverse_ with error accumulation
Attributes
- Inherited from:
- Applicative2
Attributes
- Inherited from:
- Applicative2
Attributes
- Inherited from:
- Monad2
Attributes
- Inherited from:
- Applicative2
Attributes
- Inherited from:
- Functor2
Attributes
- Inherited from:
- Monad2
Attributes
- Inherited from:
- Applicative2
Attributes
- Inherited from:
- Functor2
Attributes
- Inherited from:
- Bifunctor2
Attributes
- Inherited from:
- Bifunctor2
for-comprehensions sugar:
for-comprehensions sugar:
for {
(1, 2) <- F.pure((2, 1))
} yield ()
Use widenError to for pattern matching with non-Throwable errors:
val f = for {
(1, 2) <- F.pure((2, 1)).widenError[Option[Unit]]
} yield ()
// f: F[Option[Unit], Unit] = F.fail(Some(())
Attributes
- Inherited from:
- Error2
Attributes
- Inherited from:
- Applicative2
Returns an effect that executes both effects, in parallel, combining their results into a tuple. If either side fails, then the other side will be interrupted.
Returns an effect that executes both effects, in parallel, combining their results into a tuple. If either side fails, then the other side will be interrupted.
Attributes
- Inherited from:
- Parallel2
Returns an effect that executes both effects, in parallel, the left effect result is returned. If either side fails, then the other side will be interrupted.
Returns an effect that executes both effects, in parallel, the left effect result is returned. If either side fails, then the other side will be interrupted.
Attributes
- Inherited from:
- Parallel2
Returns an effect that executes both effects, in parallel, the right effect result is returned. If either side fails, then the other side will be interrupted.
Returns an effect that executes both effects, in parallel, the right effect result is returned. If either side fails, then the other side will be interrupted.
Attributes
- Inherited from:
- Parallel2
Deprecated and Inherited methods
Attributes
- Deprecated
-
[Since version 1.3]renamed to suspendThrowable - Inherited from:
- IO2