See inferred types in complex OCaml code

后端 未结 4 924
孤独总比滥情好
孤独总比滥情好 2021-01-02 09:42

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

4条回答
  •  情书的邮戳
    2021-01-02 10:04

    First, you must compile your file (foo.ml) with the -annot flag. 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.

提交回复
热议问题