简体   繁体   中英

Cabal - Expose all modules while building library

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.

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

You have to list all modules in the cabal configuration file. In your case, you just put the list of modules after exposed-modules: . 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM