
16 Jan
2009
16 Jan
'09
4:18 a.m.
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 output: 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.