Using Merlin 2.5.4, what is the correct way to print the signature of an OCaml file in my project? E.g., suppose I have:
(* foo.ml *)
let x = 1
And I want to get:
val x : int
What is the proper command (or sequence of commands)?
What I've tried:
I temporarily wrapped up the file in a submodule: module Foo = struct let x = 1 end
, then ran:
$ ocamlmerlin
["type","expression","Foo","at",{"line":1,"col":7}]
But I get:
["error",{"start":{"line":1,"col":0},"end":{"line":1,"col":3},"type":"type","sub":[],"valid":true,"message":"Error: Unbound constructor Foo"}]
Which makes sense, because I haven't actually mentioned which file I'm querying, nor does the query ( https://github.com/ocaml/merlin/blob/master/doc/dev/OLD-PROTOCOL.md#type-checking ) allow me to.
E I should mention that I'm using BuckleScript, not ocamlc
, and also ocamlc -i
only works if I specify not just my module but all its module dependencies; I'm looking for something that automatically manages those dependencies.