minor errors in Haskell 2010 report

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". Section 5.6.1 contains "These modules are not part of Haskell 98, and they cannot be imported separately." I suggest that the "98" be removed.

On 22/08/2012 13:32, 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".
The current text seems clear to me. This is the *definition* of what is exported by module M, so referring to what is exported by module M within its own definition would be very confusing.
Section 5.6.1 contains "These modules are not part of Haskell 98, and they cannot be imported separately." I suggest that the "98" be removed.
Thanks, someone else already pointed that out and I've fixed it in the sources. The next revision will include the fix. Cheers, Simon

On Thu, Aug 23, 2012 at 4:43 PM, Simon Marlow
On 22/08/2012 13:32, Ramana Kumar wrote:
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".
The current text seems clear to me. This is the *definition* of what is exported by module M, so referring to what is exported by module M within its own definition would be very confusing.
Where is that definition written down? I couldn't find anything apart from the (I think unclear) sentence above. It seemed to me that list item 5 was the definition of what "module M" means in an export list. Is there any indication that the exports are from a module apart from the name of the keyword, "module"?

On Thu, Aug 23, 2012 at 4:43 PM, Simon Marlow
The current text seems clear to me. This is the *definition* of what is exported by module M, so referring to what is exported by module M within its own definition would be very confusing.
To clarify, this is not the definition of what is exported by module M; rather, it is the definition of what is exported by some other module that includes "module M" in its export list.

On 23/08/2012 16:51, Ramana Kumar wrote:
On Thu, Aug 23, 2012 at 4:43 PM, Simon Marlow
mailto:marlowsd@gmail.com> wrote: The current text seems clear to me. This is the *definition* of what is exported by module M, so referring to what is exported by module M within its own definition would be very confusing.
To clarify, this is not the definition of what is exported by module M; rather, it is the definition of what is exported by some other module that includes "module M" in its export list.
Yes sorry, I got slightly mixed up there. But the current text still seems clear to me. You said:
It is not clear that "in scope" here really means "in scope and exported by module M".
There are two cases: Either M is the current module, in which case we should not refer recursively to the export list in the definition of the export list, or M is not the current module, in which case the only way that an entity could be in scope in the current module is if it was exported by M and subsequently imported by the current module, so adding "exported by module M" is superfluous. The current definition is succinct and does the right thing, without having to resort to separating the two cases explicitly. Perhaps it could do with a word or two of explanation in the text, though. Cheers, Simon

On Thu, Aug 23, 2012 at 5:01 PM, Simon Marlow
On 23/08/2012 16:51, Ramana Kumar wrote:
On Thu, Aug 23, 2012 at 4:43 PM, Simon Marlow
mailto:marlowsd@gmail.com> wrote: The current text seems clear to me. This is the *definition* of what is exported by module M, so referring to what is exported by module M within its own definition would be very confusing.
To clarify, this is not the definition of what is exported by module M; rather, it is the definition of what is exported by some other module that includes "module M" in its export list.
Yes sorry, I got slightly mixed up there. But the current text still seems clear to me. You said:
It is not clear that "in scope" here really means "in scope and exported by module M".
There are two cases:
Either M is the current module, in which case we should not refer recursively to the export list in the definition of the export list, or
Yes, in this case you are right not to refer recursively.
M is not the current module, in which case the only way that an entity could be in scope in the current module is if it was exported by M and subsequently imported by the current module, so adding "exported by module M" is superfluous.
In this case, what you said is not quite correct: an entity could be in scope in the current module if it was defined in the current module, or if it was imported from some other module (not M). These are the two kinds of entity I thought of when I first read the sentence, and was expecting clarification that only ones imported from M are to be considered.
The current definition is succinct and does the right thing, without having to resort to separating the two cases explicitly. Perhaps it could do with a word or two of explanation in the text, though.
Cheers, Simon

On 23/08/2012 17:09, Ramana Kumar wrote:
M is not the current module, in which case the only way that an entity could be in scope in the current module is if it was exported by M and subsequently imported by the current module, so adding "exported by module M" is superfluous.
In this case, what you said is not quite correct: an entity could be in scope in the current module if it was defined in the current module, or if it was imported from some other module (not M). These are the two kinds of entity I thought of when I first read the sentence, and was expecting clarification that only ones imported from M are to be considered.
That wouldn't be a clarification, it would be a change in the definition. Remember that entities that are in scope as M.x might not come from module M. Consider: import X as M now saying "module M" in the export list will export everything from X. Furthermore, we can export many modules at the same time: import X as M import Y as M import M and then saying "module M" in the export list will export all of the entities from modules X, Y and M. There was lots of discussion about this in the past, for some tricky issues see e.g. http://www.haskell.org/pipermail/haskell/2001-August/007767.html http://www.haskell.org/pipermail/cvs-ghc/2002-November/015880.html http://www.haskell.org/pipermail/haskell/2002-November/010662.html Cheers, Simon

Hello,
On Wed, Aug 22, 2012 at 5:32 AM, Ramana Kumar
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

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
participants (3)
-
Iavor Diatchki
-
Ramana Kumar
-
Simon Marlow