Haskell 98 Report possible errors, part one

Marcin 'Qrczak' Kowalczyk qrczak@knm.org.pl
22 Jul 2001 20:37:08 GMT

0.4.1. "http:://haskell.org" - typo. Same in the Library Report.

2.2. "any UNIcode character" - spelling inconsistent with "Unicode"
elsewhere. Same in appendix B.

2.2. Identifiers can use small and large Unicode letters. What about
caseless scripts where letters are neither small nor large? The
description of module Char says: "For the purposes of Haskell, any
alphabetic character which is not lower case is treated as upper case
(Unicode actually has three cases: upper, lower and title)". This
suggests that the only anomaly is that titlecase letters are considered
uppercase. But what is actually specified is that caseless scripts
can be used to write constructor names, but not to variable names.
I don't know how to solve this.

3. A precedence table says that case (rightwards) has higher precedence
than operators and right associativity. If it's meaningful to talk
about precedence of such syntactic constructs as case at all, it should
probably be told to have a lower precedence, so "case x+1 of ..."
is valid as "case (x+1) of ...". At least I don't see a difference
between "case" (rightwards) and "if" (rightwards). I'm not sure if
it makes sense to explain parsing of "case" in terms of precedence.

3.10. enumFrom* on Integer is specified as translated to and from Int.
But I assume that [2^100..2^100+9]::[Integer] should work.

3.11. Translation of list comprehensions in a table inconsistently
uses italic font for metavariables.

3.15.2 and elsewhere. Some translations to core use `undefined',
others use `error "some message"'. Not a big deal, but perhaps
could be consistent.

4. "cdecl -> gendecl | (funlhs | car) rhs" - typo, s/car/var/.

4.2.2. "A synonym and its definition are completely interchangeable."
They are not in instance headers. But probably should be.

4.3.1. "A class declaration with no where part [...]
The instance declaration must be given explicitly with no where part."
Actually the where part may be present but empty, with the same meaning
as no where part.

Generally I'm not sure that having a layout rule which says that {} is
inserted when the next indentation level is about to start and the new
indent is smaller than the outer one is necessary; in all useful cases
the keyword which triggered the layout could be omitted, and writing
    let x = case x of
      foo -> ...
should be either an error or it should be allowed to have the next
indent smaller than the previous one - it's not useful to let it mean
    let {x = case x of {}}
      foo -> ...
and in case one really wants to have empty alts in case, he can write {}

4.3.2. "The constructor is being instanced". Instantiated?

5.6.1. "an implicit `import qualified Prelude' is part of every
module and names prefixed by `Prelude.' can always be used to refer
to entities in the Prelude". So what happens in the following?

    module Test (null) where
    import Prelude hiding (null)
    null :: Int
    null = 0

    module Test2 where
    import Test as Prelude
    import Prelude hiding (null)
    x :: Int
    x = Prelude.null

ghc allows that, it dosen't seem to implement the qualified part
of the implicit Prelude import. The report is contradictory: adding
`import qualified Prelude' makes Prelude.null ambiguous, and thus names
prefixed by `Prelude.' can't always be used to refer to entities in
the Prelude.

5.8. "pop (Stk (x:s)) = Stk s"
Consistency with the previous example suggests
     "pop (Stk (_:s)) = Stk s"

6.1.4. "There is no upper bound on the size of a tuple, but some
Haskell implementations may restrict the size of tuples" - looks like
a contradiction for me. Either there are no bounds or implementations
may impose bounds. BTW, ghc should lift its limit for tuple instances.

6.3.2. max is defined in terms of ">=", min in terms of "<". ghc
uses "<=" in both cases because "<=" is suggested to be the primary
operation from which others are derived. Either should be fixed.
I think the ghc version is better.

6.4.2. Laws for quot&rem and div&mod don't hold if the divisor is 0.

7. "semi-colon" - I think "semicolon" is the correct spelling (and
used elsewhere).

7.1. "the IOError value associated with end-of-file is defined in
a library". It is not: only isEOFError predicate is provided.

 __("<  Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
  ^^                      SYGNATURA ZASTĘPCZA