strange behavior with ghci version 5.02.2

Martin Norbäck d95mback@dtek.chalmers.se
15 Feb 2002 11:23:22 +0100


fre 2002-02-15 klockan 10.48 skrev Simon Marlow:
> > > After loading a module with
> > >
> > > :l Module
> > >
> > > you can't use the Prelude functions unqualified, you just get things
> > > like
> > >
> > > <interactive>:1: Variable not in scope: `show'
> > >
> > > I am pretty sure that this worked some days ago, and I was using the
> > > same version then.
> > >
> > > I feel totally confused. Has this happened to anyone else?
> > 
> > Yes, for some modules it happens for others it doesn't. Kind 
> > of strange.
> > SuSE 7.3 rpms here, v. 5.02.2
> > J.A.
> 
> You're probably loading compiled versions of these modules.  GHC 5.02.2 will only give you the exports of a compiled module when it is selected with :module.

Yes, I was loading a compiled module, and indeed, removing the Module.o
file, enables me to use Prelude functions after loading it with 
:l Module.

A clean semantics for this in ghci would be to view the interpreter as a
"module" and all modules with :module and :load are treated just as if
imported into this module.

So you could write

:load qualified Module
:load Module hiding (name)

and so on.

In any case, there should be no difference in semantics between loading
an interpreted module and a compiled one. If there are big problems in
keeping the semantics the same, then I suggest always interpreting the
module :loaded, even if a compiled version exists.

Regards,

	Martin

-- 
[ http://www.dtek.chalmers.se/~d95mback/ ] [ PGP: 0x453504F1 ] [ UIN:
4439498 ]
    Opinions expressed above are mine, and not those of my future
employees.
SIGBORE: Signature boring error, core dumped