1 instance (RealFloat a) => Num (Complex a) where
2 (x:+y) + (x':+y') = (x+x') :+ (y+y')
3 (x:+y) - (x':+y') = (x-x') :+ (y-y')
4 (x:+y) * (x':+y') = (x*x'-y*y') :+ (x*y'+y*x')
5 negate (x:+y) = negate x :+ negate y
6 abs z = magnitude z :+ 0
8 signum z@(x:+y) = x/r :+ y/r where r = magnitude z
9 fromInteger n = fromInteger n :+ 0