Support hls-hlint-plugin and hls-stylish-plugin for ghc9.0 and ghc9.2#2854
Support hls-hlint-plugin and hls-stylish-plugin for ghc9.0 and ghc9.2#2854mergify[bot] merged 17 commits intohaskell:masterfrom
Conversation
|
What about 9.0? Should be able to play the same trick |
Haha, sorry for my unclear words, I just want to express that this pr will support hlint-plugin and stylish-haskell-plugin to 9.2(include any version less than 9.2) |
cabal-ghc92.project
Outdated
| hlint +ghc-lib, | ||
| stylish-haskell +ghc-lib | ||
|
|
||
| source-repository-package |
There was a problem hiding this comment.
Why do we need this? when can we remove it?
There was a problem hiding this comment.
Due to the limitation of hls-hlint-plugin code structure, we must force ghc-lib-parser uses ghc-lib instead of ghc to make compile, this repo adds a flag to allow us to force use ghc-lib in stylish-haskell(or is there another way to do this with out edit the package?)
Why do we have to use
ghc-lib?
- We have two code path in hls-hlint-plugin, includes using
ghcand usingghc-lib. theghccodebase relies on our compiled module bygetParsedModuleWithCommentswhich has someannoperation that ghc-9.2 has totally different views, we can makeghc-9.2also use this after some revise(Not much work, but will introduce more complex compat). Theghc-libcodebase parses the source code directly and we can use this for any ghc-lib easily. - We use
apply-refactto apply hlint, and for ghc before 9.2, it requiresapply-refact-0.9and in ghc-9.2, it needsapply-refact-0.10. Since inghccodebase we pass parsed module to apply-refact, it works in 0.9 but not in 0.10.apply-refact-0.10uses an internalIORef(https://github.com/mpickering/apply-refact/blob/cb8464af74ce9c1cee26fa4862c713bb5ff96114/src/Refact/Internal.hs#L751-L755) and the only entrance is parse the source byapply-refact. (https://github.com/mpickering/apply-refact/blob/cb8464af74ce9c1cee26fa4862c713bb5ff96114/src/Refact/Internal.hs#L709). If we still pass a parsed module toapply-refact-0.10, it crashed withundefined(https://github.com/mpickering/apply-refact/blob/cb8464af74ce9c1cee26fa4862c713bb5ff96114/src/Refact/Internal.hs#L557)
I think we can remove this after the new stylish-haskell with ghc-lib flag is released.
There was a problem hiding this comment.
It looks we can turn to ghc-lib and abandon ghc in hls-hlint-plugin, can we?
| , base >=4.12 && <5 | ||
| , filepath | ||
| , fourmolu ^>=0.3 || ^>=0.4 || ^>= 0.5 | ||
| , fourmolu ^>=0.3 || ^>=0.4 || ^>= 0.6 |
There was a problem hiding this comment.
Do we need to disallow 0.5 or should we just add 0.6?
There was a problem hiding this comment.
0.5 and 0.6 have the same requirements but 0.6 has bug fix, I don't think we have a reason to allow 0.5. https://github.com/fourmolu/fourmolu/blob/master/CHANGELOG.md
| , base >=4.12 && <5 | ||
| , containers | ||
| , ghc | ||
| -- Require ghc-exactprint >= 1.5 on ghc9.2 |
There was a problem hiding this comment.
did you mean to also actually change the bound?
There was a problem hiding this comment.
oops, I think we can only add a constraint in .project or stack-x.yaml since ghc-exactprint-0.6 is required from ghc8 to ghc9.0. I'll add a comment here.
Unfuntunately, just a comment.
There was a problem hiding this comment.
You could have a cabal conditional based on the GHC version? Maybe it's not worth it.
|
I think this pr is ready to be merged. Everything is ok except the nix config, we have a working pr to upgrade it, #2853, we can add nix contents after nix scripts upgrade. |
eddiemundo
left a comment
There was a problem hiding this comment.
LGTM. Can't comment on the ghc-lib stuff because I never really understood it.
…haskell#2854) * hls-hlint-plugin & hls-stylish-haskell-plugin rush to ghc92 * Restore allow-newer * Add BufSpan for lower version ghc * Add Cabal constraint for stack-9.0.1.yaml * Try ghc-lib-parser for BufSpan * Loose tactic compiling constraint * Rename hlint34 * Rerun test * Update doc * Comment ghc-exactprint requirements * Add test for apply-refact-0.10 * Use hackage stylish-haskell * ghc-exactprint constraints for hls-class-plugin * Remove uncompiled if Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…haskell#2854) * hls-hlint-plugin & hls-stylish-haskell-plugin rush to ghc92 * Restore allow-newer * Add BufSpan for lower version ghc * Add Cabal constraint for stack-9.0.1.yaml * Try ghc-lib-parser for BufSpan * Loose tactic compiling constraint * Rename hlint34 * Rerun test * Update doc * Comment ghc-exactprint requirements * Add test for apply-refact-0.10 * Use hackage stylish-haskell * ghc-exactprint constraints for hls-class-plugin * Remove uncompiled if Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
No description provided.