Repair to floating point enumerations?

Simon Marlow marlowsd at gmail.com
Wed Oct 22 06:11:54 EDT 2008


Malcolm Wallace wrote:

> Phil proposes that, although retaining the instances of Enum for Float
> and Double, we simplify the definitions of the numericEnumFrom family:
> 
>   numericEnumFromThenTo   :: (Fractional a, Ord a) => a -> a -> a -> [a]
>   numericEnumFrom         =  iterate (+1)
>   numericEnumFromThen n m =  iterate (+(m-n)) n
>   numericEnumFromTo n m   =  takeWhile (<= m) (numericEnumFrom n)
>   numericEnumFromThenTo n m p = takeWhile (<= p) (numericEnumFromThen n m)

I'll leave it to the floating-point experts to decide exactly what to do 
here for Haskell' (but I note that David Roundy's version looks better than 
the iterate version above, because the errors won't accumulate).

> But as maintainer and bug-fixer of the Haskell'98 Report, I have also
> been asked whether we should make this change retrospectively to the
> Haskell'98 language (as a "typo").  Since it involves not merely an
> ordinary library function, but a Prelude function, and moreover a
> function that is used in the desugaring of syntax, it is less clear to
> me whether to alter Haskell'98.

We definitely can't make breaking changes to Haskell 98; this would be much 
more than a "typo".

However, this does give us a problem if we decide to make a change here for 
H', as Neil points out, because there would be two mutually-incompatible 
instances for Enum Float.  We'd need to have a clear distinction between 
programs that are Haskell 98 and those that are not, with only the former 
allowed to use the haskell98 package.

Cheers,
	Simon



More information about the Haskell-prime mailing list