On 10/3/06, Edward Ing <[EMAIL PROTECTED]> wrote:
The source is below. Side is types as Float. My assumption was that
Haskell would know how to convert the Int to a float and all would be
well. I am I mistaken somewhere? The problem is with the last line.
Yes - Haskell does not automatically promote numeric types. In this
case, the following code compiles:
vertex :: Vertex -> Int -> Int -> Side -> Vertex
vertex (a ,b) currentSide totalSides length =
let angle = (360 / fromIntegral totalSides) * fromIntegral
currentSide in
( a + ( length * (sin angle)), b + ( (*) (cos angle) length ) )
although I'm not sure it's exactly what you want.
/g
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe