Refactored TypeCheck.hs to use ErrorT.