有没有办法只将 Haskell 源代码编译为接口文件,而不是进一步编译?

Is there a way to only compile Haskell source to interface file, not further?

通常,ghc在编译源代码时,至少会产生一个.o(对象)和一个.hi(接口)文件。

为了减少编译时间,如果我只需要一个接口文件,我可以命令 ghc 放弃其他所有东西,只给我所说的接口文件吗?或者,否则,通过任何卑鄙的诡计获得该接口?

我找到了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,什么都没有浮上来,但现在情况不一样了?

最有可能的是,我预计它会破解 ghc。如果是这样,我想知道方向:

否则,也许我可以从 ghc 代码中提取相关部分,然后我可以从 -ddump-types 等的输出中编译一个 .hi 文件?

实际上,有一个标志 -fno-code -fwrite-interface 可以做到这一点。它实际上将一个简单示例的编译时间缩短了大约四分之一。