opened 05:34AM - 24 May 18 UTC
type: enhancement
Cabal: file format
exact-print
historical
Now that `cabal` has common stanzas, the only thing keeping me using `hpack` is … that `hpack` will, by default, autodiscover all of your modules and stuff them into `exposed-modules` (you can disable this by explicitly defining that stanza). This feature is *really* convenient to me.
Mimicing that behavior seems like it might be against the `Cabal` philosophy, as it's implicit -- "If `exposed-modules` is not defined, collect all modules not listed in `other-modules` and make them `exposed-modules`."
A middle ground solution that provides convenience with a degree of explicitness is glob patterns for the module listings. Consider this syntax:
exposed-modules: *
This would find all modules in the source directory and add them as `exposed-modules`. Kinda like `hpack`'s autodiscovery, but we're explicitly writing "please find all the modules for me."
You could also write:
exposed-modules:
Control.Monad.*
which would only collect modules under the `Control.Monad` namespace into `exposed-modules` -- any other modules would need to be either explicitly added to `exposed-modules` or `other-modules`.
There are very good arguments against this that indicate a) it’s not cabal’s job and b) can be easily implemented the unix way by another tool (or your IDE), which has been done already .
2 Likes