Effect.Deep(3) OCaml library Effect.Deep(3)

# [NAME](#NAME)

Effect.Deep - no description

# [Module](#Module)

Module Effect.Deep

# [Documentation](#Documentation)

Module **Deep**  
: **sig end**

Deep handlers

*type* **('a, 'b)** *continuation* = **('a, 'b) continuation**

**('a,'b) continuation** is a delimited continuation that expects a **'a** value and returns a **'b** value.

*val continue* : **('a, 'b) continuation -&gt; 'a -&gt; 'b**

**continue k x** resumes the continuation **k** by passing **x** to **k** .

**Raises Continuation\_already\_resumed** if the continuation has already been resumed.

*val discontinue* : **('a, 'b) continuation -&gt; exn -&gt; 'b**

**discontinue k e** resumes the continuation **k** by raising the exception **e** in **k** .

**Raises Continuation\_already\_resumed** if the continuation has already been resumed.

*val discontinue\_with\_backtrace* : **('a, 'b) continuation -&gt;** **exn -&gt; Printexc.raw\_backtrace -&gt; 'b**

**discontinue\_with\_backtrace k e bt** resumes the continuation **k** by raising the exception **e** in **k** using **bt** as the origin for the exception.

**Raises Continuation\_already\_resumed** if the continuation has already been resumed.

*type* **('a, 'b)** *handler* = {  
retc : **'a -&gt; 'b** ;  
exnc : **exn -&gt; 'b** ;  
effc : **'c. 'c Effect.t -&gt; (('c, 'b) continuation -&gt; 'b) option** ;  
}

**('a,'b) handler** is a handler record with three fields -- **retc** is the value handler, **exnc** handles exceptions, and **effc** handles the effects performed by the computation enclosed by the handler.

*val match\_with* : **('c -&gt; 'a) -&gt; 'c -&gt; ('a, 'b) handler -&gt; 'b**

**match\_with f v h** runs the computation **f v** in the handler **h** .

*type* **'a** *effect\_handler* = {  
effc : **'b. 'b Effect.t -&gt; (('b, 'a) continuation -&gt; 'a) option** ;  
}

**'a effect\_handler** is a deep handler with an identity value handler **fun x -&gt; x** and an exception handler that raises any exception **fun e -&gt; raise e** .

*val try\_with* : **('b -&gt; 'a) -&gt; 'b -&gt; 'a effect\_handler -&gt; 'a**

**try\_with f v h** runs the computation **f v** under the handler **h** .

*val get\_callstack* : **('a, 'b) continuation -&gt; int -&gt; Printexc.raw\_backtrace**

**get\_callstack c n** returns a description of the top of the call stack on the continuation **c** , with at most **n** entries.

2026-09-04 OCamldoc

---

Document: Effect.Deep(3o) from ocaml 5.5.1-r0 (Chainguard OS)
Source: https://github.com/ocaml/ocaml
