this is the original question:
Write a function
showAreaOfCircle
which, given the radius of a circle, calculates the area of the circle,
showAreaOfCircle 12.3
⇒"The area of a circle with radius 12.3cm is about 475.2915525615999 cm^2"
Use the
show
function, as well as the predefined valuepi :: Floating a => a
to writeshowAreaOfCircle
.the type signature works for this function is: showAreaOfCircle :: (Show a, Floating a) => a -> a -> Stringmy question is : I don't quite understand the syntax behind the parenthesis and the type class Floating a. Since pi is not a function, and hence the entire function only takes one argument which belongs to the type class Show, why should i put a Floating a in the type signature in the first place?(i come up with this type signature because of the error message and the suggestion stated above) Thanks
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners