| Next | Atypical Types | 43 |
| fact :: | (Num a) => a -> b |
| n :: | (Num a) => a |
"n has type (Num a) => a."
fact 0 = 1
fact n = n * fact(n-1)
"* requires two arguments of the same type, both instances of Num."
"So fact must return (Num a) => a also."
| Next | ![]() |
Copyright © 1999,2008 Mark Dominus |