-- |
-- Module : Data.Complex
-- Copyright : (c) The University of Glasgow 2001
--- License : BSD-style (see the file libraries/core/LICENSE)
+-- License : BSD-style (see the file libraries/base/LICENSE)
--
-- Maintainer : libraries@haskell.org
-- Stability : provisional
import Prelude
-import Data.Dynamic
+#ifndef __NHC__
+import Data.Typeable
+#endif
+
+#ifdef __HUGS__
+import Hugs.Prelude(Num(fromInt), Fractional(fromDouble))
+#endif
infix 6 :+
-- -----------------------------------------------------------------------------
-- Instances of Complex
-#include "Dynamic.h"
+#ifndef __NHC__
+#include "Typeable.h"
INSTANCE_TYPEABLE1(Complex,complexTc,"Complex")
+#endif
instance (RealFloat a) => Num (Complex a) where
{-# SPECIALISE instance Num (Complex Float) #-}
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) #-}
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) #-}