Usually, when ghc
is compiling a source code, it will produce at least an .o
(object) and a .hi
(interface) file.
In the interest of diminishing compilation time, if I only need an interface file, can I somehow order ghc
to abandon everything else and just give me said interface file? Or, otherwise, obtain that interface by any kind of lowly guile?
I found this ghc
user guide part and it says nothing of such. This one doesn't even mention "interface" anywhere in its text. (In particular, -fno-code
doesn't generate it.) It must mean there's no easy way. In this question from five years ago, nothing floated up, but by chance things are different now?
Most likely, I expect it to take a hack to ghc
. If so, I'd like directions:
.hi
file distinct from something like -ddump-types
, just binary?.hi
file takes strictly less compilation stages than a complete .o
file? (For example, if there are hashes of machine code fragments within .hi
, the corresponding code will probably have to be generated, which means nothing is to be gained here.)Otherwise, perhaps I can just extract related parts from ghc
code so that I can then compile a .hi
file from the output of -ddump-types
or the like?
Actually, there is a flag -fno-code -fwrite-interface
that does this. It actually cuts compilation time for even a simplistic example by about a quarter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With