Cabal - Expose all modules while building library

删除回忆录丶 提交于 2019-12-31 19:02:33

问题


Is it possible to tell Cabal to expose all modules while building a library?

Right now I have to provide very long list of modules in the Exposed-modules cabal configurtion file section.


回答1:


The modern answer is stack + hpack instead of using explicit cabal config. It could automatically expose package modules and provides many other enhancements.




回答2:


You have to list all modules in the cabal configuration file. In your case, you just put the list of modules after exposed-module:. There is no simpler way to write a list of modules.

Cabal cannot automatically find the files that are part of an executable or library, so it relies on the list of modules in the configuration file. Unlike GHC, cabal cannot find modules based on import statements in the source code. If you don't list every module, then you may be able to build the project (because GHC can find source files), but other commands such as cabal sdist will not access the source files that aren't listed.



来源:https://stackoverflow.com/questions/18084265/cabal-expose-all-modules-while-building-library

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