[Haskell-cafe] Re: Haskell and qualified identifiers

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Wed Dec 8 11:40:43 EST 2004

On Wed, 2004-12-08 at 17:04 +0100, Henning Thielemann wrote:
> On Wed, 8 Dec 2004, Duncan Coutts wrote:
> > There are actually several options here, you can import modules only
> > qualified, then every value from that module needs to be qualified. Some
> > modules are designed to be used this way, see for example Data.HashTable
> > http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data.HashTable.html
> > (and people are encouraged to write new modules in this style).
> Good to know that there others who conform to this style. But ... why is
> the name of HashTable still HashTable.HashTable? Wouldn't be HashTable.T,
> HashTable.Type or something like that the better choice? 

I see your point. I use HashTable like so:

import Data.HashTable (HashTable)
import qualified Data.HashTable as HashTable

That way you can use HashTable unqualified as the name of the type, and
then all the other operations are qualified like HashTable.new,
HashTable.lookup etc

This is like the C++/Java OOP naming convention. The class name is the
type and it also qualifies all of the operations. This style is quite
readable I find without requiring
java.system.io.very.long.qualified.names.all.over.the.place. :-)


More information about the Haskell-Cafe mailing list