module Algebra.ToRational where
import qualified Algebra.Real as Real
import Algebra.Field (fromRational, )
import Algebra.Ring (fromInteger, )
import Number.Ratio (Rational, )
import Data.Int (Int, Int8, Int16, Int32, Int64, )
import Data.Word (Word, Word8, Word16, Word32, Word64, )
import qualified Prelude as P
import PreludeBase
import Prelude(Int,Integer,Float,Double)
class (Real.C a) => C a where
toRational :: a -> Rational
instance C Integer where
toRational = fromInteger
instance C Float where
toRational = fromRational . P.toRational
instance C Double where
toRational = fromRational . P.toRational
instance C Int where ; toRational = toRational . P.toInteger
instance C Int8 where ; toRational = toRational . P.toInteger
instance C Int16 where ; toRational = toRational . P.toInteger
instance C Int32 where ; toRational = toRational . P.toInteger
instance C Int64 where ; toRational = toRational . P.toInteger
instance C Word where ; toRational = toRational . P.toInteger
instance C Word8 where ; toRational = toRational . P.toInteger
instance C Word16 where ; toRational = toRational . P.toInteger
instance C Word32 where ; toRational = toRational . P.toInteger
instance C Word64 where ; toRational = toRational . P.toInteger