Haskell:如何只用ghc生成.hi文件? [英] Haskell: How to only generate .hi file with ghc?

查看:112
本文介绍了Haskell:如何只用ghc生成.hi文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想生成一个 .hi 接口文件和仅 (没有目标文件,根本没有代码生成)。

p>

我试过了

  ghc -fno-code -ohi out.hi myfile .hs 

并获得

  ghc:-ohi只能在编译单个源文件时使用

我不明白,因为我只给出一个源文件。

解决方案

2014年左右, GHC专门为此。现在,您可以调用:

  ghc -fno-code -fwrite-interface ... 

$ b

在某些情况下,它实际上可以加速大约四分之一的编译。


I would like to generate an .hi interface file and only that (no object file, no code generation at all).

I tried

ghc -fno-code -ohi out.hi myfile.hs

and get

ghc: -ohi can only be used when compiling a single source file

which I don't understand since I have only given a single source file.

解决方案

Around 2014, there was an option added to GHC specifically for this. Now, you can invoke:

ghc -fno-code -fwrite-interface ...

It actually speeds up compilation by about a quarter in some cases.

这篇关于Haskell:如何只用ghc生成.hi文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆