Original-Via: uk.ac.nsf; Sun, 13 Oct 91 03:45:22 BST
Original-Sender: [EMAIL PROTECTED]

| Two Haskell puzzles:
|
| 1) What are the values of [ maxint .. ]
|    and [ chr(127) .. ] in Haskell 1.1?

maxint : repeat _|_    and    ['\127'..'\255'] ++ repeat _|_

| 2) What should they be?
|
| -- Mikael R.

We've said that Char is an enumeration, and the wording in the report version 1.1
has been changed to make it clear that arithmetic sequences on enumerations
are finite, so I guess the value of the first expression should be
the same as ['\127'..'\255'] .  (I think this change was a mistake, however;
it's more consistent for all [x..] expressions to be infinite.  I also think
it's better for the programmer to denote the limit of the sequence explicitly.)

In the second case, however, I would argue that things should remain as they
are.  The boundedness of Int is an artifact; one uses Ints presuming the
limits won't be reached.  If this presumption turns out to be false, I think
it's better to get an error than to have the sequence silently truncated
at maxInt.

Thank you for pointing this out, Mikael.  Another thing your article has
suggests to me is that, particularly because future versions of Haskell
will likely need to be more flexible about what Char is, the prelude
should define minChar and maxChar.

--Joe

Reply via email to