Proposal: Faster toRational and fromRational

Isaac Dupree ml at
Thu Oct 21 20:50:41 EDT 2010

On 10/21/10 15:35, Daniel Fischer wrote:
> trac:
> Proposal: include faster implementations for
>     1. toRational :: Float ->  Rational
>     2. toRational :: Double ->  Rational
>     3. fromRational :: Rational ->  Float
>     4. fromRational :: Rational ->  Double
> The semantics of these functions shall remain the same as it is now, only
> their speed will be affected.

I generally approve!  If the libraries list has any non-trivial doubts 
then it might be best not to squeeze it into 7.0.  But if not, then 

Do we, the Libraries list, need to approve adding ( integerLog2# :: 
Integer -> Int# ) to the integer-* packages?  I had the notion those are 
relatively private packages that GHC developers have purview over.

(Then we could think separately from this proposal about adding a 
user-friendly integerLog2 to somewhere nice; and then I'd wish for a 
log2 for types like Int as well; maybe it would make sense for 
Data.Bits; questions like that.  I would be supportive but I don't think 
we have to do this before we optimize Rational.)


More information about the Libraries mailing list