Next Atypical Types 41

Type inference

fact ::(Num a) => a -> b

"0 has type (Num a) => a."

        fact 0 = 1
        fact n = n * fact(n-1)

"So n must have that type too."

Next Copyright © 1999,2008 Mark Dominus