
On Wed, 2004-12-08 at 07:58 -0700, azrael@demonlords.net wrote:
I've got a general new person type question.
I understand that I can hide a function in a module that I am importing if it conflicts with another identical function name.
But if the situation arises that I would like to use two identically named functions from two different modules is there anyway for me to specify that I want to use the function from module A rather then the function from module B.
module C where import A import qualified A (foo) import B import qualified B (foo) ... A.foo ... ... B.foo ... 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.ht... (and people are encouraged to write new modules in this style). If it's just one or two values that clash then the example above is good, ie import the whole thing unqualified and just qualify the one or two names that clash. You can even give short names to modules you import, eg: import qualified System.Gnome.GConf as Config now I can say Config.get rather than System.Gnome.GConf.get Hope this helps. Duncan