resume-to transfers control to the nearest enclosing resumable handler that matches the resumption value.

Syntax

(resume-to ⟨resumption-expr⟩)

Semantics

  • The argument’s type must be an instance of the Resumption class, which holds exactly for types defined with define-resumption. resume-to has the type Resumption :r => :r -> :a, so functions that resume with a value of unknown type are polymorphic over resumption types.
  • Control leaves the current computation and enters the matching resumable branch.
  • resume-to is typically called from a handle branch, which runs before unwinding, to recover from an exception thrown inside a resumable expression. A catch branch runs after unwinding, so it can only resume to resumptions established outside the catch.

Example

(define (serve-raw egg)
  (resume-to (ServeRaw egg)))