Ferenc Wagner wrote:

> "Simon Peyton-Jones" <[EMAIL PROTECTED]> writes:
>
> > So I propose to modify the instance decl for Ratio by
> > adding explicit defns for succ/pred just like those in
> > Float/Double.
>
> I bet you guessed: once at it, what about removing those
> unintuitive 1/2-s, like:
>
> numericEnumFromTo n m = takeWhile (<= m) (numericEnumFrom n)
> numericEnumFromThenTo n n' m = takeWhile p (numericEnumFromThen n n')
>                              where
>                                p | n' > n    = (<= m + (n'-n))
>                                  | otherwise = (>= m + (n'-n))
>
> Everybody working with floats should know their quirks, while
> Rationals should be treated exactly.

It's inconsistent to remove the "+1/2" for numericEnumFromTo but to leave
the "+(n'-n)" for numericEnumFromThenTo.  I think you probably mean to
remove both (actually, all three).

I wouldn't recommend these changes for Float and Double (the increments
are there to account for arithmetic inexactness), but they do make a lot
of sense to me for (Ratio a), which is exact.  Is is too late to consider
such a change?

 -- Dean

_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to