Haskell: How to only generate .hi file with ghc?

拈花ヽ惹草 提交于 2019-11-30 22:37:40

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.

Use -c option, or else ghc wants to link, not just to compile:

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

UPDATE: but it doesn't really help, because -fno-code prevents .hi creation.

ghc -o /dev/null -ohi out.hi -c myfile.hs

This one throws away the result of compilation. However, it will also avoid unnecessary compilation if out.hi is up to date.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!