Feature Request : Qualified module exports

David Luposchainsky dluposchainsky at googlemail.com
Mon Jul 8 13:20:52 CEST 2013

On 2013-07-08 12:14, Erik de Castro Lopo wrote:
> I've added a feature request ticket to the GHC trac:
>     http://ghc.haskell.org/trac/ghc/ticket/8043
> for qualified module exports. In a nutshell this would allow the
> following 'qualified module' export eg:
>    module MyModule
>        ( qualified module T
>         )
>    import qualified Data.Text as T
> so that any module which imports MyModule has access to the symbols
> of Data.Text under the quaified module name T.

I'm not sure this is such a good idea.

Haskell's namespace system happens strictly during import - the importer
chooses what name to use, and a module has no influence on how it will
be referred to by other modules.

On the other side, there's the C++-like namespace system, where each
function is defined as part of some namespace, leading to the
"qualification" during export. In other words, if foo is defined in
namespace bar, you will always have to refer to it as bar::foo.

The proposal blurs the line between these two - a module can specify
under what qualified name another module is imported.


More information about the ghc-devs mailing list