RFC: decodeFloat

wren ng thornton wren at freegeek.org
Sat Aug 27 03:00:25 CEST 2011

On 8/26/11 7:24 PM, Daniel Fischer wrote:
> Using that as intermediate type instead of Rational in realToFrac would
> allow a correct Double<->  Float (and newtypes) conversion also without
> rewrite rules (and should be faster than 'fromRational . toRational' for
> these, since it would be basically 'uncurry encodeFloat . decodeFloat').

For these issues I'd like to point out the RealToFrac class[1] for 
correcting the problems with the Prelude's realToFrac. The current 
version uses -XOverlappingInstances to provide general instances, but 
that's just a convenience and not strictly necessary. The only thing it 
actually requires is MPTCs. I've been waiting for the haskell' committee 
to finally get around to accepting MPTCs before suggesting the class 
replace the Prelude's function.


Live well,

More information about the Libraries mailing list