Possible bug/omission in Numeric library?

Simon Peyton-Jones simonpj@microsoft.com
Thu, 29 Nov 2001 04:52:27 -0800

| However, I would guess that changing the type signature of=20
| the current showInt function is unacceptable for Haskell'98. =20
| Maybe we should consider adding the more general version=20
| under a new name like showIntBase, together with=20
| show{Dec,Oct,Hex}?  This would break no existing code, and=20
| clear up the slight anomaly in the current capability of the=20
| Haskell'98 library.

Hmm.  This is another unforced change, but admittedly to the libraries,
which have received much less attention and in some cases (like
this) look more accidental than deliberate.  So I've been using a lower
"bar" for modifications to the Libraries than to the Report.

As you say, we can't change the type of showInt.  I suppose we could

showIntAtBase :: Integral a=20
	      =3D> a            -- base
	      -> (a -> Char)  -- digit to char
	      -> a            -- number to show.
	      -> ShowS

showOct, showHex :: Integral a =3D> a -> ShowS

	Q1:  But would we really want showDec too? =20
	Identical to existing showInt?

I am disinclined to use K-F's extra generality for H98, nice though it
Too different from readInt.

Also, GHC's NumExts has=20

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

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