title: Implement Complex from Num
body: <p>I'm new to Haskell and want to learn how to implement my Complex number from Num class.</p>
  
  <pre><code>data Complex = Complex{x::Float, y::Float} deriving (Show)
  
  instance Num Complex where
          (Complex x1 y1) + (Complex x2 y2) = Complex(x1 + x2) (y1 + y2)
          (Complex x1 y1) - (Complex x2 y2) = Complex(x1 - x2) (y1 - y2)
          (Complex x1 y1) * (Complex x2 y2) = Complex(x1*x2 - y1*y2) (x1*y2 + x2*y2)
          fromInteger n                     = Complex(fromInteger n) (fromInteger n) 
          signum (Complex x y)              = Complex(signum x) (signum y) 
          abs (Complex x y)                 = Complex(abs x) (abs y) 
  </code></pre>
  
  <p>My question is how to use </p>
  
  <pre><code>fromInteger n = Complex(fromInteger n) (fromInteger n)
  </code></pre>