Proposal: Faster toRational and fromRational

Daniel Fischer daniel.is.fischer at web.de
Fri Oct 22 07:16:52 EDT 2010


On Friday 22 October 2010 10:04:47, Lennart Augustsson wrote:
> The code used at the moment was meant as
> a reference implementation

And it serves that purpose well.

> and needs a lot of improvement.

Which reminds me of the fact that fromRat is reexported from Numeric.
My code is strictly for floatRadix 2, so it can't serve as the fromRat 
implementation which has to allow other floatRadices.

I see two possibilities,
- the simpler is to just bind fromRat to fromRational in Numeric,
- the other is to incorporate as many of the improvements into fromRat as 
possible.

The latter would lead to further bloat in GHC.Float, since it would contain 
two implementations of essentially the same function, one general and one 
specialised.
Is there any reason not to follow the simpler route?



More information about the Libraries mailing list