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 value `pi :: Floating a => a`

to write `showAreaOfCircle`

.

the type signature works for this function is: showAreaOfCircle :: (Show a, Floating a) => a -> a -> String

my 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

[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners