Problem: We need a way to simplify module imports.

Problem details:

* Hierarchical module names are getting really long (including a functional area, a package name, and a module name).

* People typically import multiple modules from areas close to each other in the hierarchical module namespace (especially in the case of intra-package imports).

* Long module names are required even for non-exposed modules because a program may contain only one module with a given name (regardless of its visibility).

Idea: Allow module relative imports in a manner that does not break any existing code.

Proposal:

* Use preceding dots to indicate that module name is relative
* Use from keyword to specify a different relative base.

Example:

 Dot relative syntax             Translation
 -------------------             -----------
 module Text.Space.Foo.M where   module Text.Space.Foo.M where
 import .M2                      import Text.Space.Foo.M2 as M2
 import ..Bar.Baz                import Text.Space.Bar.Baz as Bar.Baz
 import Data.Set                 import Data.Set
 from ...HaXML.XML
   import .Types                 import Text.HaXML.XML.Types as Types
   import .Escape                import Text.HaXML.XML.Escape as Escape
   import .Pretty                import Text.HaXML.XML.Pretty as Pretty

I believe that the proposed syntax is much more concise and readable than the current equivalent.

-Alex-

______________________________________________________________
S. Alexander Jacobson tel:917-770-6565 http://alexjacobson.com
_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to