-
Couldn't load subscription status.
- Fork 203
Description
Consider these hints:
- warn: {lhs: zipWith f y (repeat z), rhs: map (\x -> f x z) y}
- warn: {lhs: zip (map f x) x, rhs: "map (\\y -> (f y, y)) x"}Both of them bind a new variable in the RHS, and refer to a variable from the LHS in the same scope. HLint will blindly use the variable name from the hint as-is, even if it needs to be alpha-converted to be correct. This will result in HLint incorrectly suggesting that zipWith f xs (repeat x) be replaced with map (\x -> f x x) xs, and that zip (map y xs) xs be replaced with map (\y -> (y y, y)) xs. It should instead suggest, e.g., map (\x_ -> f x_ x) xs and map (\y_ -> (y y_, y_)) xs (which is similar to what it does in some other circumstances, such as #1132, when it automatically converts an infix section to a lambda). I worked around this for the first given hint in #1131, and the merge of #1178 is currently blocked due to this.