Maurício,
What is wrong with this code?
I'm sorry, I don't have time to tell the whole story on kinds right
now, so you'll have to do it with this practical solution. Maybe
someone else will jump in and give you the grand tour on kinds.
Your problem right now is that the type Complex takes (needs) a type
argument. Its definitions is (module strictness flags):
data Complex a = a :+ a
So, what you have to do, is applying Complex to a type argument.
For instance,
roots :: (Complex Double, Complex Double, Complex Double)
- (Complex Double, Complex Double)
or
roots :: (Complex Float, Complex Float, Complex Float)
- (Complex Float, Complex Float)
or, more general, and therefore probably better,
roots :: (RealFloat a) = (Complex a, Complex a, Complex a)
- (Complex a, Complex a);
HTH,
Stefan
On Dec 23, 2004, at 6:09 PM, Maurício wrote:
Guys,
What is wrong with this code?
**
import Complex
roots :: (Complex, Complex, Complex) - (Complex, Complex);
roots (a,b,c) = (x1,x2) where { x1 = (b*b + (sqrt_delta))/(2*a); x2 =
(b*b - (sqrt_delta))/(2*a); sqrt_delta = sqrt 4*a*c}
**
I load it into GHCi and get:
**
Kind error: `Complex' is not applied to enough type arguments
In the type: (Complex, Complex, Complex) - (Complex, Complex)
While checking the type signature for `roots'
Failed, modules loaded: none.
**
Thanks,
Maurício
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe