1Effect.Shallow(3) OCaml library Effect.Shallow(3)
2
3
4
6 Effect.Shallow - no description
7
9 Module Effect.Shallow
10
12 Module Shallow
13 : sig end
14
15
16
17
18
19
20
21 type ('a, 'b) continuation
22
23
24
25 ('a,'b) continuation is a delimited continuation that expects a 'a
26 value and returns a 'b value.
27
28
29
30 val fiber : ('a -> 'b) -> ('a, 'b) continuation
31
32
33 fiber f constructs a continuation that runs the computation f .
34
35
36 type ('a, 'b) handler = {
37 retc : 'a -> 'b ;
38 exnc : exn -> 'b ;
39 effc : 'c. 'c Effect.t -> (('c, 'a) continuation -> 'b) option ;
40 }
41
42
43
44 ('a,'b) handler is a handler record with three fields -- retc is the
45 value handler, exnc handles exceptions, and effc handles the effects
46 performed by the computation enclosed by the handler.
47
48
49
50 val continue_with : ('c, 'a) continuation -> 'c -> ('a, 'b) handler ->
51 'b
52
53
54 continue_with k v h resumes the continuation k with value v with the
55 handler h .
56
57
58 Raises Continuation_already_resumed if the continuation has already
59 been resumed.
60
61
62
63 val discontinue_with : ('c, 'a) continuation -> exn -> ('a, 'b) handler
64 -> 'b
65
66
67 discontinue_with k e h resumes the continuation k by raising the excep‐
68 tion e with the handler h .
69
70
71 Raises Continuation_already_resumed if the continuation has already
72 been resumed.
73
74
75
76 val discontinue_with_backtrace : ('a, 'b) continuation -> exn -> Print‐
77 exc.raw_backtrace -> ('b, 'c) handler -> 'c
78
79
80 discontinue_with k e bt h resumes the continuation k by raising the ex‐
81 ception e with the handler h using the raw backtrace bt as the origin
82 of the exception.
83
84
85 Raises Continuation_already_resumed if the continuation has already
86 been resumed.
87
88
89
90 val get_callstack : ('a, 'b) continuation -> int -> Printexc.raw_back‐
91 trace
92
93
94 get_callstack c n returns a description of the top of the call stack on
95 the continuation c , with at most n entries.
96
97
98
99
100
101OCamldoc 2023-07-20 Effect.Shallow(3)