infelicity in module imports
Chris Webb
chris@arachsys.com
05 Jul 2001 10:58:15 +0100
"Simon Marlow" <simonmar@microsoft.com> writes:
> Simon Peyton Jones writes:
>
> > In short, an import *always* brings the entire *qualified* set of
> > names into scope. Hiding and revealing applies only to unqualified
> > names. I must say that I thought GHC implemented this rule; if not I
> > should fix it.
>
> That's not my reading of the report, and it's not what GHC implements.
>
> import A (f)
>
> brings only f and A.f into scope.
Whatever the correct version of this without the `qualified' term, the
current GHC behaviour (and I'll confess my reading of the standard up
until I spotted this discussion) that allows me to replace
import qualified Foo (x, y, z)
with
import qualified Foo (x, y)
import qualified FooFixed as Foo (z)
to substitute a different module's z as Foo.z is *very* useful in
practice. It seems a pity that
import qualified Foo hiding (z)
import qualified FooFixed as Foo (z)
doesn't also do the natural thing at the moment. (It currently just
ignores the `hiding (z)' so Foo.z is ambiguous.)
Cheers,
Chris.