Continuations

continuations4s.Continuations
See theContinuations companion object

Support for suspension capabilities through a delimited continuation interface.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Type members

Classlikes

trait SuspensionBase[-T, +R]

The delimited continuation suspension interface. Represents a suspended computation asking for a value of type T to continue (and eventually returning a value of type R, which is the result that the whole delimited continuation will eventually produce).

The delimited continuation suspension interface. Represents a suspended computation asking for a value of type T to continue (and eventually returning a value of type R, which is the result that the whole delimited continuation will eventually produce).

Attributes

Supertypes
class Object
trait Matchable
class Any

Types

type Boundary[+R]

Platform-specific result of boundary.

Platform-specific result of boundary.

Attributes

type Label[R]

A marker for the "limit" of "delimited continuation".

A marker for the "limit" of "delimited continuation".

Attributes

type Suspension[-T, +R] <: SuspensionBase[T, R]

The provided suspension type.

The provided suspension type.

Attributes

Value members

Abstract methods

def boundary[R](body: Label[R] ?=> R): Boundary[R]

Set the suspension marker as the body's caller, and execute body.

Set the suspension marker as the body's caller, and execute body.

Attributes

Returns

the result of the boundary. Note that this is platform-specific. Ideally we could return just R, however, this either implies platform support for delimited continuations (Scala Native), or blocking threads (JVM). On top of JS/WASM engines, blocking can only happen in the context of a js.async scope, therefore, we have to work with js.Promise.

def boundaryAsFuture[R](body: Label[R] ?=> R)(using ExecutionContext): Future[R]

Variant of boundary that returns the result as a scala.concurrent.Future.

Variant of boundary that returns the result as a scala.concurrent.Future.

Common-denominator between platforms, useful for testing.

Attributes

def suspend[T, R](body: Suspension[T, R] => R)(using Label[R]): T

Should return immediately if resume is called from within body

Should return immediately if resume is called from within body

Attributes