FutureAsyncMonadAPI

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

Default CpsMonad implementation for Future

Attributes

Source
FutureAsyncMonad.scala
Graph
Supertypes
trait CpsSchedulingMonad[Future]
trait CpsConcurrentMonad[Future]
trait CpsAsyncMonad[Future]
trait CpsTryMonad[Future]
trait CpsTrySupport[Future]
trait CpsThrowMonad[Future]
trait CpsThrowSupport[Future]
trait CpsMonad[Future]
class Object
trait Matchable
class Any
Show all

Members list

Type members

Types

Attributes

Source
FutureAsyncMonad.scala
type F[+T] = Future[T]

Attributes

Source
FutureAsyncMonad.scala
override type WF[T] = Future[T]

Attributes

Source
FutureAsyncMonad.scala

Inherited types

type Spawned[A] = Future[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
Source
CpsMonad.scala

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

Source
FutureAsyncMonad.scala
override def applyContext[A](f: FutureContext => Future[A]): Future[A]

Evaluate operation in context.

Evaluate operation in context.

Attributes

Definition Classes
Source
FutureAsyncMonad.scala
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
Source
FutureAsyncMonad.scala
def error[A](e: Throwable): Future[A]

represent error e in monadic context.

represent error e in monadic context.

Attributes

Source
FutureAsyncMonad.scala
def executionContext: ExecutionContext

Attributes

Source
FutureAsyncMonad.scala
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

Source
FutureAsyncMonad.scala
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

Source
FutureAsyncMonad.scala
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

Source
FutureAsyncMonad.scala
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
Source
FutureAsyncMonad.scala
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

Source
FutureAsyncMonad.scala
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
Source
FutureAsyncMonad.scala
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

Source
FutureAsyncMonad.scala
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

Source
FutureAsyncMonad.scala

Inherited methods

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

delegated to applyContext

delegated to applyContext

Attributes

See also

applyContext

Definition Classes
Inherited from:
CpsTryContextMonad
Source
CpsMonadContext.scala
override def flatWrap[T](op: => Future[T]): Future[T]

Wrap and flatten of monadic expression..

Wrap and flatten of monadic expression..

Attributes

Definition Classes
Inherited from:
CpsSchedulingMonad
Source
CpsMonad.scala
def flatten[T](ffa: Future[Future[T]]): Future[T]

Attributes

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

transform r into pure value or error.

transform r into pure value or error.

Attributes

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.

Attributes

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.

Attributes

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

spawn the process of spawning. Used to unify concurrent operation in lazy and eager monads.

spawn the process of spawning. Used to unify concurrent operation in lazy and eager monads.

Attributes

Inherited from:
CpsSchedulingMonad
Source
CpsMonad.scala
def spawnSync[A](op: => A): Future[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
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.

Attributes

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.

Attributes

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

async shift of tryPure.

async shift of tryPure.

Attributes

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

Attributes

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.

Attributes

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.

Attributes

Inherited from:
CpsTryMonad
Source
CpsMonad.scala
def withAsyncErrorHandler[A](fa: => Future[A])(f: Throwable => Future[A]): Future[A]

Attributes

Inherited from:
CpsTrySupport
Source
CpsMonad.scala
def withAsyncFinalizer[A](fa: => Future[A])(f: => Future[Unit]): Future[A]

Attributes

Inherited from:
CpsTrySupport
Source
CpsMonad.scala
override def wrap[T](op: => T): Future[T]

spawnSync

spawnSync

Attributes

Definition Classes
Inherited from:
CpsSchedulingMonad
Source
CpsMonad.scala