Inferred type is not general enough