haskell / haskell/cabal

Module listing discovery (wildcard glob)

Open
#5,343 45 comments 66 reactions 0 assignees View on GitHub
Cabal: file format exact-print historical re: globbing type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

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`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.