FutureAsyncMonadAPI

cps.monads.FutureAsyncMonadAPI
class FutureAsyncMonadAPI(using x$1: ExecutionContext) extends CpsSchedulingMonad[Future] with CpsContextMonad[Future, FutureContext]

Default CpsMonad implementation for Future

Attributes

Graph
Supertypes
trait CpsSchedulingMonad[Future]
trait CpsConcurrentMonad[Future]
trait CpsAsyncMonad[Future]
trait CpsTryMonad[Future]
trait CpsMonad[Future]
trait CpsAwaitable[Future]
class Object
trait Matchable
class Any

Members list

Concise view

Type members

Types

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

Inherited types

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[_]

Attributes

Inherited from:
CpsSchedulingMonad

Value members

Concrete methods

def adoptCallbackStyle[A](source: (Try[A] => Unit) => Unit): Future[A]

called by the source, which accept callback inside

called by the source, which accept callback inside

Attributes

override def applyContext[A](f: FutureContext => Future[A]): Future[A]

Evaluate operation in context.

Evaluate operation in context.

Attributes

Definition Classes
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

Attributes

Definition Classes
def error[A](e: Throwable): Future[A]

represent error e in monadic context.

represent error e in monadic context.

Attributes

def executionContext: ExecutionContext
def flatMap[A, B](fa: Future[A])(f: A => Future[B]): Future[B]

bind combinator, which compose f over fa

bind combinator, which compose f over fa

Attributes

def flatMapTry[A, B](fa: Future[A])(f: Try[A] => Future[B]): Future[B]

flatMap over result of checked evaluation of A

flatMap over result of checked evaluation of A

Attributes

def map[A, B](fa: Future[A])(f: A => B): Future[B]

map a function f over fa

map a function f over fa

Attributes

override def mapTry[A, B](fa: Future[A])(f: Try[A] => B): Future[B]

map over result of checked evaluation of A

map over result of checked evaluation of A

Attributes

Definition Classes
def pure[T](t: T): Future[T]

Pure - wrap value t inside monad.

Pure - wrap value t inside monad.

Note, that pure use eager evaluation, which is different from Haskell.

Attributes

override def restore[A](fa: Future[A])(fx: Throwable => Future[A]): Future[A]

restore fa, ie if fa sucessful - return fa, otherwise apply fx to received error.

restore fa, ie if fa sucessful - return fa, otherwise apply fx to received error.

Attributes

Definition Classes
def spawn[A](op: => Future[A]): Future[A]

schedule execution of op somewhere, immediatly. Note, that characteristics of scheduler can vary.

schedule execution of op somewhere, immediatly. Note, that characteristics of scheduler can vary.

Attributes

def tryCancel[A](op: Future[A]): Future[Unit]

returns failed Future, because cancellation is not supported.

returns failed Future, because cancellation is not supported.

Attributes

Inherited methods

def apply[T](op: Context => Future[T]): F[T]

delegated to applyContext

delegated to applyContext

Attributes

See also:

applyContext

Inherited from:
CpsContextMonad
def fromTry[A](r: Try[A]): F[A]

transform r into pure value or error.

transform r into pure value or error.

Attributes

Inherited from:
CpsTryMonad
def join[A](op: Future[A]): F[A]

join spawned immediate monad means to receive those spawing monad.

join spawned immediate monad means to receive those spawing monad.

Attributes

Inherited from:
CpsSchedulingMonad
override def lazyPure[T](op: => T): F[T]

spawnSync

spawnSync

Attributes

Definition Classes
Inherited from:
CpsSchedulingMonad
def mapTryAsync[A, B](fa: Future[A])(f: Try[A] => Future[B]): F[B]

synonym for flatMapTry needed for processing awaits inside mapTry.

synonym for flatMapTry needed for processing awaits inside mapTry.

Attributes

Inherited from:
CpsTryMonad
def spawnEffect[A](op: => Future[A]): F[F[A]]

representation of spawnEffect as immediate operation.

representation of spawnEffect as immediate operation.

Attributes

Inherited from:
CpsSchedulingMonad
def spawnSync[A](op: => A): F[A]

schedule execution of op somewhere, immediatly. Note, that characteristics of scheduler can vary. TODO: rename to spawn until we not stabilized

schedule execution of op somewhere, immediatly. Note, that characteristics of scheduler can vary. TODO: rename to spawn until we not stabilized

Attributes

Inherited from:
CpsSchedulingMonad
def tryImpure[A](a: => Future[A]): F[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.

Attributes

Inherited from:
CpsTryMonad
def tryPure[A](a: => A): F[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.

Attributes

Inherited from:
CpsTryMonad
def tryPureAsync[A](a: () => Future[A]): F[A]

async shift of tryPure.

async shift of tryPure.

Attributes

Inherited from:
CpsTryMonad
def withAction[A](fa: Future[A])(action: => Unit): F[A]

ensure that action will run before getting value from fa

ensure that action will run before getting value from fa

Attributes

Inherited from:
CpsTryMonad
def withActionAsync[A](fa: Future[A])(action: () => Future[Unit]): F[A]

async shift of withAction.

async shift of withAction.

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

Attributes

Inherited from:
CpsTryMonad
def withAsyncAction[A](fa: Future[A])(action: => Future[Unit]): F[A]

return result of fa after completition of action.

return result of fa after completition of action.

Attributes

Inherited from:
CpsTryMonad