| Next | Atypical Types | 37 |
In particular, this works:
163 + 13.5
163 gets the same type as 13.5 here
An appropriate value is manufactured by an appropriate version of fromInteger
No nonsense like this:
double fahrenheit = 98.6;
double celsius1 = 5/9 * (fahrenheit - 32);
double celsius2 = (fahrenheit - 32) * 5/9;
printf("%.1f\n%.1f\n", celsius1, celsius2);
/* This is why we love C */
0.0
37.0
A constant like 163 actually has this type:
(Num a) => a
"Any type a, as long as it's an instance of Num."
| Next | ![]() |
Copyright © 1999,2008 Mark Dominus |