diff --git a/src/Scope.ml b/src/Scope.ml index 5f670b0d..af6ad001 100644 --- a/src/Scope.ml +++ b/src/Scope.ml @@ -97,6 +97,11 @@ struct let try_with = Mod.try_with + let register_printer = Mod.register_printer + + (* This overrides the default printer registered by Mod. *) + let () = register_printer @@ fun _ -> Some "Unhandled yuujinchou effect; use Yuujinchou.Scope.run" + module type Perform = Mod.Perform module Perform = Mod.Perform module Silence = Mod.Silence diff --git a/src/ScopeSigs.ml b/src/ScopeSigs.ml index 8e7e71ef..6ea2a0d5 100644 --- a/src/ScopeSigs.ml +++ b/src/ScopeSigs.ml @@ -200,4 +200,7 @@ section { A consequence of the semantic difference between {!val:run} and [try_with] is that {!val:run} starts a fresh empty scope while [try_with] stays in the current scope. *) + + val register_printer : ([ `NotFound of context option * Trie.bwd_path | `Shadow of context option * Trie.bwd_path * (data * tag) * (data * tag) | `Hook of context option * Trie.bwd_path * hook * (data, tag) Trie.t ] -> string option) -> unit + (** [register_printer f] registers a printer [p] via {!val:Printexc.register_printer} to turn unhandled internal effects into strings for the OCaml runtime system to display them. See {!val:Yuujinchou.Modifier.S.register_printer}. *) end