diff --git a/libraries/base/Data/Complex.hs b/libraries/base/Data/Complex.hs index 190c59811556ca39929f946d0df94e16d98e4b59..b03848b636a2ee3d4fb36b92880b9643157e104d 100644 --- a/libraries/base/Data/Complex.hs +++ b/libraries/base/Data/Complex.hs @@ -58,27 +58,27 @@ data Complex a -- Functions over Complex -- | Extracts the real part of a complex number. -realPart :: (RealFloat a) => Complex a -> a +realPart :: Complex a -> a realPart (x :+ _) = x -- | Extracts the imaginary part of a complex number. -imagPart :: (RealFloat a) => Complex a -> a +imagPart :: Complex a -> a imagPart (_ :+ y) = y -- | The conjugate of a complex number. {-# SPECIALISE conjugate :: Complex Double -> Complex Double #-} -conjugate :: (RealFloat a) => Complex a -> Complex a +conjugate :: Num a => Complex a -> Complex a conjugate (x:+y) = x :+ (-y) -- | Form a complex number from polar components of magnitude and phase. {-# SPECIALISE mkPolar :: Double -> Double -> Complex Double #-} -mkPolar :: (RealFloat a) => a -> a -> Complex a +mkPolar :: Floating a => a -> a -> Complex a mkPolar r theta = r * cos theta :+ r * sin theta -- | @'cis' t@ is a complex value with magnitude @1@ -- and phase @t@ (modulo @2*'pi'@). {-# SPECIALISE cis :: Double -> Complex Double #-} -cis :: (RealFloat a) => a -> Complex a +cis :: Floating a => a -> Complex a cis theta = cos theta :+ sin theta -- | The function 'polar' takes a complex number and diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index 3011fdfdc79e475f0448d68935491a6c157b5054..a72e4e6871539129a5e4cc8d34fa6559dfb47d82 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -8,6 +8,8 @@ * Add `Data.List.sortOn` sorting function + * Weaken RealFloat constraints on some `Data.Complex` functions + ## 4.7.0.0 *Apr 2014* * Bundled with GHC 7.8.1