Hindley–Milner type inference algorithm