[Haskell-cafe] Re: Type errors, would extensions help?

Gleb Alexeyev gleb.alexeev at gmail.com
Fri Jan 16 04:18:22 EST 2009

Mauricio wrote:

> After you pointed my dumb mistake, I was able to build
> the first example -- without any of the extensions! Haskell
> can be misterious some times.
> Strange enough, I can't get the original (and, to my eyes,
> equal) problem to work. 

Indeed Haskell can be misterious sometimes. Now that you fixed the typo 
the first example compiles, but I think you will be surprised with its 
1 % 5
5 % 1
As you can see, the type of printNumber is still monomorphic for the 
reasons explained by Ryan Ingram and Lennart Augustsson. It's only the 
peculiarity of the numeric classes in Haskell that makes two your 
examples different - the constant `5.0' has type `(Fractional t) => t', 
and (Ratio a) is an instance of Fractional.

More information about the Haskell-Cafe mailing list