-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | complex numbers with non-mandatory RealFloat -- -- The base package's Data.Complex has a RealFloat -- requirement for almost all operations, which rules out uses such as -- 'Complex Rational' or 'Complex Integer'. This package provides an -- alternative, putting most operations into additional type classes. -- Generating instances with template haskell helps reduce excessive -- boilerplate and avoids instance overlap. @package complex-generic @version 0.1.1 -- | Classes for complex number operations. module Data.Complex.Generic.Class -- | Rectangular form. class ComplexRect c r | c -> r mkRect :: ComplexRect c r => r -> r -> c real :: ComplexRect c r => r -> c imag :: ComplexRect c r => r -> c rect :: ComplexRect c r => c -> (r, r) realPart :: ComplexRect c r => c -> r imagPart :: ComplexRect c r => c -> r conjugate :: ComplexRect c r => c -> c magnitudeSquared :: ComplexRect c r => c -> r sqr :: ComplexRect c r => c -> c (.*) :: ComplexRect c r => r -> c -> c (*.) :: ComplexRect c r => c -> r -> c -- | Complex-real division. (/.) :: (Fractional r, ComplexRect c r) => c -> r -> c -- | A synonym for mkRect. (.+) :: ComplexRect c r => r -> r -> c -- | Polar form. class ComplexPolar c r | c -> r mkPolar :: ComplexPolar c r => r -> r -> c cis :: ComplexPolar c r => r -> c polar :: ComplexPolar c r => c -> (r, r) magnitude :: ComplexPolar c r => c -> r phase :: ComplexPolar c r => c -> r -- | Default implementations of complex number operations. module Data.Complex.Generic.Default realDefault :: (Num r, ComplexRect c r) => r -> c imagDefault :: (Num r, ComplexRect c r) => r -> c rectDefault :: ComplexRect c r => c -> (r, r) realPartDefault :: ComplexRect c r => c -> r imagPartDefault :: ComplexRect c r => c -> r conjugateDefault :: (Num r, ComplexRect c r) => c -> c magnitudeSquaredDefault :: (Num r, ComplexRect c r) => c -> r sqrDefault :: (Num r, ComplexRect c r) => c -> c sqrDefaultRF :: (RealFloat r, ComplexRect c r) => c -> c rmulDefault :: (Num r, ComplexRect c r) => r -> c -> c mulrDefault :: (Num r, ComplexRect c r) => c -> r -> c mkPolarDefault :: (Floating r, ComplexRect c r) => r -> r -> c cisDefault :: (Floating r, ComplexRect c r) => r -> c polarDefault :: ComplexPolar c r => c -> (r, r) magnitudeDefault :: (Floating r, ComplexRect c r) => c -> r magnitudeDefaultRF :: (RealFloat r, ComplexRect c r) => c -> r phaseDefault :: (Ord r, Floating r, ComplexRect c r) => c -> r phaseDefaultRF :: (RealFloat r, ComplexRect c r) => c -> r addDefault :: (Num r, ComplexRect c r) => c -> c -> c subDefault :: (Num r, ComplexRect c r) => c -> c -> c mulDefault :: (Num r, ComplexRect c r) => c -> c -> c negateDefault :: (Num r, ComplexRect c r) => c -> c absDefault :: (Num r, ComplexRect c r, ComplexPolar c r) => c -> c signumDefault :: (Eq r, Fractional r, ComplexRect c r, ComplexPolar c r) => c -> c fromIntegerDefault :: (Num r, ComplexRect c r) => Integer -> c divDefault :: (Fractional r, ComplexRect c r) => c -> c -> c divDefaultRF :: (RealFloat r, ComplexRect c r) => c -> c -> c fromRationalDefault :: (Fractional r, ComplexRect c r) => Rational -> c piDefault :: (Floating r, ComplexRect c r) => c expDefault :: (Floating r, ComplexRect c r) => c -> c logDefault :: (Floating r, ComplexRect c r, ComplexPolar c r) => c -> c sqrtDefault :: (Eq r, Ord r, Floating r, ComplexRect c r, ComplexPolar c r) => c -> c sinDefault :: (Floating r, ComplexRect c r) => c -> c cosDefault :: (Floating r, ComplexRect c r) => c -> c tanDefault :: (Floating r, Fractional c, ComplexRect c r) => c -> c sinhDefault :: (Floating r, ComplexRect c r) => c -> c coshDefault :: (Floating r, ComplexRect c r) => c -> c tanhDefault :: (Floating r, Floating c, ComplexRect c r) => c -> c asinDefault :: (Num r, Floating c, ComplexRect c r) => c -> c acosDefault :: (Num r, Floating c, ComplexRect c r) => c -> c atanDefault :: (Num r, Floating c, ComplexRect c r) => c -> c asinhDefault :: (Floating c, ComplexRect c r) => c -> c acoshDefault :: (Floating c, ComplexRect c r) => c -> c atanhDefault :: (Floating c, ComplexRect c r) => c -> c -- | Derive instances for complex numbers using template haskell. module Data.Complex.Generic.TH -- | Derive instances for RealFloat types. deriveComplexRF :: Name -> Name -> Name -> Name -> Q [Dec] -- | Derive instances for Floating types. deriveComplexF :: Name -> Name -> Name -> Name -> Q [Dec] -- | Derive instances for Num types. deriveComplexN :: Name -> Name -> Name -> Name -> Q [Dec] -- | Complex numbers. module Data.Complex.Generic -- | Complex numbers in rectangular form. data Complex a (:+) :: !a -> !a -> Complex a -- | Convert to Complex. toDataComplex :: Complex r -> Complex r -- | Convert from Complex. fromDataComplex :: Complex r -> Complex r instance Integral t => Fractional (Complex (Ratio t)) instance Integral t => Num (Complex (Ratio t)) instance Integral t => ComplexRect (Complex (Ratio t)) (Ratio t) instance HasResolution t => Fractional (Complex (Fixed t)) instance HasResolution t => Num (Complex (Fixed t)) instance HasResolution t => ComplexRect (Complex (Fixed t)) (Fixed t) instance Num (Complex Word64) instance ComplexRect (Complex Word64) Word64 instance Num (Complex Word32) instance ComplexRect (Complex Word32) Word32 instance Num (Complex Word16) instance ComplexRect (Complex Word16) Word16 instance Num (Complex Word8) instance ComplexRect (Complex Word8) Word8 instance Num (Complex Word) instance ComplexRect (Complex Word) Word instance Num (Complex Int64) instance ComplexRect (Complex Int64) Int64 instance Num (Complex Int32) instance ComplexRect (Complex Int32) Int32 instance Num (Complex Int16) instance ComplexRect (Complex Int16) Int16 instance Num (Complex Int8) instance ComplexRect (Complex Int8) Int8 instance Num (Complex Int) instance ComplexRect (Complex Int) Int instance Num (Complex Integer) instance ComplexRect (Complex Integer) Integer instance Floating (Complex CDouble) instance Fractional (Complex CDouble) instance Num (Complex CDouble) instance ComplexPolar (Complex CDouble) CDouble instance ComplexRect (Complex CDouble) CDouble instance Floating (Complex CFloat) instance Fractional (Complex CFloat) instance Num (Complex CFloat) instance ComplexPolar (Complex CFloat) CFloat instance ComplexRect (Complex CFloat) CFloat instance Floating (Complex Double) instance Fractional (Complex Double) instance Num (Complex Double) instance ComplexPolar (Complex Double) Double instance ComplexRect (Complex Double) Double instance Floating (Complex Float) instance Fractional (Complex Float) instance Num (Complex Float) instance ComplexPolar (Complex Float) Float instance ComplexRect (Complex Float) Float instance Typeable1 Complex instance Eq a => Eq (Complex a) instance Show a => Show (Complex a) instance Read a => Read (Complex a) instance Data a => Data (Complex a) instance Functor Complex