GHCi grumbles (3)
Simon Marlow
simonmar@microsoft.com
Wed, 15 Aug 2001 17:42:06 +0100
> It should be possible to change
> (1) the environment returned by System.getEnv
> (2) the arguments returned by System.getArgs
> (3) System.getProgName
> in GHCi (for example, using :set).
>=20
> By the way, my partial solution to grumble (1) is
>=20
> :def modules (\ modulesStr -> do { let { imports =3D=20
> Prelude.map (\ modName -> ("import "++(if modName =3D=3D "+" then=20
> "Prelude" else modName)++"\n")) (Prelude.words modulesStr) ;=20
> imod =3D "module XYZZY where \n"++(Prelude.concat imports) } ;=20
> Prelude.writeFile "/tmp/XYZZY.hs" imod ; Prelude.return=20
> ":load /tmp/XYZZY.hs" } )
Yes, I experimented with something similar for a while, but did it in an
incremental way - I had a :import command which added a line to a
temporary module and then re-loaded it.
I agree we should have a better way to control scoping at the prompt;
there have been one or two good suggestions in the past, but we just
haven't got around to implementing anything yet.
Cheers,
Simon