Packages and modules

Simon Peyton-Jones simonpj at
Thu Jul 6 11:51:05 EDT 2006

| 1) Qualified names:
|   import A.B.C( T1 ) from "foo"
|   import A.B.C( T2 ) from "bar"
|   type S = A.B.C.T1 -> A.B.C.T2
| I'd suggest that the above should give a compiler error that A.B.C is
| ambiguous (as a qualifier), rather than allowing T1 to disambiguate
| because otherwise it allows people to write code that could be very
hard to
| understand ie within the code, every occurrence of A.B.C as a
| should refer to the same module. (Otherwise the thing qualified
| the qualifier that's qualifying it...)

But that's inconsistent with Haskell 98.  In H98 you can say
	import M( T1 ) as Q
	import N( T2 ) as Q
	type S = Q.T1 -> Q.T2
and it'll work just fine.  You may think it should not work, but that's
water under the bridge.  We should be consistent here.

| In my spec, if you omit the package name you get an "old-style" import
| the shared namespace, and if you supply a package name you get a
| import that only searches in the specified package:
|     import A.B.C -- search home + exposed as is done at the moment
|     import "" A.B.C -- search home package only
|     import "pkg" A.B.C -- search "pkg" only

That's exactly what our spec says too.  (Good news, again.)  Only maybe
not explicitly enough!  See the section "Is the from<package>
compulsory".   Perhaps you could improve the wording to make it more

Indeed, if we've converged, would you like to fold into our draft
whatever you think is useful from yours?


More information about the Glasgow-haskell-users mailing list