FutureAsyncMonadAPI

class FutureAsyncMonadAPI(using x$1: ExecutionContext) extends CpsSchedulingMonad[Future] with CpsMonadInstanceContext[Future]

Default CpsMonad implementation for Future

Source:
FutureAsyncMonad.scala
trait CpsMonadContext[Future]
trait CpsSchedulingMonad[Future]
trait CpsConcurrentMonad[Future]
trait CpsAsyncMonad[Future]
trait CpsTryMonad[Future]
trait CpsMonad[Future]
trait CpsAwaitable[Future]
class Object
trait Matchable
class Any

Type members

Types

type F[+T] = Future[T]
override type WF[T] = Future[T]

Inherited types

type Monad[X] = F[X]
type Spawned[A] = F[A]

In eager monad, spawned process can be represented by F[_]

In eager monad, spawned process can be represented by F[_]

Inherited from:
CpsSchedulingMonad
Source:
CpsMonad.scala

Value members

Concrete methods

def adoptCallbackStyle[A](source: Try[A] => Unit => Unit): Future[A]
override def concurrently[A, B](fa: Future[A], fb: Future[B]): Future[Either[(Try[A], Future[B]), (Future[A], Try[B])]]

join two computations in such way, that they will execute concurrently. Since Future computation is already spawned, we can not spawn waiting for results here

join two computations in such way, that they will execute concurrently. Since Future computation is already spawned, we can not spawn waiting for results here

Definition Classes
Source:
FutureAsyncMonad.scala
def error[A](e: Throwable): Future[A]
def executionContext: ExecutionContext
def flatMap[A, B](fa: Future[A])(f: A => Future[B]): Future[B]
def flatMapTry[A, B](fa: Future[A])(f: Try[A] => Future[B]): Future[B]
def map[A, B](fa: Future[A])(f: A => B): Future[B]
override def mapTry[A, B](fa: Future[A])(f: Try[A] => B): Future[B]
Definition Classes
Source:
FutureAsyncMonad.scala
def pure[T](t: T): Future[T]
override def restore[A](fa: Future[A])(fx: Throwable => Future[A]): Future[A]
Definition Classes
Source:
FutureAsyncMonad.scala
def spawn[A](op: => Future[A]): Future[A]
def tryCancel[A](op: Future[A]): Future[Unit]

returns failed Future, because cancellation is not supported.

returns failed Future, because cancellation is not supported.

Source:
FutureAsyncMonad.scala

Inherited methods

def adoptAwait[A](fa: Future[A]): Future[A]

If is it statically known, that monad is evaluated in this context, then this call is completely eliminated by dotty-cps-async macro

If is it statically known, that monad is evaluated in this context, then this call is completely eliminated by dotty-cps-async macro

Returns:

fa

Inherited from:
CpsMonadInstanceContext
Source:
CpsMonadContext.scala
def apply[T](op: Context => Future[T]): Future[T]

run with this instance

run with this instance

Inherited from:
CpsMonadInstanceContext
Source:
CpsMonadContext.scala
def fromTry[A](r: Try[A]): Future[A]

transform r into pure value or error.

transform r into pure value or error.

Inherited from:
CpsTryMonad
Source:
CpsMonad.scala
def join[A](op: Future[A]): Future[A]

join spawned immediate monad means to receive those spawing monad.

join spawned immediate monad means to receive those spawing monad.

Inherited from:
CpsSchedulingMonad
Source:
CpsMonad.scala
def mapTryAsync[A, B](fa: Future[A])(f: Try[A] => Future[B]): Future[B]

synonym for flatMapTry needed for processing awaits inside mapTry.

synonym for flatMapTry needed for processing awaits inside mapTry.

Inherited from:
CpsTryMonad
Source:
CpsMonad.scala
def spawnEffect[A](op: => Future[A]): Future[Future[A]]

representation of spawnEffect as immediate operation.

representation of spawnEffect as immediate operation.

Inherited from:
CpsSchedulingMonad
Source:
CpsMonad.scala
def tryImpure[A](a: => Future[A]): Future[A]

try to evaluate async operation and wrap successful or failed result into F.

try to evaluate async operation and wrap successful or failed result into F.

Inherited from:
CpsTryMonad
Source:
CpsMonad.scala
def tryPure[A](a: => A): Future[A]

try to evaluate synchonious operation and wrap successful or failed result into F.

try to evaluate synchonious operation and wrap successful or failed result into F.

Inherited from:
CpsTryMonad
Source:
CpsMonad.scala
def tryPureAsync[A](a: () => Future[A]): Future[A]

async shift of tryPure.

async shift of tryPure.

Inherited from:
CpsTryMonad
Source:
CpsMonad.scala
def withAction[A](fa: Future[A])(action: => Unit): Future[A]

ensure that action will run before getting value from fa

ensure that action will run before getting value from fa

Inherited from:
CpsTryMonad
Source:
CpsMonad.scala
def withActionAsync[A](fa: Future[A])(action: () => Future[Unit]): Future[A]

async shift of withAction.

async shift of withAction.

This method is substituted instead withAction, when we use await inside withAction argument.

Inherited from:
CpsTryMonad
Source:
CpsMonad.scala
def withAsyncAction[A](fa: Future[A])(action: => Future[Unit]): Future[A]

return result of fa after completition of action.

return result of fa after completition of action.

Inherited from:
CpsTryMonad
Source:
CpsMonad.scala