COMP 302 Lecture Notes - Lecture 19: Pattern Matching, Type Inference, Type System
Document Summary
We learned about type variables and type inference. We learnt how to figure out the types of variable with unannotated code. To goal was to make the most general guess consistent with the constraints. The same flexibility in the type system that allows you to have polymorphism is the same thing that lets you do type inference. We did the map example, though it was kind of confusing, as he wrote it like this: map = fun f -> fun l -> As we are more used to seeing stuff like this: map f l = The latter one is just training wheels" for those not used to seeing functions. An expression (e), a type ((cid:555)), and a context to which we have assigned types to variables ( ). And an additional ingredient, c, which is a set of constraints expressed as equations.