infelicity in module imports

Chris Webb [email protected]
12 Jul 2001 10:07:18 +0100


"Simon Peyton-Jones" <[email protected]> writes:

> I hope the Report now unambiguously states that 
> 
> 	import M hiding (a,b,c)
> 	import qualified M hiding(a,b,c)
> 
> imports exactly the same entities (namely all that M exports
> except a,b,c), only in the latter case only the qualified names are
> brought into scope.

So using your example, in the first case we get d and M.d, but neither a
nor M.a? And in the later case, we're supposed get M.d, but not M.a?
Unless this has been changed in ghc > 5.00.1, ghc doesn't quite seem to
implement this at the moment:

  import M hiding (a, b, c)

imports d and all of M.a, M.b, ... (not just d and M.d); and

  import qualified M hiding (a, b, c)

seems to do exactly the same thing as a straight

  import qualified M

giving us M.a &c despite the hiding (a, b, c) clause.

The behaviour I think you're describing seems by far the most useful
thing do and the description in the report is now very clear, so this
isn't an issue with anything you're proposing, just a observation that
'GHC implements it' isn't yet quite true.

Cheers,
Chris.