Folks,
I've been doing the final clean-up of typographical errors in the
Haskell report. This messages summarises anything non-trivial
that I've done. I'll put out the final version shortly.
There are two points that came up that seem substantial:
1. I think we decided a while ago to remove (->) from class Show.
I have been bitten several times by accidentally having a function
in a data structure when I didn't mean to, and getting duff results.
Of course, one *might* want to print functions as '<function>' or whatever,
and that used to be impossible. But now it's possible to have instance
declarations anywhere (not just in the module that declares the type or
class),
so you can make (->) an instance of Show if you want. On the other hand,
if the Prelude does so, you can't un-do it.
So I have decided to make (->) *not* an instance of Show any more.
2. The data and type constructors
(), (,), (,,), etc
[]
(->)
are all regarded as "syntax", not as identifiers. They always mean
their standard meaning (tuples, empty list or list type constructor).
[No change here.]
The question is: what about the list constructor ":". In principle
we could regard it as an ordinary identifier, and therefore allow someone
to redefine it... but
a) it's wierd that the two list constructors should be treated
differently
b) there's no way to hide ":" without mentioning the list type
constructor:
import Prelude hiding( [](:) )
and you can't do that because [] isn't an identifier.
I have concluded that it is simpler to treat ":" as syntax, exactly
uniformly with the others. It always means list construction, and
it cannot be hidden or redefined.
I don't want to start a debate about this -- the report is frozen
and I'm in executive dictator mode. But if you really really really
hate any of this message, pls let me know very very very soon.
Simon
========================================================
Summary of changes other than typos
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<li> Section 2.4. Clarify that <tt>:</tt> is reserved solely for Haskell
list construction.
<li> Section 3.7. Clarify that <tt>:</tt> is reserved solely for Haskell
list construction.
It cannot be hidden or redefined, any more than <tt>[]</tt> or <tt>(,,)</tt>
can.
<li> Don't export the types <tt>Ratio</tt>, <tt>Rational</tt>. They aren't
useful unless you import the library <tt>Ratio</tt>.
<li> Remove (->) from class Show
===============
<li> Ix library. Remove Show from superclasses of Ix.
<li> Fix defn of <tt>range</tt> for <tt>Int</tt>, <tt>Integer</tt>,
<tt>Char</tt>.
With Haskell 98 dot-dot notation, we must write:
<pre>
range (m,n)
| m < n = [m..n]
| otherwise = []
</pre>
<li> Fix defn of <tt>rangeSize</tt>. See the adjacent comments in the code
for details.
rangeSize :: Ix a => (a,a) -> Int
rangeSize b@(l,h) | null (range b) = 0
| otherwise = index b h + 1
-- NB: replacing "null (range b)" by "l > h" fails if
-- the bounds are tuples. For example,
-- (2,1) > (1,2),
-- but
-- range ((2,1),(1,2)) = []
=======================
Module Monad, Complex, Char, Time, Random
Various typos in the new definitions.
In module List
<li>Add to <tt>genericTake</tt> the clause:
<pre>
genericTake 0 _ = []
</pre>
============================
Module Directory
make Permissions an abstract type, not a concrete one,
so we can add more functionality later.