[Haskell-cafe] Mis-understanding something in Haskell
bulat.ziganshin at gmail.com
Tue Oct 3 15:26:57 EDT 2006
Tuesday, October 3, 2006, 9:44:27 PM, you wrote:
> Couldn't match `Side' against `Int'
> In the first argument of `sin', namely `angle'
> 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 don't make automatic conversions because together with
bi-directional type inferring it will make a headache.
> let angle = 1.0 * (360 / totalSides) * currentSide in
as Garret said, you should make conversions explicitly, hopefully the
'fromIntegral' function is enough in most cases
Bulat mailto:Bulat.Ziganshin at gmail.com
More information about the Haskell-Cafe