X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Data%2FComplex.hs;h=3b15691c19146be4745951675f529ec4f66b3203;hb=2b4305df56aa7f821e5596b695a3f75e56cbd2d5;hp=c9f83341595db00c6f5fe02f0d85184443c0bc51;hpb=749dfc901df5adfe99c1bd2c2dc84767c6de0b95;p=ghc-base.git diff --git a/Data/Complex.hs b/Data/Complex.hs index c9f8334..3b15691 100644 --- a/Data/Complex.hs +++ b/Data/Complex.hs @@ -43,6 +43,10 @@ import Prelude import Data.Dynamic #endif +#ifdef __HUGS__ +import Hugs.Prelude(Num(fromInt), Fractional(fromDouble)) +#endif + infix 6 :+ -- ----------------------------------------------------------------------------- @@ -106,6 +110,9 @@ instance (RealFloat a) => Num (Complex a) where signum 0 = 0 signum z@(x:+y) = x/r :+ y/r where r = magnitude z fromInteger n = fromInteger n :+ 0 +#ifdef __HUGS__ + fromInt n = fromInt n :+ 0 +#endif instance (RealFloat a) => Fractional (Complex a) where {-# SPECIALISE instance Fractional (Complex Float) #-} @@ -117,6 +124,9 @@ instance (RealFloat a) => Fractional (Complex a) where d = x'*x'' + y'*y'' fromRational a = fromRational a :+ 0 +#ifdef __HUGS__ + fromDouble a = fromDouble a :+ 0 +#endif instance (RealFloat a) => Floating (Complex a) where {-# SPECIALISE instance Floating (Complex Float) #-}