[Hugs-users] Re: [Haskell-cafe] Writing functions in Haskell.

Ross Paterson ross at soi.city.ac.uk
Tue May 3 11:56:59 EDT 2005

On Fri, Apr 29, 2005 at 06:56:28PM +0200, Daniel Fischer wrote:
> 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 
> behaviour:
> Prelude> :l Test
> Test> :a Char
> Char> Prelude.map toUpper "buh"
> "BUH"
> Char> Data.Char.toUpper 'u'
> '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?

Hugs discards the import table of a module when switching modules, e.g.
with :m.  It used to hold on to it, but this cost a lot of space.
So the qualified names in scope at the prompt immediately after :load are
what the user's guide says, but they disappear when you switch modules.
Unfortunately :i is also implemented using module switching.

More information about the Hugs-Users mailing list