CompletableFutureCpsMonad

cps.monads.CompletableFutureCpsMonad$package$.CompletableFutureCpsMonad$
object CompletableFutureCpsMonad extends CpsSchedulingMonad[[T <: <FromJavaObject>] =>> CompletableFuture[T]] with CpsMonadInstanceContext[[T <: <FromJavaObject>] =>> CompletableFuture[T]]

Attributes

Source:
CompletableFutureCpsMonad.scala
Graph
Supertypes
trait CpsMonadInstanceContext[[T <: <FromJavaObject>] =>> CompletableFuture[T]]
trait CpsSchedulingMonad[[T <: <FromJavaObject>] =>> CompletableFuture[T]]
trait CpsConcurrentMonad[[T <: <FromJavaObject>] =>> CompletableFuture[T]]
trait CpsAsyncMonad[[T <: <FromJavaObject>] =>> CompletableFuture[T]]
trait CpsTryMonad[[T <: <FromJavaObject>] =>> CompletableFuture[T]]
trait CpsMonad[[T <: <FromJavaObject>] =>> CompletableFuture[T]]
trait CpsAwaitable[[T <: <FromJavaObject>] =>> CompletableFuture[T]]
class Object
trait Matchable
class Any
Self type

Members list

Concise view

Type members

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
Source:
CpsMonad.scala
type WF[X] = F[X]

Attributes

Inherited from:
CpsMonad
Source:
CpsMonad.scala

Value members

Concrete methods

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

called by the source, which accept callback inside

called by the source, which accept callback inside

Attributes

Source:
CompletableFutureCpsMonad.scala
def error[A](e: Throwable): CompletableFuture[A]

represent error e in monadic context.

represent error e in monadic context.

Attributes

Source:
CompletableFutureCpsMonad.scala
def flatMap[A, B](fa: CompletableFuture[A])(f: A => CompletableFuture[B]): CompletableFuture[B]

bind combinator, which compose f over fa

bind combinator, which compose f over fa

Attributes

Source:
CompletableFutureCpsMonad.scala
override def flatMapTry[A, B](fa: CompletableFuture[A])(f: Try[A] => CompletableFuture[B]): CompletableFuture[B]

flatMap over result of checked evaluation of A

flatMap over result of checked evaluation of A

Attributes

Definition Classes
Source:
CompletableFutureCpsMonad.scala
def map[A, B](fa: CompletableFuture[A])(f: A => B): CompletableFuture[B]

map a function f over fa

map a function f over fa

Attributes

Source:
CompletableFutureCpsMonad.scala
override def mapTry[A, B](fa: CompletableFuture[A])(f: Try[A] => B): CompletableFuture[B]

map over result of checked evaluation of A

map over result of checked evaluation of A

Attributes

Definition Classes
Source:
CompletableFutureCpsMonad.scala
def pure[T](t: T): CompletableFuture[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:
CompletableFutureCpsMonad.scala
override def restore[A](fa: CompletableFuture[A])(fx: Throwable => CompletableFuture[A]): CompletableFuture[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:
CompletableFutureCpsMonad.scala
def spawn[A](op: => CompletableFuture[A]): CompletableFuture[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:
CompletableFutureCpsMonad.scala
def tryCancel[A](op: CompletableFuture[A]): CompletableFuture[Unit]

Send cancel signal, which can be accepted or rejected by op flow.

Send cancel signal, which can be accepted or rejected by op flow.

Attributes

Source:
CompletableFutureCpsMonad.scala

Inherited methods

def adoptAwait[A](fa: CompletableFuture[A]): F[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

Attributes

Returns:

fa

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

run with this instance

run with this instance

Attributes

Inherited from:
CpsMonadInstanceContext
Source:
CpsMonadContext.scala
def concurrently[A, B](fa: CompletableFuture[A], fb: CompletableFuture[B]): F[Either[(Try[A], Spawned[B]), (Spawned[A], Try[B])]]

join two computations in such way, that they will execute concurrently.

join two computations in such way, that they will execute concurrently.

Attributes

Inherited from:
CpsConcurrentMonad
Source:
CpsMonad.scala
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
Source:
CpsMonad.scala
def join[A](op: CompletableFuture[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
Source:
CpsMonad.scala
override def lazyPure[T](op: => T): F[T]

spawnSync

spawnSync

Attributes

Definition Classes
Inherited from:
CpsSchedulingMonad
Source:
CpsMonad.scala
def mapTryAsync[A, B](fa: CompletableFuture[A])(f: Try[A] => CompletableFuture[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
Source:
CpsMonad.scala
def spawnEffect[A](op: => CompletableFuture[A]): F[F[A]]

representation of spawnEffect as immediate operation.

representation of spawnEffect as immediate operation.

Attributes

Inherited from:
CpsSchedulingMonad
Source:
CpsMonad.scala
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
Source:
CpsMonad.scala
def tryImpure[A](a: => CompletableFuture[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
Source:
CpsMonad.scala
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
Source:
CpsMonad.scala
def tryPureAsync[A](a: () => CompletableFuture[A]): F[A]

async shift of tryPure.

async shift of tryPure.

Attributes

Inherited from:
CpsTryMonad
Source:
CpsMonad.scala
def withAction[A](fa: CompletableFuture[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
Source:
CpsMonad.scala
def withActionAsync[A](fa: CompletableFuture[A])(action: () => CompletableFuture[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
Source:
CpsMonad.scala
def withAsyncAction[A](fa: CompletableFuture[A])(action: => CompletableFuture[Unit]): F[A]

return result of fa after completition of action.

return result of fa after completition of action.

Attributes

Inherited from:
CpsTryMonad
Source:
CpsMonad.scala