> > real2frac :: (Real a, Fractional b) => a -> b
> > real2frac = fromRational . toRational
> 
> The composition of fromRational and toRational seems to be the
> only way to convert a Double or an Int to a Double.
> 
> There is a function in the prelude, fromRealFrac, with exactly
> the same definition, but in the type signature, in place of Real
> it has RealFrac. This renders it useless as a replacement for
> my real2frac, as Int and Integer aren't instances of RealFrac.

That is odd.  It looks like a bug to me.  I'll suggest that
we change this in Standard Haskell.

Simon



Reply via email to