[project @ 2004-03-20 13:31:06 by ross]
[ghc-base.git] / Data / Complex.hs
index c9f8334..621b48e 100644 (file)
@@ -40,7 +40,11 @@ module Data.Complex
 import Prelude
 
 #ifndef __NHC__
-import Data.Dynamic
+import Data.Typeable
+#endif
+
+#ifdef __HUGS__
+import Hugs.Prelude(Num(fromInt), Fractional(fromDouble))
 #endif
 
 infix  6  :+
@@ -91,7 +95,7 @@ phase (x:+y)   = atan2 y x
 -- Instances of Complex
 
 #ifndef __NHC__
-#include "Dynamic.h"
+#include "Typeable.h"
 INSTANCE_TYPEABLE1(Complex,complexTc,"Complex")
 #endif
 
@@ -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) #-}