Inferring correct return type for length/modulus