infelicity in module imports

Malcolm Wallace
Wed, 4 Jul 2001 18:18:23 +0100

| > Currently, you are permitted to write
| > 
| >     import A hiding (f)
| >     import B as A (f)
| > 
| > and this means that everything exported from module A is visible,
| > with the exception that function `f' is overridden by a different
| > definition from module B.  Here, a reference to `A.f' is resolved
| > unambiguously to `B.f'.
| In my understanding of the report, this is not true. Quoting from section 
| 5.3 of the report 
|   "The hiding clause only applies to unqualified names. In the previous
|    example, the name M.C is brought into scope."
| Thus, in your example, the declaration import A hiding (f) will bring 
| A.f into scope and thus A.f is ambiguous!

You are possibly correct, although both nhc98 and ghc actually resolve
it in the manner I expected.

However, if you are indeed correct, then we have an even stranger

    import A (g)

brings only A.g into scope, but

    import A hiding (f)

brings both A.f and A.g into scope!  So `hiding' is doing the opposite
of hiding, and in fact _reveals_ names.