1Effect.Deep(3) OCaml library Effect.Deep(3)
2
3
4
6 Effect.Deep - no description
7
9 Module Effect.Deep
10
12 Module Deep
13 : sig end
14
15
16
17
18
19
20
21
22
23 Deep handlers
24
25 type ('a, 'b) continuation
26
27
28
29 ('a,'b) continuation is a delimited continuation that expects a 'a
30 value and returns a 'b value.
31
32
33
34 val continue : ('a, 'b) continuation -> 'a -> 'b
35
36
37 continue k x resumes the continuation k by passing x to k .
38
39
40 Raises Continuation_already_resumed if the continuation has already
41 been resumed.
42
43
44
45 val discontinue : ('a, 'b) continuation -> exn -> 'b
46
47
48 discontinue k e resumes the continuation k by raising the exception e
49 in k .
50
51
52 Raises Continuation_already_resumed if the continuation has already
53 been resumed.
54
55
56
57 val discontinue_with_backtrace : ('a, 'b) continuation -> exn -> Print‐
58 exc.raw_backtrace -> 'b
59
60
61 discontinue_with_backtrace k e bt resumes the continuation k by raising
62 the exception e in k using bt as the origin for the exception.
63
64
65 Raises Continuation_already_resumed if the continuation has already
66 been resumed.
67
68
69 type ('a, 'b) handler = {
70 retc : 'a -> 'b ;
71 exnc : exn -> 'b ;
72 effc : 'c. 'c Effect.t -> (('c, 'b) continuation -> 'b) option ;
73 }
74
75
76
77 ('a,'b) handler is a handler record with three fields -- retc is the
78 value handler, exnc handles exceptions, and effc handles the effects
79 performed by the computation enclosed by the handler.
80
81
82
83 val match_with : ('c -> 'a) -> 'c -> ('a, 'b) handler -> 'b
84
85
86 match_with f v h runs the computation f v in the handler h .
87
88
89 type 'a effect_handler = {
90 effc : 'b. 'b Effect.t -> (('b, 'a) continuation -> 'a) option ;
91 }
92
93
94
95 'a effect_handler is a deep handler with an identity value handler fun
96 x -> x and an exception handler that raises any exception fun e ->
97 raise e .
98
99
100
101 val try_with : ('b -> 'a) -> 'b -> 'a effect_handler -> 'a
102
103
104 try_with f v h runs the computation f v under the handler h .
105
106
107
108 val get_callstack : ('a, 'b) continuation -> int -> Printexc.raw_back‐
109 trace
110
111
112 get_callstack c n returns a description of the top of the call stack on
113 the continuation c , with at most n entries.
114
115
116
117
118
119OCamldoc 2023-07-20 Effect.Deep(3)