In the Libraries: state of play document, the sixth point is
about Int:
> Make Integer be the default integral type instead of Int. This
> means that
> o If you don't give an explicit default declaration, then an
> ambiguous integral type constraint defaults to Integer.
> o length gets the generic type
>
> length :: Integral a => [b] -> a
>
> (Returning Integer is almost as bad as returning Int.)
> Similarly take and drop.
The point covers defaults, and also addresses (some of the)
library functions but it needs some clarification and extension.
1. There are other library functions in a similar vein to
take and drop, such as splitAt, !!, elemIndex, findIndex;
I take it that these are also covered.
2. There are Prelude classes whose signatures contain
instances of Int, such as
class Enum a where
toEnum :: Int -> a
fromEnum :: a -> Int
etc.
class ... => RealFloat a where
floatRadix :: a -> Integer
floatDigits :: a -> Int
floatRange :: a -> (Int,Int)
decodeFloat :: a -> (Integer,Int)
encodeFloat :: Integer -> Int -> a
etc. (including some other Ints and Integers...)
and other classes in the Numeric library.
I would hope that Enum would have its signature
generalised to
class Enum a where
toEnum :: Integral b => b -> a
fromEnum :: Integral b => a -> b
etc.
as this allows an elementary introduction just to talk
about the type Integer, but it is not so clear how to
handle the numeric classes and libraries.
3. There is a subsidiary question about ord and chr:
should these stay monotyped or should they be generalised?
Simon Thompson
[P.S. I would vote for Haskell99 or Haskell 2000.]