On Fri, Mar 5, 2021 at 2:04 PM Kenichi Asai wrote: > A side question. How can I find what hooks are available? By looking > at the source and finding what functions are defined as refs? (I find > that parse_toplevel_phrase, parse_use_file, and toplevel_startup_hook > are defined as refs in toploop.ml, so they can be replaced?) > That's the idea. Only the refs exposed in the mli can be set from the outside though. > What if there is no such hook? For the type debugger, I want to call > a specific function whenever a type error occurs in the second > execute_phrase (right after "with exn ->") in toploop.ml. But there > is no hook there. Since the execute_phrase function is not defined as > a ref, I cannot replace it, either. What can I do then? > If there is no hook, I'm afraid there is no good solution at the moment; you need to patch the toplevel library, or copy some of its code and modify it. -- Jeremie