Walk the expression tree. At every node, generate fresh type variables for anything you don't know yet. When two things must be the same type, unify them. When unification fails, that's a type error.
Algorithm W in one sentence from the Loon introduction.
















