将 hlint 参数传递给 ghc-mod 的正确方法?

Proper Way To Pass hlint Arguments to ghc-mod?

我正在尝试使用 ghc-mod 对文件进行 lint。我知道 ghc-mod 为此使用 hlint,我知道 hlint 接受参数以 mod 验证它报告的建议。例如,这很好用:

eric@linux-epth:total-beginner-haskell$ hlint src/Borrower.hs --hint=Generalise
src/Borrower.hs:44:3: Suggestion: Use mappend
Found:
getName br ++
" (" `mappend` show (getMaxBooks br) `mappend` " books)"
Why not:
getName br `Data.Monoid.mappend`
(" (" `mappend` show (getMaxBooks br) `mappend` " books)")

1 hint

这是 ghc-mod 向 hlint 传递参数所需的格式:

Usage: ghc-mod lint [-h|--hlintOpt ARG] FILE

但是下面的 none 个变体会产生上面显示的提示:

eric@linux-epth:total-beginner-haskell$ ghc-mod lint -h hint=Generalise src/Borrower.hs
eric@linux-epth:total-beginner-haskell$ ghc-mod lint --hlintOpt hint=Generalise src/Borrower.hs
eric@linux-epth:total-beginner-haskell$ ghc-mod lint --hlintOpt "--hint=Generalise" src/Borrower.hs
eric@linux-epth:total-beginner-haskell$ ghc-mod lint --hlintOpt '--hint=Generalise' src/Borrower.hs

与 ghc-mod 一起使用以将参数传递给 hlint 的正确格式是什么?

谢谢。

好像是ghc-mod的bug:

问题:https://github.com/DanielG/ghc-mod/issues/826

它已经修复并合并到 master,但尚未发布。

由于问题的里程碑是 v5.8.0.0,它可能会在该版本中得到修复。

我从 Github 的最新 master 分支构建了 ghc-mod,并确认以下命令有效:

$ ghc-mod lint src/Borrower.hs  --hlintOpt='--hint=Generalise.hs'
src/Borrower.hs:1:8: Suggestion: Use mappendFound:  getName br ++    " (" `mappend` show (getMaxBooks br) `mappend` " books)"Why not:  getName br `Data.Monoid.mappend`    (" (" `mappend` show (getMaxBooks br) `mappend` " books)"

这是我从 Github.

构建最新 ghc-mod 所执行的步骤
$ git clone https://github.com/DanielG/ghc-mod
$ cd ghc-mod
$ stack init --ignore-subdirs --solver
$ stack build