scope in ghci. Reply

Martin Norbäck d95mback@dtek.chalmers.se
15 Feb 2002 09:53:06 +0100


fre 2002-02-15 klockan 07.26 skrev S.D.Mechveliani:
> Martin Norb <martin.norback@safelogic.se> writes
> 
> 
> > I just noticed this behavior with ghci
> > 
> > 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?
> 
> 
> Even if Prelude is visible, still the library items are not.
> (List.sort, Ratio ...). Maybe, this is natural, I do not know.

But I'm not talking about its library items, I am talking about things
like sort, >>=, and print.

Surely they will be visible at all times, the Prelude is automatically
imported into all modules (unless it's explicitly imported in the
module, which is not the case here).

Although this semantics only makes sense for compiled programs, I think
it's a resonable thing to have the Prelude always visible in ghci.

When ghci is first started, the Prelude is visible, so it would be
reaonable not to hide it when a module is loaded. Perhaps if the module
exports a symbol already in the prelude it could be hidden.

I think this is a bug in ghci.

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