compare on Double

Duncan Coutts duncan.coutts at
Thu Mar 22 17:48:06 EDT 2007

On Thu, 2007-03-22 at 14:50 +0000, Neil Mitchell wrote:
> Hi
> > Note that in the bytestring case the compiler doesn't do so, it's the
> > library that does (by telling the compiler to rewrite things with
> > RULEs).
> ByteString is in base, and ships with GHC, I think that makes it GHC's
> fault if it does naughty things.
> > Unfortunately, it's very appealing in bytestring's case...
> Yes, the dilema between performance and purity...

It's not impure. Our rewrite rules for ByteStrings can refine your code
(in the domain / CPO sense) by making it lazier. It doesn't 'invent'
random values to replace _|_ it gives you the result you'd have got if
the data type were slightly lazier. The optimised version doesn't force
things that are not necessary for calculating the result and if any of
those things you would have forced were _|_ then we've done a refinement
rather than a strict equality rewrite. We never rewrite in the opposite
direction since that'd be bad.


More information about the Libraries mailing list