September 22, 1999 Strong Typing Slide #17

Big Deal?

The big deal is that you do not need to declare types!

        fun fact 0 = 1
          | fact n = n * fact(n-1);

Compiler says to itself:

Then it prints:

        val fact = fn : int -> int

Then you look at the type. Is int -> int what you expected?

Yes? OK then!

If not, your program almost certainly has a bug.


Next Copyright © 1999 M-J. Dominus