X-Comment1: #############################################################
X-Comment2: # uk.ac.glasgow.cs has changed to uk.ac.glasgow.dcs #
X-Comment3: # If this address does not work please ask your mail #
X-Comment4: # administrator to update your NRS & mailer tables. #
X-Comment5: #############################################################
The Haskell report claims that all data types, type synonyms and
classes in the Prelude are declared in PreludeCore. This is blatantly
untrue. The exceptions are appended at the end of this message.
So we either have to retract the claim or make it true. This message
proposes the former.
Reasons
~~~~~~~
1. It seems odd to move the data types for IO, arrays, ratios etc
into PreludeCore, when all their operations etc are defined in the
relevant module. The Prelude is nicely structured as it is.
2. The original reason (so far as I can reconstruct it) for a compulsory
PreludeCore was a desire to give an unambiguous meaning to expressions
such as [a..b]. Would the meaning change if a non-Prelude class Enum was
in scope instead of the Prelude one? At one time the answer was meant to
be "No, because only the standard Enum can be in scope, because it is
in PreludeCore".
But this reason has really gone away. The answer now is "No, because
the syntax [a..b] conjures up the class PreludeCore.Enum, regardless of
whether it is in scope or not". Similarly, the meaning of list
comprehensions is given in terms of the standard functions map, filter and
concat; it conjures up the functions PreludeList.map, PreludeList.filter
etc, regardless of whether they are in scope or not.
So just what is in PreludeCore is now a matter of judgement and style.
Things in PreludeCore cannot be shadowed or renamed, so if you see a
reference to the class Enum you *know* it must be the standard Enum.
Summary
~~~~~~~
There is no technical reason to have PreludeCore at all. It is ok as
it is, but we shouldn't attempt to move all data types and classes into
it.
I propose to change the first sentence of 5.4.1 (page 49) to
"The PreludeCore module contains certain of the algebraic data
types, type synonyms, classes and instance declarations specified
by the standard prelude."
and after the second sentence, add
"PreludeCore thereby ensures consistent naming across all Haskell
programs for the entities it exports."
Any objections?
Simon
==================
Module Data types Type syns Classes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PreludeArray Array, Assoc
PreludeComplex Complex
PreludeIO Request, Dialogue,
Response, SuccCont
IOError StrCont
StrListCont
BinCont
FailCont
PreludeRatio Ratio Rational
PreludeText ReadS, ShowS Text