Possible bug/omission in Numeric library?

Alastair David Reid reid@cs.utah.edu
29 Nov 2001 10:27:23 -0700

> Also, GHC's NumExts has

> doubleToFloat :: Double -> Float 
> floatToDouble :: Float -> Double

> 	Q2: If we are going to run round adding functions to Numeric,
> should we add those too?  It's hard to know where to stop... but if
> that conversion is what you want to do, H98 doesn't give a good way
> to do it.

Haskell already has fromRealFrac which does the same job (ignoring
NaNs, -0, etc.).  AFAIK, the only reason you'd use these shortcuts is
if you're using a compiler that can't optimize fromRealFrac (i.e.,
you're not using HBC or GHC) or exploring the limits of Haskell's 
support for IEEE arithmetic.

My feeling is that this is something of an unforced change.  Adding
functions can break code (though the fix is easy) so, whilst I agree
that the bar is lower for libraries and for adding functions, I think
we should still exercise some restraint.  This is especially true
since it's not clear that this is the right thing to do (since we have
fromRealFrac already) and it is hard to remove features once you've
added them.

Alastair Reid        reid@cs.utah.edu        http://www.cs.utah.edu/~reid/