How to Write a Type Checker/Type Inferrer With Good Error Messages