Make HLint ignore parse error due to multi-way if?
Asked Answered
W

1

8

I'm using the MultiWayIf language extension. While I love HLint (I'm using version v1.8.61), unfortunately it appears that HLint is not aware of this extension, and it reports multi-way ifs as parse errors: Warning: Parse error: |

The HLint Manual (http://community.haskell.org/~ndm/darcs/hlint/hlint.htm) describes how you can use pragmas to indicate suggestions to ignore; however, this doesn't seem to work for warnings due to parse errors.

Is there any way to tell HLint to ignore the parse error warnings? Thank you!

Witkowski answered 18/5, 2014 at 19:52 Comment(1)
What version of haskell-src-exts is it linked with? The changelog for HSE says it added support for MultiWayIf in 1.15.William
F
7

You can run:

hlint "--ignore=Parse error" MyFile.hs

There is a test that this invocation works in the HLint test suite.

Note that as soon as there is a parse error you won't get any other hints from the file, since HLint can't operate on a file until it is parsed.

However, if you upgrade to haskell-src-exts-1.15 or higher then reinstall HLint it should parse multi-way-if fine. If not, please report a bug.

Fewness answered 19/5, 2014 at 5:41 Comment(1)
Upgrading haskell-src-exts and reinstalling HLint (cabal install --reinstall hlint) worked for me. Thank you very much!Witkowski

© 2022 - 2024 — McMap. All rights reserved.