[Haskell-cafe] Writing functions in Haskell.

Daniel Fischer daniel.is.fischer at web.de
Fri Apr 29 12:56:28 EDT 2005

Am Freitag, 29. April 2005 18:01 schrieb Ross Paterson:
> On Thu, Apr 28, 2005 at 09:22:15PM -0400, Cale Gibbard wrote:
> > The second problem arises from hugs not doing the same thing as ghci
> > with respect to looking up qualified variable names (that is, those
> > with the module name specified, in this case, the standard module
> > Char). You can tell hugs to also load the Char module on top of
> > whatever code you have loaded by using the command ":also Char", after
> > which the prompt should look like
> > Char>
> > and you can try
> > toUpper 'a'
> Might as well use :load -- in both case Char becomes the new current
> module, making the old current module inaccessible.

There is a difference, though. Compare

Test> :l Char
Char> :n my_map
ERROR - No names selected


Test> :a Char
Char> :n my_map
(1 names listed)

So with :a(lso) the old module remains in sight for :n(ames) - and for :i in 
qualified form. Unfortunately I haven't found a way to use them, Hugs (Nov. 
2003) in general refuses qualified names, though with some rather weird 

Prelude> :l Test
Test> :a Char
Char> Prelude.map toUpper "buh"
Char> Data.Char.toUpper 'u'
Char> :i Test.my_map
my_map :: (a -> b) -> [a] -> [b]

Char> Data.Char.toUpper 'u'
ERROR - Undefined qualified variable "Data.Char.toUpper"
Char> Prelude.map toUpper "buh"
ERROR - Undefined qualified variable "Prelude.map"

How can it be that Hugs knows these qualified names before I ask about 
Test.my_map but not afterwards?


More information about the Haskell-Cafe mailing list