
6 Jan
2005
6 Jan
'05
9:06 a.m.
Ketil Malde wrote:
Maurício
writes: (...)
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)
The error message says it all, really.
(...)
Note that Haskell doesn't automatically convert arguments for you -- this is a feature.
-kzm
When I type this: ***** import Complex; a = 3 :+ 4; ***** and load it into ghci, "a + 4" gives me "7.0 :+ 4.0", although "a + (4::Float)" gives me that error again. Why Haskell converts "4" to Complex but not a Float? Maurício