infelicity in module imports

Koen Claessen koen@cs.chalmers.se
Thu, 12 Jul 2001 10:09:54 +0200 (MET DST)


Simon Peyton-Jones wrote:

 | [..modules..] So here's the message anyway.  I don't
 | think it's controversial, since it's the outcome the
 | cognoscenti were seeking, and no one else will care.

That is not true! I do care! :-)

Often, after having been bitten by a misunderstanding of the
Haskell module system, I have often wondered why the
following two facts are consistent:

  1. Haskell has a simple module system.

  2. There exists no comprehensive description of it, nor do
     there exist two compilers who seem to implement the
     same thing.

The answer is, of course, that one of these "facts" is false
(namely 1.).

I have often tried, but never succeeded, to understand what
the report says and at the same time unify it with what the
particular compiler I was using actually implemented.

What I would like to see in the report are *examples*.
Namely what happens in each of the following cases:

  import A
  import A()
  import A(x,y)
  import qualified A
  import qualified A()
  import qualified A(x,y)
  import A hiding ()
  import A() hiding ()
  import A(x,y) hiding ()
  import A hiding (p,q)
  import A() hiding (p,q)
  import A(x,y) hiding (p,q)
  import qualified A hiding ()
  import qualified A() hiding ()
  import qualified A(x,y) hiding ()
  import qualified A hiding (p,q)
  import qualified A() hiding (p,q)
  import qualified A(x,y) hiding (p,q)

Where A is a module exporting the names x, y, p, q, v, w.

Honestly, in some of these case I do not understand if 1) it
is legal syntax, and if so, 2) what happens, and, if not so,
3) why not.

Certainly, some of the above are equivalent? (At least when
you take semantics nr 1. from Simon's e-mail).

/Koen.