Control

turbolift.interpreter.Control
See theControl companion object
abstract class Control[-A, B, S, F[_], U, V] extends A => Computation[F[B], V]

Access to delimited continuation.

Used from custom implementations of effect Interpreter.

Type parameters

A

input of this continuation

B

part of the result of this continuation

F

part of the result of this continuation

S

state of the current effect

U

effect set for higher order operations

V

part of the result of this continuation

Attributes

Companion
object
Graph
Supertypes
trait A => Computation[F[B], V]
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

final def abort(value: F[B]): Computation[F[B], V]
final override def apply(a: A): Computation[F[B], V]

Resumes the continuation.

Resumes the continuation.

Attributes

Definition Classes
Function1
final def apply(a: A, s: S): Computation[F[B], V]

Resumes the continuation, also updating the state.

Resumes the continuation, also updating the state.

Attributes

final def escape[X](body: Computation[X, U]): Computation[(X, This), V]

Execute body in the context, where this continuation has been created.

Execute body in the context, where this continuation has been created.

...

Attributes

final def escape[X](body: Computation[X, U], s: S): Computation[(X, This, S), V]

Like the unary escape, but also with updating the state.

Like the unary escape, but also with updating the state.

Attributes

final def escapeAndAbort(body: Computation[F[B], U]): Computation[F[B], V]
final def escapeAndForget(body: Computation[F[B], U]): Computation[F[B], V]
final def escapeAndForget(body: Computation[F[B], U], s: S): Computation[F[B], V]
final def escapeAndResume(body: Computation[A, U]): Computation[F[B], V]
final def escapeAndResume(body: Computation[A, U], s: S): Computation[F[B], V]
final def local[X](body: Computation[X, U]): Computation[(F[X], This), V]

Handles given computation locally.

Handles given computation locally.

Execute body in the context, where this continuation has been created, as if scope of the currently interpreted effect was delimited by body.

Returns a pair of:

  1. The result of handling of the effect, in the scope delimited by the body.
  2. A fresh Control object.

The fresh Control should be used for subsequent resumption, because it captures actions, that may have been performed inside the body by other effects.

The stale continuation (this) can be resumed too. However, this introduces semantic fragility. Such that, we may find that some of those other effects are undone, even though we have just got a hold on the value computed with their participation.

This alternative behavior is similar to the known problem of Monad Transformers: "catch resets state".

Attributes

final def local[X](body: Computation[X, U], s: S): Computation[(F[X], This, S), V]

Like the unary local, but also with updating the state.

Like the unary local, but also with updating the state.

Attributes

final def localAndForget(body: Computation[B, U]): Computation[F[B], V]
final def localAndForget(body: Computation[B, U], s: S): Computation[F[B], V]
final def localAndResume[X](body: Computation[X, U])(using ev: F[X] <:< A): Computation[F[B], V]
final def localAndResume[X](body: Computation[X, U], s: S)(using ev: F[X] <:< A): Computation[F[B], V]
final def resume(a: A): Computation[F[B], Any]
final def resume(a: A, s: S): Computation[F[B], Any]
final def resumeTupled(a_s: (A, S)): Computation[F[B], Any]
final def tupled(a_s: (A, S)): Computation[F[B], V]

Tupled version of binary apply.

Tupled version of binary apply.

Attributes

Inherited methods

def andThen[A](g: Computation[F[B], V] => A): T1 => A

Attributes

Inherited from:
Function1
def compose[A](g: A => A): A => R

Attributes

Inherited from:
Function1
override def toString(): String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Function1 -> Any
Inherited from:
Function1