The Pythagorean theorem is a^2 + b^2 = c^2. w and h are bad choices and confused me as they appear to represent height and width, not the two sides of a right triangle.
So I suggest that you change the exercise to expect this, to be clearer:
diagonal a b = sqrt (a * a + b * b)