Haskell uses type classes to support ad hoc polymorphism, or overloading. Consider the statement:
(4.2::Fractional a=> a) + (4::Float)
Float is an instance of the type class Fractional. That is: methods which are defined for all fractional types must be defined for floats.
The compiler infers that (4.2::Fractional a=>a) must have type float, as it is being added to a float.
This is compatible with the original type of the expression, as Float is an instance of fractional, so it is valid to read 4.2 as a Float.
(4.2::Fractional a=> a) + (4::Float)
Float is an instance of the type class Fractional. That is: methods which are defined for all fractional types must be defined for floats.
The compiler infers that (4.2::Fractional a=>a) must have type float, as it is being added to a float. This is compatible with the original type of the expression, as Float is an instance of fractional, so it is valid to read 4.2 as a Float.
This diagram might help: http://www.haskell.org/onlinereport/basic.html#sect6.3