Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

F# type inference (compiler output)

Is there a way to get a structured output of the result of type inference by the F# compiler?

(I am trying to build a small IDE).

like image 371
Giuseppe Maggiore Avatar asked Aug 02 '26 04:08

Giuseppe Maggiore


1 Answers

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:

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

To get information about local variables, you'll need to use the F# compiler as a service. There is a simple command-line example that demonstrates how to call the API and you can also explore the F# binding for MonoDevelop.

like image 163
Tomas Petricek Avatar answered Aug 03 '26 18:08

Tomas Petricek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!