[Haskell-cafe] Is it possible to export module aliases?

Simon Peyton-Jones simonpj at microsoft.com
Wed May 3 07:18:35 EDT 2006


Are you asking for the same thing as described under "Permit qualified
exports" on this Haskell Prime page?

	
http://haskell.galois.com/cgi-bin/haskell-prime/trac.cgi/wiki/ModuleSyst
em

Simon

| -----Original Message-----
| From: haskell-cafe-bounces at haskell.org
[mailto:haskell-cafe-bounces at haskell.org] On Behalf Of
| Brian Hulley
| Sent: 27 April 2006 02:51
| To: Haskell-cafe
| Subject: [Haskell-cafe] Is it possible to export module aliases?
| 
| Hi -
| Given some large list of modules which need to be used qualified, I'd
like
| to be able to make a convenience module that I could use instead, and
which
| would export all these modules also qualified by an alias, ie:
| 
| module Top
|        ( module qualified Top.First as First
|        , module qualified Top.Second as Second
|        ) where ...
| import qualified Top.First
| 
| so that I could then say:
| 
| import Top
| 
| main = do
|    a <- First.create ...
|    b <- Second.create ...
| 
| instead of having to always write:
| 
| import qualified Top.First as First
| import qualified Top.Second as Second
| -- this may be a *very* long list
| 
| in every module that uses the "Top" API.
| 
| The current "workaround" for this problem in the standard libraries
seems to
| be to always append the module name to the name of the function or
type or
| constructor (which is unfortunately, like record field names, not
local to
| the type but that's another story) eg by using createFirst,
createSecond
| etc, which seems a bit messy to me.
| 
| An alternative is to use the C preprocessor and #include a file
containing
| all the import declarations, but although "ok", I'd prefer to be able
to
| express the code organization purely in Haskell itself.
| 
| This must be a very common issue so I'm wondering if anyone else has
some
| better ideas on how to solve it?
| 
| Thanks, Brian.
| 
| _______________________________________________
| Haskell-Cafe mailing list
| Haskell-Cafe at haskell.org
| http://www.haskell.org/mailman/listinfo/haskell-cafe


More information about the Haskell-Cafe mailing list