
On 4/28/06, Aditya Siram
type Point = (Int,Int) distBetween :: Point -> Point -> Float
ERROR - Type error in explicitly typed binding *** Term : distBetween *** Type : Point -> Point -> Int *** Does not match : Point -> Point -> Float
distBetween :: Point -> Point -> Int
Instance of Floating Int required for definition of distBetween
It's saying that you explicitly gave the function the type "Point -> Point -> Int" but that it actually has "Point -> Point -> Int". If you look at the type of sqrt: Prelude> :t sqrt sqrt :: (Floating a) => a -> a You'll see that it returns a floating-point number. (Also, a minor style point: you should probably get in the habit of putting a space between the "sqrt" and its arguments. It'll make more sense as you gain more experience.)