started textbook implementation of HM type inference