Hi,
When compiling this:
************ import Complex;
complex_root :: (Float, Float, Float) -> (Complex Float, Complex Float)
complex_root (a,b,c) = (x1,x2) where {
delta = b * b - 4 * a * c :: Float;
sqr_delta = if delta >= 0 then (sqrt delta) :+ 0 else 0 :+ (sqrt delta) :: (Complex Float);
x1 = (b + sqr_delta)/(2 * a);
x2 = (b - sqr_delta)/(2 * a);
}
***********
I get this error message:
********** Couldn't match `Float' against `Complex Float' Expected type: Float Inferred type: Complex Float In the second argument of `(+)', namely `sqr_delta' In the definition of `x1': x1 = (b + sqr_delta) ***********
Can you help me finding what is wrong? Shouldn't "b" be converted to Complex Float and be summed to sqr_delta?
Thanks for your help, Maurício
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe