
Hello, I'm just learning Haskell and have problems with a simple calculation: Here is my code below : data Figure = Carre Int Int Int | Rond (Int, Int, Integer) -- i hope Integer allows fromInteger function for r surface_carre :: Figure -> Int surface_carre (Carre x y c)= c * c surface_rond :: Figure -> Float surface_rond (Rond (x, y, r))= 3.14 * r * r surface x = case x of Carre a b c -> surface_carre x Rond (a, b, c) -> surface_rond x a::Figure a=Carre 10 10 5 b::Figure b=Rond (20, 20, 3) When i load this program, i get the following error for the line 3.14 * r * r Couldn't match expected type Float against inferred type Integer In the expression : 3.14 *r * r ... Further, i think there's a problem with the surface function, since it's not typed. Thanks for your help. Didier.