compare on Double

Ian Lynagh igloo at
Wed Mar 21 20:18:24 EDT 2007

On Wed, Mar 21, 2007 at 06:58:46PM +0000, David House wrote:
> On 21/03/07, Neil Mitchell <ndmitchell at> wrote:
> >Following on from the tradition of ByteString, will it be acceptable
> >for the compiler to turn _|_ into False, as an optimisation?
> My interpretation of Ian's message was a questioning of the behaviour
> of compare, not of (<) etc. compare can't return False.

Right, I'm happy with the three False's, it's the incompatible result of
compare that I'm objecting to.

As Sven thinks the real solution is to modify the report such that this
case can be handled nicely without raising an exception, I've closed the
proposal and opened a Haskell' ticket for it. Thus we can discuss what
the answer should be for Haskell' and change the report or not as we
think appropriate, before finally fixing the problem.

> >I agree very much with Sven here, nothing as simple as comparison or
> >equality should make a program crash. I wouldn't mind division by zero
> >raising an error - that is something that you could argue for.
> Doesn't compare need to force its arguments anyway, so that (0/0)
> `compare` (0/0) would be a divide-by-zero error?

Not with Float and Double:

Prelude> 0/0 :: Double
Prelude> 0/0 :: Float


More information about the Libraries mailing list