[Haskell] Re: Proposal: Relative Module Imports

Samuel Bronson naesten at gmail.com
Sat May 7 19:38:27 EDT 2005


On 5/5/05, S. Alexander Jacobson <alex at alexjacobson.com> wrote:
> 
> On Tue, 3 May 2005, Samuel Bronson wrote:
> > Maybe something like
> >
> > from Text.HaXML.XML import (Types, Escape, Pretty)
> >
> > would be nice.
> 
> The problem with this one is that you need a way to express all the
> other stuff in import statements like "qualified" or "as", the
> imported list, etc.

Hmm, I guess it isn't dead obvious what they would do, but it seems
like it would make more sense that way than with braces-and-commas in
the shell style.

> If you don't like the dots and are willing to deal with having to type
> the current module hierarchy twice, a more verbose syntax would be
> 
>    Proposal                       Translation
>    --------                        -----------
>    module Foo.Bar.Baz.Bing where   module Foo.Bar.Baz.Bing where
>    from Foo.Bar.Baz
>       import Blip                  import Foo.Bar.Baz.Blip as Blip
>    from Text.HaXML.XML
>       import Types                 import Text.HaXML.XML.Types as Types
>       import Escape                import Text.HaXML.XML.Escape as Escape
> 
> Not as tight as the prior syntax I proposed, but more readable and
> still a large improvement on the status quo.
> 
> Thoughts?

That looks pretty much like what I had only with an import for each
module, instead of one import with syntax a bit like deriving...
probably much easier to parse, and a bit more obvious what it means.
Definately makes qualified and friends more fine-grained than I was
thinking. You could even nest them. Also, it is much easier on the
eyes than your previous suggestion, and there are no dots to count. I
like it ;-).

--Sam


More information about the Haskell mailing list