[Haskell] Re: Proposal: Relative Module Imports

Jacques Carette carette at mcmaster.ca
Wed May 4 18:25:21 EDT 2005


Samuel Bronson <naesten at gmail.com> wrote:
> On 5/3/05, S. Alexander Jacobson <alex <at> alexjacobson.com> wrote:
> > Problem: We need a way to simplify module imports.
> > Idea: Allow module relative imports in a manner that does not break
> > any existing code.
>
> I almost want "import Text.HaXML.XML.{Types,Escape,Pretty}", but not
> quite. And that would not be nice for qualified imports, anyway.
> 
> Maybe something like
> from Text.HaXML.XML import (Types, Escape, Pretty)
> would be nice.

That's really funny.  Some 4th year students here just finished a project under my supervision that I called 'SJ' for 
'Short Java', where the basic premise was that most Java code is unecessarily verbose.  One of the 'low hanging fruit' 
for shortening were import declarations.  I had advised the students to go with something that would be the equivalent 
of
import Text.HaXML.XML.{Types|Escape|Pretty}
but they chose something a bit worse than that.

Of course, the project aimed for more substantial 'shortenings', but the end-result was very unsatisfying as this 
particular group didn't "get it".  I will try again next year, hopefully with a bigger group.

Jacques

PS: I tried to get them to use Parsec and write their own pretty-printer for in Haskell, but gave up on that because 
of the weakness of the group.  They ended up using ANTLR (good) and some awful Java pretty-printer that was quite 
buggy :-(


More information about the Haskell mailing list