简体   繁体   English

F#类型推断(编译器输出)

[英]F# type inference (compiler output)

Is there a way to get a structured output of the result of type inference by the F# compiler? 有没有办法通过F#编译器获得类型推断结果的结构化输出?

(I am trying to build a small IDE). (我正在尝试构建一个小型IDE)。

Assuming you have a file test.fs , you can use the following command to generate F# Signature File test.fsi , which contains type information about all top-level definitions: 假设您有一个文件test.fs ,您可以使用以下命令生成F#签名文件test.fsi ,其中包含有关所有顶级定义的类型信息:

Fsc.exe --sig:test.fsi test.fs

To get information about local variables, you'll need to use the F# compiler as a service. 要获取有关局部变量的信息,您需要使用F#编译器作为服务。 There is a simple command-line example that demonstrates how to call the API and you can also explore the F# binding for MonoDevelop . 有一个简单的命令行示例演示如何调用API,您还可以探索MonoDevelopF#绑定

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM