
That is a good point, Iavor, about M needing to be the qualifier rather
than an imported module. That should be fixed.
And I now think the report is correct at the sentence I previously had
trouble with.
This is my problem example:
module A (module M) where
import M ()
val e :: Int
val e = 0
In this situation, I think A exports nothing, and I thought the report said
it exports e, because e is in scope with an unqualified name.
But now I see that the report requires "both e and M.e. to be in scope"; I
had misread it as "either e or M.e to be in scope".
Sorry for pushing this mistake of mine so hard, but at least it prompted
Iavor to find a real error :)
On Thu, Aug 23, 2012 at 10:15 PM, Iavor Diatchki
Hello,
On Wed, Aug 22, 2012 at 5:32 AM, Ramana Kumar
wrote: I recently read http://www.haskell.org/onlinereport/haskell2010/ and noticed a few minor issues in Chapter 5. Is it easy to correct them on that web page for future readers? If not, at least this may be useful for future reports. Apologies if these were known already.
Section 5.2, the first sentence of list item 5 says "The form “module M” names the set of all entities that are in scope with both an unqualified name “e” and a qualified name “M.e”." It is not clear that "in scope" here really means "in scope and exported by module M".
I think that the definition in the report is correct and clear. In particular "in scope" does not refer to "in scope and exported by module M". Consider this example:
module A (module M) where import A as M import B as M import C(d) import qualified D as M (d)
In this case the "module M" declaration refers to all the entities imported from A and B and, assuming that "d" refers to the same entity in both C & D, also "d".
The same section (5.2) does contain a slightly inaccurate remark though. The report says:
It is an error to use module M in an export list unless M is the module bearing the export list, *or **M** is imported by at least one import declaration* (qualified or unqualified).
The above example illustrates that this is not the case: M really should be the "qualifier" on one of the imports (if the qualifier is omitted, then it is the same as the module name). Here is another example to emphasize the point:
-- error module module A (module M) where import M as B
This is an error because M is not the qualifier for any import (the correct usage is "module B").
-Iavor