For the distance between two Points, without changing the function declaration, I keep getting this error "Couldn't match expected type ‘b’ with actual type ‘a’ ‘a’ is a rigid type variable bound by the type signature for:"
type Point a = (a,a)
distance :: (Real a, Floating b) => Point a -> Point a -> b
distance (x1,y1) (x2,y2) = sqrt ((dx * dx) + (dy * dy))
where dx = x2 - x1
dy = y2 - y1
realToFrac
to the result ofsqrt
? – jakubdaniel