The function polar takes a complex number and
returns a (magnitude, phase) pair in canonical form:
the magnitude is non-negative, and the phase in the range (-pi, pi];
if the magnitude is zero, then so is the phase.
In haskell, complex numbers are represented as a :+ b which can be thought of
as representing a + bi. For a complex number z, abs z is a number with the magnitude of z,
but oriented in the positive real direction, whereas signum z
has the phase of z, but unit magnitude.
Apart from the loss of precision due to IEEE754 floating point numbers,
it holds that z == abs z * signum z.
Note that Complex's instances inherit the deficiencies from the type
parameter's. For example, Complex Float's Ord instance has similar
problems to Float's.
As can be seen in the examples, the Foldable
and Traversable instances traverse the real part first.