Effect.Shallow(3)

✨ NAME ✨

omg hi bestie πŸ’– welcome to the Effect.Shallow(3) page. The official NAME section is literally β€œno description” β€” iconic, mysterious, zero notes. But it’s all about shallow effect handlers and delimited continuations, and we’re gonna get you comfy with it. πŸ¦‹


🧩 Module 🧩

Module Effect.Shallow

πŸ“š Documentation πŸ“š

🧚 Module Shallow

Module Shallow
 : sig end

Okay so here’s the whole Shallow module vibe β€” it’s giving β€œsmall but powerful,” and every type and val below is exactly what’s on the menu. πŸ’…

  • type ('a, 'b) continuation β€” bestie, this is a delimited continuation that expects a 'a value and returns a 'b value. lowkey main character energy: it’s waiting for a value, then it gives you a result. πŸŽ€
  • val fiber : ('a -> 'b) -> ('a, 'b) continuation β€” fiber f constructs a continuation that runs the computation f. slay. ✨
  • type ('a, 'b) handler = { ... } β€” this is the handler record with three fields. not me being obsessed with a record, but here we are:
type ('a, 'b) handler = {
 retc : 'a -> 'b ;
 exnc : exn -> 'b ;
 effc : 'c. 'c Effect.t -> (('c, 'a) continuation -> 'b) option ;
 }

So: retc is the value handler, exnc handles exceptions, and effc handles the effects performed by the computation enclosed by the handler. periodt. 🫢

  • val continue_with : ('c, 'a) continuation -> 'c -> ('a, 'b) handler -> 'b β€” continue_with k v h resumes the continuation k with value v with the handler h. πŸ’–
Raises Continuation_already_resumed if the continuation has already been resumed. (so don’t double-resume, bestie, it’s not that kind of party 😭)
  • val discontinue_with : ('c, 'a) continuation -> exn -> ('a, 'b) handler -> 'b β€” discontinue_with k e h resumes the continuation k by raising the exception e with the handler h. dramatic? yes. valid? also yes. πŸ’€
Raises Continuation_already_resumed if the continuation has already been resumed.
  • val discontinue_with_backtrace : ('a, 'b) continuation -> exn -> Printexc.raw_backtrace -> ('b, 'c) handler -> 'c β€” the doc describes it as discontinue_with k e bt h: it resumes the continuation k by raising the exception e with the handler h, using the raw backtrace bt as the origin of the exception. backtrace lore fr fr. πŸ”₯
Raises Continuation_already_resumed if the continuation has already been resumed.
  • val get_callstack : ('a, 'b) continuation -> int -> 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. peek at the stack, but make it delimited. ⭐

mwah πŸ’‹ β€” OCamldoc, 2026-06-22. byeee πŸ‘‘

πŸ“¦ where this page comes from