[Haskell] Re: Data.Set whishes

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Fri Feb 20 12:00:50 EST 2004

Wolfgang Jeltsch <wolfgang at jeltsch.net> writes:

> Am Freitag, 20. Februar 2004 10:23 schrieb Koen Claessen:
> > > http://www.haskell.org/hierarchical-modules/libraries/library-design.html
> >
> > What I mean is, instead of:
> >   newIORef, writeIORef, readIORef
> >
> > We could have:
> >   IORef.new, IORef.write, IORef.read
> Alas, it has a problem with hierarchical module names.  For example, you 
> cannot write Set.empty but have to write Data.Set.empty instead.

Use module renaming:
    import Data.Set as Set

> A solution would be if Haskell would allow "partially qualified" names,
> e.g., you import Data and are able to say "Set.empty" afterwards.

There was an optional part of the original proposal for hierarchical
module names, that the last segment of the hierarchy be automatically
regarded as a renaming.  e.g.
    import X.Y.Z
could be treated equivalent to
    import X.Y.Z
    import X.Y.Z as Z
This has been implemented in nhc98 since 2001.


More information about the Haskell mailing list