haskellemacsflycheckhlint

is there a command to apply hlint suggestions in emacs?


I'm using flycheck and haskell-hlint in emacs when I write Haskell codes and I think it will be great if I can apply those hlint suggestions by invoking some emacs procedures instead of modifying the code manually.

If there isn't one available and in case I have to write this procedure for myself:

Is it guaranteed that hlint output is always of the following form:

Found:
  {Text1}
Why not:
  {Text2}

where {Text?} can always be parsed as a Haskell abstract syntax tree?


Solution

  • HLint comes with an Emacs script hs-lint.el that does the replacement you are after, details are in the README. The script isn't officially supported by the HLint developer, but some people have had some success with it.

    Separately, there are plans to provide a proper replacement feature in HLint, which if provided would be easy to integrate with Emacs. While it's always been on the back-burner, there are now people working on the necessary whitespace-aware-syntax-replacement libraries that HLint requires.