Type variable tidying for better error reporting