infelicity in module imports
Simon Peyton-Jones
simonpj@microsoft.com
Thu, 12 Jul 2001 01:24:51 -0700
| I have often tried, but never succeeded, to understand what
| the report says and at the same time unify it with what the=20
| particular compiler I was using actually implemented.
Could I ask you to try one more time, with the current draft report?
available at
http://research.microsoft.com/~simonpj/haskell98-revised
I have tried hard to make it easy to understand. I am sure the result
is not perfect. If it is not fairly easy to answer your questions below
by reading the text, then I would like to improve the text. Can you
suggest ways in which it could be made clearer?
I've filled in the answers to each of your examples.
Simon
| Namely what happens in each of the following cases:
| Where A is a module exporting the names x, y, p, q, v, w.
| import A
x, y, p, q, v, w
A.x, A.y, A.p, A.q, A.v, A.w
| import A()
nothing is imported, except instance declarations
| import A(x,y)
x, y, A.x, A.y
| import qualified A
A.x, A.y, A.p, A.q, A.v, A.w
| import qualified A()
nothing is imported, except instance declarations
| import qualified A(x,y)
A.x A,y
| import A hiding ()
same as import A
| import A() hiding ()
syntactically illegal
| import A(x,y) hiding ()
syntactically illegal
| import A hiding (p,q)
x, y, v, w
A.x, A.y, A.v, A.w
| import A() hiding (p,q)
syntactically illegal
| import A(x,y) hiding (p,q)
syntactically illegal
| import qualified A hiding ()
same as import qualified A
| import qualified A() hiding ()
syntactically illegal
| import qualified A(x,y) hiding ()
syntactically illegal
| import qualified A hiding (p,q)
A.x, A.y, A.v, A.w
| import qualified A() hiding (p,q)
syntactically illegal
| import qualified A(x,y) hiding (p,q)
syntactically illegal
|=20
| 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.