Control

turbolift.interpreter.Control
final class Control[S, Q, F[_], L, N, M]

Access to delimited continuation.

This is a Primitive Effect, provided for implementing custom effects:

  1. It's accessible only from within custom implementations of Interpreters. Custom effects can invoke Control's operations to implement their own operations.

  2. It does not require a handler. Invoking Control's operations does not manifest as a dependency.

See also another primitive effect: Local.

Type parameters

F

result, same as To[+_] of the corresponding interpreter.

L

effect set, same as Elim of the corresponding interpreter.

M

effect set, same as Ambient of the corresponding interpreter.

N

effect set, same as Intro of the corresponding interpreter.

Q

effect set, same as Unknown of the corresponding interpreter.

S

local state, same as Local of the corresponding interpreter.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Type members

Types

type Cont[A, U] = Continuation[A, F[Q], S, U]

Value members

Concrete methods

def abort(value: F[Q]): Computation[Nothing, M & N]

Unwind the stack until the end of the effect's scope.

Unwind the stack until the end of the effect's scope.

Can be thought of as invoking the continuation zero times, as in: capture(_ => value).

However, abort(value) also invokes finalization clauses during stack unwinding.

Attributes

def capture[A, U <: M & N](f: (Cont[A, U]) => Computation[F[Q], U]): Computation[A, U]

Captures the continuation.

Captures the continuation.

Unwinds the stack up to the end of the effect's scope. The unwound part of the stack is reified as a Continuation object.

Attributes

def captureGet[A, U <: M & N](f: (Cont[A, U], S) => Computation[F[Q], U]): Computation[A, U]

Like capture, except it also accesses the local state.

Like capture, except it also accesses the local state.

Fusion of Local.get and capture.

Attributes

def delimit[A, U <: M & N](body: Computation[A, U]): Computation[F[A], U]

Changes scope of the effect.

Changes scope of the effect.

The scope of the effect is defined as either:

  • The body of the innermost delimit call.
  • The the whole scope of the effect's handler, if none of the above is found.

Attributes

def delimitModify[A, U <: M & N](body: Computation[A, U], f: S => S): Computation[F[A], U]

Like delimitPut, but modifies the local state, instead of replacing it.

Like delimitPut, but modifies the local state, instead of replacing it.

Attributes

def delimitPut[A, U <: M & N](body: Computation[A, U], s: S): Computation[F[A], U]

Like delimit, but also replaces the local state.

Like delimit, but also replaces the local state.

Upon exit of delimit's body, the local state is restored to its original value.

Attributes

def reinterpret[A, U <: M & N](body: Computation[A, L & U]): Computation[A, U]

Reinterpret a computation.

Reinterpret a computation.

Allows this effect's operations to be invoked inside its own interpreter.

Attributes

def shadow[A, U](using N <:< L)(body: Computation[A, U]): Computation[A, U]

Bypass current interpreter.

Bypass current interpreter.

Attributes

def strip[A, U <: N](body: Computation[A, M & U]): Computation[A, U]

Strips away the Ambient effect.

Strips away the Ambient effect.

Useful when we need a continuation to outlive the interpreter that captured it.

Attributes