Library
Module
Module type
Parameter
Class
Class type
a resumption
is a managed variation of Effect.Shallow.continuation
that can be used multiple times.
val promote : ('a, 'b) Effect.Shallow.continuation -> ('a, 'b) resumption
promote k
converts a regular linear shallow continuation to a multi-shot shallow resumption. This function fully consumes the supplied continuation k
.
val resume_with :
('c, 'a) resumption ->
'c ->
('a, 'b) Effect.Shallow.handler ->
'b
resume r v h
reinstates the context captured by the multi-shot shallow resumption r
with value v
under the handler h
.
val abort_with :
('c, 'a) resumption ->
exn ->
('a, 'b) Effect.Shallow.handler ->
'b
abort r e h
injects the exception e
into the context captured by the multi-shot shallow resumption r
under the handler h
.
val abort_with_backtrace :
('c, 'a) resumption ->
exn ->
Printexc.raw_backtrace ->
('a, 'b) Effect.Shallow.handler ->
'b
abort_with_backtrace k e bt
aborts the shallow multi-shot resumption r
by raising the exception e
in k
using bt
as the origin for the exception.
val clone_continuation :
('a, 'b) Effect.Shallow.continuation ->
('a, 'b) Effect.Shallow.continuation
clone_continuation k
clones the linear shallow continuation k
. The supplied continuation is *not* consumed.
val drop_continuation : ('a, 'b) Effect.Shallow.continuation -> unit
drop_continuation k
deallocates the memory occupied by the continuation k
. Note, however, that this function does not clean up acquired resources captured by the continuation. In order to delete the continuation and free up the resources the programmer should instead use discontinue_with
from the Effect.Shallow
module.