I’m a OCaml newbie working with some pretty complex (at least for me) OCaml code I didn’t write. It would help a lot to understand it if I could see the inferred types for some of the values, as I can do with F# and Visual Studio by hovering over any value, e.g.:

(screenshot borrowed from http://theburningmonk.com/2010/01/learning-f-part-1/)
I guess I could break down the code and feed it to the toplevel to get the types, but is there any other, simpler way?
First, you must compile your file (
foo.ml) with the-annotflag. This generates the annotation file (foo.annot) that contains type information about all identifiers inside. You can include this as part of your makefile or build process.Then, you need to rely on your IDE to display that information. I do this in Tuareg (the emacs mode) using Ctrl+C, Ctrl+T, which highlights the current expression and displays its type.