Search code examples
ocamltraceocaml-toplevel

Is it possible to trace auxiliary functions in the Ocaml REPL


What I would like to do is trace the function aux that has restricted scope in a definition like:

let example = function 
  arg -> 
    let rec aux =  
      (* some recursive function body*)  
    in 
    aux arg 
;;

with #trace or a similar toplevel command, so that the trace appears when example is called.

(without just copy-pasting the auxiliary function under some other name and passing it to the toplevel)

note: I am using tuareg mode on emacs


Solution

  • No. In the toplevel, you can trace only toplevel functions.