When running HaskellLintBear on the following code:
wrapAsteroidP :: V2 Float -> V2 Float
wrapAsteroidP p = fmap f p
where f x = if (x < (-worldSize))
then x + (2 * worldSize)
else if (x > worldSize)
then x - (2 * worldSize)
else x
...we get the exception:
[DEBUG][14:51:32] Running 'hlint --json /home/pauls/HAsteroids/src/Asteroid.hs'
[DEBUG][14:51:32] The bear HaskellLintBear raised an exception. If you are the author of this bear, please make sure to catch all exceptions. If not and this error annoys you, you might want to get in contact with the author of this bear.
Traceback information is provided below:
Traceback (most recent call last):
File "/home/pauls/.local/lib/python3.7/site-packages/coalib/bears/Bear.py", line 282, in execute
return [] if result is None else list(result)
File "/home/pauls/.local/lib/python3.7/site-packages/bears/haskell/HaskellLintBear.py", line 44, in process_output
assert len(from_lines) == len(to_lines)
AssertionError
This appears to be because the change hlint is suggesting is multi-line, with the result being longer than the original.
src/Asteroid.hs:69:9: Suggestion: Use guards
Found:
f x
= if (x < (-worldSize)) then x + (2 * worldSize) else
if (x > worldSize) then x - (2 * worldSize) else x
Why not:
f x
| (x < (-worldSize)) = x + (2 * worldSize)
| (x > worldSize) = x - (2 * worldSize)
| otherwise = x
When running HaskellLintBear on the following code:
...we get the exception:
This appears to be because the change
hlint
is suggesting is multi-line, with the result being longer than the original.The JSON returned by
hlint
is: