[Hugs-users] Weird behaviour,
was Re: [Haskell-cafe] Writing functions in Haskell.
Daniel Fischer
daniel.is.fischer at web.de
Tue May 3 13:59:51 EDT 2005
Am Dienstag, 3. Mai 2005 17:56 schrieben Sie:
> 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.
Hm, I don't quite get it. Apparently whenever I ask :info Qualified.name with
a qualification different from the top module, I lose all qualified names,
even from explicitly imported modules -- right?
Okay, that's not a problem, only a little odd.
Now I encountered another odd thing:
Char> :l
Prelude> :a Char
Char> :a Test
Char> :l -- notice the top module is still Char!
Prelude> :a Test
Test> :a Char
Char>
in that session, this behaviour was reproducible, in later sessions it wasn't:
Prelude> :a Char
Char> :a Test
Test> :l
Prelude> :a Test
Test> :a Char
Char> :l
Prelude> :a Char
Char> :a Test
Test>
Any idea how that may come?
Cheers,
Daniel
More information about the Hugs-Users
mailing list