[Haskell-cafe] Cabal: wrapping namespace of a package into top-level module
Ivan Lazar Miljenovic
ivan.miljenovic at gmail.com
Tue May 24 06:47:08 CEST 2011
On 24 May 2011 14:38, max ulidtko <ulidtko at gmail.com> wrote:
> Hi haskell-cafe.
>
> I have a package which builds with cabal pretty fine, but there is
> namespace issue which disturbs me. The problem is that the package
> exports (to the toplevel namespace!) some modules with fairly general
> names, like Tests, Basics, Applications. This is probably an oversight
> of the original package author, and the namespace shouldn't be organised
> like this... but it is. And I'm looking for a way to avoid potential
> namespace troubles should I install the package, other than going and
> reforming the namespace tree myself.
>
> What I was thinking about was some cabal option to "wrap" package's
> namespace into a toplevel module, say "PackageName", so that module
> Tests could be imported by usual code with `import PackageName.Tests`.
> Is that possible with cabal?
>
> Things are further complicated by the numerous intra-library imports.
> While the "outside" code refers to a module with PackageName.ModuleName,
> it would be very desirable that "inside" code used just straight
> ModuleName.
The only real option I can think of is to use GHC's package imports
functionality: http://haskell.org/ghc/docs/latest/html/users_guide/syntax-extns.html#package-imports
. However, its usage is usually discouraged.
--
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
IvanMiljenovic.wordpress.com
More information about the Haskell-Cafe
mailing list